Example #1
0
 def default_setup(self):
     setup = {
         'setup': {
             'app': {
                 'name': QApplication.applicationName(),
                 'version': QApplication.applicationVersion()
             },
             'result_t_z': {
                 'font': {
                     'name': 'Monospace',
                     'size': 7
                 },
                 'color': '#fff',
                 'background_color': '#300A24'
             },
             'result_wind': {
                 'font': {
                     'name': 'Monospace',
                     'size': 7
                 },
                 'color': '#fff',
                 'background_color': '#300A24'
             },
             'result_spr': {
                 'font': {
                     'name': 'Monospace',
                     'size': 7
                 },
                 'color': '#fff',
                 'background_color': '#300A24'
             }
         }
     }
     return setup
Example #2
0
File: dPw.py Project: kvdum/st_code
    def about(self):
        QMessageBox.about(self, QApplication.applicationDisplayName(), 
          '''<strong>{name}</strong><br>Версія: <strong>{version}</strong><br>
Copyright \N{COPYRIGHT SIGN} {organization}, {years}<br>{description}.'''.format(name=QApplication.applicationDisplayName(),
            version=QApplication.applicationVersion(), 
            organization=QApplication.organizationName(), years='2017',
            description='Програма для гідравлічного розрахунку системи опалення'))
Example #3
0
    def __setupUi(self):
        layout = QVBoxLayout()
        label = QLabel(self)

        pixmap, _ = config.splash_screen()

        label.setPixmap(pixmap)

        layout.addWidget(label, Qt.AlignCenter)

        name = QApplication.applicationName()
        version = QApplication.applicationVersion()

        text = ABOUT_TEMPLATE.format(
            name=escape(name),
            version=escape(version),
        )
        # TODO: Also list all known add-on versions??.
        text_label = QLabel(text)
        layout.addWidget(text_label, Qt.AlignCenter)

        buttons = QDialogButtonBox(
            QDialogButtonBox.Close, Qt.Horizontal, self)
        layout.addWidget(buttons)
        buttons.rejected.connect(self.accept)
        layout.setSizeConstraint(QVBoxLayout.SetFixedSize)
        self.setLayout(layout)
Example #4
0
 def on_aboutAction_triggered(self):
     QMessageBox.about(
         self, self.tr('About'),
         self.tr('<h1>%s %s</h1>\n' +
                 '<p>Developed by <a href="%s">%s</a></p>') %
         (QApplication.applicationName(), QApplication.applicationVersion(),
          QApplication.organizationDomain(),
          QApplication.organizationName()))
Example #5
0
 def getLatestRelease(self):
     release = Release(QApplication.applicationVersion())
     _updates = self.getUpdates(release)
     if len(_updates) > 0:
         last_release = _updates[0]
         skip_release = setting_service.getSettingsValue(SKIP_RELEASE) == last_release.getVersion()
         if not skip_release:
             return last_release
     return None
Example #6
0
 def on_aboutAction(self):
     msg = (
         "{} v{}<br>"
         "<br>"
         "Copyright (C) 2018 <a href=\"mailto:[email protected]\">Eero Molkoselkä</a><br>"
         "<br>"
         "This software is licensed under WTFPL. See COPYING file for details.<br>"
     )
     QMessageBox.about(
         self, "About %s" % QApplication.applicationName(),
         msg.format(QApplication.applicationName(),
                    QApplication.applicationVersion()))
Example #7
0
def main(n):
    app = QApplication(sys.argv)
    setDefaultAppLocale(app)
    app.setApplicationName('KwWorkWindow')
    app.setApplicationVersion('1.0.0')

    if n == 1:
        window = KwWorkWindow()
    elif n == 2:
        window = QWidget()
        layout = QVBoxLayout(window)
        button = QPushButton('Як тебе не любити')
        button.setObjectName('calcButton')
        layout.addWidget(button)

        setup = {
            'setup': {
                'app': {
                    'name': QApplication.applicationName(),
                    'version': QApplication.applicationVersion()
                },
                'KwResultBrowser': {
                    'font': {
                        'name': 'Monospace',
                        'size': 7
                    },
                    'color': '#fff',
                    'background_color': '#300A24'
                }
            }
        }

        browser = KwResultBrowser(setup['setup']['KwResultBrowser'])
        browser.setText('Anton')
        layout.addWidget(browser)
        colorButton = KwColorButton()
        layout.addWidget(colorButton)
        colorChoicer = KwColorChoicer(Qt.green, Qt.magenta)
        layout.addWidget(colorChoicer)
        font_dataChoicer = KwFontDataChoicer()
        font_dataChoicer.fontChanged[str].connect(lambda font: print(font))
        font_dataChoicer.font_sizeChanged[int].connect(lambda s: print(s))
        layout.addWidget(font_dataChoicer)

    with open('ww_style.css', 'r') as f:
        app.setStyleSheet(f.read())

    window.show()
    sys.exit(app.exec())
