def __init__(self, player, contexts=None, actions=None, prio=0): if not contexts: contexts = [] if not actions: actions = {} NumberActionMap.__init__(self, contexts, actions, prio) self.player = player
def __init__(self, parent, context, actions, prio): alist = [] adict = {} for (action, funchelp) in actions.iteritems(): alist.append((action, funchelp[1])) adict[action] = funchelp[0] NumberActionMap.__init__(self, [context], adict, prio) parent.helpList.append((self, context, alist))
def action(self, contexts, action): print '[MENU][MenuSelectionActionMap] action:', action if action == 'up' and self.menu.currentlist == self.menu.MENU_LIST: return 0 elif action == 'down' and self.menu.currentlist == self.menu.MENU_LIST: return 0 elif action == 'left' and self.menu.currentlist == self.menu.MENU_LIST: return 0 elif action == 'right' and self.menu.currentlist == self.menu.MENU_LIST: return 0 elif action == 'upRepeated' and self.menu.currentlist == self.menu.MENU_LIST: return 0 elif action == 'downRepeated' and self.menu.currentlist == self.menu.MENU_LIST: return 0 elif action == 'leftRepeated' and self.menu.currentlist == self.menu.MENU_LIST: return 0 elif action == 'rightRepeated' and self.menu.currentlist == self.menu.MENU_LIST: return 0 else: return NumberActionMap.action(self, contexts, action)
def __init__(self, session, service, isVirtualDir = False): Screen.__init__(self, session) self.allowPiP = SystemInfo["CanPiP"] self.allowPiPSwap = False try: import Plugins.Extensions.GraphMultiEPG.plugin self.zap_to_orig = Plugins.Extensions.GraphMultiEPG.plugin.zapToService Plugins.Extensions.GraphMultiEPG.plugin.zapToService = self.zapToServiceGMEPG except ImportError: self.zap_to_orig = False vtiactions = { "showEPGBar":(self.showEPGBar, _("show service EPGBar...")), "showSingleEPG":(self.showSingleEPG, _("show single service EPG...")), "setPlayMode":(self.setPlayMode, _("change play mode...")), "cancel": (self.moviebar_hide, _("leave movie player...")), } if self.allowPiP: vtiactions.update({"show_hide_pip": (self.showPiP, _("(de)activate Picture in Picture..."))}) self["actionsVTi"] = HelpableActionMap(self, "MoviePlayerActionsVTi",vtiactions,-1) self["NumberActions"] = NumberActionMap( [ "NumberActions"], { "1": self.keyNumber, "2": self.keyNumber, "3": self.keyNumber, "4": self.keyNumber, "5": self.keyNumber, "6": self.keyNumber, "7": self.keyNumber, "8": self.keyNumber, "9": self.keyNumber, "0": self.keyNumber, }, -2) self["actions"] = HelpableActionMap(self, "MoviePlayerActions", { "showSubtitle":(self.showSubtitle, _("Show the Subtitle...")), "leavePlayer": (self.leavePlayer, _("leave movie player...")), }) self["ChannelUpDownActions"] = HelpableActionMap(self, "ChannelUpDownActions", { "channelUp": (self.nextMedia, _("Play next media file in directory")), "channelDown": (self.previousMedia, _("Play previous media file in directory")), }) for x in HelpableScreen, InfoBarShowHide, InfoBarMenu, \ InfoBarBase, InfoBarSeek, InfoBarShowMovies, \ InfoBarAudioSelection, InfoBarNotifications, InfoBarSimpleEventView, \ InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, \ InfoBarMoviePlayerSummarySupport, InfoBarSubtitleSupport, \ InfoBarTeletextPlugin, InfoBarServiceErrorPopupSupport, InfoBarExtensions, \ InfoBarPlugins, InfoBarPiP, InfoBarInstantRecord: x.__init__(self) self.isVirtualDir = isVirtualDir self.movie_playlist = None self.random_play = None self.playmode = None self.movie_start_config = None self.random_history = [] if isinstance(service, tuple): self.movie_playlist = service[1] if len(service) >= 3: self.playmode = service[2] if self.playmode: self.movie_start_config = config.usage.on_movie_start.value config.usage.on_movie_start.value = "beginning" service = service[0] self.lastservice = session.nav.getCurrentlyPlayingServiceReference() if service: config.usage.movielist_last_played_movie.value = service.toString() config.usage.movielist_last_played_movie.save() session.nav.playService(service) self.returning = False self.InfoBar_Instance = None self.orig_openSingleServiceEPG = InfoBar.openSingleServiceEPG InfoBar.openSingleServiceEPG = self.movieEPG self.got_service_sel = None self.__InfoBar_Instance__() self.onClose.append(self.__onClose)
def __init__(self, session, text='', filename='', currDir=None, bookmarks=None, userMode=False, windowTitle=_('Select location'), minFree=None, autoAdd=False, editDir=False, inhibitDirs=None, inhibitMounts=None): if not inhibitDirs: inhibitDirs = [] if not inhibitMounts: inhibitMounts = [] Screen.__init__(self, session) NumericalTextInput.__init__(self, handleTimeout=False) HelpableScreen.__init__(self) self.setUseableChars(u'1234567890abcdefghijklmnopqrstuvwxyz') self.qs_timer = eTimer() self.qs_timer.callback.append(self.timeout) self.qs_timer_type = 0 self.curr_pos = -1 self.quickselect = '' self['text'] = Label(text) self['textbook'] = Label(_('Bookmarks')) self.text = text self.filename = filename self.minFree = minFree self.realBookmarks = bookmarks self.bookmarks = bookmarks and bookmarks.value[:] or [] self.userMode = userMode self.autoAdd = autoAdd self.editDir = editDir self.inhibitDirs = inhibitDirs self['filelist'] = FileList(currDir, showDirectories=True, showFiles=False, inhibitMounts=inhibitMounts, inhibitDirs=inhibitDirs) self['booklist'] = MenuList(self.bookmarks) self['key_green'] = Button(_('OK')) self['key_yellow'] = Button(_('Rename')) self['key_blue'] = Button(_('Remove bookmark')) self['key_red'] = Button(_('Cancel')) self['green'] = Pixmap() self['yellow'] = Pixmap() self['blue'] = Pixmap() self['red'] = Pixmap() self['target'] = Label() if self.userMode: self.usermodeOn() class LocationBoxActionMap(HelpableActionMap): def __init__(self, parent, context, actions=None, prio=0): if not actions: actions = {} HelpableActionMap.__init__(self, parent, context, actions, prio) self.box = parent def action(self, contexts, action): self.box.timeout(force=True) return HelpableActionMap.action(self, contexts, action) self['WizardActions'] = LocationBoxActionMap(self, 'WizardActions', { 'ok': (self.ok, _('select')), 'back': (self.cancel, _('Cancel')) }, -2) self['DirectionActions'] = LocationBoxActionMap( self, 'DirectionActions', { 'left': self.left, 'right': self.right, 'up': self.up, 'down': self.down }, -2) self['ColorActions'] = LocationBoxActionMap( self, 'ColorActions', { 'red': self.cancel, 'green': self.select, 'yellow': self.changeName, 'blue': self.addRemoveBookmark }, -2) self['EPGSelectActions'] = LocationBoxActionMap( self, 'EPGSelectActions', { 'prevService': (self.switchToBookList, _('switch to bookmarks')), 'nextService': (self.switchToFileList, _('switch to filelist')) }, -2) self['MenuActions'] = LocationBoxActionMap( self, 'MenuActions', {'menu': (self.showMenu, _('menu'))}, -2) self['NumberActions'] = NumberActionMap( ['NumberActions'], { '1': self.keyNumberGlobal, '2': self.keyNumberGlobal, '3': self.keyNumberGlobal, '4': self.keyNumberGlobal, '5': self.keyNumberGlobal, '6': self.keyNumberGlobal, '7': self.keyNumberGlobal, '8': self.keyNumberGlobal, '9': self.keyNumberGlobal, '0': self.keyNumberGlobal }) self.onShown.extend((boundFunction(self.setTitle, _('Select Location')), self.updateTarget, self.showHideRename)) self.onLayoutFinish.append(self.switchToFileListOnStart) self.onClose.append(self.disableTimer)
def __init__(self, session, title="", **kwargs): Screen.__init__(self, session) self.keys_list = [] self.shiftkeys_list = [] self.lang = language.getLanguage() self.nextLang = None self.shiftMode = False self.selectedKey = 0 self.smsChar = None self.sms = NumericalTextInput(self.smsOK) self.key_bg = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, "skin_default/vkey_bg.png")) self.key_sel = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, "skin_default/vkey_sel.png")) self.key_backspace = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, "skin_default/vkey_backspace.png")) self.key_all = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, "skin_default/vkey_all.png")) self.key_clr = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, "skin_default/vkey_clr.png")) self.key_esc = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, "skin_default/vkey_esc.png")) self.key_ok = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, "skin_default/vkey_ok.png")) self.key_shift = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, "skin_default/vkey_shift.png")) self.key_shift_sel = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, "skin_default/vkey_shift_sel.png")) self.key_space = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, "skin_default/vkey_space.png")) self.key_left = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, "skin_default/vkey_left.png")) self.key_right = LoadPixmap(path=resolveFilename( SCOPE_CURRENT_SKIN, "skin_default/vkey_right.png")) self.keyImages = { "BACKSPACE": self.key_backspace, "ALL": self.key_all, "EXIT": self.key_esc, "OK": self.key_ok, "SHIFT": self.key_shift, "SPACE": self.key_space, "LEFT": self.key_left, "RIGHT": self.key_right } self.keyImagesShift = { "BACKSPACE": self.key_backspace, "CLEAR": self.key_clr, "EXIT": self.key_esc, "OK": self.key_ok, "SHIFT": self.key_shift_sel, "SPACE": self.key_space, "LEFT": self.key_left, "RIGHT": self.key_right } self["country"] = StaticText("") self["header"] = Label(title) self["text"] = Input(currPos=len( kwargs.get("text", "").decode("utf-8", 'ignore')), allMarked=False, **kwargs) self["list"] = VirtualKeyBoardList([]) self["actions"] = NumberActionMap( [ "OkCancelActions", "WizardActions", "ColorActions", "KeyboardInputActions", "InputBoxActions", "InputAsciiActions" ], { "gotAsciiCode": self.keyGotAscii, "ok": self.okClicked, "cancel": self.exit, "left": self.left, "right": self.right, "up": self.up, "down": self.down, "red": self.exit, "green": self.ok, "yellow": self.switchLang, "blue": self.shiftClicked, "deleteBackward": self.backClicked, "deleteForward": self.forwardClicked, "back": self.exit, "pageUp": self.cursorRight, "pageDown": self.cursorLeft, "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, }, -2) self.setLang() self.onExecBegin.append(self.setKeyboardModeAscii) self.onLayoutFinish.append(self.buildVirtualKeyBoard) self.onClose.append(self.__onClose)
def __init__(self, menu, contexts = [], actions = {}, prio = -1): NumberActionMap.__init__(self, contexts, actions, prio) self.menu = menu
def __init__(self, session, dvd_device=None, dvd_filelist=[], args=None): Screen.__init__(self, session) InfoBarBase.__init__(self) InfoBarNotifications.__init__(self) InfoBarCueSheetSupport.__init__(self, actionmap="MediaPlayerCueSheetActions") InfoBarShowHide.__init__(self) InfoBarAudioSelection.__init__(self) InfoBarSubtitleSupport.__init__(self) HelpableScreen.__init__(self) self.save_infobar_seek_config() self.change_infobar_seek_config() InfoBarSeek.__init__(self) InfoBarPVRState.__init__(self) self.oldService = self.session.nav.getCurrentlyPlayingServiceOrGroup() self.session.nav.stopService() self["audioLabel"] = Label("n/a") self["subtitleLabel"] = Label("") self["angleLabel"] = Label("") self["chapterLabel"] = Label("") self["anglePix"] = Pixmap() self["anglePix"].hide() self.last_audioTuple = None self.last_subtitleTuple = None self.last_angleTuple = None self.totalChapters = 0 self.currentChapter = 0 self.totalTitles = 0 self.currentTitle = 0 self.__event_tracker = ServiceEventTracker( screen=self, eventmap={ iPlayableService.evStopped: self.__serviceStopped, iPlayableService.evUser: self.__timeUpdated, iPlayableService.evUser + 1: self.__statePlay, iPlayableService.evUser + 2: self.__statePause, iPlayableService.evUser + 3: self.__osdFFwdInfoAvail, iPlayableService.evUser + 4: self.__osdFBwdInfoAvail, iPlayableService.evUser + 5: self.__osdStringAvail, iPlayableService.evUser + 6: self.__osdAudioInfoAvail, iPlayableService.evUser + 7: self.__osdSubtitleInfoAvail, iPlayableService.evUser + 8: self.__chapterUpdated, iPlayableService.evUser + 9: self.__titleUpdated, iPlayableService.evUser + 11: self.__menuOpened, iPlayableService.evUser + 12: self.__menuClosed, iPlayableService.evUser + 13: self.__osdAngleInfoAvail }) self["DVDPlayerDirectionActions"] = ActionMap( ["DirectionActions"], { #MENU KEY DOWN ACTIONS "left": self.keyLeft, "right": self.keyRight, "up": self.keyUp, "down": self.keyDown, #MENU KEY REPEATED ACTIONS "leftRepeated": self.doNothing, "rightRepeated": self.doNothing, "upRepeated": self.doNothing, "downRepeated": self.doNothing, #MENU KEY UP ACTIONS "leftUp": self.doNothing, "rightUp": self.doNothing, "upUp": self.doNothing, "downUp": self.doNothing, }) self["OkCancelActions"] = ActionMap(["OkCancelActions"], { "ok": self.keyOk, "cancel": self.keyCancel, }) self["DVDPlayerPlaybackActions"] = HelpableActionMap( self, "DVDPlayerActions", { #PLAYER ACTIONS "dvdMenu": (self.enterDVDMenu, _("show DVD main menu")), "toggleInfo": (self.toggleInfo, _("toggle time, chapter, audio, subtitle info")), "nextChapter": (self.nextChapter, _("forward to the next chapter")), "prevChapter": (self.prevChapter, _("rewind to the previous chapter")), "nextTitle": (self.nextTitle, _("jump forward to the next title")), "prevTitle": (self.prevTitle, _("jump back to the previous title")), "tv": (self.askLeavePlayer, _("exit DVD player or return to file browser")), "dvdAudioMenu": (self.enterDVDAudioMenu, _("(show optional DVD audio menu)")), "AudioSelection": (self.enterAudioSelection, _("Select audio track")), "nextAudioTrack": (self.nextAudioTrack, _("switch to the next audio track")), "nextSubtitleTrack": (self.nextSubtitleTrack, _("switch to the next subtitle language")), "nextAngle": (self.nextAngle, _("switch to the next angle")), "seekBeginning": self.seekBeginning, }, -2) self["NumberActions"] = NumberActionMap( ["NumberActions"], { "1": self.keyNumberGlobal, "2": self.keyNumberGlobal, "3": self.keyNumberGlobal, "4": self.keyNumberGlobal, "5": self.keyNumberGlobal, "6": self.keyNumberGlobal, "7": self.keyNumberGlobal, "8": self.keyNumberGlobal, "9": self.keyNumberGlobal, "0": self.keyNumberGlobal, }) self.onClose.append(self.__onClose) try: from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier hotplugNotifier.append(self.hotplugCB) except: pass self.autoplay = dvd_device or dvd_filelist if dvd_device: self.physicalDVD = True else: self.scanHotplug() self.dvd_filelist = dvd_filelist self.onFirstExecBegin.append(self.opened) self.service = None self.in_menu = False
def __init__(self, session, title="", list=None, keys=None, selection=0, skin_name=None, text="", reorderConfig="", windowTitle=None, allow_cancel=True, titlebartext=_("Choice Box")): if not windowTitle: #for compatibility windowTitle = titlebartext if not list: list = [] if not skin_name: skin_name = [] Screen.__init__(self, session) self.allow_cancel = allow_cancel if isinstance(skin_name, str): skin_name = [skin_name] self.skinName = skin_name + ["ChoiceBox"] self.reorderConfig = reorderConfig self["text"] = Label() title_max = 55 if 'MetrixHD/' in config.skin.primary_skin.value: title_max += 10 if title: title = _(title) if len(title) < title_max and title.find('\n') == -1: Screen.setTitle(self, title) if text != "": self["text"] = Label(_(text)) elif title.find('\n') != -1: temptext = title.split('\n') if len(temptext[0]) < title_max: Screen.setTitle(self, temptext[0]) count = 2 labeltext = "" while len(temptext) >= count: if labeltext: labeltext += '\n' labeltext = labeltext + temptext[count - 1] count += 1 print('[Choicebox] count', count) self["text"].setText(labeltext) else: self["text"] = Label(title) else: self["text"] = Label(title) elif text: self["text"] = Label(_(text)) self.list = [] self.summarylist = [] if keys is None: self.__keys = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "red", "green", "yellow", "blue", "text" ] + (len(list) - 14) * [""] else: self.__keys = keys + (len(list) - len(keys)) * [""] self.keymap = {} pos = 0 if self.reorderConfig: self.config_type = eval("config.misc.pluginlist." + self.reorderConfig) if self.config_type.value: prev_list = [i for i in zip(list, self.__keys)] new_list = [] for x in self.config_type.value.split(","): for entry in prev_list: if entry[0][0] == x: new_list.append(entry) prev_list.remove(entry) list = [i for i in zip(*(new_list + prev_list))] list, self.__keys = list[0], list[1] number = 1 new_keys = [] for x in self.__keys: if (not x or x.isdigit()) and number <= 10: new_keys.append(str(number % 10)) number += 1 else: new_keys.append(not x.isdigit() and x or "") self.__keys = new_keys for x in list: strpos = str(self.__keys[pos]) self.list.append(ChoiceEntryComponent(key=strpos, text=x)) if self.__keys[pos] != "": self.keymap[self.__keys[pos]] = list[pos] self.summarylist.append((self.__keys[pos], x[0])) pos += 1 self["windowtitle"] = Label(_(windowTitle)) self["list"] = ChoiceList(list=self.list, selection=selection) self["summary_list"] = StaticText() self["summary_selection"] = StaticText() self.updateSummary(selection) self["actions"] = NumberActionMap( [ "WizardActions", "InputActions", "ColorActions", "DirectionActions", "MenuActions" ], { "ok": self.go, "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, "red": self.keyRed, "green": self.keyGreen, "yellow": self.keyYellow, "blue": self.keyBlue, "text": self.keyText, "up": self.up, "down": self.down, "left": self.left, "right": self.right, "shiftUp": self.additionalMoveUp, "shiftDown": self.additionalMoveDown, "menu": self.setDefaultChoiceList, "back": lambda: 0, # drop through to self["cancelaction"] }, prio=-2) self["cancelaction"] = ActionMap(["WizardActions"], { "back": self.cancel, }, prio=-1)
def __init__(self, session, tlist, menuTitle): Screen.__init__(self, session) self.skinName = 'Animmain' self.tlist = tlist ipage = 1 list = [] nopic = len(tlist) self.pos = [] self.index = 0 title = menuTitle self['title'] = Button(title) list = [] tlist = [] self['label1'] = StaticText() self['label2'] = StaticText() self['label3'] = StaticText() self['label4'] = StaticText() self['label5'] = StaticText() self['red'] = Button(_('Exit')) self['green'] = Button(_('Select')) self['yellow'] = Button(_('Config')) self['actions'] = NumberActionMap( [ 'OkCancelActions', 'MenuActions', 'DirectionActions', 'NumberActions', 'ColorActions' ], { 'ok': self.okbuttonClick, 'cancel': self.closeNonRecursive, 'left': self.key_left, 'right': self.key_right, 'up': self.key_up, 'down': self.key_down, 'red': self.cancel, 'green': self.okbuttonClick, 'yellow': self.key_menu, '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 }) nop = len(self.tlist) self.nop = nop nh = 1 if nop == 1: nh = 1 elif nop == 2: nh = 2 elif nop == 3: nh = 2 elif nop == 4: nh = 3 elif nop == 5: nh = 3 else: nh = int(float(nop) / 2) self.index = nh i = 0 self.onShown.append(self.openTest)
def __init__(self, session, text="", filename="", currDir=None, bookmarks=None, userMode=False, windowTitle=_("Select location"), minFree=None, autoAdd=False, editDir=False, inhibitDirs=None, inhibitMounts=None): # Init parents if not inhibitDirs: inhibitDirs = [] if not inhibitMounts: inhibitMounts = [] Screen.__init__(self, session) NumericalTextInput.__init__(self, handleTimeout=False) HelpableScreen.__init__(self) # Set useable chars self.setUseableChars(u'1234567890abcdefghijklmnopqrstuvwxyz') # Quickselect Timer self.qs_timer = eTimer() self.qs_timer.callback.append(self.timeout) self.qs_timer_type = 0 # Initialize Quickselect self.curr_pos = -1 self.quickselect = "" # Set Text self["text"] = Label(text) self["textbook"] = Label(_("Bookmarks")) # Save parameters locally self.text = text self.filename = filename self.minFree = minFree self.realBookmarks = bookmarks self.bookmarks = bookmarks and bookmarks.value[:] or [] self.userMode = userMode self.autoAdd = autoAdd self.editDir = editDir self.inhibitDirs = inhibitDirs # Initialize FileList self["filelist"] = FileList(currDir, showDirectories=True, showFiles=False, inhibitMounts=inhibitMounts, inhibitDirs=inhibitDirs) # Initialize BookList self["booklist"] = MenuList(self.bookmarks) # Buttons self["key_green"] = Button(_("OK")) self["key_yellow"] = Button(_("Rename")) self["key_blue"] = Button(_("Remove bookmark")) self["key_red"] = Button(_("Cancel")) # Background for Buttons self["green"] = Pixmap() self["yellow"] = Pixmap() self["blue"] = Pixmap() self["red"] = Pixmap() # Initialize Target self["target"] = Label() self["targetfreespace"] = Label() if self.userMode: self.usermodeOn() # Custom Action Handler class LocationBoxActionMap(HelpableActionMap): def __init__(self, parent, context, actions=None, prio=0): if not actions: actions = {} HelpableActionMap.__init__(self, parent, context, actions, prio) self.box = parent def action(self, contexts, action): # Reset Quickselect self.box.timeout(force=True) return HelpableActionMap.action(self, contexts, action) # Actions that will reset quickselect self["WizardActions"] = LocationBoxActionMap(self, "WizardActions", { "ok": (self.ok, _("select")), "back": (self.cancel, _("Cancel")), }, -2) self["DirectionActions"] = LocationBoxActionMap( self, "DirectionActions", { "left": self.left, "right": self.right, "up": self.up, "down": self.down, }, -2) self["ColorActions"] = LocationBoxActionMap( self, "ColorActions", { "red": self.cancel, "green": self.select, "yellow": self.changeName, "blue": self.addRemoveBookmark, }, -2) self["EPGSelectActions"] = LocationBoxActionMap( self, "EPGSelectActions", { "prevService": (self.switchToBookList, _("switch to bookmarks")), "nextService": (self.switchToFileList, _("switch to filelist")), }, -2) self["MenuActions"] = LocationBoxActionMap(self, "MenuActions", { "menu": (self.showMenu, _("menu")), }, -2) # Actions used by quickselect self["NumberActions"] = NumberActionMap( ["NumberActions"], { "1": self.keyNumberGlobal, "2": self.keyNumberGlobal, "3": self.keyNumberGlobal, "4": self.keyNumberGlobal, "5": self.keyNumberGlobal, "6": self.keyNumberGlobal, "7": self.keyNumberGlobal, "8": self.keyNumberGlobal, "9": self.keyNumberGlobal, "0": self.keyNumberGlobal }) # Run some functions when shown self.onShown.extend(( boundFunction(self.setTitle, _("Select Location")), self.updateTarget, self.showHideRename, )) self.onLayoutFinish.append(self.switchToFileListOnStart) # Make sure we remove our callback self.onClose.append(self.disableTimer)
def __init__(self, session, infobar): Screen.__init__(self, session) self.infobar = infobar or self.session.infobar self.wait = eTimer() self.wait.timeout.get().append(self.resyncSubtitles) self.resume = eTimer() self.resume.timeout.get().append(self.resyncSubtitlesResume) self["videofps"] = Label("") sub = self.infobar.selected_subtitle if sub[0] == 0: # dvb menu = [ getConfigMenuItem("config.subtitles.dvb_subtitles_yellow"), getConfigMenuItem("config.subtitles.dvb_subtitles_centered"), getConfigMenuItem("config.subtitles.dvb_subtitles_backtrans"), getConfigMenuItem( "config.subtitles.dvb_subtitles_original_position"), getConfigMenuItem("config.subtitles.subtitle_position"), getConfigMenuItem( "config.subtitles.subtitle_bad_timing_delay"), getConfigMenuItem( "config.subtitles.subtitle_noPTSrecordingdelay"), ] elif sub[0] == 1: # teletext menu = [ getConfigMenuItem("config.subtitles.ttx_subtitle_colors"), getConfigMenuItem( "config.subtitles.ttx_subtitle_original_position"), getConfigMenuItem("config.subtitles.subtitle_fontsize"), getConfigMenuItem("config.subtitles.subtitle_position"), getConfigMenuItem("config.subtitles.subtitle_rewrap"), getConfigMenuItem("config.subtitles.subtitle_borderwidth"), getConfigMenuItem("config.subtitles.subtitle_alignment"), getConfigMenuItem( "config.subtitles.subtitle_bad_timing_delay"), getConfigMenuItem( "config.subtitles.subtitle_noPTSrecordingdelay"), ] else: # pango menu = [ getConfigMenuItem("config.subtitles.pango_subtitles_delay"), getConfigMenuItem("config.subtitles.pango_subtitle_colors"), getConfigMenuItem( "config.subtitles.pango_subtitle_fontswitch"), getConfigMenuItem("config.subtitles.colourise_dialogs"), getConfigMenuItem("config.subtitles.subtitle_fontsize"), getConfigMenuItem("config.subtitles.subtitle_position"), getConfigMenuItem("config.subtitles.subtitle_alignment"), getConfigMenuItem("config.subtitles.subtitle_rewrap"), getConfigMenuItem("config.subtitles.pango_subtitle_removehi"), getConfigMenuItem("config.subtitles.subtitle_borderwidth"), getConfigMenuItem("config.subtitles.pango_subtitles_fps"), ] self["videofps"].setText( _("Video: %s fps") % (self.getFps().rstrip(".000"))) ConfigListScreen.__init__(self, menu, self.session, on_change=self.changedEntry) self["actions"] = NumberActionMap( ["SetupActions"], { "cancel": self.cancel, "ok": self.ok, "1": self.keyNumber, "3": self.keyNumber, "4": self.keyNumber, "6": self.keyNumber, "7": self.keyNumber, "9": self.keyNumber, "0": self.keyNumber, }, -2) self.onLayoutFinish.append(self.layoutFinished)
def __init__(self, session, servicelist=None): Screen.__init__(self, session) self.session = session if SystemInfo.get("NumVideoDecoders", 1) > 1 and config.plugins.virtualzap.usepip.value and config.plugins.virtualzap.showpipininfobar.value: self.skinName = "VirtualZap" self.pipAvailable = True else: self.skinName = "VirtualZapNoPiP" self.pipAvailable = (SystemInfo.get("NumVideoDecoders", 1) > 1) and config.plugins.virtualzap.usepip.value and not config.plugins.virtualzap.showpipininfobar.value self.epgcache = eEPGCache.getInstance() self.CheckForEPG = eTimer() self.CheckForEPG.callback.append(self.CheckItNow) self["NowChannel"] = Label() self["NowEPG"] = Label() self["NextEPG"] = Label() self["NowTime"] = Label() self["NextTime"] = Label() self["actions"] = ActionMap(["OkCancelActions", "DirectionActions", "ChannelSelectBaseActions", "ChannelSelectEPGActions", "ColorActions"], { "ok": self.ok, "cancel": self.closing, "right": self.nextService, "left": self.prevService, "nextBouquet": self.showFavourites, "prevBouquet": self.openServiceList, "showEPGList": self.openEventView, "blue": self.standardPiP, "yellow": self.switchAndStandardPiP, "down": self.switchChannelDown, "up": self.switchChannelUp, }, -2) self["actions2"] = NumberActionMap(["NumberActions"], { "0": self.swap, "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, }, -1) self.onLayoutFinish.append(self.onLayoutReady) # PiP if self.pipAvailable: # activate PiP support if config.plugins.virtualzap.usepip.value and not config.plugins.virtualzap.showpipininfobar.value: # activate standard PiP self["video"] = VideoWindow() else: # show PiP in Infobar self["video"] = VideoWindow(fb_width=getDesktop(0).size().width(), fb_height=getDesktop(0).size().height()) self.currentPiP = "" else: # no PiP self["video"] = Label() # this is the servicelist from ChannelSelectionBase self.servicelist = servicelist # save orig. method of zap in servicelist self.servicelist_orig_zap = self.servicelist.zap # when displaying ChannelSelection, do not zap when pressing "ok", so new method is needed self.servicelist.zap = self.servicelist_overwrite_zap # overwrite the actionmap of ChannelSelection self.servicelist["actions"] = ActionMap(["OkCancelActions"], { "cancel": self.cancelChannelSelection, "ok": self.servicelist.channelSelected, }) # temp. vars, needed when pressing cancel in ChannelSelection self.curSelectedRef = None self.curSelectedBouquet = None # needed, because if we won't zap, we have to go back to the current bouquet and service self.curRef = ServiceReference(self.servicelist.getCurrentSelection()) self.curBouquet = self.servicelist.getRoot() # start with last used service if config.plugins.virtualzap.saveLastService.value: # get service and bouquet ref ref = eServiceReference(config.plugins.virtualzap.curref.value) bouquet = eServiceReference(config.plugins.virtualzap.curbouquet.value) if ref.valid() and bouquet.valid(): # select bouquet and ref in servicelist self.setServicelistSelection(bouquet, ref) # prepare exitTimer self.exitTimer = eTimer() self.exitTimer.timeout.get().append(self.standardPiP) # reverse changes of ChannelSelection when closing plugin self.onClose.append(self.__onClose) # if PiPServiceRelation is installed, get relation dict if plugin_PiPServiceRelation_installed: self.pipServiceRelation = getRelationDict() else: self.pipServiceRelation = {}
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)
def __init__(self, session, services): Screen.__init__(self, session) self.session = session self.oldService = self.session.nav.getCurrentlyPlayingServiceReference( ) self.consoleCmd = "" self.Console = Console() self.serviceHandler = eServiceCenter.getInstance() self.ref_list = services self.window_refs = [ None, None, None, None, None, None, None, None, None ] self.current_refidx = 0 self.current_window = 1 self.countdown = config.plugins.Mosaic.countdown.value self.working = False self.state = self.PLAY self["playState"] = Pixmap() for i in range(1, 10): self["window" + str(i)] = Pixmap() self["video" + str(i)] = VideoWindow(decoder=0, fb_width=self.width, fb_height=self.height) self["video" + str(i)].hide() self["channel" + str(i)] = Label("") self["event" + str(i)] = Label("") self["event" + str(i)].hide() self["video1"].decoder = 0 self["video1"].show() self["countdown"] = Label() self.updateCountdownLabel() self["count"] = Label() self["actions"] = NumberActionMap( ["MosaicActions"], { "ok": self.exit, "cancel": self.closeWithOldService, "green": self.play, "yellow": self.pause, "channelup": self.countdownPlus, "channeldown": self.countdownMinus, "1": self.numberPressed, "2": self.numberPressed, "3": self.numberPressed, "4": self.numberPressed, "5": self.numberPressed, "6": self.numberPressed, "7": self.numberPressed, "8": self.numberPressed, "9": self.numberPressed }, prio=-1) self.updateTimer = eTimer() self.updateTimer_conn = self.updateTimer.timeout.connect( self.updateCountdown) self.checkTimer = eTimer() self.checkTimer_conn = self.checkTimer.timeout.connect(self.checkGrab) self.checkTimer.start(500, 1)
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)
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)
def __init__(self, session, title='', list=None, keys=None, selection=0, skin_name=None, text='', reorderConfig='', var=''): if not list: list = [] if not skin_name: skin_name = [] Screen.__init__(self, session) if isinstance(skin_name, str): skin_name = [skin_name] self.skinName = skin_name + ['ChoiceBox'] self.reorderConfig = reorderConfig self['text'] = Label() self.var = '' if skin_name and 'SoftwareUpdateChoices' in skin_name and var and var in ( 'unstable', 'updating', 'stable', 'unknown'): self.var = var self['feedStatusMSG'] = Label() self['tl_off'] = Pixmap() self['tl_red'] = Pixmap() self['tl_yellow'] = Pixmap() self['tl_green'] = Pixmap() if title: title = _(title) if len(title) < 55 and title.find('\n') == -1: Screen.setTitle(self, title) elif title.find('\n') != -1: temptext = title.split('\n') if len(temptext[0]) < 55: Screen.setTitle(self, temptext[0]) count = 2 labeltext = '' while len(temptext) >= count: if labeltext: labeltext += '\n' labeltext = labeltext + temptext[count - 1] count += 1 print 'count', count self['text'].setText(labeltext) else: self['text'] = Label(title) else: self['text'] = Label(title) elif text: self['text'] = Label(_(text)) self.list = [] self.summarylist = [] if keys is None: self.__keys = [ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'red', 'green', 'yellow', 'blue' ] + (len(list) - 14) * [''] else: self.__keys = keys + (len(list) - len(keys)) * [''] self.keymap = {} pos = 0 if self.reorderConfig: self.config_type = eval('config.misc.pluginlist.' + self.reorderConfig) if self.config_type.value: prev_list = zip(list, self.__keys) new_list = [] for x in self.config_type.value.split(','): for entry in prev_list: if entry[0][0] == x: new_list.append(entry) prev_list.remove(entry) list = zip(*(new_list + prev_list)) list, self.__keys = list[0], list[1] number = 1 new_keys = [] for x in self.__keys: if (not x or x.isdigit()) and number <= 10: new_keys.append(str(number % 10)) number += 1 else: new_keys.append(not x.isdigit() and x or '') self.__keys = new_keys for x in list: strpos = str(self.__keys[pos]) self.list.append(ChoiceEntryComponent(key=strpos, text=x)) if self.__keys[pos] != '': self.keymap[self.__keys[pos]] = list[pos] self.summarylist.append((self.__keys[pos], x[0])) pos += 1 self['list'] = ChoiceList(list=self.list, selection=selection) self['summary_list'] = StaticText() self['summary_selection'] = StaticText() self.updateSummary(selection) self['actions'] = NumberActionMap( [ 'WizardActions', 'InputActions', 'ColorActions', 'DirectionActions', 'MenuActions' ], { 'ok': self.go, '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, 'red': self.keyRed, 'green': self.keyGreen, 'yellow': self.keyYellow, 'blue': self.keyBlue, 'up': self.up, 'down': self.down, 'left': self.left, 'right': self.right, 'shiftUp': self.additionalMoveUp, 'shiftDown': self.additionalMoveDown, 'menu': self.setDefaultChoiceList }, -1) self['cancelaction'] = NumberActionMap( ['WizardActions', 'InputActions', 'ColorActions'], {'back': self.cancel}, -1) self.onShown.append(self.onshow) return
def __init__(self, session, parent): Screen.__init__(self, session) self.sort_mode = False self.selected_entry = None self.sub_menu_sort = None self["green"] = Label() self["yellow"] = Label() self["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 = six.ensure_str( x.get("description", "")) 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 findSkinScreen( "Animmain"): self.skinName.append('Animmain') elif config.usage.menutype.value == 'horzicon' and findSkinScreen( "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["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 = six.ensure_str(parent.get("title", "")) or None a = a and _(a) if a is None: a = _(six.ensure_str(parent.get("text", ""))) 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 findSkinScreen( "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 findSkinScreen( "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, title='', **kwargs): Screen.__init__(self, session) self.setTitle(_('Virtual KeyBoard')) self.keys_list = [] self.shiftkeys_list = [] self.lang = language.getLanguage() self.nextLang = None self.shiftMode = False self.selectedKey = 0 self.smsChar = None self.sms = NumericalTextInput(self.smsOK) self.key_bg = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, 'buttons/vkey_bg.png')) self.key_sel = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, 'buttons/vkey_sel.png')) self.key_backspace = LoadPixmap(path=resolveFilename( SCOPE_ACTIVE_SKIN, 'buttons/vkey_backspace.png')) self.key_all = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, 'buttons/vkey_all.png')) self.key_clr = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, 'buttons/vkey_clr.png')) self.key_esc = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, 'buttons/vkey_esc.png')) self.key_ok = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, 'buttons/vkey_ok.png')) self.key_shift = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, 'buttons/vkey_shift.png')) self.key_shift_sel = LoadPixmap(path=resolveFilename( SCOPE_ACTIVE_SKIN, 'buttons/vkey_shift_sel.png')) self.key_space = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, 'buttons/vkey_space.png')) self.key_left = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, 'buttons/vkey_left.png')) self.key_right = LoadPixmap( path=resolveFilename(SCOPE_ACTIVE_SKIN, 'buttons/vkey_right.png')) self.keyImages = { 'BACKSPACE': self.key_backspace, 'ALL': self.key_all, 'EXIT': self.key_esc, 'OK': self.key_ok, 'SHIFT': self.key_shift, 'SPACE': self.key_space, 'LEFT': self.key_left, 'RIGHT': self.key_right } self.keyImagesShift = { 'BACKSPACE': self.key_backspace, 'CLEAR': self.key_clr, 'EXIT': self.key_esc, 'OK': self.key_ok, 'SHIFT': self.key_shift_sel, 'SPACE': self.key_space, 'LEFT': self.key_left, 'RIGHT': self.key_right } self['country'] = StaticText('') self['header'] = Label() self['text'] = Input(currPos=len( kwargs.get('text', '').decode('utf-8', 'ignore')), allMarked=False, **kwargs) self['list'] = VirtualKeyBoardList([]) self['actions'] = NumberActionMap( [ 'OkCancelActions', 'WizardActions', 'ColorActions', 'KeyboardInputActions', 'InputBoxActions', 'InputAsciiActions' ], { 'gotAsciiCode': self.keyGotAscii, 'ok': self.okClicked, 'OKLong': self.okLongClicked, 'cancel': self.exit, 'left': self.left, 'right': self.right, 'up': self.up, 'down': self.down, 'red': self.exit, 'green': self.ok, 'yellow': self.switchLang, 'blue': self.shiftClicked, 'deleteBackward': self.backClicked, 'deleteForward': self.forwardClicked, 'back': self.exit, 'pageUp': self.cursorRight, 'pageDown': self.cursorLeft, '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 }, -2) self.setLang() self.onExecBegin.append(self.setKeyboardModeAscii) self.onLayoutFinish.append(self.buildVirtualKeyBoard) self.onClose.append(self.__onClose) return
def __init__(self, session, tlist, menuTitle): Screen.__init__(self, session) self.skinName = 'Iconmain' self.tlist = tlist ipage = 1 list = [] nopic = len(self.tlist) self.pos = [] self.ipage = 1 self.index = 0 title = menuTitle self['title'] = Button(title) self.icons = [] self.indx = [] n1 = len(tlist) self.picnum = n1 list = [] tlist = [] 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['red'] = Button(_('Exit')) self['green'] = Button(_('Select')) self['yellow'] = Button(_('Config')) self['actions'] = NumberActionMap( [ 'OkCancelActions', 'MenuActions', 'DirectionActions', 'NumberActions', 'ColorActions' ], { 'ok': self.okbuttonClick, 'cancel': self.closeNonRecursive, 'left': self.key_left, 'right': self.key_right, 'up': self.key_up, 'down': self.key_down, 'red': self.cancel, 'green': self.okbuttonClick, 'yellow': self.key_menu, '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 }) self.index = 0 i = 0 self.maxentry = 29 self.istart = 0 i = 0 self.onShown.append(self.openTest)
def __init__(self, player, contexts=[], actions={}, prio=0): NumberActionMap.__init__(self, contexts, actions, prio) self.player = player
def __init__(self, session, title="", list=None, keys=None, selection=0, skin_name=None, text="", reorderConfig="", var="", menu_path=""): if not list: list = [] if not skin_name: skin_name = [] Screen.__init__(self, session) if isinstance(skin_name, str): skin_name = [skin_name] self.skinName = skin_name + ["ChoiceBox"] self.reorderConfig = reorderConfig self["text"] = Label() self.var = "" if skin_name and 'SoftwareUpdateChoices' in skin_name and var and var in ( 'unstable', 'updating', 'stable', 'unknown'): self.var = var self['feedStatusMSG'] = Label() self['tl_off'] = Pixmap() self['tl_red'] = Pixmap() self['tl_yellow'] = Pixmap() self['tl_green'] = Pixmap() if skin_name and 'SoftwareUpdateChoices' in skin_name: self["menu_path_compressed"] = StaticText(menu_path) if title: title = _(title) if len(title) < 55 and title.find('\n') == -1: Screen.setTitle(self, title) elif title.find('\n') != -1: temptext = title.split('\n') if len(temptext[0]) < 55: Screen.setTitle(self, temptext[0]) count = 2 labeltext = "" while len(temptext) >= count: if labeltext: labeltext += '\n' labeltext = labeltext + temptext[count - 1] count += 1 print '[Choicebox] count', count self["text"].setText(labeltext) else: self["text"] = Label(title) else: self["text"] = Label(title) elif text: self["text"] = Label(_(text)) self.list = [] self.summarylist = [] if keys is None: self.__keys = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "red", "green", "yellow", "blue" ] + (len(list) - 14) * [""] else: self.__keys = keys + (len(list) - len(keys)) * [""] self.keymap = {} pos = 0 if self.reorderConfig: self.config_type = eval("config.misc.pluginlist." + self.reorderConfig) if self.config_type.value: prev_list = zip(list, self.__keys) new_list = [] for x in self.config_type.value.split(","): for entry in prev_list: if entry[0][0] == x: new_list.append(entry) prev_list.remove(entry) list = zip(*(new_list + prev_list)) list, self.__keys = list[0], list[1] number = 1 new_keys = [] for x in self.__keys: if (not x or x.isdigit()) and number <= 10: new_keys.append(str(number % 10)) number += 1 else: new_keys.append(not x.isdigit() and x or "") self.__keys = new_keys for x in list: strpos = str(self.__keys[pos]) self.list.append(ChoiceEntryComponent(key=strpos, text=x)) if self.__keys[pos] != "": self.keymap[self.__keys[pos]] = list[pos] self.summarylist.append((self.__keys[pos], x[0])) pos += 1 self["list"] = ChoiceList(list=self.list, selection=selection) self["summary_list"] = StaticText() self["summary_selection"] = StaticText() self.updateSummary(selection) self["actions"] = NumberActionMap( [ "WizardActions", "InputActions", "ColorActions", "DirectionActions", "MenuActions" ], { "ok": self.go, "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, "red": self.keyRed, "green": self.keyGreen, "yellow": self.keyYellow, "blue": self.keyBlue, "up": self.up, "down": self.down, "left": self.left, "right": self.right, "shiftUp": self.additionalMoveUp, "shiftDown": self.additionalMoveDown, "menu": self.setDefaultChoiceList }, -1) self["cancelaction"] = NumberActionMap( ["WizardActions", "InputActions", "ColorActions"], { "back": self.cancel, }, -1) self.onShown.append(self.onshow)
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)
def __init__(self, session, feid): self.session = session Screen.__init__(self, session) self.feid = feid self.oldref = None log.open(self.LOG_SIZE) if config.Nims[self.feid].configMode.value == 'advanced': self.advanced = True self.advancedconfig = config.Nims[self.feid].advanced self.advancedsats = self.advancedconfig.sat self.availablesats = map(lambda x: x[0], nimmanager.getRotorSatListForNim(self.feid)) else: self.advanced = False cur = { } if not self.openFrontend(): self.oldref = session.nav.getCurrentlyPlayingServiceReference() service = session.nav.getCurrentService() feInfo = service and service.frontendInfo() if feInfo: cur = feInfo.getTransponderData(True) del feInfo del service session.nav.stopService() # try to disable foreground service if not self.openFrontend(): if session.pipshown: # try to disable pip service = self.session.pip.pipservice feInfo = service and service.frontendInfo() if feInfo: cur = feInfo.getTransponderData(True) del feInfo del service from Screens.InfoBar import InfoBar InfoBar.instance and hasattr(InfoBar.instance, "showPiP") and InfoBar.instance.showPiP() if not self.openFrontend(): self.frontend = None # in normal case this should not happen if hasattr(self, 'raw_channel'): del self.raw_channel self.frontendStatus = { } self.diseqc = Diseqc(self.frontend) # True means we dont like that the normal sec stuff sends commands to the rotor! self.tuner = Tuner(self.frontend, ignore_rotor = True) tp = ( cur.get("frequency", 0) / 1000, cur.get("symbol_rate", 0) / 1000, cur.get("polarization", eDVBFrontendParametersSatellite.Polarisation_Horizontal), cur.get("fec_inner", eDVBFrontendParametersSatellite.FEC_Auto), cur.get("inversion", eDVBFrontendParametersSatellite.Inversion_Unknown), cur.get("orbital_position", 0), cur.get("system", eDVBFrontendParametersSatellite.System_DVB_S), cur.get("modulation", eDVBFrontendParametersSatellite.Modulation_QPSK), cur.get("rolloff", eDVBFrontendParametersSatellite.RollOff_alpha_0_35), cur.get("pilot", eDVBFrontendParametersSatellite.Pilot_Unknown)) self.tuner.tune(tp) self.isMoving = False self.stopOnLock = False self.red = Button("") self["key_red"] = self.red self.green = Button("") self["key_green"] = self.green self.yellow = Button("") self["key_yellow"] = self.yellow self.blue = Button("") self["key_blue"] = self.blue self.list = [] self["list"] = ConfigList(self.list) self["snr_db"] = TunerInfo(TunerInfo.SNR_DB, statusDict = self.frontendStatus) self["snr_percentage"] = TunerInfo(TunerInfo.SNR_PERCENTAGE, statusDict = self.frontendStatus) self["ber_value"] = TunerInfo(TunerInfo.BER_VALUE, statusDict = self.frontendStatus) self["snr_bar"] = TunerInfo(TunerInfo.SNR_BAR, statusDict = self.frontendStatus) self["ber_bar"] = TunerInfo(TunerInfo.BER_BAR, statusDict = self.frontendStatus) self["lock_state"] = TunerInfo(TunerInfo.LOCK_STATE, statusDict = self.frontendStatus) self["frequency_value"] = Label("") self["symbolrate_value"] = Label("") self["fec_value"] = Label("") self["polarisation"] = Label("") self["status_bar"] = Label("") self.statusMsgTimeoutTicks = 0 self.statusMsgBlinking = False self.statusMsgBlinkCount = 0 self.statusMsgBlinkRate = 500 / self.UPDATE_INTERVAL # milliseconds self.tuningChangedTo(tp) self["actions"] = NumberActionMap(["DirectionActions", "OkCancelActions", "ColorActions", "TimerEditActions", "InputActions"], { "ok": self.keyOK, "cancel": self.keyCancel, "up": self.keyUp, "down": self.keyDown, "left": self.keyLeft, "right": self.keyRight, "red": self.redKey, "green": self.greenKey, "yellow": self.yellowKey, "blue": self.blueKey, "log": self.showLog, "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.updateColors("tune") self.statusTimer = eTimer() self.statusTimer.callback.append(self.updateStatus) self.collectingStatistics = False self.statusTimer.start(self.UPDATE_INTERVAL, True) self.dataAvailable = Event() self.onClose.append(self.__onClose) self.createConfig() self.createSetup()
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 "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 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)
def __init__(self, session, title="", list=None, keys=None, selection=0, skin_name=None, text=""): self.setTitle(_("Choice Box")) if not list: list = [] if not skin_name: skin_name = [] Screen.__init__(self, session) if isinstance(skin_name, str): skin_name = [skin_name] self.skinName = skin_name + ["ChoiceBox"] self["text"] = Label() if title: title = _(title) if len(title) < 55 and title.find('\n') == -1: Screen.setTitle(self, title) elif title.find('\n') != -1: temptext = title.split('\n') if len(temptext[0]) < 55: Screen.setTitle(self, temptext[0]) count = 2 labeltext = "" while len(temptext) >= count: if labeltext: labeltext += '\n' labeltext = labeltext + temptext[count - 1] count += 1 print 'count', count self["text"].setText(labeltext) else: self["text"] = Label(title) else: self["text"] = Label(title) elif text: self["text"] = Label(_(text)) self.list = [] self.summarylist = [] if keys is None: self.__keys = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "red", "green", "yellow", "blue" ] + (len(list) - 10) * [""] else: self.__keys = keys + (len(list) - len(keys)) * [""] self.keymap = {} pos = 0 for x in list: strpos = str(self.__keys[pos]) self.list.append(ChoiceEntryComponent(key=strpos, text=x)) if self.__keys[pos] != "": self.keymap[self.__keys[pos]] = list[pos] self.summarylist.append((self.__keys[pos], x[0])) pos += 1 self["list"] = ChoiceList(list=self.list, selection=selection) self["summary_list"] = StaticText() self["summary_selection"] = StaticText() self.updateSummary(selection) self["actions"] = NumberActionMap( ["WizardActions", "InputActions", "ColorActions"], { "ok": self.go, "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, "red": self.keyRed, "green": self.keyGreen, "yellow": self.keyYellow, "blue": self.keyBlue, "up": self.up, "down": self.down, "left": self.left, "right": self.right }, -1) self["cancelaction"] = NumberActionMap( ["WizardActions", "InputActions", "ColorActions"], { "back": self.cancel, }, -1)
def __init__(self, session, number, servicelist=None): Screen.__init__(self, session) self.digits = 4 self.field = str(number) self.servicelist = servicelist self.acount = config.plugins.NumberZapExt.acount.value self.startBouquet = None self.bouquets = None if self.servicelist is not None: self.bouquets = self.servicelist.getBouquetList() else: self.bouquets = None self.BouquetsPriority = False if config.plugins.NumberZapExt.bouquets_enable.value: if config.usage.multibouquet.value: self.bouquet_root_tv = eServiceReference( '1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "bouquets.tv" ORDER BY bouquet' ) self.bouquet_root_radio = eServiceReference( '1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "bouquets.radio" ORDER BY bouquet' ) else: self.bouquet_root_tv = eServiceReference( '%s FROM BOUQUET "userbouquet.favourites.tv" ORDER BY bouquet' % (service_types_tv)) self.bouquet_root_radio = eServiceReference( '%s FROM BOUQUET "userbouquet.favourites.radio" ORDER BY bouquet' % (service_types_radio)) self.Bouquetlist = self.getBouquetlist( self.bouquet_root_tv) + self.getBouquetlist( self.bouquet_root_radio) self.hotkeys_bouquets = eval( config.plugins.NumberZapExt.hotkeys_bouquets.value) self.kdelay = config.plugins.NumberZapExt.kdelay.value self.bouqSelDlg = None self.bouquet = None self.action = '' self.bouquet_action = None self.defpicon = None if config.plugins.NumberZapExt.picons.value: for scope, path in [(SCOPE_CURRENT_SKIN, "picon_default.png"), (SCOPE_SKIN_IMAGE, "skin_default/picon_default.png")]: tmp = resolveFilename(scope, path) if pathExists(tmp) and getSize(tmp): self.defpicon = tmp break self["Title"].setText(_("Service")) self["number"] = Label(_("Number:")) self["channel"] = Label(_("Channel:")) self["bouquet"] = Label(_("Bouquet:")) self["chNum"] = Label() self["chName"] = Label() self["chBouq"] = Label() self["chPicon"] = Pixmap() self["actions"] = NumberActionMap( ["ShortcutActions", "SetupActions", "MenuActions"], { "red": self.keyRed, "cancel": self.quit, "ok": self.keyOK, "green": self.keyGreen, "yellow": self.keyYellow, "blue": self.keyBlue, "menu": self.keyMenu, "1": self.keyNumberGlobal, "2": self.keyNumberGlobal, "3": self.keyNumberGlobal, "4": self.keyNumberGlobal, "5": self.keyNumberGlobal, "6": self.keyNumberGlobal, "7": self.keyNumberGlobal, "8": self.keyNumberGlobal, "9": self.keyNumberGlobal, "0": self.keyNumberGlobal }) self.Timer = eTimer() self.Timer.callback.append(self.keyOK) self.onFirstExecBegin.append(self.__onStart)
def __init__(self, session): Screen.__init__(self, session) self["red"] = Pixmap() self["green"] = Pixmap() self["yellow"] = Pixmap() self["blue"] = Pixmap() self["red_text"] = Label() self["green_text"] = Label() self["yellow_text"] = Label() self["blue_text"] = Label() self["current_status"] = Label() self.is_active = self.session.nav.SleepTimer.isActive() if self.is_active: self["current_status"].setText( _("Timer status:") + " " + _("Enabled")) else: self["current_status"].setText( _("Timer status:") + " " + _("Disabled")) if self.is_active: self.time = self.session.nav.SleepTimer.getCurrentSleepTime() else: self.time = config.SleepTimer.defaulttime.value self["input"] = Input(text=str(self.time), maxSize=False, type=Input.NUMBER) self.status = True self.updateColors() self["pretext"] = Label(_("Shutdown Settop Box after")) self["aftertext"] = Label(_("minutes")) self["actions"] = NumberActionMap( [ "SleepTimerEditorActions", "TextEntryActions", "KeyboardInputActions" ], { "exit": self.cancel, "select": self.select, "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, "selectLeft": self.selectLeft, "selectRight": self.selectRight, "left": self.selectLeft, "right": self.selectRight, "home": self.selectHome, "end": self.selectEnd, "deleteForward": self.deleteForward, "deleteBackward": self.deleteBackward, "disableTimer": self.disableTimer, "toggleAction": self.toggleAction, "toggleAsk": self.toggleAsk, "useServiceTime": self.useServiceTime }, -1)
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 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["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
def __init__(self, session, slotid, action, handler=eDVBCI_UI.getInstance(), wait_text="", screen_data=None): Screen.__init__(self, session) print "MMIDialog with action" + str(action) self.mmiclosed = False self.tag = None self.slotid = slotid self.timer = eTimer() self.timer.callback.append(self.keyCancel) #else the skins fails self["title"] = Label("") self["subtitle"] = Label("") self["bottom"] = Label("") self["entries"] = ConfigList([]) self["actions"] = NumberActionMap( ["SetupActions", "MenuActions"], { "ok": self.okbuttonClick, "cancel": self.keyCancel, "menu": self.forceExit, #for PIN "left": self.keyLeft, "right": self.keyRight, "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.action = action self.screen_data = screen_data self.is_pin_list = -1 self.handler = handler if wait_text == "": self.wait_text = _("wait for ci...") else: self.wait_text = wait_text if action == 2: #start MMI handler.startMMI(self.slotid) self.showWait() elif action == 3: #mmi already there (called from infobar) self.showScreen()
def __init__(self, player, contexts = [ ], actions = { }, prio=0): NumberActionMap.__init__(self, contexts, actions, prio) self.player = player
def action(self, contexts, action): self.player.show() return NumberActionMap.action(self, contexts, action)
def __init__(self, session, title="", list=[], keys=None, selection=0, skin_name=[], reorderConfig="", windowTitle=None): Screen.__init__(self, session) if isinstance(skin_name, str): skin_name = [skin_name] self.skinName = skin_name + ["ChoiceBox"] self.reorderConfig = reorderConfig self["autoresize"] = Label("") # do not remove, used for autoResize() self["description"] = Label() self["text"] = Label(title) self.list = [] self.summarylist = [] if keys is None: self.__keys = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "red", "green", "yellow", "blue" ] + (len(list) - 14) * ["dummy"] else: self.__keys = keys + (len(list) - len(keys)) * ["dummy"] self.keymap = {} pos = 0 if self.reorderConfig: self.config_type = eval("config.misc.pluginlist." + self.reorderConfig) if self.config_type.value: prev_list = zip(list, self.__keys) new_list = [] for x in self.config_type.value.split(","): for entry in prev_list: if entry[0][0] == x: new_list.append(entry) prev_list.remove(entry) list = zip(*(new_list + prev_list)) list, self.__keys = list[0], list[1] number = 1 new_keys = [] for x in self.__keys: if (not x or x.isdigit()) and number <= 10: new_keys.append(str(number % 10)) number+=1 else: new_keys.append(not x.isdigit() and x or "") self.__keys = new_keys for x in list: if x: strpos = str(self.__keys[pos]) self.list.append(ChoiceEntryComponent(key = strpos, text = x)) if self.__keys[pos] != "": self.keymap[self.__keys[pos]] = list[pos] self.summarylist.append((self.__keys[pos],x[0])) pos += 1 self["list"] = ChoiceList(list = self.list, selection = selection) self["summary_list"] = StaticText() self["summary_selection"] = StaticText() self.updateSummary(selection) self["actions"] = NumberActionMap(["WizardActions", "InputActions", "ColorActions", "DirectionActions", "MenuActions"], { "ok": self.go, "back": self.cancel, "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, "red": self.keyRed, "green": self.keyGreen, "yellow": self.keyYellow, "blue": self.keyBlue, "up": self.up, "down": self.down, "moveUp": self.additionalMoveUp, "moveDown": self.additionalMoveDown, "menu": self.setDefaultChoiceList, "rightUp": self.rightUp, "leftUp": self.leftUp }, -1) self.setTitle(windowTitle or _("Select"))