Ejemplo n.º 1
0
 def __init__(self, session):
     self.skin = IPTVStreams.skin
     Screen.__init__(self, session)
     self['key_red'] = StaticText(_('Cancel'))
     self['key_yellow'] = StaticText(_('Change\nStreams'))
     self['key_green'] = StaticText(_('Download'))
     self['actions'] = ActionMap(
         ['SetupActions', 'NumberActions', 'ColorActions'], {
             'ok': self.keyOk,
             'save': self.keyGo,
             'cancel': self.keyCancel,
             'yellow': self.changeMenu,
             'green': self.keyGo,
             'red': self.keyCancel
         }, -2)
     self.list = SelectionList()
     self['list'] = self.list
     self['info'] = StaticText('')
     self.doExit = False
     self.level = self.LEVEL_FILES
     self.subMenuName = ''
     self.subMenuDescrName = ''
     self.xmlFiles = []
     self.xmlCategories = []
     self.lastchanged = ''
     self.lastchanges = ''
     self.onLayoutFinish.append(self.createTopMenu)
Ejemplo n.º 2
0
    def __init__(self, session, pkl_paths):
        Screen.__init__(self, session)
        self.setTitle(_("Directories with local setting"))

        self.skinName = ["pklMovieManager", "Setup"]

        self["key_red"] = Button(_("Cancel"))
        self["key_green"] = Button()
        self["key_blue"] = Button()
        self["key_yellow"] = Button()

        self.list = SelectionList([])
        self.pklPaths = pkl_paths
        self.reloadList()
        self["description"] = Label()

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions"], {
                "cancel": self.exit,
                "ok": self.list.toggleSelection,
                "red": self.exit,
                "blue": self.list.toggleAllSelection,
                "yellow": self.remove,
            })

        text = _(
            "Remove current item or select items with 'OK' or 'Inversion' and then use remove."
        )
        self["description"].setText(text)
Ejemplo n.º 3
0
    def __init__(self, session, title, item_descr, selected_items):
        Screen.__init__(self, session)
        HelpableScreen.__init__(self)
        SkinResolutionHelper.__init__(self)
        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("Save/Close"))
        self["list"] = SelectionList([])
        self.selected_items = selected_items
        for l in item_descr:
            selected = False
            for x in selected_items:
                if l[0] in x:
                    selected = True
            self["list"].addSelection(l[1], l[0], 0, selected)

        self["OkCancelActions"] = HelpableActionMap(
            self, "OkCancelActions", {
                "ok": (self["list"].toggleSelection, _("Toggle selected")),
                "cancel": (self.cancel, _("Cancel")),
            })
        self["ColorActions"] = HelpableActionMap(
            self, "ColorActions", {
                "red": (self.cancel, _("Cancel")),
                "green": (self.accept, _("Save/Close"))
            })
        self.setTitle(title)
Ejemplo n.º 4
0
 def __init__(self, session, tags, txt=None, parent=None):
     Screen.__init__(self, session, parent=parent)
     self.skinName = SkinTools.appendResolution("AdvancedMovieSelectionTagEditor")
     self["key_red"] = StaticText(_("Cancel"))
     self["key_green"] = StaticText(_("Save/Close"))
     self["key_yellow"] = StaticText(_("Create new Tag"))
     self["key_blue"] = StaticText("")
     self["key_blue"] = StaticText(_("Load Tag(s) from movies"))
     self["info"] = StaticText(_("Use the OK Button for the selection."))
     self["list"] = SelectionList()
     self.TimerEntry = TimerEntry
     allTags = self.loadTagsFile()
     self.joinTags(allTags, tags)
     self.updateMenuList(allTags, tags)
     self.ghostlist = tags[:]
     self.ghosttags = allTags[:]
     self.origtags = allTags[:]
     self.tags = allTags
     self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "MenuActions"],
     {
         "ok": self["list"].toggleSelection,
         "cancel": self.cancel,
         "red": self.cancel,
         "green": self.accept,
         "yellow": self.addCustom,
         "blue": self.loadFromHdd,
         "menu": self.showMenu
     }, -1)
     self.defaulttaglist(tags)
     self.setCustomTitle(tags)