Example #8
0
def startmain():
    """
    Initialise the application and display the main window.
    """
    args = parse_arguments()

    app = QApplication(sys.argv)
    app.cleanup_files = []

    if not args.native_style:
        app.setStyle(QStyleFactory.create('Fusion'))
        app.setPalette(QApplication.style().standardPalette())

    app_icon = QIcon(':/icons/ui/ot_icon.svg')
    print(app_icon.isNull(), app_icon.pixmap(200, 200).isNull())

    app.setApplicationName(APP_NAME)
    app.setApplicationVersion(VERSION_STRING)
    app.setOrganizationName(ORG_NAME)
    app.setWindowIcon(app_icon)

    print('AppName: {0:s}'.format(app.applicationName()))
    print('AppVersion: {0:s}'.format(app.applicationVersion()))
    print('Company Name: {0:s}'.format(app.organizationName()))

    QLocale.setDefault(QLocale(QLocale.English, QLocale.UnitedKingdom))

    # Add passed arguments to app.
    app.args = args
    print('Args:', app.args)

    # Check to see if application already running.
    existing_pid = instance_check(app)
    if existing_pid:
        print(existing_pid)
        if app.args.quit_existing:
            # Command line argument passed to close existing program. Do that, then quit.
            if platform.system() == "Windows":
                subprocess.Popen("taskkill /F /T /PID %i" % existing_pid, shell=True)
            else:
                os.killpg(existing_pid, signal.SIGKILL)
        else:
            message_box_error('Program already running.',
                              'You can only have one copy of the Bing Wallpaper Changer running at once.')
        sys.exit()

    mainwindow = MainWindow()
    # mainwindow.show()
    sys.exit(app.exec_())
Example #9
0
 def updateToolTip(self):
     db = ReaderDb()
     db.execute("select * from store where iscache=1")
     unread = db.cursor.fetchall()
     db.execute("select * from store where isstore=1")
     store = db.cursor.fetchall()
     db.execute("select * from store where istrash=1")
     trash = db.cursor.fetchall()
     self.setToolTip(
         self.tr('''<span style='font-size:14pt'>{} - {}</span>
     <br><span style='font-size:10pt'>Unread: {}</span>
     <br><span style='font-size:10pt'>Stored: {}</span>
     <br><span style='font-size:10pt'>Deleted: {}</span>''').format(
             QApplication.applicationName(),
             QApplication.applicationVersion(), len(unread), len(store),
             len(trash)))
Example #10
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.setupUi(self)
        self.setWindowFlags(self.windowFlags()
                            & ~Qt.WindowContextHelpButtonHint)
        self.setMaximumSize(432, 460)
        html = QCoreApplication.translate(
            "AboutDialog",
            "<p align=\"center\"><font size=\"+2\"><b>Tiled Map Editor</b></font><br><i>Version %s</i></p>\n"
            "<p align=\"center\">Copyright 2008-2015 Thorbj&oslash;rn Lindeijer<br>(see the AUTHORS file for a full list of contributors)</p>\n"
            "<p align=\"center\">You may modify and redistribute this program under the terms of the GPL (version 2 or later). "
            "A copy of the GPL is contained in the 'COPYING' file distributed with Tiled.</p>\n"
            "<p align=\"center\"><a href=\"http://www.mapeditor.org/\">http://www.mapeditor.org/</a></p>\n"
            % QApplication.applicationVersion())
        self.textBrowser.setHtml(html)
        self.donateButton.clicked.connect(self.donate)
