예제 #1
0
    def __init__(self, session, parent):
        Screen.__init__(self, session)
        HelpableScreen.__init__(self)
        list = []

        menuID = None
        for x in parent:  #walk through the actual nodelist
            if not x.tag:
                continue
            if x.tag == 'item':
                item_level = int(x.get("level", 0))
                if item_level <= config.usage.setup_level.index:
                    self.addItem(list, x)
                    count += 1
            elif x.tag == 'menu':
                self.addMenu(list, x)
                count += 1
            elif x.tag == "id":
                menuID = x.get("val")
                count = 0

            if menuID is not None:
                # menuupdater?
                if menuupdater.updatedMenuAvailable(menuID):
                    for x in menuupdater.getUpdatedMenu(menuID):
                        if x[1] == count:
                            list.append(
                                (x[0],
                                 boundFunction(self.runScreen,
                                               (x[2], x[3] + ", ")), x[4]))
                            count += 1

        if menuID is not None:
            # plugins
            for l in plugins.getPluginsForMenu(menuID):
                # check if a plugin overrides an existing menu
                plugin_menuid = l[2]
                for x in list:
                    if x[2] == plugin_menuid:
                        list.remove(x)
                        break
                if len(l) > 4 and l[4]:
                    list.append(
                        (l[0], boundFunction(l[1], self.session,
                                             self.close), l[2], l[3] or 50))
                else:
                    list.append((l[0], boundFunction(l[1],
                                                     self.session), l[2], l[3]
                                 or 50))

        # for the skin: first try a menu_<menuID>, then Menu
        self.skinName = []
        if menuID is not None:
            self.skinName.append("menu_" + menuID)
        self.skinName.append("Menu")
        self.menuID = menuID
        ProtectedScreen.__init__(self)

        # Sort by Weight
        if config.usage.sort_menus.value:
            list.sort()
        else:
            list.sort(key=lambda x: int(x[3]))

        if config.usage.menu_show_numbers.value:
            list = [(str(x[0] + 1) + "  " + x[1][0], x[1][1], x[1][2])
                    for x in enumerate(list)]

        self["menu"] = List(list)

        # self["menuActions"] = HelpableNumberActionMap(self, ["OkCancelActions", "MenuActions", "NumberActions"], {
        self["menuActions"] = HelpableNumberActionMap(
            self,
            ["OkCancelActions", "NumberActions"],
            {
                "ok": (self.okbuttonClick, _("Select the current menu item")),
                "cancel": (self.closeNonRecursive, _("Exit menu")),
                "close": (self.closeRecursive, _("Exit all menus")),
                # "menu": (self.closeRecursive, _("Exit all menus")),
                "1": (self.keyNumberGlobal, _("Direct menu item selection")),
                "2": (self.keyNumberGlobal, _("Direct menu item selection")),
                "3": (self.keyNumberGlobal, _("Direct menu item selection")),
                "4": (self.keyNumberGlobal, _("Direct menu item selection")),
                "5": (self.keyNumberGlobal, _("Direct menu item selection")),
                "6": (self.keyNumberGlobal, _("Direct menu item selection")),
                "7": (self.keyNumberGlobal, _("Direct menu item selection")),
                "8": (self.keyNumberGlobal, _("Direct menu item selection")),
                "9": (self.keyNumberGlobal, _("Direct menu item selection")),
                "0": (self.keyNumberGlobal, _("Direct menu item selection"))
            },
            prio=0,
            description=_("Common Menu Actions"))

        a = parent.get("title", "").encode("UTF-8") or None
        a = a and _(a) or _(parent.get("text", "").encode("UTF-8"))
        self.setTitle(a)

        self.number = 0
        self.nextNumberTimer = eTimer()
        self.nextNumberTimer.callback.append(self.okbuttonClick)
예제 #2
0
    def __init__(self, session, parent):
        Screen.__init__(self, session)

        list = []

        menuID = None
        for x in parent:  #walk through the actual nodelist
            if not x.tag:
                continue
            if x.tag == 'item':
                item_level = int(x.get("level", 0))
                if item_level <= config.usage.setup_level.index:
                    self.addItem(list, x)
                    count += 1
            elif x.tag == 'menu':
                item_level = int(x.get("level", 0))
                if item_level <= config.usage.setup_level.index:
                    self.addMenu(list, x)
                    count += 1
            elif x.tag == "id":
                menuID = x.get("val")
                count = 0

            if menuID is not None:
                # menuupdater?
                if menuupdater.updatedMenuAvailable(menuID):
                    for x in menuupdater.getUpdatedMenu(menuID):
                        if x[1] == count:
                            list.append(
                                (x[0],
                                 boundFunction(self.runScreen,
                                               (x[2], x[3] + ", ")), x[4]))
                            count += 1

        self.menuID = menuID
        if config.ParentalControl.configured.value:
            ProtectedScreen.__init__(self)

        if menuID is not None:
            # plugins
            for l in plugins.getPluginsForMenu(menuID):
                # check if a plugin overrides an existing menu
                plugin_menuid = l[2]
                for x in list:
                    if x[2] == plugin_menuid:
                        list.remove(x)
                        break
                if len(l) > 4 and l[4]:
                    list.append(
                        (l[0], boundFunction(l[1], self.session,
                                             self.close), l[2], l[3] or 50))
                else:
                    list.append((l[0], boundFunction(l[1],
                                                     self.session), l[2], l[3]
                                 or 50))

        # for the skin: first try a menu_<menuID>, then Menu
        self.skinName = []
        if menuID is not None:
            self.skinName.append("menu_" + menuID)
        self.skinName.append("Menu")

        # Sort by Weight
        if config.usage.sort_menus.value:
            list.sort()
        else:
            list.sort(key=lambda x: int(x[3]))

        self["menu"] = List(list)

        self["actions"] = NumberActionMap(
            ["OkCancelActions", "MenuActions", "NumberActions"], {
                "ok": self.okbuttonClick,
                "cancel": self.closeNonRecursive,
                "menu": self.closeRecursive,
                "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
            })

        a = parent.get("title", "").encode("UTF-8") or None
        a = a and _(a)
        if a is None:
            a = _(parent.get("text", "").encode("UTF-8"))
        self["title"] = StaticText(a)
        Screen.setTitle(self, a)
        self.menu_title = a
예제 #3
0
    def __init__(self, session, args=0):
        Screen.__init__(self, session)
        ProtectedScreen.__init__(self)
        screentitle = _("ViX")
        self.menu_path = _("Main menu") + ' / ' + _("Setup") + ' / '
        if config.usage.show_menupath.value == 'large':
            self.menu_path += screentitle
            title = self.menu_path
            self["menu_path_compressed"] = StaticText("")
            self.menu_path += ' / '
        elif config.usage.show_menupath.value == 'small':
            title = screentitle
            condtext = ""
            if self.menu_path and not self.menu_path.endswith(' / '):
                condtext = self.menu_path + " >"
            elif self.menu_path:
                condtext = self.menu_path[:-3] + " >"
            self["menu_path_compressed"] = StaticText(condtext)
            self.menu_path += screentitle + ' / '
        else:
            title = screentitle
            self["menu_path_compressed"] = StaticText("")
        Screen.setTitle(self, title)
        self.menu = args
        self.list = []
        if self.menu == 0:
            self.list.append(("backup-manager", _("Backup manager"),
                              _("Manage the backups of your settings."), None))
            self.list.append(
                ("image-manager", _("Image manager"),
                 _("Create and flash complete images of your system."), None))
            self.list.append(("ipkg-install", _("Install local extension"),
                              _("Install IPK's from your tmp folder."), None))
            self.list.append(("mount-manager", _("Mount manager"),
                              _("Manage your devices mount points."), None))
            self.list.append(("script-runner", _("Script runner"),
                              _("Run your shell scripts."), None))
            self.list.append(("swap-manager", _("SWAP manager"),
                              _("Create and Manage your SWAP files."), None))
            if SystemInfo["canMultiBoot"]:
                self.list.append(("multiboot manager", _("MultiBoot manager"),
                                  _("Create empty slot."), None))
            if SystemInfo["HasH9SD"]:
                self.list.append(("H9SDcard manager", _("H9SDcard Manager"),
                                  _("Move Nand root to SD card"), None))
        self["menu"] = List(self.list)
        self["key_red"] = StaticText(_("Close"))

        self["shortcuts"] = NumberActionMap(
            [
                "ShortcutActions", "WizardActions", "InfobarEPGActions",
                "MenuActions", "NumberActions"
            ], {
                "ok": self.go,
                "back": self.close,
                "red": self.close,
                "menu": self.closeRecursive,
                "1": self.go,
                "2": self.go,
                "3": self.go,
                "4": self.go,
                "5": self.go,
                "6": self.go,
                "7": self.go,
                "8": self.go,
                "9": self.go,
            }, -1)
        self.onLayoutFinish.append(self.layoutFinished)
        self.onChangedEntry = []
        self["menu"].onSelectionChanged.append(self.selectionChanged)
