def _reload(self, interactive=False, complete=True): """ Reloads original structure. """ if interactive: self.header(_("Reload original table")) print(_("This will reload the original partition table.")) print(_("All changes you've done will be lost.") + "\n") res = self.question(_("Do you want to continue?"), default=False) if not res: return self.edit_partitions() # Reload. lib.restore_devices(onlyusb=self.onlyusb) self.disks, self.devices = lib.disks, lib.devices # Remove touched self.touched.clear() # Also remove flags. for name, changes in self.changed.items(): if complete: # Clear. changes["changes"].clear() else: # Remove all but useas for key, value in changes["changes"].items(): if not key == "useas": del changes["changes"][key] if interactive: return self.edit_partitions()
def start(self): """ Start the frontend """ self.onlyusb = False # Cache distribs self.distribs = lib.check_distributions() #self.devices, self.disks = lib.return_devices() # Obtain devices self.devices, self.disks = lib.devices, lib.disks if self.settings["onlyusb"]: self.onlyusb = True # Keep track of onlyusb # Only usb, we need to rebuild devices. lib.restore_devices(onlyusb=True) self.touched = {} self.changed = {} self.main()