Example #1
0
def run_gui(config: CoreConfig):
    logger.info("Starting UI")

    app = QApplication([])
    app.setOrganizationName("Scille")
    app.setOrganizationDomain("parsec.cloud")
    app.setApplicationName("Parsec")

    f = QFont("Arial")
    app.setFont(f)

    # splash = QSplashScreen(QPixmap(':/logos/images/logos/parsec.png'))
    # splash.show()
    # app.processEvents()

    lang.switch_language()

    win = MainWindow(core_config=config)

    # QTimer wakes up the event loop periodically which allows us to close
    # the window even when it is in background.
    signal.signal(signal.SIGINT, kill_window(win))
    timer = QTimer()
    timer.start(400)
    timer.timeout.connect(lambda: None)

    win.showMaximized()
    # splash.finish(win)

    return app.exec_()
Example #2
0
def main():
    app = QApplication(sys.argv)
    app.setAttribute(Qt.AA_UseHighDpiPixmaps)

    app.setOrganizationName(ORG_NAME)
    app.setOrganizationDomain(ORG_DOMAIN)
    app.setApplicationName(APP_NAME.replace(' ', '_').lower())
    app.setApplicationVersion(VERSION)

    log_window = LogWindow()
    logger = logging.getLogger()
    logger.setLevel(logging.INFO)
    logger.addHandler(log_window)
    logger.addHandler(logging.StreamHandler(stream=sys.stdout))

    log = logging.getLogger(__name__)
    log.info('Launching {}, version {}, git hash: {}'.format(
        APP_NAME, VERSION, GITHASH))

    main_window = MainWindow(log_window)
    paths = [pathlib.Path(p) for p in sys.argv[1:]]
    pnt_files = [p for p in paths if p.is_file() and p.suffix == '.pnt']
    for f in pnt_files:
        log.info('Opening file {}'.format(f))
        main_window.open_pnts([f])

    main_window.show()

    sys.exit(app.exec())
Example #3
0
def main():
    app = QApplication([i.encode('utf-8') for i in sys.argv])
    app.setOrganizationName(ffmc.__name__)
    app.setOrganizationDomain(ffmc.__url__)
    app.setApplicationName('FF Multi Converter')
    app.setWindowIcon(QIcon(':/ffmulticonverter.png'))

    locale = QLocale.system().name()
    qtTranslator = QTranslator()
    if qtTranslator.load('qt_' + locale, ':/'):
        app.installTranslator(qtTranslator)
    appTranslator = QTranslator()
    if appTranslator.load('ffmulticonverter_' + locale, ':/'):
        app.installTranslator(appTranslator)

    if not os.path.exists(config.log_dir):
        os.makedirs(config.log_dir)

    logging.basicConfig(filename=config.log_file,
                        level=logging.DEBUG,
                        format=config.log_format,
                        datefmt=config.log_dateformat)

    converter = MainWindow()
    converter.show()
    app.exec_()
Example #4
0
    def monitor(self):
        """Launch a table view of fields and field statistics."""
        auth = self.get_auth()
        race_id = self.args.race_id

        race_list = get_race_list(auth)
        matching_race_list = list(
            filter(lambda race: fnmatch.fnmatchcase(race['id'], race_id),
                   race_list))
        if len(matching_race_list) > 1:
            sys.stderr.write(
                'Ambiguous race id %s, can match: %s.\n' % (race_id, ', '.join(
                    map(lambda race: race['id'], matching_race_list))))
            sys.exit(-1)
        race = matching_race_list[0]

        QApplication.setOrganizationName(common.ORGANIZATION_NAME)
        QApplication.setOrganizationDomain(common.ORGANIZATION_DOMAIN)
        QApplication.setApplicationName(common.APPLICATION_NAME)
        QApplication.setApplicationVersion(common.VERSION)

        app = QApplication(sys.argv)

        main_window = FieldStatisticsTable(auth, race,
                                           self.args.monitor_interval)
        main_window.show()
        retcode = app.exec_()

        main_window.close()
        sys.exit(retcode)
def main():
    """Main Loop."""
    APPNAME = str(__package__ or __doc__)[:99].lower().strip().replace(" ", "")
    if not sys.platform.startswith("win") and sys.stderr.isatty():
        def add_color_emit_ansi(fn):
            """Add methods we need to the class."""
            def new(*args):
                """Method overload."""
                if len(args) == 2:
                    new_args = (args[0], copy(args[1]))
                else:
                    new_args = (args[0], copy(args[1]), args[2:])
                if hasattr(args[0], 'baseFilename'):
                    return fn(*args)
                levelno = new_args[1].levelno
                if levelno >= 50:
                    color = '\x1b[31;5;7m\n '  # blinking red with black
                elif levelno >= 40:
                    color = '\x1b[31m'  # red
                elif levelno >= 30:
                    color = '\x1b[33m'  # yellow
                elif levelno >= 20:
                    color = '\x1b[32m'  # green
                elif levelno >= 10:
                    color = '\x1b[35m'  # pink
                else:
                    color = '\x1b[0m'  # normal
                try:
                    new_args[1].msg = color + str(new_args[1].msg) + ' \x1b[0m'
                except Exception as reason:
                    print(reason)  # Do not use log here.
                return fn(*new_args)
            return new
        # all non-Windows platforms support ANSI Colors so we use them
        log.StreamHandler.emit = add_color_emit_ansi(log.StreamHandler.emit)
    log.basicConfig(level=-1, format="%(levelname)s:%(asctime)s %(message)s")
    log.getLogger().addHandler(log.StreamHandler(sys.stderr))
    log.info(__doc__)
    try:
        os.nice(19)  # smooth cpu priority
        libc = cdll.LoadLibrary('libc.so.6')  # set process name
        buff = create_string_buffer(len(APPNAME) + 1)
        buff.value = bytes(APPNAME.encode("utf-8"))
        libc.prctl(15, byref(buff), 0, 0, 0)
    except Exception as reason:
        log.warning(reason)
    signal.signal(signal.SIGINT, signal.SIG_DFL)  # CTRL+C work to quit app
    app = QApplication(sys.argv)
    app.setApplicationName(APPNAME)
    app.setOrganizationName(APPNAME)
    app.setOrganizationDomain(APPNAME)
    app.instance().setQuitOnLastWindowClosed(False)  # no quit on dialog close
    icon = QIcon(app.style().standardPixmap(QStyle.SP_FileIcon))
    app.setWindowIcon(icon)
    win = MainWindow(icon)
    win.show()
    log.info('Total Maximum RAM Memory used: ~{} MegaBytes.'.format(int(
        resource.getrusage(resource.RUSAGE_SELF).ru_maxrss *
        resource.getpagesize() / 1024 / 1024 if resource else 0)))
    sys.exit(app.exec_())
def main():
    """Main Loop."""
    APPNAME = str(__package__ or __doc__)[:99].lower().strip().replace(" ", "")
    try:
        os.nice(19)  # smooth cpu priority
        libc = cdll.LoadLibrary('libc.so.6')  # set process name
        buff = create_string_buffer(len(APPNAME) + 1)
        buff.value = bytes(APPNAME.encode("utf-8"))
        libc.prctl(15, byref(buff), 0, 0, 0)
    except Exception as reason:
        print(reason)
    app = QApplication(sys.argv)
    app.setApplicationName(__doc__.strip().lower())
    app.setOrganizationName(__doc__.strip().lower())
    app.setOrganizationDomain(__doc__.strip())
    app.setWindowIcon(QIcon.fromTheme("text-x-python"))
    web = MainWindow()
    app.aboutToQuit.connect(web.process.kill)
    try:
        opts, args = getopt(sys.argv[1:], 'hv', ('version', 'help'))
    except:
        pass
    for o, v in opts:
        if o in ('-h', '--help'):
            print(''' Usage:
                  -h, --help        Show help informations and exit.
                  -v, --version     Show version information and exit.''')
            return sys.exit(1)
        elif o in ('-v', '--version'):
            print(__version__)
            return sys.exit(1)
    # web.show()  # comment out to hide/show main window, normally dont needed
    sys.exit(app.exec_())
Example #7
0
class MemSources(Mem):
    def __init__(self, coreapplication=True):
        Mem.__init__(self)
        if coreapplication == True:
            self.app = QCoreApplication(argv)
        else:
            self.app = QApplication(argv)

        self.app.setOrganizationName("xulpymoney")
        self.app.setOrganizationDomain("xulpymoney")
        self.app.setApplicationName("xulpymoney")

        self.settings = QSettings()
        self.localzone_name = self.settings.value("mem/localzone",
                                                  "Europe/Madrid")
        self.load_translation()
        self.settings = QSettings()

    def __del__(self):
        self.settings.sync()

    def load_translation(self):
        self.languages = TranslationLanguageManager()
        self.languages.load_all()
        self.languages.selected = self.languages.find_by_id(
            self.settings.value("frmAccess/language", "en"))
        self.languages.cambiar(self.languages.selected.id, "xulpymoney")
Example #8
0
class MemGUI(MemConsole):
    def __init__(self):
        MemConsole.__init__(self)

    ## Sets parser, logging and args confitions. This one is for devicesinlan_gui  command, that overrides supper method
    def parse_args(self):
        parser = ArgumentParser(prog='devicesinlan_gui',
                                description=self.description,
                                epilog=self.epilog,
                                formatter_class=RawTextHelpFormatter)
        parser.add_argument('--version',
                            action='version',
                            version="{} ({})".format(__version__,
                                                     __versiondate__))
        parser.add_argument('--debug',
                            help=self.tr("Debug program information"))
        self.args = parser.parse_args()

        self.setLoggingLevel(self.args.debug)

    ## Sets QApplication Object to make a Qt application
    def setQApplication(self):
        self.app = QApplication(argv)
        self.app.setQuitOnLastWindowClosed(True)
        self.app.setOrganizationName(self.name)
        self.app.setOrganizationDomain(self.name)
        self.app.setApplicationName(self.name)
        self.translator = QTranslator()
        self.settings = QSettings()
