Python PyQt5.QtGui.QGuiApplication() Examples

The following are code examples for showing how to use PyQt5.QtGui.QGuiApplication(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: uavsim   Author: kamikaze   File: map.py    GNU General Public License v3.0 5 votes vote down vote up
def run_map_ui(queue_to_ui, queue_out):
    app = QGuiApplication(sys.argv)
    engine = QQmlApplicationEngine()
    ctx = engine.rootContext()

    locator = Locator(queue_to_ui, queue_out)
    pid_manager = PIDManager(queue_to_ui, queue_out)

    ctx.setContextProperty('locator', locator)
    ctx.setContextProperty('pidManager', pid_manager)
    ctx.setContextProperty('main', engine)
    engine.load(resource_filename('uavsim.resources', 'main.qml'))

    sys.exit(app.exec_()) 
Example 2
Project: HanziSRS   Author: patarapolw   File: __main__.py    Apache License 2.0 5 votes vote down vote up
def main():
    start = time()
    sys.argv += ['--style', 'fusion']
    app = QGuiApplication(sys.argv)

    engine = QQmlApplicationEngine()
    context = engine.rootContext()

    hsk_vocab = HskVocab()
    spoonfed = SpoonFed()
    hanzi_variant = HanziVariant()
    vocab_category = VocabCategory()
    hanzi_level = HanziLevel()
    cedict = Cedict()
    context.setContextProperty('pyHskVocab', hsk_vocab)
    context.setContextProperty('pySentence', spoonfed)
    context.setContextProperty('pyHanziVariant', hanzi_variant)
    context.setContextProperty('pyVocabCategory', vocab_category)
    context.setContextProperty('pyHanziLevel', hanzi_level)
    context.setContextProperty('pyCedict', cedict)

    utils = Utils()
    context.setContextProperty('py', utils)

    user = User()
    context.setContextProperty('pyUser', user)

    user_db = sqlite3.connect(user_path('user.db'))
    user_vocab = UserVocab(user_db)
    user_hanzi = UserHanzi(user_db)
    user_sentence = UserSentence(user_db)
    context.setContextProperty('pyUserVocab', user_vocab)
    context.setContextProperty('pyUserHanzi', user_hanzi)
    context.setContextProperty('pyUserSentence', user_sentence)

    print("Startup time: {:.4f} seconds".format(time()-start))

    engine.load(qml_path("main.qml"))
    engine.quit.connect(app.quit)

    sys.exit(app.exec_()) 
Example 3
Project: python3_ios   Author: holzschu   File: test_imageqt.py    BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
def setUp(self):
        PillowQtTestCase.setUp(self)
        try:
            if ImageQt.qt_version == '5':
                from PyQt5.QtGui import QGuiApplication
            elif ImageQt.qt_version == '4':
                from PyQt4.QtGui import QGuiApplication
            elif ImageQt.qt_version == 'side':
                from PySide.QtGui import QGuiApplication
            elif ImageQt.qt_version == 'side2':
                from PySide2.QtGui import QGuiApplication
        except ImportError:
            self.skipTest('QGuiApplication not installed')

        self.app = QGuiApplication([])