Ejemplo n.º 5
0
	def __init__(self, session, userSatlist=""):
		Screen.__init__(self, session)
		self["key_red"] = Button(_("Cancel"))
		self["key_green"] = Button(_("Save"))
		self["key_yellow"] = Button(_("Sort by"))
		self["key_blue"] = Button(_("Select all"))
		self["hint"] = Label(_("Press OK to toggle the selection"))
		SatList = []
		if not isinstance(userSatlist, str):
			userSatlist = ""
		else:
			userSatlist = userSatlist.replace("]", "").replace("[", "")
		for sat in nimmanager.getSatList():
			selected = False
			sat_str = str(sat[0])
			if userSatlist and ("," not in userSatlist and sat_str == userSatlist) or ((', ' + sat_str + ',' in userSatlist) or (userSatlist.startswith(sat_str + ',')) or (userSatlist.endswith(', ' + sat_str))):
				selected = True
			SatList.append((sat[0], sat[1], sat[2], selected))
		sat_list = [SelectionEntryComponent(x[1], x[0], x[2], x[3]) for x in SatList]
		self["list"] = SelectionList(sat_list, enableWrapAround=True)
		self["setupActions"] = ActionMap(["SetupActions", "ColorActions"],
		{
			"red": self.cancel,
			"green": self.save,
			"yellow": self.sortBy,
			"blue": self["list"].toggleAllSelection,
			"save": self.save,
			"cancel": self.cancel,
			"ok": self["list"].toggleSelection,
		}, -2)
		self.setTitle(_("Select satellites"))
Ejemplo n.º 6
0
 def __init__(self, session):
     self.session = session
     Screen.__init__(self, session)
     self["key_red"] = Button(_("Cancel"))
     self["key_green"] = Button(_("Ok"))
     self["key_yellow"] = Button()  # _("Import now"))
     self["key_blue"] = Button()
     cfg = EPGConfig.loadUserSettings()
     filter = cfg["sources"]
     sources = [
         # (description, value, index, selected)
         SelectionEntryComponent(x.description, x.description, 0,
                                 (filter is None)
                                 or (x.description in filter))
         for x in EPGConfig.enumSources(CONFIG_PATH, filter=None)
     ]
     self["list"] = SelectionList(sources)
     self["setupActions"] = ActionMap(
         ["SetupActions", "ColorActions"], {
             "red": self.cancel,
             "green": self.save,
             "yellow": self.doimport,
             "save": self.save,
             "cancel": self.cancel,
             "ok": self["list"].toggleSelection,
         }, -2)
Ejemplo n.º 7
0
    def __init__(self, session, list):
        Screen.__init__(self, session)
        Screen.setTitle(self, _("IPK installer"))
        self.list = SelectionList()
        self["list"] = self.list
        for listindex in range(len(list)):
            if not list[listindex].split('/')[-1].startswith('._'):
                self.list.addSelection(list[listindex].split('/')[-1],
                                       list[listindex], listindex, False)

        self["key_red"] = StaticText(_("Close"))
        self["key_green"] = StaticText(_("Install"))
        self["key_yellow"] = StaticText()
        self["key_blue"] = StaticText(_("Invert"))
        self["introduction"] = StaticText(
            _("Press OK to toggle the selection."))

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions"], {
                "ok": self.list.toggleSelection,
                "cancel": self.close,
                "red": self.close,
                "green": self.install,
                "blue": self.list.toggleAllSelection
            }, -1)