예제 #4
0
    def __init__(self,
                 session,
                 showSteps=True,
                 showStepSlider=True,
                 showList=True,
                 showConfig=True):
        Screen.__init__(self, session)

        self.isLastWizard = False  # can be used to skip a "goodbye"-screen in a wizard

        self.stepHistory = []

        self.wizard = {}
        parser = make_parser()
        if not isinstance(self.xmlfile, list):
            self.xmlfile = [self.xmlfile]
        print("[Wizard] Reading ", self.xmlfile)
        wizardHandler = self.parseWizard(self.wizard)
        parser.setContentHandler(wizardHandler)
        for xmlfile in self.xmlfile:
            if xmlfile[0] != '/':
                parser.parse(eEnv.resolve('${datadir}/enigma2/') + xmlfile)
            else:
                parser.parse(xmlfile)

        self.showSteps = showSteps
        self.showStepSlider = showStepSlider
        self.showList = showList
        self.showConfig = showConfig

        self.numSteps = len(self.wizard)
        self.currStep = self.getStepWithID("start") + 1

        self.timeoutTimer = eTimer()
        self.timeoutTimer.callback.append(self.timeoutCounterFired)

        self["text"] = Label()

        if showConfig:
            self["config"] = ConfigList([], session=session)

        if self.showSteps:
            self["step"] = Label()

        if self.showStepSlider:
            self["stepslider"] = Slider(1, self.numSteps)

        if self.showList:
            self.list = []
            self["list"] = List(self.list, enableWrapAround=True)
            self["list"].onSelectionChanged.append(self.selChanged)
            #self["list"] = MenuList(self.list, enableWrapAround = True)

        self.onShown.append(self.updateValues)

        self.configInstance = None
        self.currentConfigIndex = None

        Wizard.instance = self

        self.lcdCallbacks = []

        self.disableKeys = False

        self["actions"] = NumberActionMap(
            [
                "WizardActions", "NumberActions", "ColorActions",
                "SetupActions", "InputAsciiActions", "KeyboardInputActions"
            ], {
                "gotAsciiCode": self.keyGotAscii,
                "ok": self.ok,
                "back": self.back,
                "left": self.left,
                "right": self.right,
                "up": self.up,
                "down": self.down,
                "red": self.red,
                "green": self.green,
                "yellow": self.yellow,
                "blue": self.blue,
                "deleteBackward": self.deleteBackward,
                "deleteForward": self.deleteForward,
                "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)

        self["VirtualKB"] = NumberActionMap(
            ["VirtualKeyboardActions"], {
                "showVirtualKeyboard": self.KeyText,
            }, -2)

        self["VirtualKB"].setEnabled(False)
예제 #5
0
	def __init__(self, session, parent):
		Screen.__init__(self, session)

		self.sort_mode = False
		self.selected_entry = None
		self.sub_menu_sort = None

		self["key_green"] = Label()
		self["key_yellow"] = Label()
		self["key_blue"] = Label()

		m_list = []

		menuID = None
		for x in parent:						#walk through the actual nodelist
			if not x.tag:
				continue
			if x.tag == 'item':
				item_level = int(x.get("level", 0))
				if item_level <= config.usage.setup_level.index:
					self.addItem(m_list, x)
					count += 1
			elif x.tag == 'menu':
				item_level = int(x.get("level", 0))
				if item_level <= config.usage.setup_level.index:
					self.addMenu(m_list, x)
					count += 1
			elif x.tag == "id":
				menuID = x.get("val")
				count = 0

			if menuID is not None:
				# menuupdater?
				if menuupdater.updatedMenuAvailable(menuID):
					for x in menuupdater.getUpdatedMenu(menuID):
						if x[1] == count:
							description = x.get('description', '').encode('UTF-8') or None
							description = description and _(description)
							menupng = MenuEntryPixmap(menuID, self.png_cache, lastMenuID)
							m_list.append((x[0], boundFunction(self.runScreen, (x[2], x[3] + ", ")), x[4], description, menupng))
							count += 1

		self.menuID = menuID
		if config.ParentalControl.configured.value:
			ProtectedScreen.__init__(self)

		if menuID is not None:
			# plugins
			for l in plugins.getPluginsForMenu(menuID):
				# check if a plugin overrides an existing menu
				plugin_menuid = l[2]
				for x in m_list:
					if x[2] == plugin_menuid:
						m_list.remove(x)
						break
				description = plugins.getDescriptionForMenuEntryID(menuID, plugin_menuid)
				menupng = MenuEntryPixmap(l[2], self.png_cache, lastMenuID)
				if len(l) > 4 and l[4]:
					m_list.append((l[0], boundFunction(l[1], self.session, self.close), l[2], l[3] or 50, description, menupng))
				else:
					m_list.append((l[0], boundFunction(l[1], self.session), l[2], l[3] or 50, description, menupng))

		# for the skin: first try a menu_<menuID>, then Menu
		self.skinName = [ ]
		if menuID is not None:
			if config.usage.menutype.value == 'horzanim' and skin.dom_screens.has_key("Animmain"):
				self.skinName.append('Animmain')
			elif config.usage.menutype.value == 'horzicon' and skin.dom_screens.has_key("Iconmain"):
				self.skinName.append('Iconmain')
			else:
				self.skinName.append('menu_' + menuID)
		self.skinName.append("Menu")
		self.menuID = menuID
		ProtectedScreen.__init__(self)

		if config.usage.menu_sort_mode.value == "user" and menuID == "mainmenu":
			plugin_list = []
			id_list = []
			for l in plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU ,PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]):
				l.id = (l.name.lower()).replace(' ','_')
				if l.id not in id_list:
					id_list.append(l.id)
					plugin_list.append((l.name, boundFunction(l.__call__, session), l.id, 200))

		self.list = m_list

		if menuID is not None and config.usage.menu_sort_mode.value == "user":
			self.sub_menu_sort = NoSave(ConfigDictionarySet())
			self.sub_menu_sort.value = config.usage.menu_sort_weight.getConfigValue(self.menuID, "submenu") or {}
			idx = 0
			for x in self.list:
				entry = list(self.list.pop(idx))
				m_weight = self.sub_menu_sort.getConfigValue(entry[2], "sort") or entry[3]
				entry.append(m_weight)
				self.list.insert(idx, tuple(entry))
				self.sub_menu_sort.changeConfigValue(entry[2], "sort", m_weight)
				idx += 1
			self.full_list = list(m_list)

		if config.usage.menu_sort_mode.value == "a_z":
			# Sort by Name
			m_list.sort(key=self.sortByName)
		elif config.usage.menu_sort_mode.value == "user":
			self["key_blue"].setText(_("Edit mode on"))
			self.hide_show_entries()
			m_list = self.list
		else:
			# Sort by Weight
			m_list.sort(key=lambda x: int(x[3]))

		if config.usage.menu_show_numbers.value:
			m_list = [(str(x[0] + 1) + " " +x[1][0], x[1][1], x[1][2]) for x in enumerate(m_list)]

		self["menu"] = List(m_list)
		self["menu"].enableWrapAround = True
		if config.usage.menu_sort_mode.value == "user":
			self["menu"].onSelectionChanged.append(self.selectionChanged)

		self["actions"] = NumberActionMap(["OkCancelActions", "MenuActions", "NumberActions"],
			{
				"ok": self.okbuttonClick,
				"cancel": self.closeNonRecursive,
				"menu": self.closeRecursive,
				#"0": self.resetSortOrder,
				"0": self.keyNumberGlobal,
				"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
			})

		if config.usage.menu_sort_mode.value == "user":
			self["MoveActions"] = ActionMap(["WizardActions"],
				{
					"left": self.keyLeft,
					"right": self.keyRight,
					"up": self.keyUp,
					"down": self.keyDown,
				}, -1
			)

			self["EditActions"] = ActionMap(["ColorActions"],
			{
				"green": self.keyGreen,
				"yellow": self.keyYellow,
				"blue": self.keyBlue,
			})

		a = parent.get("title", "").encode("UTF-8") or None
		a = a and _(a)
		if a is None:
			a = _(parent.get("text", "").encode("UTF-8"))
		else:
			t_history.reset()
		self["title"] = StaticText(a)
		Screen.setTitle(self, a)
		self.menu_title = a

		self["thistory"] = StaticText(t_history.thistory)
		history_len = len(t_history.thistory)
		self["title0"] = StaticText('')
		self["title1"] = StaticText('')
		self["title2"] = StaticText('')
		if history_len < 13 :
			self["title0"] = StaticText(a)
		elif history_len < 21 :
			self["title0"] = StaticText('')
			self["title1"] = StaticText(a)
		else:
			self["title0"] = StaticText('')
			self["title1"] = StaticText('')
			self["title2"] = StaticText(a)

		if(t_history.thistory ==''):
			t_history.thistory = str(a) + ' > '
		else:
			t_history.thistory = t_history.thistory + str(a) + ' > '

		if config.usage.menutype.value == 'horzanim' and skin.dom_screens.has_key("Animmain"):
			self['label1'] = StaticText()
			self['label2'] = StaticText()
			self['label3'] = StaticText()
			self['label4'] = StaticText()
			self['label5'] = StaticText()
			self.onShown.append(self.openTestA)
		elif config.usage.menutype.value == 'horzicon' and skin.dom_screens.has_key("Iconmain"):
			self['label1'] = StaticText()
			self['label2'] = StaticText()
			self['label3'] = StaticText()
			self['label4'] = StaticText()
			self['label5'] = StaticText()
			self['label6'] = StaticText()
			self['label1s'] = StaticText()
			self['label2s'] = StaticText()
			self['label3s'] = StaticText()
			self['label4s'] = StaticText()
			self['label5s'] = StaticText()
			self['label6s'] = StaticText()
			self['pointer'] = Pixmap()
			self['pixmap1'] = Pixmap()
			self['pixmap2'] = Pixmap()
			self['pixmap3'] = Pixmap()
			self['pixmap4'] = Pixmap()
			self['pixmap5'] = Pixmap()
			self['pixmap6'] = Pixmap()
			self.onShown.append(self.openTestB)

		self.number = 0
		self.nextNumberTimer = eTimer()
		self.nextNumberTimer.callback.append(self.okbuttonClick)
    def __init__(self, session, infobar=None, page=PAGE_AUDIO):
        Screen.__init__(self, session)

        self["streams"] = List([], enableWrapAround=True)
        self["key_red"] = Boolean(False)
        self["key_green"] = Boolean(False)
        self["key_yellow"] = Boolean(True)
        self["key_blue"] = Boolean(False)
        self["key_left"] = Pixmap()
        self["key_right"] = Pixmap()
        self["switchdescription"] = Label(
            _("Switch between Audio-, Subtitlepage"))
        self["summary_description"] = StaticText("")

        self.protectContextMenu = True

        ConfigListScreen.__init__(self, [])
        self.infobar = infobar or self.session.infobar

        self.__event_tracker = ServiceEventTracker(
            screen=self,
            eventmap={iPlayableService.evUpdatedInfo: self.__updatedInfo})
        self.cached_subtitle_checked = False
        self.__selected_subtitle = None

        self["actions"] = NumberActionMap(
            [
                "ColorActions", "OkCancelActions", "DirectionActions",
                "MenuActions", "InfobarAudioSelectionActions",
                "InfobarSubtitleSelectionActions"
            ], {
                "red": self.keyRed,
                "green": self.keyGreen,
                "yellow": self.keyYellow,
                "subtitleSelection": self.keyAudioSubtitle,
                "audioSelection": self.keyAudioSubtitle,
                "blue": self.keyBlue,
                "ok": self.keyOk,
                "cancel": self.cancel,
                "up": self.keyUp,
                "down": self.keyDown,
                "volumeUp": self.volumeUp,
                "volumeDown": self.volumeDown,
                "volumeMute": self.volumeMute,
                "menu": self.openAutoLanguageSetup,
                "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,
            }, -2)

        self.settings = ConfigSubsection()
        choicelist = [(PAGE_AUDIO, ""), (PAGE_SUBTITLES, "")]
        self.settings.menupage = ConfigSelection(choices=choicelist,
                                                 default=page)
        self.onLayoutFinish.append(self.__layoutFinished)
