def __init__(self, actions, parent=None): width, height, color = 700, 400, "#aaa" DialogBox.__init__(self, width, height, color, parent) Observable.__init__(self) self.registerObserver(self) self.actions = actions self.catsActions = { "google": self.google, "wikipedia": self.wikipedia, "all": self.showAllCommands } c = '|'.join(self.getAllActions()) self.re_pre_cmd = re.compile(r'^(%s)\s*(.*)'%c) self.re_post_cmd = re.compile(r'^([^\s]*)\s+(%s)'%c) self.createUI(width) self.complectionList.registerObserver(self) self.complectionList.registerObserver(self.cmd) self.cmd.registerObserver(self) self.cmd.registerObserver(self.complectionList)
def show(self, text): self.selected_text = text return DialogBox.show(self)
def keyPressEvent(self, event): if event.key() == Qt.Key_Escape: self.hide() return DialogBox.keyPressEvent(self, event)
def show(self, *args, **kwargs): self.path = "" return DialogBox.show(self, *args, **kwargs)