class Widget(QtGui.QWidget, ScreenWidget): title = "Goodbye" # FIXME helpSummary = _("Selametle") help = _(""" <p> You have successfully installed Pardus on your computer. After restarting your computer, you can finally enjoy the full benefits of Pardus. </p> <P> Click Next to proceed. One note: You remember your password, don't you? </p> """) def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_GoodByeWidget() self.ui.setupUi(self) self.steps = YaliSteps() def shown(self): ctx.mainScreen.disableNext() ctx.interface.informationWindow.update(_("Running post-install operations...")) ctx.mainScreen.disableBack() ctx.yali.processPendingActions(self) self.steps.slotRunOperations() if not ctx.mainScreen.ui.helpContent.isVisible(): ctx.mainScreen.slotToggleHelp() self.ui.label.setPixmap(QtGui.QPixmap(":/gui/pics/goodbye.png")) ctx.interface.informationWindow.hide() ctx.mainScreen.enableNext() def execute(self): ctx.mainScreen.disableNext() ctx.logger.debug("Show restart dialog.") InfoDialog(_("Press <b>Restart</b> to restart the computer."), _("Restart")) ctx.interface.informationWindow.update(_("<b>Please wait while restarting...</b>")) # remove cd... if not ctx.yali.install_type == YALI_FIRSTBOOT: ctx.logger.debug("Trying to eject the CD.") yali.util.eject() ctx.logger.debug("Yali, reboot calling..") ctx.mainScreen.processEvents() time.sleep(4) yali.util.reboot()
def __init__(self, *args): apply(QWidget.__init__, (self,) + args) img = QLabel(self) img.setPixmap(ctx.iconfactory.newPixmap("goodbye")) self.steps = YaliSteps(self) self.info = QLabel(self) self.info.setText( _('<b><font size="+2" color="#FF6D19">Rebooting system. Please wait!</font></b>')) self.info.hide() self.info.setAlignment(QLabel.AlignCenter|QLabel.AlignTop) self.info.setMinimumSize(QSize(0,50)) vbox = QVBoxLayout(self) vbox.addStretch(1) hbox = QHBoxLayout(vbox) hbox.addStretch(1) #FIXME Where is the steps layout ?? hbox.addWidget(img) hbox.addStretch(1) vbox.addStretch(1) vbox.addWidget(self.info)
def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_RescuePisiWidget() self.ui.setupUi(self) self.steps = YaliSteps() self.steps.setOperations([{"text":_("Starting D-Bus..."),"operation":yali.sysutils.chrootDbus}, {"text":_("Connecting to D-Bus..."),"operation":yali.postinstall.connectToDBus}, {"text":_("Fetching history..."),"operation":self.fillHistoryList}]) self.connect(self.ui.buttonSelectConnection, SIGNAL("clicked()"), self.showConnections) self.connectionWidget = None
def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_RescuePasswordWidget() self.ui.setupUi(self) self.ui.pass_error.setVisible(False) self.ui.caps_error.setVisible(False) self.ui.caps_error.setText(_('Caps Lock is on.')) self.ui.updatePassword.setEnabled(False) self.steps = YaliSteps() self.steps.setOperations([{"text":_("Starting D-Bus..."),"operation":yali.sysutils.chrootDbus}, {"text":_("Connecting to D-Bus..."),"operation":yali.postinstall.connectToDBus}, {"text":_("Acquiring users..."),"operation":self.fillUserList}]) self.connect(self.ui.updatePassword, SIGNAL("clicked()"), self.updatePassword) self.connect(self.ui.userList, SIGNAL("itemChanged(QListWidgetItem*)"), self.resetWidgets) self.connect(self.ui.pass1, SIGNAL("textChanged(const QString &)"), self.slotTextChanged) self.connect(self.ui.pass2, SIGNAL("textChanged(const QString &)"), self.slotTextChanged)
class Widget(QWidget, ScreenWidget): help = _(''' <font size="+2">Congratulations</font> <font size="+1"> <p> You have successfully installed Pardus, a very easy to use desktop system on your machine. Now you can start playing with your system and stay productive all the time. </p> <P> Click on the Next button to proceed. One note: You remember your password, don't you? </p> </font> ''') def __init__(self, *args): apply(QWidget.__init__, (self,) + args) img = QLabel(self) img.setPixmap(ctx.iconfactory.newPixmap("goodbye")) self.steps = YaliSteps(self) self.info = QLabel(self) self.info.setText( _('<b><font size="+2" color="#FF6D19">Rebooting system. Please wait!</font></b>')) self.info.hide() self.info.setAlignment(QLabel.AlignCenter|QLabel.AlignTop) self.info.setMinimumSize(QSize(0,50)) vbox = QVBoxLayout(self) vbox.addStretch(1) hbox = QHBoxLayout(vbox) hbox.addStretch(1) #FIXME Where is the steps layout ?? hbox.addWidget(img) hbox.addStretch(1) vbox.addStretch(1) vbox.addWidget(self.info) def shown(self): from os.path import basename ctx.debugger.log("%s loaded" % basename(__file__)) ctx.screens.disablePrev() self.processPendingActions() self.steps.slotRunOperations() def execute(self): ctx.screens.disableNext() self.info.show() self.info.setAlignment(QLabel.AlignCenter) try: ctx.debugger.log("Trying to umount %s" % (ctx.consts.target_dir + "/home")) yali.sysutils.umount(ctx.consts.target_dir + "/home") ctx.debugger.log("Trying to umount %s" % (ctx.consts.target_dir)) yali.sysutils.umount(ctx.consts.target_dir) except: ctx.debugger.log("Umount Failed.") pass w = RebootWidget(self) ctx.debugger.log("Show reboot dialog.") self.dialog = WarningDialog(w, self) self.dialog.exec_loop() ctx.debugger.log("Trying to eject the CD.") # remove cd... yali.sysutils.eject_cdrom() ctx.debugger.log("Yali, fastreboot calling..") # store log content if ctx.debugEnabled: open(ctx.consts.log_file,"w").write(str(ctx.debugger.traceback.plainLogs)) time.sleep(4) yali.sysutils.fastreboot() # process pending actions defined in other screens. def processPendingActions(self): comarLink = None def connectToComar(): global comarLink for i in range(20): try: ctx.debugger.log("trying to start comar..") comarLink = comar.Link(sockname=consts.comar_socket_file) break except comar.CannotConnect: time.sleep(1) ctx.debugger.log("wait comar for 1 second...") if comarLink: return True return False def setHostName(): global comarLink comarLink.Net.Stack.setHostNames(hostnames=ctx.installData.hostName) reply = comarLink.read_cmd() ctx.debugger.log("Hostname set as %s" % ctx.installData.hostName) return True def addUsers(): global comarLink for u in yali.users.pending_users: ctx.debugger.log("User %s adding to system" % u.username) comarLink.User.Manager.addUser(name=u.username, password=u.passwd, realname=u.realname, groups=','.join(u.groups)) ctx.debugger.log("RESULT :: %s" % str(comarLink.read_cmd())) # Enable auto-login if u.username == ctx.installData.autoLoginUser: u.setAutoLogin() return True def setRootPassword(): if not ctx.installData.useYaliFirstBoot: global comarLink comarLink.User.Manager.setUser(uid=0,password=ctx.installData.rootPassword) ctx.debugger.log("RESULT :: %s" % str(comarLink.read_cmd())) return True def writeConsoleData(): yali.localeutils.write_keymap(ctx.installData.keyData.console) ctx.debugger.log("Keymap stored.") return True def migrateXorgConf(): yali.postinstall.migrate_xorg_conf(ctx.installData.keyData.X) ctx.debugger.log("xorg.conf merged.") return True def setPackages(): global comarLink if yali.sysutils.checkYaliParams(param=ctx.consts.firstBootParam): ctx.debugger.log("OemInstall selected.") comarLink.System.Service["kdebase"].setState(state="off") ctx.debugger.log("RESULT :: %s" % str(comarLink.read_cmd())) comarLink.System.Service["yali-firstBoot"].setState(state="on") ctx.debugger.log("RESULT :: %s" % str(comarLink.read_cmd())) return True steps = [{"text":_("Trying to connect COMAR Daemon..."),"operation":connectToComar}, {"text":_("Setting Hostname..."),"operation":setHostName}, {"text":_("Setting Root Password..."),"operation":setRootPassword}, {"text":_("Adding Users..."),"operation":addUsers}, {"text":_("Writing Console Data..."),"operation":writeConsoleData}, {"text":_("Migrating X.org Configuration..."),"operation":migrateXorgConf}, {"text":_("Setting misc. package configurations..."),"operation":setPackages}, {"text":_("Installing BootLoader..."),"operation":self.installBootloader}] self.steps.setOperations(steps) def installBootloader(self): ctx.debugger.log("Bootloader is installing...") loader = yali.bootloader.BootLoader() root_part_req = ctx.partrequests.searchPartTypeAndReqType(parttype.root, partrequest.mountRequestType) _ins_part = root_part_req.partition().getPath() loader.write_grub_conf(_ins_part,ctx.installData.bootLoaderDev) # Check for windows partitions. for d in yali.storage.devices: for p in d.getPartitions(): fs = p.getFSName() if fs in ("ntfs", "fat32"): if is_windows_boot(p.getPath(), fs): win_fs = fs win_dev = basename(p.getDevicePath()) win_root = basename(p.getPath()) loader.grub_conf_append_win(ctx.installData.bootLoaderDev, win_dev, win_root, win_fs) continue # finally install it loader.install_grub(ctx.installData.bootLoaderDev) ctx.debugger.log("Bootloader installed.")
class Widget(QtGui.QWidget, ScreenWidget): title = _("Reset Forgotten Passwords") icon = "iconInstall" help = _(""" <font size="+2">Password Recovery</font> <font size="+1"> <p> Here you can reset.. </p> """) def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_RescuePasswordWidget() self.ui.setupUi(self) self.ui.pass_error.setVisible(False) self.ui.caps_error.setVisible(False) self.ui.caps_error.setText(_('Caps Lock is on.')) self.ui.updatePassword.setEnabled(False) self.steps = YaliSteps() self.steps.setOperations([{"text":_("Starting D-Bus..."),"operation":yali.sysutils.chrootDbus}, {"text":_("Connecting to D-Bus..."),"operation":yali.postinstall.connectToDBus}, {"text":_("Acquiring users..."),"operation":self.fillUserList}]) self.connect(self.ui.updatePassword, SIGNAL("clicked()"), self.updatePassword) self.connect(self.ui.userList, SIGNAL("itemChanged(QListWidgetItem*)"), self.resetWidgets) self.connect(self.ui.pass1, SIGNAL("textChanged(const QString &)"), self.slotTextChanged) self.connect(self.ui.pass2, SIGNAL("textChanged(const QString &)"), self.slotTextChanged) def resetWidgets(self): self.ui.pass1.clear() self.ui.pass2.clear() self.ui.updatePassword.setEnabled(False) def showError(self,message): self.ui.pass_error.setText("<center>%s</center>" % message) self.ui.pass_error.setVisible(True) self.ui.updatePassword.setEnabled(False) def checkCapsLock(self): if pardus.xorg.capslock.isOn(): self.ui.caps_error.setVisible(True) else: self.ui.caps_error.setVisible(False) def keyReleaseEvent(self, e): self.checkCapsLock() def updatePassword(self): password = unicode(self.ui.pass1.text()) uid = int(self.ui.userList.currentItem().getInfo()[0]) yali.postinstall.setUserPass(uid, password) InfoDialog(_("The password has been successfully reset."), title = _("Info")) self.resetWidgets() def slotTextChanged(self): p1 = self.ui.pass1.text() p2 = self.ui.pass2.text() if not self.ui.userList.currentItem(): return user = self.ui.userList.currentItem().getInfo() if not p1 == '' and (str(p1).lower() == str(user[1]).lower() or \ str(p1).lower() == str(user[2]).lower()): self.showError(_('Do not use your username or real name as your password.')) return elif p2 != p1 and p2: self.showError(_('The passwords do not match.')) return elif len(p1) == len(p2) and len(p2) < 4 and not p1=='': self.showError(_('Password is too short.')) return elif p1 == '' or p2 == '': self.ui.pass_error.setVisible(False) return else: self.ui.pass_error.setVisible(False) self.ui.updatePassword.setEnabled(True) def shown(self): ctx.mainScreen.disableBack() ctx.yali.info.show() self.steps.slotRunOperations() ctx.yali.info.hide() def fillUserList(self): users = yali.postinstall.getUserList() for user in users: UserItem(self.ui.userList, user) def execute(self): return True def backCheck(self): ctx.mainScreen.moveInc = 3 return True
def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_GoodByeWidget() self.ui.setupUi(self) self.steps = YaliSteps()
class Widget(QtGui.QWidget, ScreenWidget): title = _("Take Back Your System") icon = "iconInstall" help = _(""" <font size="+2">Pisi History</font> <font size="+1"> <p> Pisi, the package management system of Pardus, stores every operation in its history database. More technically speaking, every removal/installation/update operation within Pisi is a point-in-time that the user may want to return back in case of a serious problem or system inconsistency. </p> <p> This repair mode allows users to visualize the operation history and to return back to a previous system state. </p> </font> """) def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_RescuePisiWidget() self.ui.setupUi(self) self.steps = YaliSteps() self.steps.setOperations([{"text":_("Starting D-Bus..."),"operation":yali.sysutils.chrootDbus}, {"text":_("Connecting to D-Bus..."),"operation":yali.postinstall.connectToDBus}, {"text":_("Fetching history..."),"operation":self.fillHistoryList}]) self.connect(self.ui.buttonSelectConnection, SIGNAL("clicked()"), self.showConnections) self.connectionWidget = None def showConnections(self): self.connectionWidget.show() def fillHistoryList(self): ui = PisiUI() ctx.debugger.log("PisiUI is creating..") yali.pisiiface.initialize(ui, with_comar = True) try: history = yali.pisiiface.getHistory() for hist in history: HistoryItem(self.ui.historyList, hist) except: return False return True def checkRegisteredConnections(self): self.connectionWidget = ConnectionWidget(self) registeredConnectionsTotal = 0 for connection in self.connectionWidget.connections.values(): registeredConnectionsTotal+=len(connection) return registeredConnectionsTotal def shown(self): self.ui.buttonSelectConnection.setEnabled(False) ctx.yali.info.show() self.steps.slotRunOperations() ctx.yali.info.hide() if self.checkRegisteredConnections(): self.ui.buttonSelectConnection.setEnabled(True) else: self.ui.labelStatus.setText(_("No connection available")) def execute(self): ctx.takeBackOperation = self.ui.historyList.currentItem().getInfo() ctx.mainScreen.moveInc = 2 return True def backCheck(self): ctx.mainScreen.moveInc = 2 return True
class Widget(QWidget, ScreenWidget): help = _(''' <font size="+2">Congratulations</font> <font size="+1"> <p> You have successfully setup your Pardus, a very easy to use desktop system on your machine. Now you can start playing with your system and stay productive all the time. </p> <P> Click on the Next button to proceed. One note: You remember your password, don't you? </p> </font> ''') def __init__(self, *args): apply(QWidget.__init__, (self,) + args) img = QLabel(self) img.setPixmap(ctx.iconfactory.newPixmap("goodbye")) self.steps = YaliSteps(self) self.info = QLabel(self) self.info.setText( _('<b><font size="+2" color="#FF6D19">Rebooting system. Please wait!</font></b>')) self.info.hide() self.info.setAlignment(QLabel.AlignCenter|QLabel.AlignTop) self.info.setMinimumSize(QSize(0,50)) vbox = QVBoxLayout(self) vbox.addStretch(1) hbox = QHBoxLayout(vbox) hbox.addStretch(1) #FIXME Where is the steps layout ?? hbox.addWidget(img) hbox.addStretch(1) vbox.addStretch(1) vbox.addWidget(self.info) def shown(self): ctx.debugger.log("%s loaded" % basename(__file__)) ctx.screens.disablePrev() self.processPendingActions() self.steps.slotRunOperations() def execute(self): ctx.screens.disableNext() self.info.show() self.info.setAlignment(QLabel.AlignCenter) ctx.debugger.log("Yali, fastreboot calling..") time.sleep(2) os.system("/sbin/reboot") # process pending actions defined in other screens. def processPendingActions(self): comarLink = None def connectToComar(): global comarLink for i in range(20): try: ctx.debugger.log("trying to start comar..") comarLink = comar.Link(sockname=consts.comar_socket_file) break except comar.CannotConnect: time.sleep(1) ctx.debugger.log("wait comar for 1 second...") if comarLink: return True return False def setHostName(): global comarLink comarLink.Net.Stack.setHostNames(hostnames=ctx.installData.hostName) reply = comarLink.read_cmd() ctx.debugger.log("Hostname set as %s" % ctx.installData.hostName) return True def addUsers(): global comarLink for u in yali.users.pending_users: ctx.debugger.log("User %s adding to system" % u.username) comarLink.User.Manager.addUser(name=u.username, password=u.passwd, realname=u.realname, groups=','.join(u.groups)) ctx.debugger.log("RESULT :: %s" % str(comarLink.read_cmd())) # Enable auto-login if u.username == ctx.installData.autoLoginUser: u.setAutoLogin() return True def setKdeBase(): global comarLink comarLink.System.Service["kdebase"].setState(state="on") comarLink.System.Service["yali"].setState(state="off") def setRootPassword(): global comarLink comarLink.User.Manager.setUser(uid=0, password=ctx.installData.rootPassword) ctx.debugger.log("RESULT :: %s" % str(comarLink.read_cmd())) return True # def writeConsoleData(): # yali.localeutils.write_keymap(ctx.installData.keyData.console) # ctx.debugger.log("Keymap stored.") # return True steps = [{"text":_("Trying to connect COMAR Daemon..."),"operation":connectToComar}, {"text":_("Setting Hostname..."),"operation":setHostName}, {"text":_("Setting Root Password..."),"operation":setRootPassword}, {"text":_("Adding Users..."),"operation":addUsers}, {"text":_("Setting up KdeBase..."),"operation":setKdeBase}] # {"text":_("Writing Console Data..."),"operation":writeConsoleData}, self.steps.setOperations(steps)