def run(params: list) -> int: """ Starts the application. :return: Error code. If no error occurred returns 0. """ for item in params: if str(item).lower() == "--verbose": Config.set_executed_type(ExecutedType.Verbose) break result = -1 try: exec_real_path = os.path.realpath(params[0]) exec_dir = os.path.dirname(exec_real_path) Config.set_root_dir(exec_dir) app = QApplication(params) Tools.check_paths() window = MainWindow() window.show() result = app.exec_() except Exception as ex: # wildcard for an app crash Tools.write_log(ex) result = -2 finally: Tools.write_verbose("Application error code is %s" % result) return result
def exec(self, query_string: str) -> QSqlQuery: """ Executes query. :param query_string: Query to execute. :return: Executed query. """ query = self.__get_query() Tools.write_verbose(query_string) query.exec(query_string) Tools.write_log(query.lastError().text()) return query