def on_back_clicked(self, button): # Clear any existing errors self.clear_errors() # If back has been clicked on once already and no other changes made on the screen, # run the storage check now. This handles displaying any errors in the info bar. if not self._back_already_clicked: self._back_already_clicked = True # If we hit any errors while saving things above, stop and let the # user think about what they have done if self._error is not None: return if not self._do_check(): return if len(self._storage_playground.devicetree.actions.find()) > 0: dialog = ActionSummaryDialog(self.data) dialog.refresh(self._storage_playground.devicetree.actions.find()) with self.main_window.enlightbox(dialog.window): rc = dialog.run() if rc != 1: # Cancel. Stay on the blivet-gui screen. return else: # remove redundant actions and sort them now self._storage_playground.devicetree.actions.prune() self._storage_playground.devicetree.actions.sort() NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): # Clear any existing errors self.clear_errors() # If back has been clicked on once already and no other changes made on the screen, # run the storage check now. This handles displaying any errors in the info bar. if not self._back_already_clicked: self._back_already_clicked = True # If we hit any errors while saving things above, stop and let the # user think about what they have done if self._error is not None: return if not self._do_check(): return dialog = ActionSummaryDialog(self.data, self._device_tree) dialog.refresh() if dialog.actions: with self.main_window.enlightbox(dialog.window): rc = dialog.run() if rc != 1: # Cancel. Stay on the blivet-gui screen. return NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): username = self.username.get_text() # if an invalid username was given, that's the biggest issue if username and not USERNAME_VALID.match(username): self.clear_info() self.set_warning(_("Invalid username")) self.username.grab_focus() self.window.show_all() # Return if: # - no user is requested (empty username) # - no password is required # - password is set by kickstart and password text entry is empty # - password is set by dialog and _validatePassword returns True elif not username or \ not self.usepassword.get_active() or \ (self.pw.get_text() == "" and \ self.pw.get_text() == self.confirm.get_text() and \ self._user.password_kickstarted) or \ self._validatePassword(): self._error = False self.clear_info() NormalSpoke.on_back_clicked(self, button) # Show the confirmation message if the password is not acceptable else: self.clear_info() self.set_warning(self._error) self.pw.grab_focus() self.window.show_all()
def on_back_clicked(self, button): if self._back_clicked: return # Skip if user is clicking multiple times on the back button. self._back_clicked = True # Clear the current warning message if any. self.clear_info() # No disks selected? The user wants to back out of the storage spoke. if not self._selected_disks: NormalSpoke.on_back_clicked(self, button) return # Reset to a snapshot if necessary. self._reset_to_snapshot() # The disk selection has to make sense before we can proceed. if not self._check_disk_selection(): self._back_clicked = False return # Check for unsupported DASDs. rc = self._check_dasd_formats() if rc == DASD_FORMAT_NO_CHANGE: pass elif rc == DASD_FORMAT_REFRESH: # User hit OK on the dialog self.refresh() elif rc == DASD_FORMAT_RETURN_TO_HUB: # User clicked uri to return to hub. NormalSpoke.on_back_clicked(self, button) return else: # User either hit cancel on the dialog or closed # it via escape, there was no formatting done. self._back_clicked = False return # Handle the partitioning. partitioning_method = self._get_selected_partitioning_method() self._last_partitioning_method = partitioning_method if partitioning_method == PARTITIONING_METHOD_AUTOMATIC: self._skip_to_automatic_partitioning() return if partitioning_method == PARTITIONING_METHOD_INTERACTIVE: self._skip_to_spoke("CustomPartitioningSpoke") return if partitioning_method == PARTITIONING_METHOD_BLIVET: self._skip_to_spoke("BlivetGuiSpoke") return self._back_clicked = False return
def on_back_clicked(self, button): """If the user entered duplicate repo names, keep them on the screen. Otherwise, do the usual thing.""" ui_repo_names = [r[REPO_OBJ].name for r in self._repoStore] if len(ui_repo_names) != len(frozenset(ui_repo_names)): return else: NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): if self._validatePassword(): self.clear_info() NormalSpoke.on_back_clicked(self, button) else: self.clear_info() self.set_warning(self._error) self.pw.grab_focus() self.window.show_all()
def on_back_clicked(self, button): # Add a click and re-check the password strength self._waivePasswordClicks += 1 self._pwStrengthCheck.update_check_status() # If there is no user set, skip the checks if not self.username.get_text(): for check in self.checks: check.disable() NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): # Add a click and re-check the password strength self._waivePasswordClicks += 1 self._pwStrengthCheck.update_check_status() # If neither the password nor the confirm field are set, skip the checks if (not self.pw.get_text()) and (not self.confirm.get_text()): for check in self.checks: check.disable() NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, *args): pw = self._pwEntry.get_text() confirm = self._confirmEntry.get_text() if pw != confirm: self.set_error(_("Passwords do not match")) self.window.show_all() self._confirmEntry.grab_focus() return NormalSpoke.on_back_clicked(self, *args)
def on_specialized_clicked(self, button): # Don't want to run apply or execute in this case, since we have to # collect some more disks first. The user will be back to this spoke. self.applyOnSkip = False # However, we do want to apply current selections so the disk cart off # the filter spoke will display the correct information. self._applyDiskSelection(self.selected_disks) self.skipTo = "FilterSpoke" NormalSpoke.on_back_clicked(self, button)
def on_specialized_clicked(self, button): # Don't want to run apply or execute in this case, since we have to # collect some more disks first. The user will be back to this spoke. self.applyOnSkip = False # However, we do want to apply current selections so the disk cart off # the filter spoke will display the correct information. apply_disk_selection(self._selected_disks) self.skipTo = "FilterSpoke" NormalSpoke.on_back_clicked(self, button)
def _skip_to_spoke(self, name, apply_on_skip=True): """Skip to a spoke. The user has requested to skip to different spoke or to the summary hub. :param name: a name of the spoke or None to return to the hub :param apply_on_skip: should we call apply? """ self.skipTo = name self.applyOnSkip = apply_on_skip NormalSpoke.on_back_clicked(self, None)
def on_back_clicked(self, button): # disable root if no password is entered if not self.password and not self.password_confirmation and \ not self._users_module.IsRootPasswordSet: control = self._disable_root_radio control.set_active(True) self.on_root_enabled_changed(control) # the GUI spoke input check handler handles the rest of the spoke exit logic for us if self.try_to_go_back() or not self.root_enabled: NormalSpoke.on_back_clicked(self, button) else: log.info("Return to hub prevented by password checking rules.")
def on_specialized_clicked(self, button): # there will be changes in disk selection, revert storage to an early snapshot (if it exists) if on_disk_storage.created: on_disk_storage.reset_to_snapshot(self.storage) # Don't want to run apply or execute in this case, since we have to # collect some more disks first. The user will be back to this spoke. self.applyOnSkip = False # However, we do want to apply current selections so the disk cart off # the filter spoke will display the correct information. applyDiskSelection(self.storage, self.data, self.selected_disks) self.skipTo = "FilterSpoke" NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): # If the failed check is for non-ASCII characters, # add a click to the counter and check again failed_check = next(self.failed_checks_with_message, None) if not self.policy.strict and failed_check == self._pwStrengthCheck: self._waiveStrengthClicks += 1 self._pwStrengthCheck.update_check_status() elif failed_check == self._pwASCIICheck: self._waiveASCIIClicks += 1 self._pwASCIICheck.update_check_status() # If there is no user set, skip the checks if not self.username.get_text(): for check in self.checks: check.enabled = False if GUISpokeInputCheckHandler.on_back_clicked(self, button): NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): # If the failed check is for password strength or non-ASCII # characters, add a click to the counter and check again failed_check = next(self.failed_checks_with_message, None) if not self.policy.strict and failed_check == self._pwStrengthCheck: self._waiveStrengthClicks += 1 self._pwStrengthCheck.update_check_status() elif failed_check == self._pwASCIICheck: self._waiveASCIIClicks += 1 self._pwASCIICheck.update_check_status() # If neither the password nor the confirm field are set, skip the checks if (not self.pw.get_text()) and (not self.confirm.get_text()): for check in self.checks: check.enabled = False if GUISpokeInputCheckHandler.on_back_clicked(self, button): NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): # If the failed check is for password strength or non-ASCII # characters, add a click to the counter and check again failed_check = next(self.failed_checks_with_message, None) if not self.policy.strict: if failed_check == self._pwStrengthCheck: self.waive_clicks += 1 self._pwStrengthCheck.update_check_status() elif failed_check == self._pwEmptyCheck: self.waive_clicks += 1 self._pwEmptyCheck.update_check_status() elif failed_check == self._pwASCIICheck: self.waive_ASCII_clicks += 1 self._pwASCIICheck.update_check_status() elif failed_check: # no failed checks -> failed_check == None failed_check.update_check_status() if GUISpokeInputCheckHandler.on_back_clicked(self, button): NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): # If the failed check is for password strength or non-ASCII # characters, add a click to the counter and check again failed_check = next(self.failed_checks_with_message, None) if not self.policy.strict: if failed_check == self._pwStrengthCheck: self.waive_clicks += 1 self._pwStrengthCheck.update_check_status() elif failed_check == self._pwEmptyCheck: self.waive_clicks += 1 self._pwEmptyCheck.update_check_status() elif failed_check: # no failed checks -> failed_check == None failed_check.update_check_status() elif failed_check == self._pwASCIICheck: self.waive_ASCII_clicks += 1 self._pwASCIICheck.update_check_status() if GUISpokeInputCheckHandler.on_back_clicked(self, button): NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): # Return if: # - no user is requested (empty username) # - no password is required # - password is set by kickstart and password text entry is empty # - password is set by dialog and _validatePassword returns True if not self.username.get_text() or \ not self.usepassword.get_active() or \ (self.pw.get_text() == "" and \ self.pw.get_text() == self.confirm.get_text() and \ self._user.password_kickstarted) or \ self._validatePassword(): self._error = False self.clear_info() NormalSpoke.on_back_clicked(self, button) # Show the confirmation message if the password is not acceptable else: self.clear_info() self.set_warning(self._error) self.pw.grab_focus() self.window.show_all()
def on_refresh_clicked(self, *args): dialog = RefreshDialog(self.data) ignoreEscape(dialog.window) with self.main_window.enlightbox(dialog.window): rc = dialog.run() dialog.window.destroy() if rc == 1: # User hit OK on the dialog, indicating they stayed on the dialog # until rescanning completed. self.refresh() return elif rc != 2: # User either hit cancel on the dialog or closed it via escape, so # there was no rescanning done. # NOTE: rc == 2 means the user clicked on the link that takes them # back to the hub. return # Can't use this spoke's on_back_clicked method as that will try to # save the right hand side, which is no longer valid. The user must # go back and select their disks all over again since whatever they # did on the shell could have changed what disks are available. NormalSpoke.on_back_clicked(self, None)
def on_back_clicked(self, button): # the GUI spoke input check handler handles the spoke exit logic for us if self.try_to_go_back(): NormalSpoke.on_back_clicked(self, button) else: log.info("Return to hub prevented by password checking rules.")
def on_back_clicked(self, button): # We can't exit early if it looks like nothing has changed because the # user might want to change settings presented in the dialogs shown from # within this method. # Remove all non-existing devices if autopart was active when we last # refreshed. if self._previous_autopart: self._previous_autopart = False for partition in self.storage.partitions[:]: # check if it's been removed in a previous iteration if not partition.exists and \ partition in self.storage.partitions: self.storage.recursiveRemove(partition) # hide/unhide disks as requested for disk in self.disks: if disk.name not in self.selected_disks and \ disk in self.storage.devices: self.storage.devicetree.hide(disk) elif disk.name in self.selected_disks and \ disk not in self.storage.devices: self.storage.devicetree.unhide(disk) # show the installation options dialog disks = [d for d in self.disks if d.name in self.selected_disks] disks_size = sum(Size(en_spec="%f MB" % d.size) for d in disks) # No disks selected? The user wants to back out of the storage spoke. if not disks: NormalSpoke.on_back_clicked(self, button) return # Figure out if the existing disk labels will work on this platform # you need to have at least one of the platform's labels in order for # any of the free space to be useful. disk_labels = set(disk.format.labelType for disk in disks if hasattr(disk.format, "labelType")) platform_labels = set(platform.diskLabelTypes) if disk_labels and platform_labels.isdisjoint(disk_labels): disk_free = 0 fs_free = 0 log.debug("Need disklabel: %s have: %s", ", ".join(platform_labels), ", ".join(disk_labels)) else: free_space = self.storage.getFreeSpace(disks=disks, clearPartType=CLEARPART_TYPE_NONE) disk_free = sum(f[0] for f in free_space.itervalues()) fs_free = sum(f[1] for f in free_space.itervalues()) required_space = self.payload.spaceRequired auto_swap = Size(bytes=0) for autoreq in self.storage.autoPartitionRequests: if autoreq.fstype == "swap": auto_swap += Size(en_spec="%d MB" % autoreq.size) log.debug("disk free: %s fs free: %s sw needs: %s auto swap: %s", disk_free, fs_free, required_space, auto_swap) if disk_free >= required_space + auto_swap: showReclaim = not all(map(lambda dev: empty_device(dev, self.storage.devicetree), self.disks)) dialog = InstallOptions1Dialog(self.data, showReclaim=showReclaim) elif disks_size >= required_space: dialog = InstallOptions2Dialog(self.data, payload=self.payload) else: dialog = InstallOptions3Dialog(self.data, payload=self.payload) dialog.refresh(required_space, auto_swap, disk_free, fs_free, self.autoPartType, self.encrypted) rc = self.run_lightbox_dialog(dialog) if rc == dialog.RESPONSE_CONTINUE: self.autoPartType = dialog.autoPartType self.encrypted = dialog.encrypted if not self._check_encrypted(): return if dialog.continue_response == dialog.RESPONSE_CONTINUE_AUTOPART: self.autopart = True elif dialog.continue_response == dialog.RESPONSE_CONTINUE_RECLAIM: self.apply() if not self._show_resize_dialog(disks): # User pressed cancel on the reclaim dialog, so don't leave # the storage spoke. return # if the user did not press cancel that means they want to # proceed with autopart self.autopart = True elif dialog.continue_response == dialog.RESPONSE_CONTINUE_CUSTOM: self.autopart = False self.skipTo = "CustomPartitioningSpoke" elif rc == dialog.RESPONSE_CANCEL: # stay on this spoke return elif rc == dialog.RESPONSE_MODIFY_SW: # go to software spoke self.skipTo = "SoftwareSelectionSpoke" elif rc == dialog.RESPONSE_RECLAIM: self.autoPartType = dialog.autoPartType self.encrypted = dialog.encrypted if not self._check_encrypted(): return self.apply() if not self._show_resize_dialog(disks): # User pressed cancel on the reclaim dialog, so don't leave # the storage spoke. return # if the user did not press cancel that means they want to # proceed with autopart self.autopart = True elif rc == dialog.RESPONSE_QUIT: raise SystemExit("user-selected exit") elif rc == dialog.RESPONSE_CUSTOM: self.autopart = False self.autoPartType = dialog.autoPartType self.encrypted = dialog.encrypted self.skipTo = "CustomPartitioningSpoke" self.applyOnSkip = True NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): # We can't exit early if it looks like nothing has changed because the # user might want to change settings presented in the dialogs shown from # within this method. # Remove all non-existing devices if autopart was active when we last # refreshed. if self._previous_autopart: self._previous_autopart = False for partition in self.storage.partitions[:]: # check if it's been removed in a previous iteration if not partition.exists and \ partition in self.storage.partitions: self.storage.recursiveRemove(partition) # hide/unhide disks as requested for disk in self.disks: if disk.name not in self.selected_disks and \ disk in self.storage.devices: self.storage.devicetree.hide(disk) elif disk.name in self.selected_disks and \ disk not in self.storage.devices: self.storage.devicetree.unhide(disk) # show the installation options dialog disks = [d for d in self.disks if d.name in self.selected_disks] disks_size = sum((d.size for d in disks), Size(bytes=0)) # No disks selected? The user wants to back out of the storage spoke. if not disks: NormalSpoke.on_back_clicked(self, button) return # Figure out if the existing disk labels will work on this platform # you need to have at least one of the platform's labels in order for # any of the free space to be useful. disk_labels = set(disk.format.labelType for disk in disks if hasattr(disk.format, "labelType")) platform_labels = set(platform.diskLabelTypes) if disk_labels and platform_labels.isdisjoint(disk_labels): disk_free = 0 fs_free = 0 log.debug("Need disklabel: %s have: %s", ", ".join(platform_labels), ", ".join(disk_labels)) else: free_space = self.storage.getFreeSpace( disks=disks, clearPartType=CLEARPART_TYPE_NONE) disk_free = sum(f[0] for f in free_space.itervalues()) fs_free = sum(f[1] for f in free_space.itervalues()) required_space = self.payload.spaceRequired auto_swap = sum((r.size for r in self.storage.autoPartitionRequests if r.fstype == "swap"), Size(bytes=0)) log.debug("disk free: %s fs free: %s sw needs: %s auto swap: %s", disk_free, fs_free, required_space, auto_swap) if disk_free >= required_space + auto_swap: dialog = None elif disks_size >= required_space: if self._customPart.get_active() or self._reclaim.get_active(): dialog = None else: dialog = NeedSpaceDialog(self.data, payload=self.payload) dialog.refresh(required_space, auto_swap, disk_free, fs_free) rc = self.run_lightbox_dialog(dialog) else: dialog = NoSpaceDialog(self.data, payload=self.payload) dialog.refresh(required_space, auto_swap, disk_free, fs_free) rc = self.run_lightbox_dialog(dialog) if not dialog: # Plenty of room - there's no need to pop up a dialog, so just send # the user to wherever they asked to go. That's either the custom # spoke or the hub. # - OR - # Not enough room, but the user checked the reclaim button. # But first, we need to ask about an encryption passphrase if that # checkbox was active. self.encrypted = self._encrypted.get_active() if not self._check_encrypted(): return # Oh and then we might also want to go to the reclaim dialog. if self._reclaim.get_active(): self.apply() if not self._show_resize_dialog(disks): # User pressed cancel on the reclaim dialog, so don't leave # the storage spoke. return if self._customPart.get_active(): self.autopart = False self.skipTo = "CustomPartitioningSpoke" else: self.autopart = True elif rc == RESPONSE_CANCEL: # A cancel button was clicked on one of the dialogs. Stay on this # spoke. Generally, this is because the user wants to add more disks. return elif rc == RESPONSE_MODIFY_SW: # The "Fedora software selection" link was clicked on one of the # dialogs. Send the user to the software spoke. self.skipTo = "SoftwareSelectionSpoke" elif rc == RESPONSE_RECLAIM: # Not enough space, but the user can make enough if they do some # work and free up space. self.encrypted = self._encrypted.get_active() if not self._check_encrypted(): return self.apply() if not self._show_resize_dialog(disks): # User pressed cancel on the reclaim dialog, so don't leave # the storage spoke. return # And then go to the custom partitioning spoke if they chose to # do so. if self._customPart.get_active(): self.autopart = False self.skipTo = "CustomPartitioningSpoke" else: self.autopart = True elif rc == RESPONSE_QUIT: # Not enough space, and the user can't do anything about it so # they chose to quit. raise SystemExit("user-selected exit") else: # I don't know how we'd get here, but might as well have a # catch-all. Just stay on this spoke. return self.applyOnSkip = True NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): # We can't exit early if it looks like nothing has changed because the # user might want to change settings presented in the dialogs shown from # within this method. # Remove all non-existing devices if autopart was active when we last # refreshed. if self._previous_autopart: self._previous_autopart = False for partition in self.storage.partitions[:]: # check if it's been removed in a previous iteration if not partition.exists and \ partition in self.storage.partitions: self.storage.recursiveRemove(partition) # hide/unhide disks as requested for disk in self.disks: if disk.name not in self.selected_disks and \ disk in self.storage.devices: self.storage.devicetree.hide(disk) elif disk.name in self.selected_disks and \ disk not in self.storage.devices: self.storage.devicetree.unhide(disk) # show the installation options dialog disks = [d for d in self.disks if d.name in self.selected_disks] disks_size = sum((d.size for d in disks), Size(bytes=0)) # No disks selected? The user wants to back out of the storage spoke. if not disks: NormalSpoke.on_back_clicked(self, button) return # Figure out if the existing disk labels will work on this platform # you need to have at least one of the platform's labels in order for # any of the free space to be useful. disk_labels = set(disk.format.labelType for disk in disks if hasattr(disk.format, "labelType")) platform_labels = set(platform.diskLabelTypes) if disk_labels and platform_labels.isdisjoint(disk_labels): disk_free = 0 fs_free = 0 log.debug("Need disklabel: %s have: %s", ", ".join(platform_labels), ", ".join(disk_labels)) else: free_space = self.storage.getFreeSpace(disks=disks, clearPartType=CLEARPART_TYPE_NONE) disk_free = sum(f[0] for f in free_space.itervalues()) fs_free = sum(f[1] for f in free_space.itervalues()) required_space = self.payload.spaceRequired auto_swap = sum((r.size for r in self.storage.autoPartitionRequests if r.fstype == "swap"), Size(bytes=0)) log.debug("disk free: %s fs free: %s sw needs: %s auto swap: %s", disk_free, fs_free, required_space, auto_swap) if disk_free >= required_space + auto_swap: dialog = None elif disks_size >= required_space: if self._customPart.get_active() or self._reclaim.get_active(): dialog = None else: dialog = NeedSpaceDialog(self.data, payload=self.payload) dialog.refresh(required_space, auto_swap, disk_free, fs_free) rc = self.run_lightbox_dialog(dialog) else: dialog = NoSpaceDialog(self.data, payload=self.payload) dialog.refresh(required_space, auto_swap, disk_free, fs_free) rc = self.run_lightbox_dialog(dialog) if not dialog: # Plenty of room - there's no need to pop up a dialog, so just send # the user to wherever they asked to go. That's either the custom # spoke or the hub. # - OR - # Not enough room, but the user checked the reclaim button. # But first, we need to ask about an encryption passphrase if that # checkbox was active. self.encrypted = self._encrypted.get_active() if not self._check_encrypted(): return # Oh and then we might also want to go to the reclaim dialog. if self._reclaim.get_active(): self.apply() if not self._show_resize_dialog(disks): # User pressed cancel on the reclaim dialog, so don't leave # the storage spoke. return if self._customPart.get_active(): self.autopart = False self.skipTo = "CustomPartitioningSpoke" else: self.autopart = True elif rc == RESPONSE_CANCEL: # A cancel button was clicked on one of the dialogs. Stay on this # spoke. Generally, this is because the user wants to add more disks. return elif rc == RESPONSE_MODIFY_SW: # The "Fedora software selection" link was clicked on one of the # dialogs. Send the user to the software spoke. self.skipTo = "SoftwareSelectionSpoke" elif rc == RESPONSE_RECLAIM: # Not enough space, but the user can make enough if they do some # work and free up space. self.encrypted = self._encrypted.get_active() if not self._check_encrypted(): return self.apply() if not self._show_resize_dialog(disks): # User pressed cancel on the reclaim dialog, so don't leave # the storage spoke. return # And then go to the custom partitioning spoke if they chose to # do so. if self._customPart.get_active(): self.autopart = False self.skipTo = "CustomPartitioningSpoke" else: self.autopart = True elif rc == RESPONSE_QUIT: # Not enough space, and the user can't do anything about it so # they chose to quit. raise SystemExit("user-selected exit") else: # I don't know how we'd get here, but might as well have a # catch-all. Just stay on this spoke. return self.applyOnSkip = True NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): # We can't exit early if it looks like nothing has changed because the # user might want to change settings presented in the dialogs shown from # within this method. # Remove all non-existing devices if autopart was active when we last # refreshed. if self._previous_autopart: self._previous_autopart = False for partition in self.storage.partitions[:]: # check if it's been removed in a previous iteration if not partition.exists and \ partition in self.storage.partitions: self.storage.recursiveRemove(partition) # hide/unhide disks as requested for disk in self.disks: if disk.name not in self.selected_disks and \ disk in self.storage.devices: self.storage.devicetree.hide(disk) elif disk.name in self.selected_disks and \ disk not in self.storage.devices: self.storage.devicetree.unhide(disk) # show the installation options dialog disks = [d for d in self.disks if d.name in self.selected_disks] disks_size = sum(Size(spec="%f MB" % d.size) for d in disks) # No disks selected? The user wants to back out of the storage spoke. if not disks: NormalSpoke.on_back_clicked(self, button) return if arch.isS390(): # check for unformatted DASDs and launch dasdfmt if any discovered dasds = make_unformatted_dasd_list(self.selected_disks) if len(dasds) > 0: dialog = DasdFormatDialog(self.data, self.storage, dasds) ignoreEscape(dialog.window) rc = self.run_lightbox_dialog(dialog) if rc == 1: # User hit OK on the dialog, indicating they stayed on the # dialog until formatting completed; make sure we stay on # the storage spoke and don't return to the summary hub self.skipTo = "StorageSpoke" # we have to manaually call refresh so changes are picked up self.refresh() elif rc == 2: # User clicked uri to return to hub. NormalSpoke.on_back_clicked(self, button) return elif rc != 2: # User either hit cancel on the dialog or closed it via escape, so # there was no formatting done. # NOTE: rc == 2 means the user clicked on the link that takes them # back to the hub. return # Figure out if the existing disk labels will work on this platform # you need to have at least one of the platform's labels in order for # any of the free space to be useful. disk_labels = set(disk.format.labelType for disk in disks if hasattr(disk.format, "labelType")) platform_labels = set(platform.diskLabelTypes) if disk_labels and platform_labels.isdisjoint(disk_labels): disk_free = 0 fs_free = 0 log.debug("Need disklabel: %s have: %s" % (", ".join(platform_labels), ", ".join(disk_labels))) else: free_space = self.storage.getFreeSpace( disks=disks, clearPartType=CLEARPART_TYPE_NONE) disk_free = sum(f[0] for f in free_space.itervalues()) fs_free = sum(f[1] for f in free_space.itervalues()) required_space = self.payload.spaceRequired auto_swap = Size(bytes=0) for autoreq in self.storage.autoPartitionRequests: if autoreq.fstype == "swap": auto_swap += Size(spec="%d MB" % autoreq.size) log.debug("disk free: %s fs free: %s sw needs: %s auto swap: %s" % (disk_free, fs_free, required_space, auto_swap)) if disk_free >= required_space + auto_swap: dialog = None elif disks_size >= required_space: if self._customPart.get_active() or self._reclaim.get_active(): dialog = None else: dialog = InstallOptions1Dialog(self.data, payload=self.payload) dialog.refresh(required_space, auto_swap, disk_free, fs_free) rc = self.run_lightbox_dialog(dialog) else: dialog = InstallOptions2Dialog(self.data, payload=self.payload) dialog.refresh(required_space, auto_swap, disk_free, fs_free) rc = self.run_lightbox_dialog(dialog) if not dialog: # Plenty of room - there's no need to pop up a dialog, so just send # the user to wherever they asked to go. That's either the custom # spoke or the hub. # - OR - # Not enough room, but the user checked the reclaim button. self.encrypted = self._encrypted.get_active() if self._customPart.get_active(): self.autopart = False self.skipTo = "CustomPartitioningSpoke" else: self.autopart = True # We might first need to ask about an encryption passphrase. if not self._check_encrypted(): return # Oh and then we might also want to go to the reclaim dialog. if self._reclaim.get_active(): self.apply() if not self._show_resize_dialog(disks): # User pressed cancel on the reclaim dialog, so don't leave # the storage spoke. return elif rc == RESPONSE_CANCEL: # A cancel button was clicked on one of the dialogs. Stay on this # spoke. Generally, this is because the user wants to add more disks. return elif rc == RESPONSE_MODIFY_SW: # The "Fedora software selection" link was clicked on one of the # dialogs. Send the user to the software spoke. self.skipTo = "SoftwareSelectionSpoke" elif rc == RESPONSE_RECLAIM: # Not enough space, but the user can make enough if they do some # work and free up space. self.encrypted = self._encrypted.get_active() if not self._check_encrypted(): return self.apply() if not self._show_resize_dialog(disks): # User pressed cancel on the reclaim dialog, so don't leave # the storage spoke. return # And then go to the custom partitioning spoke if they chose to # do so. if self._customPart.get_active(): self.autopart = False self.skipTo = "CustomPartitioningSpoke" else: self.autopart = True elif rc == RESPONSE_QUIT: # Not enough space, and the user can't do anything about it so # they chose to quit. raise SystemExit("user-selected exit") else: # I don't know how we'd get here, but might as well have a # catch-all. Just stay on this spoke. return self.applyOnSkip = True NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): # We can't exit early if it looks like nothing has changed because the # user might want to change settings presented in the dialogs shown from # within this method. # Remove all non-existing devices if autopart was active when we last # refreshed. if self._previous_autopart: self._previous_autopart = False for partition in self.storage.partitions[:]: # check if it's been removed in a previous iteration if not partition.exists and \ partition in self.storage.partitions: self.storage.recursiveRemove(partition) # hide/unhide disks as requested for disk in self.disks: if disk.name not in self.selected_disks and \ disk in self.storage.devices: self.storage.devicetree.hide(disk) elif disk.name in self.selected_disks and \ disk not in self.storage.devices: self.storage.devicetree.unhide(disk) # show the installation options dialog disks = [d for d in self.disks if d.name in self.selected_disks] disks_size = sum(Size(spec="%f MB" % d.size) for d in disks) # No disks selected? The user wants to back out of the storage spoke. if not disks: NormalSpoke.on_back_clicked(self, button) return # Figure out if the existing disk labels will work on this platform # you need to have at least one of the platform's labels in order for # any of the free space to be useful. disk_labels = set(disk.format.labelType for disk in disks if hasattr(disk.format, "labelType")) platform_labels = set(platform.diskLabelTypes) if disk_labels and platform_labels.isdisjoint(disk_labels): disk_free = 0 fs_free = 0 log.debug("Need disklabel: %s have: %s" % (", ".join(platform_labels), ", ".join(disk_labels))) else: free_space = self.storage.getFreeSpace(disks=disks, clearPartType=CLEARPART_TYPE_NONE) disk_free = sum(f[0] for f in free_space.itervalues()) fs_free = sum(f[1] for f in free_space.itervalues()) required_space = self.payload.spaceRequired auto_swap = Size(bytes=0) for autoreq in self.storage.autoPartitionRequests: if autoreq.fstype == "swap": auto_swap += Size(spec="%d MB" % autoreq.size) log.debug("disk free: %s fs free: %s sw needs: %s auto swap: %s" % (disk_free, fs_free, required_space, auto_swap)) if disk_free >= required_space + auto_swap: showReclaim = not all(map(lambda dev: empty_device(dev, self.storage.devicetree), self.disks)) dialog = InstallOptions1Dialog(self.data, showReclaim=showReclaim) elif disks_size >= required_space: dialog = InstallOptions2Dialog(self.data, payload=self.payload) else: dialog = InstallOptions3Dialog(self.data, payload=self.payload) dialog.refresh(required_space, auto_swap, disk_free, fs_free, self.autoPartType, self.encrypted) rc = self.run_lightbox_dialog(dialog) if rc == dialog.RESPONSE_CONTINUE: self.autoPartType = dialog.autoPartType self.encrypted = dialog.encrypted if not self._check_encrypted(): return if dialog.continue_response == dialog.RESPONSE_CONTINUE_AUTOPART: self.autopart = True elif dialog.continue_response == dialog.RESPONSE_CONTINUE_RECLAIM: self.apply() if not self._show_resize_dialog(disks): # User pressed cancel on the reclaim dialog, so don't leave # the storage spoke. return elif dialog.continue_response == dialog.RESPONSE_CONTINUE_CUSTOM: self.autopart = False self.skipTo = "CustomPartitioningSpoke" elif rc == dialog.RESPONSE_CANCEL: # stay on this spoke return elif rc == dialog.RESPONSE_MODIFY_SW: # go to software spoke self.skipTo = "SoftwareSelectionSpoke" elif rc == dialog.RESPONSE_RECLAIM: self.autoPartType = dialog.autoPartType self.encrypted = dialog.encrypted if not self._check_encrypted(): return self.apply() if not self._show_resize_dialog(disks): # User pressed cancel on the reclaim dialog, so don't leave # the storage spoke. return elif rc == dialog.RESPONSE_QUIT: raise SystemExit("user-selected exit") elif rc == dialog.RESPONSE_CUSTOM: self.autopart = False self.autoPartType = dialog.autoPartType self.encrypted = dialog.encrypted self.skipTo = "CustomPartitioningSpoke" self.applyOnSkip = True NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): self.skipTo = "StorageSpoke" NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): # We can't exit early if it looks like nothing has changed because the # user might want to change settings presented in the dialogs shown from # within this method. # Do not enter this method multiple times if user clicking multiple times # on back button if self._back_clicked: return else: self._back_clicked = True # make sure the snapshot of unmodified on-disk-storage model is created if not on_disk_storage.created: on_disk_storage.create_snapshot(self.storage) if self.autopart_missing_passphrase: self._setup_passphrase() NormalSpoke.on_back_clicked(self, button) return # No disks selected? The user wants to back out of the storage spoke. if not self.selected_disks: NormalSpoke.on_back_clicked(self, button) return disk_selection_changed = False if self._last_selected_disks: disk_selection_changed = (self._last_selected_disks != set(self.selected_disks)) # remember the disk selection for future decisions self._last_selected_disks = set(self.selected_disks) if disk_selection_changed: # Changing disk selection is really, really complicated and has # always been causing numerous hard bugs. Let's not play the hero # game and just revert everything and start over again. on_disk_storage.reset_to_snapshot(self.storage) self.disks = getDisks(self.storage.devicetree) else: # Remove all non-existing devices if autopart was active when we last # refreshed. if self._previous_autopart: self._previous_autopart = False self._remove_nonexistant_partitions() # hide disks as requested self._hide_disks() # make sure no containers were split up by the user's disk selection self.clear_info() # if there are some disk selection errors we don't let user to leave the # spoke, so these errors don't have to go to self.errors self.disks_errors = checkDiskSelection(self.storage, self.selected_disks) if self.disks_errors: # The disk selection has to make sense before we can proceed. self.set_error(_("There was a problem with your disk selection. " "Click here for details.")) self._back_clicked = False return if arch.isS390(): # check for unformatted DASDs and launch dasdfmt if any discovered rc = self._check_dasd_formats() if rc == DASD_FORMAT_NO_CHANGE: pass elif rc == DASD_FORMAT_REFRESH: # User hit OK on the dialog self.refresh() elif rc == DASD_FORMAT_RETURN_TO_HUB: # User clicked uri to return to hub. NormalSpoke.on_back_clicked(self, button) return else: # User either hit cancel on the dialog or closed it via escape, # there was no formatting done. self._back_clicked = False return # even if they're not doing autopart, setting autopart.encrypted # establishes a default of encrypting new devices self.encrypted = self._encrypted.get_active() # We might first need to ask about an encryption passphrase. if self.encrypted and not self._setup_passphrase(): self._back_clicked = False return # At this point there are three possible states: # 1) user chose custom part => just send them to the CustomPart spoke # 2) user wants to reclaim some more space => run the ResizeDialog # 3) we are just asked to do autopart => check free space and see if we need # user to do anything more self.autopart = not self._customPart.get_active() disks = [d for d in self.disks if d.name in self.selected_disks] dialog = None if not self.autopart: self.skipTo = "CustomPartitioningSpoke" elif self._reclaim.get_active(): # HINT: change the logic of this 'if' statement if we are asked to # support "reclaim before custom partitioning" # respect disk selection and other choices in the ReclaimDialog self.apply() dialog = ResizeDialog(self.data, self.storage, self.payload) dialog.refresh(disks) else: dialog = self._check_space_and_get_dialog(disks) if dialog: # more dialogs may need to be run based on user choices, but we are # only interested in the final result rc = self._run_dialogs(disks, start_with=dialog) if rc == RESPONSE_OK: # nothing special needed pass elif rc == RESPONSE_CANCEL: # A cancel button was clicked on one of the dialogs. Stay on this # spoke. Generally, this is because the user wants to add more disks. self._back_clicked = False return elif rc == RESPONSE_MODIFY_SW: # The "Fedora software selection" link was clicked on one of the # dialogs. Send the user to the software spoke. self.skipTo = "SoftwareSelectionSpoke" elif rc == RESPONSE_QUIT: # Not enough space, and the user can't do anything about it so # they chose to quit. raise SystemExit("user-selected exit") else: # I don't know how we'd get here, but might as well have a # catch-all. Just stay on this spoke. self._back_clicked = False return if self.autopart: refreshAutoSwapSize(self.storage) self.applyOnSkip = True NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): # We can't exit early if it looks like nothing has changed because the # user might want to change settings presented in the dialogs shown from # within this method. # Do not enter this method multiple times if user clicking multiple times # on back button if self._back_clicked: return else: self._back_clicked = True # Remove all non-existing devices if autopart was active when we last # refreshed. if self._previous_autopart: self._previous_autopart = False for partition in self.storage.partitions[:]: # check if it's been removed in a previous iteration if not partition.exists and \ partition in self.storage.partitions: self.storage.recursiveRemove(partition) # make sure no containers were split up by the user's disk selection self.clear_info() self.errors = checkDiskSelection(self.storage, self.selected_disks) if self.errors: # The disk selection has to make sense before we can proceed. self.set_error(_("There was a problem with your disk selection. " "Click here for details.")) self._back_clicked = False return # hide/unhide disks as requested for disk in self.disks: if disk.name not in self.selected_disks and \ disk in self.storage.devices: self.storage.devicetree.hide(disk) elif disk.name in self.selected_disks and \ disk not in self.storage.devices: self.storage.devicetree.unhide(disk) # show the installation options dialog disks = [d for d in self.disks if d.name in self.selected_disks] disks_size = sum((d.size for d in disks), Size(0)) # No disks selected? The user wants to back out of the storage spoke. if not disks: NormalSpoke.on_back_clicked(self, button) return if arch.isS390(): # check for unformatted DASDs and launch dasdfmt if any discovered dasds = self.storage.devicetree.make_unformatted_dasd_list(disks) if len(dasds) > 0: # We want to apply current selection before running dasdfmt to # prevent this information from being lost afterward applyDiskSelection(self.storage, self.data, self.selected_disks) dialog = DasdFormatDialog(self.data, self.storage, dasds) ignoreEscape(dialog.window) rc = self.run_lightbox_dialog(dialog) if rc == 1: # User hit OK on the dialog self.refresh() elif rc == 2: # User clicked uri to return to hub. NormalSpoke.on_back_clicked(self, button) return elif rc != 2: # User either hit cancel on the dialog or closed it via escape, # there was no formatting done. # NOTE: rc == 2 means the user clicked on the link that takes t # back to the hub. self._back_clicked = False return # Figure out if the existing disk labels will work on this platform # you need to have at least one of the platform's labels in order for # any of the free space to be useful. disk_labels = set(disk.format.labelType for disk in disks if hasattr(disk.format, "labelType")) platform_labels = set(platform.diskLabelTypes) if disk_labels and platform_labels.isdisjoint(disk_labels): disk_free = 0 fs_free = 0 log.debug("Need disklabel: %s have: %s", ", ".join(platform_labels), ", ".join(disk_labels)) else: free_space = self.storage.getFreeSpace(disks=disks, clearPartType=CLEARPART_TYPE_NONE) disk_free = sum(f[0] for f in free_space.values()) fs_free = sum(f[1] for f in free_space.values()) required_space = self.payload.spaceRequired auto_swap = sum((r.size for r in self.storage.autoPartitionRequests if r.fstype == "swap"), Size(0)) if self.autopart and auto_swap == Size(0): # autopartitioning requested, but not applied yet (=> no auto swap # requests), ask user for enough space to fit in the suggested swap auto_swap = autopart.swapSuggestion() log.debug("disk free: %s fs free: %s sw needs: %s auto swap: %s", disk_free, fs_free, required_space, auto_swap) if disk_free >= required_space + auto_swap: dialog = None elif disks_size >= required_space: if self._customPart.get_active() or self._reclaim.get_active(): dialog = None else: dialog = NeedSpaceDialog(self.data, payload=self.payload) dialog.refresh(required_space, auto_swap, disk_free, fs_free) rc = self.run_lightbox_dialog(dialog) else: dialog = NoSpaceDialog(self.data, payload=self.payload) dialog.refresh(required_space, auto_swap, disk_free, fs_free) rc = self.run_lightbox_dialog(dialog) if not dialog: # Plenty of room - there's no need to pop up a dialog, so just send # the user to wherever they asked to go. That's either the custom # spoke or the hub. # - OR - # Not enough room, but the user checked the reclaim button. self.encrypted = self._encrypted.get_active() if self._customPart.get_active(): self.autopart = False self.skipTo = "CustomPartitioningSpoke" else: self.autopart = True # We might first need to ask about an encryption passphrase. if not self._check_encrypted(): self._back_clicked = False return # Oh and then we might also want to go to the reclaim dialog. if self._reclaim.get_active(): self.apply() if not self._show_resize_dialog(disks): # User pressed cancel on the reclaim dialog, so don't leave # the storage spoke. self._back_clicked = False return elif rc == RESPONSE_CANCEL: # A cancel button was clicked on one of the dialogs. Stay on this # spoke. Generally, this is because the user wants to add more disks. self._back_clicked = False return elif rc == RESPONSE_MODIFY_SW: # The "Fedora software selection" link was clicked on one of the # dialogs. Send the user to the software spoke. self.skipTo = "SoftwareSelectionSpoke" elif rc == RESPONSE_RECLAIM: # Not enough space, but the user can make enough if they do some # work and free up space. self.encrypted = self._encrypted.get_active() if not self._check_encrypted(): return self.apply() if not self._show_resize_dialog(disks): # User pressed cancel on the reclaim dialog, so don't leave # the storage spoke. self._back_clicked = False return # And then go to the custom partitioning spoke if they chose to # do so. if self._customPart.get_active(): self.autopart = False self.skipTo = "CustomPartitioningSpoke" else: self.autopart = True elif rc == RESPONSE_QUIT: # Not enough space, and the user can't do anything about it so # they chose to quit. raise SystemExit("user-selected exit") else: # I don't know how we'd get here, but might as well have a # catch-all. Just stay on this spoke. self._back_clicked = False return if self.autopart: refreshAutoSwapSize(self.storage) self.applyOnSkip = True NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): # We can't exit early if it looks like nothing has changed because the # user might want to change settings presented in the dialogs shown from # within this method. # Do not enter this method multiple times if user clicking multiple times # on back button if self._back_clicked: return else: self._back_clicked = True # Remove all non-existing devices if autopart was active when we last # refreshed. if self._previous_autopart: self._previous_autopart = False for partition in self.storage.partitions[:]: # check if it's been removed in a previous iteration if not partition.exists and \ partition in self.storage.partitions: self.storage.recursiveRemove(partition) # make sure no containers were split up by the user's disk selection self.clear_info() self.errors = checkDiskSelection(self.storage, self.selected_disks) if self.errors: # The disk selection has to make sense before we can proceed. self.set_error( _("There was a problem with your disk selection. " "Click here for details.")) self._back_clicked = False return # hide/unhide disks as requested for disk in self.disks: if disk.name not in self.selected_disks and \ disk in self.storage.devices: self.storage.devicetree.hide(disk) elif disk.name in self.selected_disks and \ disk not in self.storage.devices: self.storage.devicetree.unhide(disk) # show the installation options dialog disks = [d for d in self.disks if d.name in self.selected_disks] disks_size = sum((d.size for d in disks), Size(0)) # No disks selected? The user wants to back out of the storage spoke. if not disks: NormalSpoke.on_back_clicked(self, button) return if arch.isS390(): # check for unformatted DASDs and launch dasdfmt if any discovered dasds = self.storage.devicetree.make_unformatted_dasd_list(disks) if len(dasds) > 0: # We want to apply current selection before running dasdfmt to # prevent this information from being lost afterward applyDiskSelection(self.storage, self.data, self.selected_disks) dialog = DasdFormatDialog(self.data, self.storage, dasds) ignoreEscape(dialog.window) rc = self.run_lightbox_dialog(dialog) if rc == 1: # User hit OK on the dialog self.refresh() elif rc == 2: # User clicked uri to return to hub. NormalSpoke.on_back_clicked(self, button) return elif rc != 2: # User either hit cancel on the dialog or closed it via escape, # there was no formatting done. # NOTE: rc == 2 means the user clicked on the link that takes t # back to the hub. self._back_clicked = False return # Figure out if the existing disk labels will work on this platform # you need to have at least one of the platform's labels in order for # any of the free space to be useful. disk_labels = set(disk.format.labelType for disk in disks if hasattr(disk.format, "labelType")) platform_labels = set(platform.diskLabelTypes) if disk_labels and platform_labels.isdisjoint(disk_labels): disk_free = 0 fs_free = 0 log.debug("Need disklabel: %s have: %s", ", ".join(platform_labels), ", ".join(disk_labels)) else: free_space = self.storage.getFreeSpace( disks=disks, clearPartType=CLEARPART_TYPE_NONE) disk_free = sum(f[0] for f in free_space.values()) fs_free = sum(f[1] for f in free_space.values()) required_space = self.payload.spaceRequired auto_swap = sum((r.size for r in self.storage.autoPartitionRequests if r.fstype == "swap"), Size(0)) if self.autopart and auto_swap == Size(0): # autopartitioning requested, but not applied yet (=> no auto swap # requests), ask user for enough space to fit in the suggested swap auto_swap = autopart.swapSuggestion() log.debug("disk free: %s fs free: %s sw needs: %s auto swap: %s", disk_free, fs_free, required_space, auto_swap) if disk_free >= required_space + auto_swap: dialog = None elif disks_size >= required_space: if self._customPart.get_active() or self._reclaim.get_active(): dialog = None else: dialog = NeedSpaceDialog(self.data, payload=self.payload) dialog.refresh(required_space, auto_swap, disk_free, fs_free) rc = self.run_lightbox_dialog(dialog) else: dialog = NoSpaceDialog(self.data, payload=self.payload) dialog.refresh(required_space, auto_swap, disk_free, fs_free) rc = self.run_lightbox_dialog(dialog) if not dialog: # Plenty of room - there's no need to pop up a dialog, so just send # the user to wherever they asked to go. That's either the custom # spoke or the hub. # - OR - # Not enough room, but the user checked the reclaim button. self.encrypted = self._encrypted.get_active() if self._customPart.get_active(): self.autopart = False self.skipTo = "CustomPartitioningSpoke" else: self.autopart = True # We might first need to ask about an encryption passphrase. if not self._check_encrypted(): self._back_clicked = False return # Oh and then we might also want to go to the reclaim dialog. if self._reclaim.get_active(): self.apply() if not self._show_resize_dialog(disks): # User pressed cancel on the reclaim dialog, so don't leave # the storage spoke. self._back_clicked = False return elif rc == RESPONSE_CANCEL: # A cancel button was clicked on one of the dialogs. Stay on this # spoke. Generally, this is because the user wants to add more disks. self._back_clicked = False return elif rc == RESPONSE_MODIFY_SW: # The "Fedora software selection" link was clicked on one of the # dialogs. Send the user to the software spoke. self.skipTo = "SoftwareSelectionSpoke" elif rc == RESPONSE_RECLAIM: # Not enough space, but the user can make enough if they do some # work and free up space. self.encrypted = self._encrypted.get_active() if not self._check_encrypted(): return self.apply() if not self._show_resize_dialog(disks): # User pressed cancel on the reclaim dialog, so don't leave # the storage spoke. self._back_clicked = False return # And then go to the custom partitioning spoke if they chose to # do so. if self._customPart.get_active(): self.autopart = False self.skipTo = "CustomPartitioningSpoke" else: self.autopart = True elif rc == RESPONSE_QUIT: # Not enough space, and the user can't do anything about it so # they chose to quit. raise SystemExit("user-selected exit") else: # I don't know how we'd get here, but might as well have a # catch-all. Just stay on this spoke. self._back_clicked = False return if self.autopart: refreshAutoSwapSize(self.storage) self.applyOnSkip = True NormalSpoke.on_back_clicked(self, button)
def on_back_clicked(self, button): # We can't exit early if it looks like nothing has changed because the # user might want to change settings presented in the dialogs shown from # within this method. # Do not enter this method multiple times if user clicking multiple times # on back button if self._back_clicked: return else: self._back_clicked = True # make sure the snapshot of unmodified on-disk-storage model is created if not on_disk_storage.created: on_disk_storage.create_snapshot(self.storage) if self.autopart_missing_passphrase: self._setup_passphrase() NormalSpoke.on_back_clicked(self, button) return # No disks selected? The user wants to back out of the storage spoke. if not self.selected_disks: NormalSpoke.on_back_clicked(self, button) return disk_selection_changed = False if self._last_selected_disks: disk_selection_changed = (self._last_selected_disks != set( self.selected_disks)) # remember the disk selection for future decisions self._last_selected_disks = set(self.selected_disks) if disk_selection_changed: # Changing disk selection is really, really complicated and has # always been causing numerous hard bugs. Let's not play the hero # game and just revert everything and start over again. on_disk_storage.reset_to_snapshot(self.storage) self.disks = getDisks(self.storage.devicetree) else: # Remove all non-existing devices if autopart was active when we last # refreshed. if self._previous_autopart: self._previous_autopart = False self._remove_nonexistant_partitions() # hide disks as requested self._hide_disks() # make sure no containers were split up by the user's disk selection self.clear_info() # if there are some disk selection errors we don't let user to leave the # spoke, so these errors don't have to go to self.errors self.disks_errors = checkDiskSelection(self.storage, self.selected_disks) if self.disks_errors: # The disk selection has to make sense before we can proceed. self.set_error( _("There was a problem with your disk selection. " "Click here for details.")) self._back_clicked = False return if arch.isS390(): # check for unformatted DASDs and launch dasdfmt if any discovered rc = self._check_dasd_formats() if rc == DASD_FORMAT_NO_CHANGE: pass elif rc == DASD_FORMAT_REFRESH: # User hit OK on the dialog self.refresh() elif rc == DASD_FORMAT_RETURN_TO_HUB: # User clicked uri to return to hub. NormalSpoke.on_back_clicked(self, button) return else: # User either hit cancel on the dialog or closed it via escape, # there was no formatting done. self._back_clicked = False return # even if they're not doing autopart, setting autopart.encrypted # establishes a default of encrypting new devices self.encrypted = self._encrypted.get_active() # We might first need to ask about an encryption passphrase. if self.encrypted and not self._setup_passphrase(): self._back_clicked = False return # At this point there are three possible states: # 1) user chose custom part => just send them to the CustomPart spoke # 2) user wants to reclaim some more space => run the ResizeDialog # 3) we are just asked to do autopart => check free space and see if we need # user to do anything more self.autopart = not self._customPart.get_active() disks = [d for d in self.disks if d.name in self.selected_disks] dialog = None if not self.autopart: self.skipTo = "CustomPartitioningSpoke" elif self._reclaim.get_active(): # HINT: change the logic of this 'if' statement if we are asked to # support "reclaim before custom partitioning" # respect disk selection and other choices in the ReclaimDialog self.apply() dialog = ResizeDialog(self.data, self.storage, self.payload) dialog.refresh(disks) else: dialog = self._check_space_and_get_dialog(disks) if dialog: # more dialogs may need to be run based on user choices, but we are # only interested in the final result rc = self._run_dialogs(disks, start_with=dialog) if rc == RESPONSE_OK: # nothing special needed pass elif rc == RESPONSE_CANCEL: # A cancel button was clicked on one of the dialogs. Stay on this # spoke. Generally, this is because the user wants to add more disks. self._back_clicked = False return elif rc == RESPONSE_MODIFY_SW: # The "Fedora software selection" link was clicked on one of the # dialogs. Send the user to the software spoke. self.skipTo = "SoftwareSelectionSpoke" elif rc == RESPONSE_QUIT: # Not enough space, and the user can't do anything about it so # they chose to quit. raise SystemExit("user-selected exit") else: # I don't know how we'd get here, but might as well have a # catch-all. Just stay on this spoke. self._back_clicked = False return if self.autopart: refreshAutoSwapSize(self.storage) self.applyOnSkip = True NormalSpoke.on_back_clicked(self, button)