On Tue, Feb 12, 2013 at 12:03 PM, Carlos Córdoba <[email protected]>wrote:
> Hi, > > I think there are two issues here: > > 1. Select the console to send commands to. > > Right now the logic is very simple: if the ipython console is visible, > send commands there. If not, send commands to the python one. If both are > visible (as in Jed's screenshot), commands are always going to be sent to > the ipython console. > > I agree with Pierre that the best thing to do is properly implement option > 2. This would require to maintain a variable (probably in spyder.py) that > keeps track of the currently focused console (python or ipython). > Or, rather, it would keep track of the last console that had focus since very often the editor will have current focus when a "run" command is issued. > > 2. Decide what happens when the user is debugging and changes focus to > another console. > > @Jed: If the user only changes focus to the editor but don't move to > another console, then (as things are right now) debug commands continue to > be sent to the selected console (could you confirm it?). if that's not the > case, then we must fix it because otherwise it'd be counterintuitive. > Today, all decisions about run commands and debugging control commands are based upon console visibility. So, if two consoles are visible and you change focus to the editor, commands will always go to the IPython console regardless of widget focus today. To get them to enter the other console you have to hide the IPython console. Incidentally, one longer-term solution would be to make it impossible for more than one console to be showing by housing all consoles, both standard Python interpreters and IPython clients, as tabs of the same plugin. Old Spyder was this way. That would eliminate all ambiguity about command direction and require no manual focus setting. I know issue 1053 argues for putting IPython kernels and clients in the same plugin [1], but the more I think about it the kernels are the things that really belong in their own plugin by themselves. Standard Python interpreters and IPython clients seem to be more natural cousins to be housed in the same tab widget given the type of input they receive from the user. > > For the case I mentioned, I think we need to have a variable for each > console to know if it is debugging state or not. This would let us avoid to > send debug commands to non-debugging consoles. > > This will likely require a monkey patch to pdb since it's possible to put a console into debug mode from the command line, and the only way for Spyder to find out about that would be if pdb itself did the notifying. That's not really a good option for external kernels since we can't monkey patch pdb in those. I think we can come to a rational console selection method without having to go there. [1] http://code.google.com/p/spyderlib/issues/detail?id=1053 -- You received this message because you are subscribed to the Google Groups "spyder" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/spyderlib?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
