当前位置: 首页>>代码示例>>Python>>正文


Python MultiFileSelectList.canDescent方法代码示例

本文整理汇总了Python中Components.FileList.MultiFileSelectList.canDescent方法的典型用法代码示例。如果您正苦于以下问题:Python MultiFileSelectList.canDescent方法的具体用法?Python MultiFileSelectList.canDescent怎么用?Python MultiFileSelectList.canDescent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Components.FileList.MultiFileSelectList的用法示例。


在下文中一共展示了MultiFileSelectList.canDescent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: BackupSelection

# 需要导入模块: from Components.FileList import MultiFileSelectList [as 别名]
# 或者: from Components.FileList.MultiFileSelectList import canDescent [as 别名]
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()
开发者ID:Antonio-Team,项目名称:enigma2,代码行数:89,代码来源:BackupRestore.py

示例2: BackupSelection

# 需要导入模块: from Components.FileList import MultiFileSelectList [as 别名]
# 或者: from Components.FileList.MultiFileSelectList import canDescent [as 别名]
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)
开发者ID:sodo13,项目名称:Atemio-all,代码行数:93,代码来源:BackupManager.py

示例3: BackupSelection

# 需要导入模块: from Components.FileList import MultiFileSelectList [as 别名]
# 或者: from Components.FileList.MultiFileSelectList import canDescent [as 别名]

#.........这里部分代码省略.........
			<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()
开发者ID:chabah73,项目名称:enigma2-1,代码行数:104,代码来源:BackupRestore.py

示例4: BackupSelection

# 需要导入模块: from Components.FileList import MultiFileSelectList [as 别名]
# 或者: from Components.FileList.MultiFileSelectList import canDescent [as 别名]
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)
开发者ID:mrnamingo,项目名称:vix4-core,代码行数:81,代码来源:BackupManager.py

示例5: BackupSelection

# 需要导入模块: from Components.FileList import MultiFileSelectList [as 别名]
# 或者: from Components.FileList.MultiFileSelectList import canDescent [as 别名]
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()
开发者ID:Pancronos,项目名称:xt-panel,代码行数:84,代码来源:BackupRestore.py


注:本文中的Components.FileList.MultiFileSelectList.canDescent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。