Example #11
0
    def handleFeedReady(self):
        release = Release(QApplication.applicationVersion())
        self._updates = self.feed.getUpdates(release)
        if len(self._updates) > 0:
            self._latest_release = self._updates[0]

        if len(self._updates) == 0:
            self.setupNoUpdatesUi()
            logger.info("No release found.")
            return

        latest_version = self._latest_release.getVersion()
        skip_release = setting_service.getSettingsValue(
            SKIP_RELEASE) == latest_version
        if latest_version:
            self.setupUpdateUi()
            if self._silent and not skip_release:
                self._showDialog()
Example #12
0
    def load_setup(self):
        try:
            with open(self.CONFIG_FNAME, 'r') as f:
                setup = json.load(f)

            if setup['setup']['app']['name'] != QApplication.applicationName() or \
           setup['setup']['app']['version'] != QApplication.applicationVersion():
                QMessageBox.warning(
                    self, QApplication.applicationName(),
                    'Поточний файл налаштувань створений не для цієї програми або \
засторілий.\nПрийняті нові налаштування за промовчанням.')
                setup = self.default_setup()
        except Exception as err:
            QMessageBox.critical(self, QApplication.applicationName(),
                                 str(err))
            setup = self.default_setup()
        finally:
            self.__setup = setup
Example #13
0
def main(n):
    app = KwAntTeploMonitorDbl(sys.argv)
    app_exec_name = 'kwCalcGQ'
    app.setApplicationName(app_exec_name)
    app.setApplicationVersion('0.1.0')
    app.setWindowIcon(QIcon(os.path.abspath('class_x24.png')))
    app.setApplicationDisplayName('{} v {}'.format(app_exec_name.lstrip('kw'),
                                  app.applicationVersion()))
    QFontDatabase.addApplicationFont('Hack-Regular.ttf')
    
    if n == 1:
        window = KwMainWindow()
    elif n == 2:
        window = QWidget()
        layout = QVBoxLayout(window)
        button = QPushButton('Як тебе не любити')
        button.setObjectName('calcButton')
        layout.addWidget(button)
        
        setup = {'setup': {'app':
            {'name': QApplication.applicationName(),
             'version': QApplication.applicationVersion()},
            'KwResultBrowser': {'font': {'name': 'Monospace', 'size': 7}, 
                                  'color': '#fff', 'background_color': '#300A24'}
                           }
                 }
        
        browser = KwResultBrowser(setup['setup']['KwResultBrowser'])
        browser.setText('Anton')
        layout.addWidget(browser)
        colorButton = KwColorButton()
        layout.addWidget(colorButton)
        colorChoicer = KwColorChoicer(Qt.green, Qt.magenta)
        layout.addWidget(colorChoicer)
        font_dataChoicer = KwFontDataChoicer()
        font_dataChoicer.fontChanged[str].connect(lambda font: print(font))
        font_dataChoicer.font_sizeChanged[int].connect(lambda s: print(s))
        layout.addWidget(font_dataChoicer)
        
    with open('ww_style.css', 'r') as f:
        app.setStyleSheet(f.read())
        
    window.show()
    sys.exit(app.exec())
Example #14
0
    def __init__(self, parent = None):
        super().__init__(parent)

        self.setupUi(self)
        self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
        self.setMaximumSize(432, 460)
        html = QCoreApplication.translate(
                "AboutDialog",
                "<p align=\"center\"><font size=\"+2\"><b>Tiled Map Editor</b></font><br><i>Version %s</i></p>\n"
                "<p align=\"center\">Copyright 2008-2015 Thorbj&oslash;rn Lindeijer<br>(see the AUTHORS file for a full list of contributors)</p>\n"
                "<p align=\"center\">You may modify and redistribute this program under the terms of the GPL (version 2 or later). "
                "A copy of the GPL is contained in the 'COPYING' file distributed with Tiled.</p>\n"
                "<p align=\"center\"><a href=\"http://www.mapeditor.org/\">http://www.mapeditor.org/</a></p>\n"%QApplication.applicationVersion())
        self.textBrowser.setHtml(html)
        self.donateButton.clicked.connect(self.donate)
