def __init__(self): QWidget.__init__(self) self.ui = Ui_InstallWidget() self.ui.setupUi(self) self.installProgress = InstallProgressWidget(self) self.timer = QTimer(self) self.timer.timeout.connect(self.changeSlideshows) self.poll_timer = QTimer(self) self.poll_timer.timeout.connect(self.checkQueueEvent) if ctx.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.pkg_configurator = None self.pkg_installer = None
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 __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_InstallWidget() self.ui.setupUi(self) self.timer = QTimer(self) QObject.connect(self.timer, SIGNAL("timeout()"),self.slotChangePix) if ctx.consts.lang == "tr": self.ui.progress.setFormat("%%p") self.iter_pics = iter_slide_pics() # show first pic self.slotChangePix() self.total = 0 self.cur = 0 self.hasErrors = False
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 = "packageInstallation" def __init__(self): QWidget.__init__(self) self.ui = Ui_InstallWidget() self.ui.setupUi(self) self.installProgress = InstallProgressWidget(self) self.timer = QTimer(self) self.timer.timeout.connect(self.changeSlideshows) self.poll_timer = QTimer(self) self.poll_timer.timeout.connect(self.checkQueueEvent) if ctx.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.pkg_configurator = None self.pkg_installer = 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("PkgInstaller is creating...") self.mutex = QMutex() self.wait_condition = QWaitCondition() self.queue = Queue() self.pkg_installer = PkgInstaller(self.queue, self.mutex, self.wait_condition, self.retry_answer) self.poll_timer.start(500) # start installer polling ctx.logger.debug("Calling PkgInstaller.start...") self.pkg_installer.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: return ctx.logger.debug("checkQueueEvent: Processing %s event..." % event) # EventInstall if event == EventInstall: package = data[1] self.installProgress.ui.info.setText( _("General", "Installing <b>%(name)s</b> -- %(summary)s") % { "name": package.name, "summary": package.summary }) ctx.logger.debug("Pisi: %s installing" % package.name) self.cur += 1 self.installProgress.ui.progress.setValue(self.cur) # EventConfigure elif event == EventConfigure: package = data[1] self.installProgress.ui.info.setText( _("General", "Configuring <b>%s</b>") % package.name) ctx.logger.debug("Pisi: %s configuring" % package.name) self.cur += 1 self.installProgress.ui.progress.setValue(self.cur) # EventSetProgress elif event == EventSetProgress: total = data[1] self.installProgress.ui.progress.setMaximum(total) # EventPackageInstallFinished elif event == EventPackageInstallFinished: print("***EventPackageInstallFinished called....") self.packageInstallFinished() # 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( _("General", "Warning"), _( "General", "Following error occured while " "installing packages:" "<b>%s</b><br><br>" "Do you want to retry?") % package, type="custom", customIcon="warning", customButtons=[_("General", "Yes"), _("General", "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() def changeSlideshows(self): slide = self.iter_slideshows.next() self.ui.slideImage.setPixmap(slide["picture"]) # if slide["description"].has_key(ctx.lang): if ctx.lang in slide["description"]: description = slide["description"][ctx.lang] else: description = slide["description"]["en"] self.ui.slideText.setText(description) def packageInstallFinished(self): yali.postinstall.writeFstab() # Configure Pending... # run baselayout's postinstall first yali.postinstall.initbaselayout() # postscripts depend on 03locale... yali.util.writeLocaleFromCmdline() # Write InitramfsConf yali.postinstall.writeInitramfsConf() # set resume param in /etc/default/grub yali.postinstall.setGrubResume() # run dbus in chroot yali.util.start_dbus() # start configurator thread self.pkg_configurator = PkgConfigurator(self.queue, self.mutex) self.pkg_configurator.start() def execute(self): # stop slide show self.timer.stop() self.poll_timer.stop() return True def finished(self): self.poll_timer.stop() if self.has_errors: return ctx.mainScreen.slotNext() def installError(self, error): self.has_errors = True errorstr = _( "General", """An error occured during the installation of packages. This may be caused by a corrupted installation medium error: %s """) % str(error) ctx.interface.exceptionWindow(error, errorstr) ctx.logger.error("Package installation failed error with:%s" % error)
class Widget(QWidget, ScreenWidget): name = "packageInstallation" def __init__(self): QWidget.__init__(self) self.ui = Ui_InstallWidget() self.ui.setupUi(self) self.installProgress = InstallProgressWidget(self) self.timer = QTimer(self) self.timer.timeout.connect(self.changeSlideshows) self.poll_timer = QTimer(self) self.poll_timer.timeout.connect(self.checkQueueEvent) if ctx.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.pkg_configurator = None self.pkg_installer = 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("PkgInstaller is creating...") self.mutex = QMutex() self.wait_condition = QWaitCondition() self.queue = Queue() self.pkg_installer = SqfsInstaller( self.queue, self.mutex, self.wait_condition, self.retry_answer) self.poll_timer.start(500) # start installer polling ctx.logger.debug("Calling PkgInstaller.start...") self.pkg_installer.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: return ctx.logger.debug("checkQueueEvent: Processing %s event..." % event) # EventInstall if event == EventInstall: # FIXME: mesajlar düzenlenecek info = data[1] percent = info["percent"] # percent = data[1] self.installProgress.ui.info.setText( _("General", # "Installing <b>{percent:.2f}%</b>".format(percent=percent))) "Installing <b>{percent:.2f}%</b> : {file}".format(**info))) if percent >= self.cur + 0.5: ctx.logger.debug("Sqfs: installing {}%".format(percent)) self.cur = percent self.installProgress.ui.progress.setValue(self.cur) # EventConfigure elif event == EventConfigure: package = data[1] self.installProgress.ui.info.setText( _("General", "Configuring <b>%s</b>") % package.name) ctx.logger.debug("Pisi: %s configuring" % package.name) self.cur += 1 self.installProgress.ui.progress.setValue(self.cur) # EventSetProgress elif event == EventSetProgress: total = data[1] self.installProgress.ui.progress.setMaximum(total) # EventPackageInstallFinished elif event == EventPackageInstallFinished: # print("***EventPackageInstallFinished called....") # self.packageInstallFinished() self.sqfsInstallFinished() event = EventAllFinished # 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( _("General", "Warning"), _("General", "Following error occured while " "installing packages:" "<b>%s</b><br><br>" "Do you want to retry?") % package, type="custom", customIcon="warning", customButtons=[_("General", "Yes"), _("General", "No")]) self.retry_answer = not rc self.timer.start(1000 * 30) self.poll_timer.start(500) self.wait_condition.wakeAll() # EventAllFinished if event == EventAllFinished: self.finished() def changeSlideshows(self): slide = self.iter_slideshows.next() self.ui.slideImage.setPixmap(slide["picture"]) # if slide["description"].has_key(ctx.lang): if ctx.lang in slide["description"]: description = slide["description"][ctx.lang] else: description = slide["description"]["en"] self.ui.slideText.setText(description) def sqfsInstallFinished(self): # bilgi yazısı kontrol edilecek self.installProgress.setVisible(False) ctx.interface.informationWindow.update( message=_("General", "Fstab, grub configuration, etc is writing.")) yali.postinstall.writeFstab() # Configure Pending... # run baselayout's postinstall first yali.postinstall.initbaselayout() # postscripts depend on 03locale... yali.util.writeLocaleFromCmdline() # Write InitramfsConf yali.postinstall.writeInitramfsConf() # set resume param in /etc/default/grub yali.postinstall.setGrubResume() # copy needed files # yali.util.cp("/etc/resolv.conf", "%s/etc/" % ctx.consts.target_dir) ctx.interface.informationWindow.update( message=_("General", "Unnecessary files and packages are being removed.")) # run dbus in chroot yali.util.start_dbus() kver = ".".join(os.uname()[2].split(".")[:2]) yali.util.run_batch( "rm -rf {}/etc/modules.autoload.d/kernel-{}".format( ctx.consts.target_dir, kver)) yali.util.run_batch( "rm -rf {}/etc/polkit-1/localauthority/90-mandatory.d/".format( ctx.consts.target_dir)) yali.util.run_batch( "rm -rf {}/run/livemedia".format(ctx.consts.target_dir)) # mount -B /run/udev target_dir/run/udev yali.util.chroot("pisi it --rei --ignore-file-conflicts \ /var/cache/pisi/packages/*.pisi") yali.util.run_batch( "rm -rf {}/var/cache/pisi/packages/*.pisi".format( ctx.consts.target_dir)) yali.util.chroot("pisi rm --purge yali yali-branding-pisilinux \ yali-theme-pisilinux xdm") yali.util.run_batch( "rm -rf {}/usr/share/applications/yali*.desktop".format( ctx.consts.target_dir)) # WARNING: çalışmadı tekrar dene yali.util.run_batch( "cp -f /etc/resolv.conf {}/etc/resolv.conf".format( ctx.consts.target_dir)) ctx.interface.informationWindow.update( message=_("General", "Paket depoları ayarlanıyor.")) yali.pisiiface.initialize2(with_comar=True) yali.pisiiface.switchToPardusRepo("live") # sddm_conf = "{}/etc/sddm.conf".format(ctx.consts.target_dir) # if os.path.exists(sddm_conf): # import ConfigParser # cfg = ConfigParser.ConfigParser() # cfg.optionxform = str # # cfg.read(sddm_conf) # # cfg.set("Autologin", "Session", "") # cfg.set("Autologin", "User", "") # # with open(sddm_conf, "w") as f: # cfg.write(f) # root oto giriş iptali için /etc/inittab dosyasında düzenleme yali.util.dosed( "{}/etc/inittab".format(ctx.consts.target_dir), "(.*) --autologin root (tty[1|2])", "\\1 \\2") yali.util.dosed( "{}/etc/inittab".format(ctx.consts.target_dir), "(.*) --noclear --autologin root (tty[3-6])", "\\1 \\2") def packageInstallFinished(self): yali.postinstall.writeFstab() # Configure Pending... # run baselayout's postinstall first yali.postinstall.initbaselayout() # postscripts depend on 03locale... yali.util.writeLocaleFromCmdline() # Write InitramfsConf yali.postinstall.writeInitramfsConf() # set resume param in /etc/default/grub yali.postinstall.setGrubResume() # run dbus in chroot yali.util.start_dbus() # start configurator thread self.pkg_configurator = PkgConfigurator(self.queue, self.mutex) self.pkg_configurator.start() def execute(self): # stop slide show self.timer.stop() self.poll_timer.stop() return True def finished(self): self.poll_timer.stop() if self.has_errors: return ctx.mainScreen.slotNext() def installError(self, error): self.has_errors = True errorstr = _("General", """An error occured during the installation of packages. This may be caused by a corrupted installation medium error: %s """) % str(error) ctx.interface.exceptionWindow(error, errorstr) ctx.logger.error("Package installation failed error with:%s" % error)
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(QtGui.QWidget, ScreenWidget): title = _("Installing Pardus") icon = "iconInstall" helpSummary = _("""YALI is now installing Pardus on your computer. This operation takes approximately 20-30 minutes depending on your computer's hardware.""") help = _(''' <p> YALI is now installing Pardus on your computer. This operation takes approximately 20-30 minutes depending on your computer's hardware. </p> <p> Note that the installation from a USB storage will be much faster than an optical medium (CD/DVD). </p> <p> Now, sit back and enjoy the installation during which you will be able to discover the features and the innovations offered by this new Pardus release. </p> ''') def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_InstallWidget() self.ui.setupUi(self) self.timer = QTimer(self) QObject.connect(self.timer, SIGNAL("timeout()"),self.slotChangePix) if ctx.consts.lang == "tr": self.ui.progress.setFormat("%%p") self.iter_pics = iter_slide_pics() # show first pic self.slotChangePix() self.total = 0 self.cur = 0 self.hasErrors = False def shown(self): # Disable mouse handler ctx.mainScreen.dontAskCmbAgain = True ctx.mainScreen.themeShortCut.setEnabled(False) # Thread object global currentObject currentObject = self # start installer thread ctx.logger.debug("PkgInstaller is creating...") self.pkg_installer = PkgInstaller() ctx.logger.debug("Calling PkgInstaller.start...") self.pkg_installer.start() #ctx.interface.informationWindow.update(_("Installing packages...")) ctx.mainScreen.disableNext() ctx.mainScreen.disableBack() # start 30 seconds self.timer.start(1000 * 30) def customEvent(self, qevent): # EventPisi if qevent.eventType() == EventPisi: p, event = qevent.data() if event == pisi.ui.installing: self.ui.info.setText(_("Installing <b>%s</b><br>%s") % (p.name, p.summary)) ctx.logger.debug("Pisi: %s installing" % p.name) self.cur += 1 self.ui.progress.setValue(self.cur) elif event == pisi.ui.configuring: self.ui.info.setText(_("Configuring <b>%s</b>") % p.name) ctx.logger.debug("Pisi: %s configuring" % p.name) self.cur += 1 self.ui.progress.setValue(self.cur) # EventSetProgress elif qevent.eventType() == EventSetProgress: total = qevent.data() self.ui.progress.setMaximum(total) # EventPackageInstallFinished elif qevent.eventType() == EventPackageInstallFinished: self.packageInstallFinished() # EventError elif qevent.eventType() == EventError: err = qevent.data() self.installError(err) # EventRetry elif qevent.eventType() == EventRetry: package = qevent.data() self.timer.stop() ctx.yali.retryAnswer = EjectAndRetryDialog(_("Warning"), _("Failed installing <b>%s</b>") % package, _("Do you want to retry?")) self.timer.start(1000 * 30) ctx.yali.waitCondition.wakeAll() # EventAllFinished elif qevent.eventType() == EventAllFinished: self.finished() def slotChangePix(self): slide = self.iter_pics.next() self.ui.pix.setPixmap(slide["pic"]) self.ui.desc.setText(slide["desc"]) def packageInstallFinished(self): ctx.yali.fillFstab() # Configure Pending... # run baselayout's postinstall first #ctx.interface.informationWindow.update(_("Creating base layout...")) yali.postinstall.initbaselayout() # postscripts depend on 03locale... yali.localeutils.writeLocaleFromCmdline() #Write InitramfsConf yali.postinstall.writeInitramfsConf() # run dbus in chroot yali.util.start_dbus() #ctx.interface.informationWindow.update(_("Configuring packages...")) # start configurator thread self.pkg_configurator = PkgConfigurator() self.pkg_configurator.start() def execute(self): # stop slide show self.timer.stop() return True def finished(self): if self.hasErrors: return #ctx.interface.informationWindow.hide() # trigger next screen. will activate execute() ctx.mainScreen.slotNext() def installError(self, error): self.hasErrors = True errorstr = _("""An error occured during the installation of packages. This may be caused by a corrupted installation medium. Error: %s """) % str(error) import yali.gui.runner yali.gui.runner.showException(1, errorstr)