def __init__(self, session, title="", text=""):
        #VirtualKeyBoard.__init__(self, session, title, text) Changed by Topfi, added parameter names
        VirtualKeyBoard.__init__(self, session, title=title, text=text)
        NumericalTextInput.__init__(self, nextFunc=self.nextFunc)
        SkinResolutionHelper.__init__(self)
        self.configText = None
        if config.AdvancedMovieSelection.keyboard.value == "virtual":
            use = self.KEYBOARD
        elif config.AdvancedMovieSelection.keyboard.value == "numerical":
            use = self.NUM_KEYB
        else:
            use = self.BOTH
        if not use & self.KEYBOARD:
            # hide the keyboard
            self["list"].hide()
            # overwrite VirtualKeyBoard actions
            # make sure not overwrite any action of base class
            self["actions"] = ActionMap(["OkCancelActions", "WizardActions", "ColorActions", "KeyboardInputActions", "InputBoxActions", "InputAsciiActions"],
            {
                "ok": self.__ok,
                "cancel": self.__cancel,
                "left": self.dummy,
                "right": self.dummy,
                "up": self.dummy,
                "down": self.dummy,
                "red": self.__cancel,
                "green": self.__ok,
                "yellow": self.dummy,
                "deleteBackward": self.dummy,
                "back": self.dummy
            }, -2)

        if use & self.NUM_KEYB:
            self.timer = eTimer()
            self.timer.callback.append(self.timeout)
            self.configText = ConfigText("", False)
            if text:
                self.configText.text = text
                self.configText.marked_pos = len(text)
            self["config_actions"] = NumberActionMap(["SetupActions", "InputAsciiActions", "KeyboardInputActions"],
            {
                "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
            }, -1) # to prevent left/right overriding the listbox
            if use & self.KEYBOARD:
                self.selectedKey = self.getKeyIndex(u"OK")

        self.onLayoutFinish.append(self.__onLayoutFinish)
        self.onClose.append(self.__onClose)
예제 #2
0
    def __init__(self, session, title="", text=""):
        #VirtualKeyBoard.__init__(self, session, title, text) Changed by Topfi, added parameter names
        VirtualKeyBoard.__init__(self, session, title=title, text=text)
        NumericalTextInput.__init__(self, nextFunc=self.nextFunc)
        SkinResolutionHelper.__init__(self)
        self.configText = None
        if config.AdvancedMovieSelection.keyboard.value == "virtual":
            use = self.KEYBOARD
        elif config.AdvancedMovieSelection.keyboard.value == "numerical":
            use = self.NUM_KEYB
        else:
            use = self.BOTH
        if not use & self.KEYBOARD:
            # hide the keyboard
            self["list"].hide()
            # overwrite VirtualKeyBoard actions
            # make sure not overwrite any action of base class
            self["actions"] = ActionMap(["OkCancelActions", "WizardActions", "ColorActions", "KeyboardInputActions", "InputBoxActions", "InputAsciiActions"],
            {
                "ok": self.__ok,
                "cancel": self.__cancel,
                "left": self.dummy,
                "right": self.dummy,
                "up": self.dummy,
                "down": self.dummy,
                "red": self.__cancel,
                "green": self.__ok,
                "yellow": self.dummy,
                "deleteBackward": self.dummy,
                "back": self.dummy                
            }, -2)

        if use & self.NUM_KEYB:
            self.timer = eTimer()
            self.timer.callback.append(self.timeout)
            self.configText = ConfigText("", False)
            if text:
                self.configText.text = text
                self.configText.marked_pos = len(text)
            self["config_actions"] = NumberActionMap(["SetupActions", "InputAsciiActions", "KeyboardInputActions"],
            {
                "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
            }, -1) # to prevent left/right overriding the listbox
            if use & self.KEYBOARD:
                self.selectedKey = self.getKeyIndex(u"OK") 
            
        self.onLayoutFinish.append(self.__onLayoutFinish)
        self.onClose.append(self.__onClose)
예제 #3
0
파일: Input.py 프로젝트: kingvuplus/eg-e2
 def __init__(self, text = '', maxSize = False, visible_width = False, type = TEXT, currPos = 0, allMarked = True):
     NumericalTextInput.__init__(self, self.right)
     GUIComponent.__init__(self)
     VariableText.__init__(self)
     self.type = type
     self.allmarked = allMarked and text != '' and type != self.PIN
     self.maxSize = maxSize
     self.currPos = currPos
     self.visible_width = visible_width
     self.offset = 0
     self.overwrite = maxSize
     self.setText(text)
예제 #4
0
	def __init__(self, text="", maxSize = False, visible_width = False, type = TEXT):
		NumericalTextInput.__init__(self, self.right)
		GUIComponent.__init__(self)
		VariableText.__init__(self)
		self.type = type
		self.allmarked = (text != "") and (type != self.PIN)
		self.maxSize = maxSize
		self.currPos = 0
		self.visible_width = visible_width
		self.offset = 0
		self.overwrite = maxSize
		self.setText(text)
예제 #5
0
	def __init__(self, text="", maxSize=False, visible_width=False, type=TEXT, currPos=0, allMarked=True):
		NumericalTextInput.__init__(self, self.right)
		GUIComponent.__init__(self)
		VariableText.__init__(self)
		self.type = type
		self.allmarked = allMarked and (text != "") and (type is not self.PIN)
		self.maxSize = maxSize
		self.currPos = currPos
		self.visible_width = visible_width
		self.offset = 0
		self.overwrite = maxSize
		self.setText(text)
예제 #6
0
	def __init__(self, default = "", fixed_size = True, visible_width = False):
		ConfigElement.__init__(self)
		NumericalTextInput.__init__(self, nextFunc = self.nextFunc, handleTimeout = False)

		self.marked_pos = 0
		self.allmarked = (default != "")
		self.fixed_size = fixed_size
		self.visible_width = visible_width
		self.offset = 0
		self.overwrite = fixed_size
		self.help_window = None
		self.value = self.last_value = self.default = default
예제 #7
0
	def __init__(self, default = "", fixed_size = True, visible_width = False):
		ConfigElement.__init__(self)
		NumericalTextInput.__init__(self, nextFunc = self.nextFunc, handleTimeout = False)

		self.marked_pos = 0
		self.allmarked = (default != "")
		self.fixed_size = fixed_size
		self.visible_width = visible_width
		self.offset = 0
		self.overwrite = fixed_size
		self.help_window = None
		self.value = self.last_value = self.default = default
