示例#1
0
def main():
    """The main routine."""
    # Define the names of the organization and the application
    # The value is used by the QSettings class when it is constructed using
    # the empty constructor. This saves having to repeat this information
    # each time a QSettings object is created.
    # The default scope is QSettings::UserScope
    QCoreApplication.setOrganizationName("labsquare")
    QCoreApplication.setApplicationName("cutevariant")
    QCoreApplication.setApplicationVersion(__version__)

    # Process command line arguments
    app = QApplication(sys.argv)
    process_arguments(app)

    # Load app styles
    load_styles(app)

    # # Uncomment those line to clear settings
    # settings = QSettings()
    # settings.clear()

    # Set icons set
    setFontPath(cm.FONT_FILE)

    # Translations
    load_translations(app)

    # debug settings
    # from cutevariant.gui.settings import *
    # w = SettingsWidget()
    # w.show()

    # Splash screen
    splash = QSplashScreen()
    splash.setPixmap(QPixmap(cm.DIR_ICONS + "splash.png"))
    splash.showMessage(f"Version {__version__}")
    splash.show()
    app.processEvents()

    #  Drop settings if old version
    settings = QSettings()
    settings_version = settings.value("version", None)
    if settings_version is None or parse_version(
            settings_version) < parse_version(__version__):
        settings.clear()
        settings.setValue("version", __version__)

    # Display
    w = MainWindow()

    # STYLES = cm.DIR_STYLES + "frameless.qss"
    # with open(STYLES,"r") as file:
    #     w.setStyleSheet(file.read())

    w.show()
    splash.finish(w)
    app.exec_()
示例#2
0
def __show_main_window(splash: QtWidgets.QSplashScreen,
                       event_source: EventSource) -> MainWindow:
    splash.showMessage("Creating main window...", Qt.AlignBottom,
                       QtGui.QColor("#F0F0F0"))
    icon = QtGui.QIcon(str(HERE.joinpath("images/icon.png")))
    window = MainWindow(icon, event_source)
    window.show()
    splash.finish(window)
    return window
示例#3
0
class App:
    def __init__(self):
        # Create a Qt application
        self.app = QApplication(sys.argv)
        self.main = BT('main.ui')

        self.splash = QSplashScreen(QPixmap('../images/boot.jpg'))
        self.splash.show()

        menu = QMenu()
        showAction = menu.addAction("显示")
        hideAction = menu.addAction("隐藏")
        closeAction = menu.addAction("退出")

        showAction.triggered.connect(
            lambda event: self.show(showAction, hideAction))
        hideAction.triggered.connect(
            lambda event: self.hide(showAction, hideAction))
        closeAction.triggered.connect(self.exit)

        self.tray = QSystemTrayIcon()
        self.tray.setIcon(QIcon("../icon/icon.ico"))
        self.tray.setContextMenu(menu)
        self.tray.show()
        self.tray.setToolTip("")

    def run(self):
        # Enter Qt application main loop

        self.app.processEvents()

        self.main.window.show()

        self.splash.finish(self.main.window)

        sys.exit(self.app.exec_())

    def hide(self, show_action, hiden_actoin):
        hiden_actoin.setDisabled(True)
        show_action.setEnabled(True)
        self.main.window.hide()
        return

    def show(self, show_action, hiden_actoin):
        hiden_actoin.setEnabled(True)
        show_action.setDisabled(True)
        self.main.window.show()
        return

    def exit(self):
        self.main.window.close()
        return
