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: Split off part of NotebookPlugin into NotebookTabWidget #283

Merged
merged 20 commits into from
Jun 1, 2020

Conversation

jitseniesen
Copy link
Member

This PR splits the NotebookPlugin class in two parts: one part which handles the tabbed widget and one part responsible for integrating it into Spyder. There should not be any user visible changes.

I used the occasion to do some general clean up, including:

  • Remove some functions that are not used.
  • Remove some convenience functions that were only used in the tests.
  • Add doc strings.
  • Remove code specific to Python 2 or Spyder 3.
  • Add a stand-alone app that can be used to view and edit notebooks.

Fixes #275

This code was left behind when support for Python 2 was dropped.
The code suggests that this function is called when the user moves a tab
in order to keep the list in `self.clients` in the same order as the tabs.
However, as far as I can tell, this function is never actually called,
the order in `self.clients` is not synchronized, and the order is not
actually used.
This is going to be the main widget of the plugin. The idea is that you
can also use this widget independent of Spyder.
I also removed switching to the plugin whenever a tab is added because
I don't see why it is useful: a tab is only added when the user requests it,
in which case the plugin already has focus, or at startup, in which case
the plugin need not get focus.
Also rename the function from create_welcome_tab to maybe_create_welcome_tab
to indicate that the welcome tab is not always created, and change the
example app to create a welcome tab.
Update example app to allow opening new and existing notebooks.
Instead, change the test so that it expects the widget to behave as normal.
The function .currentIndex() works just as well.
The new names better reflects their meaning.
Before, if the user closes a tab with a newly created notebook and
chooses to save it under a different name when prompted, a new tab would
be opened with the new file name. This commit prevents the opening of the
new tab.
QTabbedWidget keeks track of all the tabs so there is no need to duplicate
that in NotebookTabWidget.
@jitseniesen jitseniesen merged commit a0999e8 into spyder-ide:master Jun 1, 2020
@jitseniesen jitseniesen deleted the split-plugin branch June 1, 2020 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move functionality out of NotebookPlugin
1 participant