Ejemplo n.º 8
0
	def __init__(self, session):
		Screen.__init__(self, session)
		HelpableScreen.__init__(self)

		# Initialize widgets
		self["key_green"] = StaticText(_("OK"))
		self["key_red"] = StaticText(_("Cancel"))
		self["key_yellow"] = StaticText("")
		self["key_blue"] = StaticText(_("Run"))
		self["plugins"] = StaticText(_("Plugins"))
		self["extensions"] = StaticText(_("Extensions"))
		self["eventinfo"] = StaticText(_("Eventinfo"))
		self["tabbar"] = MultiPixmap()

		self["list"] = SelectionList([])
		self.selectedList = LIST_PLUGINS
		self.updateList()

		self["PluginHiderSetupActions"] = HelpableActionMap(self, "PluginHiderSetupActions",
			{
				"ok": (self["list"].toggleSelection, _("toggle selection")),
				"cancel": (self.cancel, _("end editing")),
				"green": (self.save, _("save")),
				"blue": (self.run, _("run selected plugin")),
				"next": (self.next, _("select next tab")),
				"previous": (self.previous, _("select previous tab")),
			}, -1
		)

		self.onLayoutFinish.append(self.setCustomTitle)
Ejemplo n.º 9
0
 def __init__(self, session):
     self.session = session
     Screen.__init__(self, session)
     self.setup_title = _("XMLTV Import Sources")
     Screen.setTitle(self, self.setup_title)
     self["key_red"] = Button(_("Cancel"))
     self["key_green"] = Button(_("Ok"))
     self["key_yellow"] = Button()  # _("Import now"))
     self["key_blue"] = Button()
     self.onChangedEntry = []
     filter = config.plugins.xmltvimport.sources.getValue().split("|")
     sources = [
         # (description, value, index, selected)
         SelectionEntryComponent(x.description, x.description, 0,
                                 (filter is None)
                                 or (x.description in filter))
         for x in XMLTVConfig.enumSources(CONFIG_PATH, filter=None)
     ]
     self["list"] = SelectionList(sources)
     self["setupActions"] = ActionMap(
         ["SetupActions", "ColorActions", "MenuActions"], {
             "red": self.cancel,
             "green": self.save,
             "yellow": self.doimport,
             "save": self.save,
             "cancel": self.cancel,
             "ok": self["list"].toggleSelection,
             "menu": self.cancel,
         }, -2)
Ejemplo n.º 10
0
    def __init__(self, session, list, selected_caids):

        Screen.__init__(self, session)

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

        for listindex in range(len(list)):
            if find_in_list(selected_caids, list[listindex][0], 0):
                self.list.addSelection(list[listindex][0], list[listindex][1],
                                       listindex, True)
            else:
                self.list.addSelection(list[listindex][0], list[listindex][1],
                                       listindex, False)

        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("Save"))
        self["introduction"] = StaticText(
            _("Press OK to select/deselect a CAId."))

        self["actions"] = ActionMap(
            ["ColorActions", "SetupActions"], {
                "ok": self.list.toggleSelection,
                "cancel": self.cancel,
                "green": self.greenPressed,
                "red": self.cancel
            }, -1)
        self.onShown.append(self.setWindowTitle)
Ejemplo n.º 11
0
    def __init__(self, session, tags, txt=None, args=0, parent=None):
        Screen.__init__(self, session, parent=parent)

        # Initialize Buttons
        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("OK"))
        self["key_yellow"] = StaticText(_("New"))
        self["key_blue"] = StaticText(_("Load"))

        self["list"] = SelectionList()

        allTags = self.loadTagsFile()
        self.joinTags(allTags, tags)
        self.updateMenuList(allTags, tags)

        self.ghostlist = tags[:]
        self.ghosttags = allTags[:]
        self.origtags = allTags[:]
        self.tags = allTags

        # Define Actions
        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions", "MenuActions"], {
                "ok": self["list"].toggleSelection,
                "cancel": self.cancel,
                "red": self.cancel,
                "green": self.accept,
                "yellow": self.addCustom,
                "blue": self.loadFromHdd,
                "menu": self.showMenu
            }, -1)

        self.onLayoutFinish.append(self.setCustomTitle)