Example #15
0
def showVersion():
    qWarning("TMX Map Viewer" + QApplication.applicationVersion())
    def __init__(self, app):
        super().__init__()
        self.app = app
        self.setupUi(self)

        # Read icons
        self.app_icon = QIcon(":/icons/app.svg")
        self.star_icon = QIcon(":/icons/star.svg")
        self.star_inv_icon = QIcon(":/icons/star_inv.svg")
        self.trash_icon = QIcon(":/icons/delete.svg")
        self.quit_icon = QIcon(":/icons/quit_inv.svg")
        self.fake_icon = QIcon(":/icons/fake.svg")

        # Read settings
        self.settings = QSettings('b3d_version_manager', 'settings')

        is_register_blend = self.settings.value('is_register_blend', type=bool)
        self.is_run_minimized = self.settings.value('is_run_minimized',
                                                    type=bool)
        is_run_on_startup = self.settings.value('is_run_on_startup', type=bool)
        root_folder = self.settings.value('root_folder')
        if (not root_folder) or (not os.path.isdir(root_folder)):
            exe_path = os.path.dirname(sys.executable)
            self.settings.setValue('root_folder', exe_path)

        # Custom title bar
        self.title.setText("%s %s" % (QApplication.applicationName(),
                                      QApplication.applicationVersion()))
        self.btnClose.clicked.connect(self.close)
        self.btnMinimize.clicked.connect(self.showMinimized)

        # Custom menu bar
        self.actionToggleRegisterBlend.setChecked(is_register_blend)
        self.actionToggleRegisterBlend.triggered.connect(
            self.toggle_register_blend)

        self.actionToggleRunMinimized.setChecked(self.is_run_minimized)
        self.actionToggleRunMinimized.triggered.connect(
            self.toggle_run_minimized)

        self.actionToggleRunOnStartup.setChecked(is_run_on_startup)
        self.actionToggleRunOnStartup.triggered.connect(
            self.toggle_run_on_startup)

        self.actionQuit.triggered.connect(self.quit)

        self.menubar.hide()
        self.btnFile.setMenu(self.menuFile)

        # Root folder layout
        self.labelRootFolder.setText(self.settings.value('root_folder'))
        self.btnSetRootFolder.clicked.connect(self.set_root_folder)
        self.btnOpenRootFolder.clicked.connect(
            lambda: os.startfile(self.settings.value('root_folder')))

        # Tray layout
        self.blender_action = QAction(self.star_inv_icon, "Blender", self)
        show_action = QAction("Show", self)
        hide_action = QAction("Hide", self)
        quit_action = QAction(self.quit_icon, "Quit", self)

        self.blender_action.triggered.connect(self.open_latest_b3d)
        show_action.triggered.connect(self.bring_to_front)
        hide_action.triggered.connect(self.hide)
        quit_action.triggered.connect(self.quit)

        self.tray_menu = QMenu()
        self.tray_menu.addAction(self.blender_action)
        self.tray_menu.addSeparator()
        self.tray_menu.addAction(show_action)
        self.tray_menu.addAction(hide_action)
        self.tray_menu.addAction(quit_action)

        self.tray_icon = QSystemTrayIcon(self.app_icon, self)
        self.tray_icon.setContextMenu(self.tray_menu)
        self.tray_icon.messageClicked.connect(self.bring_to_front)
        self.tray_icon.activated.connect(lambda btn: self.bring_to_front()
                                         if btn == 3 else False)
        self.tray_icon.show()

        # Version layout
        self.btnUpdate.clicked.connect(self.update)
        self.set_task_visible(False)
        self.layouts = []
        self.latest_local = None
        self.collect_versions()
        self.draw_list_versions()

        # Custom drag behaviour
        self.old_pos = self.pos()
        self.pressed = False

        # Update task
        self.is_update_running = False
        self.uptodate_silent = False
        self.uptodate_thread = CheckForUpdates(self)
        self.uptodate_thread.new_version_obtained.connect(
            self.show_new_version)
        self.uptodate_thread.start()

        self.taskbar_progress = None
Example #17
0
 def showVersion(self):
     if (not self.showedVersion):
         self.showedVersion = True
         qWarning(QApplication.applicationDisplayName() + '\n' +
                  QApplication.applicationVersion())
         self.quit = True