Example #9
0
class MemCaloriestracker(MemGui):
    def __init__(self):        
        MemGui.__init__(self)
    
    def run(self):
        self.args=self.parse_arguments()
        self.addDebugSystem(self.args.debug)
        self.app=QApplication(argv)
        self.app.setOrganizationName("caloriestracker")
        self.app.setOrganizationDomain("caloriestracker")
        self.app.setApplicationName("caloriestracker")
        self.con=None

        self.frmMain=None #Pointer to mainwidget
        self.closing=False#Used to close threads
        self.url_wiki="https://github.com/turulomio/caloriestracker/wiki"
    
    def parse_arguments(self):
        self.parser=ArgumentParser(prog='caloriestracker', description=self.tr('Report of calories'), epilog=self.epilog(), formatter_class=RawTextHelpFormatter)
        self. addCommonToArgParse(self.parser)
        args=self.parser.parse_args()
        return args
        
    def setLocalzone(self):
        self.localzone=self.settings.value("mem/localzone", "Europe/Madrid")
Example #10
0
    def start(self):
        """Display the GUI"""
        myApp = QApplication(sys.argv)
        sys.excepthook = lambda typ, val, tb: error_handler(typ, val, tb)

        myApp.setOrganizationDomain('mlox')
        myApp.setOrganizationName('mlox')

        icon_data: bytes = resource_manager.resource_string(
            "mlox.static", "mlox.ico")
        icon = QIcon()
        pixmap = QPixmap()
        pixmap.loadFromData(icon_data)
        icon.addPixmap(pixmap)
        myApp.setWindowIcon(icon)

        myEngine = QQmlApplicationEngine()
        # Need to set these before loading
        myEngine.rootContext().setContextProperty("python", self)
        myEngine.addImageProvider('static', PkgResourcesImageProvider())

        qml: bytes = resource_manager.resource_string("mlox.static",
                                                      "window.qml")
        myEngine.loadData(qml)

        # These two are hacks, because getting them in the __init__ and RAII working isn't
        self.debug_window = ScrollableDialog()
        self.clipboard = myApp.clipboard()

        self.analyze_loadorder()

        sys.exit(myApp.exec())
Example #11
0
def main():
    try:
        base_path = sys._MEIPASS
    except AttributeError:
        base_path = Path(__file__).parent

    # https://github.com/kivy/kivy/issues/4182#issuecomment-471488773
    if 'twisted.internet.reactor' in sys.modules:
        del sys.modules['twisted.internet.reactor']

    qapp = QApplication(sys.argv)
    qapp.setApplicationName("HPOS Seed")
    qapp.setOrganizationDomain("holo.host")
    qapp.setOrganizationName("Holo")

    # qt5reactor needs to be imported and installed after QApplication(),
    # but before importing twisted.internet.reactor. See qt5reactor docs.
    import qt5reactor
    qt5reactor.install()

    from twisted.internet import reactor
    app = App(qapp, reactor)

    engine = QQmlApplicationEngine()
    engine.rootContext().setContextProperty("app", app)
    engine.load(Path(base_path, 'send_qt.qml').as_uri())

    reactor.run()
def main():
    app = QApplication([i.encode('utf-8') for i in sys.argv])
    app.setOrganizationName(ffmc.__name__)
    app.setOrganizationDomain(ffmc.__url__)
    app.setApplicationName('FF Multi Converter')
    app.setWindowIcon(QIcon(':/ffmulticonverter.png'))

    locale = QLocale.system().name()
    qtTranslator = QTranslator()
    if qtTranslator.load('qt_' + locale, ':/'):
        app.installTranslator(qtTranslator)
    appTranslator = QTranslator()
    if appTranslator.load('ffmulticonverter_' + locale, ':/'):
        app.installTranslator(appTranslator)

    if not os.path.exists(config.log_dir):
        os.makedirs(config.log_dir)

    logging.basicConfig(
            filename=config.log_file,
            level=logging.DEBUG,
            format=config.log_format,
            datefmt=config.log_dateformat
            )

    converter = MainWindow()
    converter.show()
    app.exec_()
Example #13
0
def main():
    import sys
    import icon
    # Start the application. This does a ton of Qt setup stuff.
    the_app = QApplication(sys.argv)
    QTest.qWait(500)  # idle for half a second before doing stuff
    '''
    With the application started, set the constants that define where
    the settings file is stored and what it is called. Then open the settings.

    FYI: Locations for Qt settings values:
                    Linux: $HOME/.config/TassoSoft/Sidetone.conf
                  Mac OSX: $HOME/Library/Preferences/com.TassoSoft.Sidetone.plist
    Windows (registry): HKEY_CURRENT_USER\Software\TassoSoft\Sidetone

    '''

    the_app.setOrganizationName("TassoSoft")
    the_app.setOrganizationDomain("tassos-oak.com")
    the_app.setApplicationName("Sidetone")

    from PyQt5.QtCore import QSettings
    the_settings = QSettings()
    '''
    Uncomment the following to wipe all settings everything back to defaults.
    '''
    #the_settings.clear()

    main = MyMainWindow(the_settings)
    main.show()
    the_app.exec_()
    QTest.qWait(500)  # idle for half a second to let Python shut down
Example #14
0
def run(torrent_client):
    """
    Start the UI
    """
    app = QApplication(sys.argv)

    app.setOrganizationName("example")
    app.setOrganizationDomain("example.com")

    engine = QQmlApplicationEngine()

    context = engine.rootContext()

    ctx_manager = ContextManager(torrent_client)

    ctx_props = ctx_manager.context_props
    for prop_name in ctx_props:
        context.setContextProperty(prop_name, ctx_props[prop_name])

    qml_file = os.path.join(os.path.dirname(__file__), "views/window.qml")
    engine.load(QUrl.fromLocalFile(os.path.abspath(qml_file)))

    if not engine.rootObjects():
        sys.exit(-1)

    window = engine.rootObjects()[0]
    ctx_manager.set_window(window)

    ret = app.exec_()

    ctx_manager.clean_up()
    sys.exit(ret)
Example #15
0
def main():
    if hasattr(Qt, 'AA_EnableHighDpiScaling'):
        QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
    if hasattr(Qt, 'AA_Use96Dpi'):
        QCoreApplication.setAttribute(Qt.AA_Use96Dpi, True)
    if hasattr(Qt, 'AA_ShareOpenGLContexts'):
        QCoreApplication.setAttribute(Qt.AA_ShareOpenGLContexts, True)

    if sys.platform == 'darwin':
        QApplication.setStyle('Fusion')

    app = QApplication(sys.argv)
    app.setApplicationName('VidCutter Special HD Ver.')
    app.setApplicationVersion(MainWindow.get_version())
    app.setOrganizationDomain('ozmartians.com')
    app.setQuitOnLastWindowClosed(True)

    win = MainWindow()
    exit_code = app.exec_()
    if exit_code == MainWindow.EXIT_CODE_REBOOT:
        if sys.platform == 'win32':
            if hasattr(win.cutter, 'mpvWidget'):
                win.close()
            QProcess.startDetached('"%s"' % qApp.applicationFilePath())
        else:
            os.execl(sys.executable, sys.executable, *sys.argv)
    sys.exit(exit_code)
Example #16
0
def init_app(argv=None, gui=True):
    """
    Initialize qt runtime, deal with common issues (such as installing an
    exception handler), and return a ``QApplication`` object. If ``gui`` is
    false, return a ``QCoreApplication`` instead.
    """
    warnings.filterwarnings(
        "default", module='(madgui|cpymad|minrpc|pydicti).*')
    set_app_id('hit.madgui')
    init_stdio()
    # QApplication needs a valid argument list:
    if argv is None:
        argv = sys.argv
    if gui:
        from PyQt5.QtWidgets import QApplication
        from madgui.util.qt import load_icon_resource
        from importlib_resources import read_text
        app = QApplication(argv)
        app.setWindowIcon(load_icon_resource('madgui.data', 'icon.xpm'))
        app.setStyleSheet(read_text('madgui.data', 'style.css'))
        # matplotlib must be imported *after* Qt;
        # must be selected before importing matplotlib.backends:
        import matplotlib
        matplotlib.use('Qt5Agg')
    else:
        app = QCoreApplication(argv)
    app.setApplicationName('madgui')
    app.setApplicationVersion(__version__)
    app.setOrganizationName('HIT Betriebs GmbH')
    app.setOrganizationDomain('https://www.klinikum.uni-heidelberg.de/hit')
    # Print uncaught exceptions. This changes the default behaviour on PyQt5,
    # where an uncaught exception would usually cause the program to abort.
    sys.excepthook = traceback.print_exception
    setup_interrupt_handling(app)
    return app
Example #17
0
def start_gui():
    logger = core.logger.get_logger(__name__)
    logger.info('Qt gui starting, PyQt5 version: {}; sip version: {}'.format(
        PYQT_VERSION_STR, sip.SIP_VERSION_STR))

    sip.setdestroyonexit(False)
    ver = version.get_pyevemon_version()

    # flags are usually set BEFORE app object is created
    QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)

    app = QApplication(sys.argv)
    app.setApplicationVersion(ver['version'])
    app.setApplicationName(ver['app_name'])
    app.setApplicationDisplayName(ver['app_displayname'])
    app.setOrganizationDomain(ver['app_domain'])
    app.setOrganizationName(ver['author_name'])

    # print(app.applicationName(), app.applicationDirPath(), app.applicationPid())
    # print(app.applicationDisplayName(), app.applicationVersion())

    # do not forget to start ESI auth callback receiver
    core.esi_handler.esi_handler_start()

    mainwindow = gui_qt.mainwindow.QtEmMainWindow()
    mainwindow.show()

    return app.exec_()
