本文整理汇总了Python中PyQt5.QtWidgets.QApplication.processEvents方法的典型用法代码示例。如果您正苦于以下问题:Python QApplication.processEvents方法的具体用法?Python QApplication.processEvents怎么用?Python QApplication.processEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QApplication
的用法示例。
在下文中一共展示了QApplication.processEvents方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_delete_save
# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import processEvents [as 别名]
def test_delete_save(modeler, mgr, model):
path = "test_delete_save.uamodel"
val = 0.99
modeler.tree_ui.expand_to_node("Objects")
obj_node = mgr.add_folder(1, "myobj")
obj2_node = mgr.add_folder(1, "myobj2")
QApplication.processEvents()
modeler.tree_ui.expand_to_node("myobj2")
var_node = mgr.add_variable(1, "myvar", val)
mgr.save_ua_model(path)
mgr.save_xml(path)
QApplication.processEvents()
modeler.tree_ui.expand_to_node(obj2_node)
mgr.delete_node(obj2_node)
mgr.save_ua_model(path)
mgr.save_xml(path)
assert obj2_node not in mgr.new_nodes
assert var_node not in mgr.new_nodes
示例2: _click_js
# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import processEvents [as 别名]
def _click_js(self, _click_target: usertypes.ClickTarget) -> None:
# FIXME:qtwebengine Have a proper API for this
# pylint: disable=protected-access
view = self._tab._widget
assert view is not None
# pylint: enable=protected-access
attribute = QWebEngineSettings.JavascriptCanOpenWindows
could_open_windows = view.settings().testAttribute(attribute)
view.settings().setAttribute(attribute, True)
# Get QtWebEngine do apply the settings
# (it does so with a 0ms QTimer...)
# This is also used in Qt's tests:
# https://github.com/qt/qtwebengine/commit/5e572e88efa7ba7c2b9138ec19e606d3e345ac90
QApplication.processEvents( # type: ignore[call-overload]
QEventLoop.ExcludeSocketNotifiers |
QEventLoop.ExcludeUserInputEvents)
def reset_setting(_arg: typing.Any) -> None:
"""Set the JavascriptCanOpenWindows setting to its old value."""
assert view is not None
try:
view.settings().setAttribute(attribute, could_open_windows)
except RuntimeError:
# Happens if this callback gets called during QWebEnginePage
# destruction, i.e. if the tab was closed in the meantime.
pass
self._js_call('click', callback=reset_setting)
示例3: start
# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import processEvents [as 别名]
def start(self, text, maximum):
"""Start showing a progress dialog."""
self._progress = QProgressDialog()
self._progress.setMinimumDuration(500)
self._progress.setLabelText(text)
self._progress.setMaximum(maximum)
self._progress.setCancelButton(None)
self._progress.show()
QApplication.processEvents()
示例4: tick
# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import processEvents [as 别名]
def tick(self):
"""Increase the displayed progress value."""
self._value += 1
if self._progress is not None:
self._progress.setValue(self._value)
QApplication.processEvents()
示例5: clear_widgets
# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import processEvents [as 别名]
def clear_widgets(self):
item = self.layout().takeAt(0)
if item:
item.widget().hide()
item.widget().setParent(None)
QApplication.processEvents()
示例6: UpdateSurface
# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import processEvents [as 别名]
def UpdateSurface(self):
''' Update Video Surface only is is stopped or paused '''
if self.parent.playerState in (QMediaPlayer.StoppedState,
QMediaPlayer.PausedState):
self.update()
QApplication.processEvents()
示例7: resizeEvent
# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import processEvents [as 别名]
def resizeEvent(self, _):
"""
@type _: QMouseEvent
@param _:
@return:
"""
self.surface.updateVideoRect()
self.update()
# Magnifier Glass
if self._interaction.magnifier and not self.dragPos.isNull():
draw.drawMagnifierOnVideo(self, self.dragPos, self.currentFrame(), self.painter)
# QApplication.processEvents()
示例8: initProgressbar
# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import processEvents [as 别名]
def initProgressbar(self, maximum):
if self.pb is not None:
self.pb.setValue(0)
self.pb.setMaximum(maximum)
QApplication.processEvents()
示例9: updateProgressbar
# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import processEvents [as 别名]
def updateProgressbar(self):
if self.pb is not None:
self.pb.setValue(self.pb.value() + 1)
QApplication.processEvents()
示例10: _repr_png_
# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import processEvents [as 别名]
def _repr_png_(self):
"""This is used by ipython to plot inline.
"""
app.process_events()
QApplication.processEvents()
img = read_pixels()
return bytes(_make_png(img))
示例11: update
# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import processEvents [as 别名]
def update(self, value):
if self.dialog:
self.dialog.setValue(value)
QApplication.processEvents()
else:
print('Progress: %.2f%% done' % value)
示例12: showMessage
# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import processEvents [as 别名]
def showMessage(self, msg):
"""Show the progress message on the splash image"""
super(SplashScreen, self).showMessage(msg, self.labelAlignment, Qt.white)
QApplication.processEvents()
示例13: clearMessage
# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import processEvents [as 别名]
def clearMessage(self):
"""Clear message on the splash image"""
super(SplashScreen, self).clearMessage()
QApplication.processEvents()
示例14: test_participant_table
# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import processEvents [as 别名]
def test_participant_table(self):
stc = self.form.simulator_tab_controller # type: SimulatorTabController
stc.ui.tabWidget.setCurrentIndex(2)
self.assertEqual(stc.participant_table_model.rowCount(), 0)
for i in range(3):
stc.ui.btnAddParticipant.click()
QApplication.processEvents()
self.assertEqual(stc.participant_table_model.rowCount(), 3)
participants = stc.project_manager.participants
self.assertEqual(participants[0].name, "Alice")
self.assertEqual(participants[1].name, "Bob")
self.assertEqual(participants[2].name, "Carl")
stc.ui.tableViewParticipants.selectRow(1)
stc.ui.btnUp.click()
self.assertEqual(participants[0].name, "Bob")
self.assertEqual(participants[1].name, "Alice")
self.assertEqual(participants[2].name, "Carl")
stc.ui.btnDown.click()
self.assertEqual(participants[0].name, "Alice")
self.assertEqual(participants[1].name, "Bob")
self.assertEqual(participants[2].name, "Carl")
stc.ui.btnDown.click()
self.assertEqual(participants[0].name, "Alice")
self.assertEqual(participants[1].name, "Carl")
self.assertEqual(participants[2].name, "Bob")
示例15: updateSigProgress
# 需要导入模块: from PyQt5.QtWidgets import QApplication [as 别名]
# 或者: from PyQt5.QtWidgets.QApplication import processEvents [as 别名]
def updateSigProgress(self, percent):
messageText = self.messageText + "Signature Progress: <b style='color:red'>" + str(percent) + " %</b>"
self.mBox2.setText(messageText)
QApplication.processEvents()