def restore_dialog_geometry(self): # Restore the geometry of the dialog # Should be called in the __init__(self) of the subclass settings = Settings() geometry = settings.value(self.__class__.__name__ + "Geometry" + str(self.dialog_type)) restore_geometry(self, geometry)
def restore_dialog_geometry(self): super(EditModelTestDialog, self).restore_dialog_geometry() with Settings(group=self.__class__.__name__) as settings: restore_state(self.splitter_horizontal, settings.value("SplitterH")) restore_state(self.splitter_vertical, settings.value("SplitterV"))
def save_dialog_geometry(self): super(EditModelTestDialog, self).save_dialog_geometry() with Settings(group=self.__class__.__name__) as settings: settings.setValue("SplitterH", self.splitter_horizontal.saveState()) settings.setValue("SplitterV", self.splitter_vertical.saveState())
def save_dialog_geometry(self): """ Save the geometry of the table in settings """ super(DuplicateDialog, self).save_dialog_geometry() Settings().setValue( self.__class__.__name__ + "TableHeader" + str(self.dialog_type), self.treeView.header().saveState())
def restore_dialog_geometry(self): """ Restore the geometry of the table from the settings """ super(DuplicateDialog, self).restore_dialog_geometry() header_state = Settings().value(self.__class__.__name__ + "TableHeader" + str(self.dialog_type)) restore_state(self.treeView.header(), header_state)
def load_maps(self): settings = Settings() last_path = settings.value("MapsLastPath", None) # Get file names to open file_paths, _ = QFileDialog.getOpenFileNames( self, self.tr("Select maps.."), last_path, self.tr("JSON file (*.json)")) # Load maps into escher builder objects for i, path in enumerate(file_paths): if path in self.maps: LOGGER.debug("{} already in list -> skipped.".format(path)) else: LOGGER.debug("Loading map: {0!s}".format(path)) with open(path) as read_file: content = read_file.read() try: loaded_map = MapWrapper(map_json=content, path=path) except json.JSONDecodeError: LOGGER.debug( "The file is not properly formatted JSON and has been skipped." ) QMessageBox().critical( None, "Format error", "'{0!s}' is not proper JSON and has been skipped.". format(path)) continue except WrongEscherFormat as e: LOGGER.debug(e, exc_info=True) QMessageBox().critical( None, "Format error", "'{0!s}' is not proper escher JSON and has been skipped." .format(path)) continue else: self.maps[path] = loaded_map LOGGER.debug("Map added.") if i == 0 and os.path.dirname(path) != last_path: new_path = os.path.dirname(path) settings.setValue("MapsLastPath", new_path) LOGGER.debug("Setting '{0!s}' set to '{1!s}'".format( "MapsLastPath", new_path)) # Update view self.update_items()
def restore_dialog_geometry(self): # Restore the geometry of the dialog # Should be called in the __init__(self) of the subclass with Settings(group=self.__class__.__name__) as settings: restore_geometry(self, settings.value("Geometry")) restore_state(self.tab_error.dataView.horizontalHeader(), settings.value("ErrorTable")) restore_state(self.tab_conflict.dataView.header(), settings.value("ConflictTable")) restore_state(self.tab_failing.dataView.header(), settings.value("Failingtable"))
def save_settings(self): """ Store dialog geometry in settings Returns ------- None """ with Settings(group=self.__class__.__name__) as settings: settings.setValue("SplitterState", self.splitter.saveState()) settings.setValue("TableHeader", self.dataView.header().saveState()) settings.setValue("DialogGeometry", self.saveGeometry())
def _restore_settings(self): """ Restore dialog geometry from setting Returns ------- """ with Settings(group=self.__class__.__name__) as settings: restore_state(self.dataView.header(), settings.value("TableHeader")) restore_geometry(self, settings.value("DialogGeometry")) restore_state(self.splitter, settings.value("SplitterState"))
def save_dialog_geometry(self): # Store the geometry of the dialog during the closing settings = Settings() settings.setValue( self.__class__.__name__ + "Geometry" + str(self.dialog_type), self.saveGeometry()) settings.sync()
def restore_geometry(self): with Settings(group=self.__class__.__name__) as settings: restore_geometry(self, settings.value("DialogGeometry")) for i in range(self.tabWidget.count()): self.tabWidget.widget(i).restore_geometry(settings)
def save_geometry(self): with Settings(group=self.__class__.__name__) as settings: settings.setValue("DialogGeometry", self.saveGeometry()) for i in range(self.tabWidget.count()): self.tabWidget.widget(i).save_geometry(settings)
def save_dialog_state(self): with Settings(group=self.__class__.__name__) as settings: settings.setValue("Geometry", self.saveGeometry()) settings.setValue("ErrorTable", self.tab_error.dataView.horizontalHeader().saveState()) settings.setValue("ConflictTable", self.tab_conflict.dataView.header().saveState()) settings.setValue("Failingtable", self.tab_failing.dataView.header().saveState())