Example #18
0
class MemInit(MemGui):
    def __init__(self):
        MemGui.__init__(self)
        
        self.settings=QSettings()
        
    def __del__(self):
        self.settings.sync()

    def run(self):
        self.args=self.parse_arguments()
        self.addDebugSystem(self.args.debug) #Must be before QCoreApplication
        self.app=QApplication(argv)
        self.app.setOrganizationName("caloriestracker")
        self.app.setOrganizationDomain("caloriestracker")
        self.app.setApplicationName("caloriestracker")
        self.load_translation()
                
    def load_translation(self):
        self.qtranslator=QTranslator(self.app)
        self.languages=TranslationLanguageManager()
        self.languages.load_all()
        self.languages.selected=self.languages.find_by_id(self.settings.value("frmAccess/language", "en"))
        filename=package_filename("caloriestracker", "i18n/caloriestracker_{}.qm".format(self.languages.selected.id))
        self.qtranslator.load(filename)
        info("TranslationLanguage changed to {}".format(self.languages.selected.id))
        self.app.installTranslator(self.qtranslator)

    def parse_arguments(self):
        self.parser=ArgumentParser(prog='caloriestracker_init', description=self.tr('Create a new caloriestracker database'), epilog=self.epilog(), formatter_class=RawTextHelpFormatter)
        self. addCommonToArgParse(self.parser)
        argparse_connection_arguments_group(self.parser, default_db="caloriestracker")
        args=self.parser.parse_args()
        return args
Example #19
0
def main():
    """The main() function creates the main window and starts the event loop."""
    parser = argparse.ArgumentParser(description=common.APPLICATION_NAME)
    parser.add_argument('--version',
                        action='version',
                        version=common.APPLICATION_NAME + ' v' +
                        common.VERSION)
    parser.add_argument('racefile',
                        nargs='?',
                        help='Optional racefile to load')
    args = parser.parse_args()

    QApplication.setOrganizationName(common.ORGANIZATION_NAME)
    QApplication.setOrganizationDomain(common.ORGANIZATION_DOMAIN)
    QApplication.setApplicationName(common.APPLICATION_NAME)
    QApplication.setApplicationVersion(common.VERSION)

    app = QApplication(sys.argv)

    # Set our current working directory to the documents folder. We need to do this because running
    # a pyinstaller version of this app has the current working directory as "/" (at least, on OS X)
    # which is always wrong. Therefore, always just start it off at somewhere sane and writable.
    os.chdir(common.get_documents_dir())

    main_window = TimingCatMainWindow(filename=args.racefile)
    main_window.show()

    sys.exit(app.exec_())
Example #20
0
def main():
    app = QApplication(sys.argv)
    app.setQuitOnLastWindowClosed(False)
    app.setOrganizationName('sansimera-qt')
    app.setOrganizationDomain('sansimera-qt')
    app.setApplicationName('sansimera-qt')
    prog = Sansimera()
    app.exec_()
Example #21
0
def main():
    app = QApplication(sys.argv)
    app.setOrganizationName("LRSM Ltd.")
    app.setOrganizationDomain("lrsm.eu")
    app.setApplicationName("LRSMSingleVersion")
    form = MainWindow()
    form.showMaximized()
    sys.exit(app.exec_())
Example #22
0
def main():
    app = QApplication(sys.argv)
    app.setApplicationName('VidCutter')
    app.setApplicationVersion(MainWindow.get_version())
    app.setOrganizationDomain('http://vidcutter.ozmartians.com')
    app.setQuitOnLastWindowClosed(True)
    win = MainWindow()
    sys.exit(app.exec_())
def main():
    app = QApplication(sys.argv)
    app.setOrganizationName('Sergey Ivanov')
    app.setOrganizationDomain('')
    app.setApplicationName('Musical harmony explorer')
    form = MainWindow()
    form.show()
    sys.exit(app.exec_())
Example #24
0
def main():
	if markups.__version_tuple__ < (2, ):
		sys.exit('Error: ReText needs PyMarkups 2.0 or newer to run.')

	# If we're running on Windows without a console, then discard stdout
	# and save stderr to a file to facilitate debugging in case of crashes.
	if sys.executable.endswith('pythonw.exe'):
		sys.stdout = open(devnull, 'w')
		sys.stderr = open('stderr.log', 'w')

	app = QApplication(sys.argv)
	app.setOrganizationName("ReText project")
	app.setApplicationName("ReText")
	app.setApplicationDisplayName("ReText")
	app.setApplicationVersion(app_version)
	app.setOrganizationDomain('mitya57.me')
	if hasattr(app, 'setDesktopFileName'): # available since Qt 5.7
		app.setDesktopFileName('me.mitya57.ReText.desktop')
	QNetworkProxyFactory.setUseSystemConfiguration(True)
	RtTranslator = QTranslator()
	for path in datadirs:
		if RtTranslator.load('retext_' + globalSettings.uiLanguage,
		                     join(path, 'locale')):
			break
	QtTranslator = QTranslator()
	QtTranslator.load("qtbase_" + globalSettings.uiLanguage,
		QLibraryInfo.location(QLibraryInfo.TranslationsPath))
	app.installTranslator(RtTranslator)
	app.installTranslator(QtTranslator)
	print('Using configuration file:', settings.fileName())
	if globalSettings.appStyleSheet:
		sheetfile = QFile(globalSettings.appStyleSheet)
		sheetfile.open(QIODevice.ReadOnly)
		app.setStyleSheet(QTextStream(sheetfile).readAll())
		sheetfile.close()
	window = ReTextWindow()
	window.show()
	# ReText can change directory when loading files, so we
	# need to have a list of canonical names before loading
	fileNames = list(map(canonicalize, sys.argv[1:]))
	previewMode = False
	for fileName in fileNames:
		if QFile.exists(fileName):
			window.openFileWrapper(fileName)
			if previewMode:
				window.actionPreview.setChecked(True)
				window.preview(True)
		elif fileName == '--preview':
			previewMode = True
	if globalSettings.openLastFilesOnStartup:
		window.restoreLastOpenedFiles()

	inputData = '' if (sys.stdin is None or sys.stdin.isatty()) else sys.stdin.read()
	if inputData or not window.tabWidget.count():
		window.createNew(inputData)
	signal.signal(signal.SIGINT, lambda sig, frame: window.close())
	sys.exit(app.exec())
Example #25
0
def main():
	app = QApplication(sys.argv)
	app.setOrganizationName("Knorr-Bremse Technology Center India, Pune")
	app.setOrganizationDomain("https://www.knorr-bremse.co.in/en/group/kbinindia/tci/tci_1.jsp")
	app.setApplicationName("EnSeGi Library GUI")
	# app.setWindowIcon(QIcon(":/icon.png"))
	form = MainWindow()
	form.show()
	sys.exit(app.exec())
Example #26
0
def main():
    app = QApplication(sys.argv)
    app.setStyle(OverrideStyle())
    app.setApplicationName(FixedSettings.applicationName)
    app.setOrganizationDomain(FixedSettings.organizationDomain)
    app.setApplicationVersion(FixedSettings.applicationVersion)
    app.setQuitOnLastWindowClosed(True)
    tvlinker = TVLinker(FixedSettings.get_app_settings())
    sys.exit(app.exec_())
Example #27
0
def main(measurements=None):
    parser = _cmd_line_parser()
    args = parser.parse_args(sys.argv[1:])
    app = QApplication(sys.argv)
    app.setOrganizationName("py-asammdf")
    app.setOrganizationDomain("py-asammdf")
    app.setApplicationName("py-asammdf")
    main = MainWindow(args.measurements)
    app.exec_()
Example #28
0
def app():
    app = QApplication(sys.argv)
    app.setApplicationName('CuriElements')
    app.setApplicationDisplayName('CuriElements')
    app.setOrganizationName('CodeHuntersLab')
    app.setOrganizationDomain('CodeHuntersLab.com')
    app.setApplicationVersion('1.0')
    w = CuriWidget()
    w.show()
    sys.exit(app.exec_())
Example #29
0
def main():
    app = QApplication(sys.argv)
    app.setOrganizationName("Qtrac Ltd.")
    app.setOrganizationDomain("qtrac.eu")
    app.setApplicationName("Image Editor")
    app.setWindowIcon(QIcon(":/icon.png"))
    
    form = MainWindow()
    form.show()
    app.exec_()
Example #30
0
def instantiate():
    """Instantiate the global QApplication object."""
    global qApp
    args = list(map(os.fsencode, [os.path.abspath(sys.argv[0])] + sys.argv[1:]))
    qApp = QApplication(args)
    QApplication.setApplicationName(appinfo.name)
    QApplication.setApplicationVersion(appinfo.version)
    QApplication.setOrganizationName(appinfo.name)
    QApplication.setOrganizationDomain(appinfo.domain)
    appInstantiated()
Example #31
0
def main():
    app = QApplication(sys.argv)
    app.setApplicationName("Visinum-Metadata")
    app.setOrganizationName("Qwilka")
    app.setOrganizationDomain("qwilka.github.io")
    app.setStyle("fusion")  
    mainwindow = MainWindow()
    ##app.mainwindow = mainwindow
    mainwindow.show()
    sys.exit(app.exec_())   # app.exec_()
