def open_database(self, conn): """Open the project file and populate widgets Args: conn (sqlite3.Connection): Sqlite3 Connection """ self.conn = conn # Clear memoization cache for count_cmd # Clear State variable of application # store fields, source, filters, group_by, having data self.state = State() for plugin_obj in self.plugins.values(): plugin_obj.on_open_project(self.conn)
def __init__(self, parent=None): super().__init__(parent) self.setWindowTitle("Cutevariant") self.toolbar = self.addToolBar("maintoolbar") self.toolbar.setObjectName("maintoolbar") # For window saveState self.setWindowIcon(QIcon(DIR_ICONS + "app.png")) self.setWindowFlags(Qt.WindowContextHelpButtonHint | self.windowFlags()) # Keep sqlite connection self.conn = None # App settings self.app_settings = QSettings() # State variable of application # store fields, source, filters, group_by, having data # Often changed by plugins self.state = State() # Central workspace self.central_tab = QTabWidget() self.footer_tab = QTabWidget() self.vsplit = QSplitter(Qt.Vertical) self.vsplit.addWidget(self.central_tab) self.vsplit.addWidget(self.footer_tab) self.setCentralWidget(self.vsplit) # Status Bar self.status_bar = QStatusBar() self.setStatusBar(self.status_bar) # Setup menubar self.setup_menubar() # Setup toobar under the menu bar self.setup_toolbar() # Register plugins self.plugins = { } # dict of names (not titles) as keys and widgets as values self.dialog_plugins = { } # dict of actions as keys and classes as values self.register_plugins() # Window geometry self.resize(600, 400) self.setGeometry(QApplication.instance().desktop().rect().adjusted( 100, 100, -100, -100)) self.setTabPosition(Qt.AllDockWidgetAreas, QTabWidget.North) # If True, the GUI settings are deleted when the app is closed self.requested_reset_ui = False # Restores the state of this mainwindow's toolbars and dockwidgets self.read_settings() # Auto open recent projects recent = self.get_recent_projects() if recent and os.path.isfile(recent[0]): self.open(recent[0])
def __init__(self): super().__init__() self.state = State()
def __init__(self): super().__init__() self.state = State() self.step_counter = {}