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 unable to split editor #5083

Merged
Merged
Show file tree
Hide file tree
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
12 changes: 7 additions & 5 deletions spyder/plugins/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ def register_editorstack(self, editorstack):
self.set_last_focus_editorstack(self, editorstack)
editorstack.set_closable( len(self.editorstacks) > 1 )
if self.outlineexplorer is not None:
editorstack.set_outlineexplorer(self.outlineexplorer)
editorstack.set_outlineexplorer(self.outlineexplorer.explorer)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix Issue 1

Copy link
Member

@ccordoba12 ccordoba12 Sep 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was my bad in a refactoring I did some months ago. Thanks for catching it.

editorstack.set_find_widget(self.find_widget)
editorstack.reset_statusbar.connect(self.readwrite_status.hide)
editorstack.reset_statusbar.connect(self.encoding_status.hide)
Expand Down Expand Up @@ -1472,13 +1472,15 @@ def get_filename_index(self, filename):
def get_current_editorstack(self, editorwindow=None):
if self.editorstacks is not None:
if len(self.editorstacks) == 1:
return self.editorstacks[0]
editorstack = self.editorstacks[0]
else:
editorstack = self.__get_focus_editorstack()
if editorstack is None or editorwindow is not None:
return self.get_last_focus_editorstack(editorwindow)
return editorstack

editorstack = self.get_last_focus_editorstack(editorwindow)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix Issue 3

if editorstack is None:
editorstack = self.editorstacks[0]
return editorstack

def get_current_editor(self):
editorstack = self.get_current_editorstack()
if editorstack is not None:
Expand Down
10 changes: 6 additions & 4 deletions spyder/widgets/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,12 @@ def add_corner_widgets_to_tabbar(self, widgets):
def closeEvent(self, event):
self.threadmanager.close_all_threads()
self.analysis_timer.timeout.disconnect(self.analyze_script)

# Remove editor references from the outline explorer settings
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix Issue 2

if self.outlineexplorer is not None:
for finfo in self.data:
self.outlineexplorer.remove_editor(finfo.editor)

QWidget.closeEvent(self, event)
if is_pyqt46:
self.destroyed.emit()
Expand Down Expand Up @@ -2012,10 +2018,6 @@ def create_new_editor(self, fname, enc, txt, set_current, new=False,
editor.zoom_out.connect(lambda: self.zoom_out.emit())
editor.zoom_reset.connect(lambda: self.zoom_reset.emit())
editor.sig_eol_chars_changed.connect(lambda eol_chars: self.refresh_eol_chars(eol_chars))
if self.outlineexplorer is not None:
# Removing editor reference from outline explorer settings:
editor.destroyed.connect(lambda obj=editor:
self.outlineexplorer.remove_editor(obj))

self.find_widget.set_editor(editor)

Expand Down
1 change: 0 additions & 1 deletion spyder/widgets/editortools.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,6 @@ def activated(self, item):
parent = self.current_editor.parent()
for editor_id, i_item in list(self.editor_items.items()):
if i_item is root_item:
#XXX: not working anymore!!!
for editor, _id in list(self.editor_ids.items()):
if _id == editor_id and editor.parent() is parent:
self.current_editor = editor
Expand Down