self.start_button = QPushButton("Start", self) self.start_button.clicked.connect(self.tableModel.start) self.main_widget.addWidget(self.start_button) if __name__ == '__main__': log = Logger() qInstallMessageHandler(qt_message_handler) def exception_hook(exctype, value, tb): logging.critical(''.join(traceback.format_exception( exctype, value, tb))) sys.exit(1) sys.excepthook = exception_hook QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps) QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) QApplication.setQuitOnLastWindowClosed(True) app = QApplication(sys.argv) app.setStyleSheet(qrainbowstyle.load_stylesheet(style="oceanic")) win = MainWindow() win.createRequests() win.show() win.setupAlgorithms() sys.exit(app.exec())
if args.nogui: os.environ["QT_QPA_PLATFORM"] = "offscreen" if getattr(sys, 'frozen', False): application_path = os.path.dirname(sys.executable) elif __file__: application_path = os.path.dirname(__file__) else: application_path = "." logging.debug("Application path is {}".format(application_path)) os.chdir(application_path) sys.path.insert(0, os.path.abspath(MODULES_PATH)) sys.path.append(os.path.abspath(CLIENT_PATH)) QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps) QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) QApplication.setQuitOnLastWindowClosed(False) app = QApplication(sys.argv) app.setApplicationName(__app_name__) app.setApplicationVersion(__version__) app.setApplicationDisplayName(__app_name__) app.setStyleSheet(qrainbowstyle.load_stylesheet(style="Oceanic")) font = app.font() font.setPointSize(9) app.setFont(font) m = Main(args) m.connect_log_signal(logger.install_signal_handler()) sys.exit(app.exec_())