Re: [Boa Constr] Converting a Module to a BoaAp
Status: Beta
Brought to you by:
riaan
From: <ada...@ea...> - 2004-06-14 22:47:07
|
Hi All: Just wanted to let you know how the conversion went: I followed the suggestion to start a new wxApp, rename the objects to match my previous version, then cut and paste the functional pieces. Worked pretty well! So I'm up and running; thanx all. Now, as I continued to develop the app in Boa with the visual designer, I ran into a minor inconstancy relating to the way the new code is inserted into the target app. In some cases widgets like wxTextCtrl, wxPanel, wxFrame, etc the user clicks on a tool bar icon for the widget and drops it into place as a visual object into another visual object using the Designer and the code is inserted into the editor pretty much transparently. Other widgets like dialog boxes, the user clicks on the tool bar icon and, instead of dropping into the designer, the user drops the code directly into the Editor at the location within the code wherever the user deems fit. Understanding the difference between the two types of widget, it makes sense that those which are contained within others get dropped into place in an OBJECT-to-OBJECT mapped way (cognitively speaking) and those that "stand alone" get dropped into place in an OBJECT-to-CODE mapped way. However, it would be nice to get a hint at the tool bar. One way would be to enhance the tool tip hint such that the "map target" is included somehow. Maybe for OBJECT-to-CODE mapped widgets (where xxxwidgetxxx is the widget) the tool tip hint looks something like: xxxwidgetxxx:Editor And for OBJECT-to-OBJECT mapped widgets the tool tip hint might look like: xxxwidgetxxx:Designer Another possibility is to put a little colored triangle in the corner of one type of widgets' tool bar icon and not in the other type's icon. Maybe even both schemes are employed. Anyway, I'm sure there are many other ways to provide a mapping hint but my point is that it would be helpful. (especially to those who are just getting into Boa.) Thanx again for your help. ciao, adam.sys Riaan Booysen wrote: > Hi Adam, > > ada...@ea... wrote: > >> Hi All: >> >> I'm trying to learn Python, wxWindows, wxPython and Boa Constructor >> all at one. Its a little tough but, with help from sample code from >> wxPython Cookbook and other sources, I'm getting the hang of it. >> >> I'm very close to my goal application now but its a Python Module and >> I don't have the cool visual design stuff of boa. Any suggestions on >> how best to convert a Module to proper BoaAp? All my attempts thus >> far just ruins the thing, doesn't seem to take much to botch up the >> works. > > > It's not supposed to be that tricky ;) > > If you create a new empty PythonApp you'll see exactly what is required. > > The module type header comment needs to be at the top of the file. > > Secondly there needs to me a global dictionary named modules, this is > needed for the 'Application' view. > > When you add these requirements to a normal Python Module, you need to > save, close and reopen it for Boa to pick it up as a different file > type. > > As Oleg suggested it's easier to create a new PythonApp and paste into > it. > > > Ok, from Oliver's response I realise you maybe also refering converting > visual GUI code. I agree that this won't work. > Redesign with the Designer, rename controls to match the names in your > code and copy paste the event code. > Those are the steps I usually use for converting GUI code. > > That covers all that could go wrong. > > Cheers, > Riaan. > > |