예제 #8
0
    def __init__(self, session, title="", text=""):
        Screen.__init__(self, session)
        NumericalTextInput.__init__(self, nextFunc=self.nextFunc)
        self.setZPosition(10000)
        self.keys_list = []
        self.shiftkeys_list = []
        self.lang = language.getLanguage()
        self.nextLang = None
        self.shiftMode = False
        self.text = text
        self.selectedKey = 0
        self.editing = False

        self["country"] = StaticText("")
        self["header"] = Label(title)
        self["text"] = Label(self.text)
        self["list"] = VirtualKeyBoardList([])

        self["actions"] = ActionMap(
            [
                "OkCancelActions", "WizardActions", "ColorActions",
                "KeyboardInputActions", "InputBoxActions", "InputAsciiActions"
            ], {
                "gotAsciiCode": self.keyGotAscii,
                "ok": self.okClicked,
                "cancel": self.exit,
                "left": self.left,
                "right": self.right,
                "up": self.up,
                "down": self.down,
                "red": self.backClicked,
                "green": self.ok,
                "yellow": self.switchLang,
                "deleteBackward": self.backClicked,
                "back": self.exit
            }, -2)
        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.setLang()
        self.onExecBegin.append(self.setKeyboardModeAscii)
        self.onLayoutFinish.append(self.buildVirtualKeyBoard)
예제 #9
0
파일: Input.py 프로젝트: aitchala/enigma2
	def __init__(self, text="", maxSize = False, visible_width = False, type = TEXT):
		NumericalTextInput.__init__(self, self.right)
		GUIComponent.__init__(self)
		VariableText.__init__(self)
		self.type = type
		self.allmarked = (text != "") and (type != self.PIN)
		self.maxSize = maxSize
		self.currPos = 0
		self.visible_width = visible_width
		self.offset = 0
		self.overwrite = maxSize
		self.onInputUpdate = []
		self.setText(text)
예제 #10
0
파일: config.py 프로젝트: 4doe/enigma2-old
	def __init__(self, default = "", max_count=0):
		ConfigElement.__init__(self)
		NumericalTextInput.__init__(self, nextFunc = self.nextFunc, handleTimeout = False)

		self.marked_pos = 0
		self.allmarked = (default != "")
		self.offset = 0
		self.help_window = None
		self.value = self.last_value = self.default = default

		self.max_count=max_count
		self.current_count=0
		self.count_back=False
예제 #11
0
	def __init__(self, text="", overwrite = False, firstpos_end = False, visible_width = False, allmarked = True, type = TEXT):
		NumericalTextInput.__init__(self, self.right)
		GUIComponent.__init__(self)
		VariableText.__init__(self)
		self.type = type
		self.allmarked = allmarked 
		self.maxSize = overwrite
		self.currPos = 0
		self.visible_width = visible_width #50
		self.offset = 0
		self.firstpos_end = firstpos_end
		self.overwrite = overwrite
		self.setText(text)
예제 #12
0
	def __init__(self, session, title="", text=""):
		Screen.__init__(self, session)
		NumericalTextInput.__init__(self, nextFunc = self.nextFunc)
		self.setZPosition(10000)
		self.keys_list = []
		self.shiftkeys_list = []
		self.lang = language.getLanguage()
		self.nextLang = None
		self.shiftMode = False
		self.text = text
		self.selectedKey = 0
		self.editing = False

		self["country"] = StaticText("")
		self["header"] = Label(title)
		self["text"] = Label(self.text)
		self["list"] = VirtualKeyBoardList([])
		
		self["actions"] = ActionMap(["OkCancelActions", "WizardActions", "ColorActions", "KeyboardInputActions", "InputBoxActions", "InputAsciiActions"],
			{
				"gotAsciiCode": self.keyGotAscii,
				"ok": self.okClicked,
				"cancel": self.exit,
				"left": self.left,
				"right": self.right,
				"up": self.up,
				"down": self.down,
				"red": self.backClicked,
				"green": self.ok,
				"yellow": self.switchLang,
				"deleteBackward": self.backClicked,
				"back": self.exit				
			}, -2)
		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.setLang()
		self.onExecBegin.append(self.setKeyboardModeAscii)
		self.onLayoutFinish.append(self.buildVirtualKeyBoard)
예제 #13
0
 def __init__(self,
              text="",
              overwrite=False,
              firstpos_end=False,
              visible_width=False,
              allmarked=True,
              type=TEXT):
     NumericalTextInput.__init__(self, self.right)
     GUIComponent.__init__(self)
     VariableText.__init__(self)
     self.type = type
     self.allmarked = allmarked
     self.maxSize = overwrite
     self.currPos = 0
     self.visible_width = visible_width  #50
     self.offset = 0
     self.firstpos_end = firstpos_end
     self.overwrite = overwrite
     self.setText(text)
예제 #14
0
    def __init__(self, session):
        Screen.__init__(self, session)
        NumericalTextInput.__init__(self)

        self.session = session
        self.serverName = config.plugins.youtubeplayer.serverprofile.value
        self.currentServer = vlcServerConfig.getServerByName(self.serverName)

        self["red"] = Label(_("Select a VLC-Server"))
        self["green"] = Label(_("New YouTube search"))

        self.list = []
        self["list"] = YouTubeList(self.list)

        self["label_total_results"] = Label(_("Total results") + ":")
        self["total_results"] = Label("")

        self["label_currently_shown"] = Label(_("Shown") + ":")
        self["currently_shown"] = Label("")

        self.history = []
        self.historyIndex = 0

        self.isFavoritesFeed = False

        self.patientDialog = None

        self["actions"] = ActionMap(
            ["YouTubeVideoListActions"], {
                "play": self.tryToPlay,
                "select": self.justSelectServer,
                "search": self.searchAgain,
                "menu": self.openContextMenu,
                "forward": self.forwardInHistory,
                "backward": self.backInHistory,
                "left": self.keyLeft,
                "right": self.keyRight,
                "up": self.keyUp,
                "down": self.keyDown,
                "info": self.showVideoInfo,
                "cancel": self.close
            }, -1)
