예제 #1
0
    def selectAll(self):
        #selected = [ item[0][1] for item in self["list"].list if item[0][3]]
        oneSelected = False
        oneUnSelected = False
        for idx, item in enumerate(self["list"].list):
            item = self["list"].list[idx][0]
            if item[3]:
                oneSelected = True
            else:
                oneUnSelected = True
        # Select all or unselect all if all selected
        if (oneSelected and not oneUnSelected) or (oneUnSelected
                                                   and not oneSelected):
            for idx, item in enumerate(self["list"].list):
                item = self["list"].list[idx][0]
                self["list"].list[idx] = SelectionEntryComponent(
                    item[0], item[1], item[2], not item[3])
            self["list"].setList(self["list"].list)
        if oneSelected and oneUnSelected:
            for idx, item in enumerate(self["list"].list):
                item = self["list"].list[idx][0]
                self["list"].list[idx] = SelectionEntryComponent(
                    item[0], item[1], item[2], True)
            self["list"].setList(self["list"].list)

        self.offerToSave = True
예제 #2
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"))
예제 #3
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"))
예제 #4
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)
예제 #5
0
	def updateList(self):
		if hasattr(plugins, 'pluginHider_baseGetPlugins'):
			fnc = plugins.pluginHider_baseGetPlugins
		else:
			fnc = plugins.getPlugins

		if self.selectedList == LIST_PLUGINS:
			list = fnc([PluginDescriptor.WHERE_PLUGINMENU])
			selected = config.plugins.pluginhider.hideplugins.value
		elif self.selectedList == LIST_EXTENSIONS:
			list = fnc([PluginDescriptor.WHERE_EXTENSIONSMENU])
			selected = config.plugins.pluginhider.hideextensions.value
		else: #if self.selectedList == LIST_EVENTINFO:
			list = fnc([PluginDescriptor.WHERE_EVENTINFO])
			selected = config.plugins.pluginhider.hideeventinfo.value
		self["tabbar"].setPixmapNum(self.selectedList)

		res = []
		i = 0
		for plugin in list:
			if plugin.description:
				name = "%s (%s)" % (plugin.name, plugin.description)
			else:
				name = plugin.name

			res.append(SelectionEntryComponent(
					name,
					plugin,
					i,
					plugin.name in selected,
			))
			i += 1
		self["list"].setList(res)
		if res:
			self["list"].moveToIndex(0)
예제 #6
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)
예제 #7
0
 def toggleSelection(self):
     entrylist = self["list"]
     if len(entrylist.list):
         idx = entrylist.getSelectedIndex()
         item = entrylist.list[idx][0]
         val = not item[3]
         entrylist.list[idx] = SelectionEntryComponent(
             item[0], item[1], item[2], val)
         if self.update_weekdays and item[2] == 2:
             next_idx = idx + 1
             # try:
             # next_item = entrylist.list[next_idx][0]
             # if next_item[2] == 9:
             # entry_val = val and self.begin.tm_wday or self.start.tm_wday
             # entrylist.list[next_idx] = SelectionEntryComponent(_("Only on Weekday: %s") % (weekdays[entry_val][1]), str(entry_val), next_item[2], next_item[3])
             # except:
             # pass
         entrylist.setList(entrylist.list)
예제 #8
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)
예제 #9
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)		
    def setSelection(self, selectAll=False, deselcetAll=False):
        entries = []
        index = 0

        for object in sorted(self.availableObjects,
                             key=lambda object: object.name.lower()):
            if not self.showDisabled and not object.enabled:
                continue
            if selectAll or deselcetAll:
                selected = True if selectAll else False
            else:
                selected = True if self.selectedObjects.has_key(
                    object.key) else False
            if selected:
                self.selectedObjects[object.key] = object
            elif self.selectedObjects.has_key(object.key):
                self.selectedObjects.pop(object.key)
            entries.append(
                SelectionEntryComponent(object.name, object, index, selected))
            index = index + 1

        self["list"].setList(entries)
예제 #11
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)