本文整理匯總了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)