So I guess that the same behavior should be expected for consoles:
this is your second solution. However, I'm not sure to understand why
you wrote that it would imply for the user to systematically click on
the console before executing the command: for me, as I understand it,
the user would simply click on the console once, to make it active.
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).
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.
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.
On Tue, Feb 12, 2013 at 12:03 PM, Carlos Córdoba <ccord...@gmail.com> 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.
My bad, it was the easiest thing for me to do at first. Perhaps after solving the previous point, it should fix this one too.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.
Work for 2.3, right? :-) The two consoles are wildly different right now and joining them won't be easy (if feasible at all).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.
I think it could be far more easier: add a signal to the Debug action and button that changes the state of a new console attribute called "debugging".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.
Was running 0de971c2b32dcffbcef1465d612c365b3027838b. Going back to the tagged v2.2.0beta2 works fine. The merge of the ipython improvements (e6ff60e4db575a0625388d6cb0b8daa7e70ef632) causes the breakage .
On Thu, Feb 14, 2013 at 2:32 PM, Steve <steve.f....@gmail.com> wrote:
Was running f28202581fe8. Going back to the tagged v2.2.0beta2 works fine. The merge of the ipython improvements (c3fc28ffbe77) causes the breakage .
Oh. Oops. Disregard those original commits. They are from our git mirror of the hg repo. Updated to reference hg commits below.
On Thursday, February 14, 2013 4:00:22 PM UTC-6, Jed Ludlow wrote:On Thu, Feb 14, 2013 at 2:32 PM, Steve <steve.f....@gmail.com> wrote:
Was running f28202581fe8. Going back to the tagged v2.2.0beta2 works fine. The merge of the ipython improvements (c3fc28ffbe77) causes the breakage .
On Thu, Feb 14, 2013 at 2:32 PM, Steve <steve.f....@gmail.com> wrote:
Was running f28202581fe8. Going back to the tagged v2.2.0beta2 works fine. The merge of the ipython improvements (c3fc28ffbe77) causes the breakage .
Ok, Steve, I can reproduce this if an older version of IPython is installed. My bisecting showed the problem showed up at revision 4adf2d0b5594. Can you confirm that this is the commit that breaks things for you? What version of IPython (if any) do you have installed?
Yeah, things are working great again. I wanted to try out ipython but I can't find the setting in spyder to use it over the regular console for debugging. How do I fix it?
There is a similar problem with the editor plugin: multiple editor
widgets may be visible at the same time, and it should happen more
often than for consoles. The solution with the editor plugin was to
keep track of the last editor widget which had focus. This widget is
considered as the current active widget (e.g. new files will be opened
in that widget).
So I guess that the same behavior should be expected for consoles:
this is your second solution. However, I'm not sure to understand why
you wrote that it would imply for the user to systematically click on
the console before executing the command: for me, as I understand it,
the user would simply click on the console once, to make it active.
-Pierre
That's odd. Which platform? Any trackback?
Ubuntu 12.04 64bits. I will try to get a traceback tonight.
That's odd. Which platform? Any trackback?
--
Ubuntu 12.04 64bits. I will try to get a traceback tonight.