コード例 #1
0
ファイル: downloader.py プロジェクト: kolombek/enigma2
	def __init__(self, url, filename, device=None, mountpoint="/"):
		Job.__init__(self, _("Download .NFI-files for USB-flasher"))
		if device:
			if isMount(mountpoint):
				UmountTask(self, mountpoint)
			MountTask(self, device, mountpoint)
		ImageDownloadTask(self, url, mountpoint+filename)
		ImageDownloadTask(self, url[:-4]+".nfo", mountpoint+filename[:-4]+".nfo")
コード例 #2
0
ファイル: Process.py プロジェクト: Atemio4U/enigma2
	def __init__(self, project):
		Job.__init__(self, "Data DVD Burn")
		self.project = project
		from time import strftime
		from Tools.Directories import SCOPE_HDD, resolveFilename, createDir
		new_workspace = resolveFilename(SCOPE_HDD) + "tmp/" + strftime("%Y%m%d%H%M%S") + "/dvd/"
		createDir(new_workspace, True)
		self.workspace = new_workspace
		self.project.workspace = self.workspace
		self.conduct()
コード例 #3
0
ファイル: Bludisc.py プロジェクト: OpenLD/enigma2
	def __init__(self, project):
		Job.__init__(self, "Bludisc Burn")
		self.project = project
		new_workspace = resolveFilename(SCOPE_HDD) + "tmp/" + strftime("bludisc_%Y%m%d%H%M/")
		createDir(new_workspace, True)
		self.workspace = new_workspace
		self.project.workspace = self.workspace
		self.titles = []
		for title in self.project.titles:
			self.titles.append(BludiscTitle(title))	# wrap original DVD-Title into new BludiscTitle objects
		self.conduct()
コード例 #4
0
ファイル: Process.py プロジェクト: Atemio4U/enigma2
	def __init__(self, project, menupreview=False):
		Job.__init__(self, "DVDBurn Job")
		self.project = project
		from time import strftime
		from Tools.Directories import SCOPE_HDD, resolveFilename, createDir
		new_workspace = resolveFilename(SCOPE_HDD) + "tmp/" + strftime("%Y%m%d%H%M%S")
		createDir(new_workspace, True)
		self.workspace = new_workspace
		self.project.workspace = self.workspace
		self.menupreview = menupreview
		self.conduct()
コード例 #5
0
ファイル: Process.py プロジェクト: kakunbsc/enigma2.4
	def __init__(self, project, imagepath):
		Job.__init__(self, _("Burn DVD"))
		self.project = project
		self.menupreview = False
		if imagepath.endswith(".iso"):
			PreviewTask(self, imagepath)
			burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD() + '='+imagepath, "-dvd-compat" ]
		else:
			PreviewTask(self, imagepath + "/VIDEO_TS/")
			volName = self.project.settings.name.getValue()
			burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat" ]
			burnargs += [ "-dvd-video", "-publisher", "Dreambox", "-V", volName, imagepath ]
		tool = "/bin/growisofs"
		BurnTask(self, burnargs, tool)
コード例 #6
0
ファイル: downloader.py プロジェクト: kolombek/enigma2
	def __init__(self, path):
		Job.__init__(self, _("USB stick wizard"))
		self.path = path
		self.device = path
		while self.device[-1:] == "/" or self.device[-1:].isdigit():
			self.device = self.device[:-1]

		box = HardwareInfo().get_device_name()
		url = "http://www.dreamboxupdate.com/download/opendreambox/dreambox-nfiflasher-%s.tar.bz2" % box
		self.downloadfilename = "/tmp/dreambox-nfiflasher-%s.tar.bz2" % box
		self.imagefilename = "/tmp/nfiflash_%s.img" % box
		#UmountTask(self, device)
		PartitionTask(self)
		ImageDownloadTask(self, url, self.downloadfilename)
		UnpackTask(self)
		CopyTask(self)
