boa-constructor-users Mailing List for Boa Constructor - wxPython GUI Builder
Status: Beta
Brought to you by:
riaan
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
(1) |
Mar
(18) |
Apr
(4) |
May
(17) |
Jun
(14) |
Jul
(18) |
Aug
(3) |
Sep
(30) |
Oct
(16) |
Nov
(11) |
Dec
(9) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(19) |
Feb
(10) |
Mar
(4) |
Apr
(6) |
May
(27) |
Jun
(37) |
Jul
(44) |
Aug
(44) |
Sep
(49) |
Oct
(4) |
Nov
(6) |
Dec
(12) |
| 2002 |
Jan
(27) |
Feb
(22) |
Mar
(48) |
Apr
(21) |
May
(20) |
Jun
(6) |
Jul
(33) |
Aug
(34) |
Sep
(9) |
Oct
(41) |
Nov
(14) |
Dec
(35) |
| 2003 |
Jan
(75) |
Feb
(75) |
Mar
(59) |
Apr
(22) |
May
(18) |
Jun
(36) |
Jul
(50) |
Aug
(106) |
Sep
(71) |
Oct
(63) |
Nov
(81) |
Dec
(58) |
| 2004 |
Jan
(48) |
Feb
(42) |
Mar
(57) |
Apr
(64) |
May
(81) |
Jun
(30) |
Jul
(15) |
Aug
(39) |
Sep
(56) |
Oct
(61) |
Nov
(27) |
Dec
(20) |
| 2005 |
Jan
(74) |
Feb
(62) |
Mar
(237) |
Apr
(83) |
May
(138) |
Jun
(132) |
Jul
(61) |
Aug
(51) |
Sep
(17) |
Oct
(22) |
Nov
(59) |
Dec
(32) |
| 2006 |
Jan
(7) |
Feb
(7) |
Mar
(24) |
Apr
(15) |
May
(19) |
Jun
(46) |
Jul
(26) |
Aug
(51) |
Sep
(35) |
Oct
(90) |
Nov
(27) |
Dec
(23) |
| 2007 |
Jan
(22) |
Feb
(17) |
Mar
(14) |
Apr
(28) |
May
(38) |
Jun
(44) |
Jul
(34) |
Aug
(40) |
Sep
(29) |
Oct
(44) |
Nov
(16) |
Dec
(15) |
| 2008 |
Jan
(12) |
Feb
(37) |
Mar
(48) |
Apr
(35) |
May
(37) |
Jun
(32) |
Jul
(30) |
Aug
(28) |
Sep
(33) |
Oct
(19) |
Nov
(44) |
Dec
(45) |
| 2009 |
Jan
(30) |
Feb
(16) |
Mar
(48) |
Apr
(56) |
May
(100) |
Jun
(4) |
Jul
(1) |
Aug
|
Sep
|
Oct
(7) |
Nov
|
Dec
(3) |
| 2010 |
Jan
(8) |
Feb
(3) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(6) |
Nov
(22) |
Dec
|
| 2011 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(2) |
Dec
(1) |
| 2012 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2013 |
Jan
(5) |
Feb
(1) |
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
1
|
2
|
3
|
4
|
5
|
6
|
7
(3) |
|
8
|
9
(2) |
10
(1) |
11
|
12
|
13
|
14
|
|
15
|
16
|
17
|
18
|
19
|
20
|
21
|
|
22
|
23
|
24
|
25
|
26
|
27
|
28
|
|
29
|
30
|
|
|
|
|
|
|
From: Bakki K. <ba...@na...> - 2001-04-10 16:45:37
|
I see that the container (tool bar) ends up in a different position than where its contents (tool buttons). For example I created a frame, a menubar and then a tool bar. WHile the visible tool bar and its buttons end up at the expected postion just under the menubar, I don't see it in the Inspector until I click in the invisible tool bar somewhere else in the window. Once I hit the toolbar it appears with its border handles which I can use to resize and move but it never stays where I put it nor exactly coincide with the visible tool bar. After adding a splitter window beneath the toolbar is inaccessible for editing. Has anyone seen this sort of behavior? -bakki -- .-. | Bakki Kudva__________________Open Source EDMS______ oo| | Navaco ph: 814-833-2592 /`'\ | 420 Pasadena Drive fax: 603-947-5747 (\_;/) | Erie, PA 16505 http://www.navaco.com/ |
|
From: Riaan B. <riaan@e.co.za> - 2001-04-09 23:22:33
|
Hi Mike, thanks for the contribution, it's now integrated with Boa
and accesible from the 'New' palette page.
To expand the COM support in Boa I've added Acrobat and IE as examples.
I have not automated the process and there is some manual work to get
a COM control integrated in Boa.
Like other controls you have to write a Companions class for the
COM control. See Companions.ComCompanions for examples. Additionally
you have to write a thin wrapper for the ActiveX control itself, this
makes it look more like a normal control to Boa and allows it better
integrate with current machinery. This could be automated.
See bcrtl.activex.acrobat and bcrtl.activex.IE for details.
Note that for IE I have added code which translate the Python COM
events to wxWindows events so that they may be defined in the Inspector.
This was a mechanical process and could definitely be automated as well.
This is a first draft at COM support and everything may still change.
COM properties aren't supported yet.
Note that now for the first time Boa needs to have a run time library.
Before, all code was generated to run on wxPython libraries but the
extra COM control layer needs to be accessible to your generated source.
For now I've decided to place this run time library under wxPython.lib.
If you wrap a COM control, the new module must be placed under here.
e.g. wxPython.lib.bcrtl.activex.acrobat.
This will also apply to any new control you wish to add to Boa which
is not part of the wxPython distribution. Place these controls modules
under wxPython.lib.bcrtl.user.
One problem may me wxPython's very aggresive uninstaller which
deletes everything under the wxPython directory.
For deployment I think Boa should also be able to generate source that
uses components defined in the application's own directory.
Also in this direction, Boa should make it much easier to to use
visual objects defined in an application, but for which there is no
associated Companion (defining design time logic).
Boa should simply handle such objects as their base classes, e.g
wxListCtrl or wxStaticText or whatever.
I've put in a check so that Boa automatically creates/copies these
files if they do not exist on startup.
There is also an option in Preferences.py, blockCOM which is on by
default (because of the crasing under win9x). Turn off the block to
enable COM.
"Mike C. Fletcher" wrote:
>
> I wanted to play around with Boa as an IDE a little more, so I decided I'd
> make a MakePy dialog for it (a Win32COM thing that lets you auto-generate
> wrappers for COM controls). It's slightly more advanced than the dialog in
> PythonWin, as it lets you search for libraries. This isn't particularly
> beautiful, but it does seem to work. Eventually you'd want to create
> Design-time controls and options on the design palette for each wrapped
> control (maybe even scanning the gen_py directory for controls generated by
> other systems), but for now it's just a "tell it to generate a wrapper"
> dialog.
One problem at the moment is that it generates different type libraries
than the EnsureModule call that is used when ActiveX controls are used
in wxPython. If the library is generated from the Dialog, the controls
no longer work in wxPython. (Test this with the demo).
I believe that the EnsureModule behavior should be the default
behaviour. It also generates the methods which it useful.
Can you change your dialog to work like this?
>
> Thoughts that have arisen as I worked:
> An option for PythonWin key bindings would be nice (is there a way to
> plug-in whole key-binding sets with minimal fuss?).
See PrefsKeys, I believes this meets your requirements.
> Block indent/dedent mapped to tab/shift-tab is very useful
To use Tab for indent dedent was one of the few keys that could not
be mapped from PrefsKeys because the keys in PrefsKeys are bound with
an accelerator table and when a key is bound in a table, it does not
generate key events in the control anymore (which I needed)
I've duplicated the logic in the Indent/Dedent methods so the key
tab is no longer needed and tab/shift tab indenting now works.
I'm not convinced this should be default tho.
> Block-comment/uncomment mapped to Alt-3, Alt-4 is nice
> Ctrl-G mapped to Goto
Goto what? Line number?
> Option for tab-preservation/conversion wasn't immediately obvious in the
> interface, possibly in the preferences.
Boa is rather harsh in this respect. No tabs preserved. As the style
guide says 4 space tab levels, this is enforced.
> Tools to tabify/untabify source are needed.
Running Edit->Reindent whole file will remove all tabs and correct
a few other things, this is non reversable.
> Auto-complete windows a-la PythonWin are very helpful (for me anyway).
There is limited auto-complete support, pressing control space after
'self.' will bring up a list of all methods/attribute for that object
defined in the current module. wxPython object decendants brings
up a list of all methods in the wxPython libraries.
Ctrl-Space without 'self.' in a class will bring up the entire wxPython
namespace.
Shift-Space for parameter tips, but there is very little support here.
Note that sometimes you'll have to refresh your code (Ctrl-R)
(so the source is reparsed) before the code completion box will appear.
> Might be nice to have an option that makes the "interface" text get wrapped
> in _( ) for internationalisation (or whatever the standard is), with the
> files generated for translators on the side.
Yes this seems like a good idea, I have no experience with this and
if someone gives me the exact requiremnets I'll look into implementing
it.
> The trace/error window doesn't appear until the client process completes
> and doesn't seem to update if I have to kill the client process. Makes it
> hard to use with mis-behaving apps.
I'm at the mercy of popen2 here, sometimes you get output when you nuke
an app or it crashes, sometimes you don't, suggestions would be welcome.
Another painful fact is that both wxProcess and popen blocks if they
run a GUI application and only writes to their output and error streams
after the app terminates, I know of no workarounds. wxProcess also has
other problems when spawning GUI applications.
> Option in the inspector to auto-generate shortcuts would be cool.
> Would be good to have option to auto-generate a test-harness application
> for dialogs/frames. See the attached for a simplistic harness.
Such a feature is already part of Boa. On the Source View select
Edit -> Add simple app. Not this this applies only to wxFrames at the
moment, for Dialogs the code has to be a little different. I will
still fix this.
This is the code that should be added for Dialogs:
if __name__ == '__main__':
app = wxPySimpleApp()
dlg = create(None)
try:
dlg.ShowModal()
finally:
dlg.Destroy()
Destoying the dialog is not strictly necessary as the process will
always terminate after ShowModal...
Ok, I've just fixed it so that Dialogs get the above code.
Model.getSimpleRunnerSrc() now returns the runner code for the
module type.
Intersting question is what should a normal python module get here?
For now the following lines are added to plain python scripts:
if __name__ == '__main__':
pass # add a call to your main function here
>
> Module attached, enjoy yourselves,
> Mike
Thanks for the code and feedback,
>
> __________________________________
> Mike C. Fletcher
> Designer, VR Plumber
> http://members.home.com/mcfletch
>
> ------------------------------------------------------------------------
> Name: makepydialog.py
> makepydialog.py Type: Plain Text (text/plain)
> Encoding: quoted-printable
--
Riaan Booysen
___________________________________________________
Boa Constructor - RAD GUI building IDE for wxPython
http://boa-constructor.sourceforge.net
|
|
From: Riaan B. <riaan@e.co.za> - 2001-04-09 23:08:36
|
Hi Mike, thanks for the comments, "Mike C. Fletcher" wrote: > > Hi all, > > I've been playing with Boa (from the CVS) for a few days now, working on > building a whole slew of dialogues for a wxPython app I'm behind on. > Overall I'm impressed. The dialogue building is going well, and it's saving > me some serious time. The following is a list of the nits I've run across > so far. I'm using Boa primarily as a GUI layout system, rather than as an > actual IDE, so most comments will focus on the design window. > > 1) Need a way to specify a particular ID for a given button (particularly > need wxID_OK and wxID_CANCEL so that we can get automatic OK/Cancel > behaviour in dialogues. Potentially include OK/Cancel buttons explicitly in > the buttons toolbar as well (still need the ability to specify). I was not aware (or have forgotten) about this behaviour of buttons. Boa should support it. It might be a little tricky because the parent and id parameters are automatically managed internally by Boa and regenerated the whole time. I will look into this. > > 2) Inspector's Event Handler Definition needs ability to specify a > non-default name for the method Yes, I intend to do this soon. The wxChoice in the Inspector will change to a wxComboBox where you may edit the method name. Note that you can change the name at the moment by just renaming it in the source in 2 places, the EVT_* binding and the method name in the class. Boa will respect such changes. > > 3) Inspector's "checkmark to expand options" is not intuitive, possibly use > an owner-drawn icon instead? How intuitive does a boolean control need to be ? ;) I would prefer an small white boxed image of a + and - like in Delphi, but this is low priority for me at the moment. > > 4) Option for auto-expansion of the editing window when not showing the > designer would help with editing. Would likely require adding the "new" > toolbar as a menu in the editor. Alternate window layouts with, for > instance, a "design window" set and a "code editing" set might be useful. The problem with this is that Boa is not in just one state at any given time. You may have 5 frame modules of which 2 have Designers open. Best you would probably be to have the editor window at full width and to show and hide the inspector when needed. There are shortcut keys which will save you time, F11 brings up the Inspector, F12 switches between the Designer and the Editor. This works quite well. > > 5) Would be nice to have drag-and-drop functionality for the widgets. (i.e. > drag from the toolbar to the design window). I prefer the Delphi way, so this is very low priority for me. Patches are welcome to make this an optional feature. > > 6) How do you add new items to the list of available widgets (sub-classes, > entirely new classes, etceteras)? There are many many examples ;) I will add an 'Extending Boa Constructor' section to the Help when I have time. Basically you need to do the following: * Define a Companion class that mirrors the component that you want to wrap; Constructor, events, extra properties, style flags, etc. See code for details. * Define new Property Editors if necessary. * Register the component and companion with the Palette. See bottom of Companion modules for examples * Add a 24x24 bitmap for the component to the Images/Palette and Images/Palette/Gray directories. The one in the Gray dir should have a gray background while the other should have a magenta background. * Restart Boa I've just refactored the Palette code a bit so that registering should be simpler. I've also added the module Companions.UserCompanions to which you should add your own companions. As another self contained example I've wrapped wxCalendarCtrl, but it's not yet on the Palette by default as there are still some problems. To enable it remove the comment in line 78 in Companions.UserCompanions. Please take a look at the calendar code in Companions.UserCompanions. There is also a Property Editor example. > > 7) For a text control, altering "label" in the properties panel changes the > control value, but doesn't alter the "value" attribute in the construction > panel. (Reverse does work). It's a more general problem where changing one property affects another but Boa can not know this unless it is explicitly coded. I do handle some properties and will cover them all as time goes by. > > 8) I couldn't find a "test dialog" function anywhere, i.e. run the dialog > using run-time controls and report each event/call/etceteras generated by > user interactions. Not sure if I just missed it, but it's a really useful > feature for figuring out what's going on. There is no test dialog function as such, but "Edit -> Add simple app" comes close. It adds a code to the module which creates the frame and a wxPySimpleApp(). Now run the module with the Blue arrow (F10/Run module) > > 9) Events panel of the inspector should likely use something other than > "small list" style. Because the names are touching the edges it looks as > though scrolling only lets you see the "Event" text rather than showing > entirely new event classes. A downward-scrolling list gives a better "feel" > that there's more items to see. The scrollbar which appears on downward scrolling list controls took too much horizontal space on lower resolutions for my taste, that's why it's small list style. Maybe I should make this a preference? > > 10) Default editor font for windows is very large on my machine, not sure > why that is, I'm running a 1152x864 resolution, font looks to be about 15 or > 16 point. It's changeable, of course, but a smaller default might be > reasonable. Seems fine to me. Can you look at the screenshots on the boa web site and tell me if your font is bigger than what I see? > > 11) A wxWindow option should be available in the Containers/Layout toolbar. > (Or see #6) Ok, I've added it. > > 12) Could really use "nudge" key bindings for the design window. i.e. the > arrow keys nudge the selection 1 pixel or grid-point in their appropriate > direction. This is already done. Ctrl-Cursor keys moves the current selection in the Designer in 1 pixel increments. Shift-Cursor sizes it. > > 13) Would suggest that when grid mode is on that new items be sized in > increments of the grid Grid mode is purely a visual setting. You can set the size in Views.SelectionTags.screenGran. Controls are already sized in the increments of the grid. > > 14) Sequence: Create dialog, Add Button, Add Button, Delete Button, Delete > Button --> crashes (consistently) Not for me. You may try to identify where it happens. Run Boa with command-line param -T until it crashes (try crash it as soon as possible as this trace file grows VERY quickly. After crashing restart Boa normally and while on the Application view of the Boa.py file, select "Edit -> View tracelog as traceback". This may churn for quite a while (there are limits you can set in ErrorStack.py for the impatient) and will then show a traceback of where Boa crashed. > > 16) Having menus on a "nested" window (i.e. the edit window) instead of at > the top of the screen is "counter-experiential" (unfamiliar/breaks habits) > for most GUI users. That is the way it works ;) The Editor is the IDE (all menu/toolbar actions apply to the Editor, not the Palette). The Palette could conceivably be optionally hidden when Boa is used more as an IDE than a GUI builder. All I can say is please get used to it. > > 17) Having an option to use a single top-level window which always restores > a "window set" of the IDE would be useful (versus having to click 3 separate > windows to get "back to Boa"). On windows I think this is possible to do with Activate events. Would it suffice if the Palette raised the Editor and Inspector when it's activated? > > 18) Sizer support would be a nice feature. wxDesigner is cool, but still > awkward for doing lots of dialogues. When I can figure out how to integrate Sizers into the current architechture I will. In the meanwhile Anchors can cover some of your layout needs. > > 19) Icon editor or file drag-and-drop or image cut-and-paste would be useful > for editing icon attributes. Open for patches/contributions. > > 20) Colour editor should use the "full dialogue" to allow for defining > non-16-colour palette colours. Ok done, this was just a setting on the ColourDialog I had to set. Docs says it should be on by default. > > 21) Colour fields in the inspector should paint themselves the appropriate > colour or contain the "text" of the colour e.g. FFFFFF or 255,255,255 or > 1.0,1.0,1.0 (preferably a standardised representation, of course) on the > colour (text colour = (255 & (colour.Red()+128)), (255 & > (colour.Green()+128)), (255 & (colour.Blue()+128))). I agree and have wanted to do this, and in general improve property editors, but have not had time yet. > > Okay, must be off now. Keep up the good work and enjoy yourselves, > Mike Thanks again for all the feedback! > > __________________________________ > Mike C. Fletcher > Designer, VR Plumber > http://members.home.com/mcfletch > > _______________________________________________ > Boa-constructor-users mailing list > Boa...@li... > http://lists.sourceforge.net/lists/listinfo/boa-constructor-users -- Riaan Booysen ___________________________________________________ Boa Constructor - RAD GUI building IDE for wxPython http://boa-constructor.sourceforge.net |
|
From: Mike C. F. <mcf...@ho...> - 2001-04-07 20:32:39
|
Hi Riaan, Thanks for the reassurance (and the work) :) . I didn't realise there was a requirement to bind it in PrefsKeys. As for the long file comment, it was more a "Oh my God, I'll never figure it out" comment, not a "don't do that" comment. I'm not a programmer by profession, so big blocks of code written by someone else always seem daunting to me :) . I wanted to know if there's more dragons waiting in the wings to make me feel inadequate :o) . Enjoy, Mike -----Original Message----- From: Riaan Booysen [mailto:riaan@e.co.za] Sent: Saturday, April 07, 2001 16:00 To: Mike C. Fletcher Cc: Boa Constructor (E-mail) Subject: Re: [Boa Constr] Tab-key in PySourceView ... Did you also binf it in PrefsKeys.py ? I've explained this in my other message, in short; If a key is bound to an accelerator table, it does not generate further events for the control. ... Be fair, it's a 1280 line file (50k), and there 7 source files in the distribution bigger than 45k. My usual rule of thumb is to not let a file get longer than 1000 lines, although there are a few. ... |
|
From: Riaan B. <riaan@e.co.za> - 2001-04-07 19:57:09
|
Hi Mike, this is a quick note just to let you know I am here but still busy with the replies to your (and others') previous messages. I've addressed some of your issues and fixed bugs that have been reported since the release and hope to post the replies (and CVS) tonight. I've added tab, shift-tab/indent, dedent support. "Mike C. Fletcher" wrote: > > Hi all, looking at the tab-key handler in PySourceView (line 984), it could > use some enhancements. These are patterned after the PythonWin interactions > (IDLE too if I recall), and make the indent/dedent operations with the tab Idle uses Ctrl-] and Ctrl-[ (Which can't be bound to an accelerator table) > key much more natural feeling. > > My attempts to integrate the changes have failed. I can't seem to get the > PySourceView to actually use my modified function (so I haven't actually > tested it to see if it works). Although the OnKeyDown method appears like > the correct customisation point, it doesn't actually seem to get called. Did you also binf it in PrefsKeys.py ? I've explained this in my other message, in short; If a key is bound to an accelerator table, it does not generate further events for the control. > > tab -- should be translated to an indent command if within the leading > whitespace of the line and there's no selection > shift-tab -- should be translated to a dedent command if within the leading > whitespace of the line and there's no selection > if there is a multi-line selection, then both indent and dedent (tab and > shift-tab) should operate on the selection. > > Are there a lot of these 2600 line files around? > Mike Be fair, it's a 1280 line file (50k), and there 7 source files in the distribution bigger than 45k. My usual rule of thumb is to not let a file get longer than 1000 lines, although there are a few. > > 8<___________ PySourceView line 984 + > # Tabbed indent > elif key == 9: > print 'tab key' > # revised tab semantics mcfletch 2001 > if event.ShiftDown(): > print 'shift down' > # is a dedent request > self.OnDedent(event) > else: > # is likely an indent request > # will consider it an ident request if we're actually > # in the indentation section or we have a non-null selection > # set... > # selection set? > start, stop = self.GetSelection() > pos = self.GetCurrentPos() > startPosition = > self.GetLineStartPos(self.GetLineFromPos(pos)) > line = self.GetLineFromPos(pos) > prefix = string.strip(line[:(pos-startPosition)]) > def updatePosition( self, position ): > if old_stc: > self.SetCurrentPosition(position) > else: > self.SetSelectionStart(pos + indentLevel) > if (start == stop): > # is a tab-key in the indentation section, > # update the indentation to be one level deeper... > if prefix: > # there is a non-whitespace character in front of > position, > # insert an actual tab character > self.InsertText(pos, '\t') > updatePosition( self, pos + 1 ) > else: > # do an indent by inserting some whitespace > self.InsertText(pos, indentLevel*' ') > updatePosition( self, pos + indentLevel ) > else: > # non-null selection set... > self.OnIndent(event) > if not self.AutoCompActive(): return > > __________________________________ > Mike C. Fletcher > Designer, VR Plumber > http://members.home.com/mcfletch > > _______________________________________________ > Boa-constructor-users mailing list > Boa...@li... > http://lists.sourceforge.net/lists/listinfo/boa-constructor-users -- Riaan Booysen ___________________________________________________ Boa Constructor - RAD GUI building IDE for wxPython http://boa-constructor.sourceforge.net |
|
From: Mike C. F. <mcf...@ho...> - 2001-04-07 06:49:09
|
Hi all, looking at the tab-key handler in PySourceView (line 984), it could
use some enhancements. These are patterned after the PythonWin interactions
(IDLE too if I recall), and make the indent/dedent operations with the tab
key much more natural feeling.
My attempts to integrate the changes have failed. I can't seem to get the
PySourceView to actually use my modified function (so I haven't actually
tested it to see if it works). Although the OnKeyDown method appears like
the correct customisation point, it doesn't actually seem to get called.
tab -- should be translated to an indent command if within the leading
whitespace of the line and there's no selection
shift-tab -- should be translated to a dedent command if within the leading
whitespace of the line and there's no selection
if there is a multi-line selection, then both indent and dedent (tab and
shift-tab) should operate on the selection.
Are there a lot of these 2600 line files around?
Mike
8<___________ PySourceView line 984 +
# Tabbed indent
elif key == 9:
print 'tab key'
# revised tab semantics mcfletch 2001
if event.ShiftDown():
print 'shift down'
# is a dedent request
self.OnDedent(event)
else:
# is likely an indent request
# will consider it an ident request if we're actually
# in the indentation section or we have a non-null selection
# set...
# selection set?
start, stop = self.GetSelection()
pos = self.GetCurrentPos()
startPosition =
self.GetLineStartPos(self.GetLineFromPos(pos))
line = self.GetLineFromPos(pos)
prefix = string.strip(line[:(pos-startPosition)])
def updatePosition( self, position ):
if old_stc:
self.SetCurrentPosition(position)
else:
self.SetSelectionStart(pos + indentLevel)
if (start == stop):
# is a tab-key in the indentation section,
# update the indentation to be one level deeper...
if prefix:
# there is a non-whitespace character in front of
position,
# insert an actual tab character
self.InsertText(pos, '\t')
updatePosition( self, pos + 1 )
else:
# do an indent by inserting some whitespace
self.InsertText(pos, indentLevel*' ')
updatePosition( self, pos + indentLevel )
else:
# non-null selection set...
self.OnIndent(event)
if not self.AutoCompActive(): return
__________________________________
Mike C. Fletcher
Designer, VR Plumber
http://members.home.com/mcfletch
|