def main(): global app global threads Log.__init__(None) Log.i("Performing DB Init") upgrade = Upgrade() upgrade.upgrade() Log.i('Starting GUI') app = QApplication(sys.argv) Log.i('Process ID %s' % app.applicationPid()) app.setStyle('Fusion') app.focusWidget() window = MainWindow() app.setActiveWindow(window) window.show() threads = [] sys.excepthook = handle_exception sys.exit(app.exec_())
def assignWidgets(self): wd = self._widget self.single_field = SingleField(wd.fieldFrame, wd.field) # assign quartered view, 4 times, and integrate it into 4 defaultviews self.quarter_field1 = QuarterField(wd.frm_rob1field, wd.lb_field) self.quarter_field2 = QuarterField(wd.frm_rob1field_2, wd.lb_field_2) self.quarter_field3 = QuarterField(wd.frm_rob1field_3, wd.lb_field_3) self.quarter_field4 = QuarterField(wd.frm_rob1field_4, wd.lb_field_4) self.quarter_fields = [ self.quarter_field1, self.quarter_field2, self.quarter_field3, self.quarter_field4 ] self.main_window = MainWindow(self.single_field, self.quarter_fields, wd.checkBox, wd.tabWidget, wd.Uebersicht,\ wd.lb_gamephase, wd.lb_gamescore, wd.lb_extratime) self.tab1 = InformationTab(0, self.single_field, wd.role1, wd.penalty1, wd.hardwarestatus1, wd.action1, wd.checkHideAll_4, \ wd.checkTarget_4, wd.checkBall_4, wd.checkTeammate_4, wd.checkOpponent_4, wd.checkUndef_4, wd.activity1, wd.activityRed1) self.tab2 = InformationTab(1, self.single_field, wd.role2, wd.penalty2, wd.hardwarestatus2, wd.action2, wd.checkHideAll_2, \ wd.checkTarget_2, wd.checkBall_2, wd.checkTeammate_2, wd.checkOpponent_2, wd.checkUndef_2, wd.activity2, wd.activityRed2) self.tab3 = InformationTab(2, self.single_field, wd.role3, wd.penalty3, wd.hardwarestatus3, wd.action3, wd.checkHideAll_3, \ wd.checkTarget_3, wd.checkBall_3, wd.checkTeammate_3, wd.checkOpponent_3, wd.checkUndef_3, wd.activity3, wd.activityRed3) self.tab4 = InformationTab(3, self.single_field, wd.role4, wd.penalty4, wd.hardwarestatus4, wd.action4, wd.checkHideAll_5, \ wd.checkTarget_5, wd.checkBall_5, wd.checkTeammate_5, wd.checkOpponent_5, wd.checkUndef_5, wd.activity4, wd.activityRed4) self.view1 = DefaultView(self.quarter_field1, wd.lb_name, wd.lb_nextaction, wd.lb_penaltytime, \ wd.lb_role, wd.lb_statehardware, wd.wdg_stateindicator_green, wd.wdg_stateindicator_red) self.view2 = DefaultView(self.quarter_field2, wd.lb_name_2, wd.lb_nextaction_2, wd.lb_penaltytime_3, \ wd.lb_role_3, wd.lb_statehardware_3, wd.wdg_stateindicator_green_2, wd.wdg_stateindicator_red_2) self.view3 = DefaultView(self.quarter_field3, wd.lb_name_3, wd.lb_nextaction_3, wd.lb_penaltytime_4, \ wd.lb_role_4, wd.lb_statehardware_4, wd.wdg_stateindicator_green_3, wd.wdg_stateindicator_red_3) self.view4 = DefaultView(self.quarter_field4, wd.lb_name_4, wd.lb_nextaction_4, wd.lb_penaltytime_5, \ wd.lb_role_5, wd.lb_statehardware_5, wd.wdg_stateindicator_green_4, wd.wdg_stateindicator_red_4)
def __init__(self): appdata = str( QDesktopServices.storageLocation(QDesktopServices.DataLocation)) MusicGuruBase.__init__(self, appdata) ApplicationBase.__init__(self) if not op.exists(appdata): os.makedirs(appdata) logging.basicConfig(filename=op.join(appdata, 'debug.log'), level=logging.WARNING) self.prefs = Preferences() self.prefs.load() self.selectedBoardItems = [] self.selectedLocation = None self.mainWindow = MainWindow(app=self) self.locationsPanel = LocationsPanel(app=self) self.detailsPanel = DetailsPanel(app=self) self.ignoreBox = IgnoreBox(app=self) self.progress = Progress(self.mainWindow) self.aboutBox = AboutBox(self.mainWindow, self) self.connect(self.progress, SIGNAL('finished(QString)'), self.jobFinished) self.connect(self, SIGNAL('applicationFinishedLaunching()'), self.applicationFinishedLaunching)
#!/usr/bin/env python3 import sys from PySide2.QtWidgets import QApplication from main_window import MainWindow if __name__ == '__main__': app = QApplication(sys.argv) window = MainWindow(None) window.show() app.exec_()
def main(): app = QtGui.QApplication(sys.argv) widget = MainWindow() widget.show() widget.raise_() sys.exit(app.exec_())
from main_window import MainWindow if __name__ == '__main__': import sys from PySide2.QtWidgets import QApplication app = QApplication(sys.argv) w = MainWindow() w.show() app.exec_()
def run(): app = QtWidgets.QApplication(sys.argv) GUI = MainWindow() GUI.show() app.exec_()
from main_window import MainWindow if __name__ == '__main__': app = MainWindow() app.mainloop()
def __init__(self): if os.geteuid() != 0: root_popup = Popup('Error', 'You need to be root to run the VPN.') root_popup.set_icon_from_file("surfshark_linux_client.png") root_popup.connect('destroy', Gtk.main_quit) Gtk.main() return None self.debug_on = True # set to False to disable debug infos # TODO : Make a loader # TODO : Find a way to have a popup to run the app as root self.folder_path = os.path.abspath(os.path.dirname(__file__)) + "/" self.servers = self.get_servers() self.unhash_pass = "" self.config_files = {} self.vpn_command = False self.thread = False self.ip = "" with open(self.folder_path + "config.json", "r") as file: self.config = json.load(file) style = Gtk.CssProvider() #Theme if (self.config['theme'] == 'light'): style.load_from_path(self.folder_path + "style/style_lightmode.css") else: style.load_from_path(self.folder_path + "style/style_darkmode.css") Gtk.StyleContext.add_provider_for_screen( Gdk.Screen.get_default(), style, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) if (self.config['password_needed'] or not self.config['registered']): self.log_window = LogWindow(self) self.log_window.connect("destroy", Gtk.main_quit) self.log_window.show_all() self.main_window = MainWindow(self) self.main_window.connect("destroy", self.soft_quit_g) if (not self.config['password_needed'] and self.config['registered']): screen = self.main_window.get_display() monitor_size = screen.get_monitor_at_window( Gdk.get_default_root_window()).get_geometry() self.main_window.move( monitor_size.width / 2 - self.main_window.get_size().width / 2, monitor_size.height / 2 - self.main_window.get_size().height / 2) self.main_window.credentials_username.set_text( self.config['vpn_username']) self.main_window.credentials_password.set_text( self.config['vpn_password']) self.main_window.show_all() try: Gtk.main() except (KeyboardInterrupt, SystemExit): self.soft_quit()
import os import ctypes import PyQt5.QtWidgets as QtWidgets from main_window import MainWindow if os.name == 'nt': my_app_id = u'lv.meaanalyzer.subproduct.version' ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(my_app_id) # the following lines create an exception hook # which allows to output Python exceptions while PyQt is running # taken from: https://stackoverflow.com/a/43039363/8928024 sys._excepthook = sys.excepthook def my_exception_hook(exctype, value, traceback): print(exctype, value, traceback) sys._excepthook(exctype, value, traceback) sys.exit(1) sys.excepthook = my_exception_hook # end of exception hook creation application = QtWidgets.QApplication(sys.argv) mainWindow = MainWindow('MEAsure') mainWindow.show() application.setActiveWindow(mainWindow) sys.exit(application.exec())
cr.line_to(x, self.allocation.height / scale[1]) cr.stroke() cr.identity_matrix() images = state.get_images() cr.translate(offset[0], offset[1]) cr.scale(state.scale[0], state.scale[1]) for img in images: img.draw(cr) cr.identity_matrix() cr_gdk.set_source_surface(cr_surf) cr_gdk.paint() mw = MainWindow(width, height, Screen) ep.mw = mw # GTK mumbo-jumbo to show the widget in a window and quit when it's closed def run(): mw.run() if __name__ == "__main__": usage = "pythone tileset_editor.py [-h] [--reexport] [--project <path>] [--out <path>]" if len(sys.argv) > 1: description = { "-h": { "arglen": 0, "arg": None,
from main_window import MainWindow if __name__ == "__main__": app = MainWindow(None) app.mainloop()
filemode='a', format=LOG_FORMAT) logging.addLevelName(5, "INPUT") logging.info("**** START ****") def make_screen_list(main_win): result = [] result.append(DeviceScreen(main_win)) result.append(MediaScreen(main_win)) return result if __name__ == '__main__': setup_logging() try: initscr = setup_curses() win_size_y, win_size_x = initscr.getmaxyx() if win_size_y < 24 or win_size_x < 80: cleanup_curses() print _("Terminal too small. Min size is 80x24\n"), "\r" exit_text_installer() main_win = MainWindow(initscr) win_list = make_screen_list(main_win) screen = start_screen_list(win_list) while screen is not None: screen = screen.show() finally: cleanup_curses() exit_text_installer()
def _save_measure(self, no, label, sizes, img_name): path = self.conf.get('save_folder', './') f = open(os.path.join(path, self.conf['measure_file']), 'a+') f.write("%d,%s,%.3f,%.3f,%s\n" % (no, label, sizes[0], sizes[1], img_name)) f.close() def start(self): assert (self.video_widget) assert (self.form) self.video_thread.start() if __name__ == '__main__': try: CONFIG['cam_num'] = int(sys.argv[1]) except IndexError: print "No cam_num given using %d" % CONFIG['cam_num'] if not os.path.isdir(CONFIG['save_folder']): os.mkdir(CONFIG['save_folder']) app = App(sys.argv, conf=CONFIG) form = MainWindow() app.set_form(form) app.set_video_widget(form.video_widget, CONFIG) app.start() form.show() sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) _ = MainWindow() sys.exit(app.exec_())
from school_data import SchoolData from meal import Meal from PyQt5.QtWidgets import QApplication import sys from main_window import MainWindow school_data = SchoolData() meal = Meal() # school_data.crawl_db() # print(meal.get_month(list(school_data.get_db(schl_nm=('천안쌍용고등학교', '=')))[0], 2020, 5)) app = QApplication(sys.argv) main_window = MainWindow(school_data, meal) main_window.show() sys.exit(app.exec_())
import sys from PyQt5 import QtWidgets from main_window import MainWindow app = QtWidgets.QApplication([]) application = MainWindow() application.show() sys.exit(app.exec())
import sys from PyQt5.QtWidgets import QApplication import PyQt5.sip from main_window import MainWindow if __name__ == "__main__": wxclients = { "client1": { "url": "http://localhost:7456?0" }, "client2": { "url": "http://localhost:7456?1" }, "client3": { "url": "http://localhost:7456?2" }, "client4": { "url": "http://localhost:7456?3" }, "client5": { "url": "http://localhost:7456?4" }, "client6": { "url": "http://localhost:7456?5" }, } app = QApplication([]) window = MainWindow(None, "TCYWechatGameDevHelper", wxclients) window.show() sys.exit(app.exec_())
# here we go... if __name__ == "__main__": # default config from cavity_gui import config # load user config if os.path.exists(CONFIG_FILE): execfile(CONFIG_FILE) # start our first application from main_window import MainWindow # not using styles atm, at some point later... #style = open(os.path.join(os.getcwd(), # 'source/gui/cyclops/style.css'), 'r').read() cavity_gui_app = QtGui.QApplication(sys.argv) # cyclops_app.setStyleSheet(style) # open the socket and start the client. # will fail if no connection to qtlab is available sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(('localhost', PORT)) handler = _QtDummyHandler(sock, 'client', 'server') mainwindow = MainWindow() mainwindow.show() sys.exit(cavity_gui.exec_())
def main(argv): # Create a Qt application app = QApplication(argv) app.setStyle('macintosh') setPalette(app) eng_package_error_message, rus_package_error_message = _checkPackages() if eng_package_error_message or rus_package_error_message: error_message = u'<font color=\"red\">Next python packages are required for running the program:</font><br/>' error_message += eng_package_error_message error_message += u'<br/><font color=\"yellow\">---------------------------------' \ u'-------------------------------------------------</font><br/>' error_message += u'<font color=\"red\">Для запуска программы необходимы следующие библиотеки для python:' \ u'</font><br/>' error_message += rus_package_error_message mb = QMessageBox(QMessageBox.Critical, 'Package Error', error_message, QMessageBox.Ok) mb.exec_() sys.exit() from main_window import AppArgs, MainWindow start_path = os.environ.get('BEHAVIOR_STUDIO_ROOT', None) if start_path is None: globals.rootDirectory = os.getcwd() # globals.rootDirectory = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) else: globals.rootDirectory = start_path globals.rootDirectory = toUnixPath(os.path.normpath(globals.rootDirectory)) # Read input args appArgs = AppArgs(argv) opts = None try: opts, args = getopt.getopt( argv[1:], 'hdc:', ['help', 'debug', 'config=', 'config-file=']) except getopt.GetoptError: appArgs.options_error = True mb = QMessageBox( QMessageBox.Warning, 'Options Error', '<font color=\"red\">There are some options error!<br/>Read studio output...</font>', QMessageBox.Ok) mb.exec_() if not appArgs.options_error: for opt, arg in opts: if opt in ('-h', '--help'): infoString = 'available options:<br/>\ -h, --help - see this hint<br/>\ -c, --config, --config-file - set start configuration file<br/>' infoString += '<br/>Example:<br/><b>{0} -c config.xml</b>'.format( appArgs.current_file) mb = QMessageBox(QMessageBox.Information, 'Options Help', infoString, QMessageBox.Ok) mb.exec_() sys.exit() elif opt in ('-c', '--config', '--config-file'): appArgs.config_file = arg appArgs.config_file_default = False elif opt in ('-d', '--debug'): appArgs.debug = True globals.applicationConfigFile = globals.processVars( globals.applicationConfigFile) appArgs.config_file = globals.processVars(appArgs.config_file) globals.applicationAlphabetPath = globals.processVars( globals.applicationAlphabetPath) globals.applicationShapesPath = globals.processVars( globals.applicationShapesPath) if args: appArgs.project_for_opening = toUnixPath(args[0]) if not _readConfig(appArgs): # read icons path mb = QMessageBox( QMessageBox.Critical, 'Configuration Error', 'Can\'t load application configuration!<br/>' 'Configuration file <b>\'{0}\'</b> does not exist.'.format( appArgs.config_file), QMessageBox.Ok) mb.exec_() sys.exit() if globals.showLogo: splash = QSplashScreen( QPixmap(joinPath(globals.applicationIconsPath, 'splash2.png'))) splash.showMessage( '<h2>Behavior Studio {0}</h2>'.format(globals.strVersion), Qt.AlignHCenter, Qt.red) splash.show() sleep(3) else: splash = None # Create main window window = MainWindow(appArgs) window.show() if splash is not None: splash.finish(window) # window = main_window.MainStackedWindow() # window.hide() # Enter Qt application main loop app.exec_() sys.exit()
def main(): base = Tk() user_settings = UserSettings() MainWindow(base, user_settings) base.mainloop()
__slots__ = ['_model', '_view'] def __init__(self, view, model): self._model = model self._view = view # self._view.set_file_path.connect(self.set_file_path) # self.main() def get_blocks(self): pass def set_blocks(self): pass def set_file_path(self, path_): print(path_) def main(self): prs = ParserText( 'Привет тебе, противный мир\n Как же я не люблю тебя!') print(prs.get()) if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) win = MainWindow() pr = Presenter(win, None) win.set_file_path.connect(pr.set_file_path) win.show() sys.exit(app.exec_())
else 'Unchecked') + '\n' setting += 'Show-dist = ' + ('Checked' if self.show_dist_chb.isChecked() else 'Unchecked') + '\n' setting += 'Display = ' + ('Checked' if self.display_chb. isChecked() else 'Unchecked') + '\n' setting += 'Regressor = ' + ('Checked' if self.regressor_chb.isChecked() else 'Unchecked') + '\n' file.write(setting) else: print('Wrong mode entered!') exit(-1) return setting # def closeEvent(self): if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) main_window = MainWindow() ui_backend = UIBackend(main_window) main_window.ui = ui_backend main_window.show() sys.exit(app.exec_())
print("\tChange the vertex/fragment profiles that Cg will use:") print("\t\t--cg-arb:\tuse arb profiles.") print("\t\t--cg-glsl:\tuse glsl profiles.") print("\tN: number of particles. Start with 8000 and slowly increase") sys.exit(0) def excepthook(type, value, traceback): import traceback traceback.print_last() sys.exit(1) # PySide/PyQT just print exceptions to console and continue # override excepthook to exit application on error. sys.excepthook = excepthook app = QtGui.QApplication(sys.argv) # number of particles (last argument in command line) try: N = int(sys.argv[-1]) #20**3 except (IndexError, ValueError): print( "Invalid number of particles. Use 'python main.py 8000', for example" ) print("See also: python main.py --help") exit(1) window = MainWindow(N) window.show() sys.exit(app.exec_())
# Read the CSV content df = pd.read_csv(fname) # Remove wrong magnitudes df = df.drop(df[df.mag < 0].index) magnitudes = df["mag"] # My local timezone timezone = QTimeZone(b"Europe/Berlin") # Get timestamp transformed to our timezone times = df["time"].apply(lambda x: transform_date(x, timezone)) return times, magnitudes if __name__ == "__main__": options = argparse.ArgumentParser() options.add_argument("-f", "--file", type=str, required=True) args = options.parse_args() data = read_data(args.file) # Qt Application app = QApplication(sys.argv) widget = Widget(data) window = MainWindow(widget) window.show() sys.exit(app.exec_())
import pyglet from main_window import MainWindow from widgets import MainManager window = MainWindow(1200, 1000, resizable=True) window.set_caption('Touchy - Virtual MIDI X-Y Pad') MainManager(window=window, is_movable=True) pyglet.app.run()
from tkinter import * from main_window import MainWindow if __name__ == "__main__": root = Tk() root.columnconfigure(0, weight=1) root.columnconfigure(2, weight=1) root.rowconfigure(0, weight=1) m = MainWindow(root) root.mainloop()
def init_main_window(self): main_window = MainWindow(self.con) main_window.mainloop()
def test_codegen_not_fails(): app = QtWidgets.QApplication([]) window = MainWindow() window.GenerateCode()
self._exception_caught.connect(show_exception_box) def exception_hook(self, exc_type, exc_value, exc_traceback): if issubclass(exc_type, KeyboardInterrupt): # ignore keyboard interrupt to support console applications sys.__excepthook__(exc_type, exc_value, exc_traceback) else: log_msg = '\n'.join([ ''.join(traceback.format_tb(exc_traceback)), '{0}: {1}'.format(exc_type.__name__, exc_value) ]) # trigger message box show self._exception_caught.emit(log_msg) sys._excepthook(exc_type, exc_value, exc_traceback) if __name__ == '__main__': if len(sys.argv) == 2 and sys.argv[1] == "--linux-recorder": from linux_keystroke_recorder import linux_keystroke_recorder linux_keystroke_recorder() else: appctxt = ApplicationContext() # 1. Instantiate ApplicationContext init_logger() qt_exception_hook = UncaughtHook() window = MainWindow(appctxt) window.show() exit_code = appctxt.app.exec_() # 2. Invoke appctxt.app.exec_() sys.exit(exit_code)