コード例 #7
0
ファイル: Process.py プロジェクト: Atemio4U/enigma2
	def __init__(self, project, imagepath):
		Job.__init__(self, _("Burn DVD"))
		self.project = project
		self.menupreview = False
		from Tools.Directories import getSize
		if imagepath.endswith(".iso"):
			PreviewTask(self, imagepath)
			burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD() + '='+imagepath, "-dvd-compat" ]
			if getSize(imagepath)/(1024*1024) > self.project.MAX_SL:
				burnargs += [ "-use-the-force-luke=4gms", "-speed=1", "-R" ]
		else:
			PreviewTask(self, imagepath + "/VIDEO_TS/")
			volName = self.project.settings.name.value
			burnargs = [ "-Z", "/dev/" + harddiskmanager.getCD(), "-dvd-compat" ]
			if getSize(imagepath)/(1024*1024) > self.project.MAX_SL:
				burnargs += [ "-use-the-force-luke=4gms", "-speed=1", "-R" ]
			burnargs += [ "-dvd-video", "-publisher", "Dreambox", "-V", volName, imagepath ]
		tool = "growisofs"
		BurnTask(self, burnargs, tool)
コード例 #8
0
ファイル: flasher.py プロジェクト: TitanNit/tdt
	def createJob(self):
		self.job = Job("Image flashing job")
		param = [self.nfifile]
		writeNAND(self.job,param,self.box)
		#writeNAND2(self.job,param)
		#writeNAND3(self.job,param)
		self.job.state_changed.append(self.update_job)
		self.job.end = 540
		self.cwd = self["filelist"].getCurrentDirectory()
		self["job_progressbar"].range = self.job.end
		self.startJob()
コード例 #9
0
ファイル: Downloads.py プロジェクト: kingvuplus/stbgui-new
	def __init__(self, toolbox, cmdline, filename, filetitle):
		Job.__init__(self, _("Downloading"))
		self.toolbox = toolbox
		self.retrycount = 0
		
                downloadTask(self, cmdline, filename, filetitle)
コード例 #10
0
ファイル: TimeShift.py プロジェクト: undertaker01/enigma2
 def __init__(self, toolbox, cmdline, srcfile, destfile, eventname):
     Job.__init__(self, _("Merging Timeshift files"))
     self.toolbox = toolbox
     AddMergeTimeshiftTask(self, cmdline, srcfile, destfile, eventname)
コード例 #11
0
 def __init__(self, srcfile, destfile, name):
     Job.__init__(self, _("Moving files"))
     cmdline = "mv -f \"%s\" \"%s\"" % (srcfile, destfile)
     AddFileProcessTask(self, cmdline, srcfile, destfile, name)
コード例 #12
0
ファイル: FileTransfer.py プロジェクト: fairbird/OpenPLI-VTI
	def __init__(self, src_file, dst_file, src_isDir, do_copy, title):
		Job.__init__(self, title)
		FileTransferTask(self, src_file, dst_file, src_isDir, do_copy)
コード例 #13
0
 def retry(self):
     self.tasks[0].args += self.tasks[0].retryargs
     Job.retry(self)
コード例 #14
0
def deleteFiles(fileList, name):
	job = Job(_("Deleting files"))
	task = DeleteFolderTask(job, name)
	task.openFiles(fileList)
	JobManager.AddJob(job)
コード例 #15
0
 def __init__(self, url, file, title):
     Job.__init__(self, title)
     downloadTask(self, url, file)
コード例 #16
0
 def __init__(self, toolbox, cmdline, srcfile, destfile, eventname):
     Job.__init__(self, _("Merging Timeshift files"))
     self.toolbox = toolbox
     AddMergeTimeshiftTask(self, cmdline, srcfile, destfile, eventname)
コード例 #17
0
ファイル: ImageUpgrade.py プロジェクト: ostende/test2
 def __init__(self, url, file, title):
     Job.__init__(self, title)
     self.download_file = file
     self.download_job = downloadTask(self, url, self.download_file)
コード例 #18
0
 def __init__(self, cmdline, filename, filetitle):
     Job.__init__(self, 'Download: %s' % filetitle)
     self.filename = filename
     self.retrycount = 0
     print '63', filename
     downloadTaskrtmp(self, cmdline, filename)
コード例 #19
0
ファイル: CopyFiles.py プロジェクト: IanSav/enigma2-Beyonwiz
	def __init__(self, srcfile, destfile, name):
		Job.__init__(self, _("Moving files"))
		cmdline = ('mv', '-f', srcfile, destfile)
		AddFileProcessTask(self, cmdline, srcfile, destfile, name)
コード例 #20
0
ファイル: CopyFiles.py プロジェクト: IanSav/enigma2-Beyonwiz
	def __init__(self, srcfile, destfile, name):
		Job.__init__(self, _("Copying files"))
		cmdline = ('cp', '-Rf', srcfile, destfile)
		AddFileProcessTask(self, cmdline, srcfile, destfile, name)
