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(): 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_()
def run_gui(): """ Launch the graphical user interface of SimSo. This requires a working installation of PyQt4. """ import sys import optparse from PyQt5.QtWidgets import QApplication from simsogui.SimulatorWindow import SimulatorWindow parser = optparse.OptionParser() parser.add_option('-t', '--text', help='run script instead of a GUI', action='store', dest='script') (opts, args) = parser.parse_args() if opts.script: import imp script = imp.load_source("", opts.script) script.main(args) else: app = QApplication(args) app.setOrganizationName("SimSo") app.setApplicationName("SimSo") aw = SimulatorWindow(args[0:]) aw.show() sys.exit(app.exec_())
def main(): # DBUS MainLoop if not dbus.get_default_main_loop(): from dbus.mainloop.pyqt5 import DBusQtMainLoop DBusQtMainLoop(set_as_default = True) # Application Stuff from libhistorymanager.window import MainManager app = QApplication(sys.argv) app.setOrganizationName("history-manager") app.setApplicationName("history-manager") app.setApplicationVersion("0.2.8b") locale = QLocale.system().name() translator = QTranslator(app) translator.load(join("/usr/share/history-manager", "languages/{}.qm".format(locale))) app.installTranslator(translator) # Create Main Widget and make some settings mainWindow = MainManager(None, app= app) mainWindow.resize(640, 480) mainWindow.setWindowIcon(QIcon.fromTheme("view-history")) mainWindow.show() # Create connection for lastWindowClosed signal to quit app app.lastWindowClosed.connect(app.quit) # Run the applications 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_())
def main(): app = QApplication(sys.argv) app.setOrganizationName("cyberegoorg") app.setApplicationName("playground") pm = ProjectManagerDialog() ret = pm.exec() if ret == pm.Accepted: name, directory = pm.open_project_name, pm.open_project_dir mw = MainWindow() mw.show() mw.focusWidget() mw.open_project(name, directory) try: ret = app.exec_() finally: mw.project.killall() sys.exit(ret) else: sys.exit(0)
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_())
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_()
def main(): app = QApplication(sys.argv) app.setOrganizationName('Arvedui') app.setApplicationName('picup') QSettings.setDefaultFormat(QSettings.IniFormat) window = MainWindow() window.show() sys.exit(app.exec_())
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()
def main(): app = QApplication(sys.argv) app.setOrganizationName("Pisi Linux") app.setApplicationName("Pisi Player") app.setApplicationVersion("0.9") pisiplayer = PisiPlayer() pisiplayer.show() sys.exit(app.exec_())
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))
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())
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()
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_())
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_()
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)
def main(): app = QApplication(sys.argv) app.setApplicationName("Kaptan") app.setOrganizationName("Kaptan") app.setApplicationVersion("5.0 Beta3") #app.setStyleSheet(open(join(dirPath, "data/libkaptan.qss").read()) locale = QLocale.system().name() translator = QTranslator(app) translator.load("/usr/share/kaptan/languages/kaptan_{}.qm".format(locale)) app.installTranslator(translator) kaptan = Kaptan() kaptan.show() app.exec_()
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_")()
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()
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_())
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())
class Application: organization = 'pisak' name = 'pisak' def __init__(self, gui): self._app = QApplication(sys.argv) self._app.setOrganizationName(self.organization) self._app.setApplicationName(self.name) self._context = _ApplicationContext() self._engine = QQmlApplicationEngine() self._engine.rootContext().setContextProperty('pisak', self._context) self._engine.load(gui) def run(self): sys.exit(self._app.exec_())
def main(): app = QApplication(sys.argv) app.setOrganizationName('cyberegoorg') app.setApplicationName('playground') pm = ProjectManagerDialog() ret = pm.exec() if ret == pm.Accepted: name, dir = pm.open_project_name, pm.open_project_dir mw = MainWindow() mw.show() mw.focusWidget() mw.open_project(name, dir) sys.exit(app.exec_()) else: sys.exit(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())
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_())
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())
def main(): parser = get_parser() args = parser.parse_args() app = QApplication([]) app.setWindowIcon(QIcon(QPixmap(":/logo_small"))) app.setOrganizationName('Hardcoded Software') app.setApplicationName('moneyGuru') settings = QSettings() if args.debug: LOGGING_LEVEL = logging.DEBUG else: LOGGING_LEVEL = logging.DEBUG if adjust_after_deserialization(settings.value('DebugMode')) else logging.WARNING setupQtLogging(level=LOGGING_LEVEL, log_to_stdout=args.log_to_stdout) logging.debug('started in debug mode') if ISLINUX: stylesheetFile = QFile(':/stylesheet_lnx') else: stylesheetFile = QFile(':/stylesheet_win') stylesheetFile.open(QFile.ReadOnly) textStream = QTextStream(stylesheetFile) style = textStream.readAll() stylesheetFile.close() app.setStyleSheet(style) lang = settings.value('Language') locale_folder = op.join(BASE_PATH, 'locale') hscommon.trans.install_gettext_trans_under_qt(locale_folder, lang) # Many strings are translated at import time, so this is why we only import after the translator # has been installed from qt.app import MoneyGuru app.setApplicationVersion(MoneyGuru.VERSION) mgapp = MoneyGuru(filepath=args.filepath) install_excepthook('https://github.com/hsoft/moneyguru/issues') exec_result = app.exec_() del mgapp # Since PyQt 4.7.2, I had crashes on exit, and from reading the mailing list, it seems to be # caused by some weird crap about C++ instance being deleted with python instance still living. # The worst part is that Phil seems to say this is expected behavior. So, whatever, this # gc.collect() below is required to avoid a crash. gc.collect() return exec_result
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()
# usertransform in callback def start(self): self.interactor.Initialize() self.interactor.Start() if __name__ == '__main__': # Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute if QApplication.startingUp(): app = QApplication(sys.argv) else: app = QCoreApplication.instance() app.setApplicationName("FourPaneViewer") app.setOrganizationName("KitWare") app.setOrganizationDomain("www.kitware.com") main_window = FourPaneViewer() main_window.setGeometry(0, 40, main_window.width(), main_window.height()) main_window.show() main_window.initialize() if len(sys.argv) > 1: mySettings = QSettings() fileDir = mySettings.value(main_window.DEFAULT_DIR_KEY) main_window.loadFile(os.path.join(fileDir, defaultFiles[0])) main_window.loadSurface(os.path.join(fileDir, defaultFiles[1])) sys.exit(app.exec_()) # Local variables: # # tab-width: 2 #
if line.startswith(COMMENT_IDENTIFIER): self.tooltip = self.tooltip + line.lstrip(COMMENT_IDENTIFIER) elif line.startswith(CONTROL_IDENTIFIER): boolValue = line.split("=")[1] # Bloody boolValue could inherit the '\n' new line boolValue = boolValue.rstrip("\n") if boolValue == str(1) or "\"auto\"" in boolValue: self.configBool = True else: self.configBool = False # This will ensure that even if we don't read any string, tooltip # doesn't fail self.tooltip = self.tooltip + '' ############################################################################### if __name__ == "__main__": log = Log() application = QApplication(sys.argv) application.setApplicationName(__doc__.strip().lower()) application.setOrganizationName(__doc__.strip().title()) application.setOrganizationDomain(__doc__.strip().title()) application.setWindowIcon(QIcon.fromTheme("preferences-system")) window = MainWidget() window.show() window.raise_() sys.exit(application.exec_())
self.saveSettings() if self.rapidApp is None: event.accept() else: event.ignore() self.hide() def saveSettings(self) -> None: self.incrementTip() settings = QSettings() settings.beginGroup("DidYouKnowWindow") settings.setValue("windowSize", self.size()) settings.endGroup() if __name__ == "__main__": # Application development test code: app = QApplication([]) app.setOrganizationName("Rapid Photo Downloader") app.setOrganizationDomain("damonlynch.net") app.setApplicationName("Rapid Photo Downloader") prefs = Preferences() dialog = DidYouKnowDialog(prefs=prefs) dialog.show() app.exec_()
logger.addHandler(ch) app = QApplication(sys.argv) if platform.system() == 'Windows': if QSysInfo.windowsVersion() > QSysInfo.WV_WINDOWS7: QApplication.setStyle(QStyleFactory.create("Fusion")) else: QApplication.setStyle(QStyleFactory.create("Windows")) else: QApplication.setStyle(QStyleFactory.create("Windows")) app.setApplicationDisplayName("MQTT Observer") app.setApplicationName("MQTT Observer") app.setOrganizationDomain("xcape.io") app.setOrganizationName("xcape.io") if platform.system() == 'Windows': app.setAttribute(Qt.AA_EnableHighDpiScaling) # for 4K display translator = QTranslator() if args['french']: if translator.load(":/Observer.fr_FR.qm", QDir.currentPath()): app.installTranslator(translator) clientid = "Observer/" + QUuid.createUuid().toString() logger.debug("MQTT clientid %s", clientid) mqtt_client = mqtt.Client(clientid, clean_session=True, userdata=None) dlg = ObserverWindow(mqtt_client, logger)
self.input_widget.setLayout(self.input_gird) def set_action(self): self.start_btn.clicked.connect(self.trans_start) def trans_start(self): try: self.regual_exp = RegularExp(self.text_input_lineedit.text()) self.regual_exp.trans2mfa() image = QImage("img/nfa.png").scaled(800, 280, Qt.KeepAspectRatio, Qt.SmoothTransformation) self.nfa_label.setPixmap(QPixmap.fromImage(image)) image = QImage("img/dfa.png").scaled(800, 280, Qt.KeepAspectRatio, Qt.SmoothTransformation) self.dfa_label.setPixmap(QPixmap.fromImage(image)) image = QImage("img/mfa.png").scaled(800, 280, Qt.KeepAspectRatio, Qt.SmoothTransformation) self.mfa_label.setPixmap(QPixmap.fromImage(image)) except Exception as e: print("exp error:", e) if __name__ == '__main__': app = QApplication(sys.argv) app.setOrganizationName("Zhangtian.") app.setOrganizationDomain("elezt.cn") app.setApplicationName("Complier Editer") form = Regual2autoUI() form.show() app.exec_()
def main(): filename = None debug = 0 kodos_dir = os.path.join(sys.prefix, "kodos") locale = None args = sys.argv[1:] try: (opts, getopts) = getopt.getopt(args, 'd:f:k:l:?h', ["file=", "debug=", "help", "locale="]) except: print("\nInvalid command line option detected.") usage() for opt, arg in opts: if opt in ('-h', '-?', '--help'): usage() if opt == '-k': kodos_dir = arg if opt in ('-d', '--debug'): try: debug = int(arg) except: print("debug value must be an integer") usage() if opt in ('-f', '--file'): filename = arg if opt in ('-l', '--locale'): locale = arg os.environ['KODOS_DIR'] = kodos_dir qApp = QApplication(sys.argv) qApp.setOrganizationName("kodos") qApp.setApplicationName("kodos") qApp.setOrganizationDomain("kodos.sourceforge.net") if locale not in (None, 'en'): localefile = "kodos_%s.qm" % (locale or QTextCodec.locale()) localepath = findFile(os.path.join("translations", localefile)) if debug: print(("locale changed to:", locale)) print(localefile) print(localepath) translator = QTranslator(qApp) translator.load(localepath) qApp.installTranslator(translator) kodos = Kodos(filename, debug) #Find the current window where the mouse is just in case we are in a multi #monitor setup. And then move to its center. frameGm = kodos.frameGeometry() screen = QApplication.desktop().screenNumber( QApplication.desktop().cursor().pos()) centerPoint = QApplication.desktop().availableGeometry(screen).center() frameGm.moveCenter(centerPoint) kodos.move(frameGm.topLeft()) kodos.show() sys.exit(qApp.exec_())
class ColorPickerSquare(QPushButton): def __init__(self, parent=None, color_name="green"): super().__init__(parent) self.setAutoFillBackground(True) self.name = "" self.color = None if QColor.isValidColor(color_name): self.color = QColor(color_name) self.name = color_name self.clicked.connect(self.pick_color) self.setStyleSheet('background-color: {}'.format(self.color.name())) def pick_color(self): self.color = QColorDialog.getColor(options=QColorDialog.DontUseNativeDialog) self.setStyleSheet('background-color: {}'.format(self.color.name())) self.name = self.color.name() # for testing if __name__ == '__main__': app = QApplication(sys.argv) app.setOrganizationName("KARE Ltd.") app.setOrganizationDomain("KAREyiz.biz") app.setApplicationName("PT-Tester") form = ColorPickerSquare() form.show() app.exec()
c.writerow([ self.device_model.mac(d), self.device_model.topic(d), self.device_model.friendly_name(d), self.device_model.fullTopic(d), self.device_model.commandTopic(d), self.device_model.statTopic(d), self.device_model.teleTopic(d), modules.get(self.device_model.module(d)), self.device_model.firmware(d), self.device_model.core(d) ]) def closeEvent(self, e): self.settings.setValue("window_geometry", self.saveGeometry()) self.settings.setValue("splitter_state", self.main_splitter.saveState()) self.settings.sync() e.accept() if __name__ == '__main__': app = QApplication(sys.argv) app.setOrganizationName("Tasmota") app.setApplicationName("TDM") app.lastWindowClosed.connect(app.quit) MW = MainWindow() MW.show() sys.exit(app.exec_())
class CarlaApplication(object): def __init__(self, appName="Carla2", libPrefix=None): object.__init__(self) # try to find styles dir stylesDir = "" CWDl = CWD.lower() # standalone, installed system-wide linux if libPrefix is not None: stylesDir = os.path.join(libPrefix, "lib", "carla") # standalone, local source elif CWDl.endswith("source"): stylesDir = os.path.abspath(os.path.join(CWD, "..", "bin")) if WINDOWS: # Fixes local wine build QApplication.addLibraryPath( "C:\\Python34\\Lib\\site-packages\\PyQt5\\plugins") # plugin elif CWDl.endswith("resources"): # installed system-wide linux if CWDl.endswith("/share/carla/resources"): stylesDir = os.path.abspath( os.path.join(CWD, "..", "..", "..", "lib", "carla")) # local source elif CWDl.endswith("native-plugins%sresources" % os.sep): stylesDir = os.path.abspath( os.path.join(CWD, "..", "..", "..", "..", "bin")) # other else: stylesDir = os.path.abspath(os.path.join(CWD, "..")) # everything else else: stylesDir = CWD if os.path.exists(stylesDir): QApplication.addLibraryPath(stylesDir) if WINDOWS: stylesDir = "" elif config_UseQt5: stylesDir = "" else: self._createApp(appName) return # base settings settings = QSettings("falkTX", appName) useProTheme = settings.value(CARLA_KEY_MAIN_USE_PRO_THEME, CARLA_DEFAULT_MAIN_USE_PRO_THEME, type=bool) if not useProTheme: self._createApp(appName) return # set style QApplication.setStyle("carla" if stylesDir else "fusion") # create app self._createApp(appName) self.fApp.setStyle("carla" if stylesDir else "fusion") # set palette proThemeColor = settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, type=str).lower() if proThemeColor == "black": self.fPalBlack = QPalette() self.fPalBlack.setColor(QPalette.Disabled, QPalette.Window, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Window, QColor(17, 17, 17)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.WindowText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.WindowText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Base, QColor(6, 6, 6)) self.fPalBlack.setColor(QPalette.Active, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Base, QColor(7, 7, 7)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(12, 12, 12)) self.fPalBlack.setColor(QPalette.Active, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(4, 4, 4)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Text, QColor(74, 74, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Text, QColor(230, 230, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Button, QColor(24, 24, 24)) self.fPalBlack.setColor(QPalette.Active, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Button, QColor(28, 28, 28)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90)) self.fPalBlack.setColor(QPalette.Active, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Active, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Light, QColor(191, 191, 191)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Midlight, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Active, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Dark, QColor(129, 129, 129)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Active, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Mid, QColor(94, 94, 94)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Active, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Shadow, QColor(155, 155, 155)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Highlight, QColor(14, 14, 14)) self.fPalBlack.setColor(QPalette.Active, QPalette.Highlight, QColor(60, 60, 60)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Highlight, QColor(34, 34, 34)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(83, 83, 83)) self.fPalBlack.setColor(QPalette.Active, QPalette.HighlightedText, QColor(255, 255, 255)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(240, 240, 240)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.Link, QColor(34, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.Link, QColor(100, 100, 230)) self.fPalBlack.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(74, 34, 74)) self.fPalBlack.setColor(QPalette.Active, QPalette.LinkVisited, QColor(230, 100, 230)) self.fPalBlack.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(230, 100, 230)) self.fApp.setPalette(self.fPalBlack) elif proThemeColor == "blue": self.fPalBlue = QPalette() self.fPalBlue.setColor(QPalette.Disabled, QPalette.Window, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Window, QColor(37, 40, 45)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.WindowText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.WindowText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Base, QColor(48, 53, 60)) self.fPalBlue.setColor(QPalette.Active, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Base, QColor(55, 61, 69)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(60, 64, 67)) self.fPalBlue.setColor(QPalette.Active, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(69, 73, 77)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(182, 193, 208)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(42, 44, 48)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Text, QColor(96, 103, 113)) self.fPalBlue.setColor(QPalette.Active, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Text, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Button, QColor(51, 55, 62)) self.fPalBlue.setColor(QPalette.Active, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Button, QColor(59, 63, 71)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(98, 104, 114)) self.fPalBlue.setColor(QPalette.Active, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(210, 222, 240)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Light, QColor(59, 64, 72)) self.fPalBlue.setColor(QPalette.Active, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Light, QColor(63, 68, 76)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Midlight, QColor(48, 52, 59)) self.fPalBlue.setColor(QPalette.Active, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Midlight, QColor(51, 56, 63)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Dark, QColor(18, 19, 22)) self.fPalBlue.setColor(QPalette.Active, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Dark, QColor(20, 22, 25)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Mid, QColor(28, 30, 34)) self.fPalBlue.setColor(QPalette.Active, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Mid, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Shadow, QColor(13, 14, 16)) self.fPalBlue.setColor(QPalette.Active, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Shadow, QColor(15, 16, 18)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Highlight, QColor(32, 35, 39)) self.fPalBlue.setColor(QPalette.Active, QPalette.Highlight, QColor(14, 14, 17)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Highlight, QColor(27, 28, 33)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(89, 95, 104)) self.fPalBlue.setColor(QPalette.Active, QPalette.HighlightedText, QColor(217, 234, 253)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(223, 237, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.Link, QColor(79, 100, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.Link, QColor(156, 212, 255)) self.fPalBlue.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(51, 74, 118)) self.fPalBlue.setColor(QPalette.Active, QPalette.LinkVisited, QColor(64, 128, 255)) self.fPalBlue.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(64, 128, 255)) self.fApp.setPalette(self.fPalBlue) print("Using \"%s\" theme" % self.fApp.style().objectName()) def _createApp(self, appName): self.fApp = QApplication(sys.argv) self.fApp.setApplicationName(appName) self.fApp.setApplicationVersion(VERSION) self.fApp.setOrganizationName("falkTX") if appName.lower() == "carla-control": self.fApp.setWindowIcon(QIcon(":/scalable/carla-control.svg")) else: self.fApp.setWindowIcon(QIcon(":/scalable/carla.svg")) if MACOS and config_UseQt5: self.fApp.setAttribute(Qt.AA_DontShowIconsInMenus) def arguments(self): return self.fApp.arguments() def exec_(self): return self.fApp.exec_() def exit_exec(self): return sys.exit(self.fApp.exec_()) def getApp(self): return self.fApp def quit(self): self.fApp.quit()
return self.windowMenu.addSeparator() i = 1 menu = self.windowMenu for textEdit_MSW in textEdits: textEdit = textEdit_MSW.widget() title = textEdit.windowTitle() if i == 10: self.windowMenu.addSeparator() menu = menu.addMenu("&More") accel = "" if i < 10: accel = "&{0} ".format(i) elif i < 36: accel = "&{0} ".format(chr(i + ord("@") - 9)) action = menu.addAction("{0}{1}".format(accel, title)) self.windowMapper.setMapping(action, textEdit_MSW) action.triggered.connect(self.windowMapper.map) i += 1 if __name__ == "__main__": app = QApplication(sys.argv) app.setWindowIcon(QIcon(":/icon.png")) app.setOrganizationName("Qtrac Ltd.") app.setOrganizationDomain("qtrac.eu") app.setApplicationName("Text Editor") form = MainWindow() form.show() app.exec_()
import sys from PyQt5.QtGui import QColor, QPalette from PyQt5.QtWidgets import QApplication, QStyleFactory, QWidget from PyQt5.QtCore import Qt from MainWindow import MainWindow if __name__ == '__main__': app = QApplication(sys.argv) app.setApplicationName("Monterey") app.setApplicationVersion("1.0") app.setOrganizationName("PoliTOcean") app.setStyle(QStyleFactory.create("Fusion")) darkPalette = QPalette() darkPalette.setColor(QPalette.Window, QColor(53, 53, 53)) darkPalette.setColor(QPalette.WindowText, Qt.white) darkPalette.setColor(QPalette.Base, QColor(25, 25, 25)) darkPalette.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) darkPalette.setColor(QPalette.ToolTipBase, Qt.white) darkPalette.setColor(QPalette.ToolTipText, Qt.white) darkPalette.setColor(QPalette.Text, Qt.white) darkPalette.setColor(QPalette.Button, QColor(53, 53, 53)) darkPalette.setColor(QPalette.ButtonText, Qt.white) darkPalette.setColor(QPalette.BrightText, Qt.red) darkPalette.setColor(QPalette.Link, QColor(42, 130, 218)) darkPalette.setColor(QPalette.Highlight, QColor(42, 130, 218)) darkPalette.setColor(QPalette.HighlightedText, Qt.black)
def run_dwarf(): """ fire it up """ args = process_args() os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1" if os.name == 'nt': # windows stuff import ctypes try: # write ini to show folder with dwarficon folder_stuff = "[.ShellClassInfo]\n" folder_stuff += "IconResource=assets\\dwarf.ico,0\n" folder_stuff += "[ViewState]\n" folder_stuff += "Mode=\n" folder_stuff += "Vid=\n" folder_stuff += "FolderType=Generic\n" try: with open('desktop.ini', 'w') as ini: ini.writelines(folder_stuff) # set fileattributes to hidden + systemfile ctypes.windll.kernel32.SetFileAttributesW( r'desktop.ini', 0x02 | 0x04 ) # FILE_ATTRIBUTE_HIDDEN = 0x02 | FILE_ATTRIBUTE_SYSTEM = 0x04 except PermissionError: # its hidden+system already pass # fix for showing dwarf icon in windows taskbar instead of pythonicon _appid = u'iGio90.dwarf.debugger' ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID( _appid) ctypes.windll.user32.SetProcessDPIAware() except Exception: # pylint: disable=broad-except pass qapp = QApplication([]) qapp.setDesktopSettingsAware(True) qapp.setAttribute(Qt.AA_EnableHighDpiScaling) qapp.setAttribute(Qt.AA_UseHighDpiPixmaps) qapp.setLayoutDirection(Qt.LeftToRight) qapp.setOrganizationName("https://github.com/iGio90/Dwarf") qapp.setApplicationName("dwarf") # set icon if os.name == "nt" and os.path.exists( utils.resource_path('assets/dwarf.ico')): _icon = QIcon(utils.resource_path('assets/dwarf.ico')) qapp.setWindowIcon(_icon) else: if os.path.exists(utils.resource_path('assets/dwarf.png')): _icon = QIcon(utils.resource_path('assets/dwarf.png')) qapp.setWindowIcon(_icon) app_window = AppWindow(args) app_window.setWindowIcon(_icon) app_window.onRestart.connect(_on_restart) try: sys.exit(qapp.exec_()) except SystemExit as sys_err: if sys_err.code == 0: # thanks for using dwarf print('Thank\'s for using Dwarf\nHave a nice day...') else: # something was wrong print('sysexit with: %d' % sys_err.code)
control(name) # self.errEdit.setText('asdfas') assem_code = open( './results/' + name.split('/')[-1].split('.')[0] + '.asm', 'w') self.symbolEdit.append("名字\t类型\t在内存中的起始位置\t所占内存大小 ") for i in ERR_MSG: # print(i) self.errEdit.append(i) for i in ASSEMBLY_CODE: self.assEdit.append(i) assem_code.write(i + '\n') for i in QUAT_DICT: self.quatEdit.append(str(QUAT_DICT[i])) for i in Token: self.tokenEdit.append(str(i)) for i in SYMBOL_TABLE: self.symbolEdit.append(str(i)) for i in CODE_RESULT: self.keyEdit.append(str(CODE_RESULT.index(i)) + ': ' + i) assem_code.close() if __name__ == '__main__': app = QApplication(sys.argv) app.setOrganizationName("Acytxx") app.setOrganizationDomain("acytoo.com") app.setApplicationName("Analysis") s = AnaUI('1.c') s.show() app.exec_()
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from PyQt5.QtWidgets import QApplication except: from PySide.QtWidgets import QApplication from TagManagerMainWidget import TagManager ORGANIZATION_NAME = 'OpenSource' APPLICATION_NAME = 'qTagManager' if __name__ == "__main__": import sys app = QApplication(sys.argv) # Для того, чтобы каждый раз при вызове QSettings не вводить данные вашего приложения # по которым будут находиться настройки, можно # установить их глобально для всего приложения QApplication.setOrganizationName(ORGANIZATION_NAME) QApplication.setApplicationName(APPLICATION_NAME) m = TagManager() m.show() sys.exit(app.exec())
widget = self._widgets[option][1] stack = self.stack if stack.indexOf(widget) == -1: stack.addWidget(widget) stack.setCurrentWidget(widget) if self.width() < self.sizeHint().width(): self.setMinimumWidth(self.sizeHint().width()) def saveSettings(self): for z in self._widgets.values(): try: z[1].applySettings(z[2]) except SettingsError as e: QMessageBox.warning( self, 'puddletag', translate( 'Settings', 'An error occurred while saving the settings of <b>%1</b>: %2' ).arg(z[0]).arg(str(e))) return self.close() if __name__ == "__main__": app = QApplication(sys.argv) app.setOrganizationName("Puddle Inc.") app.setApplicationName("puddletag") qb = SettingsDialog() qb.show() app.exec_()
from PyQt5.QtWidgets import QApplication from stockmonitor.gui.sigint import setup_interrupt_handling from stockmonitor.gui.widget.stocktable import StockFullTable from stockmonitor.dataaccess.gpw.gpwcurrentdata import GpwCurrentStockData from teststockmonitor import data ## ============================= main section =================================== if __name__ != '__main__': sys.exit(0) app = QApplication(sys.argv) app.setApplicationName("StockMonitor") app.setOrganizationName("arnet") # dataframe = DataFrame({'a': ['Mary', 'Jim', 'John'], # 'b': [100, 200, 300], # 'c': ['a', 'b', 'c']}) dataAccess = GpwCurrentStockData() dataPath = data.get_data_path("akcje_2020-04-14_15-50.xls") dataframe = dataAccess.dao.parseWorksheetFromFile(dataPath) # csvPath = data.get_data_root_path() + "/akcje_2020-04-14_15-50.csv" # dataframe.to_csv( csvPath, encoding='utf-8', index=False ) setup_interrupt_handling() widget = StockFullTable()
"""Close application. Parameters ---------- event : QEvent Close event. """ self._write_settings() if self.history: print("\nCommand History") print("===============") print("\n".join(self.history)) QApplication.quit() def eventFilter(self, source, event): # currently the only source is the raw plot window if event.type() == QEvent.Close: self._update_infowidget() return QObject.eventFilter(self, source, event) matplotlib.use("Qt5Agg") app = QApplication(sys.argv) app.setApplicationName("MNELAB") app.setOrganizationName("cbrnr") main = MainWindow() if len(sys.argv) > 1: # open files from command line arguments for f in sys.argv[1:]: main.load_file(f) sys.exit(app.exec_())
import sys import matplotlib from PyQt5.QtWidgets import QApplication import multiprocessing as mp import matplotlib.pyplot as plt from mnelab import MainWindow, Model plt.style.use('ggplot') if __name__ == "__main__": mp.set_start_method("spawn") # required for Linux/macOS matplotlib.use("Qt5Agg") app = QApplication(sys.argv) app.setApplicationName("MNELAB") app.setOrganizationName("cbrnr - FCBG") model = Model() view = MainWindow(model) model.view = view if len(sys.argv) > 1: # open files from command line arguments for f in sys.argv[1:]: model.load(f) view.show() sys.exit(app.exec_())
async def receive_serial_async(self) -> None: """Wait for incoming data, convert it to text and add to Textedit.""" while True: msg = ser.readline() if msg != b'': text = msg.decode().strip() self.received_textedit.appendPlainText(text) await asyncio.sleep(0) if __name__ == '__main__': appctxt = ApplicationContext() # 1. Instantiate ApplicationContext app = QApplication([]) loop = QEventLoop() asyncio.set_event_loop(loop) app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5()) app.setStyleSheet(qdarkstyle.load_stylesheet(qt_api='pyqt5')) app.setOrganizationName('Dramco') app.setApplicationName('IWAST Configurator') w = RemoteWidget() w.show() exit_code = appctxt.app.exec_() # 2. Invoke appctxt.app.exec_() sys.exit(exit_code) with loop: loop.run_forever()
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) # Set up the app so that settings work -- this in lieu of the ppqt2.py # Note the app name is distinct from the old, so that v1 and v2 can # be used simultaneously. app.setOrganizationName("PGDP") app.setOrganizationDomain("pgdp.net") app.setApplicationName("PPQT2") from PyQt5.QtCore import QSettings settings = QSettings() # and awayyyy we go import mainwindow from PyQt5.QtCore import Qt, QPoint, QSize ## SECOND test check loading saving recent files and previously open files ## clear the sessions and insert some previous files ## and open files. mw = None # clear out that mainwindow settings.clear()
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 readStdIn = 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 elif fileName == '-': readStdIn = True if globalSettings.openLastFilesOnStartup: window.restoreLastOpenedFiles() inputData = '' if readStdIn and sys.stdin is not None: if sys.stdin.isatty(): print('Reading stdin, press ^D to end...') inputData = 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())
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' if os.path.exists('cacert.pem'): os.environ["REQUESTS_CA_BUNDLE"] = os.path.join( os.getcwd(), "cacert.pem") 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') parser.add_argument('-x', '--dev', action='store_true', help='Development Switch') args = parser.parse_args() log_handlers = [] log_level = logging.INFO if args.dev: log_handlers.append(logging.StreamHandler()) 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 log_handlers.append( logging.FileHandler('happypanda_debug.log', 'w', 'utf-8')) log_level = logging.DEBUG app_constants.DEBUG = True else: try: with open(log_path, 'x') as f: pass except FileExistsError: pass log_handlers.append( logging.handlers.RotatingFileHandler(log_path, maxBytes=1000000 * 10, encoding='utf-8', backupCount=2)) logging.basicConfig( level=log_level, format='%(asctime)-8s %(levelname)-6s %(name)-6s %(message)s', datefmt='%d-%m %H:%M', handlers=tuple(log_handlers)) 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 if app_constants.FORCE_HIGH_DPI_SUPPORT: log_i("Enabling high DPI display support") os.environ.putenv("QT_DEVICE_PIXEL_RATIO", "auto") effects = [ Qt.UI_AnimateCombo, Qt.UI_FadeMenu, Qt.UI_AnimateMenu, Qt.UI_AnimateTooltip, Qt.UI_FadeTooltip ] for effect in effects: QApplication.setEffectEnabled(effect) 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)) application.setAttribute(Qt.AA_UseHighDpiPixmaps) log_i('Starting Happypanda...'.format(app_constants.vs)) if args.debug: log_i('Running in debug mode'.format(app_constants.vs)) import pprint sys.displayhook = pprint.pprint 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(args.exceptions) # 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()
def run_dwarf(): """ fire it up """ os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1" # os.environ["QT_SCALE_FACTOR"] = "1" # os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "0" # os.environ["QT_SCREEN_SCALE_FACTORS"] = "1" from dwarf_debugger.lib import utils from dwarf_debugger.lib.git import Git from dwarf_debugger.lib.prefs import Prefs from dwarf_debugger.ui.app import AppWindow from PyQt5.QtCore import Qt from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QApplication import dwarf_debugger.resources # pylint: disable=unused-import QApplication.setDesktopSettingsAware(True) QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps) QApplication.setLayoutDirection(Qt.LeftToRight) QApplication.setOrganizationName("https://github.com/iGio90/Dwarf") QApplication.setApplicationName("Dwarf") QApplication.setApplicationDisplayName('Dwarf') qapp = QApplication([]) # set icon _icon = None if os.name == "nt": if os.path.exists(utils.resource_path('assets/dwarf.ico')): _icon = QIcon(utils.resource_path('assets/dwarf.ico')) else: _icon = QIcon(':/assets/dwarf.ico') else: if os.path.exists(utils.resource_path('assets/dwarf.png')): _icon = QIcon(utils.resource_path('assets/dwarf.png')) else: _icon = QIcon(':/assets/dwarf.png') if _icon: qapp.setWindowIcon(_icon) _prefs = Prefs() local_update_disabled = _prefs.get('disable_local_frida_update', False) args = process_args() """ did_first_run = _prefs.get('did_first_run', False) if False: from dwarf_debugger.ui.dialogs.dialog_setup import SetupDialog # did_first_run: _prefs.put('did_first_run', True) SetupDialog.showDialog(_prefs) """ if not local_update_disabled: _git = Git() import frida remote_frida = _git.get_frida_version() local_frida = frida.__version__ if remote_frida and local_frida != remote_frida['tag_name']: print('Updating local frida version to ' + remote_frida['tag_name']) try: res = utils.do_shell_command( 'pip3 install frida --upgrade --user') if 'Successfully installed frida-' + remote_frida[ 'tag_name'] in res: _on_restart() elif 'Requirement already up-to-date' in res: if os.path.exists('.git_cache'): shutil.rmtree('.git_cache', ignore_errors=True) else: print('failed to update local frida') print(res) except Exception as e: # pylint: disable=broad-except, invalid-name print('failed to update local frida') print(str(e)) if os.name == 'nt': # windows stuff import ctypes try: if os.path.exists(utils.resource_path('assets/dwarf.ico')): # write ini to show folder with dwarficon folder_stuff = "[.ShellClassInfo]\n" folder_stuff += "IconResource=dwarf\\assets\\dwarf.ico,0\n" folder_stuff += "[ViewState]\n" folder_stuff += "Mode=\n" folder_stuff += "Vid=\n" folder_stuff += "FolderType=Generic\n" try: ini_path = os.path.dirname( os.path.abspath(__file__) ) + os.sep + os.pardir + os.sep + 'desktop.ini' with open(ini_path, 'w') as ini: ini.writelines(folder_stuff) # set fileattributes to hidden + systemfile ctypes.windll.kernel32.SetFileAttributesW( ini_path, 0x02 | 0x04 | ~0x20 ) # FILE_ATTRIBUTE_HIDDEN = 0x02 | FILE_ATTRIBUTE_SYSTEM = 0x04 except PermissionError: # its hidden+system already pass # fix for showing dwarf icon in windows taskbar instead of pythonicon _appid = u'iGio90.dwarf.debugger' ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID( _appid) ctypes.windll.user32.SetProcessDPIAware() except Exception: # pylint: disable=broad-except pass try: # parse target as pid args.pid = int(args.any) except ValueError: args.pid = 0 # default to local if not specified if args.target is None: args.target = 'local' app_window = AppWindow(args) if _icon: app_window.setWindowIcon(_icon) app_window.onRestart.connect(_on_restart) try: sys.exit(qapp.exec_()) except SystemExit as sys_err: if sys_err.code == 0: # thanks for using dwarf print('Thank\'s for using Dwarf\nHave a nice day...') else: # something was wrong print('sysexit with: %d' % sys_err.code)
def closeEvent(self, event): # Stops the renderer such that the application can close without issues self.stackCT.close() self.viewer3D.interactor.close() for i in range(len(self.viewUS)): self.viewUS[i].interactor.close() event.accept() if __name__ == '__main__': if QApplication.startingUp(): app = QApplication(sys.argv) else: app = QCoreApplication.instance() app.setApplicationName("SmartLock") app.setOrganizationName("BK Medical") app.setOrganizationDomain("www.bkmedical.com") main_window = SmartLock() main_window.setGeometry(0, 40, main_window.width(), main_window.height()) main_window.show() main_window.initialize() # Hack to load stuff on startup if len(sys.argv) > 1: mySettings = QSettings() fileDir = mySettings.value(main_window.DEFAULT_DIR_KEY) main_window.loadFile(os.path.join(fileDir, defaultFiles[0])) # CT # main_window.loadUSFile(os.path.join(fileDir,defaultFiles[3])) # US # main_window.loadUSFile(os.path.join(fileDir,defaultFiles[4])) # NoBound main_window.loadUSFile(os.path.join(fileDir, defaultFiles[5])) # White main_window.loadSurface(os.path.join(fileDir, defaultFiles[1]),
self.browser.setHtml(html) self.urlbar.setText(filename) def save_file(self): filename, _ = QFileDialog.getSaveFileName( self, "Save Page As", "", "Hypertext Markup Language (*.htm *html);;" "All files (*.*)") if filename: html = self.browser.page().toHtml() with open(filename, 'w') as f: f.write(html) def navigate_page(self): self.browser.setUrl(QUrl("hipycas.github.io/PyBrowse")) def about(self): dlg = AboutDialog() dlg.exec_() app = QApplication(argv) app.setApplicationName("PyBrowse") app.setOrganizationName("HipyCas Development") app.setOrganizationDomain("hipycas.github.io") win = MainWindow() app.exec_()
"server_ip": "127.0.0.1", "server_port": "8134", "workspace_name": "test_hunt_d4b", "use_ssh": False, "ssh_host": "ws168.diamond.ac.uk", "ssh_port": "22", } workspace_config = { "dataset_name": "data", "datasets_dir": "/path/to/my/data/dir", "vol_fname": "myfile.h5", "workspace_name": "my_survos_workspace", "downsample_by": "1", } from survos2.server.config import cfg pipeline_config = dict(cfg) os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1" QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) app = QApplication([]) app.setOrganizationName("DLS") app.setApplicationName("SuRVoS2") front_end_runner = FrontEndRunner(run_config, workspace_config, pipeline_config) app.exec_() if front_end_runner.server_process is not None: front_end_runner.server_process.kill()
pass else: if okunan == None: pass try: mesaj_tipi = okunan["mesaj_tipi"] except: mesaj_tipi = "" try: mesaj_metni = okunan["mesaj"] except: mesaj_metni = "" try: mesaj_tarihi = okunan["tarih"] except: mesaj_tarihi = "" if gonderen[0] == "<" and gonderen[-1] == ">": gonderen = gonderen[1:-1] duzenli_mesajlar[mesaj_tarihi] = [ mesaj_tipi, mesaj_metni, mesaj, gonderen, gonderen_onay ] return duzenli_mesajlar if __name__ == "__main__": uyg = QApplication(sys.argv) okuyucu_pencere = Okuyucu() uyg.setOrganizationName('milis-bildirim') uyg.setQuitOnLastWindowClosed(False) sys.exit(uyg.exec_())
# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. import os import sys import signal from OpenGL import GL from PyQt5 import QtCore from PyQt5.QtCore import QCoreApplication if os.name == 'posix': QCoreApplication.setAttribute(QtCore.Qt.AA_X11InitThreads, True) from PyQt5.QtWidgets import QApplication app = QApplication(sys.argv) app.setOrganizationName("Deepin") app.setApplicationName("Deepin Screenshot") app.setApplicationVersion("3.1.11") app.setQuitOnLastWindowClosed(False) from app_controller import AppController from dbus_services import is_service_exist, register_object from dbus_interfaces import screenshotInterface if __name__ == "__main__": if is_service_exist(): screenshotInterface.runWithArguments(app.arguments()) # TODO: maybe there will never be a situation that # the following should be executed. # notificationsInterface.notify(_("Deepin Screenshot"), # _("Deepin Screenshot has been started!"))
CONFIG_POLL_DELAY = 1 #attempt opening config file base = os.path.dirname(os.path.abspath(__file__)) cfg_path = "{}/config_msys_kiosk.json".format(base) try: f = open(cfg_path) data = json.load(f) f.close() if 'base_url' in data: CONFIG_BASE_URL = data['base_url'] if 'fullscreen' in data: CONFIG_FULLSCREEN = data['fullscreen'] if 'poll_delay' in data: CONFIG_POLL_DELAY = data['poll_delay'] except FileNotFoundError as e: print("error opening file: [{}]".format(e)) print("using default settings") app = QApplication(sys.argv) app.setApplicationName("Helios Kiosk") app.setOrganizationName("Helios Makerspace") app.setOrganizationDomain("heliosmakerspace.ca") window = MainWindow(screen_mode=CONFIG_FULLSCREEN) t = nfcThread(CONFIG_POLL_DELAY) t.sig_got_ID.connect(window.navigate_to_url) t.start() app.exec_()
log_data = log_stream.getvalue() 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
def main(args=None): print("starting epyq") signal.signal(signal.SIGINT, sigint_handler) # TODO: CAMPid 9757656124812312388543272342377 app = QApplication(sys.argv) epyqlib.utils.qt.exception_message_box_register_versions( version_tag=epyq.__version_tag__, build_tag=epyq.__build_tag__, ) sys.excepthook = functools.partial( epyqlib.utils.qt.exception_message_box, ) QtCore.qInstallMessageHandler(epyqlib.utils.qt.message_handler) app.setStyleSheet( "QMessageBox {{ messagebox-text-interaction-flags: {}; }}".format( Qt.TextBrowserInteraction ) ) app.setOrganizationName("EPC Power Corp.") app.setApplicationName("EPyQ") os_signal_timer = QtCore.QTimer() os_signal_timer.start(200) os_signal_timer.timeout.connect(lambda: None) # TODO: CAMPid 03127876954165421679215396954697 # https://github.com/kivy/kivy/issues/4182#issuecomment-253159955 # fix for pyinstaller packages app to avoid ReactorAlreadyInstalledError if "twisted.internet.reactor" in sys.modules: del sys.modules["twisted.internet.reactor"] import qt5reactor qt5reactor.install() import argparse ui_default = "main.ui" parser = argparse.ArgumentParser() parser.add_argument("--verbose", "-v", action="count", default=0) parser.add_argument("--quit-after", type=float, default=None) parser.add_argument("--load-offline", default=None) if args is None: args = parser.parse_args() else: args = parser.parse_args(args) can_logger_modules = ("can", "can.socketcan.native") for module in can_logger_modules: logging.getLogger(module).setLevel(logging.WARNING) if args.verbose >= 1: logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) if args.verbose >= 2: import twisted.internet.defer twisted.internet.defer.setDebugging(True) if args.verbose >= 3: logging.getLogger().setLevel(logging.DEBUG) if args.verbose >= 4: logging.getLogger().setLevel(logging.INFO) for module in can_logger_modules: logging.getLogger(module).setLevel(logging.DEBUG) window = Window() epyqlib.utils.qt.exception_message_box_register_parent(parent=window) window.show() if args.quit_after is not None: QtCore.QTimer.singleShot(args.quit_after * 1000, app.quit) if args.load_offline is not None: def load_offline(): (bus_node,) = [ node for node in window.ui.device_tree.model.root.children if node.fields.name == "Offline" ] split = args.load_offline.split("_", maxsplit=1) if split[0] == "test": path = epyqlib.tests.common.devices[split[1]] else: path = args.load_offline window.ui.device_tree.add_device( bus=bus_node, device=epyqlib.device.Device( file=path, bus=bus_node.bus, node_id=247, ), ) QtCore.QTimer.singleShot(0.5 * 1000, load_offline) from twisted.internet import reactor reactor.runReturn() result = app.exec() if reactor.threadpool is not None: reactor._stopThreadPool() logging.debug("Thread pool stopped") logging.debug("Application ended") reactor.stop() logging.debug("Reactor stopped") # TODO: this should be sys.exit() but something keeps the process # from terminating. Ref T679 Ref T711 os._exit(result)