示例#4
0
def main(filepath=None):

    if not check_dependencies():
        sys.exit(1)

    set_app_user_model_id()

    from PySide2.QtWidgets import QApplication, QSplashScreen
    from PySide2.QtGui import QFontDatabase, QPixmap, QIcon
    from PySide2.QtCore import Qt

    from .config import FONT_LOCATION, IMG_LOCATION

    app = QApplication(sys.argv)
    app.setApplicationDisplayName("angr management")
    app.setApplicationName("angr management")

    # Make + display splash screen
    splashscreen_location = os.path.join(IMG_LOCATION, 'angr-splash.png')
    splash_pixmap = QPixmap(splashscreen_location)
    splash = QSplashScreen(splash_pixmap, Qt.WindowStaysOnTopHint)
    icon_location = os.path.join(IMG_LOCATION, 'angr.png')
    splash.setWindowIcon(QIcon(icon_location))
    splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)
    splash.setEnabled(False)
    splash.show()
    time.sleep(0.05)
    app.processEvents()

    from .logic import GlobalInfo
    from .ui.css import CSS
    from .ui.main_window import MainWindow

    # Load fonts
    QFontDatabase.addApplicationFont(
        os.path.join(FONT_LOCATION, "SourceCodePro-Regular.ttf"))

    GlobalInfo.gui_thread = threading.get_ident()

    # apply the CSS
    app.setStyleSheet(CSS.global_css())

    file_to_open = filepath if filepath else sys.argv[1] if len(
        sys.argv) > 1 else None
    main_window = MainWindow()
    splash.finish(main_window)

    if file_to_open is not None:
        main_window.load_file(file_to_open)

    app.exec_()
示例#5
0
文件: main.py 项目: rk-exxec/MAEsure
    def __init__(self, *args, **kwargs):
        super(App, self).__init__(*args, **kwargs)
        pic = QPixmap('qt_resources/maesure.png')
        splash = QSplashScreen(pic)  #, Qt.WindowStaysOnTopHint)
        #splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)
        splash.setMask(pic.mask())
        splash.show()
        self.window = MainWindow()
        self.ui = Ui_main()
        self.window.ui = self.ui
        self.ui.setupUi(self.window)
        self.window.show()

        splash.finish(self.window)
示例#6
0
class Splash:
    def __init__(self):
        splash_pix = QPixmap('resources/splash.png')

        self.splash = QSplashScreen(
            splash_pix, Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)

    def show(self):
        self.splash.show()
        self.splash.showMessage("Some message or no message",
                                Qt.AlignTop | Qt.AlignCenter, Qt.black)

    def finish(self, form):
        self.splash.finish(form)
示例#7
0
def run_ui(game: Optional[Game] = None) -> None:
    os.environ[
        "QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"  # Potential fix for 4K screens
    app = QApplication(sys.argv)

    # init the theme and load the stylesheet based on the theme index
    liberation_theme.init()
    with open("./resources/stylesheets/" +
              liberation_theme.get_theme_css_file()) as stylesheet:
        logging.info('Loading stylesheet: %s',
                     liberation_theme.get_theme_css_file())
        app.setStyleSheet(stylesheet.read())

    # Inject custom payload in pydcs framework
    custom_payloads = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                                   "..\\resources\\customized_payloads")
    if os.path.exists(custom_payloads):
        dcs.unittype.FlyingType.payload_dirs.append(custom_payloads)
    else:
        # For release version the path is different.
        custom_payloads = os.path.join(
            os.path.dirname(os.path.realpath(__file__)),
            "resources\\customized_payloads")
        if os.path.exists(custom_payloads):
            dcs.unittype.FlyingType.payload_dirs.append(custom_payloads)

    first_start = liberation_install.init()
    if first_start:
        window = QLiberationFirstStartWindow()
        window.exec_()

    logging.info("Using {} as 'Saved Game Folder'".format(
        persistency.base_path()))
    logging.info("Using {} as 'DCS installation folder'".format(
        liberation_install.get_dcs_install_directory()))

    # Splash screen setup
    pixmap = QPixmap("./resources/ui/splash_screen.png")
    splash = QSplashScreen(pixmap)
    splash.show()

    # Once splash screen is up : load resources & setup stuff
    uiconstants.load_icons()
    uiconstants.load_event_icons()
    uiconstants.load_aircraft_icons()
    uiconstants.load_vehicle_icons()
    uiconstants.load_aircraft_banners()
    uiconstants.load_vehicle_banners()

    # Replace DCS Mission scripting file to allow DCS Liberation to work
    try:
        liberation_install.replace_mission_scripting_file()
    except:
        error_dialog = QtWidgets.QErrorMessage()
        error_dialog.setWindowTitle("Wrong DCS installation directory.")
        error_dialog.showMessage(
            "Unable to modify Mission Scripting file. Possible issues with rights. Try running as admin, or please perform the modification of the MissionScripting file manually."
        )
        error_dialog.exec_()

    # Apply CSS (need works)
    GameUpdateSignal()

    # Start window
    window = QLiberationWindow(game)
    window.showMaximized()
    splash.finish(window)
    qt_execution_code = app.exec_()

    # Restore Mission Scripting file
    logging.info("QT App terminated with status code : " +
                 str(qt_execution_code))
    logging.info("Attempt to restore original mission scripting file")
    liberation_install.restore_original_mission_scripting()
    logging.info("QT process exited with code : " + str(qt_execution_code))
