當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。