예제 #15
0
	def __init__(self, session):
		Screen.__init__(self, session)
		NumericalTextInput.__init__(self)

		self.session = session
		self.serverName = config.plugins.youtubeplayer.serverprofile.value
		self.currentServer = vlcServerConfig.getServerByName(self.serverName)

		self["red"] = Label(_("Select a VLC-Server"))
		self["green"] = Label(_("New YouTube search"))
		
		self.list = []
		self["list"] = YouTubeList(self.list)

		self["label_total_results"] = Label(_("Total results") + ":")
		self["total_results"] = Label("")

		self["label_currently_shown"] = Label(_("Shown") + ":")
		self["currently_shown"] = Label("")

		self.history = []
		self.historyIndex = 0

		self.isFavoritesFeed = False

		self.patientDialog = None
		
		self["actions"] = ActionMap(["YouTubeVideoListActions"],
		{
			"play"			:	self.tryToPlay,
			"select"		:	self.justSelectServer,
			"search"		:	self.searchAgain,
			"menu"			:	self.openContextMenu,
			"forward"		:	self.forwardInHistory,
			"backward"		:	self.backInHistory,
			"left"			:	self.keyLeft,
			"right"			:	self.keyRight,
			"up"			:	self.keyUp,
			"down"			:	self.keyDown,
			"info"			:	self.showVideoInfo,
			"cancel"		:	self.close
		}, -1)
예제 #16
0
	def __init__(self, session, **kwargs):
		VirtualKeyBoard.__init__(self, session, **kwargs)
		NumericalTextInput.__init__(self, nextFunc=self.nextFunc)

		self.skinName = "VirtualKeyBoard"

		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.editing = False
	def __init__(self, session, **kwargs):
		VirtualKeyBoard.__init__(self, session, **kwargs)
		NumericalTextInput.__init__(self, nextFunc = self.nextFunc)

		self.skinName = "VirtualKeyBoard"

		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.editing = False
예제 #18
0
	def __init__(self, default = "", fixed_size = False, visible_width = False):
		ConfigText.__init__(self, default = default, fixed_size = fixed_size, visible_width = visible_width)
		NumericalTextInput.__init__(self, nextFunc = self.nextFunc, handleTimeout = False, search = True)
예제 #19
0
    def __init__(
        self,
        session,
        text="",
        filename="",
        currDir=None,
        bookmarks=None,
        userMode=False,
        windowTitle=_("Select location"),
        minFree=None,
        autoAdd=False,
        editDir=False,
        inhibitDirs=None,
        inhibitMounts=None,
    ):
        if not inhibitDirs:
            inhibitDirs = []
        if not inhibitMounts:
            inhibitMounts = []
        Screen.__init__(self, session)
        NumericalTextInput.__init__(self, handleTimeout=False)
        HelpableScreen.__init__(self)
        self.setUseableChars(u"1234567890abcdefghijklmnopqrstuvwxyz")
        self.qs_timer = eTimer()
        self.qs_timer.callback.append(self.timeout)
        self.qs_timer_type = 0
        self.curr_pos = -1
        self.quickselect = ""
        self["text"] = Label(text)
        self["textbook"] = Label(_("Bookmarks"))
        self.text = text
        self.filename = filename
        self.minFree = minFree
        self.realBookmarks = bookmarks
        self.bookmarks = bookmarks and bookmarks.value[:] or []
        self.userMode = userMode
        self.autoAdd = autoAdd
        self.editDir = editDir
        self.inhibitDirs = inhibitDirs
        self["filelist"] = FileList(
            currDir, showDirectories=True, showFiles=False, inhibitMounts=inhibitMounts, inhibitDirs=inhibitDirs
        )
        self["booklist"] = MenuList(self.bookmarks)
        self["key_green"] = Button(_("OK"))
        self["key_yellow"] = Button(_("Rename"))
        self["key_blue"] = Button(_("Remove bookmark"))
        self["key_red"] = Button(_("Cancel"))
        self["green"] = Pixmap()
        self["yellow"] = Pixmap()
        self["blue"] = Pixmap()
        self["red"] = Pixmap()
        self["target"] = Label()
        if self.userMode:
            self.usermodeOn()

        class LocationBoxActionMap(HelpableActionMap):
            def __init__(self, parent, context, actions=None, prio=0):
                if not actions:
                    actions = {}
                HelpableActionMap.__init__(self, parent, context, actions, prio)
                self.box = parent

            def action(self, contexts, action):
                self.box.timeout(force=True)
                return HelpableActionMap.action(self, contexts, action)

        self["WizardActions"] = LocationBoxActionMap(
            self, "WizardActions", {"ok": (self.ok, _("select")), "back": (self.cancel, _("Cancel"))}, -2
        )
        self["DirectionActions"] = LocationBoxActionMap(
            self, "DirectionActions", {"left": self.left, "right": self.right, "up": self.up, "down": self.down}, -2
        )
        self["ColorActions"] = LocationBoxActionMap(
            self,
            "ColorActions",
            {"red": self.cancel, "green": self.select, "yellow": self.changeName, "blue": self.addRemoveBookmark},
            -2,
        )
        self["EPGSelectActions"] = LocationBoxActionMap(
            self,
            "EPGSelectActions",
            {
                "prevService": (self.switchToBookList, _("switch to bookmarks")),
                "nextService": (self.switchToFileList, _("switch to filelist")),
            },
            -2,
        )
        self["MenuActions"] = LocationBoxActionMap(self, "MenuActions", {"menu": (self.showMenu, _("menu"))}, -2)
        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.onShown.extend(
            (boundFunction(self.setTitle, _("Select Location")), self.updateTarget, self.showHideRename)
        )
        self.onLayoutFinish.append(self.switchToFileListOnStart)
        self.onClose.append(self.disableTimer)
