def closeEvent(self, event): """The window was closed""" # Determine the window state state = self.windowState() window_state = 'none' if state & QtCore.Qt.WindowFullScreen: window_state = 'fullscreen' elif state & QtCore.Qt.WindowMaximized: window_state = 'maximized' elif state & QtCore.Qt.WindowMinimized: window_state = 'minimized' else: # Save the window geometry for normal state geometry = self.geometry() Config.set('window/geometry', [ geometry.x(), geometry.y(), geometry.width(), geometry.height() ]) # Save the window state Config.set('window/state', window_state) # Save the configuration Config.save() # Continue to close the window QtWidgets.QMainWindow.closeEvent(self, event)
def save_repo_entry(repo_path, repo_url=None): repos = Config.get('repos', defaultValue=[]) duplicate_found = False for index, repo in enumerate(repos): if repo['path'] == repo_path: repos[index]['url'] = repo_url duplicate_found = True break if not duplicate_found: repos.append({'path': repo_path, 'url': repo_url}) Config.set('repos', repos) Config.save()
def _save_prefs_clicked(self): """Advanced preferences editor saved""" if not Config.replace( self._prefs_editor.toPlainText()) or not Config.save(): QtWidgets.QMessageBox.critical( App.get_window(), App.get_name(), f'Could not save the configuration "{Config.get("path/config")}"!' )
def uninstallCurrentPlugin(self): item = self.plugin_list.currentItem() if item is not None and PluginManager.uninstall(item.text(1)): Config.save() (item.parent() or self.plugin_list.invisibleRootItem()).removeChild(item) self.changeButtonStates()
def disableCurrentPlugin(self): item = self.plugin_list.currentItem() if item is not None and PluginManager.disable(item.text(1)): item.setText(0, chr(9898)) Config.save() self.changeButtonStates()
def enableCurrentPlugin(self): item = self.plugin_list.currentItem() if item is not None and PluginManager.load_and_enable(item.text(1)): item.setText(0, chr(128309)) Config.save() self.changeButtonStates()