Example #18
0
 def showVersion(self):
     if (not self.showedVersion):
         self.showedVersion = True
         qWarning(QApplication.applicationDisplayName()+'\n'+QApplication.applicationVersion())
         self.quit = True
Example #19
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.__setup = {}
        self.load_setup()

        self.load_db()

        layout = QVBoxLayout(self)

        gb_1 = QGroupBox('Параметри зовнішнього повітря:')

        self.__cityChoice_1 = QComboBox(self)
        self.__cityChoice_1.addItems(self.__t_z_data.cities())

        calcButton_1 = KwCalcButton(self)
        calcButton_1.clicked.connect(self.calc_t_z_data)

        self.__resultEdit_1 = KwResultBrowser(
            self.__setup['setup']['result_t_z'], self)

        gb_1Layout = QVBoxLayout(gb_1)
        gb_1subLayout = QHBoxLayout()
        gb_1subLayout.addWidget(QLabel('Місто:'))
        gb_1subLayout.addWidget(self.__cityChoice_1)
        gb_1subLayout.addSpacing(5)
        gb_1subLayout.addWidget(calcButton_1)
        gb_1subLayout.addStretch()

        gb_1Layout.addLayout(gb_1subLayout)
        gb_1Layout.addWidget(self.__resultEdit_1)

        layout.addWidget(gb_1)

        # -----------------------------------------------
        gb_2 = QGroupBox('Характеристики вітру:')

        self.__cityChoice_2 = QComboBox(self)
        self.__cityChoice_2.addItems(self.__janguary_wind_dir.cities())

        self.__seasonChoice_2 = QComboBox(self)
        self.__seasonChoice_2.addItem('cічень', 'jan')
        self.__seasonChoice_2.addItem('липень', 'jul')

        calcButton_2 = KwCalcButton(self)
        calcButton_2.clicked.connect(self.calc_wind_dir)

        self.__resultEdit_2 = KwResultBrowser(
            self.__setup['setup']['result_wind'], self)

        gb_2Layout = QVBoxLayout(gb_2)
        gb_2subLayout = QHBoxLayout()
        gb_2subLayout.addWidget(QLabel('Місто:'))
        gb_2subLayout.addWidget(self.__cityChoice_2)
        gb_2subLayout.addSpacing(5)
        gb_2subLayout.addWidget(QLabel('Сезон:'))
        gb_2subLayout.addWidget(self.__seasonChoice_2)
        gb_2subLayout.addSpacing(5)
        gb_2subLayout.addWidget(calcButton_2)
        gb_2subLayout.addStretch()

        gb_2Layout.addLayout(gb_2subLayout)
        gb_2Layout.addWidget(self.__resultEdit_2)

        layout.addWidget(gb_2)

        # ------------------------------------------------
        gb_3 = QGroupBox('Нагрівальні прилади:')

        self.__t_1Edit_3 = QSpinBox(self)
        self.__t_1Edit_3.setRange(0, 150)
        self.__t_1Edit_3.setValue(95)

        self.__t_2Edit_3 = QSpinBox(self)
        self.__t_2Edit_3.setRange(0, 150)
        self.__t_2Edit_3.setValue(70)

        self.__t_vEdit_3 = QSpinBox(self)
        self.__t_vEdit_3.setRange(0, 50)
        self.__t_vEdit_3.setValue(20)

        self.__QEdit_3 = QSpinBox(self)
        self.__QEdit_3.setRange(0, 10**6)

        self.__vendorChoice_3 = QComboBox(self)
        self.__vendorChoice_3.addItem('Radik Klasic', 'radik klasic')
        self.__vendorChoice_3.addItem('Vogel&Noot', 'vogel_noot')

        self.__modelChoice_3 = QComboBox(self)
        self.__modelChoice_3.addItem('var')
        self.__modelChoice_3.setEditable(True)

        self.__hChoice_3 = QComboBox(self)
        self.__hChoice_3.addItem('500')
        self.__hChoice_3.addItem('var')
        self.__hChoice_3.setEditable(True)

        calcButton_3 = KwCalcButton(self)
        calcButton_3.clicked.connect(self.calc_spr)

        self.__resultEdit_3 = KwResultBrowser(
            self.__setup['setup']['result_spr'], self)

        gb_3Layout = QVBoxLayout(gb_3)

        h1_gb_3subLayout = QHBoxLayout()
        h1_gb_3subLayout.addWidget(QLabel('t_1:'))
        h1_gb_3subLayout.addWidget(self.__t_1Edit_3)
        h1_gb_3subLayout.addSpacing(5)
        h1_gb_3subLayout.addWidget(QLabel('t_2:'))
        h1_gb_3subLayout.addWidget(self.__t_2Edit_3)
        h1_gb_3subLayout.addSpacing(5)
        h1_gb_3subLayout.addWidget(QLabel('t_v:'))
        h1_gb_3subLayout.addWidget(self.__t_vEdit_3)
        h1_gb_3subLayout.addSpacing(5)
        h1_gb_3subLayout.addWidget(QLabel('Q, Вт:'))
        h1_gb_3subLayout.addWidget(self.__QEdit_3)
        h1_gb_3subLayout.addStretch()
        gb_3Layout.addLayout(h1_gb_3subLayout)

        h2_gb_3subLayout = QHBoxLayout()
        h2_gb_3subLayout.addWidget(QLabel('Марка:'))
        h2_gb_3subLayout.addWidget(self.__vendorChoice_3)
        h2_gb_3subLayout.addSpacing(5)
        h2_gb_3subLayout.addWidget(QLabel('Тип:'))
        h2_gb_3subLayout.addWidget(self.__modelChoice_3)
        h2_gb_3subLayout.addSpacing(5)
        h2_gb_3subLayout.addWidget(QLabel('h, мм:'))
        h2_gb_3subLayout.addWidget(self.__hChoice_3)
        h2_gb_3subLayout.addSpacing(5)
        h2_gb_3subLayout.addWidget(calcButton_3)
        h2_gb_3subLayout.addStretch()
        gb_3Layout.addLayout(h2_gb_3subLayout)

        gb_3Layout.addWidget(self.__resultEdit_3)

        layout.addWidget(gb_3)

        self.setWindowTitle('{} v {}'.format(
            QApplication.applicationName(), QApplication.applicationVersion()))