예제 #7
0
    def __init__(self, session, args=None):
        Screen.__init__(self, session)
        self.session = session
        
        self.list = []
        self.SelectedIndex = None
        self.prev_running_service = None
        self.packages = []
        self.installedpackages = []
        self.upgradeablepackages = []
        self.ActiveFilterID = 0
        self.ActiveFilter = ""
        self.LocalFileName = ""
        #self.changeList = []
        self.maxSize = 8000000
        self.maxPackages = 15
        if self.getFreeSpace('/var/cache') > self.maxSize * 3:
            self.CacheDir = "/var/cache"
        elif self.getFreeSpace('/media/data') > self.maxSize * 4:
            self.CacheDir = "/media/data"
        elif self.getFreeSpace('/hdd') > self.maxSize * 4:
            self.CacheDir = "/hdd"
        else:
            self.CacheDir = "/var/cache"
            if fileExists('/hdd/epg.dat'):
                os_remove('/hdd/epg.dat')
        
        self.firstRun = True
        self.MainMenu = True
        self.pushUpgrade = True
        self.BlockedInstall = False
        self.IPTVfullInstalled = False
        self.BlockedInput = True
        self.packages2upgrade = 0
        self.keyGreenAction = ""
        self.keyBlueAction = ""
        self.actionInfo = ""
        self.SkinSelectorInstalled = 0
        self.changed = False #zmiana na True kiedy cokolwiek zainstalujemy
        self.Console = ComConsole()
        self.divpng = LoadPixmap(cached = True, path = resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/div-h.png'))
        self.goinstalledpng = LoadPixmap(cached = True, path = resolveFilename(SCOPE_PLUGINS, 'Extensions/GOSmanager/icons/install.png'))
        self.goremovepng = LoadPixmap(cached = True, path = resolveFilename(SCOPE_PLUGINS, 'Extensions/GOSmanager/icons/remove.png'))
        self.gousbpng = LoadPixmap(cached = True, path = resolveFilename(SCOPE_PLUGINS, 'Extensions/GOSmanager/icons/opkg_local.png'))
        self.installedpng = LoadPixmap(cached = True, path = resolveFilename(SCOPE_PLUGINS, 'Extensions/GOSmanager/icons/installed.png'))
        self.upgradeablepng = LoadPixmap(cached = True, path = resolveFilename(SCOPE_PLUGINS, 'Extensions/GOSmanager/icons/upgradeable.png'))
        
        self["list"] = List(self.list)

        self["key_red"] = Label(_("Refresh list"))
        self["key_green"] = Label()
        self["key_blue"] = Label()
        self["key_yellow"] = Label(_("Options"))
        self["whatUPDATED"] = ScrollLabel()
        
        self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions"],
            {
                "cancel": self.keyCancel,
                "ok": self.doAction,
                "red": self.keyRed,
                "green": self.doAction,
                "yellow": self.keyYellow,
                "blue": self.keyBlue,
                "pageUp": self["whatUPDATED"].pageUp,
                "pageDown": self["whatUPDATED"].pageDown 
            }, -2)

        self.onLayoutFinish.append(self.layoutFinished)
        self.onShown.append(self.checkFreeSpace)
        if self.selectionChanged not in self['list'].onSelectionChanged:
            self['list'].onSelectionChanged.append(self.selectionChanged)