示例#8
0
    splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
    splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)
    splash.setEnabled(False)
    # splash = QSplashScreen(splash_pix)
    # adding progress bar
    progressBar = QProgressBar(splash)
    progressBar.setMaximum(10)
    progressBar.setGeometry(0,
                            splash_pix.height() - 50, splash_pix.width(), 20)
    # splash.setMask(splash_pix.mask())

    splash.show()
    splash.showMessage(
        "<h1><font color='black' size= 10>New Neuro Spec !</font></h1>",
        Qt.AlignTop | Qt.AlignCenter, Qt.black)

    for i in range(1, 11):
        progressBar.setValue(i)
        t = time()
        while time() < t + 0.1:
            app.processEvents()

    # Simulate something that takes time
    with loop:
        window33 = MainWindow()
        window33.show()
        splash.finish(window33)
        sys.exit(app.exec_())
        loop.run_forever()
    print('ended')
示例#9
0
    import utils
    show_splash_msg("Loading utils library...")
    import detail
    show_splash_msg("Loading detail library...")
    import db
    show_splash_msg("Loading database library...")
    import motif
    show_splash_msg("Loading motif library...")
    #import plot
    #show_splash_msg("Loading plot library...")
    import statistics
    show_splash_msg("Loading statistical library...")
    import workers
    show_splash_msg("Loading workers...")
    import widgets
    show_splash_msg("Loading main widgets...")

    #set style sheet like css
    app.setStyleSheet(config.STYLE_QSS)

    #create main windows
    from widgets import SSRMainWindow
    win = SSRMainWindow()
    win.show()

    #stop splash screen
    splash.finish(win)

    #start the main loop
    sys.exit(app.exec_())
示例#10
0
文件: main.py 项目: nwagu/pablo
        self.paged_text_edit.setThemeColor(mainColorHex)


if __name__ == '__main__':

    app = QApplication(sys.argv)
    pixmap = QPixmap(GenUtils.resource_path("src/images/splash.jpg"))
    splash = QSplashScreen(pixmap, Qt.WindowStaysOnTopHint)

    progressBar = QProgressBar(splash)
    progressBar.setFixedSize(splash.width(), 5)
    progressBar.setTextVisible(False)
    progressBar.setStyleSheet(
        " QProgressBar { background-color: red; } QProgressBar::chunk { background-color: orange }"
    )
    splash.setMask(pixmap.mask())

    splash.show()
    for i in range(0, 100):
        progressBar.setValue(i)
        t = time.time()
        while time.time() < t + 0.01:
            app.processEvents()

    app.processEvents()

    main_win = create_main_window()
    splash.finish(main_win)
    exit_code = app.exec_()
    sys.exit(exit_code)
