コード例 #1
0
    def __init__(self, session, device, partition):
        Screen.__init__(self, session)

        self.device = device
        self.partition = partition
        self.mountpoints = MountPoints()
        self.mountpoints.read()
        self.fast = False

        self.list = []
        self.list.append("Mount as main hdd")
        self.list.append("Mount as /media/usb")
        self.list.append("Mount as /media/usb1")
        self.list.append("Mount as /media/usb2")
        self.list.append("Mount as /media/usb3")
        self.list.append("Mount as /media/cf")
        self.list.append("Mount as /media/mmc1")
        self.list.append("Mount on custom path")

        self["menu"] = MenuList(self.list)

        self["key_red"] = Button(_("Fixed mount"))
        self["key_green"] = Button("Fast mount")
        self["key_blue"] = Button(_("Exit"))
        #self["key_yellow"] = Button("")
        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions"], {
                "blue": self.quit,
                "green": self.green,
                "ok": self.ok,
                "red": self.ok,
                "cancel": self.quit,
            }, -2)
コード例 #2
0
ファイル: HddPartitions.py プロジェクト: oostende/opennfr
    def refreshMP(self, uirefresh=True):
        self.partitions = []
        self.mountpoints = MountPoints()
        self.mountpoints.read()
        count = 1
        for part in self.disk[5]:
            capacity = "%d MB" % (part[1] / (1024 * 1024))
            mp = self.mountpoints.get(self.disk[0], count)
            rmp = self.mountpoints.getRealMount(self.disk[0], count)
            if len(mp) > 0:
                self.partitions.append(
                    PartitionEntry(
                        "P. %d - %s (Fixed: %s)" % (count, part[2], mp),
                        capacity))
            elif len(rmp) > 0:
                self.partitions.append(
                    PartitionEntry(
                        "P. %d - %s (Fast: %s)" % (count, part[2], rmp),
                        capacity))
            else:
                self.partitions.append(
                    PartitionEntry("P. %d - %s" % (count, part[2]), capacity))
            count += 1

        if uirefresh:
            self["menu"].setList(self.partitions)
コード例 #3
0
 def __init__(self, session):
     Screen.__init__(self, session)
     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)
コード例 #4
0
	def checkDefault(self):
		mp = MountPoints()
		mp.read()
		if not mp.exist("/hdd"):
			mp.add(self.mdisks.disks[self.sindex][0], 1, "/media/hdd")
			mp.write()
			mp.mount(self.mdisks.disks[self.sindex][0], 1, "/media/hdd")
			os.system("/bin/mkdir /media/hdd/movie")
			os.system("/bin/mkdir /media/hdd/music")
			os.system("/bin/mkdir /media/hdd/picture")
コード例 #5
0
	def __init__(self, session, device, partition):
		Screen.__init__(self, session)
		
		self.device = device
		self.partition = partition
		self.mountpoints = MountPoints()
		self.mountpoints.read()
		self.fast = False
		
		self.list = []
		self.list.append("Mount as main hdd")
		self.list.append("Mount as /media/usb")
		self.list.append("Mount as /media/usb1")
		self.list.append("Mount as /media/usb2")
		self.list.append("Mount as /media/usb3")
		self.list.append("Mount as /media/cf")
		self.list.append("Mount as /media/mmc1")
		self.list.append("Mount on custom path")
		
		self["menu"] = MenuList(self.list)
		
		self["key_red"] = Button(_("Fixed mount"))
		self["key_green"] = Button("Fast mount")
		self["key_blue"] = Button(_("Exit"))
		#self["key_yellow"] = Button("")
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
		{
			"blue": self.quit,
			"green": self.green,
			"ok": self.ok,
			"red": self.ok,
			"cancel": self.quit,
		}, -2)
コード例 #6
0
	def initialaze(self, result):
		if not self.isExt4Supported():
			result += 1
			
		if result != 4:
			self.fsresult = result
			self.formatted = 0
			mp = MountPoints()
			mp.read()
			mp.deleteDisk(self.mdisks.disks[self.sindex][0])
			mp.write()
			self.session.openWithCallback(self.fdiskEnded, ExtraActionBox, "Partitioning...", "Initialize disk", self.fdisk)