예제 #8
0
파일: Menu.py 프로젝트: dream-alpha/enigma2
	def __init__(self, session, parent):
		Screen.__init__(self, session)
		list = []

		menuID = None
		count = 0
		for x in parent:	#walk through the actual nodelist
			if x.tag == 'item':
				item_level = int(x.get("level", 0))
				if item_level <= config.usage.setup_level.index:
					self.addItem(list, x)
					count += 1
			elif x.tag == 'menu':
				self.addMenu(list, x)
				count += 1
			elif x.tag == "id":
				menuID = x.get("val")
				count = 0

			if menuID is not None:
				# menuupdater?
				if menuupdater.updatedMenuAvailable(menuID):
					for x in menuupdater.getUpdatedMenu(menuID):
						if x[1] == count:
							description = six.ensure_str(x.get("description", "")) or None
							description = description and _(description)
							menupng = MenuEntryPixmap(menuID, self.png_cache, lastMenuID)
							list.append((x[0], boundFunction(self.runScreen, (x[2], x[3] + ", ")), x[4], description, menupng))
							count += 1

		if menuID is not None:
			# plugins
			for l in plugins.getPluginsForMenu(menuID):
				# check if a plugin overrides an existing menu
				plugin_menuid = l[2]
				for x in list:
					if x[2] == plugin_menuid:
						list.remove(x)
						break
				description = l[4] if len(l) == 5 else plugins.getDescriptionForMenuEntryID(menuID, plugin_menuid)
				menupng = MenuEntryPixmap(l[2], self.png_cache, lastMenuID)
				list.append((l[0], boundFunction(l[1], self.session), l[2], l[3] or 50, description, menupng))

		# for the skin: first try a menu_<menuID>, then Menu
		self.skinName = [ ]
		if menuID is not None:
			self.skinName.append("menu_" + menuID)
		self.skinName.append("Menu")

		# Sort by Weight
		list.sort(key=lambda x: int(x[3]))

		self._list = List(list)
		self._list.onSelectionChanged.append(self._onSelectionChanged)
		self["menu"] = self._list
		self["pixmap"] = Pixmap()
		self["description"] = StaticText()

		self["actions"] = NumberActionMap(["OkCancelActions", "MenuActions", "NumberActions"],
			{
				"ok": self.okbuttonClick,
				"cancel": self.closeNonRecursive,
				"menu": self.closeRecursive,
				"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
			})

		a = six.ensure_str(parent.get("title", "")) or None
		a = a and _(a)
		if a is None:
			a = _(six.ensure_str(parent.get("text", "")))
		self["title"] = StaticText(a)
		self.menu_title = a
		self.onLayoutFinish.append(self._onLayoutFinish)
예제 #9
0
    def __init__(self, session, args=0):
        skin = """<screen position="93,70" size="550,450" title="Webcams provided by webcams.travel">

			<widget source="list" render="Listbox" position="0,0" size="550,350" zPosition="1" scrollbarMode="showOnDemand" transparent="1"  >
				<convert type="TemplatedMultiContent">
				{"templates":
					{"default": (77,[
							MultiContentEntryPixmapAlphaTest(pos = (0, 0), size = (100, 75), png = 4), # index 4 is the thumbnail
							MultiContentEntryText(pos = (100, 1), size = (500, 22), font=0, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP| RT_WRAP, text = 1), # index 1 is the Title
							MultiContentEntryText(pos = (100, 24), size = (300, 18), font=1, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP| RT_WRAP, text = 5), # index 5 is the Published Date
							MultiContentEntryText(pos = (100, 43), size = (300, 18), font=1, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP| RT_WRAP, text = 6), # index 6 is the Views Count
							MultiContentEntryText(pos = (400, 24), size = (200, 18), font=1, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP| RT_WRAP, text = 7), # index 7 is the duration
							MultiContentEntryText(pos = (400, 43), size = (200, 18), font=1, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP| RT_WRAP, text = 8), # index 8 is the ratingcount
						]),
					"status": (77,[
							MultiContentEntryText(pos = (10, 1), size = (500, 28), font=2, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP| RT_WRAP, text = 0), # index 0 is the name
							MultiContentEntryText(pos = (10, 22), size = (500, 46), font=3, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP| RT_WRAP, text = 1), # index 2 is the description
						])
					},
					"fonts": [gFont("Regular", 22),gFont("Regular", 18),gFont("Regular", 26),gFont("Regular", 20)],
					"itemHeight": 77
				}
				</convert>
			</widget>
			<widget name="thumbnail" position="0,0" size="100,75" alphatest="on"/> # fake entry for dynamic thumbnail resizing, currently there is no other way doing this.

			<widget name="count" position="5,360" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="page" position="150,360" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="currentnumbers" position="295,360" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />

			<ePixmap position="5,410" zPosition="0" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
			<ePixmap position="150,410" zPosition="1" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
			<ePixmap position="295,410" zPosition="2" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
			<!-- #not used now# ePixmap position="445,410" zPosition="3" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" //-->
			<widget name="key_red" position="5,410" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="key_green" position="150,410" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="key_yellow" position="295,410" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="key_blue" position="445,410" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />

		</screen>"""
        self.skin = skin
        Screen.__init__(self, session)
        self.picloads = {}
        self.thumbnails = {}

        self["list"] = List([])
        self["thumbnail"] = Pixmap()
        self["thumbnail"].hide()

        self["count"] = Label(_("Cams: "))
        self["page"] = Label(_("Page: "))
        self["currentnumbers"] = Label(_("current: "))

        self["key_red"] = Button(_("prev"))
        self["key_red"].hide()
        self["key_green"] = Button(_("next"))
        self["key_green"].hide()
        self["key_yellow"] = Button(_("search"))
        self["key_blue"] = Button(_("hdkfjhg"))

        self["key_blue"].hide()  #not used at the moment

        self["actions"] = ActionMap(
            [
                "WizardActions", "MenuActions", "DirectionActions",
                "ShortcutActions"
            ], {
                "ok": self.onOK,
                "red": self.onRed,
                "green": self.onGreen,
                "yellow": self.onYellow,
                "back": self.close
            }, -1)
        self.finish_loading = True
        self.timer_default = eTimer()
        self.timer_default.timeout.callback.append(self.buildCamList)

        self.timer_status = eTimer()
        self.timer_status.timeout.callback.append(self.buildStatusList)

        self.timer_labels = eTimer()
        self.timer_labels.timeout.callback.append(self.refreshLabels)

        self.onLayoutFinish.append(self.loadData)
