def start_logo(self): img_logo = QPixmap('pystudylogo.png') self.splash = QSplashScreen(img_logo, Qt.WindowStaysOnTopHint) self.splash.setMask(img_logo.mask()) self.splash.show() time.sleep(1.8) self.splash.close()
def __init__(self): super().__init__() self.window = QtWidgets.QMainWindow() self.PosUi = Ui_PosWindow() self.LicenceUi = Ui_LicenceWindow() self.splash = QSplashScreen(QPixmap('pos.jpg')) if not (path.exists(system_path)): os.makedirs(system_path) os.makedirs(db_path) initDB() initDBTables() if not (path.exists(system_path + "config.INI")): config['DEFAULT']['user_id'] = '' # create config['DEFAULT']['token'] = '' config['DEFAULT']['login_status'] = "False" status = "False" with open(system_path + "config.INI", "w") as configFile: config.write(configFile) else: config.read(system_path + 'config.INI') print("Status: " + str(config['DEFAULT']['login_status'])) self.splash.show() QTimer.singleShot(5000, self.navigate)
def make_splash(): splash_pic = QPixmap('oncat/img/splash.png') splash = QSplashScreen(splash_pic, Qt.WindowStaysOnTopHint) splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint) splash.setEnabled(True) splash.show() return splash
def main(): signal(SIGINT, SIG_DFL) app = QApplication(sys.argv) sys.excepthook = excepthook splash_pix = QPixmap(path.join(path.dirname(__file__), 'loading.png')) splash = QSplashScreen(splash_pix) splash.show() splash.raise_() app.processEvents() with open(path.join(path.dirname(__file__), "style.qss"), 'r') as f: app.setStyleSheet(f.read()) win = MainWindow() from argparse import ArgumentParser parser = ArgumentParser(description='Microchip Peripheral I/O Control') parser.add_argument('--fullscreen', dest='fullscreen', action='store_true', help='show the main window in fullscreen') parser.set_defaults(fullscreen=False) # ignore unknown arguments, necessary for ignoring only -smallresolution args, unknown = parser.parse_known_args() if args.fullscreen: win.setFixedSize(QApplication.desktop().size()) win.showFullScreen() else: win.show() win.setFocus() splash.finish(win) sys.exit(app.exec_())
def run(): app = QApplication(sys.argv) app.setWindowIcon(QIcon(':/icons/windows/deeplisten-logo.png')) # splash screen # Create and display the splash screen splash_pix = QPixmap(':/icons/windows/start.png') splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() app.processEvents() # Simulate something that takes time time.sleep(1) mw = MainWindow() mw.show() splash.finish(mw) ##setup stylesheet # import qdarkstyle # app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5()) sys.exit(app.exec_())
def demo_run(): app = QApplication(sys.argv) # get screen size. desktop = QApplication.desktop().screenGeometry() ratio = QApplication.desktop().screen().devicePixelRatio() width = desktop.width() height = desktop.height() # setting up welcome screen. screen = QPixmap(icon["SCREEN"]) screen.setDevicePixelRatio(ratio) if ratio == 2: # under Mac Retina screen = screen.scaled(height * 0.9, height * 0.9) else: # under Windows and Linux screen = screen.scaled(height * 0.5, height * 0.5) splash = QSplashScreen(screen) splash.show() # handle the main process event. qApp.processEvents() # setting up main window. size = (width * 0.8, height * 0.8) editor = KMBMainWindow(size) stylesheet = load_stylesheet(SS_COMMON) app.setStyleSheet(stylesheet) # Mac: set the icon in dock. app.setWindowIcon(editor.win_icon) # compatible with Mac Retina screen. app.setAttribute(Qt.AA_UseHighDpiPixmaps, True) app.setAttribute(Qt.AA_EnableHighDpiScaling, True) # editor show up editor.show() splash.finish(editor) sys.exit(app.exec_())
def show(): message = "{0} {1} ".format(appinfo.appname, appinfo.version) pixmap = QPixmap(os.path.join(__path__[0], 'splash3.png')) if QApplication.desktop().screenGeometry().height() < 640: fontsize = 23 pixmap = pixmap.scaledToHeight(240, Qt.SmoothTransformation) else: fontsize = 40 splash = QSplashScreen(pixmap, Qt.SplashScreen) font = splash.font() font.setPixelSize(fontsize) font.setWeight(QFont.Bold) splash.setFont(font) splash.showMessage(message, Qt.AlignRight | Qt.AlignTop, Qt.white) splash.show() QApplication.processEvents() def hide(): splash.deleteLater() app.appStarted.disconnect(hide) app.appStarted.connect(hide)
def run(): """ Creates all the top-level assets for the application, sets things up and then runs the application. """ # The app object is the application running on your computer. app = QApplication(sys.argv) # Display a friendly "splash" icon. splash = QSplashScreen(load_pixmap('icon')) splash.show() # Create the "window" we'll be looking at. editor_window = Window() # Create the "editor" that'll control the "window". editor = Editor(view=editor_window) # Setup the window. editor_window.closeEvent = editor.quit editor_window.setup(editor.theme) editor.restore_session() # Connect the various buttons in the window to the editor. button_bar = editor_window.button_bar button_bar.connect("new", editor.new, "Ctrl+N") button_bar.connect("load", editor.load, "Ctrl+O") button_bar.connect("save", editor.save, "Ctrl+S") button_bar.connect("flash", editor.flash) button_bar.connect("repl", editor.toggle_repl) button_bar.connect("zoom-in", editor.zoom_in) button_bar.connect("zoom-out", editor.zoom_out) button_bar.connect("theme", editor.toggle_theme) button_bar.connect("quit", editor.quit) # Finished starting up the application, so hide the splash icon. splash.finish(editor_window) # Stop the program after the application finishes executing. sys.exit(app.exec_())
def run(): app = QApplication(sys.argv) qtmodern.styles.dark(app) app.setWindowIcon(QIcon("resources/icon.ico")) if platform.system() == "Windows": ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID( "quikplan") # App ID for taskbar icon splash = QSplashScreen( QPixmap("resources/quikplan.png").scaledToHeight( 400, QtCore.Qt.TransformationMode.SmoothTransformation)) splash.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) splash.show() main = Window() def showWindow(): splash.close() main.show() QtCore.QTimer.singleShot(1000, showWindow) sys.exit(app.exec_())
def __init__(self, main_window: QMainWindow): """ 启动动画 """ self.main_window = main_window self.splash = QSplashScreen()
def __init__(self, db_worker: DBWorker, parent=None): generate_image(get_now()) QMainWindow.__init__(self, parent) self.setWindowTitle("Амбарная книга") self.splash_for_time = QSplashScreen( QtGui.QPixmap(r'images/spimage.jpg')) self.splash_for_time.showMessage( "Сохраните своё время с нами!\n\nПодключение к базе данных...\n\r" "\n\r\n\r", QtCore.Qt.AlignCenter | QtCore.Qt.AlignBottom, QtCore.Qt.black) self.splash_for_time.show() time.sleep(2) self.db_worker: DBWorker = db_worker self.con = QSqlDatabase.addDatabase("QSQLITE") self.con.setDatabaseName('ambar_book.db') self.con.open() self.stm: SRTM = SRTM(self) self.stm.setEditStrategy(QSqlTableModel.OnManualSubmit) generate_image(get_now()) self.splash_for_time.setPixmap(QtGui.QPixmap(r'images/spimage.jpg')) self.splash_for_time.showMessage( "Сохраните своё время с нами!\n\nЗагрузка элементов экрана...\n\r" "\n\r\n\r", QtCore.Qt.AlignCenter | QtCore.Qt.AlignBottom, QtCore.Qt.black) time.sleep(2) self.central_widget: QWidget = QWidget(self) self.main_layout: QLayout = QVBoxLayout() self.table_labels_row: QLayout = QHBoxLayout() self.control_buttons_row: QLayout = QHBoxLayout() self.table_title_layout: QLayout = QVBoxLayout() self.pbcwg = QGroupBox("Выберите продукт:") self.pbc: QLayout = QVBoxLayout() # ProductButtonsColumn self.pbcwg.setLayout(self.pbc) self.pbcw = QScrollArea(self) self.pbcw.setWidget(self.pbcwg) self.pbcw.setWidgetResizable(True) self.labels_increment_decrement_column = QVBoxLayout() self.product_buttons: List[ProductButton] = list() self.table_title: QLabel = QLabel("", parent=self) self.table: QTableView = QTableView(self) # self.table = QTableWidget(self) self.child_count_label = QLabel("", parent=self) self.date_label = QLabel(date.today().strftime("%d.%m.%Y")) self.add_increment_widget = AddIncrementWidget(parent=self) self.add_increment_widget.button.clicked.connect(self.add_increment) self.add_decrement_widget = AddDecrementWidget(parent=self) self.add_decrement_widget.button.clicked.connect(self.add_decrement) self.add_row_button = QPushButton("Добавить строку", parent=self) self.add_row_button.clicked.connect(self.add_row) self.delete_row_button = QPushButton("Убрать строку", parent=self) self.delete_row_button.clicked.connect(self.delete_row) self.setup_menu_bar() self.load_ui() self.setStyleSheet(css_style) self.chosen_product = self.product_buttons[0] self.chosen_product.setObjectName("chosenProductButton") self.table_title.setText(centralize_text(self.chosen_product.text())) self.load_changings() self.add_decrement_widget.quantity_checker.setEnabled( self.child_count_is_known)
def main(): import time os.chdir(civiltools_path) app = QtWidgets.QApplication(sys.argv) splash_pix = QPixmap("./images/civil-engineering.jpg") 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(50, splash_pix.height() - 30, splash_pix.width() - 100, 20) splash.show() splash.showMessage("<h1><font color='DarkRed'>civiltools by Ebrahim Raeyat Roknabadi </font></h1>", Qt.AlignCenter | Qt.AlignCenter, Qt.black) for i in range(1, 11): progressBar.setValue(i) t = time.time() while time.time() < t + 0.1: app.processEvents() # Simulate something that takes time time.sleep(1) # translator = QtCore.QTranslator() # translator.load("main_form.qm") # app.installTranslator(translator) window = FormWidget() window.setWindowTitle(_appname + ' ' + _version) window.show() splash.finish(window) sys.exit(app.exec_())
def main(): if sys.version_info < REQUIRED_PYTHON_VERSION: raise SystemExit("Python {}.{} or higher is required".format( REQUIRED_PYTHON_VERSION[0], REQUIRED_PYTHON_VERSION[1])) # QApplication.setAttribute(Qt.AA_ShareOpenGLContexts) app = Application(sys.argv) loop = quamash.QEventLoop(app) asyncio.set_event_loop(loop) pixmap = QPixmap('OptoStimLogo.jpeg') splash = QSplashScreen(pixmap) splash.show() w = OptoStimMainWindow() w.show() splash.finish(w) hook = ExceptHook(sentry_key=SENTRY_KEY, non_exit_exceptions=[DeviceException, OptoStimException]) sys.excepthook = hook.except_hook signal.signal(signal.SIGINT, w.clean_up) signal.signal(signal.SIGTERM, w.clean_up) try: with loop: sys.exit(loop.run_forever()) finally: w.clean_up()
def welcomeExactDialog(app, settingsObject, mainwindow): # Create and display the about screen splash_pix = QPixmap(ARTWORK_DIR_NAME+'ExactWelcomeScreen.png') splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) btn = QPushButton('Enable EXACT', splash) btn.move(140, 320) btn.clicked.connect(partial(enableAndClose, splash, settingsObject,mainwindow)) btn = QPushButton('Disable EXACT',splash) btn.move(350, 320) btn.clicked.connect(partial(disableAndClose, splash, settingsObject,mainwindow)) # layout.addWidget(btn, 1,1) # splash.showMessage('Version %s\n'%version, alignment = Qt.AlignHCenter + Qt.AlignBottom, color=Qt.black) splash.setMask(splash_pix.mask()) splash.show() splash.mousePressEvent = partial(closeDlg, splash) start = time() while splash.isActiveWindow() & (time() - start < 10): sleep(0.001) app.processEvents() if (splash.isActiveWindow()): splash.close()
def show_splash(version=''): splash_fname = utils.get_resource_path('icons/splash.jpg') splash_pix = QPixmap(splash_fname) size = splash_pix.size()*.35 splash_pix = splash_pix.scaled(size, Qt.KeepAspectRatio, transformMode=Qt.SmoothTransformation) numbers = {} for number in list(range(10)) + ['point']: fname = utils.get_resource_path('icons/{}.png'.format(number)) pix = QPixmap(fname) size = pix.size() * .65 numbers[str(number)] = pix.scaled(size, Qt.KeepAspectRatio, transformMode=Qt.SmoothTransformation) numbers['.'] = numbers['point'] painter = QPainter(splash_pix) painter.begin(splash_pix) x, y = 470, 70 for digit in version: painter.drawPixmap(x, y, numbers[digit]) x += numbers[digit].rect().width()/3 painter.end() splash = QSplashScreen(splash_pix, Qt.WindowStaysOnBottomHint) splash.show() return splash
def main(): app = QApplication(sys.argv) app.setStyle('cleanlooks') app.setApplicationName("Linguistica") # Get screen resolution # Why do we need to know screen resolution? # Because this information is useful for setting the size of particular # widgets, e.g., the webview for visualizing the word neighbor manifold # (the bigger the webview size, the better it is for visualization!) resolution = app.desktop().screenGeometry() screen_width = resolution.width() screen_height = resolution.height() # create and display splash screen splash_image_path = os.path.join(os.path.dirname(__file__), 'lxa_splash_screen.png') splash_image = QPixmap(splash_image_path) splash_screen = QSplashScreen(splash_image, Qt.WindowStaysOnTopHint) splash_screen.setMask(splash_image.mask()) splash_screen.show() app.processEvents() time.sleep(2) # launch graphical user interface form = MainWindow(screen_height, screen_width, __version__) form.show() splash_screen.finish(form) app.exec_()
def show_splash(text: str) -> QSplashScreen: splash = QSplashScreen() splash_font = QFont() # splashFont.setFamily("Arial") splash_font.setBold(True) splash_font.setPixelSize(16) splash_font.setStretch(120) splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.SplashScreen) splash = QSplashScreen() splash.show() splash.setStyleSheet("background-color:#fcc77c;") splash.setFont(splash_font) splash.setMinimumWidth(400) splash.setMaximumHeight(100) splash.showMessage(text, alignment=Qt.AlignCenter, ) return splash
def main(): # The app object is the application running on your computer. app = QApplication(sys.argv) app.setStyleSheet(load_stylesheet('puppy.css')) # A splash screen is a logo that appears when you start up the application. # The image to be "splashed" on your screen is in the resources/images # directory. splash = QSplashScreen(load_pixmap('splash')) # Show the splash. splash.show() # Make the editor with the Puppy class defined above. the_editor = Puppy() proj_root = os.path.join(ROOT, 'hello_world') proj = HelloWorld(proj_root, {}) if not os.path.isdir(proj_root): proj.init_files() the_editor.add_project(proj) the_editor.show() the_editor.autosize_window() # Remove the splash when the_editor has finished setting itself up. splash.finish(the_editor) # Stop the program after application finishes executing. sys.exit(app.exec_())
def splash(self): pixmap = QPixmap(".\\gui\\pyspec_less_ugly_shorter.png") smallerPixmap = pixmap.scaled(256, 256, Qt.KeepAspectRatio, Qt.SmoothTransformation) splash = QSplashScreen(smallerPixmap, Qt.WindowStaysOnTopHint) splash.setMask(smallerPixmap.mask()) splash.setWindowFlag(Qt.WindowStaysOnTopHint) splash.show() self.processEvents() self.init_logging() self.processEvents() log.info("Initialization of views, models, controllers...") time.sleep(2) self.processEvents() self.mainModel = MainModel() self.mainCtrl = MainController() self.mainWindow = MainWindow(self.mainModel, self.mainCtrl) self.mainWindow.setWindowTitle("PySpec Software") self.mainWindow.setAttribute(Qt.WA_AlwaysStackOnTop) self.processEvents() log.info("Initialization completed.") self.processEvents() self.mainWindow.show() log.info("This is the MAIN THREAD")
def main(): QtWidgets.QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True) # enable highdpi scaling Qt.HighDpiScaleFactorRoundingPolicy.Round scaleFactor = ctypes.windll.shcore.GetScaleFactorForDevice(0) / 100 if scaleFactor >= 1.5: os.environ["QT_SCREEN_SCALE_FACTORS"] = "1.5" else: os.environ[ "QT_SCREEN_SCALE_FACTORS"] = "scaleFactor" # das ist der richtige Skalierungsfaktor #os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "-1" #QT_SCREEN_SCALE_FACTORS #os.environ["QT_SCALE_FACTOR"] = "1.4" #os.environ["QT_DEVICE_PIXEL_RATIO"] = "0.5" app = QApplication(sys.argv) pixmap = QPixmap(os.path.dirname(sys.argv[0]) + "/pics/splesh.JPG") splash = QSplashScreen(pixmap) splash.show() splash.showMessage("Module werden geladen...") app.processEvents() app.setStyle("Fusion") time.sleep(3) window11 = myTab5.myTab5() #window11.setFixedSize(1100, 600) #window11.resize(window11.minimumSizeHint()) splash.finish(window11) showForUpdates(version, "https://digital-ies.de/wp-content/uploads", app, window11) app.exec_()
def makeSplash(): """ This makes a splash screen that has the current FOQUS version information as well as all of the third party dependency information """ # Load the splash screen background svg, gonna draw text over pixmap = QPixmap(':/icons/icons/ccsiSplash2.svg') # Make a painter to add text to painter = QPainter(pixmap) font = painter.font() # current font for drawing text font.setPointSize(8) font.setBold(True) painter.setFont(font) painter.drawText(20, 110, "Version: {}".format(ver.version)) font.setBold(False) painter.setFont(font) painter.drawText( 20, 200, 740, 50, QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft | QtCore.Qt.TextWordWrap, "License: {}".format(ver.license)) painter.drawText( 20, 250, 740, 50, QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft | QtCore.Qt.TextWordWrap, "Support: {}".format(ver.support)) painter.drawText( 20, 300, 740, 300, QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft | QtCore.Qt.TextWordWrap, ver.copyright) painter.end() splashScr[1] = QSplashScreen(pixmap=pixmap)
def main(test_func): from pyminer2 import pmutil app = QApplication(sys.argv) path_logo = os.path.join(pmutil.get_root_dir(), r'ui\source\icons\logo.png') app.setWindowIcon(QIcon(path_logo)) # 设置应用logo path_splash = os.path.join(pmutil.get_root_dir(), r'ui\source\images\splash.png') splash = QSplashScreen(QPixmap(path_splash)) splash.showMessage("正在加载pyminer... 0%", Qt.AlignHCenter | Qt.AlignBottom, Qt.black) splash.show() # 显示启动界面 pmutil._application = app load_fonts(app) load_translator(app) # font = os.path.join(os.path.dirname(__file__), 'ui', 'source', 'font', 'SourceCodePro-Regular.ttf') app.default_font = 'Deng' f = QFont(app.default_font, 10) app.setFont(f) demo = MainWindow() demo.events_ready_signal.connect(test_func) splash.finish(demo) # 修复故障 I1VYVO 程序启动完成后,关闭启动界面 liugang 20200921 id(demo) sys.exit(app.exec_())
def init(): """ Init gui. Concat all files from style directory and apply stylesheet. Run `bootstrap_function` to prepare app. """ app = QApplication(sys.argv) app.setWindowIcon(QIcon('splash.png')) splash_img = QPixmap('splash.png') splash = QSplashScreen(splash_img) splash.show() app.processEvents() # items = bootstrap_function() items = '' style = [] style_dir = 'style' for f in os.listdir(style_dir): if not f.endswith('.qss'): continue with open(os.path.join(style_dir, f), 'r') as qss: style.append(qss.read()) app.setStyleSheet('\n'.join(style)) mw = MainWindow(items) splash.finish(mw) sys.excepthook = mw.excepthook sys.exit(app.exec_())
def openDialog(self): # Only single instance of Plugin if self.exists == True: return else: self.exists = True self.resources = Resources(self.plugin_dir) self.dlg = PlanHeatDMMDialog(self) self.data = Data(plugin=False) splash = QSplashScreen( QtGui.QPixmap(self.plugin_dir + os.path.sep + 'resources/PlanHeatPrincipal.png'), QtCore.Qt.WindowStaysOnTopHint) splash.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) splash.setEnabled(False) splash.show() # Run the dialog event loop self.run() splash.finish(self.dlg) self.dlg.show() result = self.dlg.exec_() self.exists = False # See if OK was pressed if result: # Do something useful here pass else: pass
def launch_main(xml_fname=None, introspect_fname=None): app = QApplication(sys.argv) import time start = time.time() splash_fname = utils.get_resource_path('icons/splash.jpg') splash_pix = QPixmap(splash_fname) size = splash_pix.size()*.35 splash_pix = splash_pix.scaled(size, Qt.KeepAspectRatio, transformMode=Qt.SmoothTransformation) # # below makes the pixmap half transparent painter = QPainter(splash_pix) painter.setCompositionMode(painter.CompositionMode_DestinationAtop) painter.end() splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) splash.show() app.processEvents() time.sleep(2) app.processEvents() mdwiz = PyMdWizardMainForm() mdwiz.show() splash.finish(mdwiz) if xml_fname is not None and os.path.exists(xml_fname): mdwiz.open_file(xml_fname) if introspect_fname is not None and os.path.exists(introspect_fname): mdwiz.metadata_root.eainfo.detaileds[0].populate_from_fname(introspect_fname) mdwiz.metadata_root.eainfo.ui.fgdc_eainfo.setCurrentIndex(1) app.exec_()
def __init__(self, irises, settings, parent=None, chan=None, **kwargs): QMainWindow.__init__(self, parent) self._splash = QSplashScreen(self, QPixmap('data/logo.tif')) self._splash.show() self.setAttribute(Qt.WA_DeleteOnClose) self.setWindowTitle("CBRS Array Monitor") self.setMinimumSize(800, 600) self._settings = settings self.addDockWidget( Qt.TopDockWidgetArea, TopLevelControlPanel(irises=irises, settings=settings, parent=self)) #start the window self.setCentralWidget( MainStatusWindow(irises=irises, parent=self, chan=chan)) #load previous settings print("Loading %s" % self._settings.fileName()) if self._settings.contains("MainWindow/geometry"): self.restoreGeometry(self._settings.value("MainWindow/geometry")) if self._settings.contains("MainWindow/state"): self.restoreState(self._settings.value("MainWindow/state")) #load complete self._splash.finish(self)
def check_update(self): try: self.top = QSplashScreen(QPixmap('icons/wait.png')) self.top.show() QTimer.singleShot(3000, self.top.close) resp = requests.get( url= 'https://raw.githubusercontent.com/SubhoBasak/SKFGI_feedback_analyzer/master/Output/version.txt' ) resp = resp.text.strip('\n').strip() self.tmp = QMessageBox() self.tmp.setWindowTitle('Update') self.tmp.setWindowIcon(QIcon('icons/logo.png')) if resp != self.version: self.tmp.setInformativeText( 'New update available!\nDownlaod from : https://github.com/SubhoBasak/SKFGI_feedback_analyzer/tree/master/Output' ) else: self.tmp.setInformativeText('Already up-to-date') self.tmp.show() except Exception as e: self.top = Ui_Error() self.top_widget = QWidget() self.top.setupUi(self.top_widget) self.top.retranslateUi(self.top_widget) self.top.textBrowser.setTextColor(QColor(255, 0, 0)) self.top.textBrowser.setText(repr(e)) self.top_widget.show()
def main(): # define command line parameters parser = ArgumentParser() parser.add_argument("--no-splash", dest="splash", action="store_false") args = parser.parse_args() app = QApplication(sys.argv) # create splash screen with sponsors # default splash=True, use "-s" or "--splash" to set splash=False window = MainWindow() if args.splash: pixmap = QPixmap(os.path.join("resources","splash", "splash.jpg")) splash = QSplashScreen(pixmap) splash.showMessage(" Version: " + __version__, Qt.AlignBottom) # show the splash screen for 3 seconds splash.show() app.processEvents() QThread.sleep(3) window.show() splash.finish(window) else: window.show() sys.exit(app.exec())
def run(): """ Creates all the top-level assets for the application, sets things up and then runs the application. """ setup_logging() logging.info('\n\n-----------------\n\nStarting Mu {}'.format(__version__)) logging.info(platform.uname()) # The app object is the application running on your computer. app = QApplication(sys.argv) # Create the "window" we'll be looking at. editor_window = Window() # Create the "editor" that'll control the "window". editor = Editor(view=editor_window) editor.setup(setup_modes(editor, editor_window)) # Setup the window. editor_window.closeEvent = editor.quit editor_window.setup(editor.debug_toggle_breakpoint, editor.theme) # capture the filename passed by the os, if there was one passed_filename = sys.argv[1] if len(sys.argv) > 1 else None editor.restore_session(passed_filename) # Connect the various UI elements in the window to the editor. status_bar = editor_window.status_bar status_bar.connect_logs(editor.show_logs, 'Ctrl+Shift+D') status_bar.connect_mode(editor.select_mode, 'Ctrl+Shift+M') # Display a friendly "splash" icon. splash = QSplashScreen(load_pixmap('splash-screen')) splash.show() # Finished starting up the application, so hide the splash icon. splash_be_gone = QTimer() splash_be_gone.timeout.connect(lambda: splash.finish(editor_window)) splash_be_gone.setSingleShot(True) splash_be_gone.start(5000) # Stop the program after the application finishes executing. sys.exit(app.exec_())
def main(sys): app = QApplication(sys.argv) show_splash = True for token in sys.argv: if token == '-nosplash' or token == '--nosplash': show_splash = False elif token == '-h' or token == '-help' or token == '--help': print('pdgui - graphical user interface to the PDielec package') print('pdgui [-help] [-debug] [program] [filename] [spreadsheet] [-script scriptname] [-nosplash] [-exit]') exit() if show_splash: dirname = os.path.dirname(os.path.realpath(sys.argv[0])) splashfile = os.path.join(dirname, 'Python/GUI/splash.png') pixmap = QPixmap(splashfile) splash = QSplashScreen(pixmap) progressbar = QProgressBar(splash) splash.show() else: progressbar = QProgressBar() progressbar = None ex = App(sys.argv, progressbar) ex.show() if show_splash: splash.finish(ex) sys.exit(app.exec_())