def __bmOk(self): print "[BrowserMenu].__bmOk" if self.detailList.index > 0 and self.detailList.getCurrent() != None: current = self.detailList.getCurrent()[0] print "[BrowserMenu].__bmOk, current = '%s'" % current self.__actions.append((self.ACTION_BOOKMARK, current.url)) self.close(self.__actions) else: self.__bmAdd(Bookmark(-1, self.currentTitle, self.currentUrl))
def __bmBuildList(self): print "[BrowserMenu].__bmBuildList" list = [] #Suggest current page for adding default = Bookmark(-2, _("Add '%s' to Bookmarks" %self.currentTitle), self.currentUrl) list.append(self.__bmGetEntryComponent(default)) for b in self.__bmList: list.append(self.__bmGetEntryComponent(b)) self.detailList.setList(list)
def __init__(self, session, bookmark = None): Screen.__init__(self, session) self.bookmark = bookmark if self.bookmark == None: self.bookmark = Bookmark() self["nameTitle"] = StaticText(_("Name:")) self["urlTitle"] = StaticText(_("Url:")) self["nameActive"] = Label("<") self["urlActive"] = Label("<") self.inputName = EnhancedInput( self.bookmark.name ) self["name"] = self.inputName self.inputUrl = EnhancedInput( self.bookmark.url ) self["url"] = self.inputUrl self.onShow.append(self.setKeyboardModeAscii) self["actions"] = ActionMap(["SimpleEditorActions"], { "ok" : self.__ok, "exit" : self.__cancel, "up" : self.__up, "down" : self.__down, "left" : self.__left, "right" : self.__right, "ascii" : self.__ascii, "delete" : self.__delete, "backspace" : self.__backspace }) self["numberactions"] = NumberActionMap(["NumberActions"], { "1": self.__keyNumberGlobal, "2": self.__keyNumberGlobal, "3": self.__keyNumberGlobal, "4": self.__keyNumberGlobal, "5": self.__keyNumberGlobal, "6": self.__keyNumberGlobal, "7": self.__keyNumberGlobal, "8": self.__keyNumberGlobal, "9": self.__keyNumberGlobal, "0": self.__keyNumberGlobal }) self.nameFocus = False self.onShow.append(self.__toggleInput)