cjprecord / editra-plugins

Automatically exported from code.google.com/p/editra-plugins
0 stars 0 forks source link

PyVariable - new tab which allows to set "interesting" variables #188

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What Plugin does this relate to? What version of the Plugin?
PyVariable - using Editra 0.6.48 from SVN

Not a problem but an enhancement request.

When one is debugging something one is often interested in the values of a few 
particular variables.

Currently there is a tab which shows all "locale" and one which shows all 
"global" variables.

It would be really nice to have another tab "Interesting" which allows to 
define variables one is interested in, it would also be nice to be able to 
define a variable for this tab directly from the "locale" or "globale" tabs - 
maybe a context menu.

Original issue reported on code.google.com by wbru...@gmail.com on 4 Jul 2011 at 3:10

GoogleCodeExporter commented 9 years ago
The Expressions shelf allows you to type in variables (or expressions with 
variables in them) - does this do what you want?

Original comment by rans1...@gmail.com on 6 Jul 2011 at 8:58

GoogleCodeExporter commented 9 years ago
Can you tell me if the above ("The Expressions shelf allows you to type in 
variables (or expressions with variables in them") is satisfactory? If it is, I 
will close the ticket.

Original comment by rans1...@gmail.com on 10 Jul 2011 at 10:09

GoogleCodeExporter commented 9 years ago
I had responded to comment 1 but included an image which means it didn't make 
it here, so lets try again.

Just tried it but I must be doing something wrong as the "value" column doesn't 
show anything.

Hopefully the attached picture helps.

Currently I can see pretty quickly whatever is in the locale namespace, but if 
I like to see e.g. the value of "self.btdId" in the above I would have to 
search through the global tab.

PyExpression could work but for some reason it doesn't show me the current 
value of the two variables I defined there.  Am I not using it correctly?

Original comment by wbru...@gmail.com on 10 Jul 2011 at 11:54

Attachments:

GoogleCodeExporter commented 9 years ago
In your picture, the checkboxes to the left of self.btnId and child are not 
selected. Does it work if you select them?

Original comment by rans1...@gmail.com on 10 Jul 2011 at 1:28

GoogleCodeExporter commented 9 years ago
Thanks for following up on this.

Yes, then it works, didn't notice that these where check boxes as each 
time I clicked on them I went into edit mode of the expression, I was 
obviously clicking just a bit to far to the right.

Can I then suggest some enhancements to pyExpression and pyVariable.

- adding an new expression should "check" the check box
- context menu on the pyVariable tabs to add an expression to pyExpression

Werner

Original comment by wbru...@gmail.com on 10 Jul 2011 at 4:59

GoogleCodeExporter commented 9 years ago
I have added the features you asked for into source control. These should 
appear in PyStudio 0.3 (or you can build from source).

1. Adding a new expression "checks" the check box
2. Right click on pyVariable tree item to add a variable to pyExpression (As 
before, double (left) click allows editing the variable value at run time)

If you are happy with this, I will close the ticket.

Original comment by rans1...@gmail.com on 10 Jul 2011 at 8:49

GoogleCodeExporter commented 9 years ago
I get Editra from SVN but don't see how I can force it to get latest 
stuff for plug-ins e.g. PyStudio.  Do
I have to uninstall/install it?

That sounds great, thanks a lot for implementing this.

Werner

Original comment by wbru...@gmail.com on 11 Jul 2011 at 9:30

GoogleCodeExporter commented 9 years ago
No problem.

Plugins come from a different place:

svn checkout http://editra-plugins.googlecode.com/svn/trunk/ editra-plugins

Assuming current working directory is PyStudio, from command prompt:
python setup.py bdist_egg --dist-dir=../

You can then copy the egg to where your plugins folder is, making sure you 
delete the previous one (one built from source will have version 0.3 not 0.2).

Original comment by rans1...@gmail.com on 11 Jul 2011 at 9:43

GoogleCodeExporter commented 9 years ago
got it.

pyExpression works like a charm now - thanks again

pyVariable - the right click doesn't work for me.  Is pyVariable part of 
pyStudio or do I need to upgrade something else?

Have:
- pyStudio 0.3
- Editra SVN rev 68222

While I am at it;-) , any chance one could add a search in pyVariable to 
find a particular one is interested in?

Werner

Original comment by wbru...@gmail.com on 11 Jul 2011 at 10:09

GoogleCodeExporter commented 9 years ago
pyVariable is part of PyStudio (it's the one with locals, globals and 
exceptions sub-shelves). Presuming your have the Expressions and Variables 
shelves both open, you should be able to right click on a variable in the 
variables shelf (eg. a variable in Globals subshelf) and see it appear in the 
Expressions shelf.

I will put the search idea on the TODO list.

Original comment by rans1...@gmail.com on 11 Jul 2011 at 10:39

GoogleCodeExporter commented 9 years ago
Opening Editra, and add the following to the Shelf: pyDebug, 
pyExpression and pyVariable

I then start to debug and go to pyVariable and right click e.g. a global 
variable.  At this point Editra just disappears/crashes without any 
error message.

If I set a breakpoint and then start debug at this point I can right 
click and the variable is getting added to pyExpression.  It is done 
very quietly;-) :-) which is a bit surprising.  What about a status 
message, or a "ding" (also don't like it to much when that is used to 
advise that something has been done).

