当前位置: 首页>>代码示例>>Python>>正文


Python QtCore.QCoreApplication方法代码示例

本文整理汇总了Python中PyQt5.QtCore.QCoreApplication方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.QCoreApplication方法的具体用法?Python QtCore.QCoreApplication怎么用?Python QtCore.QCoreApplication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtCore的用法示例。


在下文中一共展示了QtCore.QCoreApplication方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _pyside2

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QCoreApplication [as 别名]
def _pyside2():
    import PySide2
    from PySide2 import QtGui, QtWidgets, QtCore, QtUiTools

    _remap(QtCore, "QStringListModel", QtGui.QStringListModel)

    _add(PySide2, "__binding__", PySide2.__name__)
    _add(PySide2, "load_ui", lambda fname: QtUiTools.QUiLoader().load(fname))
    _add(PySide2, "translate", lambda context, sourceText, disambiguation, n: (
        QtCore.QCoreApplication(context, sourceText,
                                disambiguation, None, n)))
    _add(PySide2,
         "setSectionResizeMode",
         QtWidgets.QHeaderView.setSectionResizeMode)

    _maintain_backwards_compatibility(PySide2)

    return PySide2 
开发者ID:liorbenhorin,项目名称:pipeline,代码行数:20,代码来源:Qt.py

示例2: test

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QCoreApplication [as 别名]
def test():
    """测试函数"""
    from datetime import datetime
    try:
        from PyQt5.QtCore import QCoreApplication
    except ImportError:
        from PyQt4.QtCore import QCoreApplication
    
    def simpletest(event):
        print(u'处理每秒触发的计时器事件:%s' % str(datetime.now()))
    
    app = QCoreApplication('VnTrader')
    
    ee = EventEngine2()
    ee.register(EVENT_TIMER, simpletest)
    ee.start()
    
    app.exec_()


# 直接运行脚本可以进行测试 
开发者ID:quantOS-org,项目名称:TradeSim,代码行数:23,代码来源:eventEngine.py

示例3: _pyside2

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QCoreApplication [as 别名]
def _pyside2():
    import PySide2
    from PySide2 import QtGui, QtWidgets, QtCore, QtUiTools

    _remap(QtCore, "QStringListModel", QtGui.QStringListModel)

    _add(PySide2, "__binding__", PySide2.__name__)
    _add(PySide2, "load_ui", _pyside_loadui)
    _add(PySide2, "translate", lambda context, sourceText, disambiguation, n: (
        QtCore.QCoreApplication(context, sourceText,
                                disambiguation, None, n)))
    _add(PySide2,
         "setSectionResizeMode",
         QtWidgets.QHeaderView.setSectionResizeMode)

    _maintain_backwards_compatibility(PySide2)

    return PySide2 
开发者ID:cineuse,项目名称:CNCGToolKit,代码行数:20,代码来源:Qt.py

示例4: zipdb

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QCoreApplication [as 别名]
def zipdb(self):
        filename_tuple = widgets.QFileDialog.getSaveFileName(self, _("Save database (keep '.zip' extension)"),
                                                   "./ecu.zip", "*.zip")
        if qt5:
            filename = str(filename_tuple[0])
        else:
            filename = str(filename_tuple)
        
        if not filename.endswith(".zip"):
            filename += ".zip"

        if not isWritable(str(os.path.dirname(filename))):
            mbox = widgets.QMessageBox()
            mbox.setText("Cannot write to directory " + os.path.dirname(filename))
            mbox.exec_()
            return

        self.logview.append(_("Zipping XML database... (this can take a few minutes"))
        core.QCoreApplication.processEvents()
        parameters.zipConvertXML(filename)
        self.logview.append(_("Zip job finished")) 
开发者ID:cedricp,项目名称:ddt4all,代码行数:23,代码来源:ddt4all.py

示例5: run

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QCoreApplication [as 别名]
def run(self):
        """
        Runs the server process by starting its own QCoreApplication.
        """
        self._configure_forked_logger()

        qt.fix_pyqt5_exception_eating()

        app = QtCore.QCoreApplication([])

        # server manager, signal shutdown stops the app
        server_manager = ServerManager()
        server_manager.shutdown.connect(app.quit)
        # noinspection PyCallByClass
        QtCore.QTimer.singleShot(100, server_manager.start)

        # run event loop of app
        app.exec_() 
