Ed Leafe wrote:

On Jun 5, 2006, at 5:01 PM, Alex Tweedly wrote:

I have a simple form (one button, one text field). The button has some code in its "OnHit" handler, and I'd like to put a breakpoint in the middle of it. The temp .py file doesn't (afaict) contain the code that I put into the handler, so the line where I want to break at still isn't anywhere visible.


    Whatever you put in the code will be in the temp file.

Got it - there are actually two temporary files - one in the directory where the cdxml file is (called CLASSTEXT.py) and another in the temp directory, and I was looking at the wrong one.

Suggestion: instead of calling it CLASSTEXT.py, called it appname_classtext.py - so the cdxml file is called myproject.cdxml, then the python file will be called myproject_classtext.py ; this would let me have multiple apps in the same directory without stomping over each others' files.

Q: why not put this all in classtext.py ? What's the benefit of having a separate temp file ? Even if there's a benefit in having a separate file - why not make it be a user-chosen name, within the same directory. That way you don't lose it if you clear out your temp directory.


- which may or may not be a fine debugger, but I really wanted to use (for example) the WingIDE debugger which I'm familiar with, and I wanted to insert breakpoints, watched variables, etc. which (I think) means I need visibility into the code within the handlers.


Well, we would love to use Wing, but unfortunately it is proprietary and thus not compatible with integration into Dabo.

You shouldn't need to *integrate* it as a debugger - merely provide a way to get the code somewhere that the debugger can find it, just like any other wxPython app that has its code in Python files.


But from what you're describing, Wing doesn't put breakpoints in the code; it marks internally "Line NN of file XX.py"; that breakpoint never is put into the code. IOW, if you saved the file, there's nothing in there to indicate that there is any breakpoint.

I think the way Wing does it is to have a project file, which is used to store the set of breakpoints (and lots of other things - list of files in the project, cursor position in each file, stat of the windows / GUI, etc.) If you edit the source files within Wing, then it can adjust the breakpoint position accordingly - and if you edit the source files outside Wing, then your breakpoints will "drift".


Essentially then, all I want <grin> is instead of the classtext.py importing a temp file, it should import a file I specify, and auto-bind any events defined within that to the relevant controls. That should be even easier than my earlier suggestion, because it can be done within the classtext.py

Suggestion:
CD has an option setting to say "use external source file" rather than "internal source snippets". When this is enabled, the users must specify (somewhere) the name of the file to be used - and also prevent (or give warning) if the user tried to edit code within CD.

The generated classtext.py will then look like

import dabo
dabo.ui.loadUI("wx")
import dabo.dEvents as dEvents
import sys
# debugging!
import usernamedfile

bindEvents(usernamedfile)

etc.

where bindEvents looks (very vaguely) like

def bindEvents(module):
   for name in dir(module):
       if name[0] == "_": continue
       parts = name.split("_")
       if parts[0] in knownHandlerNames:
           if len(parts) == 2 and parts[1] in regIDList:
                 bind it
# and maybe also allow hierarchically defined names, such as OnHit_page1_button2 which use the Name hierarchy, in addition to the regIDs.



--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.8.1/355 - Release Date: 02/06/2006


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Reply via email to