def shown(self): # Disable mouse handler ctx.mainScreen.dontAskCmbAgain = True ctx.mainScreen.theme_shortcut.setEnabled(False) ctx.mainScreen.ui.system_menu.setEnabled(False) # start installer thread ctx.logger.debug("Copy system thread is creating...") self.mutex = QMutex() self.wait_condition = QWaitCondition() self.queue = Queue() self.sys_copier = SystemCopy(self.queue, self.mutex, self.wait_condition, self.retry_answer) self.poll_timer.start(500) # start installer polling ctx.logger.debug("Calling SystemCopy.start...") self.sys_copier.start() ctx.mainScreen.disableNext() ctx.mainScreen.disableBack() # start 30 seconds self.timer.start(1000 * 30) self.installProgress.showInstallProgress()
class Widget(QWidget, ScreenWidget): name = "liveInstallation" def __init__(self): QWidget.__init__(self) self.ui = Ui_InstallWidget() self.ui.setupUi(self) self.installProgress = InstallProgressWidget(self) self.timer = QTimer(self) QObject.connect(self.timer, SIGNAL("timeout()"), self.changeSlideshows) self.poll_timer = QTimer(self) QObject.connect(self.poll_timer, SIGNAL("timeout()"), self.checkQueueEvent) if ctx.consts.lang == "tr": self.installProgress.ui.progress.setFormat("%%p") self.iter_slideshows = iter_slideshows() # show first pic self.changeSlideshows() self.total = 0 self.cur = 0 self.has_errors = False # mutual exclusion self.mutex = None self.wait_condition = None self.queue = None self.retry_answer = False self.sys_copier = None def shown(self): # Disable mouse handler ctx.mainScreen.dontAskCmbAgain = True ctx.mainScreen.theme_shortcut.setEnabled(False) ctx.mainScreen.ui.system_menu.setEnabled(False) # start installer thread ctx.logger.debug("Copy system thread is creating...") self.mutex = QMutex() self.wait_condition = QWaitCondition() self.queue = Queue() self.sys_copier = SystemCopy(self.queue, self.mutex, self.wait_condition, self.retry_answer) self.poll_timer.start(500) # start installer polling ctx.logger.debug("Calling SystemCopy.start...") self.sys_copier.start() ctx.mainScreen.disableNext() ctx.mainScreen.disableBack() # start 30 seconds self.timer.start(1000 * 30) self.installProgress.showInstallProgress() def checkQueueEvent(self): while True: try: data = self.queue.get_nowait() event = data[0] except Empty, msg: return ctx.logger.debug("checkQueueEvent: Processing %s event..." % event) # EventCopy if event == EventCopy: self.cur = data[1] self.installProgress.ui.info.setText(_("Copying system")) ctx.logger.debug("Unsquashfs system") self.installProgress.ui.progress.setValue(self.cur) # EventSetProgress elif event == EventSetProgress: total = data[1] self.installProgress.ui.progress.setMaximum(total) # EventCopyFinished elif event == EventCopyFinished: print "***EventCopyFinished called...." self.copyFinished() # EventError elif event == EventError: err = data[1] self.installError(err) # EventRetry elif event == EventRetry: package = os.path.basename(data[1]) self.timer.stop() self.poll_timer.stop() rc = ctx.interface.messageWindow(_("Warning"), _("Following error occured while " "installing packages:" "<b>%s</b><br><br>" "Do you want to retry?") % package, type="custom", customIcon="warning", customButtons=[_("Yes"), _("No")]) self.retry_answer = not rc self.timer.start(1000 * 30) self.poll_timer.start(500) self.wait_condition.wakeAll() # EventAllFinished elif event == EventAllFinished: self.finished()
class Widget(QWidget, ScreenWidget): name = "liveInstallation" def __init__(self): QWidget.__init__(self) self.ui = Ui_InstallWidget() self.ui.setupUi(self) self.installProgress = InstallProgressWidget(self) self.timer = QTimer(self) QObject.connect(self.timer, SIGNAL("timeout()"), self.changeSlideshows) self.poll_timer = QTimer(self) QObject.connect(self.poll_timer, SIGNAL("timeout()"), self.checkQueueEvent) if ctx.consts.lang == "tr": self.installProgress.ui.progress.setFormat("%%p") self.iter_slideshows = iter_slideshows() # show first pic self.changeSlideshows() self.total = 0 self.cur = 0 self.has_errors = False # mutual exclusion self.mutex = None self.wait_condition = None self.queue = None self.retry_answer = False self.sys_copier = None def shown(self): # Disable mouse handler ctx.mainScreen.dontAskCmbAgain = True ctx.mainScreen.theme_shortcut.setEnabled(False) ctx.mainScreen.ui.system_menu.setEnabled(False) # start installer thread ctx.logger.debug("Copy system thread is creating...") self.mutex = QMutex() self.wait_condition = QWaitCondition() self.queue = Queue() self.sys_copier = SystemCopy(self.queue, self.mutex, self.wait_condition, self.retry_answer) self.poll_timer.start(500) # start installer polling ctx.logger.debug("Calling SystemCopy.start...") self.sys_copier.start() ctx.mainScreen.disableNext() ctx.mainScreen.disableBack() # start 30 seconds self.timer.start(1000 * 30) self.installProgress.showInstallProgress() def checkQueueEvent(self): while True: try: data = self.queue.get_nowait() event = data[0] except Empty, msg: return ctx.logger.debug("checkQueueEvent: Processing %s event..." % event) # EventCopy if event == EventCopy: self.cur = data[1] self.installProgress.ui.info.setText(_("Copying system")) ctx.logger.debug("Unsquashfs system") self.installProgress.ui.progress.setValue(self.cur) # EventSetProgress elif event == EventSetProgress: total = data[1] self.installProgress.ui.progress.setMaximum(total) # EventCopyFinished elif event == EventCopyFinished: print "***EventCopyFinished called...." self.copyFinished() # EventError elif event == EventError: err = data[1] self.installError(err) # EventRetry elif event == EventRetry: package = os.path.basename(data[1]) self.timer.stop() self.poll_timer.stop() rc = ctx.interface.messageWindow( _("Warning"), _("Following error occured while " "installing packages:" "<b>%s</b><br><br>" "Do you want to retry?") % package, type="custom", customIcon="warning", customButtons=[_("Yes"), _("No")]) self.retry_answer = not rc self.timer.start(1000 * 30) self.poll_timer.start(500) self.wait_condition.wakeAll() # EventAllFinished elif event == EventAllFinished: self.finished()