711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
|
self.add_attribute(cell, "text", 1)
if no_scroll:
self.connect("scroll_event", self.no_scroll)
# collect entries
self.ls = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
self.set_model(self.ls)
entries = entries.items()
if type(entries[0]) is not tuple:
entries = zip(entries, entries)
for key,value in entries:
self.ls.append([key, value])
# activate dropdown of given value
def set_default(self, value):
for index,row in enumerate(self.ls):
if value in row:
return self.set_active(index)
|
>
|
|
|
|
|
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
|
self.add_attribute(cell, "text", 1)
if no_scroll:
self.connect("scroll_event", self.no_scroll)
# collect entries
self.ls = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
self.set_model(self.ls)
if isinstance(entries, str):
entries = ComboBoxText.parse_options(entries)
if isinstance(entries, list):
entries = dict(zip(entries, entries))
for key,value in entries.items():
self.ls.append([key, value])
# activate dropdown of given value
def set_default(self, value):
for index,row in enumerate(self.ls):
if value in row:
return self.set_active(index)
|