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 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 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 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 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()
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()
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_())
# -*- 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_())
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 main(): import sys app = QApplication(sys.argv) wnd = MainWindow() wnd.show() 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_())
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 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_())
#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_())
#!/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_())