示例#11
0
def start_management(filepath=None, use_daemon=False):

    if sys.platform == "darwin":
        macos_bigsur_wants_layer()

    if not check_dependencies():
        sys.exit(1)

    set_app_user_model_id()
    set_windows_event_loop_policy()

    from PySide2.QtWidgets import QApplication, QSplashScreen, QMessageBox
    from PySide2.QtGui import QFontDatabase, QPixmap, QIcon
    from PySide2.QtCore import Qt

    from .config import FONT_LOCATION, IMG_LOCATION, Conf

    app = QApplication(sys.argv)
    app.setApplicationDisplayName("angr management")
    app.setApplicationName("angr management")
    icon_location = os.path.join(IMG_LOCATION, 'angr.png')
    QApplication.setWindowIcon(QIcon(icon_location))

    # URL scheme
    from .logic.url_scheme import AngrUrlScheme
    scheme = AngrUrlScheme()
    registered, _ = scheme.is_url_scheme_registered()
    supported = scheme.is_url_scheme_supported()
    if not registered and supported:
        btn = QMessageBox.question(None, "Setting up angr URL scheme",
                "angr URL scheme allows \"deep linking\" from browsers and other applications by registering the "
                "angr:// protocol to the current user. Do you want to register it? You may unregister at any "
                "time in Preferences.",
                defaultButton=QMessageBox.Yes)
        if btn == QMessageBox.Yes:
            try:
                AngrUrlScheme().register_url_scheme()
            except (ValueError, FileNotFoundError) as ex:
                QMessageBox.warning(None, "Error in registering angr URL scheme",
                        "Failed to register the angr URL scheme.\n"
                        "The following exception occurred:\n"
                        + str(ex))

    # Make + display splash screen
    splashscreen_location = os.path.join(IMG_LOCATION, 'angr-splash.png')
    splash_pixmap = QPixmap(splashscreen_location)
    splash = QSplashScreen(splash_pixmap, Qt.WindowStaysOnTopHint)
    icon_location = os.path.join(IMG_LOCATION, 'angr.png')
    splash.setWindowIcon(QIcon(icon_location))
    splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)
    splash.setEnabled(False)
    splash.show()
    for _ in range(5):
        time.sleep(0.01)
        app.processEvents()

    from .logic import GlobalInfo
    from .ui.css import CSS
    from .ui.main_window import MainWindow
    from .daemon import daemon_exists, run_daemon_process, daemon_conn
    from .daemon.client import ClientService

    # Load fonts
    QFontDatabase.addApplicationFont(os.path.join(FONT_LOCATION, "SourceCodePro-Regular.ttf"))
    QFontDatabase.addApplicationFont(os.path.join(FONT_LOCATION, "DejaVuSansMono.ttf"))

    # Initialize font-related configuration
    Conf.init_font_config()
    # Set global font
    app.setFont(Conf.ui_default_font)

    GlobalInfo.gui_thread = threading.get_ident()

    # apply the CSS
    app.setStyleSheet(CSS.global_css())

    if use_daemon:
        # connect to daemon (if there is one)
        if not daemon_exists():
            print("[+] Starting a new daemon.")
            run_daemon_process()
            time.sleep(0.2)
        else:
            print("[+] Connecting to an existing angr management daemon.")

        while True:
            try:
                GlobalInfo.daemon_conn = daemon_conn(service=ClientService)
            except ConnectionRefusedError:
                print("[-] Connection failed... try again.")
                time.sleep(0.4)
                continue
            print("[+] Connected to daemon.")
            break

        from rpyc import BgServingThread
        th = BgServingThread(GlobalInfo.daemon_conn)

    file_to_open = filepath if filepath else None
    main_window = MainWindow()
    splash.finish(main_window)

    if file_to_open is not None:
        main_window.load_file(file_to_open)

    app.exec_()
