當前位置: 首頁>>代碼示例>>Python>>正文


Python PythonMode.stop_script方法代碼示例

本文整理匯總了Python中mu.modes.python3.PythonMode.stop_script方法的典型用法代碼示例。如果您正苦於以下問題:Python PythonMode.stop_script方法的具體用法?Python PythonMode.stop_script怎麽用?Python PythonMode.stop_script使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mu.modes.python3.PythonMode的用法示例。


在下文中一共展示了PythonMode.stop_script方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_python_stop_script_no_runner

# 需要導入模塊: from mu.modes.python3 import PythonMode [as 別名]
# 或者: from mu.modes.python3.PythonMode import stop_script [as 別名]
def test_python_stop_script_no_runner():
    """
    If the script is cancelled before the child process is created ensure
    nothing breaks and the UI is reset.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    pm = PythonMode(editor, view)
    pm.runner = None
    pm.stop_script()
    view.remove_python_runner.assert_called_once_with()
開發者ID:martinohanlon,項目名稱:mu,代碼行數:13,代碼來源:test_python3.py

示例2: test_python_stop_resets_focus

# 需要導入模塊: from mu.modes.python3 import PythonMode [as 別名]
# 或者: from mu.modes.python3.PythonMode import stop_script [as 別名]
def test_python_stop_resets_focus():
    """
    Check that, when a child process is killed, the current
    tab regains focus.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    pm = PythonMode(editor, view)
    mock_runner = mock.MagicMock()
    pm.runner = mock_runner
    pm.stop_script()
    view.current_tab.setFocus.assert_called_once_with()
開發者ID:martinohanlon,項目名稱:mu,代碼行數:14,代碼來源:test_python3.py

示例3: test_python_stop_script

# 需要導入模塊: from mu.modes.python3 import PythonMode [as 別名]
# 或者: from mu.modes.python3.PythonMode import stop_script [as 別名]
def test_python_stop_script():
    """
    Check that the child process is killed, the runner cleaned up and UI
    is reset.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    pm = PythonMode(editor, view)
    mock_runner = mock.MagicMock()
    pm.runner = mock_runner
    pm.stop_script()
    mock_runner.process.kill.assert_called_once_with()
    mock_runner.process.waitForFinished.assert_called_once_with()
    assert pm.runner is None
開發者ID:martinohanlon,項目名稱:mu,代碼行數:16,代碼來源:test_python3.py

示例4: test_python_run_script_needs_saving

# 需要導入模塊: from mu.modes.python3 import PythonMode [as 別名]
# 或者: from mu.modes.python3.PythonMode import stop_script [as 別名]
def test_python_run_script_needs_saving():
    """
    If the file hasn't been saved yet (it's unnamed), prompt the user to save
    it.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    view.current_tab.path = None
    pm = PythonMode(editor, view)
    pm.stop_script = mock.MagicMock()
    pm.run_script()
    editor.save.assert_called_once_with()
開發者ID:martinohanlon,項目名稱:mu,代碼行數:14,代碼來源:test_python3.py

示例5: test_python_run_script_no_editor

# 需要導入模塊: from mu.modes.python3 import PythonMode [as 別名]
# 或者: from mu.modes.python3.PythonMode import stop_script [as 別名]
def test_python_run_script_no_editor():
    """
    If there's no active tab, there can be no runner either.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    view.current_tab = None
    pm = PythonMode(editor, view)
    pm.stop_script = mock.MagicMock()
    pm.run_script()
    assert pm.runner is None
    pm.stop_script.assert_called_once_with()
開發者ID:martinohanlon,項目名稱:mu,代碼行數:14,代碼來源:test_python3.py

示例6: test_python_run_script_uses_editor_save

# 需要導入模塊: from mu.modes.python3 import PythonMode [as 別名]
# 或者: from mu.modes.python3.PythonMode import stop_script [as 別名]
def test_python_run_script_uses_editor_save():
    """The run code uses the common editor save code, invoking
    encoding checks and useful messages
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    view.current_tab.IsModified.return_value = True
    view.current_tab.path = "foo"
    view.current_tab.text = mock.MagicMock(return_value="foo")
    pm = PythonMode(editor, view)
    pm.stop_script = mock.MagicMock()
    pm.run_script()
    editor.save_tab_to_file.assert_called_once_with(view.current_tab)
開發者ID:martinohanlon,項目名稱:mu,代碼行數:15,代碼來源:test_python3.py

示例7: test_python_run_toggle_off

# 需要導入模塊: from mu.modes.python3 import PythonMode [as 別名]
# 或者: from mu.modes.python3.PythonMode import stop_script [as 別名]
def test_python_run_toggle_off():
    """
    Check the handler for clicking run stops the process and reverts the UI
    state.
    """
    editor = mock.MagicMock()
    view = mock.MagicMock()
    pm = PythonMode(editor, view)
    pm.runner = True
    pm.stop_script = mock.MagicMock()
    pm.run_toggle(None)
    pm.stop_script.assert_called_once_with()
    slot = pm.view.button_bar.slots['run']
    assert slot.setIcon.call_count == 1
    slot.setText.assert_called_once_with('Run')
    slot.setToolTip.assert_called_once_with('Run your Python script.')
    pm.view.button_bar.slots['debug'].setEnabled.assert_called_once_with(True)
開發者ID:lordmauve,項目名稱:mu,代碼行數:19,代碼來源:test_python3.py


注:本文中的mu.modes.python3.PythonMode.stop_script方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。