def slotReboot(self): w = WarningWidget(self) w.warning.setText(_('''<b><p>This action will reboot your system !</p></b>''')) w.ok.setText(_("Reboot")) dialog = WarningDialog(w, self) if dialog.exec_(): yali4.sysutils.fastreboot()
def askForRetry(self, message): w = WarningWidget() w.warning.setText(str(message)) w.ok.setText(_("Retry")) dialog = WarningDialog(w, self) if not dialog.exec_(): return False return True
def execute(self): ctx.mainScreen.disableNext() if not ctx.yali.install_type == YALI_FIRSTBOOT: try: ctx.debugger.log("Trying to umount %s" % (ctx.consts.target_dir + "/home")) yali4.sysutils.umount(ctx.consts.target_dir + "/home") ctx.debugger.log("Trying to umount %s" % (ctx.consts.target_dir)) yali4.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_() ctx.mainScreen.processEvents() ctx.yali.info.updateAndShow(_('<b>Rebooting system. Please wait!</b>')) # remove cd... if not ctx.yali.install_type == YALI_FIRSTBOOT: ctx.debugger.log("Trying to eject the CD.") yali4.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)) ctx.mainScreen.processEvents() time.sleep(4) yali4.sysutils.fastreboot()
def execute(self): ctx.mainScreen.disableNext() w = RebootWidget(self) ctx.debugger.log("Show reboot dialog.") self.dialog = WarningDialog(w, self) self.dialog.exec_() ctx.mainScreen.processEvents() ctx.yali.info.updateAndShow(_("<b>Rebooting system. Please wait!</b>")) # remove cd... if not ctx.yali.install_type == YALI_FIRSTBOOT: ctx.debugger.log("Trying to eject the CD.") yali4.sysutils.eject_cdrom() ctx.debugger.log("Yali, fastreboot calling..") ctx.mainScreen.processEvents() time.sleep(4) yali4.sysutils.fastreboot()
def execute(self): isAdminSet = False for i in range(self.ui.userList.count()): u = self.ui.userList.item(i).getUser() if "wheel" in u.groups: isAdminSet = True if not isAdminSet: # show confirmation dialog w = WarningWidget(self) w.warning.setText(_('''<b> <p>You have not defined an administrator!</p> <p>A user without administrative rights cannot complete system maintenance tasks. You are strongly encouraged to define an administrator user.</p> <p>Click "Cancel" to define an administrator user (recommended) or "OK" to go to next screen.</p> </b> ''')) self.dialog = WarningDialog(w, self) if not self.dialog.exec_(): ctx.mainScreen.enableBack() ctx.mainScreen.enableNext() return False # reset and fill pending_users yali4.users.reset_pending_users() ctx.installData.autoLoginUser = str(self.ui.autoLogin.currentText()) for i in range(self.ui.userList.count()): u = self.ui.userList.item(i).getUser() ctx.installData.users.append(u) yali4.users.pending_users.append(u) return True
def execute(self): # Just store normal installation session if ctx.yali.install_type == 0: ctx.yali.backupInstallData() self.timer.stop() if self.resizeAction: w = WarningWidget(self) w.warning.setText(_( """<p><b><u>Warning</u></b>: There is a resizing operation and it may corrupt your partition,<br> rendering your data unreachable. <br> Make sure that you have a backup for this partition.<br> <b>Note that this operation cannot be undone ! </b></p>""")) w.ok.setText(_("Begin Install")) dialog = WarningDialog(w, self) if not dialog.exec_(): ctx.mainScreen.moveInc = 0 return self.ui.install.setEnabled(False) self.ui.cancel.setEnabled(False) ctx.mainScreen.processEvents() # We should do partitioning operations in here. if ctx.options.dryRun == True: ctx.debugger.log("dryRun activated Yali stopped") return # Auto Partitioning if ctx.installData.autoPartDev: ctx.use_autopart = True if ctx.installData.autoPartMethod == methodEraseAll: ctx.yali.autoPartDevice() ctx.yali.checkSwap() ctx.yali.info.updateMessage(_("Formatting ...")) ctx.mainScreen.processEvents() ctx.partrequests.applyAll() elif ctx.installData.autoPartMethod == methodUseAvail: if ctx.installData.autoPartPartition["partition"].isFreespace(): ctx.yali.info.updateAndShow(_("Writing disk tables ...")) else: ctx.yali.info.updateAndShow(_("Resizing ...")) ctx.yali.autoPartUseAvail() ctx.yali.checkSwap() ctx.yali.info.updateMessage(_("Formatting ...")) ctx.mainScreen.processEvents() ctx.partrequests.applyAll() # Manual Partitioning else: ctx.debugger.log("Format Operation Started") ctx.yali.info.updateAndShow(_("Writing disk tables ...")) for dev in yali4.storage.devices: ctx.mainScreen.processEvents() if dev._needs_commit: dev.commit() # wait for udev to create device nodes time.sleep(2) ctx.yali.checkSwap() ctx.yali.info.updateMessage(_("Formatting ...")) ctx.mainScreen.processEvents() ctx.partrequests.applyAll() ctx.debugger.log("Format Operation Finished") ctx.yali.info.hide() # Find GRUB Dev root_part_req = ctx.partrequests.searchPartTypeAndReqType(parttype.root, request.mountRequestType) if ctx.installData.bootLoaderOption == B_DONT_INSTALL: ctx.installData.bootLoaderDev = None elif ctx.installData.bootLoaderOption == B_INSTALL_PART: ctx.installData.bootLoaderDev = os.path.basename(root_part_req.partition().getPath()) elif ctx.installData.bootLoaderOption == B_INSTALL_MBR: ctx.installData.bootLoaderDev = os.path.basename(ctx.installData.bootLoaderOptionalDev.getPath()) else: ctx.yali.guessBootLoaderDevice() root_part_req = ctx.partrequests.searchPartTypeAndReqType(parttype.root,request.mountRequestType) _ins_part = root_part_req.partition().getPath() ctx.debugger.log("Pardus Root is : %s" % _ins_part) ctx.debugger.log("GRUB will be installing to : %s" % ctx.installData.bootLoaderDev) ctx.mainScreen.moveInc = 1 return True
class Widget(QtGui.QWidget, ScreenWidget): title = _('Set Users') desc = _('Create users to use Pardus..') icon = "iconUser" help = _(''' <font size="+2">User setup</font> <font size="+1"> <p> Other than the system administrator user, you can create a user account for your daily needs, i.e reading your e-mail, surfing on the web and searching for daily recipe offerings. Usual password assignment rules also apply here: This password should be unique and private. Choose a password difficult to guess, but easy to remember. </p> <p> Click Next button to proceed. </p> </font> ''') def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_SetupUsersWidget() self.ui.setupUi(self) self.edititemindex = None self.ui.pass_error.setVisible(False) self.ui.caps_error.setVisible(False) self.ui.caps_error.setText(_('<font color="#FF6D19">Caps Lock is on!</font>')) # User Icons self.normalUserIcon = QtGui.QPixmap(":/gui/pics/user_normal.png") self.superUserIcon = QtGui.QPixmap(":/gui/pics/user_root.png") # KDE AutoLogin self.autoLoginUser = "" # Give Admin Privileges default self.ui.admin.setChecked(True) # Set disabled the create Button self.ui.createButton.setEnabled(False) # Connections self.connect(self.ui.pass1, SIGNAL("textChanged(const QString &)"), self.slotTextChanged) self.connect(self.ui.pass2, SIGNAL("textChanged(const QString &)"), self.slotTextChanged) self.connect(self.ui.username, SIGNAL("textChanged(const QString &)"), self.slotTextChanged) self.connect(self.ui.createButton, SIGNAL("clicked()"), self.slotCreateUser) self.connect(self.ui.deleteButton, SIGNAL("clicked()"), self.slotDeleteUser) self.connect(self.ui.userList, SIGNAL("itemDoubleClicked(QListWidgetItem*)"), self.slotEditUser) self.connect(self.ui.pass2, SIGNAL("returnPressed()"), self.slotReturnPressed) def shown(self): ctx.installData.users = [] ctx.installData.autoLoginUser = None self.checkUsers() self.checkCapsLock() self.ui.username.setFocus() def execute(self): isAdminSet = False for i in range(self.ui.userList.count()): u = self.ui.userList.item(i).getUser() if "wheel" in u.groups: isAdminSet = True if not isAdminSet: # show confirmation dialog w = WarningWidget(self) w.warning.setText(_('''<b> <p>You have not defined an administrator!</p> <p>A user without administrative rights cannot complete system maintenance tasks. You are strongly encouraged to define an administrator user.</p> <p>Click "Cancel" to define an administrator user (recommended) or "OK" to go to next screen.</p> </b> ''')) self.dialog = WarningDialog(w, self) if not self.dialog.exec_(): ctx.mainScreen.enableBack() ctx.mainScreen.enableNext() return False # reset and fill pending_users yali4.users.reset_pending_users() ctx.installData.autoLoginUser = str(self.ui.autoLogin.currentText()) for i in range(self.ui.userList.count()): u = self.ui.userList.item(i).getUser() ctx.installData.users.append(u) yali4.users.pending_users.append(u) return True 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 showError(self,message): self.ui.pass_error.setText("<center>%s</center>" % message) self.ui.pass_error.setVisible(True) self.ui.createButton.setEnabled(False) def slotTextChanged(self): p1 = self.ui.pass1.text() p2 = self.ui.pass2.text() if not p1 == '' and (p1 == self.ui.username.text() or p1 == self.ui.realname.text()): self.showError(_('<font color="#FF6D19">Don\'t use your user name or name as a password.</font>')) return elif p2 != p1 and p2: self.showError(_('<font color="#FF6D19">Passwords do not match!</font>')) return elif len(p1) == len(p2) and len(p2) < 4 and not p1=='': self.showError(_('<font color="#FF6D19">Password is too short!</font>')) return else: self.ui.pass_error.setVisible(False) if self.ui.username.text() and p1 and p2: self.ui.createButton.setEnabled(True) else: self.ui.createButton.setEnabled(False) def slotCreateUser(self): u = yali4.users.User() u.username = str(self.ui.username.text().toAscii()) # ignore last character. see bug #887 u.realname = unicode(self.ui.realname.text()) u.passwd = unicode(self.ui.pass1.text()) u.groups = ["users", "pnp", "pnpadmin", "removable", "disk", "audio", "video", "power", "dialout"] pix = self.normalUserIcon if self.ui.admin.isChecked(): u.groups.append("wheel") pix = self.superUserIcon existsInList = [i for i in range(self.ui.userList.count()) if self.ui.userList.item(i).getUser().username == u.username] # check user validity if u.exists() or (existsInList and self.edititemindex == None): self.showError(_('<font color="#FF6D19">Username exists, choose another one!</font>')) return elif not u.usernameIsValid(): self.showError(_('<font color="#FF6D19">Username contains invalid characters!</font>')) return elif not u.realnameIsValid(): self.showError(_('<font color="#FF6D19">Realname contains invalid characters!</font>')) return self.ui.createButton.setText(_("Create User")) updateItem = None try: self.ui.userList.takeItem(self.edititemindex) self.ui.autoLogin.removeItem(self.edititemindex + 1) except: updateItem = self.edititemindex # nothing wrong. just adding a new user... pass self.edititemindex = None i = UserItem(self.ui.userList, pix, user = u) # add user to auto-login list. self.ui.autoLogin.addItem(QString(u.username)) if updateItem: self.ui.autoLogin.setCurrentIndex(self.ui.autoLogin.count()) # clear form self.resetWidgets() ctx.debugger.log("slotCreateUser :: user '%s (%s)' added/updated" % (u.realname,u.username)) ctx.debugger.log("slotCreateUser :: user groups are %s" % str(','.join(u.groups))) # give focus to username widget for a new user. #3280 self.ui.username.setFocus() self.checkUsers() def slotDeleteUser(self): if self.ui.userList.currentRow()==self.edititemindex: self.resetWidgets() self.ui.autoLogin.setCurrentIndex(0) _cur = self.ui.userList.currentRow() self.ui.userList.takeItem(_cur) self.ui.autoLogin.removeItem(_cur + 1) self.checkUsers() def slotEditUser(self, item): u = item.getUser() self.ui.username.setText(QString(u.username)) self.ui.realname.setText(QString(u.realname)) self.ui.pass1.setText(QString(u.passwd)) self.ui.pass2.setText(QString(u.passwd)) if "wheel" in u.groups: self.ui.admin.setChecked(True) else: self.ui.admin.setChecked(False) self.edititemindex = self.ui.userList.currentRow() self.ui.createButton.setText(_("Update User")) def checkUsers(self): if self.ui.userList.count(): self.ui.deleteButton.setEnabled(True) self.ui.autoLogin.setEnabled(True) ctx.mainScreen.enableNext() else: # there is no user in list so noting to delete self.ui.deleteButton.setEnabled(False) self.ui.autoLogin.setEnabled(False) ctx.mainScreen.disableNext() def resetWidgets(self): # clear all self.ui.username.clear() self.ui.realname.clear() self.ui.pass1.clear() self.ui.pass2.clear() self.ui.admin.setChecked(False) self.ui.createButton.setEnabled(False) def slotReturnPressed(self): self.slotCreateUser()
class Widget(QtGui.QWidget, ScreenWidget): title = _('Goodbye from YALI') desc = _('Enjoy your freash Pardus !..') 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): QtGui.QWidget.__init__(self,None) self.ui = Ui_GoodByeWidget() self.ui.setupUi(self) self.steps = YaliSteps() def shown(self): ctx.mainScreen.disableBack() ctx.yali.processPendingActions(self) self.steps.slotRunOperations() def execute(self): ctx.mainScreen.disableNext() if not ctx.yali.install_type == YALI_FIRSTBOOT: try: ctx.debugger.log("Trying to umount %s" % (ctx.consts.target_dir + "/home")) yali4.sysutils.umount(ctx.consts.target_dir + "/home") ctx.debugger.log("Trying to umount %s" % (ctx.consts.target_dir)) yali4.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_() ctx.mainScreen.processEvents() ctx.yali.info.updateAndShow(_('<b>Rebooting system. Please wait!</b>')) # remove cd... if not ctx.yali.install_type == YALI_FIRSTBOOT: ctx.debugger.log("Trying to eject the CD.") yali4.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)) ctx.mainScreen.processEvents() time.sleep(4) yali4.sysutils.fastreboot()
class Widget(QtGui.QWidget, ScreenWidget): title = _('Bootloader Choice') desc = _('Configure the system boot..') help = _(''' <font size="+2">Boot loader setup</font> <font size="+1"> <p> Linux makes use of GRUB boot loader, which can boot the operating system of your taste during the start up. </p> <p> If you have more than one operating system, you can choose which operating system to boot also. </p> <p> Please refer to Pardus Installing and Using Guide for more information about GRUB boot loader. </p> </font> ''') def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_BootLoaderWidget() self.ui.setupUi(self) self.ui.installFirstMBR.setChecked(True) # initialize all storage devices if not yali4.storage.init_devices(): raise GUIException, _("Can't find a storage device!") if len(yali4.storage.devices) > 1: self.device_list_state = True # fill device list for dev in yali4.storage.devices: DeviceItem(self.ui.device_list, dev) # select the first disk by default self.ui.device_list.setCurrentRow(0) # be sure first is selected device self.device = self.ui.device_list.item(0).getDevice() else: # don't show device list if we have just one disk self.ui.installMBR.hide() self.device_list_state = False self.ui.device_list.hide() self.ui.select_disk_label.hide() self.device = yali4.storage.devices[0] self.connect(self.ui.device_list, SIGNAL("currentItemChanged(QListWidgetItem*,QListWidgetItem*)"), self.slotDeviceChanged) self.connect(self.ui.device_list, SIGNAL("itemClicked(QListWidgetItem*)"), self.slotSelect) def shown(self): if len(yali4.storage.devices) > 1: ctx.installData.orderedDiskList = yali4.storage.getOrderedDiskList() else: ctx.installData.orderedDiskList = yali4.storage.detect_all() ctx.debugger.log("Disks BIOS Boot order : %s " % ','.join(ctx.installData.orderedDiskList)) def backCheck(self): if ctx.autoInstall: # we need to go partition auto screen, not manual ;) ctx.mainScreen.moveInc = 2 return True def slotSelect(self): self.ui.installMBR.toggle() def slotDeviceChanged(self, o, n): self.device = o.getDevice() def execute(self): w = WarningWidget(self) # We need different warning messages for Auto and Manual Partitioning if ctx.installData.autoPartDev: # show confirmation dialog w.warning.setText(_('''<b> <p>This action will use your entire disk for Pardus installation and <br> all your present data on the selected disk will be lost.</p> </b> ''')) self.dialog = WarningDialog(w, self) if not self.dialog.exec_(): # disabled by weaver ctx.mainScreen.enableBack() return False ctx.mainScreen.processEvents() # We should do partitioning operations in here. if ctx.options.dryRun == True: ctx.debugger.log("dryRun activated Yali stopped") return # Auto Partitioning if ctx.installData.autoPartDev: ctx.use_autopart = True if ctx.installData.autoPartMethod == methodEraseAll: ctx.yali.autoPartDevice() ctx.yali.checkSwap() ctx.yali.info.updateMessage(_("Formatting ...")) ctx.mainScreen.processEvents() ctx.partrequests.applyAll() elif ctx.installData.autoPartMethod == methodUseAvail: ctx.yali.autoPartUseAvail() ctx.yali.checkSwap() ctx.yali.info.updateMessage(_("Formatting ...")) ctx.mainScreen.processEvents() ctx.partrequests.applyAll() # Manual Partitioning else: ctx.debugger.log("Format Operation Started") ctx.yali.info.updateAndShow(_("Writing disk tables ...")) for dev in yali4.storage.devices: ctx.mainScreen.processEvents() dev.commit() # wait for udev to create device nodes time.sleep(2) ctx.yali.checkSwap() ctx.yali.info.updateMessage(_("Formatting ...")) ctx.mainScreen.processEvents() ctx.partrequests.applyAll() ctx.debugger.log("Format Operation Finished") ctx.yali.info.hide() root_part_req = ctx.partrequests.searchPartTypeAndReqType(parttype.root, request.mountRequestType) # install_dev if self.ui.noInstall.isChecked(): ctx.installData.bootLoaderDev = None elif self.ui.installPart.isChecked(): ctx.installData.bootLoaderDev = basename(root_part_req.partition().getPath()) elif self.ui.installMBR.isChecked(): ctx.installData.bootLoaderDev = basename(self.device.getPath()) else: ctx.yali.guessBootLoaderDevice() _ins_part = root_part_req.partition().getPath() ctx.debugger.log("Pardus Root is : %s" % _ins_part) ctx.debugger.log("GRUB will be installing to : %s" % ctx.installData.bootLoaderDev) return True
def execute(self): w = WarningWidget(self) # We need different warning messages for Auto and Manual Partitioning if ctx.installData.autoPartDev: # show confirmation dialog w.warning.setText(_('''<b> <p>This action will use your entire disk for Pardus installation and <br> all your present data on the selected disk will be lost.</p> </b> ''')) self.dialog = WarningDialog(w, self) if not self.dialog.exec_(): # disabled by weaver ctx.mainScreen.enableBack() return False ctx.mainScreen.processEvents() # We should do partitioning operations in here. if ctx.options.dryRun == True: ctx.debugger.log("dryRun activated Yali stopped") return # Auto Partitioning if ctx.installData.autoPartDev: ctx.use_autopart = True if ctx.installData.autoPartMethod == methodEraseAll: ctx.yali.autoPartDevice() ctx.yali.checkSwap() ctx.yali.info.updateMessage(_("Formatting ...")) ctx.mainScreen.processEvents() ctx.partrequests.applyAll() elif ctx.installData.autoPartMethod == methodUseAvail: ctx.yali.autoPartUseAvail() ctx.yali.checkSwap() ctx.yali.info.updateMessage(_("Formatting ...")) ctx.mainScreen.processEvents() ctx.partrequests.applyAll() # Manual Partitioning else: ctx.debugger.log("Format Operation Started") ctx.yali.info.updateAndShow(_("Writing disk tables ...")) for dev in yali4.storage.devices: ctx.mainScreen.processEvents() dev.commit() # wait for udev to create device nodes time.sleep(2) ctx.yali.checkSwap() ctx.yali.info.updateMessage(_("Formatting ...")) ctx.mainScreen.processEvents() ctx.partrequests.applyAll() ctx.debugger.log("Format Operation Finished") ctx.yali.info.hide() root_part_req = ctx.partrequests.searchPartTypeAndReqType(parttype.root, request.mountRequestType) # install_dev if self.ui.noInstall.isChecked(): ctx.installData.bootLoaderDev = None elif self.ui.installPart.isChecked(): ctx.installData.bootLoaderDev = basename(root_part_req.partition().getPath()) elif self.ui.installMBR.isChecked(): ctx.installData.bootLoaderDev = basename(self.device.getPath()) else: ctx.yali.guessBootLoaderDevice() _ins_part = root_part_req.partition().getPath() ctx.debugger.log("Pardus Root is : %s" % _ins_part) ctx.debugger.log("GRUB will be installing to : %s" % ctx.installData.bootLoaderDev) return True
class Widget(QtGui.QWidget, ScreenWidget): title = _("Goodbye from YALI") desc = _("Enjoy your fresh Pardus !...") 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): QtGui.QWidget.__init__(self, None) self.ui = Ui_GoodByeWidget() self.ui.setupUi(self) self.steps = YaliSteps() def shown(self): ctx.mainScreen.disableNext() ctx.yali.info.updateAndShow(_("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.yali.info.hide() ctx.mainScreen.enableNext() def execute(self): ctx.mainScreen.disableNext() w = RebootWidget(self) ctx.debugger.log("Show reboot dialog.") self.dialog = WarningDialog(w, self) self.dialog.exec_() ctx.mainScreen.processEvents() ctx.yali.info.updateAndShow(_("<b>Rebooting system. Please wait!</b>")) # remove cd... if not ctx.yali.install_type == YALI_FIRSTBOOT: ctx.debugger.log("Trying to eject the CD.") yali4.sysutils.eject_cdrom() ctx.debugger.log("Yali, fastreboot calling..") ctx.mainScreen.processEvents() time.sleep(4) yali4.sysutils.fastreboot()