예제 #20
0
		def __init__(self, session):
			self.entriesWidth = DESKTOP_WIDTH * scaleH(75, 85) / 100
			self.height = DESKTOP_HEIGHT * 0.75
			numberFieldWidth = scaleH(220, 160)
			fieldWidth = self.entriesWidth - 5 - numberFieldWidth - 10
			fontSize = scaleV(22, 18)
			fontHeight = scaleV(24, 20)
			buttonGap = (self.entriesWidth - 4 * 140) / 5
			debug("[NcidDisplayPhonebook] width: " + str(self.entriesWidth))
			self.skin = """
				<screen name="NcidDisplayPhonebook" position="center,center" size="%d,%d" title="Phonebook" >
					<eLabel position="0,0" size="%d,2" backgroundColor="#aaaaaa" />
					<widget source="entries" render="Listbox" position="%d,%d" size="%d,%d" scrollbarMode="showOnDemand" transparent="1">
						<convert type="TemplatedMultiContent">
							{"template": [
									MultiContentEntryText(pos = (%d,%d), size = (%d,%d), font=0, flags = RT_HALIGN_LEFT, text = 1), # index 0 is the name, index 1 is shortname
									MultiContentEntryText(pos = (%d,%d), size = (%d,%d), font=0, flags = RT_HALIGN_LEFT, text = 2), # index 2 is number
								],
							"fonts": [gFont("Regular", %d)],
							"itemHeight": %d
							}
						</convert>
					</widget>
					<eLabel position="0,%d" size="%d,2" backgroundColor="#aaaaaa" />
					<ePixmap position="%d,%d" zPosition="4" size="140,40" pixmap="%s" transparent="1" alphatest="on" />
					<ePixmap position="%d,%d" zPosition="4" size="140,40" pixmap="%s" transparent="1" alphatest="on" />
					<ePixmap position="%d,%d" zPosition="4" size="140,40" pixmap="%s" transparent="1" alphatest="on" />
					<ePixmap position="%d,%d" zPosition="4" size="140,40" pixmap="%s" transparent="1" alphatest="on" />
					<widget name="key_red" position="%d,%d" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;%d" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
					<widget name="key_green" position="%d,%d" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;%d" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
					<widget name="key_yellow" position="%d,%d" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;%d" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
					<widget name="key_blue" position="%d,%d" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;%d" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
				</screen>""" % (
						# scaleH(90, 75), scaleV(100, 73), # position
						self.entriesWidth, self.height, # size
						self.entriesWidth, # eLabel width
						scaleH(40, 5), scaleV(20, 5), # entries position
						self.entriesWidth - scaleH(40, 5), self.height - scaleV(20, 5) - 5 - 5 - 40, # entries size
						0, 0, fieldWidth, scaleH(24, 20), # name pos/size
						fieldWidth + 5, 0, numberFieldWidth, scaleH(24, 20), # dir pos/size
						fontSize, # fontsize
						fontHeight, # itemHeight
						self.height - 40 - 5, # eLabel position vertical
						self.entriesWidth, # eLabel width
						buttonGap, self.height - 40, "buttons/red.png", # ePixmap red
						2 * buttonGap + 140, self.height - 40, "buttons/green.png", # ePixmap green
						3 * buttonGap + 2 * 140, self.height - 40, "buttons/yellow.png", # ePixmap yellow
						4 * buttonGap + 3 * 140, self.height - 40, "buttons/blue.png", # ePixmap blue
						buttonGap, self.height - 40, scaleV(22, 21), # widget red
						2 * buttonGap + 140, self.height - 40, scaleV(22, 21), # widget green
						3 * buttonGap + 2 * 140, self.height - 40, scaleV(22, 21), # widget yellow
						4 * buttonGap + 3 * 140, self.height - 40, scaleV(22, 21), # widget blue
						)

			# debug("[NcidDisplayCalls] skin: " + self.skin)
			Screen.__init__(self, session)
			NumericalTextInput.__init__(self)
			HelpableScreen.__init__(self)

			# TRANSLATORS: keep it short, this is a button
			self["key_red"] = Button(_("Delete"))
			# TRANSLATORS: keep it short, this is a button
			self["key_green"] = Button(_("New"))
			# TRANSLATORS: keep it short, this is a button
			self["key_yellow"] = Button(_("Edit"))
			# TRANSLATORS: keep it short, this is a button
			self["key_blue"] = Button(_("Search"))

			self["setupActions"] = ActionMap(["OkCancelActions", "ColorActions"],
			{
				"red": self.delete,
				"green": self.add,
				"yellow": self.edit,
				"blue": self.search,
				"cancel": self.exit,
				"ok": self.showEntry, }, -2)

			self["entries"] = List([])
			debug("[NcidClientPhonebook] displayPhonebook init")
			self.help_window = None
			self.sortlist = []
			self.onLayoutFinish.append(self.setWindowTitle)
			self.display()
예제 #21
0
    def __init__(self, session, text = '', filename = '', currDir = None, bookmarks = None, userMode = False, windowTitle = None, minFree = None, autoAdd = False, editDir = False, inhibitDirs = None, inhibitMounts = None):
        if not inhibitDirs:
            inhibitDirs = []
        if not inhibitMounts:
            inhibitMounts = []
        Screen.__init__(self, session)
        NumericalTextInput.__init__(self, handleTimeout=False)
        HelpableScreen.__init__(self)
        self.setUseableChars(u'1234567890abcdefghijklmnopqrstuvwxyz')
        self.qs_timer = eTimer()
        self.qs_timer.callback.append(self.timeout)
        self.qs_timer_type = 0
        self.curr_pos = -1
        self.quickselect = ''
        self['text'] = Label(text)
        self['textbook'] = Label(_('Bookmarks'))
        self.text = text
        self.filename = filename
        self.minFree = minFree
        self.realBookmarks = bookmarks
        self.bookmarks = bookmarks and bookmarks.value[:] or []
        self.userMode = userMode
        self.autoAdd = autoAdd
        self.editDir = editDir
        self.inhibitDirs = inhibitDirs
        self['filelist'] = FileList(currDir, showDirectories=True, showFiles=False, inhibitMounts=inhibitMounts, inhibitDirs=inhibitDirs)
        self['booklist'] = MenuList(self.bookmarks)
        self['key_green'] = Button(_('OK'))
        self['key_yellow'] = Button(_('Rename'))
        self['key_blue'] = Button(_('Remove bookmark'))
        self['key_red'] = Button(_('Cancel'))
        self['green'] = Pixmap()
        self['yellow'] = Pixmap()
        self['blue'] = Pixmap()
        self['red'] = Pixmap()
        self['target'] = Label()
        if self.userMode:
            self.usermodeOn()

        class LocationBoxActionMap(HelpableActionMap):

            def __init__(self, parent, context, actions = None, prio = 0):
                if not actions:
                    actions = {}
                HelpableActionMap.__init__(self, parent, context, actions, prio)
                self.box = parent

            def action(self, contexts, action):
                self.box.timeout(force=True)
                return HelpableActionMap.action(self, contexts, action)

        self['WizardActions'] = LocationBoxActionMap(self, 'WizardActions', {'ok': (self.ok, _('select')),
         'back': (self.cancel, _('Cancel'))}, -2)
        self['DirectionActions'] = LocationBoxActionMap(self, 'DirectionActions', {'left': self.left,
         'right': self.right,
         'up': self.up,
         'down': self.down}, -2)
        self['ColorActions'] = LocationBoxActionMap(self, 'ColorActions', {'red': self.cancel,
         'green': self.select,
         'yellow': self.changeName,
         'blue': self.addRemoveBookmark}, -2)
        self['EPGSelectActions'] = LocationBoxActionMap(self, 'EPGSelectActions', {'prevService': (self.switchToBookList, _('switch to bookmarks')),
         'nextService': (self.switchToFileList, _('switch to filelist'))}, -2)
        self['MenuActions'] = LocationBoxActionMap(self, 'MenuActions', {'menu': (self.showMenu, _('menu'))}, -2)
        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})
        if windowTitle is None:
            windowTitle = _('Select location')
        self.onShown.extend((boundFunction(self.setTitle, _('Select Location')), self.updateTarget, self.showHideRename))
        self.onLayoutFinish.append(self.switchToFileListOnStart)
        self.onClose.append(self.disableTimer)
        return