开发者ID:Trilarion,项目名称:imperialism-remake,代码行数:20,代码来源:server.py

示例6: _pyqt5

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QCoreApplication [as 别名]
def _pyqt5():
    import PyQt5.Qt
    from PyQt5 import QtCore, QtWidgets, uic

    _remap(QtCore, "Signal", QtCore.pyqtSignal)
    _remap(QtCore, "Slot", QtCore.pyqtSlot)
    _remap(QtCore, "Property", QtCore.pyqtProperty)

    _add(PyQt5, "__binding__", PyQt5.__name__)
    _add(PyQt5, "load_ui", lambda fname: uic.loadUi(fname))
    _add(PyQt5, "translate", lambda context, sourceText, disambiguation, n: (
        QtCore.QCoreApplication(context, sourceText,
                                disambiguation, n)))
    _add(PyQt5,
         "setSectionResizeMode",
         QtWidgets.QHeaderView.setSectionResizeMode)

    _maintain_backwards_compatibility(PyQt5)

    return PyQt5 
开发者ID:chrisevans3d,项目名称:uExport,代码行数:22,代码来源:Qt.py

示例7: test_defer

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QCoreApplication [as 别名]
def test_defer():
    """util.defer works as expected"""

    app = QtCore.QCoreApplication(sys.argv)

    mutable = dict()

    def expensive_function():
        time.sleep(0.1)
        return 5

    def on_expensive_function(result):
        mutable["result"] = result
        app.quit()

    qthread = util.defer(expensive_function,
                         callback=on_expensive_function)

    app.exec_()

    assert_true(qthread.wait(200))
    assert_equals(mutable["result"], 5) 
开发者ID:pyblish,项目名称:pyblish-qml,代码行数:24,代码来源:test_util.py

示例8: _pyside

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QCoreApplication [as 别名]
def _pyside():
    import PySide
    from PySide import QtGui, QtCore, QtUiTools

    _remap(PySide, "QtWidgets", QtGui)
    _remap(QtCore, "QSortFilterProxyModel", QtGui.QSortFilterProxyModel)
    _remap(QtCore, "QStringListModel", QtGui.QStringListModel)
    _remap(QtCore, "QItemSelection", QtGui.QItemSelection)
    _remap(QtCore, "QItemSelectionModel", QtGui.QItemSelectionModel)
    _remap(QtCore, "QAbstractProxyModel", QtGui.QAbstractProxyModel)

    try:
        from PySide import QtWebKit
        _remap(PySide, "QtWebKitWidgets", QtWebKit)
    except ImportError:
        # QtWebkit is optional in Qt, therefore might not be available
        pass

    _add(PySide, "__binding__", PySide.__name__)
    _add(PySide, "load_ui", lambda fname: QtUiTools.QUiLoader().load(fname))
    _add(PySide, "translate", lambda context, sourceText, disambiguation, n: (
        QtCore.QCoreApplication(context, sourceText,
                                disambiguation, None, n)))
    _add(PySide, "setSectionResizeMode", QtGui.QHeaderView.setResizeMode)

    _maintain_backwards_compatibility(PySide)

    return PySide 
开发者ID:liorbenhorin,项目名称:pipeline,代码行数:30,代码来源:Qt.py

示例9: run

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QCoreApplication [as 别名]
def run(self):
        count = 0
        app = QtCore.QCoreApplication.instance()
        while count < 5:
            print("Increasing")  # break here
            count += 1
        app.quit() 
开发者ID:fabioz,项目名称:PyDev.Debugger,代码行数:9,代码来源:_debugger_case_qthread3.py

示例10: check_elm

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QCoreApplication [as 别名]
def check_elm(self):
        currentitem = self.listview.currentItem()
        self.logview.show()
        if self.wifibutton.isChecked():
            port = str(self.wifiinput.text())
        else:
            if not currentitem:
                self.logview.hide()
                return
            portinfo = utf8(currentitem.text())
            port = self.ports[portinfo][0]
        speed = int(self.speedcombo.currentText())
        res = elm.elm_checker(port, speed, self.logview, core.QCoreApplication)
        if not res:
            self.logview.append(options.get_last_error()) 