예제 #10
0
    def __init__(self, session, *args):
        Screen.__init__(self, session)
        Screen.setTitle(self, _("Software Panel"))
        skin = """
		<screen name="SoftwarePanel" position="center,center" size="650,605" title="Software Panel">
			<widget name="a_off" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/icons/aoff.png" position="10,10" zPosition="1" size="36,97" alphatest="on" />
			<widget name="a_red" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/icons/ared.png" position="10,10" zPosition="1" size="36,97" alphatest="on" />
			<widget name="a_yellow" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/icons/ayellow.png" position="10,10" zPosition="1" size="36,97" alphatest="on" />
			<widget name="a_green" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/icons/agreen.png" position="10,10" zPosition="1" size="36,97" alphatest="on" />
			<widget name="feedstatusRED" position="60,14" size="200,30" zPosition="1" font="Regular;25" halign="left" transparent="1" />
			<widget name="feedstatusYELLOW" position="60,46" size="200,30" zPosition="1" font="Regular;25" halign="left" transparent="1" />
			<widget name="feedstatusGREEN" position="60,78" size="200,30" zPosition="1" font="Regular;25" halign="left" transparent="1" />
			<widget name="packagetext" position="180,50" size="350,30" zPosition="1" font="Regular;25" halign="right" transparent="1" />
			<widget name="packagenr" position="511,50" size="50,30" zPosition="1" font="Regular;25" halign="right" transparent="1" />
			<widget source="list" render="Listbox" position="10,120" size="630,365" scrollbarMode="showOnDemand">
				<convert type="TemplatedMultiContent">
					{"template": [
							MultiContentEntryText(pos = (5, 1), size = (540, 28), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name
							MultiContentEntryText(pos = (5, 26), size = (540, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description
							MultiContentEntryPixmapAlphaBlend(pos = (545, 2), size = (48, 48), png = 4), # index 4 is the status pixmap
							MultiContentEntryPixmapAlphaBlend(pos = (5, 50), size = (610, 2), png = 5), # index 4 is the div pixmap
						],
					"fonts": [gFont("Regular", 22),gFont("Regular", 14)],
					"itemHeight": 52
					}
				</convert>
			</widget>
			<ePixmap pixmap="skin_default/buttons/red.png" position=" 30,570" size="35,27" alphatest="blend" />
			<widget name="key_green_pic" pixmap="skin_default/buttons/green.png" position="290,570" size="35,27" alphatest="blend" />
			<widget name="key_red" position=" 80,573" size="200,26" zPosition="1" font="Regular;22" halign="left" transparent="1" />
			<widget name="key_green" position="340,573" size="200,26" zPosition="1" font="Regular;22" halign="left" transparent="1" />
		</screen> """
        self.skin = skin
        self.list = []
        self.statuslist = []
        self["list"] = List(self.list)
        self['a_off'] = Pixmap()
        self['a_red'] = Pixmap()
        self['a_yellow'] = Pixmap()
        self['a_green'] = Pixmap()
        self['key_green_pic'] = Pixmap()
        self['key_red_pic'] = Pixmap()
        self['key_red'] = Label(_("Cancel"))
        self['key_green'] = Label(_("Update"))
        self['packagetext'] = Label(_("Updates Available:"))
        self['packagenr'] = Label("0")
        self['feedstatusRED'] = Label("<  " + _("feed status"))
        self['feedstatusYELLOW'] = Label("<  " + _("feed status"))
        self['feedstatusGREEN'] = Label("<  " + _("feed status"))
        self['key_green'].hide()
        self['key_green_pic'].hide()
        self.update = False
        self.packages = 0
        self.ipkg = IpkgComponent()
        self.ipkg.addCallback(self.ipkgCallback)
        self["actions"] = ActionMap([
            "OkCancelActions", "DirectionActions", "ColorActions",
            "SetupActions"
        ], {
            "cancel": self.Exit,
            "green": self.Green,
            "red": self.Exit,
        }, -2)

        self.onLayoutFinish.append(self.layoutFinished)
예제 #11
0
    def __init__(self, session, parent):
        self.parentmenu = parent
        Screen.__init__(self, session)
        self["key_blue"] = StaticText("")
        self["menu"] = List([])
        self["menu"].enableWrapAround = True
        self.showNumericHelp = False
        self.createMenuList()

        # for the skin: first try a menu_<menuID>, then Menu
        self.skinName = []
        if 'horz' in config.usage.menutype.value:
            skfile = '/usr/share/enigma2/' + config.skin.primary_skin.value
            f1 = open(skfile, 'r')
            self.sktxt = f1.read()
            f1.close()
        if self.menuID is not None:
            if config.usage.menutype.value == 'horzanim' and '<screen name="Animmain" ' in self.sktxt:
                self.skinName.append('Animmain')
            elif config.usage.menutype.value == 'horzicon' and '<screen name="Iconmain" ' in self.sktxt:
                self.skinName.append('Iconmain')
            else:
                self.skinName.append('menu_' + self.menuID)
        self.skinName.append("Menu")
        ProtectedScreen.__init__(self)
        self["actions"] = NumberActionMap(
            [
                "OkCancelActions", "MenuActions", "NumberActions",
                "HelpActions", "ColorActions"
            ], {
                "ok": self.okbuttonClick,
                "cancel": self.closeNonRecursive,
                "menu": self.closeRecursive,
                "0": self.keyNumberGlobal,
                "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,
                "displayHelp": self.showHelp,
                "blue": self.keyBlue,
            })
        title = parent.get("title", "").encode("UTF-8") or None
        title = title and _(title) or _(parent.get("text", "").encode("UTF-8"))
        title = self.__class__.__name__ == "MenuSort" and _(
            "Menusort (%s)") % title or title
        if title is None:
            title = _(parent.get('text', '').encode('UTF-8'))
        else:
            t_history.reset()
        self["title"] = StaticText(title)
        self.setScreenPathMode(True)
        self.setTitle(title)
        self.menu_title = title
        self['thistory'] = StaticText(t_history.thistory)
        history_len = len(t_history.thistory)
        self['title0'] = StaticText('')
        self['title1'] = StaticText('')
        self['title2'] = StaticText('')
        if history_len < 13:
            self['title0'] = StaticText(title)
        elif history_len < 21:
            self['title0'] = StaticText('')
            self['title1'] = StaticText(title)
        else:
            self['title0'] = StaticText('')
            self['title1'] = StaticText('')
            self['title2'] = StaticText(title)
        if t_history.thistory == '':
            t_history.thistory = str(title) + ' > '
        else:
            t_history.thistory = t_history.thistory + str(title) + ' > '
        if config.usage.menutype.value == 'horzanim' and '<screen name="Animmain" ' in self.sktxt:
            self['label1'] = StaticText()
            self['label2'] = StaticText()
            self['label3'] = StaticText()
            self['label4'] = StaticText()
            self['label5'] = StaticText()
            self.onShown.append(self.openTestA)
        elif config.usage.menutype.value == 'horzicon' and '<screen name="Iconmain" ' in self.sktxt:
            self['label1'] = StaticText()
            self['label2'] = StaticText()
            self['label3'] = StaticText()
            self['label4'] = StaticText()
            self['label5'] = StaticText()
            self['label6'] = StaticText()
            self['label1s'] = StaticText()
            self['label2s'] = StaticText()
            self['label3s'] = StaticText()
            self['label4s'] = StaticText()
            self['label5s'] = StaticText()
            self['label6s'] = StaticText()
            self['pointer'] = Pixmap()
            self['pixmap1'] = Pixmap()
            self['pixmap2'] = Pixmap()
            self['pixmap3'] = Pixmap()
            self['pixmap4'] = Pixmap()
            self['pixmap5'] = Pixmap()
            self['pixmap6'] = Pixmap()
            self.onShown.append(self.openTestB)

        self.number = 0
        self.nextNumberTimer = eTimer()
        self.nextNumberTimer.callback.append(self.okbuttonClick)
        if len(self.list) == 1:
            self.onExecBegin.append(self.__onExecBegin)