Example #32
0
def make_app():
    global app, settings
    app = QApplication(sys.argv)
    app.setOrganizationName("PGDP")
    app.setOrganizationDomain("pgdp.net")
    app.setApplicationName("PPQT2")
    settings = QSettings()
    settings.clear()
    settings.setValue("paths/dicts_path", path_to_Files)
    settings.setValue("dictionaries/default_tag", "en_US")
    settings.setValue("mainwindow/position", QPoint(50, 50))
Example #33
0
def make_app():
    global app, settings
    app = QApplication(sys.argv)
    app.setOrganizationName("PGDP")
    app.setOrganizationDomain("pgdp.net")
    app.setApplicationName("PPQT2")
    settings = QSettings()
    settings.clear()
    settings.setValue("paths/dicts_path",path_to_Files)
    settings.setValue("dictionaries/default_tag","en_US")
    settings.setValue("mainwindow/position",QPoint(50,50))
Example #34
0
def main(argv=None):

    from PyQt5.QtWidgets import QApplication
    from PyQt5.QtGui import QIcon
    from PyQt5.QtCore import QSize

    from pyboat.ui import start_menu

    # --- initialize the Qt App ---

    # args get not parsed inside Qt app
    app = QApplication(sys.argv)

    # add an application icon
    abs_path = os.path.dirname(os.path.realpath(__file__))
    icon_path = os.path.join(abs_path, 'logo_circ128x128.png')
    icon = QIcon()
    icon.addFile(icon_path, QSize(128, 128))
    app.setWindowIcon(icon)

    # needed for QSettings
    app.setOrganizationName("tensionhead")
    app.setOrganizationDomain("https://github.com/tensionhead")
    app.setApplicationName("pyBOAT")

    # -- parse command line arguments ---

    parser = argparse.ArgumentParser()
    parser.add_argument('--debug', action='store_true')
    parser.add_argument('--version',
                        action='version',
                        version='pyBOAT ' + __version__)
    args = parser.parse_args(argv)

    debug = args.debug

    if debug:
        print('''
            ---------------
            DEBUG enabled!!
            ---------------
            ''')

        screen = app.primaryScreen()
        print('Screen: %s' % screen.name())
        size = screen.size()
        print('Size: %d x %d' % (size.width(), size.height()))
        rect = screen.availableGeometry()
        print('Available: %d x %d' % (rect.width(), rect.height()))

    # this starts up the Program
    window = start_menu.MainWindow(debug)

    return app.exec()
Example #35
0
def main():
	if markups.__version_tuple__ < (2, ):
		sys.exit('Error: ReText needs PyMarkups 2.0 or newer to run.')

	# If we're running on Windows without a console, then discard stdout
	# and save stderr to a file to facilitate debugging in case of crashes.
	if sys.executable.endswith('pythonw.exe'):
		sys.stdout = open(devnull, 'w')
		sys.stderr = open('stderr.log', 'w')

	app = QApplication(sys.argv)
	app.setOrganizationName("ReText project")
	app.setApplicationName("ReText")
	app.setApplicationDisplayName("ReText")
	app.setApplicationVersion(app_version)
	app.setOrganizationDomain('mitya57.me')
	if hasattr(app, 'setDesktopFileName'): # available since Qt 5.7
		app.setDesktopFileName('me.mitya57.ReText.desktop')
	QNetworkProxyFactory.setUseSystemConfiguration(True)
	RtTranslator = QTranslator()
	for path in datadirs:
		if RtTranslator.load('retext_' + globalSettings.uiLanguage,
		                     join(path, 'locale')):
			break
	QtTranslator = QTranslator()
	QtTranslator.load("qt_" + globalSettings.uiLanguage,
		QLibraryInfo.location(QLibraryInfo.TranslationsPath))
	app.installTranslator(RtTranslator)
	app.installTranslator(QtTranslator)
	print('Using configuration file:', settings.fileName())
	if globalSettings.appStyleSheet:
		sheetfile = QFile(globalSettings.appStyleSheet)
		sheetfile.open(QIODevice.ReadOnly)
		app.setStyleSheet(QTextStream(sheetfile).readAll())
		sheetfile.close()
	window = ReTextWindow()
	window.show()
	# ReText can change directory when loading files, so we
	# need to have a list of canonical names before loading
	fileNames = list(map(canonicalize, sys.argv[1:]))
	previewMode = False
	for fileName in fileNames:
		if QFile.exists(fileName):
			window.openFileWrapper(fileName)
			if previewMode:
				window.actionPreview.setChecked(True)
				window.preview(True)
		elif fileName == '--preview':
			previewMode = True
	inputData = '' if (sys.stdin is None or sys.stdin.isatty()) else sys.stdin.read()
	if inputData or not window.tabWidget.count():
		window.createNew(inputData)
	signal.signal(signal.SIGINT, lambda sig, frame: window.close())
	sys.exit(app.exec())
Example #36
0
def instantiate():
    """Instantiate the global QApplication object."""
    global qApp
    args = list(map(os.fsencode,
                    [os.path.abspath(sys.argv[0])] + sys.argv[1:]))
    qApp = QApplication(args)
    QApplication.setApplicationName(appinfo.name)
    QApplication.setApplicationVersion(appinfo.version)
    QApplication.setOrganizationName(appinfo.name)
    QApplication.setOrganizationDomain(appinfo.domain)
    appInstantiated()
Example #37
0
def main():
    app = QApplication(sys.argv)
    app.setQuitOnLastWindowClosed(False)
    app.setOrganizationName('meteo-qt')
    app.setOrganizationDomain('meteo-qt')
    app.setApplicationName('meteo-qt')
    app.setWindowIcon(QIcon(':/logo'))
    filePath = os.path.dirname(os.path.realpath(__file__))
    settings = QSettings()
    locale = settings.value('Language')
    if locale is None or locale == '':
        locale = QLocale.system().name()
    appTranslator = QTranslator()
    if os.path.exists(filePath + '/translations/'):
        appTranslator.load(filePath + "/translations/meteo-qt_" + locale)
    else:
        appTranslator.load("/usr/share/meteo_qt/translations/meteo-qt_" +
                           locale)
    app.installTranslator(appTranslator)
    qtTranslator = QTranslator()
    qtTranslator.load("qt_" + locale,
                      QLibraryInfo.location(QLibraryInfo.TranslationsPath))
    app.installTranslator(qtTranslator)

    log_level = settings.value('Logging/Level')
    if log_level == '' or log_level is None:
        log_level = 'INFO'
        settings.setValue('Logging/Level', 'INFO')

    log_filename = os.path.dirname(settings.fileName())
    if not os.path.exists(log_filename):
        os.makedirs(log_filename)
    log_filename = log_filename + '/meteo-qt.log'

    logging.basicConfig(
        format='%(asctime)s %(levelname)s: %(message)s - %(module)s - %(name)s',
        datefmt='%m/%d/%Y %H:%M:%S',
        filename=log_filename,
        level=log_level)
    logger = logging.getLogger('meteo-qt')
    logger.setLevel(log_level)
    handler = logging.handlers.RotatingFileHandler(log_filename,
                                                   maxBytes=20,
                                                   backupCount=5)
    logger1 = logging.getLogger()
    handler1 = logging.StreamHandler()
    logger1Formatter = logging.Formatter(
        '%(levelname)s: %(message)s - %(module)s')
    handler1.setFormatter(logger1Formatter)
    logger.addHandler(handler)
    logger1.addHandler(handler1)

    m = SystemTrayIcon()
    app.exec_()
Example #38
0
def do_main(args):

    # initialize
    QApplication.setOrganizationName(APP_VENDOR)
    QApplication.setOrganizationDomain(APP_HOME_URL)
    QApplication.setApplicationName(APP_NAME)

    # initialize
    globals.base_dir, app_name = os.path.split(
        os.path.abspath(
            sys.executable if hasattr(sys, "frozen") else __file__))
    globals.app_name = os.path.splitext(app_name)[0]

    # parse the command-line arguments
    settings_fname = None
    db_fname = None
    opts, args = getopt.getopt(args[1:], "c:d:h?", ["config=", "db=", "help"])
    for opt, val in opts:
        if opt in ["-c", "--config"]:
            settings_fname = val
        elif opt in ["-d", "--db"]:
            db_fname = val
        elif opt in ["-h", "--help", "-?"]:
            print_help()
        else:
            raise RuntimeError("Unknown argument: {}".format(opt))
    if not settings_fname:
        # try to locate the settings file
        fname = globals.app_name + ".ini" if sys.platform == "win32" else "." + globals.app_name
        settings_fname = os.path.join(globals.base_dir, fname)
        if not os.path.isfile(settings_fname):
            settings_fname = os.path.join(QDir.homePath(), fname)
    if not db_fname:
        # use the default location
        db_fname = os.path.join(globals.base_dir, globals.app_name + ".db")

    # load our settings
    globals.app_settings = QSettings(settings_fname, QSettings.IniFormat)
    fname = os.path.join(os.path.split(settings_fname)[0], "debug.ini")
    globals.debug_settings = QSettings(fname, QSettings.IniFormat)

    # initialize
    natinfo.load(os.path.join(globals.base_dir, "asl_cards/natinfo"))

    # do main processing
    app = QApplication(sys.argv)
    from main_window import MainWindow
    main_window = MainWindow(db_fname)
    main_window.show()
    if os.path.isfile(db_fname):
        main_window.start_main_app(db_fname)
    return app.exec_()
