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
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)
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_())
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) 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()
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() # post_actions(mw=main_window)
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) # adding progress bar progressBar = QProgressBar(splash) progressBar.setMaximum(10) progressBar.setGeometry(0, splash_pix.height() - 50, splash_pix.width(), 20) splash.show() splash.showMessage( "<h1><font color='white' size= 10>Brint Monitor !</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() with loop: window33 = MainWindow() window33.show() splash.finish(window33) sys.exit(app.exec_()) loop.run_forever()
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()
if __name__ == "__main__": from sys import argv, exit from os.path import abspath, join, dirname out: QApplication = QApplication(argv) imagen = abspath( join(dirname(__file__), 'config', 'ventana_principal', 'assets', 'fondo.png')) ventana = QWidget() pantalla_de_carga = QSplashScreen(ventana, imagen) pantalla_de_carga.show() from PySide2.QtCore import Qt pantalla_de_carga.setFont(QFont('Segoe Ui SemiBold', 15)) pantalla_de_carga.showMessage( "Cargando...", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter, QColor('white')) state: State = State() pantalla_de_carga.showMessage( "Cargando fuentes...", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter, QColor('white')) fuentes: List[str] = cargar_fuentes() pantalla_de_carga.showMessage( "Iniciando Aplicación...", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter, QColor('white')) clase: App = App(fuentes, state) pantalla_de_carga.close() clase.show() exit(out.exec_())
def __del__(self): self.working = False # 工作状态标志量 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) # 隐藏启动界面 # 进入消息循环