Пример #1
0
    # make Qt logs go to logger
    QtCore.qInstallMessageHandler(qt_message_handler)
    logger = logging.getLogger(__name__)
    logger.info('Annotator %s starting on %s (%s)', '0.0.0.0', platform.system(), sys.platform)

    if platform.system() == 'Windows':
        logger.info('Applying Windows-specific setup')

        # enable automatic scaling for high-DPI screens
        os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1'

        # set the App ID for Windows 7 to properly display the icon in the
        # taskbar.
        import ctypes
        myappid = '??????'  # arbitrary string
        try:
            ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
        except:
            logger.error('Could not set the app model ID. If the plaftorm is older than Windows 7, this is normal.')

    elif platform.system() == 'Darwin':
        pass
        # logger.info('Applying Mac OS-specific setup')

    app = QApplication(sys.argv)
    window = Annotator()
    window.show()
    return_code = app.exec_()
    del window  # prevent mac errors
    sys.exit(return_code)