예제 #22
0
    def __init__(self, session, title="", text=""):
        Screen.__init__(self, session)
        NumericalTextInput.__init__(self,
                                    nextFunc=self.timeoutNI,
                                    handleTimeout=True)
        self.setUseableChars(
            u'1234567890aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ')
        self.sms_txt = None
        self.keys_list = []
        self.shiftkeys_list = []
        self.lang = language.getLanguage()
        self.nextLang = None
        self.shiftMode = False
        self.cursor = "XcursorX"
        self.gui_cursor = "| "
        self.text = text + self.cursor
        self.selectedKey = 0
        self.cursor_show = True
        self.cursor_time = 600
        self.cursorTimer = eTimer()
        self.cursorTimer.callback.append(self.toggleCursor)
        self.cursorTimer.start(self.cursor_time, True)
        self["country"] = StaticText("")
        self["header"] = Label(title)
        self["text"] = Label()
        self["list"] = VirtualKeyBoardList([])

        self["actions"] = ActionMap(
            ["KeyboardInputActions", "InputAsciiActions"], {
                "gotAsciiCode": self.keyGotAscii,
                "deleteBackward": self.backClicked,
            }, -2)
        self["InputBoxActions"] = HelpableActionMap(
            self, "InputBoxActions", {
                "deleteBackward": (self.cursorLeft, _("Move cursor left")),
                "deleteForward": (self.cursorRight, _("Move cursor right")),
                "0": (self.toggleShift, _("Toggle SHIFT mode")),
            }, -2)
        self["OkCancelActions"] = HelpableActionMap(
            self, "OkCancelActions", {
                "ok": (self.okClicked, _("Select key")),
                "cancel": (self.exit, _("Cancel")),
            }, -2)
        self["ShortcutActions"] = HelpableActionMap(
            self, "ShortcutActions", {
                "red": (self.backClicked, _("Delete (left of the cursor)")),
                "blue": (self.backSpace, _("Delete (right of the cursor)")),
                "green": (self.ok, _("Save")),
                "yellow": (self.switchLang, _("Switch keyboard layout")),
            }, -2)
        self["WizardActions"] = HelpableActionMap(
            self, "WizardActions", {
                "left": (self.left, _("Left")),
                "right": (self.right, _("Right")),
                "up": (self.up, _("Up")),
                "down": (self.down, _("Down")),
            }, -2)
        self["SeekActions"] = HelpableActionMap(
            self, "SeekActions", {
                "seekBack": (self.move_to_begin, _("Move to begin")),
                "seekFwd": (self.move_to_end, _("Move to end")),
            }, -2)
        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.set_GUI_Text()
        HelpableScreen.__init__(self)
        self.onExecBegin.append(self.setKeyboardModeAscii)
        self.onLayoutFinish.append(self.setLang)
        self.onLayoutFinish.append(self.buildVirtualKeyBoard)
