本文整理汇总了Python中qtpy.QtTest.QTest.keyClick方法的典型用法代码示例。如果您正苦于以下问题:Python QTest.keyClick方法的具体用法?Python QTest.keyClick怎么用?Python QTest.keyClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtTest.QTest
的用法示例。
在下文中一共展示了QTest.keyClick方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open_file_in_editor
# 需要导入模块: from qtpy.QtTest import QTest [as 别名]
# 或者: from qtpy.QtTest.QTest import keyClick [as 别名]
def open_file_in_editor(main_window, fname, directory=None):
"""Open a file using the Editor and its open file dialog"""
top_level_widgets = QApplication.topLevelWidgets()
for w in top_level_widgets:
if isinstance(w, QFileDialog):
if directory is not None:
w.setDirectory(directory)
input_field = w.findChildren(QLineEdit)[0]
input_field.setText(fname)
QTest.keyClick(w, Qt.Key_Enter)
示例2: view_set_parameter
# 需要导入模块: from qtpy.QtTest import QTest [as 别名]
# 或者: from qtpy.QtTest.QTest import keyClick [as 别名]
def view_set_parameter(self, param_name, value):
view = self.widget.view()
rect = view.getVisualRectParameterProperty(param_name)
pos = rect.center()
if self.is_multi:
pos -= QPoint(rect.width() / 5, 0)
else:
pos += QPoint(rect.width() / 4, 0)
tree = view.treeWidget().viewport()
QTest.mouseMove(tree, pos)
yield
QTest.mouseClick(tree, Qt.LeftButton, Qt.NoModifier, pos)
yield
editor = QApplication.focusWidget()
QTest.keyClicks(editor, str(value))
QTest.keyClick(editor, Qt.Key_Return)
示例3: test_delete_key_pressed_calls_presenter
# 需要导入模块: from qtpy.QtTest import QTest [as 别名]
# 或者: from qtpy.QtTest.QTest import keyClick [as 别名]
def test_delete_key_pressed_calls_presenter(self):
QTest.keyClick(self.view.close_button, Qt.Key_Delete)
self.assertEquals(self.presenter.close_action_called.call_count, 1)
QTest.keyClick(self.view.close_button, Qt.Key_Delete)
self.assertEquals(self.presenter.close_action_called.call_count, 2)
示例4: test_execute_on_return_press
# 需要导入模块: from qtpy.QtTest import QTest [as 别名]
# 或者: from qtpy.QtTest.QTest import keyClick [as 别名]
def test_execute_on_return_press(self):
with patch('mantidqt.widgets.interfacemanager.InterfaceManager.createDialogFromName') as createDialog:
widget = AlgorithmSelectorWidget()
self._select_in_tree(widget, 'DoStuff v.2')
QTest.keyClick(widget.search_box, Qt.Key_Return)
createDialog.assert_called_once_with('DoStuff', 2)
示例5: test_run_dialog_opens_on_return_press
# 需要导入模块: from qtpy.QtTest import QTest [as 别名]
# 或者: from qtpy.QtTest.QTest import keyClick [as 别名]
def test_run_dialog_opens_on_return_press(self):
with patch(createDialogFromName_func_name) as createDialog:
widget = AlgorithmSelectorWidget()
self._select_in_tree(widget, 'DoStuff v.2')
QTest.keyClick(widget.search_box, Qt.Key_Return)
createDialog.assert_called_once_with('DoStuff', 2)