コード例 #21
0
    def __init__(self, toolbox, cmdline, filename, filetitle):
        Job.__init__(self, _("Downloading"))
        self.toolbox = toolbox
        self.retrycount = 0

        downloadTask(self, cmdline, filename, filetitle)
コード例 #22
0
ファイル: DVDToolbox.py プロジェクト: OUARGLA86/enigma2
 def __init__(self, toolbox):
     Job.__init__(self, _("DVD media toolbox"))
     self.toolbox = toolbox
     DVDformatTask(self)
コード例 #23
0
 def __init__(self, url, file, title, agent=None):
     Job.__init__(self, title)
     DownloadTask(self, url, file, agent)
コード例 #24
0
ファイル: Downloads.py プロジェクト: OpenDMM/enigma2
	def __init__(self, url, file, title, agent=None):
		Job.__init__(self, title)
		DownloadTask(self, url, file, agent)
コード例 #25
0
	def __init__(self, url, filename, file, **kwargs):
		Job.__init__(self, _("%s") % file)
		DownloadTask(self, url, filename, **kwargs)
コード例 #26
0
 def __init__(self, toolbox):
     Job.__init__(self, _("DVD media toolbox"))
     self.toolbox = toolbox
     DVDformatTask(self)
コード例 #27
0
ファイル: FileTransfer.py プロジェクト: momi133/enigma2-8
 def __init__(self, src_file, dst_file, src_isDir, do_copy, title):
     Job.__init__(self, title)
     FileTransferTask(self, src_file, dst_file, src_isDir, do_copy)
コード例 #28
0
 def __init__(self, url, filename, file):
     Job.__init__(self, _('Downloading %s' % file))
     ImageDownloadTask(self, url, filename)
コード例 #29
0
ファイル: ImageUpgrade.py プロジェクト: kingvuplus/red
 def __init__(self, url, file, title):
     Job.__init__(self, title)
     self.download_file = file
     self.download_job = downloadTask(self, url, self.download_file)
コード例 #30
0
	def __init__(self, srcfile, destfile, name):
		Job.__init__(self, _("Copying files"))
		cmdline = 'cp -Rf "%s" "%s"' % (srcfile,destfile)
		AddFileProcessTask(self, cmdline, srcfile, destfile, name)
コード例 #31
0
 def cut(self, name, inpath, outpath, inlen, outlen, clist):
     job = Job(_("Execute cuts"))
     CutTask(job, self.session, name, inpath, outpath, inlen, outlen,
             mcut_path, clist)
     JobManager.AddJob(job, onFail=self.noFail)
     self.close()
コード例 #32
0
ファイル: CopyFiles.py プロジェクト: Meknes21/dvbapp2-gui
	def __init__(self, srcfile, destfile, name):
		Job.__init__(self, _("Moving files"))
		cmdline = "mv -f \"%s\" \"%s\"" % (srcfile,destfile)
		AddFileProcessTask(self, cmdline, srcfile, destfile, name)
コード例 #33
0
ファイル: CopyFiles.py プロジェクト: kingvuplus/boom2
 def __init__(self, srcfile, destfile, name):
     Job.__init__(self, _('Moving files'))
     cmdline = 'mv -f "%s" "%s"' % (srcfile, destfile)
     AddFileProcessTask(self, cmdline, srcfile, destfile, name)
コード例 #34
0
	def __init__(self, url, outputfile, title, downloadStop):
		Job.__init__(self, title)
		downloadTask(self, url, outputfile, downloadStop)
コード例 #35
0
ファイル: TimeShift.py プロジェクト: kingvuplus/boom
 def __init__(self, toolbox, cmdline, eventname):
     Job.__init__(self, _('Creating AP and SC Files'))
     self.toolbox = toolbox
     CreateAPSCFilesTask(self, cmdline, eventname)