예제 #23
0
    def __init__(self,
                 session,
                 text="",
                 filename="",
                 currDir=None,
                 bookmarks=None,
                 userMode=False,
                 windowTitle=None,
                 minFree=None,
                 autoAdd=False,
                 editDir=False,
                 inhibitDirs=None,
                 inhibitMounts=None):
        Screen.__init__(self,
                        session,
                        mandatoryWidgets=["filetext", "quickselect"])
        NumericalTextInput.__init__(self,
                                    handleTimeout=False,
                                    mode="SearchUpper")
        HelpableScreen.__init__(self)
        if not inhibitDirs:
            inhibitDirs = []
        if not inhibitMounts:
            inhibitMounts = []
        self.text = text
        self.filename = filename
        self.bookmarks = bookmarks
        self.bookmarksList = bookmarks and bookmarks.value[:] or []
        self.bookmarksList.sort()
        self.userMode = userMode
        self.minFree = minFree
        self.autoAdd = autoAdd
        self.editDir = editDir
        self.inhibitDirs = inhibitDirs
        self["filetext"] = Label("  %s" % _("Directories"))
        self["filelist"] = FileList(currDir,
                                    showDirectories=True,
                                    showFiles=False,
                                    inhibitMounts=inhibitMounts,
                                    inhibitDirs=inhibitDirs,
                                    enableWrapAround=True)
        self["booktext"] = Label("  %s" % _("Bookmarks"))
        self["booklist"] = MenuList(self.formatBookmarks(self.bookmarksList),
                                    enableWrapAround=True)
        self["quickselect"] = Label("")
        self["quickselect"].visible = False
        self["text"] = Label(text)
        self["target"] = Label()
        self["key_menu"] = StaticText(_("MENU"))
        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("Select"))
        self["key_yellow"] = StaticText("")
        self["key_blue"] = StaticText("")
        self.timer = eTimer()  # Initialize QuickSelect timer.
        self.timer.callback.append(self.timeout)
        self.timerType = 0
        self.quickSelect = ""
        self.quickSelectPos = -1

        class LocationBoxActionMap(HelpableActionMap
                                   ):  # Custom action handler.
            def __init__(self,
                         parent,
                         context,
                         actions=None,
                         prio=0,
                         description=None):
                HelpableActionMap.__init__(self, parent, context, actions,
                                           prio, description)
                self.box = parent

            def action(self, contexts, action):
                if action not in ("0", "1", "2", "3", "4", "5", "6", "7", "8",
                                  "9"):
                    self.box.timeout(
                        force=True)  # Reset QuickSelect on non numbers.
                return HelpableActionMap.action(self, contexts, action)

        # Actions that will reset QuickSelect...
        self["locationActions"] = LocationBoxActionMap(self, [
            "LocationBoxActions", "NavigationActions"
        ], {
            "enter":
            (self.enter,
             (_("Change directory / Select bookmark"),
              _("If the upper panel is active pressing OK will change the current directory.  If the lower panel is active pressing OK will select the current bookmark and exit."
                ))),
            "cancel": (self.cancel, _("Cancel the location selection")),
            "menu": (self.showMenu, _("Display context menu")),
            "top": (self.moveTop, _("Move up to first line")),
            "pageUp": (self.pageUp, _("Move up a screen")),
            "up": (self.moveUp, _("Move up a line")),
            "down": (self.moveDown, _("Mode down a line")),
            "pageDown": (self.pageDown, _("Mode down a screen")),
            "bottom": (self.moveBottom, _("Move down to last line"))
        },
                                                       prio=0,
                                                       description=_(
                                                           "LocationBox Actions"
                                                       ))
        self["selectAction"] = LocationBoxActionMap(
            self,
            "LocationBoxActions", {
                "select":
                (self.select,
                 _("Select the currently highlighted location and exit"))
            },
            prio=0,
            description=_("LocationBox Actions"))
        self["selectAction"].setEnabled(True)
        self["panelActions"] = LocationBoxActionMap(
            self, ["LocationBoxActions", "NavigationActions"], {
                "first":
                (self.switchToFileList, _("Switch to directories panel")),
                "left":
                (self.switchToFileList, _("Switch to directories panel")),
                "right":
                (self.switchToBookList, _("Switch to bookmarks panel")),
                "last":
                (self.switchToBookList, _("Switch to bookmarks panel")),
                "swap": (self.swapPanels, _("Switch to the other panel"))
            },
            prio=0,
            description=_("Panel Selection Actions"))
        self["panelActions"].setEnabled(True)
        self["bookmarkAction"] = LocationBoxActionMap(
            self,
            "LocationBoxActions",
            {"bookmark": (self.addDeleteBookmark, _("Add / Delete bookmark"))},
            prio=0,
            description=_("Bookmark Actions"))
        self["bookmarkAction"].setEnabled(True)
        self["renameAction"] = LocationBoxActionMap(
            self,
            "LocationBoxActions",
            {"rename": (self.rename, _("Rename directory"))},
            prio=0,
            description=_("Directory Actions"))
        self["renameAction"].setEnabled(False)
        # Action used by QuickSelect...
        smsMsg = _("SMS style QuickSelect location selection")
        self["numberActions"] = HelpableNumberActionMap(
            self,
            "NumberActions", {
                "1": (self.keyNumberGlobal, smsMsg),
                "2": (self.keyNumberGlobal, smsMsg),
                "3": (self.keyNumberGlobal, smsMsg),
                "4": (self.keyNumberGlobal, smsMsg),
                "5": (self.keyNumberGlobal, smsMsg),
                "6": (self.keyNumberGlobal, smsMsg),
                "7": (self.keyNumberGlobal, smsMsg),
                "8": (self.keyNumberGlobal, smsMsg),
                "9": (self.keyNumberGlobal, smsMsg),
                "0": (self.keyNumberGlobal, smsMsg)
            },
            prio=0,
            description=_("Quick Select Actions"))
        self["numberActions"].setEnabled(True)
        if self.userMode:
            self.switchToBookList()
            self["filelist"].hide()
            self["bookmarkAction"].setEnabled(False)
            self["panelActions"].setEnabled(False)
        self.setTitle(
            _("Select Location") if windowTitle is None else windowTitle)
        if self.layoutFinished not in self.onLayoutFinish:
            self.onLayoutFinish.append(self.layoutFinished)
	def __init__(self, session, text = "", filename = "", currDir = None, bookmarks = None, userMode = False, windowTitle = "Select location", minFree = None, autoAdd = False, editDir = False, inhibitDirs = [], inhibitMounts = []):
		# Init parents
		Screen.__init__(self, session)
		NumericalTextInput.__init__(self, handleTimeout = False)
		HelpableScreen.__init__(self)

		# Set useable chars
		self.setUseableChars(u'1234567890abcdefghijklmnopqrstuvwxyz')

		# Quickselect Timer
		self.qs_timer = eTimer()
		self.qs_timer.callback.append(self.timeout)
		self.qs_timer_type = 0

		# Initialize Quickselect
		self.curr_pos = -1
		self.quickselect = ""

		# Set Text
		self["text"] = Label(text)
		self["textbook"] = Label(_("Bookmarks"))

		# Save parameters locally
		self.text = text
		self.filename = filename
		self.minFree = minFree
		self.realBookmarks = bookmarks
		self.bookmarks = bookmarks and bookmarks.value[:] or []
		self.userMode = userMode
		self.autoAdd = autoAdd
		self.editDir = editDir
		self.inhibitDirs = inhibitDirs

		# Initialize FileList
		self["filelist"] = FileList(currDir, showDirectories = True, showFiles = False, inhibitMounts = inhibitMounts, inhibitDirs = inhibitDirs)

		# Initialize BookList
		self["booklist"] = MenuList(self.bookmarks)

		# Buttons
		self["key_green"] = Button(_("OK"))
		self["key_yellow"] = Button(_("Rename"))
		self["key_blue"] = Button(_("Remove bookmark"))
		self["key_red"] = Button(_("Cancel"))

		# Background for Buttons
		self["green"] = Pixmap()
		self["yellow"] = Pixmap()
		self["blue"] = Pixmap()
		self["red"] = Pixmap()

		# Initialize Target
		self["target"] = Label()

		if self.userMode:
			self.usermodeOn()

		# Custom Action Handler
		class LocationBoxActionMap(HelpableActionMap):
			def __init__(self, parent, context, actions = { }, prio=0):
				HelpableActionMap.__init__(self, parent, context, actions, prio)
				self.box = parent

			def action(self, contexts, action):
				# Reset Quickselect
				self.box.timeout(force = True)

				return HelpableActionMap.action(self, contexts, action)

		# Actions that will reset quickselect
		self["WizardActions"] = LocationBoxActionMap(self, "WizardActions",
			{
				"left": self.left,
				"right": self.right,
				"up": self.up,
				"down": self.down,
				"ok": (self.ok, _("select")),
				"back": (self.cancel, _("Cancel")),
			}, -2)

		self["ColorActions"] = LocationBoxActionMap(self, "ColorActions",
			{
				"red": self.cancel,
				"green": self.select,
				"yellow": self.changeName,
				"blue": self.addRemoveBookmark,
			}, -2)

		self["EPGSelectActions"] = LocationBoxActionMap(self, "EPGSelectActions",
			{
				"prevBouquet": (self.switchToBookList, _("switch to bookmarks")),
				"nextBouquet": (self.switchToFileList, _("switch to filelist")),
			}, -2)

		self["MenuActions"] = LocationBoxActionMap(self, "MenuActions",
			{
				"menu": (self.showMenu, _("menu")),
			}, -2)

		# Actions used by quickselect
		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
		})

		# Run some functions when shown
		self.onShown.extend((
			boundFunction(self.setTitle, _(windowTitle)),
			self.updateTarget,
			self.showHideRename,
		))

		self.onLayoutFinish.append(self.switchToFileListOnStart)

		# Make sure we remove our callback
		self.onClose.append(self.disableTimer)