Would you like me to create a trac item?

Werner

Original comment by wbru...@gmail.com on 11 Jul 2011 at 11:08

GoogleCodeExporter commented 9 years ago
I will add a status message.

No need to add a trac item.

I will look at the crash. If I understand correctly, the distinction between 
your two cases above is that in the former, your program was in some sort of 
loop or in some long running code, not stopped at a breakpoint. You looked at 
variables in the Variable shelf and right clicked one of them and Editra 
crashed. Is that right?

Original comment by rans1...@gmail.com on 11 Jul 2011 at 11:19

GoogleCodeExporter commented 9 years ago
The problem case was not setting any breakpoints and then start a 
wxPython app which basically just shows a wx.frame with a few controls 
and menu items.  At this point right click a variable in the Variable 
shelf and at this point it crashes.

This is on Ubuntu 10.10 with Python 2.6 and wxPython 2.8.12.

Werner

Original comment by wbru...@gmail.com on 11 Jul 2011 at 1:26

GoogleCodeExporter commented 9 years ago
I don't know if this is relevant, but there is an option called Synchronicity. 
The debugger is based on Winpdb and so I ensured that this options is available 
in the settings, but I don't know if it will help. Can you try with Synchronity 
on and with it off? 

It is described in the Winpdb documentation as follows:

        Traditional Python debuggers that use the inspected thread (usually 
        the main thread) to query or modify the script name-space have to 
        wait until the script hits a break-point. Synchronicity allows the
        debugger to query and modify the script name-space even if its 
        threads are still running or blocked in C library code by using 
        special worker threads. In some rare cases querying or modifying data 
        in synchronicity can crash the script. For example in some Linux 
        builds of wxPython querying the state of wx objects from a thread 
        other than the GUI thread can crash the script. If this happens or 
        if you want to restrict these operations to the inspected thread, 
        turn synchronicity off.

        On the other hand when synchronicity is off it is possible to 
        accidentally deadlock or block indefinitely the script threads by 
        querying or modifying particular data structures.

Original comment by rans1...@gmail.com on 11 Jul 2011 at 1:45

GoogleCodeExporter commented 9 years ago
If I un-check "Allow Synchronicity" in the pyStudio/debugger 
configuration tab then no variables are available/shown in the 
pyVariable Shelf.

If it is checked and there is not stopped at breakpoint then I see the 
crash.

Original comment by wbru...@gmail.com on 11 Jul 2011 at 2:01

GoogleCodeExporter commented 9 years ago
I have added the status message when adding variables to the Expressions shelf 
by right clicking.

