当前位置: 首页>>代码示例>>Python>>正文


Python QTest.keyClick方法代码示例

本文整理汇总了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)
开发者ID:0xBADCA7,项目名称:spyder,代码行数:12,代码来源:test_mainwindow.py

示例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)
开发者ID:mantidproject,项目名称:mantid,代码行数:18,代码来源:test_functionbrowser.py

示例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)
开发者ID:mantidproject,项目名称:mantid,代码行数:7,代码来源:test_plotselector_view.py

示例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)
开发者ID:DanNixon,项目名称:mantid,代码行数:8,代码来源:test_algorithmselector.py

示例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)
开发者ID:mantidproject,项目名称:mantid,代码行数:8,代码来源:test_algorithmselector.py


注:本文中的qtpy.QtTest.QTest.keyClick方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。