def main():
    """Main Loop."""
    print(__doc__ + __version__ + __url__)
    application = QApplication(sys.argv)
    application.setApplicationName("pyvoicechanger")
    application.setOrganizationName("pyvoicechanger")
    application.setOrganizationDomain("pyvoicechanger")
    application.setWindowIcon(QIcon.fromTheme("audio-input-microphone"))
    application.aboutToQuit.connect(
        lambda: call('killall rec ; killall play', shell=True))
    mainwindow = MainWindow()
    mainwindow.show()
    sys.exit(application.exec_())
Example #40
0
def instantiate():
    """Instantiate the global QApplication object."""
    global qApp
    args = [os.path.abspath(sys.argv[0])] + sys.argv[1:]
    ### on Python3, QApplication args must be byte strings
    if sys.version_info >= (3, 0):
        args = list(map(os.fsencode, args))
    qApp = QApplication(args)
    QApplication.setApplicationName(appinfo.name)
    QApplication.setApplicationVersion(appinfo.version)
    QApplication.setOrganizationName(appinfo.name)
    QApplication.setOrganizationDomain(appinfo.domain)
    appInstantiated()
Example #41
0
def main():
    app = QApplication(sys.argv)
    app.setQuitOnLastWindowClosed(False)
    app.setOrganizationName('meteo-qt')
    app.setOrganizationDomain('meteo-qt')
    app.setApplicationName('meteo-qt')
    app.setWindowIcon(QIcon(':/logo'))
    filePath = os.path.dirname(os.path.realpath(__file__))
    settings = QSettings()
    locale = settings.value('Language')
    if locale is None or locale == '':
        locale = QLocale.system().name()
    appTranslator = QTranslator()
    if os.path.exists(filePath + '/translations/'):
        appTranslator.load(filePath + "/translations/meteo-qt_" + locale)
    else:
        appTranslator.load("/usr/share/meteo_qt/translations/meteo-qt_" +
                           locale)
    app.installTranslator(appTranslator)
    qtTranslator = QTranslator()
    qtTranslator.load("qt_" + locale,
                      QLibraryInfo.location(QLibraryInfo.TranslationsPath))
    app.installTranslator(qtTranslator)

    log_level = settings.value('Logging/Level')
    if log_level == '' or log_level is None:
        log_level = 'INFO'
        settings.setValue('Logging/Level', 'INFO')

    log_filename = os.path.dirname(settings.fileName())
    if not os.path.exists(log_filename):
        os.makedirs(log_filename)
    log_filename = log_filename + '/meteo-qt.log'

    logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s - %(module)s - %(name)s',
                        datefmt='%m/%d/%Y %H:%M:%S',
                        filename=log_filename, level=log_level)
    logger = logging.getLogger('meteo-qt')
    logger.setLevel(log_level)
    handler = logging.handlers.RotatingFileHandler(
        log_filename, maxBytes=20, backupCount=5)
    logger1 = logging.getLogger()
    handler1 = logging.StreamHandler()
    logger1Formatter = logging.Formatter('%(levelname)s: %(message)s - %(module)s')
    handler1.setFormatter(logger1Formatter)
    logger.addHandler(handler)
    logger1.addHandler(handler1)

    m = SystemTrayIcon()
    app.exec_()
Example #42
0
def main():
    logging.basicConfig(filename='log.txt',
                        level=logging.DEBUG,
                        filemode='w')

    # Redirect stdout and stderr to our logging file
    stdout_logger = logging.getLogger('STDOUT')
    stderr_logger = logging.getLogger('STDERR')
    sys.stdout = StreamToLogger(stdout_logger, logging.INFO)
    sys.stderr = StreamToLogger(stderr_logger, logging.ERROR)

    logging.info('Started ICE Control v' + __version__)

    app = QApplication(sys.argv)

    app_name = 'ICE Control'
    app.setOrganizationName("Vescent Photonics, Inc.")
    app.setOrganizationDomain("www.vescent.com")
    app.setApplicationName(app_name)
    app.setWindowIcon(QIcon("ui/vescent.ico"))

    view = QtQuick.QQuickView()

    if getattr(sys, 'frozen', False):
        # we are running in a |PyInstaller| bundle
        basedir = sys._MEIPASS
    else:
        # we are running in a normal Python environment
        basedir = os.path.dirname(os.path.abspath(__file__))

    view.setTitle(app_name)
    context = view.rootContext()

    pyconsole = PyConsole(__version__)
    context.setContextProperty('python', pyconsole)

    ice = iceController()
    context.setContextProperty('ice', ice)

    view.setSource(QUrl("ui/main.qml"))
    view.engine().quit.connect(app.quit)
    view.show()

    app.exec_()

    #Cleanup: Manually delete QQuickView to prevent app crash
    del view
    ice.iceRef.disconnect()
    sys.exit(0)
Example #43
0
def main():
    app = QApplication(sys.argv)
    if sys.platform == "win32":
        app.setFont(QFont("Tahoma", 9))
    app.setOrganizationName("Besteam")
    app.setOrganizationDomain("besteam.im")
    app.setApplicationName("QuickPanel")
    app.setQuitOnLastWindowClosed(False)
    app.setWindowIcon(QIcon(":/images/angelfish.png"))
    #app.setStyle(QStyleFactory.create("qtcurve"))
    platform = Platform()
    platform.start()
    try:
        getattr(app, "exec")()
    except AttributeError:
        getattr(app, "exec_")()
Example #44
0
def run():
    app = QApplication(sys.argv)
    app.setOrganizationName("manuskript")
    app.setOrganizationDomain("www.theologeek.ch")
    app.setApplicationName("manuskript")
    app.setApplicationVersion(_version)

    icon = QIcon()
    for i in [16, 31, 64, 128, 256, 512]:
        icon.addFile(appPath("icons/Manuskript/icon-{}px.png".format(i)))
    qApp.setWindowIcon(icon)

    app.setStyle("Fusion")

    # Load style from QSettings
    settings = QSettings(app.organizationName(), app.applicationName())
    if settings.contains("applicationStyle"):
        style = settings.value("applicationStyle")
        app.setStyle(style)

    # Translation process
    locale = QLocale.system().name()

    appTranslator = QTranslator()
    # By default: locale
    translation = appPath(os.path.join("i18n", "manuskript_{}.qm".format(locale)))

    # Load translation from settings
    if settings.contains("applicationTranslation"):
        translation = appPath(os.path.join("i18n", settings.value("applicationTranslation")))
        print("Found translation in settings:", translation)

    if appTranslator.load(translation):
        app.installTranslator(appTranslator)
        print(app.tr("Loaded translation: {}.").format(translation))

    else:
        print(app.tr("Warning: failed to load translator for locale {}...").format(locale))

    QIcon.setThemeSearchPaths(QIcon.themeSearchPaths() + [appPath("icons")])
    QIcon.setThemeName("NumixMsk")
    # qApp.setWindowIcon(QIcon.fromTheme("im-aim"))

    # Seperating launch to avoid segfault, so it seem.
    # Cf. http://stackoverflow.com/questions/12433491/is-this-pyqt-4-python-bug-or-wrongly-behaving-code
    launch()
Example #45
0
def main():
    app = QApplication(sys.argv)
    app.setOrganizationName("University of Oldenburg")
    app.setOrganizationDomain("www.uni-oldenburg.de")
    app.setApplicationName("OptiSim")
    app.setWindowIcon(QIcon(":/OS_logo.png"))
    
    # Create and display the splash screen
    #splash_pix = QPixmap(":/OS_logo.png")
    #splash = QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint)
    #splash.setMask(splash_pix.mask())
    #splash.show()
    #app.processEvents()
    
    wnd = MainWindow()
    wnd.show()
    #splash.finish(wnd)
    sys.exit(app.exec_())
Example #46
0
def main():
	app = QApplication(sys.argv)
	app.setOrganizationName("ReText project")
	app.setApplicationName("ReText")
	app.setApplicationDisplayName("ReText")
	app.setApplicationVersion(app_version)
	app.setOrganizationDomain('mitya57.me')
	if hasattr(app, 'setDesktopFileName'): # available since Qt 5.7
		app.setDesktopFileName('me.mitya57.ReText.desktop')
	QNetworkProxyFactory.setUseSystemConfiguration(True)
	RtTranslator = QTranslator()
	for path in datadirs:
		if RtTranslator.load('retext_' + globalSettings.uiLanguage,
		                     join(path, 'locale')):
			break
	QtTranslator = QTranslator()
	QtTranslator.load("qt_" + globalSettings.uiLanguage,
		QLibraryInfo.location(QLibraryInfo.TranslationsPath))
	app.installTranslator(RtTranslator)
	app.installTranslator(QtTranslator)
	if globalSettings.appStyleSheet:
		sheetfile = QFile(globalSettings.appStyleSheet)
		sheetfile.open(QIODevice.ReadOnly)
		app.setStyleSheet(QTextStream(sheetfile).readAll())
		sheetfile.close()
	window = ReTextWindow()
	window.show()
	# ReText can change directory when loading files, so we
	# need to have a list of canonical names before loading
	fileNames = list(map(canonicalize, sys.argv[1:]))
	previewMode = False
	for fileName in fileNames:
		if QFile.exists(fileName):
			window.openFileWrapper(fileName)
			if previewMode:
				window.actionPreview.trigger()
		elif fileName == '--preview':
			previewMode = True
	if sys.stdin:
		inputData = '' if sys.stdin.isatty() else sys.stdin.read()
		if inputData or not window.tabWidget.count():
			window.createNew(inputData)
	signal.signal(signal.SIGINT, lambda sig, frame: window.close())
	sys.exit(app.exec())
