spyder-ide / spyder-notebook

Jupyter notebook integration with Spyder
Other
524 stars 129 forks source link

Use spyder New and Open file options instead of duplicanting for Notebook #134

Open goanpeca opened 6 years ago

goanpeca commented 6 years ago

@spyder-ide/core-developers maybe we should really use the normal open dialog and if the plugin is installed, we should be able (via some api) to ask the user if they want to open as text or as a notebook.

This would really avoid having all this duplicates. We could add an extra thing on the open dialog (but this would require creating a custom Open dialog for each OS) so that we have a checkbox or something that reads, open as text, so that the default is to open as a notebook.

I think no one really opens a notebook as text, so why bother with that? The current UI is very unfriendly :-\ and error prone. Users don't want 2 separate set of menus, open save, and close should be one and only one and act depending on what dock/pane send the request.

dalthviz commented 6 years ago

Just linking this with the discussion at #39 to have reference to some ideas discussed previously.

goanpeca commented 6 years ago

@rlaverde maybe the save, save_as, close, open actions should be global and broadcast the request depending on the active pane, and not get tied up to the editor.

rlaverde commented 6 years ago

Yes, I like it, how this will work? a plugin will implement a method to catch the result of the file?,also some configurations to be used in the dialog? (filters, default dir..)

goanpeca commented 6 years ago

Yeah I guess a plugin should define the methods

def save(self, fpath, filters=None, data={}):
    """"Save method""

def save_as(self, fpath, filters=None, data={}):
    """"Save as method""

def open(self, fpath, data={}):
    """"Open method""

def close(self, fpath, data={}):
    """"Close method""

def close_all(self, fpath, data={}):
    """"Close all method""

where maybe data is some additional info we transmit like what plugin, and maybe some settings, don't know for sure.

Now this still does not solve the issue of Open. Because open should work, no matter which dock /pane is active/selected. Basically the open section should define a set of files and extensions plus the priority so that when a plugin is registered it sets the filters and the priority (? and this is the default?) OR, if several plugins register something the the open dialog needs to have an extra widget injected to derive what plugin should perform the action? (either way we need a default)