setting text for wait dialog

This commit is contained in:
DYefremov
2020-04-27 17:00:52 +03:00
parent 7a4620a374
commit ba3ad9a9ef
2 changed files with 12 additions and 5 deletions

View File

@@ -26,11 +26,11 @@ THE SOFTWARE.
Author: Dmitriy Yefremov
-->
<interface>
<interface domain="demon-editor">
<requires lib="gtk+" version="3.16"/>
<!-- interface-license-type mit -->
<!-- interface-name DemonEditor -->
<!-- interface-description Enigma2 channel and satellites list editor for MacOS. -->
<!-- interface-description Enigma2 channel and satellites list editor for macOS. -->
<!-- interface-copyright 2018-2020 Dmitriy Yefremov -->
<!-- interface-authors Dmitriy Yefremov -->
<object class="GtkAboutDialog" id="about_dialog">
@@ -195,6 +195,8 @@ Author: Dmitriy Yefremov
<object class="GtkLabel" id="wait_dialog_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">10</property>
<property name="margin_right">10</property>
<property name="label" translatable="yes">Loading data...</property>
</object>
<packing>

View File

@@ -52,12 +52,17 @@ class WaitDialog:
builder, dialog = get_dialog_from_xml(DialogType.WAIT, transient)
self._dialog = dialog
self._dialog.set_transient_for(transient)
if text is not None:
builder.get_object("wait_dialog_label").set_text(text)
self._label = builder.get_object("wait_dialog_label")
self._default_text = text or self._label.get_text()
def show(self):
def show(self, text=None):
self.set_text(text)
self._dialog.show()
@run_idle
def set_text(self, text):
self._label.set_text(get_message(text or self._default_text))
@run_idle
def hide(self):
self._dialog.hide()