class MainClass: """ Main class of the program. Will initialize everything and will continue running until SIGINT is received. TODO: Consider running some things in separate processes, like UI """ def __init__(self): self.running = False self.drone = DroneControl() self.drone_controller = DronePositionControl() self.image_segmentation = ImageSegmentation() self.main_window = MainWindow(self.drone) self.task_period = 0.05 # seconds self.logger = logging.getLogger(self.__class__.__name__) def start(self): self.running = True self.logger.info("Started System") self.run() def run(self): self.main_window.show_window() while self.running: image = self.drone.get_next_frame() info = self.image_segmentation.extract_information(image) # TODO: use info to complete drone_info drone_info = DroneInfo() control = self.drone_controller.compute_drone_commands(drone_info) # TODO: something like self.drone.send_commands(control) - 3D control self.main_window.update_ui(drone_info, image) time.sleep(self.task_period) def stop(self): self.running = False self.logger.info("Stopped System")
def main(): app = QApplication(sys.argv) app.setOrganizationName('Kimchi') app.setOrganizationDomain('kimchi.app') app.setApplicationName('Kimchi') app.setWindowIcon(QIcon(':/dictionaryIcon')) locale = QLocale.system().name() # locale = 'ro_RO' qtTranslator = QTranslator() if qtTranslator.load('qt_' + locale, ':/'): app.installTranslator(qtTranslator) appTranslator = QTranslator() if appTranslator.load('kimchi_' + locale, ':/'): app.installTranslator(appTranslator) # app.setStyleSheet(styleSheet) appManager = ApplicationManager() mainWindow = MainWindow(appManager) mainWindow.show() app.exec_()
def __init__(self): self.running = False self.drone = DroneControl() self.drone_controller = DronePositionControl() self.image_segmentation = ImageSegmentation() self.main_window = MainWindow(self.drone) self.task_period = 0.05 # seconds self.logger = logging.getLogger(self.__class__.__name__)
def main(): import sys app = QApplication(sys.argv) settings = Settings.Settings() settings.restoreSettings() wnd = MainWindow() wnd.showMaximized() sys.exit(app.exec_())
def main(): mainapp = settings.appsettings() if(mainapp.initapp()): print('Hello') else: exit(0) import sys app = QtGui.QApplication(sys.argv) ui = MainWindow(mainapp) ui.pushButton.setText("Hallo") ui.setWindowTitle(settings.APPNAME + " Version: " + str(settings.VERSION)) ui.show() sys.exit(app.exec_())
def __call__(self): try: #glib.threads_init() #gtk.gdk.threads_init() self.main_window = MainWindow() #self.communicator = SerialCommunicator() self.main_window.show() #gobject.idle_add() #gtk.gdk.threads_enter() gtk.main() except: self.exception_handler() finally: gtk.main_iteration(False) return
def __update_uimanager(self): """ This private method updates the uimanager and controls. @todo GUI has to be handled in higher level class with commonlized interface for adding protocols similarly as plugins. """ from ui.MainWindow import MainWindow main_window = MainWindow() action_dispatcher = ActionDispatcher() if self.__comm_mgr is not None: if self.__comm_mgr.state == 'connected': self.__main_actiongroup.get_action('connect').set_sensitive( False) self.__main_actiongroup.get_action('disconnect').set_sensitive( True) self.__main_actiongroup.get_action( 'connection-setup').set_sensitive(False) self.__chan_actiongroup.set_sensitive(False) else: self.__main_actiongroup.get_action('connect').set_sensitive( True) self.__main_actiongroup.get_action('disconnect').set_sensitive( False) self.__main_actiongroup.get_action( 'connection-setup').set_sensitive(True) self.__chan_actiongroup.set_sensitive(True) self.__uimanager.ensure_update() return
def main(): loggingIni = pkg_resources.resource_stream(data.__name__, 'logging.ini') loggingIni = io.TextIOWrapper(loggingIni, encoding='utf-8') print("LOGGING ini file: {}".format(loggingIni)) logging.config.fileConfig(loggingIni) # Create the application object app = QApplication(sys.argv) # Create the main window mainWindow = MainWindow(app) # Show and run the application mainWindow.show() app.exec()
def show_window(self, arg): if self.window is None: self.window = MainWindow(self) self.window.set_default_size(self.window_size[0], self.window_size[1]) self.window.connect("delete-event", self.destroy_window) self.window.update(self.info) else: self.destroy_window()
def main(): app = QApplication(sys.argv) cache_size_in_kb = 700 * 10**3 QPixmapCache.setCacheLimit(cache_size_in_kb) app.setWindowIcon(QIcon(":/icons/app.svg")) f = QFile(":/style.qss") f.open(QFile.ReadOnly | QFile.Text) app.setStyleSheet(QTextStream(f).readAll()) f.close() mw = MainWindow() mw.show() sys.exit(app.exec_())
def __init__(self): self.__log = logging.getLogger('robotiq.cmds_ui.settings_dlg') from ui.MainWindow import MainWindow main_window = MainWindow() super(self.__class__, self).__init__(_('Commands configuration'), main_window, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, None) #Buttons (FIXME: order could be subject to change) self.__save_button = gtk.Button(None, gtk.STOCK_SAVE) self.__save_button.use_stock = True self.__save_button.set_sensitive(False) self.__save_button.connect('clicked', self.__on_save_clicked) self.add_action_widget(self.__save_button, gtk.RESPONSE_ACCEPT) self.__save_button.show() self.__cancel_button = gtk.Button(None, gtk.STOCK_CANCEL) self.__cancel_button.connect('clicked', self.__on_cancel_clicked) self.__cancel_button.show() self.add_action_widget(self.__cancel_button, gtk.RESPONSE_CANCEL) #Notebook self.__notebook = gtk.Notebook() self.__notebook.connect('switch-page', self.__on_switch_page) self.__tables = [] self.__tabs = CommandsUserInterface().get_tabs() self.__current_page = 0 for tab in self.__tabs: rows = 0 table = gtk.Table(1, 2, True) table.set_row_spacings(4) table.set_col_spacings(2) table.set_border_width(6) for action, details in tab['parameters'].items(): rows += 1 table.resize(rows, 2) label = gtk.Label(_(details['name']) + ':') label.set_justify(gtk.JUSTIFY_RIGHT) label.set_alignment(1.0, 0.5) label.show() entry = gtk.Entry() entry.set_width_chars(30) entry.set_text(details['command']) entry.connect('changed', self.__on_entry_change, action) entry.show() table.attach(label, 0, 1, details['position'] - 1, details['position']) table.attach(entry, 1, 2, details['position'] - 1, details['position']) self.__notebook.append_page(table, gtk.Label(tab['name'])) table.show() self.vbox.pack_start(self.__notebook) self.__notebook.show() return
def main(): print(__name__) lx = ListCommand() lx.main(args=None) # Note: Need a TextIOWrapper since streams are essentially byte-based since Python 3 # See also http://bugs.python.org/issue13518 loggingIni = pkg_resources.resource_stream(data.__name__, 'logging.ini') loggingIni = io.TextIOWrapper(loggingIni, encoding='utf-8') print("LOGGING ini file: {}".format(loggingIni)) logging.config.fileConfig(loggingIni) # Create the application object app = QApplication(sys.argv) # Create the main window mainWindow = MainWindow(app) # Show and run the application mainWindow.show() app.exec()
def main(): print(__name__) lx = ListCommand() lx.main(args=None) # Note: Need a TextIOWrapper since streams are essentially byte-based since Python 3 # See also http://bugs.python.org/issue13518 loggingIni = pkg_resources.resource_stream(data.__name__, "logging.ini") loggingIni = io.TextIOWrapper(loggingIni, encoding="utf-8") print("LOGGING ini file: {}".format(loggingIni)) logging.config.fileConfig(loggingIni) # Create the application object app = QApplication(sys.argv) # Create the main window mainWindow = MainWindow(app) # Show and run the application mainWindow.show() app.exec()
def __feed_uimanager(self): self.__log.debug("Called __feed_uimanager()") from ui.MainWindow import MainWindow main_window = MainWindow() self.__uimanager = main_window.uimanager self.__main_actiongroup = gtk.ActionGroup('CmdsUserIfaceActionGroup') action_dispatcher = ActionDispatcher() self.__main_actiongroup.add_actions([ ('commands-settings', gtk.STOCK_PROPERTIES, _('_Settings'), None, _('Configure commands bound to buttons.'), action_dispatcher['commands-settings']) ]) self.__uimanager.insert_action_group(self.__main_actiongroup, 1) self.__uimanager.ensure_update()
def run(self): self._logger.info("Starting TSM Application r{} ({})".format(Config.CURRENT_VERSION, Config.GIT_COMMIT)) # Create the windows self._login_window = LoginWindow() self._main_window = MainWindow() self._settings_window = SettingsWindow(self._main_window) self._settings = load_settings(Config.DEFAULT_SETTINGS) # Setup the main thread which handles all the business logic self._main_thread = MainThread() # connect login window signals / slots self._login_window.login_button_clicked.connect(self._main_thread.login_button_clicked) self._main_thread.set_login_window_visible.connect(self._login_window.setVisible) self._main_thread.set_login_window_enabled.connect(self._login_window.set_enabled) self._main_thread.set_login_window_form_values.connect(self._login_window.set_form_values) self._main_thread.set_login_window_button_text.connect(self._login_window.set_button_text) self._main_thread.set_login_window_error_text.connect(self._login_window.set_error_text) # connect main window signals / slots self._main_window.settings_button_clicked.connect(self._settings_window.show) self._main_window.status_table_clicked.connect(self._main_thread.status_table_clicked, Qt.QueuedConnection) self._main_window.export_accounting.connect(self._main_thread.accounting_export) self._main_thread.set_main_window_visible.connect(self._main_window.set_visible) self._main_thread.set_main_window_header_text.connect(self._main_window._ui.header_text.setText) self._main_thread.set_main_window_sync_status_data.connect(self._main_window.set_sync_status_data) self._main_thread.set_main_window_addon_status_data.connect(self._main_window.set_addon_status_data) self._main_thread.set_main_window_backup_status_data.connect(self._main_window.set_backup_status_data) self._main_thread.set_main_window_accounting_accounts.connect(self._main_window.set_accounting_accounts) self._main_thread.show_desktop_notification.connect(self._main_window.show_notification) self._main_thread.set_main_window_title.connect(self._main_window.setWindowTitle) self._main_thread.set_main_window_premium_button_visible.connect(self._main_window._ui.premium_button.setVisible) # connect settings window signals / slots self._settings_window.settings_changed.connect(self._main_thread.on_settings_changed) self._settings_window.upload_log_file.connect(self._main_thread.upload_log_file) self._settings_window.reset_settings.connect(self._main_thread.reset_settings) self._settings_window.run_at_startup_changed.connect(self._main_thread.update_run_at_startup) self._main_thread.settings_changed.connect(self._settings_window.on_settings_changed) self._main_thread.log_uploaded.connect(self._settings_window.log_uploaded) # connect general signals / slots self._main_thread.finished.connect(self._app.exit) self._main_thread.show_terms.connect(self.show_terms) self.terms_accepted.connect(self._main_thread.terms_accepted) self._main_thread.run_updater.connect(self.run_updater) # start the thread self._main_thread.start() # Start the app self._app.exec_()
def __feed_uimanager(self): self.__log.debug("Called __feed_uimanager()") from ui.MainWindow import MainWindow main_window = MainWindow() self.__uimanager = main_window.uimanager self.__main_actiongroup = gtk.ActionGroup('CommUserIfaceActionGroup') self.__chan_actiongroup = gtk.ActionGroup('CommChannelsActionGroup') action_dispatcher = ActionDispatcher() self.__main_actiongroup.add_actions([ ('connect', gtk.STOCK_CONNECT, _('_Connect'), 'F5', _('Connect to the robot.'), action_dispatcher['connect']), ('disconnect', gtk.STOCK_DISCONNECT, _('_Disconnect'), None, _('Disconnect the connection.'), action_dispatcher['disconnect']), ('connection-setup', gtk.STOCK_PROPERTIES, _('Confi_guration'), None, _('Configure all communication channels.'), action_dispatcher['connection-setup']) ]) self.__uimanager.insert_action_group(self.__main_actiongroup, 1) self.__uimanager.insert_action_group(self.__chan_actiongroup, 2) self.__uimanager.ensure_update() self.__main_actiongroup.get_action('connect').set_sensitive(True) self.__main_actiongroup.get_action('disconnect').set_sensitive(False)
import os import sys import tkinter as tk from ui.MainWindow import MainWindow from ui.MainCommand import MainCommand if __name__ == "__main__": try: os.mkdir("Files") except FileExistsError: pass try: opts, args = getopt.getopt(sys.argv[1:], "c", ["cli"]) except getopt.GetoptError as err: print(err) sys.exit(2) interface = "gui" for o, a in opts: if o in ("-c", "--cli"): interface = "cli" if interface == "gui": root = tk.Tk() MainWind = MainWindow(root) root.mainloop() elif interface == "cli": MainComm = MainCommand() MainComm.StartCli()
def loadMainWindow(self, path=""): return MainWindow(path)
class UI: ICON_CONNECTED = "evolution-mail" ICON_DISCONNECTED = "edit-delete-mail" ICON_NEW_EMAIL = "mail-mark-unread" current_picture = None window = None refresh_enabled = True window_size = (400, 350) def __init__(self, config): GObject.threads_init() self.queue = Queue() self.config = config self.app = Application(self.update, self.queue, self.config) self.info = self.app.last_info def start(self): Thread(target=self.app.check_queue).start() scheduler = Thread(target=self.app.schedule_check_new) scheduler.daemon = True scheduler.start() self.icon = Gtk.StatusIcon() self._update() self.icon.connect("activate", self.show_window) Gtk.main() def quit(self, arg): self.icon.set_visible(False) if self.window is not None: self.destroy_window() Gtk.main_quit() self.queue.put((self.app.close, None)) def update(self, data): GLib.idle_add(self._update, data) def _update(self, data=None): if data is not None: self.info = pickle.loads(data) picture = UI.ICON_DISCONNECTED if self.info.is_connected: picture = UI.ICON_CONNECTED if len(self.info.emails) > 0: picture = UI.ICON_NEW_EMAIL if picture != self.current_picture: self.current_picture = picture self.icon.set_from_icon_name(picture) if self.window is not None: self.window.update(self.info) def show_window(self, arg): if self.window is None: self.window = MainWindow(self) self.window.set_default_size(self.window_size[0], self.window_size[1]) self.window.connect("delete-event", self.destroy_window) self.window.update(self.info) else: self.destroy_window() def destroy_window(self, arg1=None, arg2=None): self.window_size = self.window.get_size() self.window.destroy() self.window = None
import wx print("Starting nim game ...") app = wx.App() from ui.MainWindow import MainWindow ui = MainWindow() app.MainLoop()
APP_TITLE = 'Comical' APP_VERSION = 0 APP_SUBVERSION = 1 APP_REVISION = 14 import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk from backend.IssueLoader import IssueLoader from ui.MainWindow import MainWindow issue_loader = IssueLoader() main_window = MainWindow(title=APP_TITLE) main_window.connect('load_issue', issue_loader.handle_load_issue) main_window.connect('delete-event', Gtk.main_quit) issue_loader.connect('issue_ready', main_window.handle_issue_ready) main_window.show_all() Gtk.main()
def run(): app = QApplication(sys.argv) ex = MainWindow() sys.exit(app.exec_())
class Application(Singleton): ## Produces exception information into GUI dialog window. # # This method formats the output from the exception traceback and puts # information about processed exception into the dialog window. # @todo Allow storage of traceback to file. def exception_handler(self): (extype, value, trace) = sys.exc_info() trb_list = traceback.extract_tb(trace, 10) del trace trb_string = '<span size="small">' for entry in trb_list: trb_string += _( "File: %s, Line: %d,\nIn function: <b>%s</b>\nCause: %s\n" ) % entry trb_string += '</span>' dialog = gtk.MessageDialog(parent=None, type=gtk.MESSAGE_ERROR, flags=gtk.DIALOG_MODAL, buttons=gtk.BUTTONS_CLOSE) dialog.set_title(_('Unhandled exception')) dialog.set_markup( _('The <b>error</b> \"%s: %s\" that has just occured during program operation left following <b>traceback</b>:' ) % (extype.__name__, value)) dialog.format_secondary_markup(trb_string) dialog.run() ## Application class constructor. # # Installs translation engine and handler for exit request event. # @warning Due to not yet solved dependencies this construction is called # every time application object creation is requested, while in # Singleton pattern such call should return the existing instance. def __init__(self): super(Application, self).__init__() self.__log = logging.getLogger('robotiq') sys.path.append(os.path.dirname(os.path.abspath(sys.argv[0]))) self.__log.setLevel(logging.DEBUG) self.__log.addHandler(logging.StreamHandler()) translation = gettext.translation('robotiq', os.path.join('.', 'locale'), ['pl', 'en'], fallback=False, codeset='utf-8') translation.install(True) action_dispatcher = ActionDispatcher() action_dispatcher['application-quit'] += self.on_req_exit ## Callable method. # # This method makes instance of this class a callable object, so it may # behave like function. def __call__(self): try: #glib.threads_init() #gtk.gdk.threads_init() self.main_window = MainWindow() #self.communicator = SerialCommunicator() self.main_window.show() #gobject.idle_add() #gtk.gdk.threads_enter() gtk.main() except: self.exception_handler() finally: gtk.main_iteration(False) return ## Exit request event handler method. # # Quits the application on request. # @param param Anything passed to signal. def on_req_exit(self, param): gtk.main_quit()
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from PyQt4 import QtGui from ui.MainWindow import MainWindow if __name__ == "__main__": app = QtGui.QApplication(sys.argv) mainWindow = MainWindow() mainWindow.show() sys.exit(app.exec_())
def __init__(self): self.__log = logging.getLogger('robotiq.comm_ui.setup_dlg') from ui.MainWindow import MainWindow main_window = MainWindow() super(self.__class__, self).__init__(_('Connection configuration'), main_window, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, None) #Buttons (FIXME: order could be subject to change) self.__save_button = gtk.Button(None, gtk.STOCK_SAVE) self.__save_button.use_stock = True self.__save_button.set_sensitive(False) self.__save_button.connect('clicked', self.__on_save_clicked) self.add_action_widget(self.__save_button, gtk.RESPONSE_ACCEPT) self.__save_button.show() self.__cancel_button = gtk.Button(None, gtk.STOCK_CANCEL) self.__cancel_button.connect('clicked', self.__on_cancel_clicked) self.__cancel_button.show() self.add_action_widget(self.__cancel_button, gtk.RESPONSE_CANCEL) #Notebook self.__notebook = gtk.Notebook() self.__notebook.connect('switch-page', self.__on_switch_page) self.__tables = [] self.__tabs = CommunicationUserInterface().get_tabs() self.__current_page = 0 for tab in self.__tabs: rows = 0 table = gtk.Table(1, 2, True) table.set_row_spacings(4) table.set_col_spacings(2) table.set_border_width(6) for name, details in tab['parameters'].items(): rows += 1 table.resize(rows, 2) label = gtk.Label(details['name'] + ':') label.set_justify(gtk.JUSTIFY_RIGHT) label.set_alignment(1.0, 0.5) label.show() model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT) combo = gtk.ComboBox(model) combo.set_wrap_width(1) cell = gtk.CellRendererText() combo.pack_start(cell, True) combo.add_attribute(cell, 'text', 0) if 'options' in details and details['options'] is not None: for option in details['options']: #combo.append_text(str(option)) iter = model.append((str(option), option)) if details['value'] == option: combo.set_active_iter(iter) elif 'logic' in details: #combo.append_text(_('Disable')) iter_false = model.append((_('Disable'), 0)) #combo.append_text(_('Enable')) iter_true = model.append((_('Enable'), 1)) if details['value'] == True or details['value'] == 1: combo.set_active_iter(iter_true) else: combo.set_active_iter(iter_false) combo.connect('changed', self.__on_combo_change, name) combo.show() table.attach(label, 0, 1, details['position'] - 1, details['position']) table.attach(combo, 1, 2, details['position'] - 1, details['position']) self.__notebook.append_page(table, gtk.Label(tab['name'])) table.show() self.vbox.pack_start(self.__notebook) self.__notebook.show() return
import sys from PyQt5 import QtWidgets from ui.MainWindow import MainWindow if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) ui = MainWindow() ui.show() sys.exit(app.exec_())
def swapConsole(self): self.console.setWindowTitle("XML Console") self.console.resize(QSize(1024, 500)) self.console.show() self.console.raise_() def addBuddy(self, item=None): if self.connectorThread: if item: jid = item.jid else: jid = "" newBuddy = AddBuddyDialog(self, self.connectorThread.jabber, self.BuddyList.groups.keys(), jid) newBuddy.show() def addGroup(self): newGroup = AddGroupDialog(self, self.BuddyList) newGroup.show() if __name__ == "__main__": app = QApplication(sys.argv) app.setOrganizationName("GSTL") app.setOrganizationDomain("pytalk.trunat.fr") app.setApplicationName(settings.APPNAME) app.setApplicationVersion(settings.VERSION) window = MainWindow() window.show() sys.exit(app.exec_())
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys from PyQt5.QtWidgets import QApplication from ui.MainWindow import MainWindow if __name__ == '__main__': app = QApplication(sys.argv) ex = MainWindow() sys.exit(app.exec_())
def main(): app = MainWindow(title, size) app.mainloop()
# -*- coding: utf-8 -*- from PySide.QtGui import QApplication from PySide.QtCore import Qt, QTranslator from ui.MainWindow import MainWindow import sys if __name__ == "__main__": app = QApplication(sys.argv) translator = QTranslator() translator.load(":/zh/qt_zh_CN.qm") app.installTranslator(translator) window = MainWindow() #window.setWindowFlags(window.windowFlags() &~ Qt.WindowMinMaxButtonsHint) window.setWindowFlags(window.windowFlags() & ~Qt.WindowMaximizeButtonHint) #window.setWindowFlags(Qt.FramelessWindowHint) window.show() sys.exit(app.exec_())
#coding=utf8 ''' Created on 2015年11月25日 @author: I321761 ''' import sys from PyQt4 import QtGui from ui.MainWindow import MainWindow if __name__ == '__main__': app = QtGui.QApplication(sys.argv) win = MainWindow() win.show() #win.showMaximized() sys.exit(app.exec_())
self.te.append(datetime.datetime.now().strftime("[%H:%M:%S]")+" : \n"+message) def swapConsole(self): self.console.setWindowTitle("XML Console") self.console.resize(QSize(1024, 500)) self.console.show() self.console.raise_() def addBuddy(self, item=None): if self.connectorThread: if item: jid = item.jid else: jid = "" newBuddy = AddBuddyDialog(self, self.connectorThread.jabber, self.BuddyList.groups.keys(), jid) newBuddy.show() def addGroup(self): newGroup = AddGroupDialog(self, self.BuddyList) newGroup.show() if __name__ == "__main__": app = QApplication(sys.argv) app.setOrganizationName( "GSTL" ); app.setOrganizationDomain( "pytalk.trunat.fr" ); app.setApplicationName( settings.APPNAME ); app.setApplicationVersion( settings.VERSION ); window = MainWindow() window.show() sys.exit(app.exec_())
def main(): import sys app = QApplication(sys.argv) wnd = MainWindow() wnd.show() sys.exit(app.exec_())
import sys from PyQt5.QtWidgets import QApplication from ui.MainWindow import MainWindow # Main startup file app = QApplication(sys.argv) m = MainWindow() m.show() app.exec_()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys from PyQt5.QtWidgets import QApplication from PyQt5.QtCore import Qt from ui.MainWindow import MainWindow if __name__ == '__main__': app = QApplication(sys.argv) geometry = app.primaryScreen().availableGeometry() main = MainWindow(geometry) sys.exit(app.exec_())
import sys import traceback import logging from PyQt5.QtWidgets import QApplication from ui.MainWindow import MainWindow def excepthook(excType, excValue, tracebackobj): traceback.print_tb(tracebackobj, None, None) print(excType, excValue) sys.excepthook = excepthook if __name__ == '__main__': logging.basicConfig(format="%(asctime)s %(message)s") logging.disable(logging.NOTSET - 10) # Enable NOTSET app = QApplication(sys.argv) mainwindow = MainWindow() mainwindow.show() sys.exit(app.exec_())
from PyQt4 import QtCore, QtGui from ui.MainWindow import MainWindow if __name__ == "__main__": import sys app = QtGui.QApplication(sys.argv) ui = MainWindow() ui.show() sys.exit(app.exec_())
#!/usr/bin/env python import sys from PyQt5.QtWidgets import QApplication from ui.MainWindow import MainWindow if __name__ == '__main__': app = QApplication(sys.argv) win = MainWindow() win.show() sys.exit(app.exec_())
from PyQt5.Qt import ( PYQT_VERSION_STR, QSettings, ) from log import logger from Application import Application from ui.MainWindow import MainWindow signal.signal(signal.SIGINT, signal.SIG_DFL) if __name__ == "__main__": log.init() logger.info("Using PyQt5 version {}".format(PYQT_VERSION_STR)) # Use INI files on Windows, NativeFormat on all other OS if sys.platform == 'win32': QSettings.setDefaultFormat(QSettings.IniFormat) app = Application(sys.argv) mainWin = MainWindow() mainWin.show() # TODO: For easier testing if len(sys.argv) == 2: logger.debug("Processing file from command line: '{}'".format( sys.argv[1])) mainWin.processVideoFile(sys.argv[1]) sys.exit(app.exec_())