def __init__(self, session): Screen.__init__(self, session) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText() self["summary_description"] = StaticText("") self.selectedFiles = config.plugins.configurationbackup.backupdirs.value defaultDir = '/' inhibitDirs = ["/bin", "/boot", "/etc/enigma2", "/dev", "/autofs", "/lib", "/proc", "/sbin", "/sys", "/hdd", "/tmp", "/mnt", "/media"] self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir, inhibitDirs = inhibitDirs ) self["checkList"] = self.filelist self["actions"] = ActionMap(["DirectionActions", "OkCancelActions", "ShortcutActions"], { "cancel": self.exit, "red": self.exit, "yellow": self.changeSelectionState, "green": self.saveSelection, "ok": self.okClicked, "left": self.left, "right": self.right, "down": self.down, "up": self.up }, -1) if not self.selectionChanged in self["checkList"].onSelectionChanged: self["checkList"].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished)
def __init__(self, session): Screen.__init__(self, session) self.skin_path = resolveFilename(SCOPE_PLUGINS, "Extensions/UpdatePreview") self["key_red"] = StaticText(_("Close")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText() self.selectedFiles = config.plugins.upw.userfiles.value defaultDir = '/' self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir, showDirectories=True, matchingPattern="^.*") self["checkList"] = self.filelist self["actions"] = ActionMap( ["DirectionActions", "OkCancelActions", "ShortcutActions"], { "cancel": self.exit, "red": self.exit, "yellow": self.changeSelectionState, "green": self.saveSelection, "ok": self.okClicked, "left": self.left, "right": self.right, "down": self.down, "up": self.up }, -1) if not self.selectionChanged in self["checkList"].onSelectionChanged: self["checkList"].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished)
def __init__(self, session): Screen.__init__(self, session) self.skinName = ["BackupSelection_AutoBackup", "BackupSelection"] from Components.Sources.StaticText import StaticText from Components.FileList import MultiFileSelectList self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText() selectedFiles = getSelectedFiles() defaultDir = '/' inhibitDirs = [ "/bin", "/boot", "/dev", "/autofs", "/lib", "/proc", "/sbin", "/sys", "/hdd", "/tmp", "/mnt", "/media" ] self.filelist = MultiFileSelectList(selectedFiles, defaultDir, inhibitDirs=inhibitDirs) self["checkList"] = self.filelist self["actions"] = ActionMap( ["DirectionActions", "OkCancelActions", "ShortcutActions"], { "cancel": self.exit, "red": self.exit, "yellow": self.changeSelectionState, "green": self.saveSelection, "ok": self.okClicked, "left": self.filelist.pageUp, "right": self.filelist.pageDown, "down": self.filelist.down, "up": self.filelist.up }, -1) if not self.selectionChanged in self.filelist.onSelectionChanged: self.filelist.onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished)
def __init__(self, session): Screen.__init__(self, session) self.skin_path = resolveFilename(SCOPE_PLUGINS, "Extensions/PurePrestige") self['key_red'] = StaticText(_('Cancel')) self['key_green'] = StaticText(_('Save')) self['key_yellow'] = StaticText() self['tspace'] = Label('Select files or folders for backup') self.selectedFiles = config.plugins.configurationbackup.backupdirs.value defaultDir = '/' inhibitDirs = [ '/bin', '/boot', '/dev', '/autofs', '/lib', '/proc', '/sbin', '/sys', '/hdd', '/tmp', '/mnt', '/media' ] self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir, inhibitDirs=inhibitDirs) self['checkList'] = self.filelist self['actions'] = ActionMap( ['DirectionActions', 'OkCancelActions', 'ShortcutActions'], { 'cancel': self.exit, 'red': self.exit, 'yellow': self.changeSelectionState, 'green': self.saveSelection, 'ok': self.okClicked, 'left': self.left, 'right': self.right, 'down': self.down, 'up': self.up }, -1) if self.selectionChanged not in self['checkList'].onSelectionChanged: self['checkList'].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished)
def __init__( self, session, title=_("Select files/folders to backup"), configBackupDirs=config.plugins.configurationbackup.backupdirs, readOnly=False, mode=""): Screen.__init__(self, session) self.setTitle(title) self.mode = mode self.readOnly = readOnly self.configBackupDirs = configBackupDirs self["key_red"] = StaticText( _("Exit") if self.readOnly else _("Cancel")) self["key_green"] = StaticText("" if self.readOnly else _("Save")) self["key_yellow"] = StaticText(_("Info") if self.readOnly else "") self["summary_description"] = StaticText(_("default")) self.selectedFiles = self.configBackupDirs.value defaultDir = '/' inhibitDirs = [ "/bin", "/boot", "/dev", "/autofs", "/lib", "/proc", "/sbin", "/sys", "/hdd", "/tmp", "/mnt", "/media" ] self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir, inhibitDirs=inhibitDirs) self["checkList"] = self.filelist self["actions"] = ActionMap( [ "DirectionActions", "OkCancelActions", "ColorActions", "InfoActions" ], { "cancel": self.exit, "red": self.exit, "yellow": self.changeSelectionState, "green": self.saveSelection, "ok": self.okClicked, "left": self.left, "right": self.right, "down": self.down, "up": self.up, "info": self.keyInfo }, -1) if not self.selectionChanged in self["checkList"].onSelectionChanged: self["checkList"].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished)
def __init__(self, session): Screen.__init__(self, session) self.logtype = 'crashlogs' self['myactions'] = ActionMap(['ColorActions', 'OkCancelActions', 'DirectionActions'], { 'ok': self.changeSelectionState, 'cancel': self.close, 'red': self.changelogtype, 'green': self.showLog, 'yellow': self.deletelog, 'blue': self.sendlog, "left": self.left, "right": self.right, "down": self.down, "up": self.up }, -1) self["key_red"] = Button(_("Debug Logs")) self["key_green"] = Button(_("View")) self["key_yellow"] = Button(_("Delete")) self["key_blue"] = Button(_("Send")) self.onChangedEntry = [ ] self.sentsingle = "" self.selectedFiles = config.logmanager.sentfiles.value self.previouslySent = config.logmanager.sentfiles.value self.defaultDir = config.crash.debug_path.value self.matchingPattern = 'enigma2_crash_' self.filelist = MultiFileSelectList(self.selectedFiles, self.defaultDir, showDirectories = False, matchingPattern = self.matchingPattern ) self["list"] = self.filelist self["LogsSize"] = self.logsinfo = LogInfo(config.crash.debug_path.value, LogInfo.USED, update=False) self.onLayoutFinish.append(self.layoutFinished) if not self.selectionChanged in self["list"].onSelectionChanged: self["list"].onSelectionChanged.append(self.selectionChanged)
def __init__(self, session): Screen.__init__(self, session) Screen.setTitle(self, _("Select files/folders to backup")) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText() self.selectedFiles = config.backupmanager.backupdirs.value defaultDir = '/' self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir) self["checkList"] = self.filelist self["actions"] = ActionMap(["DirectionActions", "OkCancelActions", "ShortcutActions", "MenuActions"], { "cancel": self.exit, "red": self.exit, "yellow": self.changeSelectionState, "green": self.saveSelection, "ok": self.okClicked, "left": self.left, "right": self.right, "down": self.down, "up": self.up, "menu": self.exit, }, -1) if not self.selectionChanged in self["checkList"].onSelectionChanged: self["checkList"].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished)
def __init__(self, session): Screen.__init__(self, session) self['key_red'] = StaticText(_('Cancel')) self['key_green'] = StaticText(_('Save')) self['key_yellow'] = StaticText() self.selectedFiles = config.plugins.ctpanel.configurationbackup.backupdirs.value defaultDir = '/' inhibitDirs = ['/bin', '/boot', '/dev', '/autofs', '/lib', '/proc', '/sbin', '/sys', '/hdd', '/tmp', '/mnt', '/media'] self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir, inhibitDirs=inhibitDirs) self['checkList'] = self.filelist self['actions'] = ActionMap(['DirectionActions', 'OkCancelActions', 'ShortcutActions'], {'cancel': self.exit, 'red': self.exit, 'yellow': self.changeSelectionState, 'green': self.saveSelection, 'ok': self.okClicked, 'left': self.left, 'right': self.right, 'down': self.down, 'up': self.up}, -1) if self.selectionChanged not in self['checkList'].onSelectionChanged: self['checkList'].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished)
def __init__(self, session): Screen.__init__(self, session) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText() self.selectedFiles = config.plugins.configurationbackup.backupdirs.value defaultDir = '/' inhibitDirs = ["/bin", "/boot", "/dev", "/autofs", "/lib", "/proc", "/sbin", "/sys", "/hdd", "/tmp", "/mnt", "/media"] self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir, inhibitDirs = inhibitDirs ) self["checkList"] = self.filelist self["actions"] = ActionMap(["DirectionActions", "OkCancelActions", "ShortcutActions"], { "cancel": self.exit, "red": self.exit, "yellow": self.changeSelectionState, "green": self.saveSelection, "ok": self.okClicked, "left": self.left, "right": self.right, "down": self.down, "up": self.up }, -1) if not self.selectionChanged in self["checkList"].onSelectionChanged: self["checkList"].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished)
def __init__(self, session): Screen.__init__(self, session) self.skinName = ["BackupSelection_AutoBackup", "BackupSelection"] from Components.Sources.StaticText import StaticText from Components.FileList import MultiFileSelectList self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText() selectedFiles = getSelectedFiles() defaultDir = '/' inhibitDirs = ["/bin", "/boot", "/dev", "/autofs", "/lib", "/proc", "/sbin", "/sys", "/hdd", "/tmp", "/mnt", "/media"] self.filelist = MultiFileSelectList(selectedFiles, defaultDir, inhibitDirs = inhibitDirs ) self["checkList"] = self.filelist self["actions"] = ActionMap(["DirectionActions", "OkCancelActions", "ShortcutActions"], { "cancel": self.exit, "red": self.exit, "yellow": self.changeSelectionState, "green": self.saveSelection, "ok": self.okClicked, "left": self.filelist.pageUp, "right": self.filelist.pageDown, "down": self.filelist.down, "up": self.filelist.up }, -1) if not self.selectionChanged in self.filelist.onSelectionChanged: self.filelist.onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished)
def __init__( self, session, title=_("Select files/folders to backup"), configBackupDirs=config.plugins.configurationbackup.backupdirs, readOnly=False, ): Screen.__init__(self, session) self.readOnly = readOnly self.configBackupDirs = configBackupDirs if self.readOnly: self["key_red"] = StaticText(_("Exit")) self["key_green"] = StaticText(_("Exit")) else: self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText() self["summary_description"] = StaticText(_("default")) self["title_text"] = StaticText(title) self.selectedFiles = self.configBackupDirs.value defaultDir = "/" inhibitDirs = [ "/bin", "/boot", "/dev", "/autofs", "/lib", "/proc", "/sbin", "/sys", "/hdd", "/tmp", "/mnt", "/media", ] self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir, inhibitDirs=inhibitDirs) self["checkList"] = self.filelist self["actions"] = ActionMap( ["DirectionActions", "OkCancelActions", "ShortcutActions"], { "cancel": self.exit, "red": self.exit, "yellow": self.changeSelectionState, "green": self.saveSelection, "ok": self.okClicked, "left": self.left, "right": self.right, "down": self.down, "up": self.up, }, -1, ) if not self.selectionChanged in self["checkList"].onSelectionChanged: self["checkList"].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished)
def __init__(self, session): Screen.__init__(self, session) screentitle = _("Softcam manager") self.menu_path = _('Main menu')+' / '+_('Setup')+' / '+_('Softcam')+' / ' 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 self["menu_path_compressed"] = StaticText(self.menu_path + " >" if not self.menu_path.endswith(' / ') else self.menu_path[:-3] + " >" or "") self.menu_path += " / " + screentitle else: title = screentitle self["menu_path_compressed"] = StaticText("") Screen.setTitle(self, title) self['lab1'] = Label(_('Select:')) self['lab2'] = Label(_('Active:')) self['activecam'] = Label() self.onChangedEntry = [] self.sentsingle = "" self.selectedFiles = config.softcammanager.softcams_autostart.value self.defaultDir = '/usr/softcams/' self.emlist = MultiFileSelectList(self.selectedFiles, self.defaultDir, showDirectories=False) self["list"] = self.emlist self['myactions'] = ActionMap(['ColorActions', 'OkCancelActions', 'DirectionActions', "TimerEditActions", "MenuActions"], { 'ok': self.keyStart, 'cancel': self.close, 'red': self.close, 'green': self.keyStart, 'yellow': self.getRestartPID, 'blue': self.changeSelectionState, 'log': self.showLog, 'menu': self.createSetup, }, -1) self["key_red"] = Button(_("Close")) self["key_green"] = Button("") self["key_yellow"] = Button("") self["key_blue"] = Button(_("Autostart")) self.currentactivecam = "" self.activityTimer = eTimer() self.activityTimer.timeout.get().append(self.getActivecam) self.Console = Console() self.showActivecam() if not self.selectionChanged in self["list"].onSelectionChanged: self["list"].onSelectionChanged.append(self.selectionChanged)
def __init__(self, session): Screen.__init__(self, session) self.setTitle(_("Vision Softcam")) self["lab1"] = StaticText(_("OpenVision")) self["lab2"] = StaticText(_("Lets define enigma2 once more")) self["lab3"] = StaticText(_("Report problems to:")) self["lab4"] = StaticText(_("https://openvision.tech")) self["lab5"] = StaticText(_("Sources are available at:")) self["lab6"] = StaticText(_("https://github.com/OpenVisionE2")) self['lab7'] = Label(_('Select:')) self['lab8'] = Label(_('Active:')) self['activecam'] = Label() self.onChangedEntry = [] self.sentsingle = "" self.selectedFiles = config.softcammanager.softcams_autostart.value self.defaultDir = '/usr/softcams/' self.emlist = MultiFileSelectList(self.selectedFiles, self.defaultDir, showDirectories=False) self["list"] = self.emlist self['myactions'] = ActionMap( [ 'ColorActions', 'OkCancelActions', 'DirectionActions', "TimerEditActions", "MenuActions" ], { 'ok': self.keyStart, 'cancel': self.close, 'red': self.close, 'green': self.keyStart, 'yellow': self.getRestartPID, 'blue': self.changeSelectionState, 'log': self.showLog, 'menu': self.createSetup, }, -1) self["key_red"] = Button(_("Close")) self["key_green"] = Button("") self["key_yellow"] = Button("") self["key_blue"] = Button(_("Autostart")) self["key_menu"] = StaticText(_("MENU")) self["key_info"] = StaticText(_("INFO")) self.currentactivecam = "" self.activityTimer = eTimer() self.activityTimer.timeout.get().append(self.getActivecam) self.Console = Console() self.showActivecam() if not self.selectionChanged in self["list"].onSelectionChanged: self["list"].onSelectionChanged.append(self.selectionChanged)
def __init__(self, session): Screen.__init__(self, session) Screen.setTitle(self, _("Softcam Setup")) self['lab1'] = Label(_('Select:')) self['lab2'] = Label(_('Active:')) self['activecam'] = Label() self.onChangedEntry = [] self.sentsingle = "" self.selectedFiles = config.softcammanager.softcams_autostart.value self.defaultDir = '/usr/softcams/' self.emlist = MultiFileSelectList(self.selectedFiles, self.defaultDir, showDirectories=False) self["list"] = self.emlist self['myactions'] = ActionMap( [ 'ColorActions', 'OkCancelActions', 'DirectionActions', "TimerEditActions", "MenuActions" ], { 'ok': self.keyStart, 'cancel': self.close, 'red': self.close, 'green': self.keyStart, 'yellow': self.getRestartPID, 'blue': self.changeSelectionState, 'log': self.showLog, 'menu': self.createSetup, }, -1) self["key_red"] = Button(_("Close")) self["key_green"] = Button("") self["key_yellow"] = Button("") self["key_blue"] = Button(_("Autostart")) self.currentactivecam = "" self.activityTimer = eTimer() self.activityTimer.timeout.get().append(self.getActivecam) self.Console = Console() self.showActivecam() if not self.selectionChanged in self["list"].onSelectionChanged: self["list"].onSelectionChanged.append(self.selectionChanged)
def __init__(self, session): Screen.__init__(self, session) self.setTitle(_("Softcam manager")) self["lab1"] = Label(_("Select:")) self["lab2"] = Label(_("Active:")) self["activecam"] = Label() self.onChangedEntry = [] self.sentsingle = "" self.selectedFiles = config.softcammanager.softcams_autostart.value self.defaultDir = "/usr/softcams/" self.emlist = MultiFileSelectList(self.selectedFiles, self.defaultDir, showDirectories=False) self["list"] = self.emlist self["myactions"] = ActionMap(["ColorActions", "OkCancelActions", "DirectionActions", "TimerEditActions", "MenuActions"], { "ok": self.keyStart, "cancel": self.close, "red": self.close, "green": self.keyStart, "yellow": self.getRestartPID, "blue": self.changeSelectionState, "log": self.showLog, # KEY_INFO "menu": self.createSetup, }, -1) self["key_red"] = Button(_("Close")) self["key_green"] = Button("") self["key_yellow"] = Button("") self["key_blue"] = Button(_("Autostart")) self["key_menu"] = StaticText(_("MENU")) self["key_info"] = StaticText(_("INFO")) self.currentactivecam = "" self.activityTimer = eTimer() self.activityTimer.timeout.get().append(self.getActivecam) self.Console = Console() self.showActivecam() if not self.selectionChanged in self["list"].onSelectionChanged: self["list"].onSelectionChanged.append(self.selectionChanged)
class BackupSelection(Screen): skin = """ <screen position="center,center" size="560,400" title="Select files/folders to backup"> <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" /> <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" /> <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" /> <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" /> <widget name="checkList" position="5,50" size="550,350" transparent="1" scrollbarMode="showOnDemand" /> </screen>""" def __init__(self, session): Screen.__init__(self, session) self.skinName = ["BackupSelection_AutoBackup", "BackupSelection"] from Components.Sources.StaticText import StaticText from Components.FileList import MultiFileSelectList self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText() selectedFiles = getSelectedFiles() defaultDir = '/' inhibitDirs = [ "/bin", "/boot", "/dev", "/autofs", "/lib", "/proc", "/sbin", "/sys", "/hdd", "/tmp", "/mnt", "/media" ] self.filelist = MultiFileSelectList(selectedFiles, defaultDir, inhibitDirs=inhibitDirs) self["checkList"] = self.filelist self.prev_files = selectedFiles self["actions"] = ActionMap( ["DirectionActions", "OkCancelActions", "ShortcutActions"], { "cancel": self.exit, "red": self.exit, "yellow": self.changeSelectionState, "green": self.saveSelection, "ok": self.okClicked, "left": self.filelist.pageUp, "right": self.filelist.pageDown, "down": self.filelist.down, "up": self.filelist.up }, -1) if not self.selectionChanged in self.filelist.onSelectionChanged: self.filelist.onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished) def layoutFinished(self): idx = 0 self["checkList"].moveToIndex(idx) self.setWindowTitle() self.selectionChanged() def setWindowTitle(self): self.setTitle(_("Select files/folders to backup")) def selectionChanged(self): current = self["checkList"].getCurrent()[0] text = "" if len(current) > 2: if current[2] is True: text = _("Deselect") else: text = _("Select") self["key_yellow"].setText(text) def changeSelectionState(self): self["checkList"].changeSelectionState() def saveSelection(self): saveSelectedFiles(self["checkList"].getSelectedList()) self.close(None) def exit(self): if self.prev_files != [ os.path.normpath(n.strip()) for n in self["checkList"].getSelectedList() ]: self.session.openWithCallback( self.exitConfirm, MessageBox, _("Really close without saving settings?")) else: self.close(None) def exitConfirm(self, result): if result: self.close(None) def okClicked(self): if self.filelist.canDescent(): self.filelist.descent()
class BackupSelection(Screen): skin = """ <screen name="BackupSelection" position="center,center" size="560,400" title="Select files/folders to backup"> <ePixmap pixmap="buttons/red.png" position="0,340" size="140,40" alphatest="on" /> <ePixmap pixmap="buttons/green.png" position="140,340" size="140,40" alphatest="on" /> <ePixmap pixmap="buttons/yellow.png" position="280,340" size="140,40" alphatest="on" /> <widget source="key_red" render="Label" position="0,360" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> <widget source="key_green" render="Label" position="140,360" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> <widget source="key_yellow" render="Label" position="280,360" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" /> <widget source="title_text" render="Label" position="10,0" size="540,30" font="Regular;24" halign="left" foregroundColor="white" backgroundColor="black" transparent="1" /> <widget source="summary_description" render="Label" position="5,300" size="550,30" foregroundColor="white" backgroundColor="black" font="Regular; 24" halign="left" transparent="1" /> <widget name="checkList" position="5,50" size="550,250" transparent="1" scrollbarMode="showOnDemand" /> </screen>""" def __init__( self, session, title=_("Select files/folders to backup"), configBackupDirs=config.plugins.configurationbackup.backupdirs, readOnly=False): Screen.__init__(self, session) self.readOnly = readOnly self.configBackupDirs = configBackupDirs if self.readOnly: self["key_red"] = StaticText(_("Exit")) self["key_green"] = StaticText(_("Exit")) else: self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText() self["summary_description"] = StaticText(_("default")) self["title_text"] = StaticText(title) self.selectedFiles = self.configBackupDirs.value defaultDir = '/' inhibitDirs = [ "/bin", "/boot", "/dev", "/autofs", "/lib", "/proc", "/sbin", "/sys", "/hdd", "/tmp", "/mnt", "/media" ] self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir, inhibitDirs=inhibitDirs) self["checkList"] = self.filelist self["actions"] = ActionMap( ["DirectionActions", "OkCancelActions", "ShortcutActions"], { "cancel": self.exit, "red": self.exit, "yellow": self.changeSelectionState, "green": self.saveSelection, "ok": self.okClicked, "left": self.left, "right": self.right, "down": self.down, "up": self.up }, -1) if not self.selectionChanged in self["checkList"].onSelectionChanged: self["checkList"].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished) def layoutFinished(self): idx = 0 self["checkList"].moveToIndex(idx) self.setWindowTitle() self.selectionChanged() def setWindowTitle(self): self.setTitle(_("Select files/folders to backup")) def selectionChanged(self): current = self["checkList"].getCurrent()[0] if current[3] == "<Parent directory>": self["summary_description"].text = self[ "checkList"].getCurrentDirectory() + ".." else: self["summary_description"].text = self[ "checkList"].getCurrentDirectory() + current[3] if current[2] is True: self["key_yellow"].setText(_("Deselect")) else: self["key_yellow"].setText(_("Select")) def up(self): self["checkList"].up() def down(self): self["checkList"].down() def left(self): self["checkList"].pageUp() def right(self): self["checkList"].pageDown() def changeSelectionState(self): if self.readOnly: self.session.open( MessageBox, _("The default backup selection cannot be changed.\nPlease use the 'additional' and 'excluded' backup selection." ), type=MessageBox.TYPE_INFO, timeout=10) else: self["checkList"].changeSelectionState() self.selectedFiles = self["checkList"].getSelectedList() def saveSelection(self): if self.readOnly: self.close(None) else: self.selectedFiles = self["checkList"].getSelectedList() self.configBackupDirs.setValue(self.selectedFiles) self.configBackupDirs.save() config.plugins.configurationbackup.save() config.save() self.close(None) def exit(self): self.close(None) def okClicked(self): if self.filelist.canDescent(): self.filelist.descent()
class BackupSelection(Screen): skin = """ <screen name="BackupSelection" position="center,center" size="560,400" title="Select files/folders to backup"> <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" /> <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" /> <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" /> <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" /> <widget name="checkList" position="5,50" size="550,250" transparent="1" scrollbarMode="showOnDemand" /> </screen>""" def __init__(self, session): Screen.__init__(self, session) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText() self.selectedFiles = config.plugins.configurationbackup.backupdirs.value defaultDir = '/' inhibitDirs = ["/bin", "/boot", "/dev", "/autofs", "/lib", "/proc", "/sbin", "/sys", "/hdd", "/tmp", "/mnt", "/media"] self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir, inhibitDirs = inhibitDirs ) self["checkList"] = self.filelist self["actions"] = ActionMap(["DirectionActions", "OkCancelActions", "ShortcutActions"], { "cancel": self.exit, "red": self.exit, "yellow": self.changeSelectionState, "green": self.saveSelection, "ok": self.okClicked, "left": self.left, "right": self.right, "down": self.down, "up": self.up }, -1) if not self.selectionChanged in self["checkList"].onSelectionChanged: self["checkList"].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished) def layoutFinished(self): idx = 0 self["checkList"].moveToIndex(idx) self.setWindowTitle() self.selectionChanged() def setWindowTitle(self): self.setTitle(_("Select files/folders to backup")) def selectionChanged(self): current = self["checkList"].getCurrent()[0] if len(current) > 2: if current[2] is True: self["key_yellow"].setText(_("Deselect")) else: self["key_yellow"].setText(_("Select")) def up(self): self["checkList"].up() def down(self): self["checkList"].down() def left(self): self["checkList"].pageUp() def right(self): self["checkList"].pageDown() def changeSelectionState(self): self["checkList"].changeSelectionState() self.selectedFiles = self["checkList"].getSelectedList() def saveSelection(self): self.selectedFiles = self["checkList"].getSelectedList() config.plugins.configurationbackup.backupdirs.value = self.selectedFiles config.plugins.configurationbackup.backupdirs.save() config.plugins.configurationbackup.save() config.save() self.close(None) def exit(self): self.close(None) def okClicked(self): if self.filelist.canDescent(): self.filelist.descent()
class BackupSelection(Screen): skin = """ <screen name="BackupSelection" position="center,center" size="560,400" title="Select files/folders to backup"> <ePixmap pixmap="buttons/red.png" position="0,0" size="140,40" alphatest="on" /> <ePixmap pixmap="buttons/green.png" position="140,0" size="140,40" alphatest="on" /> <ePixmap pixmap="buttons/yellow.png" position="280,0" size="140,40" alphatest="on" /> <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" /> <widget name="checkList" position="5,50" size="550,250" transparent="1" scrollbarMode="showOnDemand" /> </screen>""" def __init__(self, session): Screen.__init__(self, session) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText() self["summary_description"] = StaticText("") self.selectedFiles = config.plugins.configurationbackup.backupdirs.value defaultDir = '/' inhibitDirs = ["/bin", "/boot", "/etc/enigma2", "/dev", "/autofs", "/lib", "/proc", "/sbin", "/sys", "/hdd", "/tmp", "/mnt", "/media"] self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir, inhibitDirs = inhibitDirs ) self["checkList"] = self.filelist self["actions"] = ActionMap(["DirectionActions", "OkCancelActions", "ShortcutActions"], { "cancel": self.exit, "red": self.exit, "yellow": self.changeSelectionState, "green": self.saveSelection, "ok": self.okClicked, "left": self.left, "right": self.right, "down": self.down, "up": self.up }, -1) if not self.selectionChanged in self["checkList"].onSelectionChanged: self["checkList"].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished) def layoutFinished(self): idx = 0 self["checkList"].moveToIndex(idx) self.setWindowTitle() self.selectionChanged() def setWindowTitle(self): self.setTitle(_("Select files/folders to backup")) def selectionChanged(self): current = self["checkList"].getCurrent()[0] self["summary_description"].text = current[3] if current[2] is True: self["key_yellow"].setText(_("Deselect")) else: self["key_yellow"].setText(_("Select")) def up(self): self["checkList"].up() def down(self): self["checkList"].down() def left(self): self["checkList"].pageUp() def right(self): self["checkList"].pageDown() def changeSelectionState(self): self["checkList"].changeSelectionState() self.selectedFiles = self["checkList"].getSelectedList() def saveSelection(self): self.selectedFiles = self["checkList"].getSelectedList() config.plugins.configurationbackup.backupdirs.setValue(self.selectedFiles) config.plugins.configurationbackup.backupdirs.save() config.plugins.configurationbackup.save() config.save() self.close(None) def exit(self): self.close(None) def okClicked(self): if self.filelist.canDescent(): self.filelist.descent()
class BackupSelection(Screen): def __init__(self, session): Screen.__init__(self, session) self['key_red'] = StaticText(_('Cancel')) self['key_green'] = StaticText(_('Save')) self['key_yellow'] = StaticText() self.selectedFiles = config.plugins.ctpanel.configurationbackup.backupdirs.value defaultDir = '/' inhibitDirs = ['/bin', '/boot', '/dev', '/autofs', '/lib', '/proc', '/sbin', '/sys', '/hdd', '/tmp', '/mnt', '/media'] self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir, inhibitDirs=inhibitDirs) self['checkList'] = self.filelist self['actions'] = ActionMap(['DirectionActions', 'OkCancelActions', 'ShortcutActions'], {'cancel': self.exit, 'red': self.exit, 'yellow': self.changeSelectionState, 'green': self.saveSelection, 'ok': self.okClicked, 'left': self.left, 'right': self.right, 'down': self.down, 'up': self.up}, -1) if self.selectionChanged not in self['checkList'].onSelectionChanged: self['checkList'].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished) def layoutFinished(self): idx = 0 self['checkList'].moveToIndex(idx) self.setWindowTitle() self.selectionChanged() def setWindowTitle(self): self.setTitle(_('Select files/folders to backup')) def selectionChanged(self): current = self['checkList'].getCurrent()[0] if current[2] is True: self['key_yellow'].setText(_('Deselect')) else: self['key_yellow'].setText(_('Select')) def up(self): self['checkList'].up() def down(self): self['checkList'].down() def left(self): self['checkList'].pageUp() def right(self): self['checkList'].pageDown() def changeSelectionState(self): self['checkList'].changeSelectionState() self.selectedFiles = self['checkList'].getSelectedList() def saveSelection(self): self.selectedFiles = self['checkList'].getSelectedList() config.plugins.ctpanel.configurationbackup.backupdirs.value = self.selectedFiles config.plugins.ctpanel.configurationbackup.backupdirs.save() config.plugins.ctpanel.configurationbackup.save() config.save() self.close(None) def exit(self): self.close(None) def okClicked(self): if self.filelist.canDescent(): self.filelist.descent()
class FilesSelection(Screen): skin = """ <screen name="FilesSelection" position="265,160" size="750,360" title="Select files"> <widget name="checkList" position="15,10" size="720,300" transparent="1" scrollbarMode="showOnDemand" /> <ePixmap position="10,355" zPosition="1" size="165,2" pixmap="~/images/red.png" alphatest="blend" /> <widget source="key_red" render="Label" position="10,325" zPosition="2" size="165,30" font="Regular;20" halign="center" valign="center" transparent="1" /> <ePixmap position="175,355" zPosition="1" size="180,2" pixmap="~/images/green.png" alphatest="blend" /> <widget source="key_green" render="Label" position="175,325" zPosition="2" size="180,30" font="Regular;20" halign="center" valign="center" transparent="1" /> <ePixmap position="355,355" zPosition="1" size="180,2" pixmap="~/images/yellow.png" alphatest="blend" /> <widget source="key_yellow" render="Label" position="355,325" zPosition="2" size="180,30" font="Regular;20" halign="center" valign="center" transparent="1" /> </screen>""" def __init__(self, session): Screen.__init__(self, session) self.skin_path = resolveFilename(SCOPE_PLUGINS, "Extensions/UpdatePreview") self["key_red"] = StaticText(_("Close")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText() self.selectedFiles = config.plugins.upw.userfiles.value defaultDir = '/' self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir, showDirectories=True, matchingPattern="^.*") self["checkList"] = self.filelist self["actions"] = ActionMap( ["DirectionActions", "OkCancelActions", "ShortcutActions"], { "cancel": self.exit, "red": self.exit, "yellow": self.changeSelectionState, "green": self.saveSelection, "ok": self.okClicked, "left": self.left, "right": self.right, "down": self.down, "up": self.up }, -1) if not self.selectionChanged in self["checkList"].onSelectionChanged: self["checkList"].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished) def layoutFinished(self): idx = 0 self["checkList"].moveToIndex(idx) self.setWindowTitle() self.selectionChanged() def setWindowTitle(self): self.setTitle(_("Select files")) def selectionChanged(self): current = self["checkList"].getCurrent()[0] if len(current) > 2: if current[2] is True: self["key_yellow"].setText(_("Deselect")) else: self["key_yellow"].setText(_("Select")) def up(self): self["checkList"].up() def down(self): self["checkList"].down() def left(self): self["checkList"].pageUp() def right(self): self["checkList"].pageDown() def changeSelectionState(self): self["checkList"].changeSelectionState() self.selectedFiles = self["checkList"].getSelectedList() def saveSelection(self): self.selectedFiles = self["checkList"].getSelectedList() config.plugins.upw.userfiles.value = self.selectedFiles config.plugins.upw.userfiles.save() config.plugins.upw.save() config.save() self.close(None) def exit(self): self.close(None) def okClicked(self): if self.filelist.canDescent(): self.filelist.descent()
class BackupSelection(Screen): skin = """ <screen position="0,0" size="1280,720" > <eLabel backgroundColor="metrixAccent1" name="new eLabel" position="462,119" size="720,2" /> <ePixmap alphatest="blend" pixmap="skin_default/buttons/green.png" position="610,637" size="30,35" /> <ePixmap alphatest="blend" pixmap="skin_default/buttons/yellow.png" position="805,637" size="30,35" /> <ePixmap alphatest="blend" pixmap="skin_default/buttons/red.png" position="415,636" size="30,35" /> <widget font="Regular;20" halign="left" position="645,640" render="Label" size="160,24" source="key_green" transparent="1" zPosition="1" /> <widget font="Regular;20" halign="left" position="840,640" render="Label" size="160,24" source="key_yellow" transparent="1" zPosition="1" /> <widget font="Regular; 22" halign="left" position="450,640" render="Label" size="160,24" source="key_red" transparent="1" zPosition="1" /> <widget enableWrapAround="1" font="Regular;22" itemHeight="28" name="checkList" position="470,135" scrollbarMode="showOnDemand" size="755,500" transparent="1" zPosition="3" /> </screen>""" def __init__(self, session): Screen.__init__(self, session) Screen.setTitle(self, _("Select files/folders to backup")) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText() self.selectedFiles = config.backupmanager.backupdirs.value defaultDir = '/' self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir) self["checkList"] = self.filelist self["actions"] = ActionMap(["DirectionActions", "OkCancelActions", "ShortcutActions", "MenuActions"], { "cancel": self.exit, "red": self.exit, "yellow": self.changeSelectionState, "green": self.saveSelection, "ok": self.okClicked, "left": self.left, "right": self.right, "down": self.down, "up": self.up, "menu": self.exit, }, -1) if not self.selectionChanged in self["checkList"].onSelectionChanged: self["checkList"].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished) def layoutFinished(self): idx = 0 self["checkList"].moveToIndex(idx) self.setWindowTitle() self.selectionChanged() def setWindowTitle(self): self.setTitle(_("Select files/folders to backup")) def selectionChanged(self): current = self["checkList"].getCurrent()[0] if current[2] is True: self["key_yellow"].setText(_("Deselect")) else: self["key_yellow"].setText(_("Select")) def up(self): self["checkList"].up() def down(self): self["checkList"].down() def left(self): self["checkList"].pageUp() def right(self): self["checkList"].pageDown() def changeSelectionState(self): self["checkList"].changeSelectionState() self.selectedFiles = self["checkList"].getSelectedList() def saveSelection(self): self.selectedFiles = self["checkList"].getSelectedList() config.backupmanager.backupdirs.value = self.selectedFiles config.backupmanager.backupdirs.save() config.backupmanager.save() config.save() self.close(None) def exit(self): self.close(None) def okClicked(self): if self.filelist.canDescent(): self.filelist.descent() def closeRecursive(self): self.close(True)
class BackupSelection(Screen): skin = """ <screen name="BackupSelection" position="center,center" size="560,400" title="Select files/folders to backup"> <ePixmap pixmap="buttons/red.png" position="0,340" size="140,40" alphatest="on" /> <ePixmap pixmap="buttons/green.png" position="140,340" size="140,40" alphatest="on" /> <ePixmap pixmap="buttons/yellow.png" position="280,340" size="140,40" alphatest="on" /> <widget source="key_red" render="Label" position="0,360" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> <widget source="key_green" render="Label" position="140,360" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> <widget source="key_yellow" render="Label" position="280,360" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" /> <widget source="title_text" render="Label" position="10,0" size="540,30" font="Regular;24" halign="left" foregroundColor="white" backgroundColor="black" transparent="1" /> <widget source="summary_description" render="Label" position="5,300" size="550,30" foregroundColor="white" backgroundColor="black" font="Regular; 24" halign="left" transparent="1" /> <widget name="checkList" position="5,50" size="550,250" transparent="1" scrollbarMode="showOnDemand" /> </screen>""" def __init__(self, session, title=_("Select files/folders to backup"), configBackupDirs=config.plugins.configurationbackup.backupdirs, readOnly=False): Screen.__init__(self, session) self.readOnly = readOnly self.configBackupDirs = configBackupDirs if self.readOnly: self["key_red"] = StaticText(_("Exit")) self["key_green"] = StaticText(_("Exit")) else: self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText() self["summary_description"] = StaticText(_("default")) self["title_text"] = StaticText(title) self.selectedFiles = self.configBackupDirs.value defaultDir = '/' inhibitDirs = ["/bin", "/boot", "/dev", "/autofs", "/lib", "/proc", "/sbin", "/sys", "/hdd", "/tmp", "/mnt", "/media"] self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir, inhibitDirs = inhibitDirs ) self["checkList"] = self.filelist self["actions"] = ActionMap(["DirectionActions", "OkCancelActions", "ShortcutActions"], { "cancel": self.exit, "red": self.exit, "yellow": self.changeSelectionState, "green": self.saveSelection, "ok": self.okClicked, "left": self.left, "right": self.right, "down": self.down, "up": self.up }, -1) if not self.selectionChanged in self["checkList"].onSelectionChanged: self["checkList"].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished) def layoutFinished(self): idx = 0 self["checkList"].moveToIndex(idx) self.setWindowTitle() self.selectionChanged() def setWindowTitle(self): self.setTitle(_("Select files/folders to backup")) def selectionChanged(self): current = self["checkList"].getCurrent()[0] if current[3] == "<Parent directory>": self["summary_description"].text =self["checkList"].getCurrentDirectory()+".." else: self["summary_description"].text =self["checkList"].getCurrentDirectory()+current[3] if current[2] is True: self["key_yellow"].setText(_("Deselect")) else: self["key_yellow"].setText(_("Select")) def up(self): self["checkList"].up() def down(self): self["checkList"].down() def left(self): self["checkList"].pageUp() def right(self): self["checkList"].pageDown() def changeSelectionState(self): if self.readOnly: self.session.open(MessageBox,_("The default backup selection cannot be changed.\nPlease use the 'additional' and 'excluded' backup selection."), type = MessageBox.TYPE_INFO,timeout = 10) else: self["checkList"].changeSelectionState() self.selectedFiles = self["checkList"].getSelectedList() def saveSelection(self): if self.readOnly: self.close(None) else: self.selectedFiles = self["checkList"].getSelectedList() self.configBackupDirs.setValue(self.selectedFiles) self.configBackupDirs.save() config.plugins.configurationbackup.save() config.save() self.close(None) def exit(self): self.close(None) def okClicked(self): if self.filelist.canDescent(): self.filelist.descent()
class BackupSelection(Screen): def __init__(self, session): Screen.__init__(self, session) Screen.setTitle(self, _("Select files/folders to backup")) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText() self.selectedFiles = config.backupmanager.backupdirs.value defaultDir = '/' self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir) self["checkList"] = self.filelist self["actions"] = ActionMap(["DirectionActions", "OkCancelActions", "ShortcutActions", "MenuActions"], { "cancel": self.exit, "red": self.exit, "yellow": self.changeSelectionState, "green": self.saveSelection, "ok": self.okClicked, "left": self.left, "right": self.right, "down": self.down, "up": self.up, "menu": self.exit, }, -1) if not self.selectionChanged in self["checkList"].onSelectionChanged: self["checkList"].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished) def layoutFinished(self): idx = 0 self["checkList"].moveToIndex(idx) self.setWindowTitle() self.selectionChanged() def setWindowTitle(self): self.setTitle(_("Select files/folders to backup")) def selectionChanged(self): current = self["checkList"].getCurrent()[0] if current[2] is True: self["key_yellow"].setText(_("Deselect")) else: self["key_yellow"].setText(_("Select")) def up(self): self["checkList"].up() def down(self): self["checkList"].down() def left(self): self["checkList"].pageUp() def right(self): self["checkList"].pageDown() def changeSelectionState(self): self["checkList"].changeSelectionState() self.selectedFiles = self["checkList"].getSelectedList() def saveSelection(self): self.selectedFiles = self["checkList"].getSelectedList() config.backupmanager.backupdirs.value = self.selectedFiles config.backupmanager.backupdirs.save() config.backupmanager.save() config.save() self.close(None) def exit(self): self.close(None) def okClicked(self): if self.filelist.canDescent(): self.filelist.descent() def closeRecursive(self): self.close(True)
class PurePrestigeBackupSelection(Screen): skin = '\n <screen position="center,center" size="640,520" title="" flags="wfNoBorder" >\n <ePixmap pixmap="~/images/framesd.png" position="0,0" size="640,520" transparent="1"/>\t\n <widget name="tspace" position="0,480" zPosition="4" size="640,40" font="Regular;20" foregroundColor="#ffffff" transparent="1" halign="center" valign="center" />\n <ePixmap position="15,64" size="610,5" pixmap="~/images/slider.png" alphatest="blend" transparent="1" backgroundColor="transparent"/>\n\t\t\t\n <ePixmap pixmap="~/ddbuttons/red.png" position="15,15" size="140,40" alphatest="on" />\n\t\t <ePixmap pixmap="~/ddbuttons/green.png" position="160,15" size="140,40" alphatest="on" />\n\t\t\t<ePixmap pixmap="~/ddbuttons/yellow.png" position="300,15" size="140,40" alphatest="on" />\n\t\t\t<widget source="key_red" render="Label" position="15,20" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />\n\t\t\t<widget source="key_green" render="Label" position="160,20" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />\n\t\t\t<widget source="key_yellow" render="Label" position="300,20" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />\n\t\t\t<widget name="checkList" position="15,80" size="610,380" transparent="1" scrollbarMode="showOnDemand" zPosition="2" />\n\t <ePixmap position="15,470" size="610,5" pixmap="~/images/slider.png" alphatest="blend" transparent="1" backgroundColor="transparent"/>\n \t</screen>' def __init__(self, session): Screen.__init__(self, session) self.skin_path = resolveFilename(SCOPE_PLUGINS, "Extensions/PurePrestige") self['key_red'] = StaticText(_('Cancel')) self['key_green'] = StaticText(_('Save')) self['key_yellow'] = StaticText() self['tspace'] = Label('Select files or folders for backup') self.selectedFiles = config.plugins.configurationbackup.backupdirs.value defaultDir = '/' inhibitDirs = [ '/bin', '/boot', '/dev', '/autofs', '/lib', '/proc', '/sbin', '/sys', '/hdd', '/tmp', '/mnt', '/media' ] self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir, inhibitDirs=inhibitDirs) self['checkList'] = self.filelist self['actions'] = ActionMap( ['DirectionActions', 'OkCancelActions', 'ShortcutActions'], { 'cancel': self.exit, 'red': self.exit, 'yellow': self.changeSelectionState, 'green': self.saveSelection, 'ok': self.okClicked, 'left': self.left, 'right': self.right, 'down': self.down, 'up': self.up }, -1) if self.selectionChanged not in self['checkList'].onSelectionChanged: self['checkList'].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished) def layoutFinished(self): idx = 0 self['checkList'].moveToIndex(idx) self.setWindowTitle() self.selectionChanged() def setWindowTitle(self): self.setTitle(_('Select files/folders to backup')) def selectionChanged(self): current = self['checkList'].getCurrent()[0] if current[2] is True: self['key_yellow'].setText(_('Deselect')) else: self['key_yellow'].setText(_('Select')) def up(self): self['checkList'].up() def down(self): self['checkList'].down() def left(self): self['checkList'].pageUp() def right(self): self['checkList'].pageDown() def changeSelectionState(self): self['checkList'].changeSelectionState() self.selectedFiles = self['checkList'].getSelectedList() def saveSelection(self): self.selectedFiles = self['checkList'].getSelectedList() config.plugins.configurationbackup.backupdirs.value = self.selectedFiles config.plugins.configurationbackup.backupdirs.save() config.plugins.configurationbackup.save() config.save() self.close(None) return def exit(self): self.close(None) return def okClicked(self): if self.filelist.canDescent(): self.filelist.descent()
class BackupSelection(Screen): def __init__(self, session): Screen.__init__(self, session) self['key_red'] = StaticText(_('Cancel')) self['key_green'] = StaticText(_('Save')) self['key_yellow'] = StaticText() self.selectedFiles = config.plugins.pepanel.configurationbackup.backupdirs.value defaultDir = '/' inhibitDirs = ['/bin', '/boot', '/dev', '/autofs', '/lib', '/proc', '/sbin', '/sys', '/hdd', '/tmp', '/mnt', '/media'] self.filelist = MultiFileSelectList(self.selectedFiles, defaultDir, inhibitDirs=inhibitDirs) self['checkList'] = self.filelist self['actions'] = ActionMap(['DirectionActions', 'OkCancelActions', 'ShortcutActions'], {'cancel': self.exit, 'red': self.exit, 'yellow': self.changeSelectionState, 'green': self.saveSelection, 'ok': self.okClicked, 'left': self.left, 'right': self.right, 'down': self.down, 'up': self.up}, -1) if self.selectionChanged not in self['checkList'].onSelectionChanged: self['checkList'].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.layoutFinished) def layoutFinished(self): idx = 0 self['checkList'].moveToIndex(idx) self.setWindowTitle() self.selectionChanged() def setWindowTitle(self): self.setTitle(_('Select files/folders to backup')) def selectionChanged(self): current = self['checkList'].getCurrent()[0] if current[2] is True: self['key_yellow'].setText(_('Deselect')) else: self['key_yellow'].setText(_('Select')) def up(self): self['checkList'].up() def down(self): self['checkList'].down() def left(self): self['checkList'].pageUp() def right(self): self['checkList'].pageDown() def changeSelectionState(self): self['checkList'].changeSelectionState() self.selectedFiles = self['checkList'].getSelectedList() def saveSelection(self): self.selectedFiles = self['checkList'].getSelectedList() config.plugins.pepanel.configurationbackup.backupdirs.value = self.selectedFiles config.plugins.pepanel.configurationbackup.backupdirs.save() config.plugins.pepanel.configurationbackup.save() config.save() self.close(None) def exit(self): self.close(None) def okClicked(self): if self.filelist.canDescent(): self.filelist.descent()