Ejemplo n.º 12
0
	def __init__(self, session, userSatlist=[]):
		Screen.__init__(self, session)
		self["key_red"] = Button(_("Cancel"))
		self["key_green"] = Button(_("Save"))
		self["key_yellow"] = Button(_("Sort by"))
		self["key_blue"] = Button(_("Select all"))
		self["hint"] = Label(_("Press OK to toggle the selection"))
		SatList = []
		for sat in nimmanager.getSatList():
			selected = False
			if isinstance(userSatlist, str) and str(sat[0]) in userSatlist:
				selected = True
			SatList.append((sat[0], sat[1], sat[2], selected))
		sat_list = [SelectionEntryComponent(x[1], x[0], x[2], x[3]) for x in SatList]
		self["list"] = SelectionList(sat_list, enableWrapAround=True)
		self["setupActions"] = ActionMap(["SetupActions", "ColorActions"],
		{
			"red": self.cancel,
			"green": self.save,
			"yellow": self.sortBy,
			"blue": self["list"].toggleAllSelection,
			"save": self.save,
			"cancel": self.cancel,
			"ok": self["list"].toggleSelection,
		}, -2)
		self.setTitle(_("Select satellites"))
Ejemplo n.º 13
0
 def __init__(self, session, tags=None, service=None, parent=None):
     Screen.__init__(self, session, parent=parent)
     HelpableScreen.__init__(self)
     TagManager.__init__(self)
     self.setTitle(_("Tag Editor"))
     if isinstance(service, eServiceReference):
         tags = eServiceCenter.getInstance().info(service).getInfoString(
             service, iServiceInformation.sTags)
         tags = tags.split(" ") if tags else []
     elif tags is None:
         tags = []
     elif isinstance(tags, list):
         pass
     elif isinstance(tags, str):
         tags = [x.strip()
                 for x in tags.split(",")] if "," in tags else [tags]
     else:
         raise TypeError(
             "[TagEditor] Error: Must be called with a service as a movie service reference or a tag list!"
         )
     self.service = service
     self["actions"] = HelpableActionMap(
         self, ["OkCancelActions", "ColorActions", "MenuActions"], {
             "cancel":
             (self.keyCancel, _("Cancel any changed tags and exit")),
             "save": (self.keySave, _("Save all changed tags and exit")),
             "ok": (self.toggleSelection,
                    _("Toggle selection of the current tag")),
             "red": (self.keyCancel, _("Cancel any changed tags and exit")),
             "green": (self.keySave, _("Save all changed tags and exit")),
             "yellow": (self.addNewTag, _("Add a new tag")),
             "blue": (self.loadFromData,
                      _("Load tags from the timer and recordings")),
             "menu": (self.showMenu, _("Display the tags context menu"))
         },
         prio=0,
         description=_("Tag Editor Actions"))
     self["key_red"] = StaticText(_("Cancel"))
     self["key_green"] = StaticText(_("Save"))
     self["key_yellow"] = StaticText(_("New"))
     self["key_blue"] = StaticText(_("Load"))
     self["key_menu"] = StaticText(_("MENU"))
     self["taglist"] = SelectionList(enableWrapAround=True)
     self.tags = self.mergeTags(tags)
     self.updateMenuList(self.tags, extraSelected=tags)
     self.ghostList = tags[:]
     self.ghostTags = self.tags[:]
Ejemplo n.º 14
0
    def __init__(self, session, list, selected_caids):
        Screen.__init__(self, session)
        self.list = SelectionList()
        self['list'] = self.list
        for listindex in range(len(list)):
            if find_in_list(selected_caids, list[listindex][0], 0):
                self.list.addSelection(list[listindex][0], list[listindex][1], listindex, True)
            else:
                self.list.addSelection(list[listindex][0], list[listindex][1], listindex, False)

        self['key_red'] = StaticText(_('Cancel'))
        self['key_green'] = StaticText(_('Save'))
        self['introduction'] = StaticText(_('Press OK to select/deselect a CAId.'))
        self['actions'] = ActionMap(['ColorActions', 'SetupActions'], {'ok': self.list.toggleSelection,
         'cancel': self.cancel,
         'green': self.greenPressed,
         'red': self.cancel}, -1)
        self.onShown.append(self.setWindowTitle)
