Skip to content
Snippets Groups Projects
Unverified Commit 2d6f20f5 authored by Simon Heybrock's avatar Simon Heybrock Committed by GitHub
Browse files

Merge pull request #23121 from mantidproject/22994_script_progress_indicator

Progress indicator works correctly for errors and exec
parents bc201fac 30977a8b
No related branches found
No related tags found
No related merge requests found
...@@ -232,10 +232,7 @@ class PythonFileInterpreterPresenter(QObject): ...@@ -232,10 +232,7 @@ class PythonFileInterpreterPresenter(QObject):
else: else:
code_str = editor.text() code_str = editor.text()
line_from = 0 line_from = 0
# Pad code out with empty lines so that reported line numbers return code_str, line_from
# do not have to be adjusted
padded = '\n'*line_from + code_str
return padded, line_from
def _on_exec_success(self, task_result): def _on_exec_success(self, task_result):
self.view.editor.updateCompletionAPI(self.model.generate_calltips()) self.view.editor.updateCompletionAPI(self.model.generate_calltips())
...@@ -245,9 +242,9 @@ class PythonFileInterpreterPresenter(QObject): ...@@ -245,9 +242,9 @@ class PythonFileInterpreterPresenter(QObject):
exc_type, exc_value, exc_stack = task_error.exc_type, task_error.exc_value, \ exc_type, exc_value, exc_stack = task_error.exc_type, task_error.exc_value, \
task_error.stack task_error.stack
if hasattr(exc_value, 'lineno'): if hasattr(exc_value, 'lineno'):
lineno = exc_value.lineno lineno = exc_value.lineno + self._code_start_offset
elif exc_stack is not None: elif exc_stack is not None:
lineno = exc_stack[-1][1] lineno = exc_stack[-1][1] + self._code_start_offset
else: else:
lineno = -1 lineno = -1
sys.stderr.write(self._error_formatter.format(exc_type, exc_value, exc_stack) + '\n') sys.stderr.write(self._error_formatter.format(exc_type, exc_value, exc_stack) + '\n')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment