def __init__(self): QWidget.__init__(self) self.ui = Ui_SummaryWidget() self.ui.setupUi(self) self.ui.content.setText("") self.timer = QTimer() self.start_time = 0 try: self.connect(self.timer, SIGNAL("timeout()"), self.updateCounter) except: pass
def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_SummaryWidget() self.ui.setupUi(self) self.ui.content.setText("") self.timer = QTimer() try: self.connect(self.timer, SIGNAL("timeout()"), self.updateCounter) except: pass
def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_SummaryWidget() self.ui.setupUi(self) self.ui.content.setText("") self.timer = QTimer() # Handle translators tool problems .. try: #self.connect(self.ui.install, SIGNAL("clicked()"), ctx.mainScreen.slotNext) #self.connect(self.ui.cancel, SIGNAL("clicked()"), self.slotReboot) self.connect(self.timer, SIGNAL("timeout()"), self.updateCounter) except: pass
class Widget(QWidget, ScreenWidget): name = "summary" def __init__(self): QWidget.__init__(self) self.ui = Ui_SummaryWidget() self.ui.setupUi(self) self.ui.content.setText("") self.timer = QTimer() self.start_time = 0 try: self.connect(self.timer, SIGNAL("timeout()"), self.updateCounter) except: pass def slotReboot(self): reply = QuestionDialog(_("Restart"), _('''<b><p>Are you sure you want to restart the computer?</p></b>''')) if reply == "yes": yali.util.reboot() def startBombCounter(self): self.start_time = int(time.time()) self.timer.start(1000) def backCheck(self): self.timer.stop() ctx.interface.informationWindow.hide() if ctx.flags.install_type == ctx.STEP_BASE or ctx.flags.install_type == ctx.STEP_DEFAULT: ctx.mainScreen.ui.buttonNext.setText(_("Next")) if (ctx.flags.install_type == ctx.STEP_BASE or ctx.flags.install_type == ctx.STEP_DEFAULT) \ and not ctx.flags.collection: ctx.mainScreen.step_increment = 2 return True def updateCounter(self): remain = 20 - (int(time.time()) - self.start_time) ctx.interface.informationWindow.update(_("Installation starts in <b>%s</b> seconds") % remain) if remain <= 0: self.timer.stop() ctx.mainScreen.slotNext() def shown(self): #ctx.mainScreen.disableNext() if ctx.flags.install_type == ctx.STEP_BASE or ctx.flags.install_type == ctx.STEP_DEFAULT: ctx.mainScreen.ui.buttonNext.setText(_("Start Installation")) if ctx.flags.install_type == ctx.STEP_FIRST_BOOT: ctx.mainScreen.ui.buttonNext.setText(_("Apply Settings")) if ctx.installData.isKahyaUsed: self.startBombCounter() self.fillContent() def fillContent(self): subject = "<p><li><b>%s</b></li><ul>" item = "<li>%s</li>" end = "</ul></p>" content = QString("") content.append("""<html><body><ul>""") # Keyboard Layout if ctx.installData.keyData: content.append(subject % _("Keyboard Settings")) content.append(item % _("Selected keyboard layout is <b>%s</b>") % ctx.installData.keyData["name"]) content.append(end) # TimeZone if ctx.installData.timezone: content.append(subject % _("Date/Time Settings")) content.append(item % _("Selected TimeZone is <b>%s</b>") % ctx.installData.timezone) content.append(end) # Users if len(yali.users.PENDING_USERS) > 0: content.append(subject % _("User Settings")) for user in yali.users.PENDING_USERS: state = _("User %(username)s (<b>%(realname)s</b>) added.") if "wheel" in user.groups: state = _("User %(username)s (<b>%(realname)s</b>) added with <u>administrator privileges</u>.") content.append(item % state % {"username":user.realname, "realname":user.username}) content.append(end) # HostName if ctx.installData.hostName: content.append(subject % _("Hostname Settings")) content.append(item % _("Hostname is set as <b>%s</b>") % ctx.installData.hostName) content.append(end) # Partition if ctx.storage.clearPartType is not None: content.append(subject % _("Partition Settings")) devices = "" for disk in ctx.storage.clearPartDisks: device = ctx.storage.devicetree.getDeviceByName(disk) devices += "(%s on %s)" % (device.model, device.name) if ctx.storage.doAutoPart: content.append(item % _("Automatic Partitioning selected.")) if ctx.storage.clearPartType == CLEARPART_TYPE_ALL: content.append(item % _("Use All Space")) content.append(item % _("Removes all partitions on the selected "\ "%s device(s). <b><u>This includes partitions "\ "created by other operating systems.</u></b>") % devices) elif ctx.storage.clearPartType == CLEARPART_TYPE_LINUX: content.append(item % _("Replace Existing Linux System(s)")) content.append(item % _("Removes all Linux partitions on the selected" \ "%s device(s). This does not remove "\ "other partitions you may have on your " \ "storage device(s) (such as VFAT or FAT32)") % devices) elif ctx.storage.clearPartType == CLEARPART_TYPE_NONE: content.append(item % _("Use Free Space")) content.append(item % _("Retains your current data and partitions" \ " and uses only the unpartitioned space on " \ "the selected %s device(s), assuming you have "\ "enough free space available.") % devices) else: content.append(item % _("Manual Partitioning selected.")) for operation in ctx.storage.devicetree.operations: content.append(item % operation) content.append(end) # Bootloader if ctx.bootloader.stage1Device: content.append(subject % _("Bootloader Settings")) grubstr = _("GRUB will be installed to <b>%s</b>.") if ctx.bootloader.bootType == BOOT_TYPE_NONE: content.append(item % _("GRUB will not be installed.")) else: content.append(item % grubstr % ctx.bootloader.stage1Device) content.append(end) if ctx.flags.collection and ctx.installData.autoCollection: content.append(subject % _("Package Installation Settings")) content.append(item % _("Collection <b>%s</b> selected") % ctx.installData.autoCollection.title) content.append(end) content.append("""</ul></body></html>""") self.ui.content.setHtml(content) def execute(self): self.timer.stop() if ctx.flags.dryRun: ctx.logger.debug("dryRun activated Yali stopped") ctx.mainScreen.enableBack() return False if ctx.flags.install_type == ctx.STEP_BASE or ctx.flags.install_type == ctx.STEP_DEFAULT: self.createPackageList() rc = ctx.interface.messageWindow(_("Confirm"), _("The partitioning options you have selected " "will now be written to disk. Any " "data on deleted or reformatted partitions " "will be lost."), type = "custom", customIcon="question", customButtons=[_("Write Changes to Disk"), _("Go Back")], default=1) ctx.mainScreen.processEvents() if not rc: if yali.storage.complete(ctx.storage, ctx.interface): ctx.storage.turnOnSwap() ctx.storage.mountFilesystems(readOnly=False, skipRoot=False) ctx.mainScreen.step_increment = 1 ctx.mainScreen.ui.buttonNext.setText(_("Next")) return True ctx.mainScreen.enableBack() return False elif ctx.flags.install_type == ctx.STEP_FIRST_BOOT: ctx.mainScreen.ui.buttonNext.setText(_("Next")) return True # Auto Partitioning #if not ctx.storage.storageset.swapDevices: # size = 0 # if yali.util.memInstalled() > 512: # size = 300 # else: # size = 600 # ctx.storage.storageset.createSwapFile(ctx.storage.storageset.rootDevice, ctx.consts.target_dir, size) def createPackageList(self): ctx.logger.debug("Generating package list...") if ctx.flags.collection: # Get only collection packages with collection Name packages = yali.pisiiface.getAllPackagesWithPaths( collectionIndex=ctx.installData.autoCollection.index) else: # Check for just installing system.base packages if ctx.flags.baseonly: packages = yali.pisiiface.getBasePackages() else: packages = yali.pisiiface.getAllPackagesWithPaths() # Check for extra languages packages = list(set(packages) - set(yali.pisiiface.getNotNeededLanguagePackages())) ctx.logger.debug("Not needed lang packages will not be installing...") packages = self.filterDriverPacks(packages) packages.sort() # Place baselayout package on the top of package list baselayout = None for path in packages: if "/baselayout-" in path: baselayout = packages.index(path) break if baselayout: packages.insert(0, packages.pop(baselayout)) ctx.packagesToInstall = packages def filterDriverPacks(self, paths): try: from panda import Panda except ImportError: ctx.logger.debug("Installing all driver packages since panda module is not installed.") return paths panda = Panda() # filter all driver packages foundDriverPackages = set(yali.pisiiface.getPathsByPackageName(panda.get_all_driver_packages())) ctx.logger.debug("Found driver packages: %s" % foundDriverPackages) allPackages = set(paths) packages = allPackages - foundDriverPackages # detect hardware neededDriverPackages = set(yali.pisiiface.getPathsByPackageName(panda.get_needed_driver_packages())) ctx.logger.debug("Known driver packages for this hardware: %s" % neededDriverPackages) # if alternatives are available ask to user, otherwise return if neededDriverPackages and neededDriverPackages.issubset(allPackages): answer = ctx.interface.messageWindow( _("Proprietary Hardware Drivers"), _("<qt>Proprietary drivers are available which may be required " "to utilize the full capabilities of your video card. " "These drivers are developed by the hardware manufacturer " "and not supported by Pardus developers since their " "source code is not publicly available." "<br><br>" "<b>Do you want to install and use these proprietary drivers " "instead of the default drivers?</b></qt>"), type="custom", customIcon="question", customButtons=[_("Yes"), _("No")]) if answer == 0: packages.update(neededDriverPackages) ctx.blacklistedKernelModules.append(panda.get_blacklisted_module()) ctx.logger.debug("These driver packages will be installed: %s" % neededDriverPackages) return list(packages)
class Widget(QWidget, ScreenWidget): name = "summary" def __init__(self): QWidget.__init__(self) self.ui = Ui_SummaryWidget() self.ui.setupUi(self) self.ui.content.setText("") self.timer = QTimer() self.start_time = 0 try: self.connect(self.timer, SIGNAL("timeout()"), self.updateCounter) except: pass def slotReboot(self): reply = QuestionDialog( _("Restart"), _('''<b><p>Are you sure you want to restart the computer?</p></b>''' )) if reply == "yes": yali.util.reboot() def startBombCounter(self): self.start_time = int(time.time()) self.timer.start(1000) def backCheck(self): self.timer.stop() ctx.interface.informationWindow.hide() if ctx.flags.install_type == ctx.STEP_BASE or ctx.flags.install_type == ctx.STEP_DEFAULT: ctx.mainScreen.ui.buttonNext.setText(_("Next")) if (ctx.flags.install_type == ctx.STEP_BASE or ctx.flags.install_type == ctx.STEP_DEFAULT) \ and not ctx.flags.collection: ctx.mainScreen.step_increment = 2 return True def updateCounter(self): remain = 20 - (int(time.time()) - self.start_time) ctx.interface.informationWindow.update( _("Installation starts in <b>%s</b> seconds") % remain) if remain <= 0: self.timer.stop() ctx.mainScreen.slotNext() def shown(self): #ctx.mainScreen.disableNext() if ctx.flags.install_type == ctx.STEP_BASE or ctx.flags.install_type == ctx.STEP_DEFAULT: ctx.mainScreen.ui.buttonNext.setText(_("Start Installation")) if ctx.flags.install_type == ctx.STEP_FIRST_BOOT: ctx.mainScreen.ui.buttonNext.setText(_("Apply Settings")) if ctx.installData.isKahyaUsed: self.startBombCounter() self.fillContent() def fillContent(self): subject = "<p><li><b>%s</b></li><ul>" item = "<li>%s</li>" end = "</ul></p>" content = QString("") content.append("""<html><body><ul>""") # Keyboard Layout if ctx.installData.keyData: content.append(subject % _("Keyboard Settings")) content.append(item % _("Selected keyboard layout is <b>%s</b>") % ctx.installData.keyData["name"]) content.append(end) # TimeZone if ctx.installData.timezone: content.append(subject % _("Date/Time Settings")) content.append(item % _("Selected TimeZone is <b>%s</b>") % ctx.installData.timezone) content.append(end) # Users if len(yali.users.PENDING_USERS) > 0: content.append(subject % _("User Settings")) for user in yali.users.PENDING_USERS: state = _("User %(username)s (<b>%(realname)s</b>) added.") if "wheel" in user.groups: state = _( "User %(username)s (<b>%(realname)s</b>) added with <u>administrator privileges</u>." ) content.append(item % state % { "username": user.realname, "realname": user.username }) content.append(end) # HostName if ctx.installData.hostName: content.append(subject % _("Hostname Settings")) content.append(item % _("Hostname is set as <b>%s</b>") % ctx.installData.hostName) content.append(end) # Partition if ctx.storage.clearPartType is not None: content.append(subject % _("Partition Settings")) devices = "" for disk in ctx.storage.clearPartDisks: device = ctx.storage.devicetree.getDeviceByName(disk) devices += "(%s on %s)" % (device.model, device.name) if ctx.storage.doAutoPart: content.append(item % _("Automatic Partitioning selected.")) if ctx.storage.clearPartType == CLEARPART_TYPE_ALL: content.append(item % _("Use All Space")) content.append(item % _("Removes all partitions on the selected "\ "%s device(s). <b><u>This includes partitions "\ "created by other operating systems.</u></b>") % devices) elif ctx.storage.clearPartType == CLEARPART_TYPE_LINUX: content.append(item % _("Replace Existing Linux System(s)")) content.append(item % _("Removes all Linux partitions on the selected" \ "%s device(s). This does not remove "\ "other partitions you may have on your " \ "storage device(s) (such as VFAT or FAT32)") % devices) elif ctx.storage.clearPartType == CLEARPART_TYPE_NONE: content.append(item % _("Use Free Space")) content.append(item % _("Retains your current data and partitions" \ " and uses only the unpartitioned space on " \ "the selected %s device(s), assuming you have "\ "enough free space available.") % devices) else: content.append(item % _("Manual Partitioning selected.")) for operation in ctx.storage.devicetree.operations: content.append(item % operation) content.append(end) # Bootloader if ctx.bootloader.stage1Device: content.append(subject % _("Bootloader Settings")) grubstr = _("GRUB will be installed to <b>%s</b>.") if ctx.bootloader.bootType == BOOT_TYPE_NONE: content.append(item % _("GRUB will not be installed.")) else: content.append(item % grubstr % ctx.bootloader.stage1Device) content.append(end) if ctx.flags.collection and ctx.installData.autoCollection: content.append(subject % _("Package Installation Settings")) content.append(item % _("Collection <b>%s</b> selected") % ctx.installData.autoCollection.title) content.append(end) content.append("""</ul></body></html>""") self.ui.content.setHtml(content) def execute(self): self.timer.stop() if ctx.flags.dryRun: ctx.logger.debug("dryRun activated Yali stopped") ctx.mainScreen.enableBack() return False if ctx.flags.install_type == ctx.STEP_BASE or ctx.flags.install_type == ctx.STEP_DEFAULT: self.createPackageList() rc = ctx.interface.messageWindow( _("Confirm"), _("The partitioning options you have selected " "will now be written to disk. Any " "data on deleted or reformatted partitions " "will be lost."), type="custom", customIcon="question", customButtons=[_("Write Changes to Disk"), _("Go Back")], default=1) ctx.mainScreen.processEvents() if not rc: if yali.storage.complete(ctx.storage, ctx.interface): ctx.storage.turnOnSwap() ctx.storage.mountFilesystems(readOnly=False, skipRoot=False) ctx.mainScreen.step_increment = 1 ctx.mainScreen.ui.buttonNext.setText(_("Next")) return True ctx.mainScreen.enableBack() return False elif ctx.flags.install_type == ctx.STEP_FIRST_BOOT: ctx.mainScreen.ui.buttonNext.setText(_("Next")) return True # Auto Partitioning #if not ctx.storage.storageset.swapDevices: # size = 0 # if yali.util.memInstalled() > 512: # size = 300 # else: # size = 600 # ctx.storage.storageset.createSwapFile(ctx.storage.storageset.rootDevice, ctx.consts.target_dir, size) def createPackageList(self): ctx.logger.debug("Generating package list...") if ctx.flags.collection: # Get only collection packages with collection Name packages = yali.pisiiface.getAllPackagesWithPaths( collectionIndex=ctx.installData.autoCollection.index) else: # Check for just installing system.base packages if ctx.flags.baseonly: packages = yali.pisiiface.getBasePackages() else: packages = yali.pisiiface.getAllPackagesWithPaths() # Check for extra languages packages = list( set(packages) - set(yali.pisiiface.getNotNeededLanguagePackages())) ctx.logger.debug("Not needed lang packages will not be installing...") packages = self.filterDriverPacks(packages) packages.sort() # Place baselayout package on the top of package list baselayout = None for path in packages: if "/baselayout-" in path: baselayout = packages.index(path) break if baselayout: packages.insert(0, packages.pop(baselayout)) ctx.packagesToInstall = packages def filterDriverPacks(self, paths): try: from panda import Panda except ImportError: ctx.logger.debug( "Installing all driver packages since panda module is not installed." ) return paths panda = Panda() # filter all driver packages foundDriverPackages = set( yali.pisiiface.getPathsByPackageName( panda.get_all_driver_packages())) ctx.logger.debug("Found driver packages: %s" % foundDriverPackages) allPackages = set(paths) packages = allPackages - foundDriverPackages # detect hardware neededDriverPackages = set( yali.pisiiface.getPathsByPackageName( panda.get_needed_driver_packages())) ctx.logger.debug("Known driver packages for this hardware: %s" % neededDriverPackages) # if alternatives are available ask to user, otherwise return if neededDriverPackages and neededDriverPackages.issubset(allPackages): answer = ctx.interface.messageWindow( _("Proprietary Hardware Drivers"), _("<qt>Proprietary drivers are available which may be required " "to utilize the full capabilities of your video card. " "These drivers are developed by the hardware manufacturer " "and not supported by Pisi Linux developers since their " "source code is not publicly available." "<br><br>" "<b>Do you want to install and use these proprietary drivers " "instead of the default drivers?</b></qt>"), type="custom", customIcon="question", customButtons=[_("Yes"), _("No")]) if answer == 0: packages.update(neededDriverPackages) ctx.blacklistedKernelModules.append( panda.get_blacklisted_module()) ctx.logger.debug( "These driver packages will be installed: %s" % neededDriverPackages) return list(packages)
class Widget(QtGui.QWidget, ScreenWidget): title = _("Summary") # icon = "iconKeyboard" helpSummary = _("") help = _( """ <p> Here you can see your install options before installation starts. </p> """ ) def __init__(self, *args): QtGui.QWidget.__init__(self, None) self.ui = Ui_SummaryWidget() self.ui.setupUi(self) self.ui.content.setText("") self.timer = QTimer() try: self.connect(self.timer, SIGNAL("timeout()"), self.updateCounter) except: pass def slotReboot(self): reply = QuestionDialog(_("Restart"), _("""<b><p>Are you sure you want to restart the computer?</p></b>""")) if reply == "yes": yali.util.reboot() def startBombCounter(self): self.startTime = int(time.time()) self.timer.start(1000) def backCheck(self): self.timer.stop() ctx.interface.informationWindow.hide() ctx.mainScreen.ui.buttonNext.setText(_("Next")) return True def updateCounter(self): remain = 20 - (int(time.time()) - self.startTime) ctx.interface.informationWindow.update(_("Installation starts in <b>%s</b> seconds") % remain) if remain <= 0: self.timer.stop() ctx.mainScreen.slotNext() def shown(self): # ctx.mainScreen.disableNext() ctx.mainScreen.ui.buttonNext.setText(_("Start Installation")) if ctx.installData.isKahyaUsed: self.startBombCounter() self.fillContent() # FIXME Later self.ui.installAllLangPacks.setChecked(True) self.ui.installAllLangPacks.hide() def fillContent(self): subject = "<p><li><b>%s</b></li><ul>" item = "<li>%s</li>" end = "</ul></p>" content = QString("") content.append("""<html><body><ul>""") # Plugin Summary if ctx.yali.install_type == YALI_PLUGIN: try: _summary = ctx.yali.plugin.config.getSummary() content.append(subject % _summary["subject"]) for _item in _summary["items"]: content.append(item % _item) content.append(end) except: pass # Keyboard Layout if ctx.installData.keyData: content.append(subject % _("Keyboard Settings")) content.append(item % _("Selected keyboard layout is <b>%s</b>") % ctx.installData.keyData["name"]) content.append(end) # TimeZone content.append(subject % _("Date/Time Settings")) content.append(item % _("Selected TimeZone is <b>%s</b>") % ctx.installData.timezone) content.append(end) # Users if len(yali.users.pending_users) > 0: content.append(subject % _("User Settings")) for user in yali.users.pending_users: state = _("User %s (<b>%s</b>) added.") if "wheel" in user.groups: state = _("User %s (<b>%s</b>) added with <u>administrator privileges</u>.") content.append(item % state % (user.realname, user.username)) content.append(end) # HostName if ctx.installData.hostName: content.append(subject % _("Hostname Settings")) content.append(item % _("Hostname is set as <b>%s</b>") % ctx.installData.hostName) content.append(end) # Partition self.resizeAction = ctx.storage.devicetree.findOperations(type="resize") content.append(subject % _("Partition Settings")) if ctx.storage.doAutoPart: summary = "" devices = "" for disk in ctx.storage.clearPartDisks: device = ctx.storage.devicetree.getDeviceByName(disk) devices += "(%s on %s)" % (device.model, device.name) content.append(item % _("Automatic Partitioning selected.")) if ctx.storage.clearPartType == CLEARPART_TYPE_ALL: content.append(item % _("Use All Space")) content.append( item % _( "Removes all partitions on the selected" "%s device(s). This includes partitions " "created by other operating systems." ) % devices ) elif ctx.storage.clearPartType == CLEARPART_TYPE_LINUX: content.append(item % _("Replace Existing Linux System(s)")) content.append( item % _( "Removes all Linux partitions on the selected" "%s device(s). This does not remove " "other partitions you may have on your " "storage device(s) (such as VFAT or FAT32)" ) % devices ) elif ctx.storage.clearPartType == CLEARPART_TYPE_NONE: content.append(item % _("Use Free Space")) content.append( item % _( "Retains your current data and partitions" " and uses only the unpartitioned space on " "the selected %s device(s), assuming you have" "enough free space available." ) % devices ) else: content.append(item % _("Manual Partitioning selected.")) for operation in ctx.storage.devicetree.operations: content.append(item % operation) content.append(end) # Bootloader content.append(subject % _("Bootloader Settings")) grubstr = _("GRUB will be installed to <b>%s</b>.") if ctx.bootloader.bootType == BOOT_TYPE_NONE: content.append(item % _("GRUB will not be installed.")) else: content.append(item % grubstr % ctx.bootloader.device) content.append(end) if ctx.yali.install_type == YALI_DVDINSTALL: # DVD INSTALL content.append(subject % _("Package Installation Settings")) # installation_str = _("Installation Collection <b>%s</b> installed.") if ctx.installData.autoInstallationMethod == methodInstallAutomatic: content.append(item % _("Auto installation selected.")) else: content.append( item % _("Manual Installation ( %s ) selected" % ctx.installData.autoInstallationCollection.title) ) if ctx.installData.autoInstallationKernel == defaultKernel: content.append(item % _("Default Kernel selected")) elif ctx.installData.autoInstallationKernel == paeKernel: content.append(item % _("PAE Kernel selected")) # elif ctx.installData.autoInstallationKernel == rtKernel: # content.append(item % _("Real Time Kernel selected")) content.append(end) content.append("""</ul></body></html>""") self.ui.content.setHtml(content) def execute(self): # Just store normal installation session # if ctx.yali.install_type == YALI_INSTALL: # ctx.yali.backupInstallData() self.timer.stop() rc = ctx.interface.messageWindow( _("Confirm"), _( "The partitioning options you have selected" "will now be\nwritten to disk. Any" "data on deleted or reformatted partitions\n" "will be lost." ), type="custom", customIcon="question", customButtons=[_("Write Changes to Disk"), _("Go Back")], default=1, ) if not rc: ctx.storage.devicetree.teardownAll() else: ctx.mainScreen.enableBack() return False ctx.installData.installAllLangPacks = self.ui.installAllLangPacks.isChecked() ctx.mainScreen.processEvents() if ctx.options.dryRun == True: ctx.logger.debug("dryRun activated Yali stopped") return False # Auto Partitioning # if not ctx.storage.storageset.swapDevices: # size = 0 # if yali.util.memInstalled() > 512: # size = 300 # else: # size = 600 # ctx.storage.storageset.createSwapFile(ctx.storage.storageset.rootDevice, ctx.consts.target_dir, size) if ctx.storage.doAutoPart: ctx.interface.informationWindow.update(_("Auto partitioning...")) ctx.logger.debug("Auto partitioning") else: ctx.interface.informationWindow.update(_("Manual partitioning...")) ctx.logger.debug("Manual partitioning...") ctx.interface.informationWindow.hide() ctx.yali.storageComplete() ctx.interface.informationWindow.update(_("Partitioning finished...")) ctx.logger.debug("Partitioning finished") ctx.interface.informationWindow.hide() ctx.mainScreen.stepIncrement = 1 ctx.mainScreen.ui.buttonNext.setText(_("Next")) return True
class Widget(QtGui.QWidget, ScreenWidget): title = _("Summary") #icon = "iconKeyboard" help = _(''' <font size="+2">Installation Summary</font> <font size="+1"> <p> Here you can see your install options before installation starts. </p> </font> ''') def __init__(self, *args): QtGui.QWidget.__init__(self,None) self.ui = Ui_SummaryWidget() self.ui.setupUi(self) self.ui.content.setText("") self.timer = QTimer() # Handle translators tool problems .. try: #self.connect(self.ui.install, SIGNAL("clicked()"), ctx.mainScreen.slotNext) #self.connect(self.ui.cancel, SIGNAL("clicked()"), self.slotReboot) self.connect(self.timer, SIGNAL("timeout()"), self.updateCounter) except: pass def slotReboot(self): reply = QuestionDialog(_("Restart"), _('''<b><p>Are you sure you want to restart the computer?</p></b>''')) if reply == "yes": yali.sysutils.reboot() def startBombCounter(self): self.startTime = int(time.time()) self.timer.start(1000) def backCheck(self): self.timer.stop() ctx.yali.info.hide() ctx.mainScreen.ui.buttonNext.setText(_("Next")) return True def updateCounter(self): remain = 20 - (int(time.time()) - self.startTime) ctx.yali.info.updateAndShow(_("Installation starts in <b>%s</b> seconds") % remain) if remain <= 0: self.timer.stop() ctx.mainScreen.slotNext() def shown(self): #ctx.mainScreen.disableNext() ctx.mainScreen.ui.buttonNext.setText(_("Start Installation")) if ctx.installData.isKahyaUsed: self.startBombCounter() self.fillContent() # FIXME Later self.ui.installAllLangPacks.setChecked(True) self.ui.installAllLangPacks.hide() def fillContent(self): subject = "<p><li><b>%s</b></li><ul>" item = "<li>%s</li>" end = "</ul></p>" content = QString("") content.append("""<html><body><ul>""") # Plugin Summary if ctx.yali.install_type == YALI_PLUGIN: try: _summary = ctx.yali.plugin.config.getSummary() content.append(subject % _summary["subject"]) for _item in _summary["items"]: content.append(item % _item) content.append(end) except: pass # Keyboard Layout if ctx.installData.keyData: content.append(subject % _("Keyboard Settings")) content.append(item % _("Selected keyboard layout is <b>%s</b>") % ctx.installData.keyData["name"]) content.append(end) # TimeZone content.append(subject % _("Date/Time Settings")) content.append(item % _("Selected TimeZone is <b>%s</b>") % ctx.installData.timezone) content.append(end) # Users if len(yali.users.pending_users)>0: content.append(subject % _("User Settings")) for user in yali.users.pending_users: state = _("User %s (<b>%s</b>) added.") if "wheel" in user.groups: state = _("User %s (<b>%s</b>) added with <u>administrator privileges</u>.") content.append(item % state % (user.realname, user.username)) content.append(end) # HostName if ctx.installData.hostName: content.append(subject % _("Hostname Settings")) content.append(item % _("Hostname is set as <b>%s</b>") % ctx.installData.hostName) content.append(end) # Partition pardus_path = None self.resizeAction = False content.append(subject % _("Partition Settings")) if ctx.installData.autoPartMethod == methodEraseAll: content.append(item % _("Automatic Partitioning selected.")) dev = ctx.installData.autoPartDev _sum = {"device":dev.getModel(), "partition":dev.getName()+"1", "size":dev.getTotalMB(), "fs":parttype.root.filesystem.name(), "type":parttype.root.name} pardus_path = dev.getPath()+"1" content.append(item % _("All partitions on device <b>%(device)s</b> has been deleted.") % _sum) content.append(item % _("Partition <b>%(partition)s</b> <b>added</b> to device <b>%(device)s</b> with <b>%(size)s MBs</b> as <b>%(fs)s</b>.") % _sum) content.append(item % _("Partition <b>%(partition)s</b> <b>selected</b> as <b>%(type)s</b>.") % _sum) elif ctx.installData.autoPartMethod == methodUseAvail: dev = ctx.installData.autoPartDev _part = ctx.installData.autoPartPartition part = _part["partition"] pardus_path = "%s%s" % (dev.getPath(), int(part._minor)+1) if part.isFreespace(): _sum = {"device":dev.getModel(), "partition":part.getName(), "newPartition":part.getName(), "size":part.getMB(), "currentFs":part._fsname, "fs":parttype.root.filesystem.name(), "type":parttype.root.name} else: content.append(item % _("Automatic Partitioning (resize method) selected.")) self.resizeAction = True newPartSize = int(_part["newSize"]/2) ctx.debugger.log("UA: newPartSize : %s " % newPartSize) resizeTo = int(part.getMB()) - newPartSize _sum = {"device":dev.getModel(), "partition":part.getName(), "newPartition":"%s%s" % (part.getName()[:-1],int(part._minor)+1), "size":newPartSize, "currentFs":part._fsname, "fs":parttype.root.filesystem.name(), "type":parttype.root.name, "currentSize":part.getMB(), "resizeTo":resizeTo} content.append(item % _("Partition <b>%(partition)s - %(currentFs)s</b> <b>resized</b> to <b>%(resizeTo)s MBs</b>, previous size was <b>%(currentSize)s MBs</b>.") % _sum) content.append(item % _("Partition <b>%(newPartition)s</b> <b>added</b> to device <b>%(device)s</b> with <b>%(size)s MBs</b> as <b>%(fs)s</b>.") % _sum) content.append(item % _("Partition <b>%(newPartition)s</b> <b>selected</b> as <b>%(type)s</b>.") % _sum) else: for operation in ctx.partSum: content.append(item % operation) content.append(end) # Find BootLoader Device if not pardus_path: # manual partitioning gives us new grub target root_part_req = ctx.partrequests.searchPartTypeAndReqType(parttype.root, request.mountRequestType) pardus_path = root_part_req.partition().getPath() # Bootloader content.append(subject % _("Bootloader Settings")) grub_str = _("GRUB will be installed to <b>%s</b>.") if ctx.installData.bootLoaderOption == B_DONT_INSTALL: content.append(item % _("GRUB will not be installed.")) elif ctx.installData.bootLoaderOption == B_INSTALL_PART: content.append(item % grub_str % pardus_path) elif ctx.installData.bootLoaderOption == B_INSTALL_MBR: content.append(item % grub_str % ctx.installData.bootLoaderOptionalDev.getPath()) else: _path = ctx.yali.guessBootLoaderDevice(pardus_path) if not _path.startswith("/dev"): _path = "/dev/" + _path content.append(item % grub_str % _path) content.append(end) if ctx.yali.install_type == YALI_DVDINSTALL: # DVD INSTALL content.append(subject % _("Package Installation Settings")) #installation_str = _("Installation Collection <b>%s</b> installed.") if ctx.installData.autoInstallationMethod == methodInstallAutomatic: content.append(item % _("Auto installation selected.")) else: content.append(item % _("Manual Installation ( %s ) selected" % ctx.installData.autoInstallationCollection.title)) if ctx.installData.autoInstallationKernel == defaultKernel: content.append(item % _("Default Kernel selected")) elif ctx.installData.autoInstallationKernel == paeKernel: content.append(item % _("PAE Kernel selected")) #elif ctx.installData.autoInstallationKernel == rtKernel: # content.append(item % _("Real Time Kernel selected")) content.append(end) content.append("""</ul></body></html>""") self.ui.content.setHtml(content) def execute(self): # Just store normal installation session if ctx.yali.install_type == 0: ctx.yali.backupInstallData() self.timer.stop() if self.resizeAction: reply = QuestionDialog(_("Before Starting"), _("""<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>""")) if reply == "no": ctx.mainScreen.moveInc = 0 return #self.ui.install.setEnabled(False) #self.ui.cancel.setEnabled(False) ctx.installData.installAllLangPacks = self.ui.installAllLangPacks.isChecked() 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 yali.storage.devices: ctx.mainScreen.processEvents() if dev._needs_commit: ctx.debugger.log("Parted Device.commit() calling...") 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 installed to %s" % ctx.installData.bootLoaderDev) ctx.mainScreen.moveInc = 1 ctx.mainScreen.ui.buttonNext.setText(_("Next")) return True