コード例 #36
0
ファイル: flasher.py プロジェクト: benny-ua/martiis-tdt
class NFIFlash(Screen):
    skin = """
		<screen name="NFIFlash" position="90,95" size="560,420" title="Image flash utility">
			<ePixmap pixmap="skin_default/buttons/green.png" position="140,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
			<ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
			<ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
			<widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
			<widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#a08500" transparent="1" />
			<widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#18188b" transparent="1" />
			<widget source="listlabel" render="Label" position="16,44" size="200,21" valign="center" font="Regular;18" />
			<widget name="filelist" position="0,68" size="260,260" scrollbarMode="showOnDemand" />
			<widget source="infolabel" render="Label" position="270,44" size="280,284" font="Regular;16" />
			<widget source="job_progressbar" render="Progress" position="10,374" size="540,26" borderWidth="1" backgroundColor="#254f7497" />
			<widget source="job_progresslabel" render="Label" position="180,378" zPosition="2" font="Regular;18" halign="center" transparent="1" size="200,22" foregroundColor="#000000" />
			<widget source="statusbar" render="Label" position="10,404" size="540,16" font="Regular;16" foregroundColor="#cccccc" />
		</screen>"""

    def __init__(self, session, cancelable=True, close_on_finish=False):
        self.skin = NFIFlash.skin
        Screen.__init__(self, session)

        self["job_progressbar"] = Progress()
        self["job_progresslabel"] = StaticText("")

        self["finished"] = Boolean()

        self["infolabel"] = StaticText("")
        self["statusbar"] = StaticText(
            _("Please select .NFI flash image file from medium"))
        self["listlabel"] = StaticText(_("select .NFI flash file") + ":")

        self["key_green"] = StaticText()
        self["key_yellow"] = StaticText()
        self["key_blue"] = StaticText()

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions", "DirectionActions"], {
                "green": self.ok,
                "yellow": self.reboot,
                "ok": self.ok,
                "left": self.left,
                "right": self.right,
                "up": self.up,
                "down": self.down
            }, -1)

        currDir = "/media/usb/"
        self.filelist = FileList(currDir, matchingPattern="^.*\.(nfi|NFI)")
        self["filelist"] = self.filelist
        self.nfifile = ""
        self.md5sum = ""
        self.job = None
        self.box = HardwareInfo().get_device_name()

    def closeCB(self):
        if (self.job is None or self.job.status
                is not self.job.IN_PROGRESS) and not self.no_autostart:
            self.close()
        #else:
        #if self.cancelable:
        #self.cancel()

    def up(self):
        self["filelist"].up()
        self.check_for_NFO()

    def down(self):
        self["filelist"].down()
        self.check_for_NFO()

    def right(self):
        self["filelist"].pageDown()
        self.check_for_NFO()

    def left(self):
        self["filelist"].pageUp()
        self.check_for_NFO()

    def check_for_NFO(self):
        self.session.summary.setText(self["filelist"].getFilename())
        if self["filelist"].getFilename() is None:
            return
        if self["filelist"].getCurrentDirectory() is not None:
            self.nfifile = self["filelist"].getCurrentDirectory(
            ) + self["filelist"].getFilename()

        if self.nfifile.upper().endswith(".NFI"):
            self["key_green"].text = _("Flash")
            nfofilename = self.nfifile[0:-3] + "nfo"
            if fileExists(nfofilename):
                nfocontent = open(nfofilename, "r").read()
                self["infolabel"].text = nfocontent
                pos = nfocontent.find("MD5:")
                if pos > 0:
                    self.md5sum = nfocontent[pos + 5:pos + 5 +
                                             32] + "  " + self.nfifile
                else:
                    self.md5sum = ""
            else:
                self["infolabel"].text = _(
                    "No details for this image file"
                ) + ":\n" + self["filelist"].getFilename()
                self.md5sum = ""
        else:
            self["infolabel"].text = ""
            self["key_green"].text = ""

    def ok(self):
        if self.job is None or self.job.status is not self.job.IN_PROGRESS:
            if self["filelist"].canDescent():  # isDir
                self["filelist"].descent()
                self.session.summary.setText(self["filelist"].getFilename())
                self.check_for_NFO()
            else:
                self.queryFlash()

    def queryFlash(self):
        fd = open(self.nfifile, 'r')
        print fd
        sign = fd.read(11)
        print sign
        if sign.find("NFI1" + self.box + "\0") == 0:
            if self.md5sum != "":
                self["statusbar"].text = (
                    "Please wait for md5 signature verification...")
                self.session.summary.setText(
                    ("Please wait for md5 signature verification..."))
                self.container = eConsoleAppContainer()
                self.container.setCWD(self["filelist"].getCurrentDirectory())
                self.container.appClosed.append(self.md5finished)
                self.container.dataSent.append(self.md5ready)
                self.container.execute("md5sum -cw -")
                self.container.write(self.md5sum)
            else:
                self.session.openWithCallback(
                    self.queryCB, MessageBox,
                    _("This .NFI file does not have a md5sum signature and is not guaranteed to work. Do you really want to burn this image to flash memory?"
                      ), MessageBox.TYPE_YESNO)
        else:
            self.session.open(
                MessageBox,
                (_("This .NFI file does not contain a valid %s image!") %
                 (self.box.upper())), MessageBox.TYPE_ERROR)

    def md5ready(self, retval):
        self.container.sendEOF()

    def md5finished(self, retval):
        if retval == 0:
            self.session.openWithCallback(
                self.queryCB, MessageBox,
                _("This .NFI file has a valid md5 signature. Continue programming this image to flash memory?"
                  ), MessageBox.TYPE_YESNO)
        else:
            self.session.openWithCallback(
                self.queryCB, MessageBox,
                _("The md5sum validation failed, the file may be corrupted! Are you sure that you want to burn this image to flash memory? You are doing this at your own risk!"
                  ), MessageBox.TYPE_YESNO)

    def queryCB(self, answer):
        if answer == True:
            self.createJob()
        else:
            self["statusbar"].text = _(
                "Please select .NFI flash image file from medium")

    def createJob(self):
        self.job = Job("Image flashing job")
        param = [self.nfifile]
        writeNAND(self.job, param, self.box)
        #writeNAND2(self.job,param)
        #writeNAND3(self.job,param)
        self.job.state_changed.append(self.update_job)
        self.job.end = 540
        self.cwd = self["filelist"].getCurrentDirectory()
        self["job_progressbar"].range = self.job.end
        self.startJob()

    def startJob(self):
        self["key_blue"].text = ""
        self["key_yellow"].text = ""
        self["key_green"].text = ""
        #self["progress0"].show()
        #self["progress1"].show()

        self.job.start(self.jobcb)

    def update_job(self):
        j = self.job
        #print "[job state_changed]"
        if j.status == j.IN_PROGRESS:
            self.session.summary["job_progressbar"].value = j.progress
            self.session.summary["job_progressbar"].range = j.end
            self.session.summary["job_progresslabel"].text = "%.2f%%" % (
                100 * j.progress / float(j.end))
            self["job_progressbar"].range = j.end
            self["job_progressbar"].value = j.progress
            #print "[update_job] j.progress=%f, j.getProgress()=%f, j.end=%d, text=%f" % (j.progress, j.getProgress(), j.end,  (100*j.progress/float(j.end)))
            self["job_progresslabel"].text = "%.2f%%" % (100 * j.progress /
                                                         float(j.end))
            self.session.summary.setText(j.tasks[j.current_task].name)
            self["statusbar"].text = (j.tasks[j.current_task].name)

        elif j.status == j.FINISHED:
            self["statusbar"].text = _(
                "Writing NFI image file to flash completed")
            self.session.summary.setText(
                _("NFI image flashing completed. Press Yellow to Reboot!"))
            self["key_yellow"].text = _("Reboot")

        elif j.status == j.FAILED:
            self["statusbar"].text = j.tasks[j.current_task].name + " " + _(
                "failed")
            self.session.open(
                MessageBox,
                (_("Flashing failed") + ":\n" + j.tasks[j.current_task].name +
                 ":\n" + j.tasks[j.current_task].output_line),
                MessageBox.TYPE_ERROR)

    def jobcb(self, jobref, fasel, blubber):
        print "[jobcb] %s %s %s" % (jobref, fasel, blubber)
        self["key_green"].text = _("Flash")

    def reboot(self):
        if self.job.status == self.job.FINISHED:
            self["statusbar"].text = ("rebooting...")
            TryQuitMainloop(self.session, 2)

    def createSummary(self):
        return NFISummary
