當前位置: 首頁>>代碼示例>>Python>>正文


Python QtCore.QCoreApplication方法代碼示例

本文整理匯總了Python中PyQt4.QtCore.QCoreApplication方法的典型用法代碼示例。如果您正苦於以下問題:Python QtCore.QCoreApplication方法的具體用法?Python QtCore.QCoreApplication怎麽用?Python QtCore.QCoreApplication使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt4.QtCore的用法示例。


在下文中一共展示了QtCore.QCoreApplication方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _pyside2

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.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: zipdb

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.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

示例3: test

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.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

示例4: _pyqt5

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.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

示例5: test

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QCoreApplication [as 別名]
def test():
    """測試函數"""
    import sys
    from datetime import datetime
    from PyQt4.QtCore import QCoreApplication
    
    def simpletest(event):
        print u'處理每秒觸發的計時器事件:%s' % str(datetime.now())
    
    app = QCoreApplication(sys.argv)
    
    ee = EventEngine()
    ee.register(EVENT_TIMER, simpletest)
    ee.start()
    
    app.exec_()
    
    
# 直接運行腳本可以進行測試 
開發者ID:sunshinelover,項目名稱:chanlun,代碼行數:21,代碼來源:eventEngine.py

示例6: test

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QCoreApplication [as 別名]
def test():
    """測試"""
    from PyQt4 import QtCore
    import sys
    
    def print_log(event):
        log = event.dict_['data']
        print ':'.join([log.logTime, log.logContent])
    
    app = QtCore.QCoreApplication(sys.argv)    

    eventEngine = EventEngine()
    eventEngine.register(EVENT_LOG, print_log)
    eventEngine.start()
    
    gateway = CtpGateway(eventEngine)
    gateway.connect()
    
    sys.exit(app.exec_()) 
開發者ID:sunshinelover,項目名稱:chanlun,代碼行數:21,代碼來源:ctpGateway.py

示例7: test

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QCoreApplication [as 別名]
def test():
    """測試函數"""
    import sys
    from datetime import datetime
    from PyQt4.QtCore import QCoreApplication
    
    def simpletest(event):
        print u'處理每秒觸發的計時器事件:%s' % str(datetime.now())
    
    app = QCoreApplication(sys.argv)
    
    ee = EventEngine2()
    ee.register(EVENT_TIMER, simpletest)
    ee.start()
    
    app.exec_()
    
    
# 直接運行腳本可以進行測試 
開發者ID:sunshinelover,項目名稱:chanlun,代碼行數:21,代碼來源:eventEngine.py

示例8: test

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QCoreApplication [as 別名]
def test():
    """測試"""
    from PyQt4 import QtCore
    import sys
    
    def print_log(event):
        log = event.dict_['data']
        print ':'.join([log.logTime, log.logContent])
    
    app = QtCore.QCoreApplication(sys.argv)    

    eventEngine = EventEngine()
    eventEngine.register(EVENT_LOG, print_log)
    eventEngine.start()
    
    gateway = FemasGateway(eventEngine)
    gateway.connect()
    
    sys.exit(app.exec_())

#---------------------------------------------------------------------- 
開發者ID:sunshinelover,項目名稱:chanlun,代碼行數:23,代碼來源:femasGateway.py

示例9: test

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QCoreApplication [as 別名]
def test():
    """測試函數"""
    import sys
    from datetime import datetime
    from PyQt4.QtCore import QCoreApplication
    
    def simpletest(event):
        print u'處理每秒觸發的計時器事件:%s' % str(datetime.now())
    
    app = QCoreApplication(sys.argv)
    
    ee = EventEngine2()
    #ee.register(EVENT_TIMER, simpletest)
    ee.registerGeneralHandler(simpletest)
    ee.start()
    
    app.exec_()
    
    
# 直接運行腳本可以進行測試 
開發者ID:zhengwsh,項目名稱:InplusTrader_Linux,代碼行數:22,代碼來源:eventEngine.py

示例10: _pyside2

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.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

示例11: _pyside

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.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

示例12: run

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.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

示例13: check_elm

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.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

示例14: main

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QCoreApplication [as 別名]
def main():
    """運行在CMD中的演示程度"""
    # 創建PyQt4應用對象
    app = QtCore.QCoreApplication(sys.argv)
    
    # 創建主引擎對象
    me = MainEngine()
    
    # 注冊事件監聽
    me.ee.register(EVENT_LOG, print_log)
    
    # 登錄
    userid = ''
    password = ''
    brokerid = ''
    mdAddress = ''
    tdAddress = ''
    
    me.login(userid, password, brokerid, mdAddress, tdAddress)
    
    # 等待10秒鍾(初始化合約數據等)
    sleep(5)
    
    # 創建策略引擎對象
    se = StrategyEngine(me.ee, me)
    
    # 創建策略對象
    setting = {}
    setting['fastAlpha'] = 0.2
    setting['slowAlpha'] = 0.05
    se.createStrategy(u'EMA演示策略', 'IF1506', SimpleEmaStrategy, setting)
    
    # 啟動所有策略
    se.startAll()
    
    # 讓程序連續運行
    sys.exit(app.exec_()) 
開發者ID:sunshinelover,項目名稱:chanlun,代碼行數:39,代碼來源:demoStrategy.py

示例15: _pyside

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.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


注:本文中的PyQt4.QtCore.QCoreApplication方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。