本文整理匯總了Python中MountPoints.MountPoints.getRealMount方法的典型用法代碼示例。如果您正苦於以下問題:Python MountPoints.getRealMount方法的具體用法?Python MountPoints.getRealMount怎麽用?Python MountPoints.getRealMount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MountPoints.MountPoints
的用法示例。
在下文中一共展示了MountPoints.getRealMount方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: HddPartitions
# 需要導入模塊: from MountPoints import MountPoints [as 別名]
# 或者: from MountPoints.MountPoints import getRealMount [as 別名]
class HddPartitions(Screen):
skin = """
<screen name="HddPartitions" position="center,center" size="560,430" title="Hard Drive Partitions">
<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" />
<ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" />
<widget name="key_red" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
<widget name="key_green" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
<widget name="key_yellow" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />
<widget name="key_blue" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" />
<widget name="label_disk" position="20,45" font="Regular;20" halign="center" size="520,25" valign="center" />
<widget source="menu" render="Listbox" position="20,75" size="520,350" scrollbarMode="showOnDemand">
<convert type="TemplatedMultiContent">
{"template": [
MultiContentEntryPixmapAlphaTest(pos = (5, 0), size = (48, 48), png = 0),
MultiContentEntryText(pos = (65, 10), size = (330, 38), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 1),
MultiContentEntryText(pos = (405, 10), size = (125, 38), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 2),
],
"fonts": [gFont("Regular", 18)],
"itemHeight": 50
}
</convert>
</widget>
</screen>"""
def __init__(self, session, disk):
self.session = session
Screen.__init__(self, session)
self.disk = disk
self.refreshMP(False)
self["menu"] = List(self.partitions)
self["menu"].onSelectionChanged.append(self.selectionChanged)
self["key_red"] = Button(_("Exit"))
self["key_green"] = Button("")
self["key_yellow"] = Button("")
self["key_blue"] = Button("")
self["label_disk"] = Label("%s - %s" % (self.disk[0], self.disk[3]))
self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
{
"red": self.quit,
"yellow": self.yellow,
"green": self.green,
"blue": self.blue,
"cancel": self.quit,
}, -2)
self.onShown.append(self.setWindowTitle)
if len(self.disk[5]) > 0:
if self.disk[5][0][3] == "83" or self.disk[5][0][3] == "7" or self.disk[5][0][3] == "b":
self["key_green"].setText(_("Check"))
self["key_yellow"].setText(_("Format"))
mp = self.mountpoints.get(self.disk[0], 1)
rmp = self.mountpoints.getRealMount(self.disk[0], 1)
if len(mp) > 0 or len(rmp) > 0:
self.mounted = True
self["key_blue"].setText(_("Unmount"))
else:
self.mounted = False
self["key_blue"].setText(_("Mount"))
def setWindowTitle(self):
self.setTitle(_("Partitions"))
def selectionChanged(self):
self["key_green"].setText("")
self["key_yellow"].setText("")
self["key_blue"].setText("")
if len(self.disk[5]) > 0:
index = self["menu"].getIndex()
if self.disk[5][index][3] == "83" or self.disk[5][index][3] == "7" or self.disk[5][index][3] == "b":
self["key_blue"].setText(_("Check"))
self["key_yellow"].setText(_("Format"))
mp = self.mountpoints.get(self.disk[0], index+1)
rmp = self.mountpoints.getRealMount(self.disk[0], index+1)
if len(mp) > 0 or len(rmp) > 0:
self.mounted = True
self["key_blue"].setText(_("Unmount"))
else:
self.mounted = False
self["key_blue"].setText(_("Mount"))
def chkfs(self):
disks = Disks()
ret = disks.chkfs(self.disk[5][self.index][0][:3], self.index+1, self.fstype)
if ret == 0:
self.session.open(MessageBox, _("Check disk terminated with success"), MessageBox.TYPE_INFO)
elif ret == -1:
self.session.open(MessageBox, _("Cannot umount current drive.\nA record in progress, timeshift or some external tools (like samba, swapfile and nfsd) may cause this problem.\nPlease stop this actions/applications and try again"), MessageBox.TYPE_ERROR)
else:
self.session.open(MessageBox, _("Error checking disk. The disk may be damaged"), MessageBox.TYPE_ERROR)
def mkfs(self):
disks = Disks()
#.........這裏部分代碼省略.........
示例2: HddFastRemove
# 需要導入模塊: from MountPoints import MountPoints [as 別名]
# 或者: from MountPoints.MountPoints import getRealMount [as 別名]
class HddFastRemove(Screen):
skin = """
<screen name="HddFastRemove" position="center,center" size="560,430" title="Hard Drive Fast Umount">
<ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
<ePixmap pixmap="skin_default/buttons/blue.png" position="140,0" size="140,40" alphatest="on" />
<widget name="key_red" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
<widget name="key_blue" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" />
<widget source="menu" render="Listbox" position="10,55" size="520,380" scrollbarMode="showOnDemand">
<convert type="TemplatedMultiContent">
{"template": [
MultiContentEntryPixmapAlphaTest(pos = (5, 0), size = (48, 48), png = 0),
MultiContentEntryText(pos = (65, 3), size = (190, 38), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 1),
MultiContentEntryText(pos = (165, 27), size = (290, 38), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 2),
],
"fonts": [gFont("Regular", 22), gFont("Regular", 18)],
"itemHeight": 50
}
</convert>
</widget>
</screen>"""
def __init__(self, session):
Screen.__init__(self, session)
self.refreshMP(False)
self["menu"] = List(self.disks)
self["key_red"] = Button(_("Unmount"))
self["key_blue"] = Button(_("Exit"))
self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
{
"blue": self.quit,
"red": self.red,
"cancel": self.quit,
}, -2)
self.onShown.append(self.setWindowTitle)
def setWindowTitle(self):
self.setTitle(_("Fast Mounted Remove"))
def red(self):
if len(self.mounts) > 0:
self.sindex = self["menu"].getIndex()
self.mountpoints.umount(self.mounts[self.sindex]) # actually umount device here - also check both cases possible - for instance error case also check with stay in /e.g. /media/usb folder on telnet
self.session.open(MessageBox, _("Fast mounted Media unmounted.\nYou can safely remove the Device now, if no further Partitions (displayed as P.x on Devicelist - where x >=2) are mounted on the same Device.\nPlease unmount Fixed Mounted Devices with Device Manager Panel!"), MessageBox.TYPE_INFO)
self.refreshMP(True)
def refreshMP(self, uirefresh = True):
self.mdisks = Disks()
self.mountpoints = MountPoints()
self.mountpoints.read()
self.disks = list ()
self.mounts = list ()
for disk in self.mdisks.disks:
if disk[2] == True:
diskname = disk[3]
for partition in disk[5]:
mp = ""
rmp = ""
try:
mp = self.mountpoints.get(partition[0][:3], int(partition[0][3:]))
rmp = self.mountpoints.getRealMount(partition[0][:3], int(partition[0][3:]))
except Exception, e:
pass
if len(mp) > 0:
self.disks.append(MountEntry(disk[3], "P.%s (Fixed: %s)" % (partition[0][3:], mp)))
self.mounts.append(mp)
elif len(rmp) > 0:
self.disks.append(MountEntry(disk[3], "P.%s (Fast: %s)" % (partition[0][3:], rmp)))
self.mounts.append(rmp)
if uirefresh:
self["menu"].setList(self.disks)
示例3: HddPartitions
# 需要導入模塊: from MountPoints import MountPoints [as 別名]
# 或者: from MountPoints.MountPoints import getRealMount [as 別名]
class HddPartitions(Screen):
skin = '\n\t<screen name="HddPartitions" position="center,center" size="560,430" title="Hard Drive Partitions">\n\t\t<ePixmap pixmap="/usr/share/enigma2/skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />\n\t\t<ePixmap pixmap="/usr/share/enigma2/skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />\n\t\t<ePixmap pixmap="/usr/share/enigma2/skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" />\n\t\t<ePixmap pixmap="/usr/share/enigma2/skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" />\n\t\t<widget name="key_red" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />\n\t\t<widget name="key_green" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />\n\t\t<widget name="key_yellow" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />\n\t\t<widget name="key_blue" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" />\n\t\t<widget name="label_disk" position="20,45" font="Regular;20" halign="center" size="520,25" valign="center" />\n\t\t<widget source="menu" render="Listbox" position="20,75" size="520,350" scrollbarMode="showOnDemand">\n\t\t\t<convert type="TemplatedMultiContent">\n\t\t\t\t{"template": [\n\t\t\t\t\tMultiContentEntryPixmapAlphaTest(pos = (5, 0), size = (48, 48), png = 0),\n\t\t\t\t\tMultiContentEntryText(pos = (65, 10), size = (330, 38), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 1),\n\t\t\t\t\tMultiContentEntryText(pos = (405, 10), size = (125, 38), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 2),\n\t\t\t\t\t],\n\t\t\t\t\t"fonts": [gFont("Regular", 18)],\n\t\t\t\t\t"itemHeight": 50\n\t\t\t\t}\n\t\t\t</convert>\n\t\t</widget>\n\t</screen>'
def __init__(self, session, disk):
self.session = session
Screen.__init__(self, session)
self.disk = disk
self.refreshMP(False)
self['menu'] = List(self.partitions)
self['menu'].onSelectionChanged.append(self.selectionChanged)
self['key_red'] = Button('')
self['key_green'] = Button('')
self['key_yellow'] = Button('')
self['key_blue'] = Button(_('Exit'))
self['label_disk'] = Label('%s - %s' % (self.disk[0], self.disk[3]))
self['actions'] = ActionMap(['OkCancelActions', 'ColorActions'], {'blue': self.quit,
'yellow': self.yellow,
'green': self.green,
'red': self.red,
'cancel': self.quit}, -2)
self.onShown.append(self.setWindowTitle)
if len(self.disk[5]) > 0:
if self.disk[5][0][3] == '83' or self.disk[5][0][3] == '7' or self.disk[5][0][3] == 'b':
self['key_green'].setText(_('Check'))
self['key_yellow'].setText(_('Format'))
mp = self.mountpoints.get(self.disk[0], 1)
rmp = self.mountpoints.getRealMount(self.disk[0], 1)
if len(mp) > 0 or len(rmp) > 0:
self.mounted = True
self['key_red'].setText(_('Unmount'))
else:
self.mounted = False
self['key_red'].setText(_('Mount'))
def setWindowTitle(self):
self.setTitle(_('Partitions'))
def selectionChanged(self):
self['key_green'].setText('')
self['key_yellow'].setText('')
self['key_red'].setText('')
if len(self.disk[5]) > 0:
index = self['menu'].getIndex()
if self.disk[5][index][3] == '83' or self.disk[5][index][3] == '7' or self.disk[5][index][3] == 'b':
self['key_green'].setText(_('Check'))
self['key_yellow'].setText(_('Format'))
mp = self.mountpoints.get(self.disk[0], index + 1)
rmp = self.mountpoints.getRealMount(self.disk[0], index + 1)
if len(mp) > 0 or len(rmp) > 0:
self.mounted = True
self['key_red'].setText(_('Unmount'))
else:
self.mounted = False
self['key_red'].setText(_('Mount'))
def chkfs(self):
disks = Disks()
ret = disks.chkfs(self.disk[5][self.index][0][:3], self.index + 1, self.fstype)
if ret == 0:
self.session.open(MessageBox, _('Check disk terminated with success'), MessageBox.TYPE_INFO)
elif ret == -1:
self.session.open(MessageBox, _('Cannot umount current drive.\nA record in progress, timeshift or some external tools (like samba, swapfile and nfsd) may cause this problem.\nPlease stop this actions/applications and try again'), MessageBox.TYPE_ERROR)
else:
self.session.open(MessageBox, _('Error checking disk. The disk may be damaged'), MessageBox.TYPE_ERROR)
def mkfs(self):
disks = Disks()
ret = disks.mkfs(self.disk[5][self.index][0][:3], self.index + 1, self.fstype)
if ret == 0:
self.session.open(MessageBox, _('Format terminated with success'), MessageBox.TYPE_INFO)
elif ret == -2:
self.session.open(MessageBox, _('Cannot format current drive.\nA record in progress, timeshift or some external tools (like samba, swapfile and nfsd) may cause this problem.\nPlease stop this actions/applications and try again'), MessageBox.TYPE_ERROR)
else:
self.session.open(MessageBox, _('Error formatting disk. The disk may be damaged'), MessageBox.TYPE_ERROR)
def isExt4Supported(self):
return 'ext4' in open('/proc/filesystems').read()
def domkfs(self, result):
if self.disk[5][self.index][3] == '83':
if self.isExt4Supported():
if result < 2:
self.fstype = result
self.session.open(ExtraActionBox, _('Formatting disk %s') % self.disk[5][self.index][0], _('Formatting disk'), self.mkfs)
elif result < 1:
self.fstype = 1
self.session.open(ExtraActionBox, _('Formatting disk %s') % self.disk[5][self.index][0], _('Formatting disk'), self.mkfs)
elif self.disk[5][self.index][3] == '7':
if result < 1:
self.fstype = 2
self.session.open(ExtraActionBox, _('Formatting disk %s') % self.disk[5][self.index][0], _('Formatting disk'), self.mkfs)
elif self.disk[5][self.index][3] == 'b':
if result < 1:
self.fstype = 3
self.session.open(ExtraActionBox, _('Formatting disk %s') % self.disk[5][self.index][0], _('Formatting disk'), self.mkfs)
def green(self):
if len(self.disk[5]) > 0:
index = self['menu'].getIndex()
if self.disk[5][index][3] == '83' or self.disk[5][index][3] == '7' or self.disk[5][index][3] == 'b':
#.........這裏部分代碼省略.........