コード例 #37
0
ファイル: flasher.py プロジェクト: TitanNit/tdt
class NFIFlash(Screen):
	skin = """
		<screen name="NFIFlash" position="90,95" size="560,420" title="Image flash utility">
			<ePixmap pixmap="skin_default/buttons/green.png" position="140,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
			<ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
			<ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
			<widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
			<widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#a08500" transparent="1" />
			<widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#18188b" transparent="1" />
			<widget source="listlabel" render="Label" position="16,44" size="200,21" valign="center" font="Regular;18" />
			<widget name="filelist" position="0,68" size="260,260" scrollbarMode="showOnDemand" />
			<widget source="infolabel" render="Label" position="270,44" size="280,284" font="Regular;16" />
			<widget source="job_progressbar" render="Progress" position="10,374" size="540,26" borderWidth="1" backgroundColor="#254f7497" />
			<widget source="job_progresslabel" render="Label" position="180,378" zPosition="2" font="Regular;18" halign="center" transparent="1" size="200,22" foregroundColor="#000000" />
			<widget source="statusbar" render="Label" position="10,404" size="540,16" font="Regular;16" foregroundColor="#cccccc" />
		</screen>"""

	def __init__(self, session, cancelable = True, close_on_finish = False):
		self.skin = NFIFlash.skin
		Screen.__init__(self, session)
		
		self["job_progressbar"] = Progress()
		self["job_progresslabel"] = StaticText("")
		
		self["finished"] = Boolean()

		self["infolabel"] = StaticText("")
		self["statusbar"] = StaticText(_("Please select .NFI flash image file from medium"))
		self["listlabel"] = StaticText(_("select .NFI flash file")+":")
		
		self["key_green"] = StaticText()
		self["key_yellow"] = StaticText()
		self["key_blue"] = StaticText()

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions"],
		{
			"green": self.ok,
			"yellow": self.reboot,
			"ok": self.ok,
			"left": self.left,
			"right": self.right,
			"up": self.up,
			"down": self.down
		}, -1)

		currDir = "/media/usb/"
		self.filelist = FileList(currDir, matchingPattern = "^.*\.(nfi|NFI)")
		self["filelist"] = self.filelist
		self.nfifile = ""
		self.md5sum = ""
		self.job = None
		self.box = HardwareInfo().get_device_name()

	def closeCB(self):
		if ( self.job is None or self.job.status is not self.job.IN_PROGRESS ) and not self.no_autostart:
			self.close()
		#else:
			#if self.cancelable:
				#self.cancel()

	def up(self):
		self["filelist"].up()
		self.check_for_NFO()

	def down(self):
		self["filelist"].down()
		self.check_for_NFO()
	
	def right(self):
		self["filelist"].pageDown()
		self.check_for_NFO()

	def left(self):
		self["filelist"].pageUp()
		self.check_for_NFO()

	def check_for_NFO(self):
		self.session.summary.setText(self["filelist"].getFilename())
		if self["filelist"].getFilename() is None:
			return
		if self["filelist"].getCurrentDirectory() is not None:
			self.nfifile = self["filelist"].getCurrentDirectory()+self["filelist"].getFilename()

		if self.nfifile.upper().endswith(".NFI"):
			self["key_green"].text = _("Flash")
			nfofilename = self.nfifile[0:-3]+"nfo"
			if fileExists(nfofilename):
				nfocontent = open(nfofilename, "r").read()
				self["infolabel"].text = nfocontent
				pos = nfocontent.find("MD5:")
				if pos > 0:
					self.md5sum = nfocontent[pos+5:pos+5+32] + "  " + self.nfifile
				else:
					self.md5sum = ""
			else:
				self["infolabel"].text = _("No details for this image file") + ":\n" + self["filelist"].getFilename()
				self.md5sum = ""
		else:
			self["infolabel"].text = ""
			self["key_green"].text = ""

	def ok(self):
		if self.job is None or self.job.status is not self.job.IN_PROGRESS:
			if self["filelist"].canDescent(): # isDir
				self["filelist"].descent()
				self.session.summary.setText(self["filelist"].getFilename())
				self.check_for_NFO()
			else:
				self.queryFlash()
	
	def queryFlash(self):
		fd = open(self.nfifile, 'r')
		print fd
		sign = fd.read(11)
		print sign
		if sign.find("NFI1" + self.box + "\0") == 0:
			if self.md5sum != "":
				self["statusbar"].text = ("Please wait for md5 signature verification...")
				self.session.summary.setText(("Please wait for md5 signature verification..."))
				self.container = eConsoleAppContainer()
				self.container.setCWD(self["filelist"].getCurrentDirectory())
				self.container.appClosed.append(self.md5finished)
				self.container.dataSent.append(self.md5ready)
				self.container.execute("md5sum -cw -")
				self.container.write(self.md5sum)
			else:
				self.session.openWithCallback(self.queryCB, MessageBox, _("This .NFI file does not have a md5sum signature and is not guaranteed to work. Do you really want to burn this image to flash memory?"), MessageBox.TYPE_YESNO)
		else:
			self.session.open(MessageBox, (_("This .NFI file does not contain a valid %s image!") % (self.box.upper())), MessageBox.TYPE_ERROR)

	def md5ready(self, retval):
		self.container.sendEOF()

	def md5finished(self, retval):
		if retval==0:
			self.session.openWithCallback(self.queryCB, MessageBox, _("This .NFI file has a valid md5 signature. Continue programming this image to flash memory?"), MessageBox.TYPE_YESNO)
		else:
			self.session.openWithCallback(self.queryCB, MessageBox, _("The md5sum validation failed, the file may be corrupted! Are you sure that you want to burn this image to flash memory? You are doing this at your own risk!"), MessageBox.TYPE_YESNO)

	def queryCB(self, answer):
		if answer == True:
			self.createJob()
		else:
			self["statusbar"].text = _("Please select .NFI flash image file from medium")

	def createJob(self):
		self.job = Job("Image flashing job")
		param = [self.nfifile]
		writeNAND(self.job,param,self.box)
		#writeNAND2(self.job,param)
		#writeNAND3(self.job,param)
		self.job.state_changed.append(self.update_job)
		self.job.end = 540
		self.cwd = self["filelist"].getCurrentDirectory()
		self["job_progressbar"].range = self.job.end
		self.startJob()

	def startJob(self):
		self["key_blue"].text = ""
		self["key_yellow"].text = ""
		self["key_green"].text = ""
		#self["progress0"].show()
		#self["progress1"].show()

		self.job.start(self.jobcb)

	def update_job(self):
		j = self.job
		#print "[job state_changed]"
		if j.status == j.IN_PROGRESS:
			self.session.summary["job_progressbar"].value = j.progress
			self.session.summary["job_progressbar"].range = j.end
			self.session.summary["job_progresslabel"].text = "%.2f%%" % (100*j.progress/float(j.end))
			self["job_progressbar"].range = j.end
			self["job_progressbar"].value = j.progress
			#print "[update_job] j.progress=%f, j.getProgress()=%f, j.end=%d, text=%f" % (j.progress, j.getProgress(), j.end,  (100*j.progress/float(j.end)))
			self["job_progresslabel"].text = "%.2f%%" % (100*j.progress/float(j.end))
			self.session.summary.setText(j.tasks[j.current_task].name)
			self["statusbar"].text = (j.tasks[j.current_task].name)

		elif j.status == j.FINISHED:
			self["statusbar"].text = _("Writing NFI image file to flash completed")
			self.session.summary.setText(_("NFI image flashing completed. Press Yellow to Reboot!"))
			self["key_yellow"].text = _("Reboot")

		elif j.status == j.FAILED:
			self["statusbar"].text = j.tasks[j.current_task].name + " " + _("failed")
			self.session.open(MessageBox, (_("Flashing failed") + ":\n" + j.tasks[j.current_task].name + ":\n" + j.tasks[j.current_task].output_line), MessageBox.TYPE_ERROR)

	def jobcb(self, jobref, fasel, blubber):
		print "[jobcb] %s %s %s" % (jobref, fasel, blubber)
		self["key_green"].text = _("Flash")

	def reboot(self):
		if self.job.status == self.job.FINISHED:
			self["statusbar"].text = ("rebooting...")
			TryQuitMainloop(self.session,2)
			
	def createSummary(self):
		return NFISummary