コード例 #7
0
	def refreshMP(self, uirefresh = True):
		self.partitions = []
		self.mountpoints = MountPoints()
		self.mountpoints.read()
		count = 1
		for part in self.disk[5]:
			capacity = "%d MB" % (part[1] / (1024 * 1024))
			mp = self.mountpoints.get(self.disk[0], count)
			rmp = self.mountpoints.getRealMount(self.disk[0], count)
			if len(mp) > 0:
				self.partitions.append(PartitionEntry("P. %d - %s (Fixed: %s)" % (count, part[2], mp), capacity))
			elif len(rmp) > 0:
				self.partitions.append(PartitionEntry("P. %d - %s (Fast: %s)" % (count, part[2], rmp), capacity))
			else:
				self.partitions.append(PartitionEntry("P. %d - %s" % (count, part[2]), capacity))
			count += 1
		
		if uirefresh:
			self["menu"].setList(self.partitions)
コード例 #8
0
	def __init__(self, session):
		Screen.__init__(self, session)
		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)
コード例 #9
0
ファイル: HddPartitions.py プロジェクト: oostende/opennfr
class HddPartitions(Screen):
    skin = """
                   <screen name="HddPartitions" position="center,115" size="900,530" title="HddPartitions" flags="wfBorder">
                        <widget source="menu" render="Listbox" position="10,47" size="880,410" scrollbarMode="showOnDemand" transparent="1">
                        <convert type="TemplatedMultiContent">
				{"template": [
					MultiContentEntryPixmapAlphaTest(pos = (5, 7), size = (48, 48), png = 0),
					MultiContentEntryText(pos = (70, 1), size = (630, 38), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 1),
					MultiContentEntryText(pos = (70, 25), size = (630, 38), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 2),
					],
					"fonts": [gFont("Regular", 22), gFont("Regular", 20)],
					"itemHeight": 50
				}
			</convert>
                       </widget>
                      <widget name="label_disk" position="10,11" font="Regular;26" halign="center" size="880,26" transparent="1" backgroundColor="red" foregroundColor="red" />
                       <ePixmap position="10,497" size="35,27" pixmap="skin_default/buttons/red.png" alphatest="blend" />
                       <ePixmap position="230,497" size="35,27" pixmap="skin_default/buttons/green.png" alphatest="blend" />
                       <ePixmap position="464,497" size="35,27" pixmap="skin_default/buttons/yellow.png" alphatest="blend" />
                       <ePixmap position="695,497" size="35,27" pixmap="skin_default/buttons/blue.png" alphatest="blend" />
                       <widget name="key_red" position="48,498" zPosition="2" size="150,22" valign="center" halign="center" font="Regular; 20" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
                        <widget name="key_green" position="273,499" zPosition="2" size="150,22" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" backgroundColor="foreground" />
                       <widget name="key_yellow" position="508,499" zPosition="3" size="150,22" valign="center" halign="center" font="Regular; 21" transparent="1" backgroundColor="foreground" />
                      <widget name="key_blue" position="736,499" zPosition="3" size="150,22" valign="center" halign="center" font="Regular; 21" transparent="1" backgroundColor="foreground" />
                     </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)

        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(_("Umount"))
                else:
                    self.mounted = False
                    self["key_red"].setText(_("Mount"))

    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(_("Umount"))
                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, timeshit or some external tools (like samba 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, timeshit or some external tools (like samba 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)
            else:
                if 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":
                self.index = index
                if self.disk[5][index][3] == "83":
                    self.fstype = 0
                elif self.disk[5][index][3] == "7":
                    self.fstype = 2
                elif self.disk[5][index][3] == "b":
                    self.fstype = 3
                self.session.open(ExtraActionBox,
                                  "Checking disk %s" % self.disk[5][index][0],
                                  "Checking disk", self.chkfs)

    def yellow(self):
        if len(self.disk[5]) > 0:
            self.index = self["menu"].getIndex()
            if self.disk[5][self.index][3] == "83":
                if self.isExt4Supported():
                    self.session.openWithCallback(
                        self.domkfs, ExtraMessageBox, "Format as",
                        "HDD Partitioner", [
                            ["Ext4", "partitionmanager.png"],
                            ["Ext3", "partitionmanager.png"],
                            ["Cancel", "cancel.png"],
                        ], 1, 2)
                else:
                    self.session.openWithCallback(
                        self.domkfs, ExtraMessageBox, "Format as",
                        "HDD Partitioner", [
                            ["Ext3", "partitionmanager.png"],
                            ["Cancel", "cancel.png"],
                        ], 1, 1)
            elif self.disk[5][self.index][3] == "7":
                self.session.openWithCallback(
                    self.domkfs, ExtraMessageBox, "Format as",
                    "HDD Partitioner", [
                        ["NTFS", "partitionmanager.png"],
                        ["Cancel", "cancel.png"],
                    ], 1, 1)
            elif self.disk[5][self.index][3] == "b":
                self.session.openWithCallback(
                    self.domkfs, ExtraMessageBox, "Format as",
                    "HDD Partitioner", [
                        ["Fat32", "partitionmanager.png"],
                        ["Cancel", "cancel.png"],
                    ], 1, 1)

    def refreshMP(self, uirefresh=True):
        self.partitions = []
        self.mountpoints = MountPoints()
        self.mountpoints.read()
        count = 1
        for part in self.disk[5]:
            capacity = "%d MB" % (part[1] / (1024 * 1024))
            mp = self.mountpoints.get(self.disk[0], count)
            rmp = self.mountpoints.getRealMount(self.disk[0], count)
            if len(mp) > 0:
                self.partitions.append(
                    PartitionEntry(
                        "P. %d - %s (Fixed: %s)" % (count, part[2], mp),
                        capacity))
            elif len(rmp) > 0:
                self.partitions.append(
                    PartitionEntry(
                        "P. %d - %s (Fast: %s)" % (count, part[2], rmp),
                        capacity))
            else:
                self.partitions.append(
                    PartitionEntry("P. %d - %s" % (count, part[2]), capacity))
            count += 1

        if uirefresh:
            self["menu"].setList(self.partitions)

    def red(self):
        if len(self.disk[5]) > 0:
            index = self["menu"].getIndex()
            if self.disk[5][index][3] != "83" and self.disk[5][index][
                    3] != "7" and self.disk[5][index][3] != "b":
                return

        if len(self.partitions) > 0:
            self.sindex = self['menu'].getIndex()
            if self.mounted:
                mp = self.mountpoints.get(self.disk[0], self.sindex + 1)
                rmp = self.mountpoints.getRealMount(self.disk[0],
                                                    self.sindex + 1)
                if len(mp) > 0:
                    if self.mountpoints.isMounted(mp):
                        if self.mountpoints.umount(mp):
                            self.mountpoints.delete(mp)
                            self.mountpoints.write()
                        else:
                            self.session.open(
                                MessageBox,
                                _("Cannot umount device.\nA record in progress, timeshit or some external tools (like samba and nfsd) may cause this problem.\nPlease stop this actions/applications and try again"
                                  ), MessageBox.TYPE_ERROR)
                    else:
                        self.mountpoints.delete(mp)
                        self.mountpoints.write()
                elif len(rmp) > 0:
                    self.mountpoints.umount(rmp)
                self.refreshMP()
            else:
                self.session.openWithCallback(self.refreshMP, HddMount,
                                              self.disk[0], self.sindex + 1)

    def quit(self):
        self.close()
コード例 #10
0
class HddMount(Screen):

    skin = """
                    <screen name="HddMount" position="center,115" size="900,530" title="HddMount" flags="wfBorder">
                      <ePixmap position="10,497" size="35,27" pixmap="skin_default/buttons/red.png" alphatest="blend" />
                      <ePixmap position="230,497" size="35,27" pixmap="skin_default/buttons/green.png" alphatest="blend" />
                      <ePixmap position="695,497" size="35,27" pixmap="skin_default/buttons/blue.png" alphatest="blend" />
                      <widget name="key_red" position="48,498" zPosition="2" size="150,22" valign="center" halign="center" font="Regular; 20" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
                      <widget name="key_green" position="273,499" zPosition="2" size="150,22" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" backgroundColor="foreground" />
                      <widget name="key_blue" position="736,499" zPosition="3" size="150,22" valign="center" halign="center" font="Regular; 21" transparent="1" backgroundColor="foreground" />
                     <eLabel text="Hard Drive Mount" zPosition="2" position="10,11" size="880,40" halign="left" font="Regular;28" foregroundColor="un538eff" transparent="1" shadowColor="black" shadowOffset="-1,-1" backgroundColor="black" />
                      <widget name="menu" position="10,59" size="880,410" scrollbarMode="showOnDemand" transparent="1" />
                    </screen> """

    def __init__(self, session, device, partition):
        Screen.__init__(self, session)

        self.device = device
        self.partition = partition
        self.mountpoints = MountPoints()
        self.mountpoints.read()
        self.fast = False

        self.list = []
        self.list.append("Mount as main hdd")
        self.list.append("Mount as /media/usb")
        self.list.append("Mount as /media/usb1")
        self.list.append("Mount as /media/usb2")
        self.list.append("Mount as /media/usb3")
        self.list.append("Mount as /media/cf")
        self.list.append("Mount as /media/mmc1")
        self.list.append("Mount on custom path")

        self["menu"] = MenuList(self.list)

        self["key_red"] = Button(_("Fixed mount"))
        self["key_green"] = Button("Fast mount")
        self["key_blue"] = Button(_("Exit"))
        #self["key_yellow"] = Button("")
        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions"], {
                "blue": self.quit,
                "green": self.green,
                "ok": self.ok,
                "red": self.ok,
                "cancel": self.quit,
            }, -2)

    def ok(self):
        self.fast = False
        selected = self["menu"].getSelectedIndex()
        if selected == 0:
            self.setMountPoint("/media/hdd")
        elif selected == 1:
            self.setMountPoint("/media/usb")
        elif selected == 2:
            self.setMountPoint("/media/usb1")
        elif selected == 3:
            self.setMountPoint("/media/usb2")
        elif selected == 4:
            self.setMountPoint("/media/usb3")
        elif selected == 5:
            self.setMountPoint("/media/cf")
        elif selected == 6:
            self.setMountPoint("/media/mmc1")
        elif selected == 7:
            self.session.openWithCallback(self.customPath,
                                          VirtualKeyBoard,
                                          title=(_("Insert mount point:")),
                                          text="/media/custom")

    def green(self):
        self.fast = True
        selected = self["menu"].getSelectedIndex()
        if selected == 0:
            self.setMountPoint("/media/hdd")
        elif selected == 1:
            self.setMountPoint("/media/usb")
        elif selected == 2:
            self.setMountPoint("/media/usb1")
        elif selected == 3:
            self.setMountPoint("/media/usb2")
        elif selected == 4:
            self.setMountPoint("/media/usb3")
        elif selected == 5:
            self.setMountPoint("/media/cf")
        elif selected == 6:
            self.setMountPoint("/media/mmc1")
        elif selected == 7:
            self.session.openWithCallback(self.customPath,
                                          VirtualKeyBoard,
                                          title=(_("Insert mount point:")),
                                          text="/media/custom")

    def customPath(self, result):
        if result and len(result) > 0:
            result = result.rstrip("/")
            os.system("mkdir -p %s" % result)
            self.setMountPoint(result)

    def setMountPoint(self, path):
        self.cpath = path
        mountp = ""
        f = open('/proc/mounts', 'r')
        for line in f.readlines():
            if path in line:
                partsp = line.strip().split()
                mountp = str(partsp[1])
                break

        f.close()
        if path == mountp:
            self.session.openWithCallback(
                self.setMountPointCb, ExtraMessageBox,
                "Selected mount point is already used by another drive.",
                "Mount point exist!", [
                    ["Change old drive with this new drive", "ok.png"],
                    ["Mantain old drive", "cancel.png"],
                ])
        else:
            self.setMountPointCb(0)

    def setMountPointCb(self, result):
        if result == 0:
            if self.mountpoints.isMounted(self.cpath):
                if not self.mountpoints.umount(self.cpath):
                    self.session.open(
                        MessageBox,
                        _("Cannot umount current drive.\nA record in progress, timeshit or some external tools (like samba and nfsd) may cause this problem.\nPlease stop this actions/applications and try again"
                          ), MessageBox.TYPE_ERROR)
                    self.close()
                    return
            self.mountpoints.delete(self.cpath)
            if not self.fast:
                self.mountpoints.add(self.device, self.partition, self.cpath)
            self.mountpoints.write()
            if not self.mountpoints.mount(self.device, self.partition,
                                          self.cpath):
                self.session.open(
                    MessageBox,
                    _("Cannot mount new drive.\nPlease check filesystem or format it and try again"
                      ), MessageBox.TYPE_ERROR)
            elif self.cpath == "/media/hdd":
                os.system("/bin/mkdir /hdd/movie")
                os.system("/bin/mkdir /hdd/music")
                os.system("/bin/mkdir /hdd/picture")

            self.close()

    def quit(self):
        self.close()
コード例 #11
0
class HddFastRemove(Screen):

    skin = """
                <screen name="HddFastRemove" position="center,115" size="900,530" title="HddFastRemove" flags="wfBorder">
                      <ePixmap position="10,497" size="35,27" pixmap="skin_default/buttons/red.png" alphatest="blend" />
                      <ePixmap position="230,497" size="35,27" pixmap="skin_default/buttons/green.png" alphatest="blend" />
                      <ePixmap position="464,497" size="35,27" pixmap="skin_default/buttons/yellow.png" alphatest="blend" />
                      <ePixmap position="695,497" size="35,27" pixmap="skin_default/buttons/blue.png" alphatest="blend" />
                      <widget name="key_red" position="48,498" zPosition="2" size="150,22" valign="center" halign="center" font="Regular; 20" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
                      <widget name="key_green" position="273,499" zPosition="2" size="150,22" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" backgroundColor="foreground" />
                      <widget name="key_yellow" position="508,499" zPosition="3" size="150,22" valign="center" halign="center" font="Regular; 21" transparent="1" backgroundColor="foreground" />
                      <widget name="key_blue" position="736,499" zPosition="3" size="150,22" valign="center" halign="center" font="Regular; 21" transparent="1" backgroundColor="foreground" />
                      <eLabel text="Hard Drive Remove" zPosition="2" position="10,11" size="880,40" halign="left" font="Regular;28" foregroundColor="un538eff" transparent="1" shadowColor="black" shadowOffset="-1,-1" backgroundColor="black" />
                      <widget source="menu" render="Listbox" position="11,58" size="880,410" scrollbarMode="showOnDemand" transparent="1">
                      <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 = (65, 27), size = (190, 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.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)

        self["menu"] = List(self.disks)
        self["key_red"] = Button(_("Umount"))
        self["key_blue"] = Button(_("Exit"))
        self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], {
            "blue": self.quit,
            "red": self.red,
            "cancel": self.quit,
        }, -2)