Example #47
0
def main(args=sys.argv):
    make_logger("unicodemoticon", emoji=True)
    lock = set_single_instance("unicodemoticon")
    check_encoding()
    set_process_name("unicodemoticon")
    set_process_priority()
    app = QApplication(args)
    app.setApplicationName("unicodemoticon")
    app.setOrganizationName("unicodemoticon")
    app.setOrganizationDomain("unicodemoticon")
    app.instance().setQuitOnLastWindowClosed(False)  # no quit on dialog quit
    if qdarkstyle:
            app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
    icon = QIcon(app.style().standardPixmap(QStyle.SP_FileIcon))
    app.setWindowIcon(icon)
    mainwindow = MainWidget()
    mainwindow.show()
    mainwindow.hide()
    make_post_exec_msg(start_time)
    sys.exit(app.exec())
Example #48
0
def main():
    """Main Loop."""
    log_file_path = os.path.join(gettempdir(), "vacap.log")
    log.basicConfig(level=-1, filemode="w", filename=log_file_path,
                    format="%(levelname)s:%(asctime)s %(message)s %(lineno)s")
    log.getLogger().addHandler(log.StreamHandler(sys.stderr))
    log.info(__doc__)
    log.debug("LOG File: '{}'.".format(log_file_path))
    log.debug("Free Space on Disk: ~{} GigaBytes.".format(
        get_free_space_on_disk_on_gb(os.path.expanduser("~"))))
    log.debug("Running on Battery: {}".format(windows_is_running_on_battery()))
    signal.signal(signal.SIGINT, signal.SIG_DFL)  # CTRL+C work to quit app
    app = QApplication(sys.argv)
    app.setApplicationName("vacap")
    app.setOrganizationName("vacap")
    app.setOrganizationDomain("vacap")
    icon = QIcon(app.style().standardPixmap(QStyle.SP_DriveFDIcon))
    app.setWindowIcon(icon)
    win = MainWindow(icon)
    win.show()
    sys.exit(app.exec_())
Example #49
0
def main(d):
    """Main Loop."""
    make_root_check_and_encoding_debug()
    set_process_name_and_cpu_priority("websktop")
    set_single_instance("websktop")
    signal.signal(signal.SIGINT, signal.SIG_DFL)  # CTRL+C work to quit app
    app = QApplication(sys.argv)
    app.setApplicationName("websktop")
    app.setOrganizationName("websktop")
    app.setOrganizationDomain("websktop")
    # app.instance().setQuitOnLastWindowClosed(False)  # no quit on dialog quit
    icon = QIcon(app.style().standardPixmap(QStyle.SP_FileIcon))
    app.setWindowIcon(icon)
    window = MainWindow()
    window.show()
    importd_thread = DThread(app, d)
    importd_thread.finished.connect(app.exit)  # if ImportD Quits then Quit GUI
    app.aboutToQuit.connect(importd_thread.exit)  # UI Quits then Quit ImportD
    importd_thread.start()
    make_post_execution_message()
    sys.exit(app.exec())
Example #50
0
def start():
	app = QApplication(sys.argv)
	app.setOrganizationName(globals.ORGANIZATION_NAME)
	app.setOrganizationDomain(globals.ORGANIZATION_DOMAIN)
	app.setApplicationName(globals.APPLICATION_NAME)

	if isMacintoshComputer():
		# add /opt/local/bin to PATH to find pdflatex binary -- useful for Mac plateform using Macports
		os.environ['PATH'] = os.environ.get('PATH', '/usr/bin') + ':/opt/local/bin'
		app.setQuitOnLastWindowClosed(False)

	app_controller = ControllerFactory.createAppController()

	args = app.arguments()[1:]
	if len(args) > 0:
		for file_path in args:
			app_controller.open(file_path)
	else:
		app_controller.new()

	app.exec_()
	app_controller.quit()
Example #51
0
def main(argv):
    # Avoid performance issues with X11 engine when rendering objects
    if sys.platform == 'linux':
        QApplication.setGraphicsSystem("raster")

    a = QApplication(argv)
    a.setOrganizationDomain("mapeditor.org")
    a.setApplicationName("TmxViewer")
    a.setApplicationVersion("1.0")
    options = CommandLineOptions()
    parseCommandLineArguments(options)
    if (options.showVersion):
        showVersion()
    if (options.showHelp or (options.fileToOpen=='' and not options.showVersion)):
        showHelp()
    if (options.showVersion
            or options.showHelp
            or options.fileToOpen==''):
        return 0
    w = TmxViewer()
    if (not w.viewMap(options.fileToOpen)):
        return 1
    w.show()
    return a.exec()
Example #52
0
    x = log_stream.seek(0)
    x = log_stream.truncate()
    return (-1 < log_data.find(text)) & (-1 < log_data.find(level_dict[level]))
# add .. dir to sys.path so we can import ppqt modules which
# are up one directory level
import sys
import os
my_path = os.path.realpath(__file__)
test_path = os.path.dirname(my_path)
files_path = os.path.join(test_path,'Files')
ppqt_path = os.path.dirname(test_path)
sys.path.append(ppqt_path)
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv)
app.setOrganizationName("PGDP")
app.setOrganizationDomain("pgdp.net")
app.setApplicationName("PPQT2")
from PyQt5.QtCore import QSettings
settings = QSettings()
import constants as C
import colors
from PyQt5.QtGui import (QColor,QBrush, QTextCharFormat)

# check initialize
# check defaults on empty settings

settings.clear()
colors.initialize(settings)
colors.shutdown(settings)
assert settings.value('colors/spell_color') == '#ff00ff' # == magenta
assert settings.value('colors/spell_style') == QTextCharFormat.WaveUnderline
Example #53
0
def start(test=False):

	if os.name == 'posix':
		main_path = os.path.dirname(os.path.realpath(__file__))
		log_path = os.path.join(main_path, 'happypanda.log')
		debug_log_path = os.path.join(main_path, 'happypanda_debug.log')
	else:
		log_path = 'happypanda.log'
		debug_log_path = 'happypanda_debug.log'

	parser = argparse.ArgumentParser(prog='Happypanda',
								  description='A manga/doujinshi manager with tagging support')
	parser.add_argument('-d', '--debug', action='store_true',
					 help='happypanda_debug_log.log will be created in main directory')
	parser.add_argument('-t', '--test', action='store_true',
					 help='Run happypanda in test mode. 5000 gallery will be preadded in DB.')
	parser.add_argument('-v', '--versi on', action='version',
					 version='Happypanda v{}'.format(gui_constants.vs))
	parser.add_argument('-e', '--exceptions', action='store_true',
					 help='Disable custom excepthook')

	args = parser.parse_args()
	if args.debug:
		print("happypanda_debug.log created at {}".format(os.getcwd()))
		# create log
		try:
			with open(debug_log_path, 'x') as f:
				pass
		except FileExistsError:
			pass

		logging.basicConfig(level=logging.DEBUG,
						format='%(asctime)-8s %(levelname)-6s %(name)-6s %(message)s',
						datefmt='%d-%m %H:%M',
						filename='happypanda_debug.log',
						filemode='w')
		gui_constants.DEBUG = True
	else:
		try:
			with open(log_path, 'x') as f:
				pass
		except FileExistsError: pass
		file_handler = logging.handlers.RotatingFileHandler(
			log_path, maxBytes=1000000*10, encoding='utf-8', backupCount=2)
		logging.basicConfig(level=logging.INFO,
						format='%(asctime)-8s %(levelname)-6s %(name)-6s %(message)s',
						datefmt='%d-%m %H:%M',
						handlers=(file_handler,))


	log = logging.getLogger(__name__)
	log_i = log.info
	log_d = log.debug
	log_w = log.warning
	log_e = log.error
	log_c = log.critical

	if not args.exceptions:
		def uncaught_exceptions(ex_type, ex, tb):
			log_c(''.join(traceback.format_tb(tb)))
			log_c('{}: {}'.format(ex_type, ex))
			traceback.print_exception(ex_type, ex, tb)

		sys.excepthook = uncaught_exceptions

	application = QApplication(sys.argv)
	application.setOrganizationName('Pewpews')
	application.setOrganizationDomain('https://github.com/Pewpews/happypanda')
	application.setApplicationName('Happypanda')
	application.setApplicationDisplayName('Happypanda')
	application.setApplicationVersion('v{}'.format(gui_constants.vs))
	log_i('Happypanda Version {}'.format(gui_constants.vs))
	log_i('OS: {} {}\n'.format(platform.system(), platform.release()))
	try:
		if args.test:
			conn = db.init_db(True)
		else:
			conn = db.init_db()
		log_d('Init DB Conn: OK')
		log_i("DB Version: {}".format(db_constants.REAL_DB_VERSION))
	except:
		log_c('Invalid database')
		log.exception('Database connection failed!')
		from PyQt5.QtGui import QIcon
		from PyQt5.QtWidgets import QMessageBox
		msg_box = QMessageBox()
		msg_box.setWindowIcon(QIcon(gui_constants.APP_ICO_PATH))
		msg_box.setText('Invalid database')
		msg_box.setInformativeText("Do you want to create a new database?")
		msg_box.setIcon(QMessageBox.Critical)
		msg_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
		msg_box.setDefaultButton(QMessageBox.Yes)
		if msg_box.exec() == QMessageBox.Yes:
			pass
		else:
			application.exit()
			log_d('Normal Exit App: OK')
			sys.exit()

	def start_main_window(conn):
		DB = db.DBThread(conn)
		#if args.test:
		#	import threading, time
		#	ser_list = []
		#	for x in range(5000):
		#		s = gallerydb.gallery()
		#		s.profile = gui_constants.NO_IMAGE_PATH
		#		s.title = 'Test {}'.format(x)
		#		s.artist = 'Author {}'.format(x)
		#		s.path = gui_constants.static_dir
		#		s.type = 'Test'
		#		s.chapters = {0:gui_constants.static_dir}
		#		s.language = 'English'
		#		s.info = 'I am number {}'.format(x)
		#		ser_list.append(s)

		#	done = False
		#	thread_list = []
		#	i = 0
		#	while not done:
		#		try:
		#			if threading.active_count() > 5000:
		#				thread_list = []
		#				done = True
		#			else:
		#				thread_list.append(
		#					threading.Thread(target=gallerydb.galleryDB.add_gallery,
		#					  args=(ser_list[i],)))
		#				thread_list[i].start()
		#				i += 1
		#				print(i)
		#				print('Threads running: {}'.format(threading.activeCount()))
		#		except IndexError:
		#			done = True

		WINDOW = app.AppWindow()

		# styling
		d_style = gui_constants.default_stylesheet_path
		u_style =  gui_constants.user_stylesheet_path

		if len(u_style) is not 0:
			try:
				style_file = QFile(u_style)
				log_i('Select userstyle: OK')
			except:
				style_file = QFile(d_style)
				log_i('Select defaultstyle: OK')
		else:
			style_file = QFile(d_style)
			log_i('Select defaultstyle: OK')

		style_file.open(QFile.ReadOnly)
		style = str(style_file.readAll(), 'utf-8')
		application.setStyleSheet(style)
		try:
			os.mkdir(gui_constants.temp_dir)
		except FileExistsError:
			try:
				for root, dirs, files in scandir.walk('temp', topdown=False):
					for name in files:
						os.remove(os.path.join(root, name))
					for name in dirs:
						os.rmdir(os.path.join(root, name))
			except:
				log_i('Empty temp: FAIL')
		log_d('Create temp: OK')

		if test:
			return application, WINDOW

		sys.exit(application.exec_())

	def db_upgrade():
		log_d('Database connection failed')
		from PyQt5.QtGui import QIcon
		from PyQt5.QtWidgets import QMessageBox

		msg_box = QMessageBox()
		msg_box.setWindowIcon(QIcon(gui_constants.APP_ICO_PATH))
		msg_box.setText('Incompatible database!')
		msg_box.setInformativeText("Do you want to upgrade to newest version?" +
							 " It shouldn't take more than a second. Don't start a new instance!")
		msg_box.setIcon(QMessageBox.Critical)
		msg_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
		msg_box.setDefaultButton(QMessageBox.Yes)
		if msg_box.exec() == QMessageBox.Yes:

			import threading
			db_p = db_constants.DB_PATH
			threading.Thread(target=db.add_db_revisions,
					args=(db_p,)).start()
			done = None
			while not done:
				done = db.ResultQueue.get()
			conn = db.init_db()
			start_main_window(conn)
		else:
			application.exit()
			log_d('Normal Exit App: OK')
			sys.exit()

	if conn:
		start_main_window(conn)
	else:
		db_upgrade()