예제 #12
0
    def __init__(self, session):
        self.session = session
        Screen.__init__(self, session)
        HelpableScreen.__init__(self)
        self.setTitle(_("Quad PiP Channel Selection"))

        dw = self.session.desktop.size().width()
        dh = self.session.desktop.size().height()
        pw, ph = {
            1080: ("center", "center"),
            720: ("center", "center"),
            576: ("center", "20%")
        }.get(dh, ("center", "center"))
        (sw, sh) = {
            1080: (dw / 3, dh / 2),
            720: (int(dw / 2), int(dh / 1.5)),
            576: (int(dw / 1.3), int(dh / 1.5))
        }.get(dh, (28, 24))
        button_margin = 5
        button_h = 40
        list_y = 40 + button_margin * 3
        self.fontSize = {
            1080: (28, 24),
            720: (24, 20),
            576: (20, 18)
        }.get(dh, (28, 24))
        self.skin = QuadPiPChannelSelection.skin % (pw, ph, \
                    sw, sh+list_y, \
                    sw/8-70, button_margin, \
                    sw/8-70+sw/4, button_margin, \
                    sw/8-70+sw/4*2, button_margin, \
                    sw/8-70+sw/4*3, button_margin, \
                    sw/8-70, button_margin, \
                    sw/8-70+sw/4, button_margin, \
                    sw/8-70+sw/4*2, button_margin, \
                    sw/8-70+sw/4*3, button_margin, \
                    0, list_y, sw, sh, \
                    sw/16, 1, sw-sw/16*2, sh/13, \
                    sw/11, 1+sh/13,    sw-sw/16*2-sw/8, sh/18, \
                    sw/11, 1+sh/13+sh/18,  sw-sw/16*2-sw/8, sh/18, \
                    sw/11, 1+sh/13+sh/18*2,  sw-sw/16*2-sw/8, sh/18, \
                    sw/11, 1+sh/13+sh/18*3,  sw-sw/16*2-sw/8, sh/18, \
                    self.fontSize[0], self.fontSize[1], \
                    sh/3)
        self["key_red"] = Label(_("Select"))
        self["key_green"] = Label(_("Add"))
        self["key_yellow"] = Label(_("Remove"))
        self["key_blue"] = Label(_("Edit"))

        self.PipChannelListApply = []
        self["ChannelList"] = List(self.PipChannelListApply)

        self["qpipActions"] = HelpableActionMap(
            self, "QuadPipSetupActions", {
                "red": (self.keyRed, _("Select Quad Channels")),
                "green": (self.keyGreen, _("Add New Quad Channel Entry")),
                "yellow": (self.keyYellow, _("Remove Quad Channel Entry")),
                "blue": (self.keyBlue, _("Edit Quad Channel Entry")),
            }, -2)

        self["OkCancelActions"] = HelpableActionMap(
            self, "OkCancelActions", {
                "ok": (self.keyOk, _("Select Quad Channels")),
                "cancel": (self.keyCancel, _("Exit Quad Channel Selection")),
            }, -2)

        self.oldPosition = None

        global quad_pip_channel_list_instance
        self.qpipChannelList = quad_pip_channel_list_instance

        self.oldPosition = self.qpipChannelList.getIdx() - 1

        self.onLayoutFinish.append(self.layoutFinishedCB)
예제 #13
0
class HddFastRemove(Screen):

	skin = """
                <screen name="HddFastRemove" position="center,115" size="900,530" title="HddFastRemove" flags="wfBorder">
                      <ePixmap position="10,497" size="35,27" pixmap="skin_default/buttons/red.png" alphatest="blend" />
                      <ePixmap position="230,497" size="35,27" pixmap="skin_default/buttons/green.png" alphatest="blend" />
                      <ePixmap position="464,497" size="35,27" pixmap="skin_default/buttons/yellow.png" alphatest="blend" />
                      <ePixmap position="695,497" size="35,27" pixmap="skin_default/buttons/blue.png" alphatest="blend" />
                      <widget name="key_red" position="48,498" zPosition="2" size="150,22" valign="center" halign="center" font="Regular; 20" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
                      <widget name="key_green" position="273,499" zPosition="2" size="150,22" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" backgroundColor="foreground" />
                      <widget name="key_yellow" position="508,499" zPosition="3" size="150,22" valign="center" halign="center" font="Regular; 21" transparent="1" backgroundColor="foreground" />
                      <widget name="key_blue" position="736,499" zPosition="3" size="150,22" valign="center" halign="center" font="Regular; 21" transparent="1" backgroundColor="foreground" />
                      <eLabel text="Hard Drive Remove" zPosition="2" position="10,11" size="880,40" halign="left" font="Regular;28" foregroundColor="un538eff" transparent="1" shadowColor="black" shadowOffset="-1,-1" backgroundColor="black" />
                      <widget source="menu" render="Listbox" position="11,58" size="880,410" scrollbarMode="showOnDemand" transparent="1">
                      <convert type="TemplatedMultiContent">
				{"template": [
					MultiContentEntryPixmapAlphaTest(pos = (5, 0), size = (48, 48), png = 0),
					MultiContentEntryText(pos = (65, 3), size = (190, 38), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 1),
					MultiContentEntryText(pos = (65, 27), size = (190, 38), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 2),
					],
					"fonts": [gFont("Regular", 22), gFont("Regular", 18)],
					"itemHeight": 50
				}
			</convert>
                     </widget>
                    </screen>"""


	def __init__(self, session):
		Screen.__init__(self, session)
		self.mdisks = Disks()
		self.mountpoints = MountPoints()
		self.mountpoints.read()
		self.disks = list ()
		self.mounts = list ()
		for disk in self.mdisks.disks:
			if disk[2] == True:
				diskname = disk[3]
				for partition in disk[5]:
					mp = ""
					rmp = ""
					try:
						mp = self.mountpoints.get(partition[0][:3], int(partition[0][3:]))
						rmp = self.mountpoints.getRealMount(partition[0][:3], int(partition[0][3:]))
					except Exception, e:
						pass
					if len(mp) > 0:
						self.disks.append(MountEntry(disk[3], "P.%s (Fixed: %s)" % (partition[0][3:], mp)))
						self.mounts.append(mp)
					elif len(rmp) > 0:
						self.disks.append(MountEntry(disk[3], "P.%s (Fast: %s)" % (partition[0][3:], rmp)))
						self.mounts.append(rmp)
						
		self["menu"] = List(self.disks)
		self["key_red"] = Button(_("Umount"))
		self["key_blue"] = Button(_("Exit"))
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
		{
			"blue": self.quit,
			"red": self.red,
			"cancel": self.quit,
		}, -2)
