本文整理汇总了Python中Testing.process_events方法的典型用法代码示例。如果您正苦于以下问题:Python Testing.process_events方法的具体用法?Python Testing.process_events怎么用?Python Testing.process_events使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Testing
的用法示例。
在下文中一共展示了Testing.process_events方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: selectMesh
# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import process_events [as 别名]
def selectMesh(self, w, mesh_type, dim=2, nx=10, ny=10):
path = "/Mesh"
self.clickOnTree(w, path, expand=True, include=True)
self.changeParamTypeCombo(w, path, mesh_type)
self.changeParamValueText(w, path, "nx", str(nx))
self.changeParamValueText(w, path, "ny", str(ny))
self.changeParamCombo(w, path, "dim", "2")
self.saveNodeWidget(w, path)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例2: changeParamValueToggle
# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import process_events [as 别名]
def changeParamValueToggle(self, w, path, value_name, old_path=None):
param_widget = self.getParamWidget(w, path, value_name, old_path)
self.assertNotEqual(param_widget, None)
pos = param_widget.valueTestPosition()
widget = param_widget.valueTestWidget()
QTest.mouseMove(widget, pos)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
QTest.mouseClick(widget, Qt.LeftButton, pos=pos)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例3: saveNodeWidget
# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import process_events [as 别名]
def saveNodeWidget(self, w, path, old_path=None):
node_widget = self.getNodeWidget(w, path, old_path)
self.assertNotEqual(node_widget, None)
apply_button = Testing.findQObjectsByName(node_widget, "apply_button")
self.assertEqual(len(apply_button), 1)
self.assertEqual(apply_button[0].isEnabled(), True)
self.clickButton(apply_button)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
self.assertEqual(apply_button[0].isEnabled(), False)
示例4: setOutput
# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import process_events [as 别名]
def setOutput(self, w, csv=False, exodus=False):
path = "/Outputs"
self.clickOnTree(w, path, expand=True, include=True)
if exodus:
self.changeParamValueToggle(w, path, "exodus")
if csv:
self.changeParamValueToggle(w, path, "csv")
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
self.saveNodeWidget(w, path)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例5: addVariable
# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import process_events [as 别名]
def addVariable(self, w, var_name, include_vars=False, expand_vars=False, include=True):
self.addToNode(w, "/Variables", expand=expand_vars, include=include_vars)
new_path = "/Variables/New0"
if include:
self.clickOnTree(w, new_path, include=True)
self.clickOnTree(w, new_path)
self.changeParamValueText(w, new_path, "name", var_name)
name_path = "/Variables/%s" % var_name
self.saveNodeWidget(w, name_path, new_path)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例6: clickTab
# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import process_events [as 别名]
def clickTab(self, app, tab_name):
peacock_tab_widgets = Testing.findQObjectsByName(app, "PeacockMainWindow/tab_plugin")
self.assertEqual(len(peacock_tab_widgets), 1)
tabs = peacock_tab_widgets[0]
for i in range(tabs.count()):
if tabs.tabText(i) == tab_name:
tab_bar = tabs.tabBar()
rect = tab_bar.tabRect(i)
QTest.mouseMove(tab_bar, rect.center())
QTest.mouseClick(tab_bar, Qt.LeftButton, pos=rect.center(), delay=100)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
return
示例7: setExecutioner
# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import process_events [as 别名]
def setExecutioner(self, w, exe_type, solve_type=None, petsc_iname=None, petsc_value=None, include_exe=False, expand_exe=False):
path = "/Executioner"
self.clickOnTree(w, path, expand=expand_exe, include=include_exe)
self.changeParamTypeCombo(w, path, exe_type)
if petsc_iname:
self.changeParamValueText(w, path, "petsc_options_iname", petsc_iname)
if petsc_value:
self.changeParamValueText(w, path, "petsc_options_value", petsc_value)
if solve_type:
self.changeParamCombo(w, path, "solve_type", solve_type)
self.saveNodeWidget(w, path)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例8: addKernel
# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import process_events [as 别名]
def addKernel(self, w, name, kernel_type, variable, include_kernels=False, expand_kernels=False):
self.addToNode(w, "/Kernels", expand=expand_kernels, include=include_kernels)
new_path = "/Kernels/New0"
if include_kernels:
self.clickOnTree(w, new_path, include=True)
self.clickOnTree(w, new_path)
self.changeParamTypeCombo(w, new_path, kernel_type)
self.changeParamCombo(w, new_path, "variable", variable)
self.changeParamValueText(w, new_path, "name", name)
name_path = "/Kernels/%s" % name
self.saveNodeWidget(w, name_path, new_path)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例9: addBC
# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import process_events [as 别名]
def addBC(self, w, name, variable, boundary, bc_type="DirichletBC", value="0", include_bc=False, expand_bc=False, include=True):
self.addToNode(w, "/BCs", expand=expand_bc, include=include_bc)
new_path = "/BCs/New0"
if include:
self.clickOnTree(w, new_path, include=True)
self.clickOnTree(w, new_path)
self.changeParamTypeCombo(w, new_path, bc_type)
self.changeParamValueText(w, new_path, "name", name)
name_path = "/BCs/%s" % name
self.changeParamValueText(w, name_path, "value", value, new_path)
self.changeParamValueText(w, name_path, "boundary", boundary, new_path)
self.saveNodeWidget(w, name_path, new_path)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例10: clickOnTree
# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import process_events [as 别名]
def clickOnTree(self, w, path, expand=False, include=False):
tree = self.getTreeWidget(w)
item = tree.findPathItem(path)
self.assertNotEqual(item, None)
tree.scrollToItem(item)
tree.setCurrentItem(item)
rect = tree.visualItemRect(item)
viewport = tree.viewport()
pos = rect.center()
if expand or include:
pos = rect.bottomLeft()
pos.setY(pos.y() - rect.height()/2)
if include:
pos.setX(pos.x() + 10)
QTest.mouseMove(tree, pos)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
QTest.mouseClick(viewport, Qt.LeftButton, delay=100, pos=pos)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例11: changeParamTypeCombo
# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import process_events [as 别名]
def changeParamTypeCombo(self, w, path, new_type, old_path=None):
node_widget = self.getNodeWidget(w, path, old_path)
self.assertNotEqual(node_widget, None)
type_combo = Testing.findQObjectsByName(node_widget, "type_combo")
self.assertEqual(len(type_combo), 1)
target = type_combo[0]
QTest.mouseMove(target)
QTest.mouseClick(target, Qt.LeftButton, delay=100)
# Now the selector should pop up which is a QListView
list_views = Testing.findQObjectsByType(target, "PyQt5.QtWidgets.QListView")
self.assertEqual(len(list_views), 1)
lv = list_views[0]
model = lv.model()
matches = model.findItems(new_type)
self.assertEqual(len(matches), 1)
model_idx = model.indexFromItem(matches[0])
rect = lv.visualRect(model_idx)
QTest.mouseMove(lv, pos=rect.center())
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
QTest.mouseClick(lv.viewport(), Qt.LeftButton, pos=rect.center(), delay=100)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例12: changeParamCombo
# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import process_events [as 别名]
def changeParamCombo(self, w, path, value_name, new_value, old_path=None):
param_widget = self.getParamWidget(w, path, value_name, old_path)
self.assertNotEqual(param_widget, None)
pos = param_widget.valueTestPosition()
widget = param_widget.valueTestWidget()
QTest.mouseMove(widget, pos)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
QTest.mouseClick(widget, Qt.LeftButton, pos=pos)
# Now the selector should pop up which is a QListView
list_views = Testing.findQObjectsByType(widget, "PyQt5.QtWidgets.QListView")
self.assertEqual(len(list_views), 1)
lv = list_views[0]
model = lv.model()
matches = model.findItems(new_value)
self.assertEqual(len(matches), 1)
model_idx = model.indexFromItem(matches[0])
rect = lv.visualRect(model_idx)
QTest.mouseMove(lv, pos=rect.center())
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
QTest.mouseClick(lv.viewport(), Qt.LeftButton, pos=rect.center(), delay=100)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例13: changeParamValueText
# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import process_events [as 别名]
def changeParamValueText(self, w, path, value_name, new_text, old_path=None):
param_widget = self.getParamWidget(w, path, value_name, old_path)
self.assertNotEqual(param_widget, None)
pos = param_widget.valueTestPosition()
widget = param_widget.valueTestWidget()
QTest.mouseMove(widget, pos)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
QTest.mouseClick(widget, Qt.LeftButton, pos=pos)
QTest.mouseDClick(widget, Qt.LeftButton, pos=pos)
# The default editing widget on a QTreeWidgetItem is a QLineEdit.
# But it doesn't seem to show up until the item has focus.
# This is pretty brittle but seems to work OK for now.
line_edit = Testing.findQObjectsByType(widget, "PyQt5.QtWidgets.QLineEdit")
for obj in line_edit:
if obj.objectName() == "":
widget = obj
break
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
QTest.keyClick(widget, Qt.Key_Backspace)
QTest.keyClicks(widget, new_text)
QTest.keyClick(widget, Qt.Key_Return)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
示例14: clickButton
# 需要导入模块: import Testing [as 别名]
# 或者: from Testing import process_events [as 别名]
def clickButton(self, button_objs):
self.assertEqual(len(button_objs), 1)
QTest.mouseMove(button_objs[0])
QTest.mouseClick(button_objs[0], Qt.LeftButton, delay=100)
Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)