本文整理汇总了Python中Components.FileList.MultiFileSelectList类的典型用法代码示例。如果您正苦于以下问题:Python MultiFileSelectList类的具体用法?Python MultiFileSelectList怎么用?Python MultiFileSelectList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MultiFileSelectList类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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)
示例2: __init__
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)
示例3: __init__
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)
示例4: __init__
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)
示例5: __init__
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)
示例6: BackupSelection
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()
示例7: BackupSelection
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)
示例8: BackupSelection
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)
示例9: BackupSelection
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)
#.........这里部分代码省略.........
示例10: BackupSelection
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()