예제 #14
0
 def __init__(self, session):
     Screen.__init__(self, session)
     HelpableScreen.__init__(self)
     self["key_menu"] = StaticText(_("MENU"))
     self["key_info"] = StaticText(_("INFO"))
     self["key_red"] = StaticText()
     self["key_green"] = StaticText()
     self["key_yellow"] = StaticText()
     self["icons"] = MultiPixmap()
     self["icons"].hide()
     self.localeList = []
     self["locales"] = List(self.localeList, enableWrapAround=True)
     self["locales"].onSelectionChanged.append(self.selectionChanged)
     self["description"] = StaticText()
     self["selectionActions"] = HelpableActionMap(
         self,
         "LocaleSelectionActions", {
             "menu": (self.keySettings,
                      _("Manage Locale/Language Selection settings")),
             "current": (self.keyCurrent,
                         _("Jump to the currently active locale/language")),
             "select":
             (self.keySelect,
              _("Select the currently highlighted locale/language for the user interface"
                )),
             "close":
             (self.closeRecursive,
              _("Cancel any changes the active locale/language and exit all menus"
                )),
             "cancel":
             (self.keyCancel,
              _("Cancel any changes to the active locale/language and exit")
              ),
             "save":
             (self.keySave,
              _("Apply any changes to the active locale/langauge and exit"))
         },
         prio=0,
         description=_("Locale/Language Selection Actions"))
     self["manageActions"] = HelpableActionMap(
         self,
         "LocaleSelectionActions", {
             "manage":
             (self.keyManage,
              (_("Purge all but / Add / Delete the currently highlighted locale/language"
                 ),
               _("Purge all but the current and permanent locales/languages.  Add the current locale/language if it is not installed.  Delete the current locale/language if it is installed."
                 )))
         },
         prio=0,
         description=_("Locale/Language Selection Actions"))
     topItem = _("Move up to first line")
     topDesc = _("Move up to the first line in the list.")
     pageUpItem = _("Move up one screen")
     pageUpDesc = _(
         "Move up one screen.  Move to the first line of the screen if this is the first screen."
     )
     upItem = _("Move up one line")
     upDesc = _(
         "Move up one line.  Move to the bottom of the previous screen if this is the first line of the screen.  Move to the last of the entry / list if this is the first line of the list."
     )
     downItem = _("Move down one line")
     downDesc = _(
         "Move down one line.  Move to the top of the next screen if this is the last line of the screen.  Move to the first line of the list if this is the last line on the list."
     )
     pageDownItem = _("Move down one screen")
     pageDownDesc = _(
         "Move down one screen.  Move to the last line of the screen if this is the last screen."
     )
     bottomItem = _("Move down to last line")
     bottomDesc = _("Move down to the last line in the list.")
     self["navigationActions"] = HelpableActionMap(
         self,
         "NavigationActions", {
             "top": (self.keyTop, (topItem, topDesc)),
             "pageUp": (self.keyPageUp, (pageUpItem, pageUpDesc)),
             "up": (self.keyUp, (upItem, upDesc)),
             "first": (self.keyTop, (topItem, topDesc)),
             "left": (self.keyPageUp, (pageUpItem, pageUpDesc)),
             "right": (self.keyPageDown, (pageDownItem, pageDownDesc)),
             "last": (self.keyBottom, (bottomItem, bottomDesc)),
             "down": (self.keyDown, (downItem, downDesc)),
             "pageDown": (self.keyPageDown, (pageDownItem, pageDownDesc)),
             "bottom": (self.keyBottom, (bottomItem, bottomDesc))
         },
         prio=0,
         description=_("List Navigation Actions"))
     self.initialLocale = international.getLocale()
     self.currentLocale = self.initialLocale
     self.packageTimer = eTimer()
     self.packageTimer.callback.append(self.processPackage)
     self.packageDoneTimer = eTimer()
     self.packageDoneTimer.callback.append(self.processPackageDone)
     self.onLayoutFinish.append(self.layoutFinished)
예제 #15
0
	def __init__(self, session, parent):
		Screen.__init__(self, session)

		list = []

		menuID = None
		for x in parent:						#walk through the actual nodelist
			if not x.tag:
				continue
			if x.tag == 'item':
				item_level = int(x.get("level", 0))
				if item_level <= config.usage.setup_level.index:
					self.addItem(list, x)
					count += 1
			elif x.tag == 'menu':
				self.addMenu(list, x)
				count += 1
			elif x.tag == "id":
				menuID = x.get("val")
				count = 0

			if menuID is not None:
				# menuupdater?
				if menuupdater.updatedMenuAvailable(menuID):
					for x in menuupdater.getUpdatedMenu(menuID):
						if x[1] == count:
							list.append((x[0], boundFunction(self.runScreen, (x[2], x[3] + ", ")), x[4]))
							count += 1

		if menuID is not None:
			# plugins
			for l in plugins.getPluginsForMenu(menuID):
				# check if a plugin overrides an existing menu
				plugin_menuid = l[2]
				for x in list:
					if x[2] == plugin_menuid:
						list.remove(x)
						break
				list.append((l[0], boundFunction(l[1], self.session, close=self.close), l[2], l[3] or 50))

		# for the skin: first try a menu_<menuID>, then Menu
########################## pcd #################################		
#		self.skinName = [ ]
#		if menuID is not None:
#			self.skinName.append("menu_" + menuID)
#		self.skinName.append("Menu")

		# Sort by Weight
#		list.sort(key=lambda x: int(x[3]))
		self.skinName = [ ]
		self.menuID = menuID
		skfile = "/usr/share/enigma2/" + config.skin.primary_skin.value 
                f1 = file(skfile, "r")
                self.sktxt = f1.read()
                f1.close()    	
                if menuID is not None:
                    if ('<screen name="Animmain" ' in self.sktxt) and (config.usage.mainmenu_mode.value == "horzanim"): 
                        self.skinName.append("Animmain")
                        title = self.menuID
                        self.setTitle(title)
                    elif ('<screen name="Iconmain" ' in self.sktxt) and (config.usage.mainmenu_mode.value == "horzicon"): 
                        self.skinName.append("Iconmain")
                        title = self.menuID
                        self.setTitle(title)
                    else:
                        self.skinName.append("menu_" + menuID)
                self.skinName.append("Menu")


		# Sort by Weight
		list.sort(key=lambda x: int(x[3]))

		self.tlist = list
########################## pcd end #############################
		self["menu"] = List(list)

		self["actions"] = NumberActionMap(["OkCancelActions", "MenuActions", "NumberActions"],
			{
				"ok": self.okbuttonClick,
				"cancel": self.closeNonRecursive,
				"menu": self.closeRecursive,
				"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
			})

		a = parent.get("title", "").encode("UTF-8") or None
		a = a and _(a)
		if a is None:
			a = _(parent.get("text", "").encode("UTF-8"))
		self["title"] = StaticText(a)
		self.menu_title = a
###################### pcd ###############
                if ('<screen name="Animmain" ' in self.sktxt) and (config.usage.mainmenu_mode.value == "horzanim"): 
                        self.onShown.append(self.openTestA)
                elif ('<screen name="Iconmain" ' in self.sktxt) and (config.usage.mainmenu_mode.value == "horzicon"): 
                        self.onShown.append(self.openTestB)