コード例 #38
0
ファイル: Flash_online.py プロジェクト: OpenSH4/enigma2
	def __init__(self, url, filename, file):
		Job.__init__(self, _("Downloading %s" %file))
		ImageDownloadTask(self, url, filename)
コード例 #39
0
    def do_run_script(self, answer):
        answer = answer and answer[1]
        if answer in ("YES", "PAR", "YES_BG", "PAR_BG"):
            if not os.access(self.commando, os.R_OK):
                self.session.open(
                    MessageBox,
                    _("Script '%s' must have read permission to be able to run it"
                      ) % self.commando,
                    type=MessageBox.TYPE_ERROR,
                    close_on_any_key=True,
                    simple=True)
                return
            nice = config.plugins.filecommander.script_priority_nice.getValue(
            ) or ''
            ionice = config.plugins.filecommander.script_priority_ionice.getValue(
            ) or ''
            if nice:
                nice = 'nice -n %d ' % nice
            if ionice:
                ionice = 'ionice -c %d ' % ionice
            priority = '%s%s' % (nice, ionice)
            if self.commando.endswith('.sh'):
                if os.access(self.commando, os.X_OK):
                    if 'PAR' in answer:
                        cmdline = "%s%s '%s'" % (priority, self.commando,
                                                 self.parameter)
                    else:
                        cmdline = "%s%s" % (priority, self.commando)
                else:
                    if 'PAR' in answer:
                        cmdline = "%s/bin/sh %s '%s'" % (
                            priority, self.commando, self.parameter)
                    else:
                        cmdline = "%s/bin/sh %s" % (priority, self.commando)
            else:
                if 'PAR' in answer:
                    cmdline = "%s/usr/bin/python %s '%s'" % (
                        priority, self.commando, self.parameter)
                else:
                    cmdline = "%s/usr/bin/python %s" % (priority,
                                                        self.commando)
        elif answer == "VIEW":
            try:
                yfile = os.stat(self.commando)
            except OSError as oe:
                self.session.open(MessageBox,
                                  _("%s: %s") % (self.commando, oe.strerror),
                                  type=MessageBox.TYPE_ERROR,
                                  simple=True)
                return
            if (yfile.st_size < 1000000):
                self.session.open(vEditor, self.commando)

        if answer and answer not in ("NO", "VIEW"):
            if answer.endswith('_BG'):
                global task_Stout, task_Sterr
                task_Stout = []
                task_Sterr = []
                if 'PAR' in answer:
                    name = '%s%s %s' % (priority, self.commando,
                                        self.parameter)
                else:
                    name = '%s%s' % (priority, self.commando)
                job = Job(_("Run script") + " ('%s')" % name)
                task = Task(job, name)
                task.postconditions.append(task_postconditions())
                task.processStdout = task_processStdout
                task.processStderr = task_processSterr
                task.setCmdline(cmdline)
                job_manager.AddJob(job,
                                   onSuccess=self.finishedCB,
                                   onFail=self.failCB)
                self.jobs += 1
                self.onLayout()
            else:
                self.session.open(Console, cmdlist=(cmdline, ))
