class App(QApplication): def __init__(self, sys_argv): super(App, self).__init__(sys_argv) log.debug("This is the mainThread") self.init_logging() self.setAttribute(Qt.AA_EnableHighDpiScaling) self.setStyle("Fusion") self.mainWindow = MainWindow() self.mainWindow.setWindowTitle("jet-tracker") self.mainWindow.show() @staticmethod def init_logging(): logger = logging.getLogger() logger.setLevel(logging.NOTSET) # Console Handler handler = logging.StreamHandler() handler.setLevel(logging.CRITICAL) formatter = logging.Formatter( "%(asctime)s\t (%(name)-25.25s) (thread:%(thread)d) " "(line:%(lineno)5d)\t[%(levelname)-5.5s] %(message)s") handler.setFormatter(formatter) logger.addHandler(handler) @staticmethod def handle_exception(exc_type, exc_value, exc_traceback): if issubclass(exc_type, KeyboardInterrupt): sys.__excepthook__(exc_type, exc_value, exc_traceback) return log.error("Uncaught exception", exc_info=(exc_type, exc_value, exc_traceback))
class App(QApplication): def __init__(self, sys_argv): super(App, self).__init__(sys_argv) sys.excepthook = self.handle_exception self.init_logging() log.debug("This is the MAIN THREAD") self.setAttribute(Qt.AA_EnableHighDpiScaling) QFontDatabase.addApplicationFont( os.path.dirname(os.path.realpath(__file__)) + "\\gui\\misc\\Open_Sans\\OpenSans-Light.ttf") self.setStyle("Fusion") # self.setStyleSheet(CSSThemes().orange_theme()) self.mainModel = MainModel() self.mainWindow = MainWindow(model=self.mainModel) self.mainWindow.setWindowTitle("MinecraftAFK") self.mainWindow.show() @staticmethod def init_logging(): logger = logging.getLogger() logger.setLevel(logging.NOTSET) # create console handler handler = logging.StreamHandler() handler.setLevel(logging.NOTSET) formatter = logging.Formatter( "%(asctime)s\t\t (%(name)-15.15s) (thread:%(thread)d) (line:%(lineno)5d)\t\t[%(levelname)-5.5s] %(message)s" ) handler.setFormatter(formatter) logger.addHandler(handler) # create debug file handler in working directory paramsViewUiPath = os.path.dirname( os.path.realpath(__file__)) + "\\lensViewUi.ui" os.makedirs(os.path.dirname(os.path.realpath(__file__)) + "\\log", exist_ok=True) handler = RotatingFileHandler( os.path.dirname(os.path.realpath(__file__)) + "\\log\\virus-propagation-simulator.log", maxBytes=2.3 * 1024 * 1024, backupCount=5) handler.setLevel(logging.ERROR) formatter = logging.Formatter( "%(asctime)s\t\t (%(name)-25.25s) (thread:%(thread)d) (line:%(lineno)5d)\t\t[%(levelname)-5.5s] %(message)s" ) handler.setFormatter(formatter) logger.addHandler(handler) @staticmethod def handle_exception(exc_type, exc_value, exc_traceback): if issubclass(exc_type, KeyboardInterrupt): sys.__excepthook__(exc_type, exc_value, exc_traceback) return log.error("Uncaught exception", exc_info=(exc_type, exc_value, exc_traceback))
def __init__(self, sys_argv): super(App, self).__init__(sys_argv) log.debug("This is the mainThread") self.init_logging() self.setAttribute(Qt.AA_EnableHighDpiScaling) self.setStyle("Fusion") self.mainWindow = MainWindow() self.mainWindow.setWindowTitle("jet-tracker") self.mainWindow.show()
def __init__(self, sys_argv): super(App, self).__init__(sys_argv) sys.excepthook = self.handle_exception self.init_logging() self.setAttribute(Qt.AA_EnableHighDpiScaling) QFontDatabase.addApplicationFont(os.path.dirname(os.path.realpath(__file__)) +"\\gui\\misc\\Open_Sans\\OpenSans-Light.ttf") self.setStyle("Fusion") # self.setStyleSheet(CSSThemes().orange_theme()) self.mainModel = MainModel() self.mainWindow = MainWindow(model=self.mainModel) self.mainWindow.setWindowTitle("opt-id") self.mainWindow.show() log.info("This is the MAIN THREAD")
import sys from PyQt5 import QtWidgets, QtGui import logging from src.core.modules.scripts import convert from gui.windows.mainWindow import MainWindow if __name__ == '__main__': convert() app = QtWidgets.QApplication(sys.argv) img = QtGui.QPixmap('static\img\экран.png') splash = QtWidgets.QSplashScreen(img) splash.show() window = MainWindow() splash.finish(window) window.show() app.exec_()