Beispiel #1
0
class Ceparted(Screen):
    skin = """<screen position="center,center" size="600,200" title="eParted OpenLD">
			<widget name="list" position="5,5" size="590,190" />
		</screen>"""

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

        self["actions"] = ActionMap(["OkCancelActions"], {
            "cancel": self.Exit,
            "ok": self.Ok
        }, -1)

        self["list"] = MenuList(list=[])
        self.Console = Console()
        global rereaddevices
        rereaddevices = True
        self.__readDev()

    def Ok(self):
        sel = self["list"].getCurrent()
        if sel and sel[1]:
            global rereaddevices
            rereaddevices = False
            self.session.openWithCallback(self.__readDev, Cpart, sel[1])

    def __readDev(self):
        global rereaddevices
        if rereaddevices:
            self.Console.ePopen("parted -m -l", self.__FinishedConsole)

    def Exit(self):
        self.Console.killAll()
        self.close()

    def __FinishedConsole(self, result, retval, extra_args=None):
        if retval == 0 and '\n' in result:
            list = []
            for x in parseCmd(result):
                if x[0][LIST_TYPE] == LIST_TYPE_DEV:
                    name = x[0][DEV_NAME]
                    if len(name) == 0:
                        name = x[0][DEV_PATH]
                    tstr = name
                    tstr += "  (%s - %d %s %s)" % (x[0][DEV_SIZE], len(x) - 1,
                                                   _("partition(s)"),
                                                   x[0][DEV_PATH])
                    list.append((tstr, (name, x[0][DEV_PATH], x[0][DEV_SIZE])))
            self["list"].setList(list)
Beispiel #2
0
class Ceparted(Screen):
	skin = """<screen position="center,center" size="600,200" title="eParted OpenLD">
			<widget name="list" position="5,5" size="590,190" />
		</screen>"""
	def __init__(self, session):
		Screen.__init__(self, session)

		self["actions"] = ActionMap(["OkCancelActions"],
		{
			"cancel": self.Exit,
			"ok": self.Ok
		}, -1)

		self["list"] = MenuList(list=[])
		self.Console = Console()
		global rereaddevices
		rereaddevices=True
		self.__readDev()

	def Ok(self):
		sel = self["list"].getCurrent()
		if sel and sel[1]:
			global rereaddevices
			rereaddevices=False
			self.session.openWithCallback(self.__readDev, Cpart, sel[1])

	def __readDev(self):
		global rereaddevices
		if rereaddevices:
			self.Console.ePopen("parted -m -l", self.__FinishedConsole)

	def Exit(self):
		self.Console.killAll()
		self.close()

	def __FinishedConsole(self, result, retval, extra_args = None):
		if retval==0 and '\n' in result:
			list=[]
			for x in parseCmd(result):
				if x[0][LIST_TYPE]==LIST_TYPE_DEV:
					name = x[0][DEV_NAME]
					if len(name)==0:
						name = x[0][DEV_PATH]
					tstr = name
					tstr += "  (%s - %d %s %s)" %(x[0][DEV_SIZE],len(x)-1,_("partition(s)"),x[0][DEV_PATH])
					list.append((tstr,(name,x[0][DEV_PATH], x[0][DEV_SIZE])))
			self["list"].setList(list)