开发者ID:cedricp,项目名称:ddt4all,代码行数:17,代码来源:ddt4all.py

示例11: initQCoreApplication

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QCoreApplication [as 别名]
def initQCoreApplication():
    """ Initializes the QtCore.QApplication instance. Creates one if it doesn't exist.

        Sets Argos specific attributes, such as the OrganizationName, so that the application
        persistent settings are read/written to the correct settings file/winreg. It is therefore
        important to call this function (or initQApplication) at startup.

        Returns the application.
    """
    app = QtCore.QCoreApplication(sys.argv)
    initArgosApplicationSettings(app)
    return app 
开发者ID:titusjan,项目名称:argos,代码行数:14,代码来源:misc.py

示例12: start

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QCoreApplication [as 别名]
def start(args):
    app = QCoreApplication(sys.argv)
    sys.excepthook = traceback.print_exception

    server = DedicatedServer(args.level)
    server.SNAPSHOT_INTERVAL = args.interval
    server.start(args.host, args.port, args.ssl)

    # Allow the use of Ctrl-C to stop the server
    def sigint_handler(_, __):
        server.stop()
        app.exit(0)

    signal.signal(signal.SIGINT, sigint_handler)

    # This timer gives the application a chance to be interrupted every 50 ms
    # even if it stuck in a loop or something
    def safe_timer(timeout, func, *args, **kwargs):
        def timer_event():
            try:
                func(*args, **kwargs)
            finally:
                QTimer.singleShot(timeout, timer_event)

        QTimer.singleShot(timeout, timer_event)

    safe_timer(50, lambda: None)

    return app.exec_() 
开发者ID:IDArlingTeam,项目名称:IDArling,代码行数:31,代码来源:server.py

示例13: run

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QCoreApplication [as 别名]
def run():

    app = QCoreApplication(sys.argv)
    
    ex = MainWorker(app)
    ex.start(sys.argv)
    
    app.exec_() 
开发者ID:hANSIc99,项目名称:Pythonic,代码行数:10,代码来源:scriptd.py

示例14: _pyside

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QCoreApplication [as 别名]
def _pyside():
    import PySide
    from PySide import QtGui, QtCore, QtUiTools

    _remap(PySide, "QtWidgets", QtGui)
    _remap(QtCore, "QSortFilterProxyModel", QtGui.QSortFilterProxyModel)
    _remap(QtCore, "QStringListModel", QtGui.QStringListModel)
    _remap(QtCore, "QItemSelection", QtGui.QItemSelection)
    _remap(QtCore, "QItemSelectionModel", QtGui.QItemSelectionModel)
    _remap(QtCore, "QAbstractProxyModel", QtGui.QAbstractProxyModel)

    try:
        from PySide import QtWebKit
        _remap(PySide, "QtWebKitWidgets", QtWebKit)
    except ImportError:
        # QtWebkit is optional in Qt, therefore might not be available
        pass

    _add(PySide, "__binding__", PySide.__name__)
    _add(PySide, "load_ui", _pyside_loadui)
    _add(PySide, "translate", lambda context, sourceText, disambiguation, n: (
        QtCore.QCoreApplication(context, sourceText,
                                disambiguation, None, n)))
    _add(PySide, "setSectionResizeMode", QtGui.QHeaderView.setResizeMode)

    _maintain_backwards_compatibility(PySide)

    return PySide 
开发者ID:cineuse,项目名称:CNCGToolKit,代码行数:30,代码来源:Qt.py

示例15: main

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QCoreApplication [as 别名]
def main():
    import sys
    app = QtCore.QCoreApplication(sys.argv)
    from artisanlib.acaia import AcaiaBLE
    acaia = AcaiaBLE()
    ble = BleInterface(acaia.SERVICE_UUID,acaia.CHAR_UUID,acaia.processData,acaia.sendHeartbeat,acaia.sendStop,acaia.reset)
    ble.scanDevices()
    sys.exit(app.exec_()) 
开发者ID:artisan-roaster-scope,项目名称:artisan,代码行数:10,代码来源:ble.py


注:本文中的PyQt5.QtCore.QCoreApplication方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。