Ejemplo n.º 15
0
    def __init__(self, session, list):
        Screen.__init__(self, session)
        Screen.setTitle(self, _('IPK Installer'))
        self.list = SelectionList()
        self['list'] = self.list
        for listindex in range(len(list)):
            if not list[listindex].split('/')[-1].startswith('._'):
                self.list.addSelection(list[listindex].split('/')[-1], list[listindex], listindex, False)

        self['key_red'] = StaticText(_('Close'))
        self['key_green'] = StaticText(_('Install'))
        self['key_yellow'] = StaticText()
        self['key_blue'] = StaticText(_('Invert'))
        self['introduction'] = StaticText(_('Press OK to toggle the selection.'))
        self['actions'] = ActionMap(['OkCancelActions', 'ColorActions'], {'ok': self.list.toggleSelection,
         'cancel': self.close,
         'red': self.close,
         'green': self.install,
         'blue': self.list.toggleAllSelection}, -1)
Ejemplo n.º 16
0
	def __init__(self, session, menu_path="", userSatlist=""):
		Screen.__init__(self, session)
		screentitle = _("Select satellites")
		if config.usage.show_menupath.value == 'large':
			menu_path += screentitle
			title = menu_path
			self["menu_path_compressed"] = StaticText("")
		elif config.usage.show_menupath.value == 'small':
			title = screentitle
			self["menu_path_compressed"] = StaticText(menu_path + " >" if not menu_path.endswith(' / ') else menu_path[:-3] + " >" or "")
		else:
			title = screentitle
			self["menu_path_compressed"] = StaticText("")
		Screen.setTitle(self, title)

		self["key_red"] = Button(_("Cancel"))
		self["key_green"] = Button(_("Save"))
		self["key_yellow"] = Button(_("Sort by"))
		self["key_blue"] = Button(_("Select all"))
		self["hint"] = Label(_("Press OK to toggle the selection"))
		SatList = []
		if not isinstance(userSatlist, str):
			userSatlist = ""
		else:
			userSatlist = userSatlist.replace("]", "").replace("[", "")
		for sat in nimmanager.getSatList():
			selected = False
			sat_str = str(sat[0])
			if userSatlist and ("," not in userSatlist and sat_str == userSatlist) or ((', ' + sat_str + ',' in userSatlist) or (userSatlist.startswith(sat_str + ',')) or (userSatlist.endswith(', ' + sat_str))):
				selected = True
			SatList.append((sat[0], sat[1], sat[2], selected))
		sat_list = [SelectionEntryComponent(x[1], x[0], x[2], x[3]) for x in SatList]
		self["list"] = SelectionList(sat_list, enableWrapAround=True)
		self["setupActions"] = ActionMap(["SetupActions", "ColorActions"],
		{
			"red": self.cancel,
			"green": self.save,
			"yellow": self.sortBy,
			"blue": self["list"].toggleAllSelection,
			"save": self.save,
			"cancel": self.cancel,
			"ok": self["list"].toggleSelection,
		}, -2)
Ejemplo n.º 17
0
	def __init__(self, session):
		self.session = session
		Screen.__init__(self, session)
		self.setup_title = _("EPG Import Filter") + " v" + VERSION + " by Acds"
		self.setTitle(self.setup_title)
		
		#cfg = EPGConfig.loadUserSettings()
		#filter = cfg["sources"]
		self.offerToSave = False
		self.callback = None
		bouquets = getBouquetList()
		filter = epgWorker.bouquets
		sources = [
			# (description, value, index, selected)
			SelectionEntryComponent(x[0], x[1], 0, (filter is None) or (x[0] in filter))
			for x in bouquets
			]
		self["statusbar"] = Label()
		self["status"] = Label()
		self["list"] = SelectionList(sources)
		self["setActions"] = ActionMap(["OkCancelActions", "ColorActions", "TimerEditActions"],
			{
				"cancel": self.cancel,
				"red": self.uninstall,
				"green": self.selectAll,
				"yellow": self.advanced,
				"blue": self.install,
				"ok": self.toggle
			}, -2)

		self["key_red"] = Label(_("Uninstall"))
		self["key_green"] = Label(_("Select All"))
		self["key_yellow"] = Label(_("Advanced"))
		self["key_blue"] = Label(_("Install"))

		self.updateTimer = enigma.eTimer()
	    	self.updateTimer.callback.append(self.updateStatus)
		
		self.updateStatus()
		self.updateTimer.start(2000)		
