@@ -38,6 +38,10 @@ class OomoxListBoxRow(Gtk.ListBoxRow, metaclass=GObjectABCMeta):
38
38
callback = None
39
39
value_widget = None
40
40
hbox = None
41
+
vbox = None
42
+
43
+
description_label = None
44
+
_description_label_added = False
41
45
42
46
@g_abstractproperty
43
47
def set_value(self, value):
@@ -52,17 +56,36 @@ def __init__(self, display_name, key, callback, value_widget):
52
56
self.hbox = Gtk.Box(
53
57
orientation=Gtk.Orientation.HORIZONTAL, spacing=50, margin=LIST_ITEM_MARGIN
54
58
)
55
-
self.add(self.hbox)
56
59
label = Gtk.Label(label=display_name, xalign=0)
57
60
self.hbox.pack_start(label, True, True, 0)
58
61
59
62
self.value_widget = value_widget
60
63
self.hbox.pack_start(self.value_widget, False, True, 0)
61
64
65
+
self.vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
66
+
self.add(self.vbox)
67
+
self.vbox.add(self.hbox)
68
+
62
69
def disconnect_changed_signal(self):
63
70
if self.changed_signal:
64
71
self.value_widget.disconnect(self.changed_signal)
65
72
73
+
def set_description(self, description_text=None):
74
+
if description_text:
75
+
if not self._description_label_added:
76
+
self.description_label = Gtk.Label(xalign=1)
77
+
self.description_label.set_margin_top(3)
78
+
self.description_label.set_margin_bottom(7)
79
+
self.description_label.set_state_flags(Gtk.StateFlags.INSENSITIVE, False)
80
+
self.vbox.add(self.description_label)
81
+
self.description_label.show()
82
+
self._description_label_added = True
83
+
self.description_label.set_text(description_text)
84
+
else:
85
+
if self._description_label_added:
86
+
self.vbox.remove(self.description_label)
87
+
self._description_label_added = False
88
+
66
89
67
90
class NumericListBoxRow(OomoxListBoxRow):
68
91
@@ -187,9 +210,6 @@ def __init__(self, display_name, key, callback):
187
210
class OptionsListBoxRow(OomoxListBoxRow):
188
211
189
212
options = None
190
-
vbox = None
191
-
description_label = None
192
-
_description_label_added = False
193
213
194
214
def connect_changed_signal(self):
195
215
self.changed_signal = self.value_widget.connect("changed", self.on_dropdown_changed)
@@ -206,17 +226,10 @@ def set_value(self, value):
206
226
if value == option['value']:
207
227
self.value_widget.set_active(option_idx)
208
228
if 'description' in option:
209
-
self.show_description_label()
210
-
self.description_label.set_text(option['description'])
229
+
self.set_description(option['description'])
211
230
break
212
231
self.connect_changed_signal()
213
232
214
-
def show_description_label(self):
215
-
if not self._description_label_added:
216
-
self.vbox.add(self.description_label)
217
-
self.description_label.show()
218
-
self._description_label_added = True
219
-
220
233
def __init__(self, display_name, key, options, callback):
221
234
self.options = options
222
235
options_store = Gtk.ListStore(str)
@@ -234,16 +247,6 @@ def __init__(self, display_name, key, options, callback):
234
247
value_widget=dropdown
235
248
)
236
249
237
-
self.remove(self.hbox)
238
-
self.vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
239
-
self.add(self.vbox)
240
-
self.vbox.add(self.hbox)
241
-
242
-
self.description_label = Gtk.Label(xalign=1)
243
-
self.description_label.set_margin_top(3)
244
-
self.description_label.set_margin_bottom(7)
245
-
self.description_label.set_state_flags(Gtk.StateFlags.INSENSITIVE, False)
246
-
247
250
248
251
class OomoxColorSelectionDialog(Gtk.ColorSelectionDialog):
249
252
@@ -628,6 +631,7 @@ def _callback(key, value):
628
631
if theme_value['type'] in ('separator', ):
629
632
section_box.add_title(row)
630
633
else:
634
+
row.set_description(theme_value.get('description'))
631
635
section_box.add(row)
632
636
633
637
self.mainbox.add(section_box)
@@ -660,9 +664,9 @@ def open_theme(self, theme): # pylint: disable=too-many-branches
660
664
if not check_value_filter(theme_value['value_filter'], theme):
661
665
row.hide()
662
666
continue
663
-
if theme_value['type'] in [
664
-
'color', 'options', 'bool', 'int', 'float', 'image_path'
665
-
]:
667
+
if theme_value['type'] in (
668
+
'color', 'options', 'bool', 'int', 'float', 'image_path',
669
+
):
666
670
row.set_value(theme[key])
667
671
row.show()
668
672
rows_displayed_in_section += 1
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4