Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Fix warning and todo action menu entries #9023

Merged
merged 1 commit into from
Mar 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions spyder/plugins/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1535,11 +1535,7 @@ def update_warning_menu(self):
error = 'syntax' in message
text = message[:1].upper() + message[1:]
icon = ima.icon('error') if error else ima.icon('warning')

def slot():
self.switch_to_plugin()
self.load(filename, goto=line_number)

slot = lambda _checked, _l=line_number: self.load(filename, goto=_l)
action = create_action(self, text=text, icon=icon, triggered=slot)
self.warning_menu.addAction(action)

Expand All @@ -1566,11 +1562,7 @@ def update_todo_menu(self):
filename = self.get_current_filename()
for text, line0 in results:
icon = ima.icon('todo')

def slot():
self.switch_to_plugin()
self.load(filename, goto=line0)

slot = lambda _checked, _l=line0: self.load(filename, goto=_l)
action = create_action(self, text=text, icon=icon, triggered=slot)
self.todo_menu.addAction(action)
self.update_todo_actions()
Expand Down Expand Up @@ -1847,6 +1839,12 @@ def load(self, filenames=None, goto=None, word='', editorwindow=None,
end of this method (set to False to prevent keyboard events from
creeping through to the editor during debugging)
"""
# Switch to editor before trying to load a file
try:
self.switch_to_plugin()
except AttributeError:
pass

editor0 = self.get_current_editor()
if editor0 is not None:
position0 = editor0.get_position('cursor')
Expand Down