예제 #25
0
	def __init__(self, default = "", fixed_size = False, visible_width = False):
		ConfigText.__init__(self, default = default, fixed_size = fixed_size, visible_width = visible_width)
		NumericalTextInput.__init__(self, nextFunc = self.nextFunc, handleTimeout = False, search = True)
예제 #26
0
    def __init__(self,
                 session,
                 text='',
                 filename='',
                 currDir=None,
                 bookmarks=None,
                 userMode=False,
                 windowTitle=_('Select location'),
                 minFree=None,
                 autoAdd=False,
                 editDir=False,
                 inhibitDirs=None,
                 inhibitMounts=None):
        if not inhibitDirs:
            inhibitDirs = []
        if not inhibitMounts:
            inhibitMounts = []
        Screen.__init__(self, session)
        NumericalTextInput.__init__(self, handleTimeout=False)
        HelpableScreen.__init__(self)
        self.setUseableChars(u'1234567890abcdefghijklmnopqrstuvwxyz')
        self.qs_timer = eTimer()
        self.qs_timer.callback.append(self.timeout)
        self.qs_timer_type = 0
        self.curr_pos = -1
        self.quickselect = ''
        self['text'] = Label(text)
        self['textbook'] = Label(_('Bookmarks'))
        self.text = text
        self.filename = filename
        self.minFree = minFree
        self.realBookmarks = bookmarks
        self.bookmarks = bookmarks and bookmarks.value[:] or []
        self.userMode = userMode
        self.autoAdd = autoAdd
        self.editDir = editDir
        self.inhibitDirs = inhibitDirs
        self['filelist'] = FileList(currDir,
                                    showDirectories=True,
                                    showFiles=False,
                                    inhibitMounts=inhibitMounts,
                                    inhibitDirs=inhibitDirs)
        self['booklist'] = MenuList(self.bookmarks)
        self['key_green'] = Button(_('OK'))
        self['key_yellow'] = Button(_('Rename'))
        self['key_blue'] = Button(_('Remove bookmark'))
        self['key_red'] = Button(_('Cancel'))
        self['green'] = Pixmap()
        self['yellow'] = Pixmap()
        self['blue'] = Pixmap()
        self['red'] = Pixmap()
        self['target'] = Label()
        self['targetfreespace'] = Label()
        if self.userMode:
            self.usermodeOn()

        class LocationBoxActionMap(HelpableActionMap):
            def __init__(self, parent, context, actions=None, prio=0):
                if not actions:
                    actions = {}
                HelpableActionMap.__init__(self, parent, context, actions,
                                           prio)
                self.box = parent

            def action(self, contexts, action):
                self.box.timeout(force=True)
                return HelpableActionMap.action(self, contexts, action)

        self['WizardActions'] = LocationBoxActionMap(self, 'WizardActions', {
            'ok': (self.ok, _('select')),
            'back': (self.cancel, _('Cancel'))
        }, -2)
        self['DirectionActions'] = LocationBoxActionMap(
            self, 'DirectionActions', {
                'left': self.left,
                'right': self.right,
                'up': self.up,
                'down': self.down
            }, -2)
        self['ColorActions'] = LocationBoxActionMap(
            self, 'ColorActions', {
                'red': self.cancel,
                'green': self.select,
                'yellow': self.changeName,
                'blue': self.addRemoveBookmark
            }, -2)
        self['EPGSelectActions'] = LocationBoxActionMap(
            self, 'EPGSelectActions', {
                'prevService':
                (self.switchToBookList, _('switch to bookmarks')),
                'nextService': (self.switchToFileList, _('switch to filelist'))
            }, -2)
        self['MenuActions'] = LocationBoxActionMap(
            self, 'MenuActions', {'menu': (self.showMenu, _('menu'))}, -2)
        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.onShown.extend((boundFunction(self.setTitle,
                                           _('Select Location')),
                             self.updateTarget, self.showHideRename))
        self.onLayoutFinish.append(self.switchToFileListOnStart)
        self.onClose.append(self.disableTimer)
예제 #27
0
    def __init__(self,
                 session,
                 text="",
                 filename="",
                 currDir=None,
                 bookmarks=None,
                 userMode=False,
                 windowTitle=None,
                 minFree=None,
                 autoAdd=False,
                 editDir=False,
                 inhibitDirs=None,
                 inhibitMounts=None):
        # Init parents
        if not inhibitDirs:
            inhibitDirs = []
        if not inhibitMounts:
            inhibitMounts = []
        Screen.__init__(self, session)
        NumericalTextInput.__init__(self, handleTimeout=False)
        HelpableScreen.__init__(self)

        # Set useable chars
        self.setUseableChars(u'1234567890abcdefghijklmnopqrstuvwxyz')

        # Quickselect Timer
        self.qs_timer = eTimer()
        self.qs_timer.callback.append(self.timeout)
        self.qs_timer_type = 0

        # Initialize Quickselect
        self.curr_pos = -1
        self.quickselect = ""

        # Set Text
        self["text"] = Label(text)
        self["textbook"] = Label(_("Bookmarks"))

        # Save parameters locally
        self.text = text
        self.filename = filename
        self.minFree = minFree
        self.realBookmarks = bookmarks
        self.bookmarks = bookmarks and bookmarks.value[:] or []
        self.userMode = userMode
        self.autoAdd = autoAdd
        self.editDir = editDir
        self.inhibitDirs = inhibitDirs

        # Initialize FileList
        self["filelist"] = FileList(currDir,
                                    showDirectories=True,
                                    showFiles=False,
                                    inhibitMounts=inhibitMounts,
                                    inhibitDirs=inhibitDirs)

        # Initialize BookList
        self["booklist"] = MenuList(self.bookmarks)

        # Buttons
        self["key_green"] = Button(_("OK"))
        self["key_yellow"] = Button(_("Rename"))
        self["key_blue"] = Button(_("Remove bookmark"))
        self["key_red"] = Button(_("Cancel"))
        self["key_menu"] = StaticText(_("MENU"))

        # Background for Buttons
        self["green"] = Pixmap()
        self["yellow"] = Pixmap()
        self["blue"] = Pixmap()
        self["red"] = Pixmap()

        # Initialize Target
        self["target"] = Label()

        if self.userMode:
            self.usermodeOn()

        # Custom Action Handler
        class LocationBoxActionMap(HelpableActionMap):
            def __init__(self, parent, context, actions=None, prio=0):
                if not actions:
                    actions = {}
                HelpableActionMap.__init__(self, parent, context, actions,
                                           prio)
                self.box = parent

            def action(self, contexts, action):
                # Reset Quickselect
                self.box.timeout(force=True)

                return HelpableActionMap.action(self, contexts, action)

        # Actions that will reset quickselect
        self["WizardActions"] = LocationBoxActionMap(self, "WizardActions", {
            "ok": (self.ok, _("select")),
            "back": (self.cancel, _("Cancel")),
        }, -2)

        self["DirectionActions"] = LocationBoxActionMap(
            self, "DirectionActions", {
                "left": self.left,
                "right": self.right,
                "up": self.up,
                "down": self.down,
            }, -2)

        self["ColorActions"] = LocationBoxActionMap(
            self, "ColorActions", {
                "red": self.cancel,
                "green": self.select,
                "yellow": self.changeName,
                "blue": self.addRemoveBookmark,
            }, -2)

        self["EPGSelectActions"] = LocationBoxActionMap(
            self, "EPGSelectActions", {
                "prevService":
                (self.switchToBookList, _("switch to bookmarks")),
                "nextService":
                (self.switchToFileList, _("switch to filelist")),
            }, -2)

        self["MenuActions"] = LocationBoxActionMap(self, "MenuActions", {
            "menu": (self.showMenu, _("menu")),
        }, -2)

        # Actions used by quickselect
        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
            })

        # Run some functions when shown
        if windowTitle is None:
            windowTitle = _("Select location")
        self.onShown.extend((
            boundFunction(self.setTitle, windowTitle),
            self.updateTarget,
            self.showHideRename,
        ))

        self.onLayoutFinish.append(self.switchToFileListOnStart)

        # Make sure we remove our callback
        self.onClose.append(self.disableTimer)
