Index: mygtk.py ================================================================== --- mygtk.py +++ mygtk.py @@ -448,18 +448,20 @@ # class ComboBoxText(gtk.ComboBox): ls = None - def __init__(self, entries): + def __init__(self, entries, no_scroll=1): # prepare widget gtk.ComboBox.__init__(self) self.set_property("visible", True) cell = gtk.CellRendererText() self.pack_start(cell, True) 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 type(entries[0]) is not tuple: @@ -479,14 +481,19 @@ # fetch currently selected text entry def get_active_text(self): index = self.get_active() if index >= 0: return self.ls[index][0] + + # Signal/Event callback to prevent hover scrolling of ComboBox widgets + def no_scroll(self, widget, event, data=None): + return True + # Expand A=a|B=b|C=c option list into (key,value) tuple list, or A|B|C just into a list. @staticmethod def parse_options(opts, sep="|", assoc="="): if opts.find(assoc) >= 0: return [ (k,v) for k,v in (x.split(assoc, 1) for x in opts.split(sep)) ] else: return opts.split(sep) #dict( (v,v) for v in opts.split(sep) )