def download(self, val=True, extStr=""): if val: # first download file must be rootfs if not extStr: self.removeDownloadDir() self.checkDepSW() self["menulist"].hide() if not extStr: self["text"].setText(_("Downloading \"%s\"\nIf you want to exit, press \"EXIT\" key in rcu") % self["menulist"].getCurrent()) self.swPath = self.imageInfo[self.type]["imagedir"] + "/" + self["menulist"].getCurrent() else: self["text"].setText(_("Downloading \"%s\"\nIf you want to exit, press \"EXIT\" key in rcu") % extStr) self.swPath = self.imageInfo[self.type]["imagedir"] + "/." + self["menulist"].getCurrent() + "." + extStr self["text"].show() dlfile = self.getDownloadDir() if extStr == "cfe": dlfile += "/cfe/cfe.bin" elif extStr == "kernel": dlfile += "/cfe/oe_kernel.bin" else: dlfile += "/oe_rootfs.bin" self.downloadedSW[self.swPath] = (dlfile, self.getSWSize(self.swPath)) MiniFTP_Thread.getInstance().DownloadFile(0, self.iface, self.SERVER_DNS, self.swPath, "anonymous", " ", dlfile) self.downloadingSW = True self.drawProgressBarTimer.start(1000, True)
def progressAction(configElement): num = int(configElement.value) if num == -1: self.drawProgressBarTimer.stop() MiniFTP_Thread.getInstance().Stop_Thread() self.downloadingSW = False self.downloadedSW = {} elif num < 100: self.drawProgressBarTimer.start(1000, True) elif num == 100: self.drawProgressBarTimer.stop() MiniFTP_Thread.getInstance().Stop_Thread() self.downloadingSW = False if self.downloadedSWSizeOk(): # self.downloadBurn() self.session.openWithCallback( self.downloadBurn, MessageBox, _("Downloading Finished!!\nDo you really want to update \nthe file \"%s\"?" ) % self["menulist"].getCurrent()) else: self.session.open( MessageBox, _("Failed while checking downloaded SW!\nTry again please." ), MessageBox.TYPE_ERROR) self.downloadCancel(True)
def progressAction(configElement): num = int(configElement.value) if num == -1: self.drawProgressBarTimer.stop() MiniFTP_Thread.getInstance().Stop_Thread() self.downloadingSW = False self.hiddenSWNum = 0 self.downloadedSW = {} self.removeDownloadDir() elif num < 100: self.drawProgressBarTimer.start(1000, True) elif num == 100: self.drawProgressBarTimer.stop() MiniFTP_Thread.getInstance().Stop_Thread() self.downloadingSW = False if len(self.existDepSWList): self.download(extStr=self.existDepSWList.pop()) else: if self.downloadedSWSizeOk(): self.session.openWithCallback(self.downloadBurn, UpdateModeChoice) else: self.session.open( MessageBox, _("Failed while checking downloaded SW!\nTry again please." ), MessageBox.TYPE_ERROR) self.downloadCancel(True)
def download(self, val=True): if val: self["menulist"].hide() self["text"].setText(_("Downloading \"%s\"\nIf you want to exit, press \"EXIT\" key in rcu") % self["menulist"].getCurrent()) self.swPath = self.imageInfo[self.type]["imagedir"] + "/" + self["menulist"].getCurrent() self["text"].show() dlfile = "/tmp/update_files.tar" self.downloadedSW[self.swPath] = (dlfile, self.getSWSize(self.swPath)) MiniFTP_Thread.getInstance().DownloadFile(0, self.iface, self.SERVER_DNS, self.swPath, "anonymous", " ", dlfile) self.downloadingSW = True self.drawProgressBarTimer.start(1000, True)
def checkEnv(self): # server check if 0 == MiniFTP_Thread.getInstance().Alive_Check(0, self.SERVER_DNS): self.serverAlive = True self.loadSWList() else: self.serverAlive = False self.swList = [] # draw menu self.drawMenu()
def progressAction(configElement): num = int(configElement.value) if num == -1: self.drawProgressBarTimer.stop() MiniFTP_Thread.getInstance().Stop_Thread(); self.downloadingSW = False self.downloadedSW = {} elif num < 100: self.drawProgressBarTimer.start(1000, True) elif num == 100: self.drawProgressBarTimer.stop() MiniFTP_Thread.getInstance().Stop_Thread(); self.downloadingSW = False if self.downloadedSWSizeOk(): # self.downloadBurn() self.session.openWithCallback(self.downloadBurn, MessageBox, _("Downloading Finished!!\nDo you really want to update \nthe file \"%s\"?") % self["menulist"].getCurrent()) else: self.session.open(MessageBox, _("Failed while checking downloaded SW!\nTry again please."), MessageBox.TYPE_ERROR) self.downloadCancel(True)
def download(self, val=True): if val: self["menulist"].hide() self["text"].setText( _("Downloading \"%s\"\nIf you want to exit, press \"EXIT\" key in rcu" ) % self["menulist"].getCurrent()) self.swPath = self.imageInfo[ self.type]["imagedir"] + "/" + self["menulist"].getCurrent() self["text"].show() dlfile = "/tmp/update_files.tar" self.downloadedSW[self.swPath] = (dlfile, self.getSWSize(self.swPath)) MiniFTP_Thread.getInstance().DownloadFile(0, self.iface, self.SERVER_DNS, self.swPath, "anonymous", " ", dlfile) self.downloadingSW = True self.drawProgressBarTimer.start(1000, True)
def download(self, val=True, extStr=""): if val: # first download file must be rootfs if not extStr: self.removeDownloadDir() self.checkDepSW() self["menulist"].hide() if not extStr: self["text"].setText( _("Downloading \"%s\"\nIf you want to exit, press \"EXIT\" key in rcu" ) % self["menulist"].getCurrent()) self.swPath = self.imageInfo[self.type][ "imagedir"] + "/" + self["menulist"].getCurrent() else: self["text"].setText( _("Downloading \"%s\"\nIf you want to exit, press \"EXIT\" key in rcu" ) % extStr) self.swPath = self.imageInfo[ self.type]["imagedir"] + "/." + self[ "menulist"].getCurrent() + "." + extStr self["text"].show() dlfile = self.getDownloadDir() if extStr == "cfe": dlfile += "/cfe/cfe.bin" elif extStr == "kernel": dlfile += "/cfe/oe_kernel.bin" else: dlfile += "/oe_rootfs.bin" self.downloadedSW[self.swPath] = (dlfile, self.getSWSize(self.swPath)) MiniFTP_Thread.getInstance().DownloadFile(0, self.iface, self.SERVER_DNS, self.swPath, "anonymous", " ", dlfile) self.downloadingSW = True self.drawProgressBarTimer.start(1000, True)
def progressAction(configElement): num = int(configElement.value) if num == -1: self.drawProgressBarTimer.stop() MiniFTP_Thread.getInstance().Stop_Thread(); self.downloadingSW = False self.hiddenSWNum = 0 self.downloadedSW = {} self.removeDownloadDir() elif num < 100: self.drawProgressBarTimer.start(1000, True) elif num == 100: self.drawProgressBarTimer.stop() MiniFTP_Thread.getInstance().Stop_Thread(); self.downloadingSW = False if len(self.existDepSWList): self.download(extStr=self.existDepSWList.pop()) else: if self.downloadedSWSizeOk(): self.session.openWithCallback(self.downloadBurn, UpdateModeChoice) else: self.session.open(MessageBox, _("Failed while checking downloaded SW!\nTry again please."), MessageBox.TYPE_ERROR) self.downloadCancel(True)
def checkEnv(self): # server check if 0 == MiniFTP_Thread.getInstance().Alive_Check(0, self.SERVER_DNS): self.serverAlive = True self.loadSWList() else: self.serverAlive = False self.swList = [] # hdd check hddList = self.getHddList() for hdd in hddList: if self.isFileSystemSupported(hdd=hdd[1]): self.hddList.append(hdd) config.swupdate.downloadlocation.setChoices(self.hddList) # draw menu self.drawMenu()
def drawProgressBar(self): config.progress.value = str(MiniFTP_Thread.getInstance().GetState())