Beispiel #3
0
class Cpart(Screen):
    PA_TYPE_USE = 1
    PA_TYPE_LAST = 2
    PA_TYPE_FREE = 4

    skin = """<screen position="center,center" size="670,200" title="eParted">
			<widget source="list" render="Listbox" position="0,0" size="670,160" scrollbarMode="showOnDemand" enableWrapAround="on">
			<convert type="TemplatedMultiContent">
				{"template": [
				MultiContentEntryText(pos = (0,5), size = (50, 30), font=0, flags = RT_HALIGN_LEFT, text=0),
				MultiContentEntryText(pos = (60,5), size = (150, 30), font=0, flags = RT_HALIGN_LEFT, text=1),
				MultiContentEntryText(pos = (210,5), size = (150, 30), font=0, flags = RT_HALIGN_LEFT, text=2),
				MultiContentEntryText(pos = (360,5), size = (150, 30), font=0, flags = RT_HALIGN_LEFT, text=3),
				MultiContentEntryText(pos = (510,5), size = (160, 30), font=0, flags = RT_HALIGN_LEFT, text=4)
				],
				"fonts": [gFont("Regular", 20)],
				"itemHeight": 35
				}
			</convert>
			</widget>
			<widget name="PixmapRed" position="25,170" size="15,16" pixmaps="skin_default/buttons/button_red_off.png,skin_default/buttons/button_red.png" transparent="1" alphatest="on" />
			<widget name="LabelRed" position="50,160" size="150,40" font="Regular;19" valign="center" />
			<widget name="PixmapGreen" position="225,170" size="15,16" pixmaps="skin_default/buttons/button_green_off.png,skin_default/buttons/button_green.png" transparent="1" alphatest="on" />
			<widget name="LabelGreen" position="250,160" size="150,40" font="Regular;19" valign="center" />
			<widget name="PixmapBlue" position="425,170" size="15,16" pixmaps="skin_default/buttons/button_blue_off.png,skin_default/buttons/button_blue.png" transparent="1" alphatest="on" />
			<widget name="LabelBlue" position="450,160" size="150,40" font="Regular;19" valign="center" />
		</screen>"""

    def __init__(self, session, entry):
        Screen.__init__(self, session)

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions"], {
                "cancel": self.Exit,
                "green": self.KeyGreen,
                "blue": self.KeyBlue,
                "red": self.KeyRed
            }, -1)

        self["list"] = List(list=[])
        self["list"].onSelectionChanged.append(self.__SetLabels)
        self["PixmapRed"] = MultiPixmap()
        self["PixmapGreen"] = MultiPixmap()
        self["PixmapBlue"] = MultiPixmap()
        self["LabelRed"] = Label()
        self["LabelGreen"] = Label()
        self["LabelBlue"] = Label()

        self.__devpath = entry[DEV_PATH]
        self.__fullsize = 0
        self.__old_part_list = []
        self.__new_part_list = []
        self.__comlist = []
        self.__unit = entry[2][len(entry[2]) - 2:]

        self.Console = Console()
        self.__getPartInfo()

    def Exit(self):
        self.Console.killAll()
        self.close()

    def __getPartInfo(self, val=None):
        self.Console.ePopen(
            "parted -m %s unit %s print" % (self.__devpath, self.__unit),
            self.__FinishedConsole)

    def __Filllist(self):
        list = []
        index = self["list"].getIndex()
        for x in self.__new_part_list:
            if x[LIST_TYPE] == LIST_TYPE_PAR:
                p0 = "%s: %s" % (_("Nr"), x[PA_NR])
                p1 = "%s: %d%s" % (_("Start"), x[PA_START], self.__unit)
                p2 = "%s: %d%s" % (_("End"), x[PA_END], self.__unit)
                p3 = "%s: %d%s" % (_("Size"), x[PA_SIZE], self.__unit)
                p4 = "%s: %s" % (_("Type"), x[PA_FS])
                list.append((p0, p1, p2, p3, p4, x))
            self["list"].setList(list)
        self["list"].setIndex(index)
        self.__createCommandList()

    def __SetLabels(self):
        sel = self["list"].getCurrent()
        self["LabelGreen"].setText("")
        self["LabelRed"].setText("")
        if sel and sel[5]:
            if sel[5][PA_TYPE] & self.PA_TYPE_FREE and len(
                    self.__new_part_list) < 6:
                self["PixmapGreen"].setPixmapNum(1)
                self["LabelGreen"].setText(_("add"))
            else:
                self["PixmapGreen"].setPixmapNum(0)
            if sel[5][PA_TYPE] & self.PA_TYPE_LAST and bool(
                    sel[5][PA_TYPE] & self.PA_TYPE_FREE) == False:
                self["PixmapRed"].setPixmapNum(1)
                self["LabelRed"].setText(_("delete"))
            else:
                self["PixmapRed"].setPixmapNum(0)

    def __addFreePart(self, plist, lastPartEnd):
        x = [
            LIST_TYPE_PAR,
            str(len(plist)), lastPartEnd, self.__fullsize, 0,
            _("free"), (self.PA_TYPE_FREE | self.PA_TYPE_LAST), ";"
        ]
        plist.append(x)

    def __FinishedConsole(self, result, retval, extra_args=None):
        if retval == 0 and '\n' in result:
            tlist = parseCmd(result)
            if len(tlist):
                self.__old_part_list = tlist[0][:]
                self.__new_part_list = tlist[0][:]

            lastPartEnd = 0
            count = 2
            for x in self.__old_part_list:
                if x[LIST_TYPE] == LIST_TYPE_DEV:
                    self.__fullsize = getInt_epart(x[DEV_SIZE])
                    name = x[DEV_NAME]
                    if len(name) == 0:
                        name = x[DEV_PATH]
                    name += " (%s)" % x[DEV_SIZE]
                    self.setTitle(name)
                else:
                    lastPartEnd = x[PA_END]
                    x[PA_TYPE] = self.PA_TYPE_USE
                    if count == len(self.__old_part_list):
                        x[PA_TYPE] |= self.PA_TYPE_LAST
                    count += 1

            if lastPartEnd < self.__fullsize:
                self.__addFreePart(self.__old_part_list, lastPartEnd)
                self.__addFreePart(self.__new_part_list, lastPartEnd)

            self.__Filllist()

    def KeyBlue(self):
        if len(self.__comlist):
            self.session.openWithCallback(self.__getPartInfo, Cpartexe,
                                          self.__comlist)

    def KeyRed(self):
        sel = self["list"].getCurrent()
        if sel and sel[1] and sel[5][PA_TYPE] & self.PA_TYPE_LAST and bool(
                sel[5][PA_TYPE] & self.PA_TYPE_FREE) == False:
            try:
                self.__new_part_list.remove(sel[5])
                for x in self.__new_part_list:
                    if x[LIST_TYPE] == LIST_TYPE_PAR:
                        if x[PA_TYPE] & self.PA_TYPE_FREE:
                            self.__new_part_list.remove(x)
                            break
                        else:
                            x[PA_TYPE] = self.PA_TYPE_USE

                lastPartEnd = 0
                if len(self.__new_part_list) > 1:
                    self.__new_part_list[
                        len(self.__new_part_list) -
                        1][PA_TYPE] = self.PA_TYPE_USE | self.PA_TYPE_LAST
                    lastPartEnd = self.__new_part_list[
                        len(self.__new_part_list) - 1][PA_END]

                if lastPartEnd < self.__fullsize:
                    self.__addFreePart(self.__new_part_list, lastPartEnd)
            except:
                print "[eParted] <remove part>"
            self.__Filllist()

    def KeyGreen(self):
        sel = self["list"].getCurrent()
        if sel and sel[5] and sel[5][PA_TYPE] & self.PA_TYPE_FREE and sel[5][
                PA_START] < sel[5][PA_END] and len(self.__new_part_list) < 6:
            self.session.openWithCallback(self.__CallbackAddPart, AddPart,
                                          sel[5][PA_END] - sel[5][PA_START],
                                          self.__unit,
                                          len(self.__new_part_list) - 1)

    def __CallbackAddPart(self, val=None):
        if val:
            for x in self.__new_part_list:
                if x[LIST_TYPE] == LIST_TYPE_PAR:
                    if x[PA_TYPE] & self.PA_TYPE_FREE:
                        x[PA_SIZE] = val[0]
                        x[PA_FS] = val[1]
                        x[PA_END] = x[PA_START] + x[PA_SIZE]
                        x[PA_TYPE] = self.PA_TYPE_USE | self.PA_TYPE_LAST
                        if x[PA_END] < self.__fullsize:
                            self.__addFreePart(self.__new_part_list, x[PA_END])
                        break
                    else:
                        x[PA_TYPE] = self.PA_TYPE_USE
            self.__Filllist()

    def __addPart2Comlist(self, list, val, mkpart=True):
        partnr = val[PA_NR]
        if mkpart:
            fs = val[PA_FS]
            com = "parted -s -a none %s mkpart primary %s %s%s %s%s" % (
                self.__devpath, fs, val[PA_START], self.__unit, val[PA_END],
                self.__unit)
            list.append((com, _("create partition %s") % partnr, None))

        mountdev = None
        if val[PA_FS] == "linux-swap":
            mkfs = "/sbin/mkswap"
        elif val[PA_FS] == "fat":
            self.mbox = self.session.open(
                MessageBox,
                _("Verify a partition smaller than 4G has been created on the USB device. If it is higher, it appears as FAT32."
                  ), MessageBox.TYPE_INFO)
            mkfs = "/sbin/mkfs.fat"
        elif val[PA_FS] == "fat16":
            self.mbox = self.session.open(
                MessageBox,
                _("Verify a partition smaller than 4G has been created on the USB device. If it is higher, it will fail."
                  ), MessageBox.TYPE_INFO)
            mkfs = "/sbin/mkfs.msdos -F 16"
        elif val[PA_FS] == "fat32":
            mkfs = "/sbin/mkfs.vfat"
        else:
            mkfs = "/sbin/mkfs." + val[PA_FS]
            mountdev = self.__devpath + partnr
            if val[PA_FS] == "xfs":
                mkfs += " -f"

        com = "%s %s%s" % (mkfs, self.__devpath, partnr)
        list.append(
            (com, _("make filesystem '%s' on partition %s (%d %s)") %
             (val[PA_FS], partnr, val[PA_SIZE], self.__unit), mountdev))

    def __delPart2Comlist(self, list, val):
        partnr = val[PA_NR]
        dev = "%s%s" % (self.__devpath, partnr)
        mp = ismounted(dev)
        if mp is not None:
            if myExecute("umount %s" % mp, self.session):
                return
        list.insert(0,
                    ("parted -s -a none %s rm %s" % (self.__devpath, partnr),
                     _("delete partition %s") % partnr, None))

    def __createCommandList(self):
        self.__comlist = []
        for x in range(len(self.__old_part_list)):
            if self.__old_part_list[x][LIST_TYPE] == LIST_TYPE_PAR:
                if bool(self.__old_part_list[x][PA_TYPE]
                        & self.PA_TYPE_FREE) == False:
                    if len(self.__new_part_list) > x:
                        if self.__old_part_list[x][
                                PA_SIZE] != self.__new_part_list[x][PA_SIZE]:
                            self.__delPart2Comlist(self.__comlist,
                                                   self.__old_part_list[x])
                    else:
                        self.__delPart2Comlist(self.__comlist,
                                               self.__old_part_list[x])

        for x in range(len(self.__new_part_list)):
            if self.__new_part_list[x][LIST_TYPE] == LIST_TYPE_PAR:
                if bool(self.__new_part_list[x][PA_TYPE]
                        & self.PA_TYPE_FREE) == False:
                    if len(self.__old_part_list) > x and bool(
                            self.__old_part_list[x][PA_TYPE]
                            & self.PA_TYPE_FREE) == False:
                        if self.__new_part_list[x][
                                PA_SIZE] != self.__old_part_list[x][PA_SIZE]:
                            self.__addPart2Comlist(self.__comlist,
                                                   self.__new_part_list[x])
                        else:
                            if self.__new_part_list[x][
                                    PA_FS] != self.__old_part_list[x][PA_FS]:
                                self.__addPart2Comlist(self.__comlist,
                                                       self.__new_part_list[x],
                                                       False)
                    else:
                        self.__addPart2Comlist(self.__comlist,
                                               self.__new_part_list[x])

        if len(self.__comlist):
            self["PixmapBlue"].setPixmapNum(1)
            self["LabelBlue"].setText(_("execute"))
        else:
            self["PixmapBlue"].setPixmapNum(0)
            self["LabelBlue"].setText("")