コード例 #12
0
 def checkDefault(self):
     mp = MountPoints()
     mp.read()
     if not mp.exist("/hdd"):
         mp.add(self.mdisks.disks[self.sindex][0], 1, "/hdd")
         mp.write()
         mp.mount(self.mdisks.disks[self.sindex][0], 1, "/hdd")
         os.system("/bin/mkdir /hdd/movie")
         os.system("/bin/mkdir /hdd/music")
         os.system("/bin/mkdir /hdd/picture")
コード例 #13
0
ファイル: HddMount.py プロジェクト: n3wb13/openNFR-gui2
    def __init__(self, session):
        Screen.__init__(self, session)
        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:
                        if "mmcblk1" in partition[0][:7]:
                            mp = self.mountpoints.get(partition[0][:7],
                                                      int(partition[0][8:]))
                            rmp = self.mountpoints.getRealMount(
                                partition[0][:7], int(partition[0][8:]))
                        else:
                            mp = self.mountpoints.get(partition[0][:3],
                                                      int(partition[0][3:]))
                            rmp = self.mountpoints.getRealMount(
                                partition[0][:3], int(partition[0][3:]))
                    except Exception as e:
                        pass
                    if len(mp) > 0:
                        if "mmcblk1" in partition[0][:7]:
                            self.disks.append(
                                MountEntry(
                                    disk[3], "P.%s (Fixed: %s)" %
                                    (partition[0][7:], mp)))
                            self.mounts.append(mp)
                        else:
                            self.disks.append(
                                MountEntry(
                                    disk[3], "P.%s (Fixed: %s)" %
                                    (partition[0][3:], mp)))
                            self.mounts.append(mp)
                    elif len(rmp) > 0:
                        if "mmcblk1" in partition[0][:7]:
                            self.disks.append(
                                MountEntry(
                                    disk[3], "P.%s (Fast: %s)" %
                                    (partition[0][7:], rmp)))
                            self.mounts.append(rmp)
                        else:
                            self.disks.append(
                                MountEntry(
                                    disk[3], "P.%s (Fast: %s)" %
                                    (partition[0][3:], rmp)))
                            self.mounts.append(rmp)

        self["menu"] = List(self.disks)
        self["key_red"] = Button(_("Umount"))
        self["key_blue"] = Button(_("Exit"))
        self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], {
            "blue": self.quit,
            "red": self.red,
            "cancel": self.quit,
        }, -2)