示例#12
0
def start_management(filepath=None, use_daemon=None, profiling=False):

    if sys.platform == "darwin":
        macos_bigsur_wants_layer()

    if not check_dependencies_qt():
        # it's likely that other dependencies are also missing. check them here before exiting.
        check_dependencies()
        sys.exit(1)

    set_app_user_model_id()
    set_windows_event_loop_policy()

    from PySide2.QtWidgets import QApplication, QSplashScreen, QMessageBox
    from PySide2.QtGui import QFontDatabase, QPixmap, QIcon
    from PySide2.QtCore import Qt, QCoreApplication

    from .config import FONT_LOCATION, IMG_LOCATION, Conf

    # Enable High-DPI support
    # https://stackoverflow.com/questions/35714837/how-to-get-sharp-ui-on-high-dpi-with-qt-5-6
    if ("QT_DEVICE_PIXEL_RATIO" not in os.environ
            and "QT_AUTO_SCREEN_SCALE_FACTOR" not in os.environ
            and "QT_SCALE_FACTOR" not in os.environ
            and "QT_SCREEN_SCALE_FACTORS" not in os.environ):
        QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
    # No more rounding
    # https://github.com/pyqtgraph/pyqtgraph/issues/756
    # https://lists.qt-project.org/pipermail/development/2019-September/037434.html
    QApplication.setHighDpiScaleFactorRoundingPolicy(
        Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
    # Use highDPI pixmaps
    QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)

    app = QApplication(sys.argv)
    app.setApplicationDisplayName("angr management")
    app.setApplicationName("angr management")
    icon_location = os.path.join(IMG_LOCATION, 'angr.png')
    QApplication.setWindowIcon(QIcon(icon_location))

    # try to import the initial configuration for the install
    Conf.attempt_importing_initial_config()

    # Make + display splash screen
    splashscreen_location = os.path.join(IMG_LOCATION, 'angr-splash.png')
    splash_pixmap = QPixmap(splashscreen_location)
    splash = QSplashScreen(splash_pixmap, Qt.WindowStaysOnTopHint)
    icon_location = os.path.join(IMG_LOCATION, 'angr.png')
    splash.setWindowIcon(QIcon(icon_location))
    splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)
    splash.setEnabled(False)
    splash.show()
    for _ in range(5):
        time.sleep(0.01)
        app.processEvents()

    if not check_dependencies():
        sys.exit(1)

    from .ui.css import refresh_theme  # import .ui after shwing the splash screen since it's going to take time

    refresh_theme()

    import angr

    angr.loggers.profiling_enabled = True if profiling else False

    from .logic import GlobalInfo
    from .ui.main_window import MainWindow

    # Load fonts
    QFontDatabase.addApplicationFont(
        os.path.join(FONT_LOCATION, "SourceCodePro-Regular.ttf"))
    QFontDatabase.addApplicationFont(
        os.path.join(FONT_LOCATION, "DejaVuSansMono.ttf"))

    # Initialize font-related configuration
    Conf.init_font_config()
    # Set global font
    app.setFont(Conf.ui_default_font)

    GlobalInfo.gui_thread = threading.get_ident()

    file_to_open = filepath if filepath else None
    main_window = MainWindow(app=app, use_daemon=use_daemon)
    splash.finish(main_window)

    if file_to_open is not None:
        main_window.load_file(file_to_open)

    app.exec_()
