def main(): window = MainWindow() window.setStyleSheet(appStyle) setattr(FWindow, 'window', window) window.show() # window.showMaximized() sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) window = MainWindow(config) window.show() ret = app.exec_() sys.exit(ret)
def main(argv=None): if argv is None: argv = sys.argv app = QApplication(argv) app.setApplicationName('CANopenGUI') window = MainWindow() window.show() return app.exec_()
def launch_data_downloader(path): app = QApplication(sys.argv) splash_pix = QPixmap('icons/xigmanas_conf_backup_icon.svg') splash = QSplashScreen(splash_pix) splash.setMask(splash_pix.mask()) splash.show() config_dict = configparser.ConfigParser() if not os.path.exists(os.path.join(path, 'xigmanas_backup.ini')): config_dict['LOG'] = {'level': 'INFO', 'path': ''} config_dict['OPTIONS'] = { 'language': 'english', 'check_update': 'False' } config_dict['CREDENTIALS'] = { 'password': '', 'username': '', 'folder': '', 'target': '', 'target_port': '22' } with open(os.path.join(path, 'xigmanas_backup.ini'), 'w') as configfile: config_dict.write(configfile) config_dict.read(os.path.join(path, 'xigmanas_backup.ini')) path_exist = True if not config_dict.get('LOG', 'path'): log_filename = os.path.join(path, 'xigmanas_backup_log.out') else: path_exist = os.path.isdir(config_dict.get('LOG', 'path')) if path_exist: log_filename = os.path.join(config_dict.get('LOG', 'path'), 'xigmanas_backup_log.out') else: log_filename = os.path.join(path, 'xigmanas_backup_log.out') logging.getLogger('').handlers = [] logging.basicConfig(filename=log_filename, level=getattr(logging, config_dict.get('LOG', 'level')), filemode='w', format='%(asctime)s : %(levelname)s : %(message)s') formatter = logging.Formatter('%(levelname)s : %(message)s') console = logging.StreamHandler() console.setLevel(logging.DEBUG) console.setFormatter(formatter) logging.getLogger('').addHandler(console) logging.info('*****************************************') logging.info('XigmaNAS Conf Backup ' + _backup_version + ' is starting ...') logging.info('*****************************************') ui = MainWindow(path, config_dict) ui.show() splash.finish(ui) sys.exit(app.exec_())
def main(): try: app.check_and_update_data() except Exception: pass qapp = QtWidgets.QApplication(sys.argv) mw = MainWindow() mw.showMaximized() ret = qapp.exec_() mw.user_data.save() sys.exit(ret)
def main(): app = QtWidgets.QApplication(sys.argv) with open("ui/style.qss") as f: try: app.setStyleSheet("\n".join(f.readlines())) except Exception as e: logging.error(e) else: logging.info("Stylesheets are included") window = MainWindow() window.show() logging.info("Show main window, starting main thread") main_thread = threading.Thread(target=app.exec_) main_thread.run()
def startmain(): """ Initialise the application and display the main window. """ args = parse_arguments() app = QApplication(sys.argv) app.cleanup_files = [] if not args.native_style: app.setStyle(QStyleFactory.create('Fusion')) app.setPalette(QApplication.style().standardPalette()) app_icon = QIcon(':/icons/ui/ot_icon.svg') print(app_icon.isNull(), app_icon.pixmap(200, 200).isNull()) app.setApplicationName(APP_NAME) app.setApplicationVersion(VERSION_STRING) app.setOrganizationName(ORG_NAME) app.setWindowIcon(app_icon) print('AppName: {0:s}'.format(app.applicationName())) print('AppVersion: {0:s}'.format(app.applicationVersion())) print('Company Name: {0:s}'.format(app.organizationName())) QLocale.setDefault(QLocale(QLocale.English, QLocale.UnitedKingdom)) # Add passed arguments to app. app.args = args print('Args:', app.args) # Check to see if application already running. existing_pid = instance_check(app) if existing_pid: print(existing_pid) if app.args.quit_existing: # Command line argument passed to close existing program. Do that, then quit. if platform.system() == "Windows": subprocess.Popen("taskkill /F /T /PID %i" % existing_pid, shell=True) else: os.killpg(existing_pid, signal.SIGKILL) else: message_box_error('Program already running.', 'You can only have one copy of the Bing Wallpaper Changer running at once.') sys.exit() mainwindow = MainWindow() # mainwindow.show() sys.exit(app.exec_())
def __init__(self): super(Window, self).__init__() self.ui: MainWindow = MainWindow() self.ui.setupUi(self) # self.ui.verticalLayout.addWidget(Lab_1(self.ui.centralwidget)) self.ui.tabWidget.addTab(Lab_1(self.ui.tabWidget), 'Лабораторная 1') self.ui.tabWidget.addTab(Lab_2(self.ui.tabWidget), 'Лабораторная 2') self.ui.tabWidget.addTab(Lab_3(self.ui.tabWidget), 'Лабораторная 3') self.ui.tabWidget.addTab(Lab_4(self.ui.tabWidget), 'Лабораторная 4') self.ui.tabWidget.addTab(Lab_5(self.ui.tabWidget), 'Лабораторная 5') self.ui.tabWidget.addTab(Lab_6(self.ui.tabWidget), 'Лабораторная 6') self.ui.tabWidget.setCurrentIndex(6-1) self.ui.tabWidget.setCurrentIndex(1-1) self.setGeometry(QtCore.QRect(0, 0, 0, 0)) self.ui.tabWidget.currentChanged.connect( lambda: self.resize(self.minimumSize()) )
def launch_egads_gui(path): app = QtWidgets.QApplication(sys.argv) splash_pix = QtGui.QPixmap('icons/egads_gui_splashscreen.png') splash = QtWidgets.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() config_dict = ConfigParser.ConfigParser() if not os.path.exists(os.path.join(path, 'egads_gui.ini')): ini_file = open(os.path.join(path, 'egads_gui.ini'), 'w') config_dict.add_section('LOG') config_dict.add_section('OPTIONS') config_dict.set('LOG', 'level', 'DEBUG') config_dict.set('LOG', 'path', '') config_dict.set('OPTIONS', 'check_update', 'False') config_dict.write(ini_file) ini_file.close() config_dict.read(os.path.join(path, 'egads_gui.ini')) log_filename = os.path.join(config_dict.get('LOG', 'path'), 'egads_gui.log') logging.getLogger('').handlers = [] logging.basicConfig(filename=log_filename, level=getattr(logging, config_dict.get('LOG', 'level')), filemode='w', format='%(asctime)s : %(levelname)s : %(message)s') formatter = logging.Formatter('%(levelname)s : %(message)s') console = logging.StreamHandler() console.setLevel(logging.DEBUG) console.setFormatter(formatter) logging.getLogger('').addHandler(console) logging.info('**********************************') logging.info('EGADS GUI ' + _gui_version + ' is starting ...') logging.info('**********************************') logging.info('gui - operating system: ' + str(sys.platform)) python_version = str(sys.version_info[0]) + '.' + str( sys.version_info[1]) + '.' + str(sys.version_info[2]) logging.info('gui - python version: ' + python_version) logging.info('gui - egads version: ' + egads_version) ui = MainWindow(path, config_dict) ui.show() splash.finish(ui) sys.exit(app.exec_())
def launch_prosim_updater(path): app = QApplication(sys.argv) splash_pix = QPixmap('icons\splash_screen.svg') splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() config_dict = configparser.ConfigParser() if not os.path.exists(os.path.join(path, 'prosim_updater.ini')): config_dict['LOG'] = {'level': 'DEBUG', 'path': ''} config_dict['OPTIONS'] = {'language':'english', 'check_update':'False', 'terminate_processes':'False', 'relaunch_processes':'False'} with open(os.path.join(path, 'prosim_updater.ini'), 'w') as configfile: config_dict.write(configfile) config_dict.read(os.path.join(path, 'prosim_updater.ini')) if not config_dict['OPTIONS'].get('language'): config_dict.set('OPTIONS', 'language', 'english') with open(os.path.join(path, 'prosim_updater.ini'), 'w') as configfile: config_dict.write(configfile) if not config_dict.get('LOG', 'path'): log_filename = os.path.join(path, 'prosim_creator_log.out') else: log_filename = os.path.join(config_dict.get('LOG', 'path'),'prosim_creator_log.out') logging.getLogger('').handlers = [] logging.basicConfig(filename = log_filename, level = getattr(logging, config_dict.get('LOG', 'level')), filemode = 'w', format = '%(asctime)s : %(levelname)s : %(message)s') formatter = logging.Formatter('%(levelname)s : %(message)s') console = logging.StreamHandler() console.setLevel(logging.DEBUG) console.setFormatter(formatter) logging.getLogger('').addHandler(console) logging.info('*****************************************') logging.info('Prosim737 Updater ' + _updater_version + ' is starting ...') logging.info('*****************************************') translations = read_translations() ui = MainWindow(path, config_dict, translations) ui.show() splash.finish(ui) sys.exit(app.exec_())
def new_instance(self, args=None, show=True): """Creates a new instances. Arguments: args: List of filenames to open in new instance (default: None). show: If True, instance.show() is called here (default: True). Returns: The new instance. """ create_editor = not args instance = MainWindow(self, create_editor=create_editor) if args is None: args = [] for arg in args: instance.editor_create(arg) self._instances.append(instance) instance.connect("destroy", self.on_instance_destroyed) if show: instance.show() self.cb.emit("instance-created", instance) return instance
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'ipetrash' # TODO: добавить батник сборки ехе через pyinstaller import sys from PyQt5.QtWidgets import QApplication from ui.mainwindow import MainWindow app = QApplication(sys.argv) font = app.font() font.setPointSize(font.pointSize() + 8) app.setFont(font) mw = MainWindow(r'C:\Users\ipetrash\Music\Эпоха – Ценой великих жертв.mp3') mw.show() sys.exit(app.exec_())
splash = SplashScreen() splash.show() app.exec_() if DEBUG: QMessageBox.warning(None, app.tr("HoruCNC"), app.tr(fp.name), QMessageBox.Close) # check that the resources has been extracted. Otherwise we # are running direct from the "*.dmg" image -which is not supported- # if not os.access("resources/config/configuration.ini", os.W_OK | os.R_OK): QMessageBox.warning(None, app.tr("HoruCNC"), app.tr("Running from DMG Image is not supported.\n" + \ "Copy HoruCNC to your application folder"), QMessageBox.Close) else: main = MainWindow() main.show() if len(sys.argv) > 1: main.loadPipelinePyFile(sys.argv[1]) else: main.loadPipelineByIndex(0) print("--------------------") print(sys.version) print(QtCore.qVersion()) print("--------------------") exit_code = app.exec_() sys.exit(exit_code)
def main(): app = QtWidgets.QApplication(sys.argv) QLocale.setDefault(QLocale(QLocale.English)) ui = MainWindow() ui.show() sys.exit(app.exec_())
# -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui from ui.mainwindow import MainWindow if __name__ == "__main__": import sys app = QtGui.QApplication(sys.argv) a = MainWindow(sys.argv) a.show() sys.exit(app.exec_())
exc_info=(exc_type, exc_value, exc_traceback)) sys.excepthook = handle_exception if __name__ == '__main__': main_path = os.path.abspath(os.path.dirname(__file__)) app = QtWidgets.QApplication(sys.argv) splash_pix = QtGui.QPixmap('icons/orionftp_splashscreen.png') splash = QtWidgets.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint) splash.setMask(splash_pix.mask()) splash.show() config_dict = configparser.ConfigParser() if not os.path.exists(os.path.join(main_path, 'orion_ftp.ini')): create_option_file(main_path, config_dict) config_dict.read(os.path.join(main_path, 'orion_ftp.ini')) create_logging_handlers(config_dict, 'orion_ftp.log') logging.info('**********************************') logging.info('OrionFTP ' + gui_version + ' is starting ...') logging.info('**********************************') logging.info('OrionFTP - operating system: ' + str(sys.platform)) python_version = str(sys.version_info[0]) + '.' + str( sys.version_info[1]) + '.' + str(sys.version_info[2]) logging.info('OrionFTP - python version: ' + python_version) translations = read_translations() ui = MainWindow(main_path, config_dict, translations) ui.show() splash.finish(ui) sys.exit(app.exec_())
def __init__(self): self.settings = Settings("./config.json") self.machine = Machine(self.settings) self.window = MainWindow(self.settings, self.machine)
def launch_asmm_creator(): import sys app = QtGui.QApplication(sys.argv) ui = MainWindow() ui.show() sys.exit(app.exec_())
def main(): app = QApplication([]) app.setApplicationName("Clinician Scheduler") window = MainWindow() app.exec_()
def main(): app = QtWidgets.QApplication([]) window = MainWindow() sys.exit(app.exec_())
import sys import PyQt5.sip from PyQt5 import QtGui from PyQt5.QtWidgets import QApplication from ui.mainwindow import MainWindow if __name__ == "__main__": app = QApplication(sys.argv) win = MainWindow(app) win.show() sys.exit(app.exec_())
def main_curses(self, screen): # tell the terminal to not send us SIGINTs when Ctrl+C is pressed tty_attributes = termios.tcgetattr(sys.stdin) tty_attributes[3] &= ~termios.ISIG termios.tcsetattr(sys.stdin, termios.TCSANOW, tty_attributes) self.screen = screen curses.use_default_colors() curses.curs_set(0) self.status_bar = StatusBar(self) self.main_window = MainWindow(self) curses.doupdate() # this window stack kind of duplicates the one kept by # curses.panel — perhaps we should just use that directly? self.window_stack = [self.status_bar, self.main_window] self.should_quit = False while True: key = screen.get_wch() # blocks indefinitely if key == curses.KEY_RESIZE: # this could be either a legitimate SIGWINCH, notifying us that # the terminal was resized, # or a fake SIGWINCH, generated by the zgram_handler # (see __init__) notifying us that we have new zephyrgrams # to take from the queue while not self.zgram_queue.empty(): zgram = Zephyrgram.from_zpipe(self.zgram_queue.get()) self.db.append_message(zgram) # if this is in class 'ununclass', and we aren't yet # subscribed to 'unununclass', do so undepth, class_stripped = take_unprefix(zgram.class_) new_unclass = 'un' + zgram.class_ for instance, recipient in self.db.update_undepth( class_stripped, undepth + 1): self.zpipe.subscribe(new_unclass, instance, recipient) for window in self.window_stack: window.update_size() else: self.status_bar.clear_status() self.should_quit = False events = self.window_stack[-1].handle_keypress(key) self.handle_events(events) if self.should_quit: break if not self.error_queue.empty(): error = self.error_queue.get() self.status_bar.set_status('Error in {}: {}'.format( error.operation, error.message)) curses.doupdate()
def main(argv): qApp = QApplication(argv) sw_updater = SoftwareUpdater() sigLoader = None supportedFileFormats = None sigModel = SignalTraceModel() ldrLauncher = LoaderLauncher() config = Configuration() if check_edii_valid(config) is False: mbox = QMessageBox(QMessageBox.Information, 'Incomplete configuration', ('Path to ECHMET Data Import Infrastructure (EDII) ' 'service has not been set. ' 'This service is necessary for SigMix to load ' 'experimental data and SigMix cannot function ' 'without it.\n\n' 'Unless you have a reason to set the path ' 'manually default path should be safe to use.')) mbox.addButton('Use default path', QMessageBox.YesRole) mbox.addButton('Set path manually', QMessageBox.NoRole) if mbox.exec_() == QDialog.Accepted: set_edii_path(config) else: config.set_value('edii_path', LoaderLauncher.default_path()) while True: try: ldrLauncher.launchIfNeeded(config.get_value('edii_path')) break except EDIIStartError as ex: mbox = QMessageBox( QMessageBox.Question, 'Cannot start EDII service', ('SigMix was unable to start the EDII service.\n' 'Error reported: ' + str(ex) + '\n' 'Would you like to set a different path to ' 'the EDII service and try again?'), QMessageBox.Yes | QMessageBox.No) ret = mbox.exec_() if ret == QMessageBox.Yes: set_edii_path(config) continue sys.exit(1) except EDIIConnectionError as ex: dlg = EDIIConnectionErrorDialog(str(ex)) dlg.exec_() ldrLauncher.terminate() sys.exit(1) try: sigLoader = signaltraceloaderfactory.makeSignalLoaderDelegate( ldrLauncher) supportedFileFormats = sigLoader.supportedFileFormats() mWin = MainWindow(supportedFileFormats, sigModel) sigLoader.signalLoaded.connect(sigModel.onSignalLoaded) except SignalTraceLoaderError as ex: mbox = QMessageBox(QMessageBox.Critical, 'Cannot initialize signal loader', str(ex)) mbox.exec_() ldrLauncher.terminate() sys.exit(1) mWin.loadSignal.connect(sigLoader.onLoadSignal) mWin.connectUpdater(sw_updater) mWin.show() sw_updater.check_for_update(True) ret = qApp.exec_() ldrLauncher.terminate() config.save() return ret
def launch_prosim_updater(path): app = QApplication(sys.argv) splash_pix = QPixmap('icons\downloader_update_off_icon.svg') splash = QSplashScreen(splash_pix) splash.setMask(splash_pix.mask()) splash.show() config_dict = configparser.ConfigParser() if not os.path.exists(os.path.join(path, 'ecmwf_downloader.ini')): config_dict['LOG'] = {'level': 'DEBUG', 'path': ''} config_dict['OPTIONS'] = { 'language': 'english', 'check_update': 'True', 'display_api_info': 'True' } config_dict['CREDENTIALS'] = { 'url': 'https://api.ecmwf.int/v1', 'key': '', 'email': '', 'folder': '' } with open(os.path.join(path, 'ecmwf_downloader.ini'), 'w') as configfile: config_dict.write(configfile) config_dict.read(os.path.join(path, 'ecmwf_downloader.ini')) if not config_dict['OPTIONS'].get('language'): config_dict.set('OPTIONS', 'language', 'english') with open(os.path.join(path, 'ecmwf_downloader.ini'), 'w') as configfile: config_dict.write(configfile) if not config_dict['CREDENTIALS'].get('folder'): config_dict.set('CREDENTIALS', 'folder', '') with open(os.path.join(path, 'ecmwf_downloader.ini'), 'w') as configfile: config_dict.write(configfile) path_exist = True if not config_dict.get('LOG', 'path'): log_filename = os.path.join(path, 'ecmwf_downloader_log.out') else: path_exist = os.path.isdir(config_dict.get('LOG', 'path')) if path_exist: log_filename = os.path.join(config_dict.get('LOG', 'path'), 'ecmwf_downloader_log.out') else: log_filename = os.path.join(path, 'ecmwf_downloader_log.out') logging.getLogger('').handlers = [] logging.basicConfig(filename=log_filename, level=getattr(logging, config_dict.get('LOG', 'level')), filemode='w', format='%(asctime)s : %(levelname)s : %(message)s') formatter = logging.Formatter('%(levelname)s : %(message)s') console = logging.StreamHandler() console.setLevel(logging.DEBUG) console.setFormatter(formatter) logging.getLogger('').addHandler(console) logging.info('*****************************************') logging.info('ECMWF Data Downloader ' + _downloader_version + ' is starting ...') logging.info('*****************************************') if not path_exist: logging.exception( 'ecmwf_data_downloader.py - exception occured when EDD tried to write log file in a non-default folder. Please check ' + 'that the folder exists. The path option in the config file is going to be modified to the default folder.' ) config_dict.set('LOG', 'path', '') with open(os.path.join(path, 'ecmwf_downloader.ini'), 'w') as configfile: config_dict.write(configfile) ui = MainWindow(path, config_dict) ui.show() splash.finish(ui) sys.exit(app.exec_())
LOG_FORMATTER = \ logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s' ) LOGGER_FH.setFormatter(LOG_FORMATTER) LOGGER_CH.setFormatter(LOG_FORMATTER) # add the handlers to the logger LOGGER.addHandler(LOGGER_FH) LOGGER.addHandler(LOGGER_CH) if __name__ == '__main__': LOGGER.debug('Start program') # Read LOC_LANG from settings file SETTINGS = QtCore.QSettings('settings.ini', QtCore.QSettings.IniFormat) SETTINGS.beginGroup('UserSettings') LOC_LANG = SETTINGS.value('Language') SETTINGS.endGroup() APP = QtWidgets.QApplication(sys.argv) PARENT_PATH = os.path.join(__file__, os.path.pardir) DIR_PATH = os.path.abspath(PARENT_PATH) FILE_PATH = os.path.join(DIR_PATH, 'i18n', LOC_LANG + '.qm') if Path(FILE_PATH).exists(): TRANSLATOR = QtCore.QTranslator() TRANSLATOR.load(FILE_PATH) APP.installTranslator(TRANSLATOR) UI = MainWindow() UI.show() sys.exit(APP.exec_()) LOGGER.debug('Exit program')
#!/usr/bin/env python # # === PYDAQCONFIG === # # This work is licensed under the Creative Commons Attribution-NonCommercial- # ShareAlike 4.0 International License. To view a copy of this license, visit # http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative # Commons, PO Box 1866, Mountain View, CA 94042, USA. import sys from ui.mainwindow import MainWindow from PyQt4 import QtGui qApp = QtGui.QApplication(sys.argv) window = MainWindow() window.show() window.raise_() qApp.exec_()
from PyQt5 import QtWidgets from PyQt5 import sip import sys sys.path.append(".") from ui.mainwindow import MainWindow if __name__ == "__main__": import sys import os max_dept = sys.getrecursionlimit() path = os.path.dirname(os.path.realpath(__file__)) print("path:" + path) print("stack size:" + str(max_dept)) os.chdir(path) app = QtWidgets.QApplication(sys.argv) MainWindows = MainWindow() MainWindows.show() sys.exit(app.exec_())
def stream_stdout(stream): """ Acts as callback for messages from stream. Routes messages from pycurl stream to the UI """ ui.update_textBrowser(stream) if __name__ == "__main__": import sys #start window app = QtGui.QApplication(sys.argv) ui = MainWindow() #start stream as new thread flow = flowdockClient.flowdock_py() flow.DEBUG = 1 flow.API_TOKEN = settings.API_TOKEN flow.USER = settings.USER #this is the user email address (user for logging in) flow.USER_NAME = settings.USER_NAME #the display name for the user flow.PASS = settings.PASS th = thread.start_new_thread(flow.stream, (stream_stdout, )) ui.load_flow(flow) flow.get_users() #show window ui.show() sys.exit(app.exec_())
import logging, logging.config logging.config.fileConfig("logging.conf") logger = logging.getLogger("wallLogger") logger.info("logger stated") from ui.mainwindow import MainWindow main_window = MainWindow() # APPSLIST from mtmenu.ui.appslist import AppsList from utils import get_all_applications apps_list = AppsList(get_all_applications()) # TOPBAR from ui.topbar import TopBar top_bar = TopBar() # CATEGORIES LIST from ui.categorylist import CategoryList from utils import get_all_categories categories_list = CategoryList(get_all_categories()) # PROXY from proxy import Proxy proxy = Proxy() # BACKGROUND from ui.backgroundimage import BackgroundImage background_image = BackgroundImage(filename='images/wallpaper.png')