def startContainer(container: Container, start_only=False, force=False):
    """
    Start the given container
    Collecting all configurations of the given container including environments, port mapping, volume mounts and
    shortcuts. The preferences of Shortcut take highest priority and will override if it existing in
    any other configurations
    :param container: container to be start
    :param start_only: start the container
    :param force: force reset the container
    :return: assign the container id and return container object
    """

    container_tag = container.tag
    if isContainerExists(container) and not start_only and not force:
        level = auditing_service.containerChangingLevel(container)
        if level == 0:
            start_only = True
        else:
            raise ContainerConfigurationChangedException()

    if isContainerExists(container) and start_only and not force:
        docker_container = docker_service.getContainerInfo(
            container.container_id)
        docker_container.start()
        return container

    if isContainerExists(container):
        # At this point, the container should be reset, so, clean it up
        docker_service.deleteContainer(container.container_id)

    envs = {}

    for environment in environment_service.getEnvironments(container):
        envs[environment.name] = environment.value

    envs = {**envs, **shortcut_service.getShortcutContainerEnvs(container)}

    ports = {}
    for port in port_mapping_service.getPortMappings(container):
        ports[str(port.port) + '/' + port.protocol] = port.target_port

    ports = {**ports, **shortcut_service.getShortcutPortMapping(container)}

    volumes = {}
    for volume in volume_mount_service.getVolumeMounts(container):
        volumes[volume.host_path] = {
            'bind': volume.container_path,
            'mode': volume.mode
        }

    volumes = {
        **volumes,
        **shortcut_service.getShortcutVolumeMounts(container)
    }

    entrypoint = container.entrypoint if container.entrypoint else None
    kwargs = {
        'labels': {
            'original': 'boatswain',
            'original_version': QApplication.applicationVersion()
        }
    }
    if container.memory_limit:
        kwargs['mem_limit'] = "%dm" % container.memory_limit
    if container.cpu_limit:
        kwargs['cpu_period'] = 100000
        kwargs['cpu_quota'] = int(container.cpu_limit * 100000)
    docker_container = docker_service.run(container.image_name, container_tag,
                                          ports, envs, volumes, entrypoint,
                                          **kwargs)
    container.container_id = docker_container.short_id
    return container
    def __init__(self, app, platform):
        super().__init__()
        self.app = app
        self.platform = platform

        self.setWindowFlags(Qt.FramelessWindowHint)
        self.setupUi(self)

        # Read icons
        self.icon_app = QIcon(":/icons/app.svg")
        self.icon_star = QIcon(":/icons/star.png")
        self.icon_trash = QIcon(":/icons/delete.png")
        self.icon_quit = QIcon(":/icons/quit.png")
        self.icon_fake = QIcon(":/icons/fake.svg")

        # Read settings
        self.settings = QSettings('b3d_version_manager', 'settings')

        is_register_blend = self.settings.value('is_register_blend', type=bool)
        self.is_run_minimized = self.settings.value('is_run_minimized',
                                                    type=bool)
        is_run_on_startup = self.settings.value('is_run_on_startup', type=bool)
        root_folder = self.settings.value('root_folder')
        if (not root_folder) or (not os.path.isdir(root_folder)):
            exe_path = os.path.dirname(sys.executable)
            self.settings.setValue('root_folder', exe_path)

        # Custom title bar
        self.btnWiki.clicked.connect(lambda: webbrowser.open(
            "https://github.com/DotBow/Blender-Version-Manager/wiki"))
        self.title.setText("%s %s" % (QApplication.applicationName(),
                                      QApplication.applicationVersion()))
        self.btnClose.clicked.connect(self.hide)
        self.btnMinimize.clicked.connect(self.showMinimized)

        # Custom menu bar
        self.actionToggleRegisterBlend.setChecked(is_register_blend)
        self.actionToggleRegisterBlend.triggered.connect(
            self.toggle_register_blend)

        self.actionToggleRunMinimized.setChecked(self.is_run_minimized)
        self.actionToggleRunMinimized.triggered.connect(
            self.toggle_run_minimized)

        self.actionToggleRunOnStartup.setChecked(is_run_on_startup)
        self.actionToggleRunOnStartup.triggered.connect(
            self.toggle_run_on_startup)

        self.menubar.hide()
        self.btnSettings.setMenu(self.menuFile)

        self.menuFile.installEventFilter(self)

        # Root folder layout
        self.labelRootFolder.setText(self.settings.value('root_folder'))
        self.btnSetRootFolder.clicked.connect(self.set_root_folder)
        self.btnOpenRootFolder.clicked.connect(
            lambda: os.startfile(self.settings.value('root_folder')))

        # Tray layout
        self.blender_action = QAction(self.icon_star, "Blender    ", self)
        show_action = QAction("Show", self)
        hide_action = QAction("Hide", self)
        quit_action = QAction(self.icon_quit, "Quit", self)

        self.blender_action.triggered.connect(self.open_latest_b3d)
        show_action.triggered.connect(self.bring_to_front)
        hide_action.triggered.connect(self.hide)
        quit_action.triggered.connect(self.quit)

        self.tray_menu = QMenu()
        self.tray_menu.setStyleSheet(self.menuFile.styleSheet())
        self.tray_menu.addAction(self.blender_action)
        self.tray_menu.addAction(show_action)
        self.tray_menu.addAction(hide_action)
        self.tray_menu.addAction(quit_action)

        self.tray_icon = QSystemTrayIcon(self.icon_app, self)
        self.tray_icon.setToolTip("Blender Version Manager")
        self.tray_icon.setContextMenu(self.tray_menu)
        self.tray_icon.messageClicked.connect(self.bring_to_front)
        self.tray_icon.activated.connect(self.onTrayIconActivated)
        self.tray_icon.show()

        # Version layout
        self.btnUpdate.clicked.connect(self.update)
        self.set_task_visible(False)
        self.zeroBuildsWarning.hide()
        self.layouts = []
        self.collect_versions()
        self.draw_list_versions()

        # Custom drag behaviour
        self.old_pos = self.pos()
        self.pressed = False

        # Update task
        self.is_update_running = False
        self.start_uptodate_thread()

        self.taskbar_progress = None

        self.left_click_timer = QTimer(self)
        self.left_click_timer.setSingleShot(True)
        self.left_click_timer.timeout.connect(self.bring_to_front)