Beispiel #4
0
class Cpart(Screen):
	PA_TYPE_USE=1
	PA_TYPE_LAST=2
	PA_TYPE_FREE=4

	skin = """<screen position="center,center" size="670,200" title="eParted">
			<widget source="list" render="Listbox" position="0,0" size="670,160" scrollbarMode="showOnDemand" enableWrapAround="on">
			<convert type="TemplatedMultiContent">
				{"template": [
				MultiContentEntryText(pos = (0,5), size = (50, 30), font=0, flags = RT_HALIGN_LEFT, text=0),
				MultiContentEntryText(pos = (60,5), size = (150, 30), font=0, flags = RT_HALIGN_LEFT, text=1),
				MultiContentEntryText(pos = (210,5), size = (150, 30), font=0, flags = RT_HALIGN_LEFT, text=2),
				MultiContentEntryText(pos = (360,5), size = (150, 30), font=0, flags = RT_HALIGN_LEFT, text=3),
				MultiContentEntryText(pos = (510,5), size = (160, 30), font=0, flags = RT_HALIGN_LEFT, text=4)
				],
				"fonts": [gFont("Regular", 20)],
				"itemHeight": 35
				}
			</convert>
			</widget>
			<widget name="PixmapRed" position="25,170" size="15,16" pixmaps="skin_default/buttons/button_red_off.png,skin_default/buttons/button_red.png" transparent="1" alphatest="on" />
			<widget name="LabelRed" position="50,160" size="150,40" font="Regular;19" valign="center" />
			<widget name="PixmapGreen" position="225,170" size="15,16" pixmaps="skin_default/buttons/button_green_off.png,skin_default/buttons/button_green.png" transparent="1" alphatest="on" />
			<widget name="LabelGreen" position="250,160" size="150,40" font="Regular;19" valign="center" />
			<widget name="PixmapBlue" position="425,170" size="15,16" pixmaps="skin_default/buttons/button_blue_off.png,skin_default/buttons/button_blue.png" transparent="1" alphatest="on" />
			<widget name="LabelBlue" position="450,160" size="150,40" font="Regular;19" valign="center" />
		</screen>"""

	def __init__(self, session, entry):
		Screen.__init__(self, session)

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
		{
			"cancel": self.Exit,
			"green": self.KeyGreen,
			"blue": self.KeyBlue,
			"red": self.KeyRed
		}, -1)

		self["list"] = List(list=[])
		self["list"].onSelectionChanged.append(self.__SetLabels)
		self["PixmapRed"] = MultiPixmap()
		self["PixmapGreen"] = MultiPixmap()
		self["PixmapBlue"] = MultiPixmap()
		self["LabelRed"] = Label()
		self["LabelGreen"] = Label()
		self["LabelBlue"] = Label()

		self.__devpath=entry[DEV_PATH]
		self.__fullsize=0
		self.__old_part_list=[]
		self.__new_part_list=[]
		self.__comlist=[]
		self.__unit=entry[2][len(entry[2])-2:]

		self.Console = Console()
		self.__getPartInfo()

	def Exit(self):
		self.Console.killAll()
		self.close()

	def __getPartInfo(self,val=None):
		self.Console.ePopen("parted -m %s unit %s print" %(self.__devpath,self.__unit), self.__FinishedConsole)

	def __Filllist(self):
		list=[]
		index = self["list"].getIndex()
		for x in self.__new_part_list:
			if x[LIST_TYPE]==LIST_TYPE_PAR:
				p0 = "%s: %s" %(_("Nr"), x[PA_NR])
				p1 = "%s: %d%s" %(_("Start"), x[PA_START], self.__unit)
				p2 = "%s: %d%s" %(_("End"), x[PA_END], self.__unit)
				p3 = "%s: %d%s" %(_("Size"), x[PA_SIZE], self.__unit)
				p4 = "%s: %s" %(_("Type"), x[PA_FS])
				list.append((p0,p1,p2,p3,p4,x))
			self["list"].setList(list)
		self["list"].setIndex(index)
		self.__createCommandList()

	def __SetLabels(self):
		sel=self["list"].getCurrent()
		self["LabelGreen"].setText("")
		self["LabelRed"].setText("")
		if sel and sel[5]:
			if sel[5][PA_TYPE] & self.PA_TYPE_FREE and len(self.__new_part_list)<6:
				self["PixmapGreen"].setPixmapNum(1)
				self["LabelGreen"].setText(_("add"))
			else:
				self["PixmapGreen"].setPixmapNum(0)
			if sel[5][PA_TYPE] & self.PA_TYPE_LAST and bool(sel[5][PA_TYPE] & self.PA_TYPE_FREE)==False:
				self["PixmapRed"].setPixmapNum(1)
				self["LabelRed"].setText(_("delete"))
			else:
				self["PixmapRed"].setPixmapNum(0)

	def __addFreePart(self,plist,lastPartEnd):
		x = [LIST_TYPE_PAR,str(len(plist)), lastPartEnd, self.__fullsize, 0,_("free"),(self.PA_TYPE_FREE | self.PA_TYPE_LAST),";"]
		plist.append(x)

	def __FinishedConsole(self, result, retval, extra_args = None):
		if retval==0 and '\n' in result:
			tlist = parseCmd(result)
			if len(tlist):
				self.__old_part_list = tlist[0][:]
				self.__new_part_list = tlist[0][:]

			lastPartEnd=0
			count=2
			for x in self.__old_part_list:
				if x[LIST_TYPE]==LIST_TYPE_DEV:
					self.__fullsize = getInt_epart(x[DEV_SIZE])
					name = x[DEV_NAME]
					if len(name)==0:
						name = x[DEV_PATH]
					name += " (%s)" %x[DEV_SIZE]
					self.setTitle(name)
				else:
					lastPartEnd=x[PA_END]
					x[PA_TYPE]=self.PA_TYPE_USE
					if count == len(self.__old_part_list):
						x[PA_TYPE] |= self.PA_TYPE_LAST
					count += 1

			if lastPartEnd < self.__fullsize:
				self.__addFreePart(self.__old_part_list, lastPartEnd)
				self.__addFreePart(self.__new_part_list, lastPartEnd)

			self.__Filllist()

	def KeyBlue(self):
		if len(self.__comlist):
			self.session.openWithCallback(self.__getPartInfo,Cpartexe,self.__comlist)

	def KeyRed(self):
		sel=self["list"].getCurrent()
		if sel and sel[1] and sel[5][PA_TYPE] & self.PA_TYPE_LAST and bool(sel[5][PA_TYPE] & self.PA_TYPE_FREE)==False:
			try:
				self.__new_part_list.remove(sel[5])
				for x in self.__new_part_list:
					if x[LIST_TYPE]==LIST_TYPE_PAR:
						if x[PA_TYPE] & self.PA_TYPE_FREE:
							self.__new_part_list.remove(x)
							break
						else:
							x[PA_TYPE]=self.PA_TYPE_USE

				lastPartEnd=0
				if len(self.__new_part_list)>1:
					self.__new_part_list[len(self.__new_part_list)-1][PA_TYPE] = self.PA_TYPE_USE | self.PA_TYPE_LAST
					lastPartEnd=self.__new_part_list[len(self.__new_part_list)-1][PA_END]

				if lastPartEnd < self.__fullsize:
					self.__addFreePart(self.__new_part_list, lastPartEnd)
			except:
				print "[eParted] <remove part>"
			self.__Filllist()

	def KeyGreen(self):
		sel=self["list"].getCurrent()
		if sel and sel[5] and sel[5][PA_TYPE] & self.PA_TYPE_FREE and sel[5][PA_START]<sel[5][PA_END] and len(self.__new_part_list)<6:
			self.session.openWithCallback(self.__CallbackAddPart, AddPart, sel[5][PA_END]-sel[5][PA_START], self.__unit, len(self.__new_part_list)-1)

	def __CallbackAddPart(self, val=None):
		if val:
			for x in self.__new_part_list:
				if x[LIST_TYPE]==LIST_TYPE_PAR:
					if x[PA_TYPE] & self.PA_TYPE_FREE:
						x[PA_SIZE] = val[0]
						x[PA_FS] = val[1]
						x[PA_END] = x[PA_START] + x[PA_SIZE]
						x[PA_TYPE] = self.PA_TYPE_USE | self.PA_TYPE_LAST
						if x[PA_END] < self.__fullsize:
							self.__addFreePart(self.__new_part_list, x[PA_END])
						break
					else:
						x[PA_TYPE]=self.PA_TYPE_USE
			self.__Filllist()

	def __addPart2Comlist(self, list, val, mkpart=True):
		partnr = val[PA_NR]
		if mkpart:
			fs=val[PA_FS]
			com = "parted -s -a none %s mkpart primary %s %s%s %s%s" %(self.__devpath, fs, val[PA_START], self.__unit, val[PA_END], self.__unit)
			list.append((com ,_("create partition %s") %partnr, None))

		mountdev=None
		if val[PA_FS]=="linux-swap":
			mkfs = "/sbin/mkswap"
		elif val[PA_FS]=="fat":
			self.mbox = self.session.open(MessageBox,_("Verify a partition smaller than 4G has been created on the USB device. If it is higher, it appears as FAT32."), MessageBox.TYPE_INFO)
			mkfs = "/sbin/mkfs.fat"
		elif val[PA_FS]=="fat16":
			self.mbox = self.session.open(MessageBox,_("Verify a partition smaller than 4G has been created on the USB device. If it is higher, it will fail."), MessageBox.TYPE_INFO)
			mkfs = "/sbin/mkfs.msdos -F 16"
		elif val[PA_FS]=="fat32":
			mkfs = "/sbin/mkfs.vfat"
		else:
			mkfs = "/sbin/mkfs." + val[PA_FS]
			mountdev=self.__devpath+partnr
			if val[PA_FS]=="xfs":
				mkfs += " -f"

		com = "%s %s%s" %(mkfs,self.__devpath,partnr)
		list.append((com ,_("make filesystem '%s' on partition %s (%d %s)") %(val[PA_FS],partnr,val[PA_SIZE],self.__unit), mountdev))

	def __delPart2Comlist(self, list, val):
		partnr = val[PA_NR]
		dev = "%s%s" %(self.__devpath,partnr)
		mp = ismounted(dev)
		if mp is not None:
			if myExecute("umount %s" %mp, self.session):
				return
		list.insert(0,("parted -s -a none %s rm %s" %(self.__devpath, partnr),_("delete partition %s") %partnr, None))

	def __createCommandList(self):
		self.__comlist=[]
		for x in range(len(self.__old_part_list)):
			if self.__old_part_list[x][LIST_TYPE] == LIST_TYPE_PAR:
				if bool(self.__old_part_list[x][PA_TYPE] & self.PA_TYPE_FREE)==False:
					if len(self.__new_part_list) > x:
						if self.__old_part_list[x][PA_SIZE] != self.__new_part_list[x][PA_SIZE]:
							self.__delPart2Comlist(self.__comlist, self.__old_part_list[x])
					else:
						self.__delPart2Comlist(self.__comlist, self.__old_part_list[x])

		for x in range(len(self.__new_part_list)):
			if self.__new_part_list[x][LIST_TYPE] == LIST_TYPE_PAR:
				if bool(self.__new_part_list[x][PA_TYPE] & self.PA_TYPE_FREE)==False:
					if len(self.__old_part_list) > x and bool(self.__old_part_list[x][PA_TYPE] & self.PA_TYPE_FREE)==False:
						if self.__new_part_list[x][PA_SIZE] != self.__old_part_list[x][PA_SIZE]:
							self.__addPart2Comlist(self.__comlist,self.__new_part_list[x])
						else:
							if self.__new_part_list[x][PA_FS] != self.__old_part_list[x][PA_FS]:
								self.__addPart2Comlist(self.__comlist,self.__new_part_list[x],False)
					else:
						self.__addPart2Comlist(self.__comlist,self.__new_part_list[x])

		if len(self.__comlist):
			self["PixmapBlue"].setPixmapNum(1)
			self["LabelBlue"].setText(_("execute"))
		else:
			self["PixmapBlue"].setPixmapNum(0)
			self["LabelBlue"].setText("")