Can you provide me some code which crashes for you when not stopped at a 
breakpoint? As that description of synchronicity says "For example in some 
Linux builds of wxPython querying the state of wx objects from a thread other 
than the GUI thread can crash the script." I want to see if this happens on 
Windows as well (in which case it probably isn't Synchronicity).

Original comment by rans1...@gmail.com on 11 Jul 2011 at 8:58

GoogleCodeExporter commented 9 years ago
Hi,

I don't think that the way this status update was implemented is the best way 
to do it. It will be rather annoying to have a popup messagebox shown everytime 
you click to add a variable. Also the icon is set to the warning icon when this 
is really an information message.

Would be better to post a simple status bar message. This can be done by either 
posting a message with ed_msg or by getting a handle to the MainWindow and 
calling the PushStatusText method. This way it won't require user interaction 
to acknowledge the event.

Original comment by CodyPrec...@gmail.com on 11 Jul 2011 at 9:02

GoogleCodeExporter commented 9 years ago
Ok Cody, that sounds better. I will change it to use the status bar. 

Werner, can you post code that demonstrates your crash for me to test?

Original comment by rans1...@gmail.com on 12 Jul 2011 at 8:28

GoogleCodeExporter commented 9 years ago
Hi,

Just about any code will do, I attach a simple wxPython script with a frame and 
a button.

Don't set any breakpoint, start it when the frame is shown right click on any 
variable in pyVariable.

Werner

Original comment by wbru...@gmail.com on 12 Jul 2011 at 10:49

Attachments:

GoogleCodeExporter commented 9 years ago
I've checked in the status bar change. 

Original comment by rans1...@gmail.com on 13 Jul 2011 at 8:25

GoogleCodeExporter commented 9 years ago
On Windows you get a popup "Debuggee has to be waiting at a breakpoint to 
complete this command" rather than a crash.

I have put in a fix which prevenst this message appearing in Windows. Can you 
see if it stops your crash in Linux?

You can press the Pause button in the Debug shelf and I have added a refresh 
button to the Expressions shelf to refresh expressions, as for wx apps only 
(strangely), this does not seem to happen automatically when breaking.

Original comment by rans1...@gmail.com on 13 Jul 2011 at 8:31

GoogleCodeExporter commented 9 years ago

Original comment by rans1...@gmail.com on 13 Jul 2011 at 8:57

GoogleCodeExporter commented 9 years ago
- updated pyStudio from SVN and build the egg and copied it to the plugin 
folder the Editra install.

- right click in pyVariable copies/creates entry in pyExpression
- as you can see on the image the value is shown in pyVariable but not in 
pyExpression, pressing the refresh button doesn't change this.

On second test if I set a breakpoint and then look a pyExpression the value is 
show - I assume this is then as expected.

Might be an idea to add a type column to pyExpression tab.

Thanks for all this work.
Werner

Original comment by wbru...@gmail.com on 14 Jul 2011 at 7:55

Attachments:

GoogleCodeExporter commented 9 years ago
The value of the expression will only be shown if the debugger is paused (or 
you've hit a breakpoint). This seems to be a restriction in the rpdb2.py script 
(which is taken from Winpdb).

If you press the Pause button in the Debug shelf after your wx app has 
launched, then refresh your Expression(s) (assuming you've added one or more), 
do you get value(s) shown?

Original comment by rans1...@gmail.com on 14 Jul 2011 at 8:23

GoogleCodeExporter commented 9 years ago
Yes, it does show when debug is paused or when I hit a breakpoint.

Original comment by wbru...@gmail.com on 14 Jul 2011 at 9:11

GoogleCodeExporter commented 9 years ago
Ok, it sounds like this issue is resolved. Let me know if this is ok.

I note your suggestion for a type column which I will add to the TODO list.

Original comment by rans1...@gmail.com on 14 Jul 2011 at 9:47

GoogleCodeExporter commented 9 years ago
I agree that this item is very nicely resolved - thanks again.

Great

Werner

Original comment by wbru...@gmail.com on 14 Jul 2011 at 9:59

GoogleCodeExporter commented 9 years ago

Original comment by rans1...@gmail.com on 14 Jul 2011 at 10:33