+ cursel = self["list"].l.getCurrentSelection()
+ if cursel:
+ self.goEntry(cursel[0])
+ else:
+ self.cancel()
+
+ # runs a specific entry
+ def goEntry(self, entry):
+ if len(entry) > 2 and isinstance(entry[1], str) and entry[1] == "CALLFUNC":
+ # CALLFUNC wants to have the current selection as argument
+ arg = self["list"].l.getCurrentSelection()[0]
+ entry[2](arg)
+ else:
+ self.close(entry)
+
+ # lookups a key in the keymap, then runs it
+ def goKey(self, key):
+ if self.keymap.has_key(key):
+ entry = self.keymap[key]
+ self.goEntry(entry)
+
+ # runs a color shortcut
+ def keyRed(self):
+ self.goKey("red")
+
+ def keyGreen(self):
+ self.goKey("green")
+
+ def keyYellow(self):
+ self.goKey("yellow")
+
+ def keyBlue(self):
+ self.goKey("blue")
+
+ def updateSummary(self, curpos=0):
+ pos = 0
+ summarytext = ""
+ for entry in self.summarylist:
+ if pos > curpos-2 and pos < curpos+5:
+ if pos == curpos:
+ summarytext += ">"
+ else:
+ summarytext += entry[0]
+ summarytext += ' ' + entry[1] + '\n'
+ pos += 1
+ self["summary_list"].setText(summarytext)
+