Ejemplo n.º 18
0
 def __init__(self, session):
     Screen.__init__(self, session)
     self.session = session
     self.workList = []
     self.readIndex = 0
     self.working = False
     self.hasFiles = False
     self.list = SelectionList()
     self["list"] = self.list
     self["key_red"] = StaticText(_("Close"))
     self["key_green"] = StaticText("")
     self["key_yellow"] = StaticText(_("Set server IP"))
     self["key_blue"] = StaticText("")
     self["statusbar"] = StaticText(_("Select a remote server IP first"))
     self["actions"] = ActionMap(
         ["OkCancelActions", "ColorActions"], {
             "ok": self.keyOk,
             "cancel": self.close,
             "red": self.close,
             "green": self.keyGreen,
             "yellow": self.keyYellow,
             "blue": self.keyBlue
         }, -1)
Ejemplo n.º 19
0
	def __init__(self, session):
		Screen.__init__(self, session)
		self.session = session
		self.workList = []
		self.readIndex = 0
		self.working = False
		self.hasFiles = False
		self.list = SelectionList()
		self["config"] = self.list
		self["key_red"] = StaticText(_("Back"))
		self["key_green"] = StaticText("")
		self["key_yellow"] = StaticText("")
		self["key_blue"] = StaticText("")
		self["text"] = Label()
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
		{
			"ok": self.keyOk,
			"cancel": self.keyExit,
			"red": self.keyExit,
			"green": self.keyGreen,
			"blue": self.keyBlue
		}, -1)
		self.setTitle(_("Select favorite bouqets to import"))
		self.setRemoteIpCallback(True)
Ejemplo n.º 20
0
 def __init__(self, session):
     Screen.__init__(self, session)
     Screen.setTitle(self, _('Select bouquets to convert'))
     self.session = session
     self.workList = []
     self.readIndex = 0
     self.working = False
     self.hasFiles = False
     self.list = SelectionList()
     self['list'] = self.list
     self['key_red'] = StaticText(_('Close'))
     self['key_green'] = StaticText('')
     self['key_yellow'] = StaticText(_('Set server IP'))
     self['key_blue'] = StaticText('')
     self['statusbar'] = StaticText(_('Select a remote server IP first'))
     self['actions'] = ActionMap(
         ['OkCancelActions', 'ColorActions'], {
             'ok': self.keyOk,
             'cancel': self.close,
             'red': self.close,
             'green': self.keyGreen,
             'yellow': self.keyYellow,
             'blue': self.keyBlue
         }, -1)
    def __init__(self, session, xmlConfigSupportInstance, availableObjects, preSelectedObjects = None, \
       windowTitle = None, filterBtnEnabled = True, showDisabled = True, loggerInstance = None):
        try:
            Screen.__init__(self, session)

            self.log = loggerInstance
            if self.log == None:
                self.log = getGeneralLogger()

            self.objectSupport = xmlConfigSupportInstance
            self.selectedObjects = {}
            if preSelectedObjects != None:
                for object in preSelectedObjects:
                    self.selectedObjects[object.key] = object
            self.availableObjects = availableObjects
            self.allSelected = False
            if len(self.selectedObjects) == len(self.availableObjects):
                self.allSelected = True
            self.showDisabled = showDisabled
            self.filterBtnEnabled = filterBtnEnabled
            if not self.filterBtnEnabled:
                self.showDisabled = True
            self.windowTitle = windowTitle

            self["key_red"] = StaticText(_("Cancel"))
            self["key_green"] = StaticText(_("OK"))
            self["key_yellow"] = StaticText()
            self["keyYellowIcon"] = Pixmap()
            self["key_blue"] = StaticText()
            self["keyBlueIcon"] = Pixmap()

            self["list"] = SelectionList(None, enableWrapAround=True)

            self["actions"] = ActionMap(
                ["OkCancelActions", "ColorActions"], {
                    "ok": self.toggleSelection,
                    "cancel": self.close,
                    "red": self.close,
                    "green": self.keyClose,
                    "yellow": self.toggleAll,
                }, -5)
            self["filteractions"] = ActionMap(["ColorActions"], {
                "blue": self.toggleFilter,
            }, -5)

            self.setSelection()
            self.setFilterButton()
            self.setAllButton()

            self.onLayoutFinish.append(self.setCustomTitle)
        except:
            if "log" in self:
                self.log.printOut("ConfigObject-Select-Init-Error:\n%s" %
                                  (str(format_exc())),
                                  level=ERROR_LEVEL)
            else:
                getGeneralLogger().printOut(
                    "ConfigObject-Select-Init-Error:\n%s" %
                    (str(format_exc())),
                    level=ERROR_LEVEL)
            self.close()