コード例 #14
0
class HddMount(Screen):

	skin = """
                    <screen name="HddMount" position="center,115" size="900,530" title="HddMount" flags="wfBorder">
                      <ePixmap position="10,497" size="35,27" pixmap="skin_default/buttons/red.png" alphatest="blend" />
                      <ePixmap position="230,497" size="35,27" pixmap="skin_default/buttons/green.png" alphatest="blend" />
                      <ePixmap position="695,497" size="35,27" pixmap="skin_default/buttons/blue.png" alphatest="blend" />
                      <widget name="key_red" position="48,498" zPosition="2" size="150,22" valign="center" halign="center" font="Regular; 20" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
                      <widget name="key_green" position="273,499" zPosition="2" size="150,22" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" backgroundColor="foreground" />
                      <widget name="key_blue" position="736,499" zPosition="3" size="150,22" valign="center" halign="center" font="Regular; 21" transparent="1" backgroundColor="foreground" />
                     <eLabel text="Hard Drive Mount" zPosition="2" position="10,11" size="880,40" halign="left" font="Regular;28" foregroundColor="un538eff" transparent="1" shadowColor="black" shadowOffset="-1,-1" backgroundColor="black" />
                      <widget name="menu" position="10,59" size="880,410" scrollbarMode="showOnDemand" transparent="1" />
                    </screen> """
                    
	def __init__(self, session, device, partition):
		Screen.__init__(self, session)
		
		self.device = device
		self.partition = partition
		self.mountpoints = MountPoints()
		self.mountpoints.read()
		self.fast = False
		
		self.list = []
		self.list.append("Mount as main hdd")
		self.list.append("Mount as /media/usb")
		self.list.append("Mount as /media/usb1")
		self.list.append("Mount as /media/usb2")
		self.list.append("Mount as /media/usb3")
		self.list.append("Mount as /media/cf")
		self.list.append("Mount as /media/mmc1")
		self.list.append("Mount on custom path")
		
		self["menu"] = MenuList(self.list)
		
		self["key_red"] = Button(_("Fixed mount"))
		self["key_green"] = Button("Fast mount")
		self["key_blue"] = Button(_("Exit"))
		#self["key_yellow"] = Button("")
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
		{
			"blue": self.quit,
			"green": self.green,
			"ok": self.ok,
			"red": self.ok,
			"cancel": self.quit,
		}, -2)
		
	def ok(self):
		self.fast = False
		selected = self["menu"].getSelectedIndex()
		if selected == 0:
			self.setMountPoint("/media/hdd")
		elif selected == 1:
			self.setMountPoint("/media/usb")
		elif selected == 2:
			self.setMountPoint("/media/usb1")
		elif selected == 3:
			self.setMountPoint("/media/usb2")
		elif selected == 4:
			self.setMountPoint("/media/usb3")
		elif selected == 5:
			self.setMountPoint("/media/cf")
		elif selected == 6:
			self.setMountPoint("/media/mmc1")
		elif selected == 7:
			self.session.openWithCallback(self.customPath, VirtualKeyBoard, title = (_("Insert mount point:")), text = "/media/custom")
			
	def green(self):
		self.fast = True
		selected = self["menu"].getSelectedIndex()
		if selected == 0:
			self.setMountPoint("/media/hdd")
		elif selected == 1:
			self.setMountPoint("/media/usb")
		elif selected == 2:
			self.setMountPoint("/media/usb1")
		elif selected == 3:
			self.setMountPoint("/media/usb2")
		elif selected == 4:
			self.setMountPoint("/media/usb3")
		elif selected == 5:
			self.setMountPoint("/media/cf")
		elif selected == 6:
			self.setMountPoint("/media/mmc1")
		elif selected == 7:
			self.session.openWithCallback(self.customPath, VirtualKeyBoard, title = (_("Insert mount point:")), text = "/media/custom")
		
	def customPath(self, result):
		if result and len(result) > 0:
			result = result.rstrip("/")
			os.system("mkdir -p %s" % result)
			self.setMountPoint(result)
		
	def setMountPoint(self, path):
		self.cpath = path
		mountp = ""
	        f = open('/proc/mounts', 'r')
		for line in f.readlines():
			if path in line:
				partsp = line.strip().split()
				mountp = str(partsp[1])
				break
		
		f.close()
	        if path == mountp:		
			self.session.openWithCallback(self.setMountPointCb, ExtraMessageBox, "Selected mount point is already used by another drive.", "Mount point exist!",
																[ [ "Change old drive with this new drive", "ok.png" ],
																[ "Mantain old drive", "cancel.png" ],
																])
		else:
			self.setMountPointCb(0)
			
	def setMountPointCb(self, result):
		if result == 0:
			if self.mountpoints.isMounted(self.cpath):
				if not self.mountpoints.umount(self.cpath):
					self.session.open(MessageBox, _("Cannot umount current drive.\nA record in progress, timeshit or some external tools (like samba and nfsd) may cause this problem.\nPlease stop this actions/applications and try again"), MessageBox.TYPE_ERROR)
					self.close()
					return
			self.mountpoints.delete(self.cpath)
			if not self.fast:
				self.mountpoints.add(self.device, self.partition, self.cpath)
			self.mountpoints.write()
			if not self.mountpoints.mount(self.device, self.partition, self.cpath):
				self.session.open(MessageBox, _("Cannot mount new drive.\nPlease check filesystem or format it and try again"), MessageBox.TYPE_ERROR)
			elif self.cpath == "/media/hdd":
				os.system("/bin/mkdir /hdd/movie")
				os.system("/bin/mkdir /hdd/music")
				os.system("/bin/mkdir /hdd/picture")

			self.close()
	
	def quit(self):
		self.close()