示例#13
0
def run_ui(game: Game | None, dev: bool) -> None:
    os.environ[
        "QT_ENABLE_HIGHDPI_SCALING"] = "1"  # Potential fix for 4K screens
    QApplication.setHighDpiScaleFactorRoundingPolicy(
        Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)

    app = QApplication(sys.argv)

    app.setAttribute(Qt.AA_DisableWindowContextHelpButton)
    app.setAttribute(Qt.AA_EnableHighDpiScaling,
                     True)  # enable highdpi scaling
    app.setAttribute(Qt.AA_UseHighDpiPixmaps, True)  # use highdpi icons

    # init the theme and load the stylesheet based on the theme index
    liberation_theme.init()
    with open(
            "./resources/stylesheets/" + liberation_theme.get_theme_css_file(),
            encoding="utf-8",
    ) as stylesheet:
        logging.info("Loading stylesheet: %s",
                     liberation_theme.get_theme_css_file())
        app.setStyleSheet(stylesheet.read())

    first_start = liberation_install.init()
    if first_start:
        window = QLiberationFirstStartWindow()
        window.exec_()

    logging.info("Using {} as 'Saved Game Folder'".format(
        persistency.base_path()))
    logging.info("Using {} as 'DCS installation folder'".format(
        liberation_install.get_dcs_install_directory()))

    inject_custom_payloads(Path(persistency.base_path()))

    # Splash screen setup
    pixmap = QPixmap("./resources/ui/splash_screen.png")
    splash = QSplashScreen(pixmap)
    splash.show()

    # Developers are launching the game in a loop hundreds of times. We've read it.
    if not dev:
        # Give enough time to read splash screen
        time.sleep(3)

    # Once splash screen is up : load resources & setup stuff
    uiconstants.load_icons()
    uiconstants.load_event_icons()
    uiconstants.load_aircraft_icons()
    uiconstants.load_vehicle_icons()
    uiconstants.load_aircraft_banners()
    uiconstants.load_vehicle_banners()

    # Show warning if no DCS Installation directory was set
    if liberation_install.get_dcs_install_directory() == "":
        logging.warning(
            "DCS Installation directory is empty. MissionScripting file will not be replaced!"
        )
        if not liberation_install.ignore_empty_install_directory():
            ignore_checkbox = QCheckBox("Do not show again")
            ignore_checkbox.stateChanged.connect(
                set_ignore_empty_install_directory)
            message_box = QtWidgets.QMessageBox(parent=splash)
            message_box.setIcon(QtWidgets.QMessageBox.Icon.Warning)
            message_box.setWindowTitle("No DCS installation directory.")
            message_box.setText(
                "The DCS Installation directory is not set correctly. "
                "This will prevent DCS Liberation to work properly as the MissionScripting "
                "file will not be modified."
                "<br/><br/>To solve this problem, you can set the Installation directory "
                "within the preferences menu. You can also manually edit or replace the "
                "following file:"
                "<br/><br/><strong>&lt;dcs_installation_directory&gt;/Scripts/MissionScripting.lua</strong>"
                "<br/><br/>The easiest way to do it is to replace the original file with the file in dcs-liberation distribution (&lt;dcs_liberation_installation&gt;/resources/scripts/MissionScripting.lua)."
                "<br/><br/>You can find more information on how to manually change this file in the Liberation Wiki (Page: Dedicated Server Guide) on GitHub.</p>"
            )
            message_box.setDefaultButton(
                QtWidgets.QMessageBox.StandardButton.Ok)
            message_box.setCheckBox(ignore_checkbox)
            message_box.exec_()
    # Replace DCS Mission scripting file to allow DCS Liberation to work
    try:
        liberation_install.replace_mission_scripting_file()
    except:
        error_dialog = QtWidgets.QErrorMessage()
        error_dialog.setWindowTitle("Wrong DCS installation directory.")
        error_dialog.showMessage(
            "Unable to modify Mission Scripting file. Possible issues with rights. Try running as admin, or please perform the modification of the MissionScripting file manually."
        )
        error_dialog.exec_()

    # Apply CSS (need works)
    GameUpdateSignal()
    GameUpdateSignal.get_instance().game_loaded.connect(on_game_load)

    # Start window
    window = QLiberationWindow(game, dev)
    window.showMaximized()
    splash.finish(window)
    qt_execution_code = app.exec_()

    # Restore Mission Scripting file
    logging.info("QT App terminated with status code : " +
                 str(qt_execution_code))
    logging.info("Attempt to restore original mission scripting file")
    liberation_install.restore_original_mission_scripting()
    logging.info("QT process exited with code : " + str(qt_execution_code))
示例#14
0
    def run(self):
        # 进行线程任务
        while self.working:
            sleep(0.1)
            self.signal.emit()  # 发射信号


if __name__ == '__main__':
    # 创建一个应用程序对象
    app = QApplication(sys.argv)

    splash = QSplashScreen(QPixmap("resource/images/loading.png"))
    splash.showMessage("加载中,请稍后...", Qt.AlignHCenter | Qt.AlignBottom, Qt.cyan)
    splash.setFont(QFont("华文楷体", 10, QFont.Bold))
    splash.show()  # 显示启动界面
    QApplication.processEvents()  # 处理主进程事件

    # 创建控件(容器)
    window = MyWindow()

    # 设置标题
    # window.setWindowTitle('title')

    # window.load_data(splash)  # 加载数据
    # 显示窗口
    window.show()
    splash.finish(window)  # 隐藏启动界面
    # 进入消息循环
    sys.exit(app.exec_())
示例#15
0
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys, multiprocessing
import qdarkstyle
from PySide2.QtWidgets import QApplication, QSplashScreen
from PySide2.QtGui import QFont, QPixmap
from utils.main_ui import MainWindow
from utils.exportTimeMark import ExportSrt