예제 #28
0
		def __init__(self, session):
			self.entriesWidth = DESKTOP_WIDTH * scaleH(75, 85) / 100
			self.height = DESKTOP_HEIGHT * 0.75
			numberFieldWidth = scaleH(220, 160)
			fieldWidth = self.entriesWidth - 5 - numberFieldWidth - 10
			fontSize = scaleV(22, 18)
			fontHeight = scaleV(24, 20)
			buttonGap = (self.entriesWidth - 4 * 140) / 5
			debug("[NcidDisplayPhonebook] width: " + str(self.entriesWidth))
			self.skin = """
				<screen name="NcidDisplayPhonebook" position="center,center" size="%d,%d" title="Phonebook" >
					<eLabel position="0,0" size="%d,2" backgroundColor="#aaaaaa" />
					<widget source="entries" render="Listbox" position="%d,%d" size="%d,%d" scrollbarMode="showOnDemand" transparent="1">
						<convert type="TemplatedMultiContent">
							{"template": [
									MultiContentEntryText(pos = (%d,%d), size = (%d,%d), font=0, flags = RT_HALIGN_LEFT, text = 1), # index 0 is the name, index 1 is shortname
									MultiContentEntryText(pos = (%d,%d), size = (%d,%d), font=0, flags = RT_HALIGN_LEFT, text = 2), # index 2 is number
								],
							"fonts": [gFont("Regular", %d)],
							"itemHeight": %d
							}
						</convert>
					</widget>
					<eLabel position="0,%d" size="%d,2" backgroundColor="#aaaaaa" />
					<ePixmap position="%d,%d" zPosition="4" size="140,40" pixmap="%s" transparent="1" alphatest="on" />
					<ePixmap position="%d,%d" zPosition="4" size="140,40" pixmap="%s" transparent="1" alphatest="on" />
					<ePixmap position="%d,%d" zPosition="4" size="140,40" pixmap="%s" transparent="1" alphatest="on" />
					<ePixmap position="%d,%d" zPosition="4" size="140,40" pixmap="%s" transparent="1" alphatest="on" />
					<widget name="key_red" position="%d,%d" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;%d" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
					<widget name="key_green" position="%d,%d" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;%d" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
					<widget name="key_yellow" position="%d,%d" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;%d" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
					<widget name="key_blue" position="%d,%d" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;%d" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
				</screen>""" % (
						# scaleH(90, 75), scaleV(100, 73), # position 
						self.entriesWidth, self.height, # size
						self.entriesWidth, # eLabel width
						scaleH(40, 5), scaleV(20, 5), # entries position
						self.entriesWidth - scaleH(40, 5), self.height - scaleV(20, 5) - 5 - 5 - 40, # entries size
						0, 0, fieldWidth, scaleH(24, 20), # name pos/size
						fieldWidth + 5, 0, numberFieldWidth, scaleH(24, 20), # dir pos/size
						fontSize, # fontsize
						fontHeight, # itemHeight
						self.height - 40 - 5, # eLabel position vertical
						self.entriesWidth, # eLabel width
						buttonGap, self.height - 40, "skin_default/buttons/red.png", # ePixmap red
						2 * buttonGap + 140, self.height - 40, "skin_default/buttons/green.png", # ePixmap green
						3 * buttonGap + 2 * 140, self.height - 40, "skin_default/buttons/yellow.png", # ePixmap yellow
						4 * buttonGap + 3 * 140, self.height - 40, "skin_default/buttons/blue.png", # ePixmap blue
						buttonGap, self.height - 40, scaleV(22, 21), # widget red
						2 * buttonGap + 140, self.height - 40, scaleV(22, 21), # widget green
						3 * buttonGap + 2 * 140, self.height - 40, scaleV(22, 21), # widget yellow
						4 * buttonGap + 3 * 140, self.height - 40, scaleV(22, 21), # widget blue
						)
	
			# debug("[NcidDisplayCalls] skin: " + self.skin)
			Screen.__init__(self, session)
			NumericalTextInput.__init__(self)
			HelpableScreen.__init__(self)
		
			# TRANSLATORS: keep it short, this is a button
			self["key_red"] = Button(_("Delete"))
			# TRANSLATORS: keep it short, this is a button
			self["key_green"] = Button(_("New"))
			# TRANSLATORS: keep it short, this is a button
			self["key_yellow"] = Button(_("Edit"))
			# TRANSLATORS: keep it short, this is a button
			self["key_blue"] = Button(_("Search"))
	
			self["setupActions"] = ActionMap(["OkCancelActions", "ColorActions"],
			{
				"red": self.delete,
				"green": self.add,
				"yellow": self.edit,
				"blue": self.search,
				"cancel": self.exit,
				"ok": self.showEntry, }, -2)
	
			self["entries"] = List([])
			debug("[NcidClientPhonebook] displayPhonebook init")
			self.help_window = None
			self.sortlist = []
			self.onLayoutFinish.append(self.setWindowTitle)
			self.display()