本文整理汇总了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
示例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"))
示例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_()
# 直接运行脚本可以进行测试
示例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
示例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_()
# 直接运行脚本可以进行测试
示例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_())
示例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_()
# 直接运行脚本可以进行测试
示例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_())
#----------------------------------------------------------------------
示例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_()
# 直接运行脚本可以进行测试
示例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
示例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
示例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()
示例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())
示例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_())
示例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