Ejemplo n.º 22
0
	def __init__(self, session, autotimer, name, begin, end, disabled, sref, afterEvent, justplay, dirname, tags):
		Screen.__init__(self, session)

		# Keep AutoTimer
		self.autotimer = autotimer

		# Initialize Buttons
		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("OK"))
		self["key_yellow"] = StaticText()
 		self["key_blue"] = StaticText()

		entries = []
		append = entries.append

		if disabled is not None:
			append(
				SelectionEntryComponent(
					': '.join((_("Enabled"), {True: _("disable"), False: _("enable")}[bool(disabled)])),
					not disabled,
					0,
					True
			))

		if name != "":
			append(
				SelectionEntryComponent(
					_("Match title: %s") % (name),
					name,
					1,
					True
			))
			append(
				SelectionEntryComponent(
					_("Exact match"),
					True,
					8,
					True
			))

		if begin and end:
			begin = localtime(begin)
			end = localtime(end)
			append(
				SelectionEntryComponent(
					_("Match Timespan: %02d:%02d - %02d:%02d") % (begin[3], begin[4], end[3], end[4]),
					((begin[3], begin[4]), (end[3], end[4])),
					2,
					True
			))
			append(
				SelectionEntryComponent(
					_("Only on Weekday: %s") % (weekdays[begin.tm_wday][1],), # XXX: the lookup is dirty but works :P
					str(begin.tm_wday),
					9,
					True
			))

		if sref:
			append(
				SelectionEntryComponent(
					_("Only on Service: %s") % (sref.getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', '')),
					str(sref),
					3,
					True
			))

		if afterEvent is not None:
			append(
				SelectionEntryComponent(
					': '.join((_("After event"), afterevent[afterEvent])),
					afterEvent,
					4,
					True
			))

		if justplay is not None:
			append(
				SelectionEntryComponent(
					': '.join((_("Timer type"), {0: _("record"), 1: _("zap")}[int(justplay)])),
					int(justplay),
					5,
					True
			))

		if dirname is not None:
			append(
				SelectionEntryComponent(
					': '.join((_("Location"), dirname or "/hdd/movie/")),
					dirname,
					6,
					True
			))

		if tags:
			append(
				SelectionEntryComponent(
					': '.join((_("Tags"), ', '.join(tags))),
					tags,
					7,
					True
			))

		self["list"] = SelectionList(entries)

		# Define Actions
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
		{
			"ok": self["list"].toggleSelection,
			"cancel": self.cancel,
			"red": self.cancel,
			"green": self.accept
		}, -1)

		self.onLayoutFinish.append(self.setCustomTitle)