Example #54
0
def start(test=False):
    app_constants.APP_RESTART_CODE = -123456789

    if os.name == "posix":
        main_path = os.path.dirname(os.path.realpath(__file__))
        log_path = os.path.join(main_path, "happypanda.log")
        debug_log_path = os.path.join(main_path, "happypanda_debug.log")
    else:
        log_path = "happypanda.log"
        debug_log_path = "happypanda_debug.log"

    parser = argparse.ArgumentParser(prog="Happypanda", description="A manga/doujinshi manager with tagging support")
    parser.add_argument(
        "-d", "--debug", action="store_true", help="happypanda_debug_log.log will be created in main directory"
    )
    parser.add_argument(
        "-t", "--test", action="store_true", help="Run happypanda in test mode. 5000 gallery will be preadded in DB."
    )
    parser.add_argument("-v", "--version", action="version", version="Happypanda v{}".format(app_constants.vs))
    parser.add_argument("-e", "--exceptions", action="store_true", help="Disable custom excepthook")

    args = parser.parse_args()
    if args.debug:
        print("happypanda_debug.log created at {}".format(os.getcwd()))
        # create log
        try:
            with open(debug_log_path, "x") as f:
                pass
        except FileExistsError:
            pass

        logging.basicConfig(
            level=logging.DEBUG,
            format="%(asctime)-8s %(levelname)-6s %(name)-6s %(message)s",
            datefmt="%d-%m %H:%M",
            filename="happypanda_debug.log",
            filemode="w",
        )
        app_constants.DEBUG = True
    else:
        try:
            with open(log_path, "x") as f:
                pass
        except FileExistsError:
            pass
        file_handler = logging.handlers.RotatingFileHandler(
            log_path, maxBytes=1000000 * 10, encoding="utf-8", backupCount=2
        )
        logging.basicConfig(
            level=logging.INFO,
            format="%(asctime)-8s %(levelname)-6s %(name)-6s %(message)s",
            datefmt="%d-%m %H:%M",
            handlers=(file_handler,),
        )

    log = logging.getLogger(__name__)
    log_i = log.info
    log_d = log.debug
    log_w = log.warning
    log_e = log.error
    log_c = log.critical

    if not args.exceptions:

        def uncaught_exceptions(ex_type, ex, tb):
            log_c("".join(traceback.format_tb(tb)))
            log_c("{}: {}".format(ex_type, ex))
            traceback.print_exception(ex_type, ex, tb)

        sys.excepthook = uncaught_exceptions

    application = QApplication(sys.argv)
    application.setOrganizationName("Pewpews")
    application.setOrganizationDomain("https://github.com/Pewpews/happypanda")
    application.setApplicationName("Happypanda")
    application.setApplicationDisplayName("Happypanda")
    application.setApplicationVersion("v{}".format(app_constants.vs))
    log_i("Happypanda Version {}".format(app_constants.vs))
    log_i("OS: {} {}\n".format(platform.system(), platform.release()))
    conn = None
    try:
        if args.test:
            conn = db.init_db(True)
        else:
            conn = db.init_db()
        log_d("Init DB Conn: OK")
        log_i("DB Version: {}".format(db_constants.REAL_DB_VERSION))
    except:
        log_c("Invalid database")
        log.exception("Database connection failed!")
        from PyQt5.QtGui import QIcon
        from PyQt5.QtWidgets import QMessageBox

        msg_box = QMessageBox()
        msg_box.setWindowIcon(QIcon(app_constants.APP_ICO_PATH))
        msg_box.setText("Invalid database")
        msg_box.setInformativeText("Do you want to create a new database?")
        msg_box.setIcon(QMessageBox.Critical)
        msg_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
        msg_box.setDefaultButton(QMessageBox.Yes)
        if msg_box.exec() == QMessageBox.Yes:
            pass
        else:
            application.exit()
            log_d("Normal Exit App: OK")
            sys.exit()

    def start_main_window(conn):
        db.DBBase._DB_CONN = conn
        # if args.test:
        # 	import threading, time
        # 	ser_list = []
        # 	for x in range(5000):
        # 		s = gallerydb.gallery()
        # 		s.profile = app_constants.NO_IMAGE_PATH
        # 		s.title = 'Test {}'.format(x)
        # 		s.artist = 'Author {}'.format(x)
        # 		s.path = app_constants.static_dir
        # 		s.type = 'Test'
        # 		s.language = 'English'
        # 		s.info = 'I am number {}'.format(x)
        # 		ser_list.append(s)

        # 	done = False
        # 	thread_list = []
        # 	i = 0
        # 	while not done:
        # 		try:
        # 			if threading.active_count() > 5000:
        # 				thread_list = []
        # 				done = True
        # 			else:
        # 				thread_list.append(
        # 					threading.Thread(target=gallerydb.galleryDB.add_gallery,
        # 					  args=(ser_list[i],)))
        # 				thread_list[i].start()
        # 				i += 1
        # 				print(i)
        # 				print('Threads running: {}'.format(threading.activeCount()))
        # 		except IndexError:
        # 			done = True

        WINDOW = app.AppWindow()

        # styling
        d_style = app_constants.default_stylesheet_path
        u_style = app_constants.user_stylesheet_path

        if len(u_style) is not 0:
            try:
                style_file = QFile(u_style)
                log_i("Select userstyle: OK")
            except:
                style_file = QFile(d_style)
                log_i("Select defaultstyle: OK")
        else:
            style_file = QFile(d_style)
            log_i("Select defaultstyle: OK")

        style_file.open(QFile.ReadOnly)
        style = str(style_file.readAll(), "utf-8")
        application.setStyleSheet(style)
        try:
            os.mkdir(app_constants.temp_dir)
        except FileExistsError:
            try:
                for root, dirs, files in scandir.walk("temp", topdown=False):
                    for name in files:
                        os.remove(os.path.join(root, name))
                    for name in dirs:
                        os.rmdir(os.path.join(root, name))
            except:
                log.exception("Empty temp: FAIL")
        log_d("Create temp: OK")

        if test:
            return application, WINDOW

        return application.exec_()

    def db_upgrade():
        log_d("Database connection failed")
        from PyQt5.QtGui import QIcon
        from PyQt5.QtWidgets import QMessageBox

        msg_box = QMessageBox()
        msg_box.setWindowIcon(QIcon(app_constants.APP_ICO_PATH))
        msg_box.setText("Incompatible database!")
        msg_box.setInformativeText(
            "Do you want to upgrade to newest version?"
            + " It shouldn't take more than a second. Don't start a new instance!"
        )
        msg_box.setIcon(QMessageBox.Critical)
        msg_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
        msg_box.setDefaultButton(QMessageBox.Yes)
        if msg_box.exec() == QMessageBox.Yes:
            utils.backup_database()
            import threading

            db_p = db_constants.DB_PATH
            db.add_db_revisions(db_p)
            conn = db.init_db()
            return start_main_window(conn)
        else:
            application.exit()
            log_d("Normal Exit App: OK")
            return 0

    if conn:
        return start_main_window(conn)
    else:
        return db_upgrade()
