New feature to allow added rules to define their own GUI elements
This commit is contained in:
parent
eb36980715
commit
3ba2253ac0
@ -141,7 +141,9 @@ class Rule:
|
|||||||
|
|
||||||
def display_values(self):
|
def display_values(self):
|
||||||
"""Return the labels and values of this rule."""
|
"""Return the labels and values of this rule."""
|
||||||
l_v = ( '%s="%s"' % (_(self.labels[ix]), self.list[ix])
|
l_v = ('%s="%s"' % (_(self.labels[ix][0] if
|
||||||
|
isinstance(self.labels[ix], tuple) else
|
||||||
|
self.labels[ix]), self.list[ix])
|
||||||
for ix in range(len(self.list)) if self.list[ix])
|
for ix in range(len(self.list)) if self.list[ix])
|
||||||
|
|
||||||
return ';'.join(l_v)
|
return ';'.join(l_v)
|
||||||
|
@ -501,6 +501,10 @@ class EditRule(ManagedWindow):
|
|||||||
grid.set_row_spacing(6)
|
grid.set_row_spacing(6)
|
||||||
grid.show()
|
grid.show()
|
||||||
for v in arglist:
|
for v in arglist:
|
||||||
|
if isinstance(v, tuple):
|
||||||
|
# allows filter to create its own GUI element
|
||||||
|
l = Gtk.Label(label=v[0], halign=Gtk.Align.END)
|
||||||
|
else:
|
||||||
l = Gtk.Label(label=v, halign=Gtk.Align.END)
|
l = Gtk.Label(label=v, halign=Gtk.Align.END)
|
||||||
l.show()
|
l.show()
|
||||||
if v == _('Place:'):
|
if v == _('Place:'):
|
||||||
@ -585,6 +589,9 @@ class EditRule(ManagedWindow):
|
|||||||
elif v == _('Units:'):
|
elif v == _('Units:'):
|
||||||
t = MyList([0, 1, 2],
|
t = MyList([0, 1, 2],
|
||||||
[_('kilometers'), _('miles'), _('degrees')])
|
[_('kilometers'), _('miles'), _('degrees')])
|
||||||
|
elif isinstance(v, tuple):
|
||||||
|
# allow filter to create its own GUI element
|
||||||
|
t = v[1](self.db)
|
||||||
else:
|
else:
|
||||||
t = MyEntry()
|
t = MyEntry()
|
||||||
t.set_hexpand(True)
|
t.set_hexpand(True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user