コード例 #15
0
class HddFastRemove(Screen):

	skin = """
                <screen name="HddFastRemove" position="center,115" size="900,530" title="HddFastRemove" flags="wfBorder">
                      <ePixmap position="10,497" size="35,27" pixmap="skin_default/buttons/red.png" alphatest="blend" />
                      <ePixmap position="230,497" size="35,27" pixmap="skin_default/buttons/green.png" alphatest="blend" />
                      <ePixmap position="464,497" size="35,27" pixmap="skin_default/buttons/yellow.png" alphatest="blend" />
                      <ePixmap position="695,497" size="35,27" pixmap="skin_default/buttons/blue.png" alphatest="blend" />
                      <widget name="key_red" position="48,498" zPosition="2" size="150,22" valign="center" halign="center" font="Regular; 20" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
                      <widget name="key_green" position="273,499" zPosition="2" size="150,22" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" backgroundColor="foreground" />
                      <widget name="key_yellow" position="508,499" zPosition="3" size="150,22" valign="center" halign="center" font="Regular; 21" transparent="1" backgroundColor="foreground" />
                      <widget name="key_blue" position="736,499" zPosition="3" size="150,22" valign="center" halign="center" font="Regular; 21" transparent="1" backgroundColor="foreground" />
                      <eLabel text="Hard Drive Remove" zPosition="2" position="10,11" size="880,40" halign="left" font="Regular;28" foregroundColor="un538eff" transparent="1" shadowColor="black" shadowOffset="-1,-1" backgroundColor="black" />
                      <widget source="menu" render="Listbox" position="11,58" size="880,410" scrollbarMode="showOnDemand" transparent="1">
                      <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 = (65, 27), size = (190, 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.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)
						
		self["menu"] = List(self.disks)
		self["key_red"] = Button(_("Umount"))
		self["key_blue"] = Button(_("Exit"))
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
		{
			"blue": self.quit,
			"red": self.red,
			"cancel": self.quit,
		}, -2)
コード例 #16
0
class HddPartitions(Screen):
	skin = """
                   <screen name="HddPartitions" position="center,115" size="900,530" title="HddPartitions" flags="wfBorder">
                        <widget source="menu" render="Listbox" position="10,47" size="880,410" scrollbarMode="showOnDemand" transparent="1">
                        <convert type="TemplatedMultiContent">
				{"template": [
					MultiContentEntryPixmapAlphaTest(pos = (5, 7), size = (48, 48), png = 0),
					MultiContentEntryText(pos = (70, 1), size = (630, 38), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 1),
					MultiContentEntryText(pos = (70, 25), size = (630, 38), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 2),
					],
					"fonts": [gFont("Regular", 22), gFont("Regular", 20)],
					"itemHeight": 50
				}
			</convert>
                       </widget>
                      <widget name="label_disk" position="10,11" font="Regular;26" halign="center" size="880,26" transparent="1" backgroundColor="red" foregroundColor="red" />
                       <ePixmap position="10,497" size="35,27" pixmap="skin_default/buttons/red.png" alphatest="blend" />
                       <ePixmap position="230,497" size="35,27" pixmap="skin_default/buttons/green.png" alphatest="blend" />
                       <ePixmap position="695,497" size="35,27" pixmap="skin_default/buttons/blue.png" alphatest="blend" />
                       <widget name="key_red" position="48,498" zPosition="2" size="150,22" valign="center" halign="center" font="Regular; 20" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
                        <widget name="key_green" position="273,499" zPosition="2" size="150,22" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" backgroundColor="foreground" />
                       <widget name="key_blue" position="736,499" zPosition="3" size="150,22" valign="center" halign="center" font="Regular; 21" transparent="1" backgroundColor="foreground" />
                     </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)
		
		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(_("Umount"))
				else:
					self.mounted = False
					self["key_red"].setText(_("Mount"))
		
	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(_("Umount"))
				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, timeshit or some external tools (like samba 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, timeshit or some external tools (like samba 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)
			else:
				if 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":
				self.index = index
				if self.disk[5][index][3] == "83":
					self.fstype = 0
				elif self.disk[5][index][3] == "7":
					self.fstype = 2
				elif self.disk[5][index][3] == "b":
					self.fstype = 3
				self.session.open(ExtraActionBox, "Checking disk %s" % self.disk[5][index][0], "Checking disk", self.chkfs)
				
#	def yellow(self):
#		if len(self.disk[5]) > 0:
#			self.index = self["menu"].getIndex()
#			if self.disk[5][self.index][3] == "83":
#				if self.isExt4Supported():
#					self.session.openWithCallback(self.domkfs, ExtraMessageBox, "Format as", "HDD Partitioner",
#												[ [ "Ext4", "partitionmanager.png" ],
#												[ "Ext3", "partitionmanager.png" ],
#												[ "Cancel", "cancel.png" ],
#												], 1, 2)
#				else:
#					self.session.openWithCallback(self.domkfs, ExtraMessageBox, "Format as", "HDD Partitioner",
#												[ [ "Ext3", "partitionmanager.png" ],
#												[ "Cancel", "cancel.png" ],
#												], 1, 1)
#			elif self.disk[5][self.index][3] == "7":
#				self.session.openWithCallback(self.domkfs, ExtraMessageBox, "Format as", "HDD Partitioner",
#											[ [ "NTFS", "partitionmanager.png" ],
#											[ "Cancel", "cancel.png" ],
#											], 1, 1)
#			elif self.disk[5][self.index][3] == "b":
#				self.session.openWithCallback(self.domkfs, ExtraMessageBox, "Format as", "HDD Partitioner",
#											[ [ "Fat32", "partitionmanager.png" ],
#											[ "Cancel", "cancel.png" ],
#											], 1, 1)
				
	def refreshMP(self, uirefresh = True):
		self.partitions = []
		self.mountpoints = MountPoints()
		self.mountpoints.read()
		count = 1
		for part in self.disk[5]:
			capacity = "%d MB" % (part[1] / (1024 * 1024))
			mp = self.mountpoints.get(self.disk[0], count)
			rmp = self.mountpoints.getRealMount(self.disk[0], count)
			if len(mp) > 0:
				self.partitions.append(PartitionEntry("P. %d - %s (Fixed: %s)" % (count, part[2], mp), capacity))
			elif len(rmp) > 0:
				self.partitions.append(PartitionEntry("P. %d - %s (Fast: %s)" % (count, part[2], rmp), capacity))
			else:
				self.partitions.append(PartitionEntry("P. %d - %s" % (count, part[2]), capacity))
			count += 1
		
		if uirefresh:
			self["menu"].setList(self.partitions)
		
	def red(self):
		if len(self.disk[5]) > 0:
			index = self["menu"].getIndex()
			if self.disk[5][index][3] != "83" and self.disk[5][index][3] != "7" and self.disk[5][index][3] != "b":
				return
				
		if len(self.partitions) > 0:
			self.sindex = self['menu'].getIndex()
			if self.mounted:
				mp = self.mountpoints.get(self.disk[0], self.sindex+1)
				rmp = self.mountpoints.getRealMount(self.disk[0], self.sindex+1)
				if len(mp) > 0:
					if self.mountpoints.isMounted(mp):
						if self.mountpoints.umount(mp):
							self.mountpoints.delete(mp)
							self.mountpoints.write()
						else:
							self.session.open(MessageBox, _("Cannot umount device.\nA record in progress, timeshit or some external tools (like samba and nfsd) may cause this problem.\nPlease stop this actions/applications and try again"), MessageBox.TYPE_ERROR)
					else:
						self.mountpoints.delete(mp)
						self.mountpoints.write()
				elif len(rmp) > 0:
					self.mountpoints.umount(rmp)
				self.refreshMP()
			else:
				self.session.openWithCallback(self.refreshMP, HddMount, self.disk[0], self.sindex+1)
		
	def quit(self):
		self.close()