def __init__(self, movie, flags, parent=None): movie.jumpToFrame(0) pixmap = QPixmap(movie.frameRect().size()) QSplashScreen.__init__(self, pixmap, flags) self.movie = movie self.movie.frameChanged.connect(self.repaint)
def __init__(self, path): self.__movie = QMovie(path) self.__movie.jumpToFrame(0) pixmap = QPixmap(self.__movie.frameRect().size()) QSplashScreen.__init__(self, pixmap) self.__movie.frameChanged.connect(self.repaint)
def __init__(self, movie, parent=None): movie.jumpToFrame(0) pixmap = QPixmap(movie.frameRect().size()) QSplashScreen.__init__(self or parent, pixmap, Qt.WindowStaysOnTopHint) self.movie = movie self.movie.setSpeed(150) self.movie.frameChanged.connect(self.repaint)
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_()
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
def __init__(self): QSplashScreen.__init__(self) self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint) height = QApplication.instance().primaryScreen().size().height() * .25 width = QApplication.instance().primaryScreen().size().width() * .25 logo = QPixmap('../resources/splash_screen_02.png').scaledToHeight( height) self.setPixmap(logo)
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
def run(): # create application # note that the auto_download window may have already created one if QApplication.instance() is not None: app = QApplication.instance() else: app = QApplication() splash = QSplashScreen(QPixmap(":/icons/splashscreen.png")) splash.show() from DAVE.gui.main import Gui import numpy as np s = Scene() s.resources_paths.append(r'C:\data\Dave\Public\Blender visuals') g = Gui(s, splash=splash, app=app)
def setup_app(): QCoreApplication.setAttribute(Qt.AA_DisableHighDpiScaling) app = QApplication(sys.argv) splash = QSplashScreen() pixmap = QPixmap(os.path.join(QGRAIN_ROOT_PATH, "assets", "icon.png")) pixmap.setDevicePixelRatio(1.0) splash.setPixmap(pixmap) splash.show() create_necessary_folders() app.setWindowIcon(QIcon(pixmap)) app.setApplicationDisplayName(f"QGrain ({QGRAIN_VERSION})") app.setApplicationVersion(QGRAIN_VERSION) app.setStyle(QStyleFactory.create("Fusion")) app.setStyleSheet("""* {font-family:Arial,Helvetica,Tahoma,Verdana; color:#000000;background-color:#c4cbcf;alternate-background-color:#b2bbbe; selection-color:#ffffff;selection-background-color:#555f69}""") plt.style.use(["science", "no-latex"]) plt.set_cmap("tab10") plt.rcParams["axes.facecolor"] = "#c4cbcf" plt.rcParams["figure.facecolor"] = "#c4cbcf" plt.rcParams["savefig.dpi"] = 300.0 plt.rcParams["savefig.facecolor"] = "white" plt.rcParams["savefig.transparent"] = True plt.rcParams["figure.max_open_warning"] = False setup_language(app) setup_logging() return app, splash
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)
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("")
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)
if __name__ == "__main__": app = QApplication(sys.argv) # App appeareance. # Add as parameter to the script to set an app style: # style=Fusion|Windows|windowsvista|cyberpunk|darkblue|oceanic|lightorange|darkorange|qdarkstyle|qdarkstyle3. # stylesheet = qrainbowstyle.load_stylesheet_pyside2(style='qdarkstyle') # app.setStyleSheet(stylesheet) # load_matlab_engine_and_show_splash_screen() # There is the possibility to disable matlab env, if you don't want to use it. if True: print('Loading Matlab engine.') print('...') pixmap = QPixmap(SONET_DATA_DIR + "splash.png") splash = QSplashScreen(pixmap) splash.show() splash.showMessage("Loading Matlab engine.", alignment=Qt.AlignCenter|Qt.AlignBottom, color=QColor('red')) app.processEvents() matlab_engine = matlab.engine.start_matlab() s = matlab_engine.genpath(SONET_DIR) matlab_engine.addpath(s, nargout=0) splash.showMessage("Matlab engine loaded.", alignment=Qt.AlignCenter|Qt.AlignBottom, color=QColor('red')) print('Matlab engine loaded.') splash.close() else: print("Matlab engine not loaded, some functionality won't be availabe.") main_window = SonetMainWindow() main_window.show()
root zoia_lib directory via a command terminal: python -m zoia_lib.backend.startup Please note, this app is still in active development. Please stay updated by visiting https://github.com/meanmedianmoge/zoia_lib/ """ import os import sys from PySide2.QtGui import QPixmap, Qt from PySide2.QtWidgets import QApplication, QSplashScreen from zoia_lib.UI.ZOIALibrarian_main import ZOIALibrarianMain # Entry point for the application. if __name__ == "__main__": app = QApplication(sys.argv) # Create and display the splash screen img = QPixmap( os.path.join(os.getcwd(), "zoia_lib", "UI", "resources", "splash.png")) splash = QSplashScreen(img, Qt.WindowStaysOnTopHint) splash.show() # Show the window after it finishes setting up and close the splash. window = ZOIALibrarianMain() window.show() splash.finish(window) sys.exit(app.exec_())
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_()
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_()
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_()
def main(): path_icon = str(Path(__file__).parent / 'assets/openmc_logo.png') path_splash = str(Path(__file__).parent / 'assets/splash.png') app = QApplication(sys.argv) app.setOrganizationName("OpenMC") app.setOrganizationDomain("openmc.org") app.setApplicationName("OpenMC Plot Explorer") app.setWindowIcon(QtGui.QIcon(path_icon)) app.setAttribute(QtCore.Qt.AA_DontShowIconsInMenus, True) splash_pix = QtGui.QPixmap(path_splash) splash = QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() app.processEvents() splash.setMask(splash_pix.mask()) splash.showMessage("Loading Model...", QtCore.Qt.AlignHCenter | QtCore.Qt.AlignBottom) app.processEvents() # load OpenMC model on another thread loader_thread = Thread(target=_openmcReload) loader_thread.start() # while thread is working, process app events while loader_thread.is_alive(): app.processEvents() splash.clearMessage() splash.showMessage("Starting GUI...", QtCore.Qt.AlignHCenter | QtCore.Qt.AlignBottom) app.processEvents() font_metric = QtGui.QFontMetrics(app.font()) screen_size = app.primaryScreen().size() mainWindow = MainWindow(font_metric, screen_size) # connect splashscreen to main window, close when main window opens mainWindow.loadGui() mainWindow.show() splash.close() # connect interrupt signal to close call signal.signal(signal.SIGINT, lambda *args: mainWindow.close()) # create timer that interrupts the Qt event loop # to check for a signal timer = QtCore.QTimer() timer.start(500) timer.timeout.connect(lambda: None) sys.exit(app.exec_())
import sys import os from PySide2.QtWidgets import (QApplication, QSplashScreen) from PySide2.QtGui import QPixmap from PySide2.QtCore import (Qt, QTimer) from LDF_AppSettings import app if __name__ == '__main__': spscr_pixmap = QPixmap("splash-screen.png") splash = QSplashScreen(spscr_pixmap) splash.show() splash.showMessage("Loading dependencies...", alignment=Qt.AlignBottom) def start(): from LDF_GUI import Window window = Window() splash.close() window.start() start()
#!/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_())
cMapList = { 'Delta': plt.cm.Reds, 'Theta': plt.cm.Oranges, 'Alpha': plt.cm.Wistia, 'Beta': plt.cm.BuGn, 'Gamma': plt.cm.YlGnBu } if __name__ == '__main__': app = QApplication.instance() if app is None: app = QApplication([]) loop = quamash.QEventLoop(app) asyncio.set_event_loop(loop) splash_pix = QPixmap('./images/splash.png') 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)
# Set image as main background self.dropView.dropImage(themePath) self.setStyleSheet("QMainWindow { background-color: " + mainColorHex + " }") # Set theme color on other views in the application appropriately self.nav_panel.setThemeColor(mainColorHex) 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()
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><dcs_installation_directory>/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 (<dcs_liberation_installation>/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))
app.setOrganizationName('Bioinformatics and Integrative Genomics') app.setOrganizationDomain('http://big.cdu.edu.cn') app.setApplicationName('Krait') #set font family QFontDatabase.addApplicationFont(":/fonts/roboto.ttf") QFontDatabase.addApplicationFont(":/fonts/robotomono.ttf") #support windows 7, 10 taskbar icon import ctypes if os.name == 'nt': myappid = 'BIG.Krait.ssr.1.0' ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid) splash_img = QPixmap(":/icons/splash.png") splash = QSplashScreen(splash_img) splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.SplashScreen | Qt.FramelessWindowHint) splash.setStyleSheet("font-family:Roboto; font-size: 14px;") splash.setEnabled(False) splash.show() def show_splash_msg(msg): splash.showMessage(msg, Qt.AlignCenter | Qt.AlignBottom, Qt.white) app.processEvents() #show_splash_msg("Loading icon resources...") import config show_splash_msg("Loading configurations...") from libs import * show_splash_msg("Loading search engines...")
from PySide2.QtWidgets import QApplication, QSplashScreen from PySide2.QtGui import QPixmap from customWidgets.main_window import MainWindow import sys import time if __name__ == "__main__": app = QApplication(sys.argv) pixmap = QPixmap("img/xlnk-transparent.png") splash = QSplashScreen(pixmap) splash.show() time.sleep(1) window = MainWindow() app.exec_() app.exit()
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))
def __init__(self, path): self.__pixmap = QPixmap(path) QSplashScreen.__init__(self, self.__pixmap)
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_())
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_()
# Populate banner self.ui.announcementLabel.setText(announcement_label) self.ui.announcementURLLabel.setText(announcement_url_label) if announcement_website_enabled is False: self.ui.announcementURLLabel.setHidden(True) except Exception: pass if __name__ == "__main__": app = QApplication() # Splash try: # data = updater.obtain_splash() image = QtGui.QImage(resource_path("assets/gui/splash.png")) splash = QSplashScreen(QtGui.QPixmap(image)) splash.show() except Exception: pass window = MainWindow() window.show() try: splash.hide() except Exception: pass app.exec_()
"resources\\customized_payloads") if os.path.exists(custom_payloads): dcs.planes.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() # 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.")