コード例 #40
0
ファイル: DVDToolbox.py プロジェクト: OUARGLA86/enigma2
 def retry(self):
     self.tasks[0].args += self.tasks[0].retryargs
     Job.retry(self)
コード例 #41
0
ファイル: CopyFiles.py プロジェクト: HasBahCa/enigma2
	def __init__(self, srcfile, destfile, name):
		Job.__init__(self, _("Copying files"))
		cmdline = 'cp -Rf "%s" "%s"' % (srcfile,destfile)
		AddFileProcessTask(self, cmdline, srcfile, destfile, name)
コード例 #42
0
 def __init__(self, toolbox, cmdline, srcfile, destfile, eventname):
     Job.__init__(self, _('Saving Timeshift files'))
     self.toolbox = toolbox
     AddCopyTimeshiftTask(self, cmdline, srcfile, destfile, eventname)
コード例 #43
0
 def __init__(self, url, filename, file):
     Job.__init__(self, _("%s") % file)
     DownloadTask(self, url, filename)
コード例 #44
0
ファイル: TimeShift.py プロジェクト: kingvuplus/boom
 def __init__(self, toolbox, cmdline, srcfile, destfile, eventname):
     Job.__init__(self, _('Saving Timeshift files'))
     self.toolbox = toolbox
     AddCopyTimeshiftTask(self, cmdline, srcfile, destfile, eventname)
コード例 #45
0
 def __init__(self, toolbox, cmdline, eventname):
     Job.__init__(self, _('Creating AP and SC Files'))
     self.toolbox = toolbox
     CreateAPSCFilesTask(self, cmdline, eventname)
コード例 #46
0
ファイル: CopyFiles.py プロジェクト: kingvuplus/boom
 def __init__(self, srcfile, destfile, name):
     Job.__init__(self, _('Moving files'))
     cmdline = 'mv -f "%s" "%s"' % (srcfile, destfile)
     AddFileProcessTask(self, cmdline, srcfile, destfile, name)
コード例 #47
0
	def __init__(self, url, outputfile, title, downloadStop):
		Job.__init__(self, title)
		downloadTask(self, url, outputfile, downloadStop)