if __name__ == '__main__':
    multiprocessing.freeze_support()
    qss = ''
    try:
        with open('utils/qdark.qss', 'r') as f:
            qss = f.read()
    except: 
        print('警告!找不到QSS文件!请从github项目地址下载完整文件。')
    app = QApplication(sys.argv)
    #app.setStyleSheet(qss)
    app.setStyleSheet(qdarkstyle.load_stylesheet(qt_api='pyside2'))
    app.setFont(QFont('微软雅黑', 9))
    splash = QSplashScreen(QPixmap(r'utils\splash.jpg'))
    splash.show()
    mainWindow = MainWindow()
    mainWindow.show()

    splash.finish(mainWindow)
    sys.exit(app.exec_())
示例#16
0
        file = QFile(file_path)
        file.open(QIODevice.ReadOnly)
        ts = QTextStream(file)
        string = ts.readAll()
        return string

    def progress_update(self, progress):
        self.progressBar.setValue(progress)


if __name__ == '__main__':
    multiprocessing.freeze_support()

    app = QApplication(sys.argv)
    pixmap = QPixmap('ui_resources/cascade_splash.png')
    splash = QSplashScreen(pixmap)
    splash.setWindowFlags(Qt.WindowStaysOnTopHint)
    splash.setEnabled(False)
    splash.setMask(pixmap.mask())
    splash.show()
    time.sleep(0.1)  # This seems to fix the splash mask displaying but not the actual image
    app.processEvents()

    window = MainWindow()
    window.show()
    window.raise_()
    window.activateWindow()
    splash.finish(window)
    sys.exit(app.exec_())
示例#17
0
def main():

    if parser.lang:
        sys_locale = parser.lang[0]
    else:
        sys_locale = QtCore.QLocale.system().name()
    translator = QtCore.QTranslator()

    #load intern dialogs translations
    qtTranslator = QtCore.QTranslator()
    qtTranslator.load("qt_" + sys_locale, QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath))

    #load translations files
    translations_path = os.path.join(os.getenv("PINGUINO_LIB"), "multilanguage")
    trasnlations = os.path.exists(translations_path)

    if trasnlations and (os.getenv("PINGUINO_MODE") == "NORMAL"):
        translations_file = "pinguino_" + sys_locale

        if translations_file + ".qm" in os.listdir(translations_path):
            translator.load(os.path.join(os.getenv("PINGUINO_LIB"), "multilanguage", "pinguino_{}.qm".format(sys_locale)))

        elif "_" in sys_locale:
            sys_locale = sys_locale[:sys_locale.find("_")]
            translations_file = "pinguino_" + sys_locale
            if translations_file + ".qm" in os.listdir(translations_path):
                translator.load(os.path.join(os.getenv("PINGUINO_LIB"), "multilanguage", "pinguino_{}.qm".format(sys_locale)))

    app = QApplication(sys.argv)

    #Splash (pinguino\qtgui\resources\art)
    #pixmap = QPixmap(":/logo/art/splash.png")
    pixmap = QPixmap("pinguino/qtgui/resources/art/splash.png")
    #pixmap = QPixmap("pinguino/qtgui/resources/art/pinguino_logo_background_blue-256x256.png")
    #pixmap = QPixmap(760, 256)
    #pixmap.fill(QtGui.QColor("#4d4d4d"))
    # keep the splash screen above all the other windows on the desktop
    splash = QSplashScreen(pixmap, QtCore.Qt.WindowStaysOnTopHint)

    splash.show()
    splash.setStyleSheet("""
        font-family: inherit;
        font-weight: normal;
        font-size: 11pt;
        """)

    # update the splash screen with messages
    def splash_write(msg):
        if not splash is None:
            splash.showMessage("\t" + msg, color=QtGui.QColor("#4d4d4d"), alignment=QtCore.Qt.AlignBottom)

    splash_write(NAME + " " + MAJOR)
    app.processEvents()

    app.installTranslator(qtTranslator)
    if trasnlations:
        app.installTranslator(translator)

    frame = PinguinoIDE(splash_write=splash_write)
    frame.show()

    if not splash is None:
        splash.finish(frame)

    app.exec_()