[Pythoncard-users] component/event support in the codeEditor
by Kevin Altis other posts by this author
Jan 3 2003 8:09PM messages near this date
[Pythoncard-users] slideshow sample updated to use IEHtmlWindow on Windows
|
RE: [Pythoncard-users] component/event support in the codeEditor
I have a modified version of the codeEditor that I'm playing with that I
plan to check into cvs in the next week if I can solve a couple of problems.
See the attached screenshots.
When you edit a Python script such as widgets.py, if there is a
corresponding .rsrc.py file (widgets.rsrc.py) then the codeEditor reads that
file, provides a menu of all the components and when you select a component,
it displays the events for that component.
1. What should the UI be for displaying components and events? Are the
dropdown (Choice) menus fine?
2. How should events that have already been defined be indicated? I don't
think I can do bold in the dropdown menu, so I'm thinking of sticking a + or
* in front of an event that has been defined.
3. Should only the most common events be displayed with an option to display
all events? Another possibility is to display the most common events at the
top of the menu rather than showing all of the events in alphabetical order.
I can't do either of these options without adding special hints to the
supported events for each component, so neither would be in the first
release.
4. The plan for the current code is to find and select an event handler if
it exists, placing the cursor at the end of the line. If an event handler
doesn't exist then a stub would be created. For example, selecting a
component named 'btnSave' and an event named 'mouseClick' would result in a
stub being created
def on_btnSave_mouseClick(self, event):
pass
with the text 'pass' selected so that you can just start typing code if you
want. The view would auto-scroll to show the method.
5. I have to figure out where to place the new handlers. At the beginning or
more likely end of the class is one possibility. I haven't really figured
out the regular expressions/parsing to decide what is what in the source.
Another possibility is to try and group event handlers for a given component
together.
6. I plan to check the modification date/time of the .rsrc.py file during
idle so that changes would automatically be re-loaded. If you were working
in the resourceEditor with the codeEditor open, your component list would
automatically be updated. Other suggestions?
7. Should this be part of the standard codeEditor? Initially, I'll probably
check it in as codeEditor2.py just so I can experiment with it and give
other people a chance to try it without disturbing the stable codeEditory.py
code.
8. On a related note, I'm thinking of making a resourceEditor that combines
the codeEditor, so the events can show up in the Property Editor and the
source code can be displayed in a separate window while you're in the
resourceEditor. I haven't started that yet, but the IDE seems to be what a
lot of people want. This would likely replace the existing resourceEditor.
Feel free to bring up any other issues on this topic here.
ka
Attachments:
components.png
events.png
Thread:
Kevin Altis
Kevin Altis
|