Example #55
0
def main():
    """Main Loop."""
    APPNAME = str(__package__ or __doc__)[:99].lower().strip().replace(" ", "")
    if not sys.platform.startswith("win") and sys.stderr.isatty():
        def add_color_emit_ansi(fn):
            """Add methods we need to the class."""
            def new(*args):
                """Method overload."""
                if len(args) == 2:
                    new_args = (args[0], copy(args[1]))
                else:
                    new_args = (args[0], copy(args[1]), args[2:])
                if hasattr(args[0], 'baseFilename'):
                    return fn(*args)
                levelno = new_args[1].levelno
                if levelno >= 50:
                    color = '\x1b[31m'  # red
                elif levelno >= 40:
                    color = '\x1b[31m'  # red
                elif levelno >= 30:
                    color = '\x1b[33m'  # yellow
                elif levelno >= 20:
                    color = '\x1b[32m'  # green
                elif levelno >= 10:
                    color = '\x1b[35m'  # pink
                else:
                    color = '\x1b[0m'  # normal
                try:
                    new_args[1].msg = color + str(new_args[1].msg) + '\x1b[0m'
                except Exception as reason:
                    print(reason)  # Do not use log here.
                return fn(*new_args)
            return new
        # all non-Windows platforms support ANSI Colors so we use them
        log.StreamHandler.emit = add_color_emit_ansi(log.StreamHandler.emit)
    log.basicConfig(
        level=-1, format="%(levelname)s:%(asctime)s %(message)s", filemode="w",
        filename=os.path.join(gettempdir(), "nuitka-gui.log"))
    log.getLogger().addHandler(log.StreamHandler(sys.stderr))
    try:
        os.nice(19)  # smooth cpu priority
        libc = cdll.LoadLibrary('libc.so.6')  # set process name
        buff = create_string_buffer(len(APPNAME) + 1)
        buff.value = bytes(APPNAME.encode("utf-8"))
        libc.prctl(15, byref(buff), 0, 0, 0)
    except Exception as reason:
        log.debug(reason)
    log.debug("Nuitka path is: {}".format(NUITKA))
    signal.signal(signal.SIGINT, signal.SIG_DFL)  # CTRL+C work to quit app
    application = QApplication(sys.argv)
    application.setApplicationName(__doc__.strip().lower())
    application.setOrganizationName(__doc__.strip().lower())
    application.setOrganizationDomain(__doc__.strip())
    application.setWindowIcon(QIcon.fromTheme("python"))
    try:
        opts, args = getopt(sys.argv[1:], 'hvt', ('version', 'help', 'tests'))
    except:
        pass
    for o, v in opts:
        if o in ('-h', '--help'):
            print(''' Usage:
                  -h, --help        Show help informations and exit.
                  -v, --version     Show version information and exit.
                  -t, --tests       Run Unit Tests on DocTests if any.''')
            return sys.exit(0)
        elif o in ('-v', '--version'):
            print(__version__)
            return sys.exit(0)
        elif o in ('-t', '--tests'):
            testmod(verbose=True, report=True, exclude_empty=True)
            exit(0)
    mainwindow = MainWindow()
    mainwindow.show()
    sys.exit(application.exec_())
Example #56
0
import sys
from PyQt5.QtWidgets import QApplication
from HeartMainWindow import MainWindow

if __name__ == '__main__':
    app = QApplication(sys.argv)

    app.setOrganizationName( 'SCI Institute' )
    app.setOrganizationDomain( 'Uncertainty' )
    app.setApplicationName( 'muView' )

    #SCI::PrintLicense( "muView : Multifield Uncertainty Viewer", "Paul Rosen", "2013" );

    w = MainWindow()

    w.setWindowTitle( 'muView : Multifield Uncertainty Viewer' )
    w.show()

    sys.exit(app.exec_())



Example #57
0
import os
import subprocess
import signal
import logging
import threading

DEBUG = True

SETTING_BASEDIR = "net.fishandwhistle/JupyterQt/basedir"
SETTING_GEOMETRY = "net.fishandwhistle/JupyterQt/geometry"
SETTING_EXECUTABLE = "net.fishandwhistle/JupyterQt/executable"

#setup application
app = QApplication(sys.argv)
app.setApplicationName("JupyterQt")
app.setOrganizationDomain("fishandwhistle.net")


#setup GUI elements
class CustomWebView(QWebView):

    def __init__(self, mainwindow, main=False):
        super(CustomWebView, self).__init__(None)
        self.parent = mainwindow
        self.main = main
        self.loadedPage = None
        self.loadFinished.connect(self.onpagechange)


    @pyqtSlot(bool)
    def onpagechange(self, ok):
Example #58
0
def prepare(tests=False):
    app = QApplication(sys.argv)
    app.setOrganizationName("manuskript"+("_tests" if tests else ""))
    app.setOrganizationDomain("www.theologeek.ch")
    app.setApplicationName("manuskript"+("_tests" if tests else ""))
    app.setApplicationVersion(getVersion())

    print("Running manuskript version {}.".format(getVersion()))
    icon = QIcon()
    for i in [16, 32, 64, 128, 256, 512]:
        icon.addFile(appPath("icons/Manuskript/icon-{}px.png".format(i)))
    qApp.setWindowIcon(icon)

    app.setStyle("Fusion")

    # Load style from QSettings
    settings = QSettings(app.organizationName(), app.applicationName())
    if settings.contains("applicationStyle"):
        style = settings.value("applicationStyle")
        app.setStyle(style)

    # Translation process
    locale = QLocale.system().name()

    appTranslator = QTranslator(app)
    # By default: locale

    def extractLocale(filename):
        # len("manuskript_") = 13, len(".qm") = 3
        return filename[11:-3] if len(filename) >= 16 else ""

    def tryLoadTranslation(translation, source):
        if appTranslator.load(appPath(os.path.join("i18n", translation))):
            app.installTranslator(appTranslator)
            print(app.tr("Loaded translation from {}: {}.").format(source, translation))
            return True
        else:
            print(app.tr("Note: No translator found or loaded from {} for locale {}.").
                  format(source, extractLocale(translation)))
            return False

    # Load translation from settings
    translation = ""
    if settings.contains("applicationTranslation"):
        translation = settings.value("applicationTranslation")
        print("Found translation in settings:", translation)

    if (translation != "" and not tryLoadTranslation(translation, "settings")) or translation == "":
        # load from settings failed or not set, fallback
        translation = "manuskript_{}.qm".format(locale)
        tryLoadTranslation(translation, "system locale")

    QIcon.setThemeSearchPaths(QIcon.themeSearchPaths() + [appPath("icons")])
    QIcon.setThemeName("NumixMsk")

    # Font siue
    if settings.contains("appFontSize"):
        f = qApp.font()
        f.setPointSize(settings.value("appFontSize", type=int))
        app.setFont(f)

    # Main window
    from manuskript.mainWindow import MainWindow

    MW = MainWindow()
    # We store the system default cursor flash time to be able to restore it
    # later if necessary
    MW._defaultCursorFlashTime = qApp.cursorFlashTime()

    # Command line project
    if len(sys.argv) > 1 and sys.argv[1][-4:] == ".msk":
        if os.path.exists(sys.argv[1]):
            path = os.path.abspath(sys.argv[1])
            MW._autoLoadProject = path

    return app, MW
Example #59
0
            self.ele = float(settings.value('ele'))
        else:
            settings.setValue('ele', 20)
            self.ele = 20

    def updatePlot(self, spec, use, plotPeak = False):
        ter = np.arange(use.shape[0]) * self.ele + self.base
        if self.axes.ishold():
            self.base = ter[-1] + self.ele
        ter = ter.reshape([1, -1])
        self.axes.plot(spec._data[[0]].T, spec._data[use + 1].T + ter)
        self.draw()

    def saveFigure(self, *args, **kwargs):
        self.axes.get_figure().savefig(*args, **kwargs)

    def toggleHold(self, state):
        self.axes.hold(state)
        self.base = 0

if __name__ == '__main__':
    app = QApplication(sys.argv)
    app.setApplicationName('RamanGui')
    app.setOrganizationName('Georgia Tech')
    app.setOrganizationDomain('www.graphene.gatech.edu')

    mw = RGui()
    mw.setWindowTitle("Raman Gui")
    mw.show()
    sys.exit(app.exec_())
Example #60
0
File: main.py Project: MazeFX/pat
        result = termination_dialog.exec_()
        if result == 0:
            Lumberjack.info('-->Trying to exit the app..')
            sys.exit(-1)
        Lumberjack.info('[result] = ', result)

    sys.excepthook = spot_the_looney

    Lumberjack.info('=======================  Starting Application.. ')

    visible = True

    app = QApplication(sys.argv)
    app.setApplicationName('PAT')
    app.setOrganizationName("MazeFX Solutions")
    app.setOrganizationDomain("MazeFX.pythonanywhere.com")

    # TODO - Make font path relative
    QFontDatabase().addApplicationFont("C:\PDE\projects\qt\pat\MyQtness\style/fonts/ethnocentric.ttf")
    QFontDatabase().addApplicationFont("C:\PDE\projects\qt\pat\MyQtness\style/fonts/ubuntu_bold.ttf")

    # loginDialog = LoginDialog()
    '''
    isAuth = False
    result = -1
    while not isAuth:
        result = loginDialog.exec_()

        if result == loginDialog.Success or result == LoginDialog.Rejected:
            isAuth = True