예제 #16
0
    def __init__(self,
                 session,
                 menumode,
                 mselection,
                 mlist,
                 service,
                 selections,
                 currentPath,
                 playlist=False):
        Screen.__init__(self, session)
        self.mode = menumode
        self.mselection = mselection
        self.mlist = mlist
        self.service = service
        self.selections = selections
        self.currentPath = currentPath
        self.plist = playlist
        self.reloadafterclose = False

        self.menu = []
        if menumode == "normal":
            self["title"] = StaticText(_("Choose operation"))

            if os.path.realpath(self.currentPath) != os.path.realpath(
                    config.EMC.movie_homepath.value):
                self.menu.append(
                    (_("Movie home"), boundFunction(self.close, "Movie home")))

            if currentPath == config.EMC.movie_pathlimit.value:
                self.menu.append(
                    (_("Directory up"), boundFunction(self.close, "dirup")))

            self.menu.append((_("Reload current directory"),
                              boundFunction(self.close, "reloadwithoutcache")))

            self.menu.append(
                (_("Playlist Options"), boundFunction(self.close,
                                                      "emcPlaylist")))
            if service is not None:
                ext = os.path.splitext(service.getPath())[1].lower()
                if ext in extMedia:
                    self.menu.append((_("Add to current Playlist"),
                                      boundFunction(self.close,
                                                    "addPlaylist")))

            self.menu.append(
                (_("Play last"), boundFunction(self.close, "Play last")))

            self.menu.append(
                (_("Play All"), boundFunction(self.close, "playall")))
            self.menu.append(
                (_("Shuffle All"), boundFunction(self.close, "shuffleall")))

            self.menu.append(
                (_("Cover search"), boundFunction(self.close, "imdb")))
            if service is not None:
                if os.path.isdir(service.getPath()):
                    self.menu.append((_("Directory-Cover search"),
                                      boundFunction(self.close,
                                                    "imdbdirectory")))
            if self.selections:
                self.menu.append((_("Delete"),
                                  boundFunction(self.close, "del",
                                                self.selections)))
            else:
                self.menu.append(
                    (_("Delete"), boundFunction(self.close, "del")))

            if config.EMC.movie_trashcan_enable.value and os.path.exists(
                    config.EMC.movie_trashcan_path.value):
                if service is not None:
                    if self.selections:
                        self.menu.append(
                            (_("Delete permanently"),
                             boundFunction(self.close, "delete",
                                           self.selections)))
                    else:
                        self.menu.append((_("Delete permanently"),
                                          boundFunction(self.close, "delete")))
                self.menu.append(
                    (_("Empty trashcan"), boundFunction(self.emptyTrash)))
                self.menu.append(
                    (_("Go to trashcan"), boundFunction(self.close, "trash")))

            self.menu.append(
                (_("Mark all movies"), boundFunction(self.close, "markall")))
            self.menu.append(
                (_("Remove rogue files"), boundFunction(self.remRogueFiles)))

            self.menu.append(
                (_("Delete cut file(s)"), boundFunction(self.deleteCutFileQ)))

            self.menu.append(
                (_("Create link"), boundFunction(self.createLink,
                                                 currentPath)))
            self.menu.append((_("Create directory"),
                              boundFunction(self.createDir, currentPath)))

            self.menu.append((_("(Un-)Lock Directory"),
                              boundFunction(self.lockDir, currentPath)))

            if service is not None:
                if os.path.isfile(service.getPath()):
                    # can we use it for both ?
                    # selections comes also with one file !!! so we can it use.
                    if self.selections:
                        self.menu.append(
                            (_("Copy Files"),
                             boundFunction(self.close, "Copy Movie",
                                           self.selections)))
                        self.menu.append(
                            (_("Move Files"),
                             boundFunction(self.close, "Move Movie",
                                           self.selections)))
                    else:
                        self.menu.append(
                            (_("Copy File"),
                             boundFunction(self.close, "Copy Movie")))
                        self.menu.append(
                            (_("Move File"),
                             boundFunction(self.close, "Move Movie")))
                    #self.menu.append((_("Download Movie Information"), boundFunction(self.close, "Movie Information")))
                if service.getPath() != config.EMC.movie_trashcan_path.value:
                    if not service.getPath().endswith(
                            "/..") and not service.getPath().endswith(
                                "/Latest Recordings"):
                        self.menu.append(
                            (_("Download Movie Information"),
                             boundFunction(self.close, "Movie Information")))
                        #self.menu.append((_("Download Movie Cover"), boundFunction(self.close, "dlcover")))

            if self.service is not None or self.selections:
                self.menu.append((_("Rename selected movie(s)"),
                                  boundFunction(self.renameMovies)))
                self.menu.append((_("Remove cut list marker"),
                                  boundFunction(self.remCutListMarker)))
                self.menu.append((_("Reset marker from selected movie(s)"),
                                  boundFunction(self.resMarker)))
                show_plugins = True
                if self.selections:
                    for service in self.selections:
                        ext = os.path.splitext(service.getPath())[1].lower()
                        if ext not in extTS:
                            show_plugins = False
                            break
                else:
                    ext = os.path.splitext(self.service.getPath())[1].lower()
                    if ext not in extTS:
                        show_plugins = False
                if show_plugins:
                    # Only valid for ts files: CutListEditor, DVDBurn, ...
                    self.menu.extend([(p.description,
                                       boundFunction(self.execPlugin, p))
                                      for p in plugins.getPlugins(
                                          PluginDescriptor.WHERE_MOVIELIST)])

            self.menu.append((_("Open E2 Bookmark path"),
                              boundFunction(self.close, "openE2Bookmarks")))
            if not self.isE2Bookmark(currentPath):
                self.menu.append((_("Add directory to E2 Bookmarks"),
                                  boundFunction(self.addDirToE2Bookmarks,
                                                currentPath)))
            else:
                self.menu.append((_("Remove directory from E2 Bookmarks"),
                                  boundFunction(self.removeDirFromE2Bookmarks,
                                                currentPath)))
            if service is not None:
                if self.isE2Bookmark(service.getPath()):
                    self.menu.append(
                        (_("Remove selected E2 Bookmark"),
                         boundFunction(self.close, "removeE2Bookmark",
                                       service)))

            self.menu.append((_("Open EMC Bookmark path"),
                              boundFunction(self.close, "openEMCBookmarks")))
            if not self.isEMCBookmark(currentPath):
                self.menu.append((_("Add directory to EMC Bookmarks"),
                                  boundFunction(self.addDirToEMCBookmarks,
                                                currentPath)))
            else:
                self.menu.append((_("Remove directory from EMC Bookmarks"),
                                  boundFunction(self.removeDirFromEMCBookmarks,
                                                currentPath)))
            if service is not None:
                if self.isEMCBookmark(service.getPath()):
                    self.menu.append(
                        (_("Remove selected EMC Bookmark"),
                         boundFunction(self.close, "removeEMCBookmark",
                                       service)))

            self.menu.append((_("Set permanent sort"),
                              boundFunction(self.setPermanentSort, currentPath,
                                            mlist.actualSort)))
            if mlist.hasFolderPermanentSort(currentPath):
                self.menu.append((_("Remove permanent sort"),
                                  boundFunction(self.removePermanentSort,
                                                currentPath)))
            else:
                path = mlist.hasParentPermanentSort(currentPath)
                if path:
                    self.menu.append((_("Remove permanent sort from parent"),
                                      boundFunction(self.removePermanentSort,
                                                    path)))

            #self.menu.append((_("Open shell script menu"), boundFunction(self.close, "oscripts")))
            self.menu.append(
                (_("EMC Setup"), boundFunction(self.execPlugin, emcsetup)))

        elif menumode == "plugins":
            self["title"] = StaticText(_("Choose plugin"))
            if self.service is not None:
                for p in plugins.getPlugins(PluginDescriptor.WHERE_MOVIELIST):
                    self.menu.append(
                        (p.description, boundFunction(self.execPlugin, p)))

        elif menumode == "emcBookmarks":
            self["title"] = StaticText(_("Choose bookmark"))
            bm = self.getEMCBookmarks()
            if bm:
                for line in bm:
                    self.menu.append((line, boundFunction(self.close, line)))

        elif menumode == "emcPlaylist":
            self["title"] = StaticText(_("Playlist Options"))
            self.menu.append((_("Show current Playlist"),
                              boundFunction(self.close, "showPlaylist")))
            if service is not None:
                ext = os.path.splitext(service.getPath())[1].lower()
                if ext in extMedia:
                    self.menu.append((_("Add to current Playlist"),
                                      boundFunction(self.close,
                                                    "addPlaylist")))
            if self.plist:
                self.menu.append((_("Play current Playlist"),
                                  boundFunction(self.close, "playPlaylist")))
                self.menu.append((_("Play random current Playlist"),
                                  boundFunction(self.close,
                                                "playPlaylistRandom")))
                self.menu.append((_("Delete current Playlist"),
                                  boundFunction(self.close, "delPlaylist")))
            self.menu.append(
                (_("Playlist Setup"), boundFunction(self.close,
                                                    "setupPlaylist")))

        self["menu"] = List(self.menu)
        self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], {
            "ok": self.okButton,
            "cancel": self.close,
            "red": self.redButton,
        })
        self.onShow.append(self.onDialogShow)