我们从Python开源项目中,提取了以下22个代码示例,用于说明如何使用PyQt4.QtCore.QCoreApplication()。
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
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_() # ????????????
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_())
def zipdb(self): filename = gui.QFileDialog.getSaveFileName(self, _("Save database (keep '.zip' extension)"), "./ecu.zip", "*.zip") filename = str(filename.toAscii()) if not filename.endswith(".zip"): filename += ".zip" if not isWritable(str(os.path.dirname(filename))): mbox = gui.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")
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_()) #----------------------------------------------------------------------
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 = SgitGateway(eventEngine) gateway.connect() sys.exit(app.exec_())
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 = KsotpGateway(eventEngine) gateway.connect() sys.exit(app.exec_())
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
def run(self): count = 0 app = QtCore.QCoreApplication.instance() while count < 5: print "Increasing" time.sleep(.5) count += 1 app.quit()
def check_elm(self): currentitem = self.listview.currentItem() if currentitem: self.logview.show() port = str(currentitem.text().split('[')[0]) speed = int(self.speedcombo.currentText()) res = elm.elm_checker(port, speed, self.logview, core.QCoreApplication) if res == False: self.logview.append(options.get_last_error())
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
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
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
def _pyqt4(): # Attempt to set sip API v2 (must be done prior to importing PyQt4) import sip try: sip.setapi("QString", 2) sip.setapi("QVariant", 2) sip.setapi("QDate", 2) sip.setapi("QDateTime", 2) sip.setapi("QTextStream", 2) sip.setapi("QTime", 2) sip.setapi("QUrl", 2) except AttributeError: raise ImportError # PyQt4 < v4.6 except ValueError: # API version already set to v1 raise ImportError import PyQt4.Qt from PyQt4 import QtCore, QtGui, uic _remap(PyQt4, "QtWidgets", QtGui) _remap(QtCore, "Signal", QtCore.pyqtSignal) _remap(QtCore, "Slot", QtCore.pyqtSlot) _remap(QtCore, "Property", QtCore.pyqtProperty) _remap(QtCore, "QItemSelection", QtGui.QItemSelection) _remap(QtCore, "QStringListModel", QtGui.QStringListModel) _remap(QtCore, "QItemSelectionModel", QtGui.QItemSelectionModel) _remap(QtCore, "QSortFilterProxyModel", QtGui.QSortFilterProxyModel) _remap(QtCore, "QAbstractProxyModel", QtGui.QAbstractProxyModel) try: from PyQt4 import QtWebKit _remap(PyQt4, "QtWebKitWidgets", QtWebKit) except ImportError: # QtWebkit is optional in Qt , therefore might not be available pass _add(PyQt4, "QtCompat", self) _add(PyQt4, "__binding__", PyQt4.__name__) _add(PyQt4, "load_ui", lambda fname: uic.loadUi(fname)) _add(PyQt4, "translate", lambda context, sourceText, disambiguation, n: ( QtCore.QCoreApplication(context, sourceText, disambiguation, None, n))) _add(PyQt4, "setSectionResizeMode", QtGui.QHeaderView.setResizeMode) _maintain_backwards_compatibility(PyQt4) return PyQt4