Merged wxPython 2.4.x to the 2.5 branch (Finally!!!)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19793 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-03-25 06:35:27 +00:00
parent 9b4e3f352b
commit 1e4a197e4c
586 changed files with 62691 additions and 17740 deletions

View File

@@ -11,11 +11,11 @@
import time
Month = {2: 'February', 3: 'March', None: 0, 'July': 7, 11:
'November', 'December': 12, 'June': 6, 'January': 1, 'September': 9,
'August': 8, 'March': 3, 'November': 11, 'April': 4, 12: 'December',
'May': 5, 10: 'October', 9: 'September', 8: 'August', 7: 'July', 6:
'June', 5: 'May', 4: 'April', 'October': 10, 'February': 2, 1:
'January', 0: None}
'November', 'December': 12, 'June': 6, 'January': 1, 'September': 9,
'August': 8, 'March': 3, 'November': 11, 'April': 4, 12: 'December',
'May': 5, 10: 'October', 9: 'September', 8: 'August', 7: 'July', 6:
'June', 5: 'May', 4: 'April', 'October': 10, 'February': 2, 1:
'January', 0: None}
# Number of days per month (except for February in leap years)
mdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

View File

@@ -191,7 +191,7 @@ class wxPyNonWindowingErrorHandler:
self.file = file
def write(self,s):
import sys
if string.find(s,"Warning") <> 0\
if s.find("Warning") <> 0\
and self.this_exception is not sys.last_traceback:
wxPyNonWindowingError("The Python interpreter encountered an error "
"not handled by any\nexception handler--this "
@@ -276,10 +276,10 @@ class wxPythonRExec (rexec.RExec):
class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
this_exception = 0
populate_function = populate_wxPyNonFatalErrorDialogWithTraceback
no_continue_button = false
fatal = false
modal = true
exitjustreturns = false # really only for testing!
no_continue_button = False
fatal = False
modal = True
exitjustreturns = False # really only for testing!
def __init__(self, parent, id,
pos=wxPyDefaultPosition,
@@ -293,7 +293,7 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
caption="Python error!",
versionname=None,
errorname=None,
disable_exit_button=false):
disable_exit_button=False):
if self.fatal:
whetherNF = ""
@@ -309,7 +309,7 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
wxDialog.__init__(self, parent, id, title, pos, size, style)
self.topsizer = self.populate_function( false,true )
self.topsizer = self.populate_function( False,True )
self.SetProgramName(programname)
self.SetVersion(version)
@@ -332,10 +332,10 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
if not disable_mail_button:
EVT_BUTTON(self, wxPyError_ID_MAIL, self.OnMail)
else:
self.GetMailButton().Enable(false)
self.GetMailButton().Enable(False)
# disable the entry box for an e-mail address by default (NOT PROPERLY DOCUMENTED)
if not hasattr(self,"enable_mail_address_box"):
self.FindWindowById(wxPyError_ID_ADDRESS).Enable(false)
self.FindWindowById(wxPyError_ID_ADDRESS).Enable(False)
if not disable_exit_button:
EVT_BUTTON(self, wxPyError_ID_EXIT, self.OnExit)
@@ -380,7 +380,7 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
value = value[:-1]
if _debug:
print "%s.SetTraceback(): ...SetValue('%s' (^M=\\r; ^J=\\n))"\
% (self,string.replace(value,'\n',"^J"))
% (self,value.replace('\n',"^J"))
c.SetValue(value)
# Despite using the wxADJUST_MINSIZE flag in the
@@ -399,7 +399,7 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
print "%s.SetTraceback(): %s.GetBestSize() = (%s,%s)"\
% (self,c,size.width,size.height)
w,h = 0,0
for v in string.split(value,"\n"):
for v in value.split("\n"):
pw,ph,d,e = t = c.GetFullTextExtent(v)
if _debug:
print v, t
@@ -415,7 +415,7 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
self.sizerAroundText.SetItemMinSize (c,w,h)
c.SetSize ((w,h))
c.SetSizeHints (w,h,w,h)
c.Refresh()#.SetAutoLayout(FALSE)
c.Refresh()#.SetAutoLayout(False)
#^ the reason we need the above seems to be to replace the
#faulty GetBestSize of wxTextCtrl...
@@ -503,7 +503,7 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
if self.modal:
self.ShowModal()
else:
self.Show(true)
self.Show(True)
except:
if not locals().has_key("c"):
@@ -654,8 +654,8 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
class wxPyFatalErrorDialogWithTraceback(wxPyNonFatalErrorDialogWithTraceback):
populate_function = populate_wxPyFatalErrorDialogWithTraceback
no_continue_button = true
fatal = true
no_continue_button = True
fatal = True
class wxPyNonFatalErrorDialog(wxPyNonFatalErrorDialogWithTraceback):
populate_function = populate_wxPyNonFatalErrorDialog
@@ -669,7 +669,7 @@ def _startmailerwithhtml(mailto,subject,html,text=None,mailfrom=None):
s = 'mailto:%s?subject=%s&body=%s' % (mailto,
urllib.quote(subject),
urllib.quote(
string.replace(text,'\n','\r\n'),
text.replace('\n','\r\n'),
""))
# Note that RFC 2368 requires that line breaks in the body of
@@ -719,7 +719,7 @@ def _writehtmlmessage(mailto,subject,html,text=None,parent=None,mailfrom=None):
def _createhtmlmail (html, text, subject, to=None, mailfrom=None):
"""Create a mime-message that will render HTML in popular
MUAs, text in better ones (if indeed text is not untrue (e.g. None)
MUAs, text in better ones (if indeed text is not unTrue (e.g. None)
"""
import MimeWriter, mimetools, cStringIO
@@ -797,7 +797,7 @@ def wxPyResizeHTMLWindowToDispelScrollbar(window,
# Will go no further than specified fraction of display size.
w = 200
if type(fraction) == type(''):
fraction = string.atoi(fraction[:-1]) / 100.
fraction = int(fraction[:-1]) / 100.
ds = wxDisplaySize ()
c = window.GetInternalRepresentation ()
while w < ds[0] * fraction:
@@ -812,7 +812,7 @@ def wxPyResizeHTMLWindowToDispelScrollbar(window,
w = w + 20
else:
if type(defaultfraction) == type(''):
defaultfraction = string.atoi(defaultfraction[:-1]) / 100.
defaultfraction = int(defaultfraction[:-1]) / 100.
defaultsize = (defaultfraction * ds[0], defaultfraction * ds[1])
if _debug:
print 'defaultsize =',defaultsize
@@ -849,7 +849,7 @@ def wxPyFatalOrNonFatalError(parent,
else:
populate_function = populate_wxPyNonFatalError
sizer = populate_function(dlg,false,true)
sizer = populate_function(dlg,False,True)
window = dlg.FindWindowById(wxPyError_ID_HTML)
window.SetPage(msg)
@@ -875,5 +875,5 @@ def wxPyFatalOrNonFatalError(parent,
dlg.Destroy()
return v
else:
dlg.Show(true)
dlg.Show(True)

View File

@@ -0,0 +1,512 @@
=============
CHANGES.txt
=============
-----------------------------------------
Changes made to each release of PyCrust
-----------------------------------------
0.9 (2/27/2003 to 3/20/2003)
============================
Added fontIncrease, fontDecrease, fontDefault signals, receivers and
keybindings:
Ctrl+] Increase font size.
Ctrl+[ Decrease font size.
Ctrl+= Default font size.
Continued enhancement of the decorator capability to provide better
documentation and docstrings for wxPython classes and functions.
Introduced new tabbed interface:
* Namespace
* Calltip
* Session
* Dispatcher
* wxPython Docs
* wxSTC Docs
Filling.tree now expands tuples as well as lists. (It should have done
this all along, I just never noticed this omission before.)
Added this True/False test to all modules:
try:
True
except NameError:
True = 1==1
False = 1==0
Added wxd directory with decoration classes.
0.8.2 (1/5/2003 to 2/26/2003)
=============================
Wrapped sys.ps1, sys.ps2, and sys.ps3 in str(). (Thanks, Kieran
Holland.)
Fixed minor things found by PyChecker.
Changed locals to use __main__.__dict__ and added code to clean up the
namespace, making it as close to the regular Python environment as
possible. This solves the problem of pickling and unpickling instances
of classes defined in the shell.
Made shell.PasteAndRun() a little more forgiving when it finds a ps2
prompt line with no trailing space, such when you copy code from a web
page.
Improved autocomplete behavior by adding these to shell:
self.AutoCompSetAutoHide(False)
self.AutoCompStops(' .,;:([)]}\'"\\<>%^&+-=*/|`')
Added decor directory, decorator.py, stcDecor.py, and
stcConstants.py. These all serve the purpose of adding docstrings to
existing wxPython classes, in particular the wxStyledTextControl.
Added wrap.py, a command line utility for running a wxPython app with
additional runtime-tools loaded, such as PyCrust (the only tool at
this point).
Flushed the clipboard Cut/Copy operations so that selections will
exist in the clipboard even after PyCrust has been closed.
Improved the suppression of docstrings for simple data types appearing
in the namespace viewer.
Better handling of autocompletion with numeric types; no
autocompletion when typing a dot after an integer. If the
autocompletion is desired, type a space before the dot:
func = 3 .
More Filling!!! The namespace tree is now dynamically updated.
0.8.1 (12/20/2002 to 12/25/2002)
================================
Improved keyboard handling with Autocomplete active. You can now use
Enter as well as Tab to select an item from the list.
Disabled autocomplete for lists of 2000 items or more. The current
implementation of wxSTC can't handle lists this big.
Changed filling to always display docstrings for objects. This is
useful for objects whose docstrings have been decorated, rather than
coming directly from the source code. (Hmmm. Sounds like someone is
doing some decorating. I wonder where that would be helpful? ;-)
Fixed handling of icon. Added images.py file.
0.8 (10/29/2002 to 12/16/2002)
==============================
Added "help" to startup banner info.
Made all wx and stc imports explicit. No more import *.
Replaced use of wx's true and false with Python's True and False.
Changed introspect.getRoot() to use tokenize module. This does a
slightly better job than the previous parsing routine and the code is
clearer.
Improved handling of whitespace and empty types during introspection.
Fixed cut/copy clipboard problem under Linux. (Robin Dunn rocks!!!)
Added shell.about() which works like this:
>>> shell.about()
PyCrust Version: 0.8
Shell Revision: 1.80
Interpreter Revision: 1.15
Python Version: 2.2.2
wxPython Version: 2.3.3.1
Platform: linux2
Added copy plus and paste plus to shell menu.
Moved shell menu from shell.py to shellmenu.py.
Added sys.stdin.readlines() support.
Added time.sleep() in readline() and OnIdle() event handler to free up
the CPU.
0.7.2 (2/22/2002 to 8/27/2002)
==============================
Tweaked getAttributeNames() to pick up a few more attributes:
'__bases__', '__class__', '__dict__', '__name__', 'func_closure',
'func_code', 'func_defaults', 'func_dict', 'func_doc',
'func_globals', 'func_name'
Added a tests directory and unit tests.
Improved support for empty types in the shell: [], () and {} as far as
when call tips and autocompletion are available.
Added support for the other triple string - ''''''.
Refactored introspect.py to improve testability.
Improved call tips for unbound methods by leaving the "self"
parameter, since unbound methods require an instance be passed.
Fixed call tip bug where a tip was displayed when a "(" was typed
after an object that wasn't callable.
Fixed getAllAttributeNames when str(object) fails.
Added brace highlighting. (Thank you, Kevin Altis.)
Fixed problem displaying unicode objects in PyFilling.
Changed how filling.py checks for expandable objects. Lists are now
expandable objects.
Made the key handling more robust when there is an active text
selection that includes text prior to the last primary prompt. Thanks
to Raul Cota for pointing this out.
Fixed wxSTC problem with brace highlighting and non-us keyboards.
(Thank you for the patch, Jean-Michel Fauth.)
Added busy = wxBusyCursor() to key point in shell and filling.
Added OnCloseWindow handler to ShellFrame and CrustFrame.
Default to SetWrapMode(1) for shell and namespace viewer.
Added shell.wrap() and shell.zoom().
Added Raul Cota autoCompleteKeys hooks.
Cleaned up various little key handling bugs.
Changed input methods to get values from shell, rather than dialog
boxes. Renamed readIn to readline and readRaw to raw_input.
0.7.1 (12/12/2001 to 2/21/2002)
===============================
Fixed OnChar() issues effecting European keyboards, as reported by
Jean-Michel Fauth.
Fixed introspect.py issue with xmlrpc objects reported by Kevin Altis.
Fixed some introspect/PyFilling issues with regard to Python 2.2.
Fixed font background color as reported by Keith J. Farmer. (Thanks)
Fixed problem with call tips and autocompletion inside multiline
commands as report by Kevin Altis.
Improved OnKeyDown handling of cut/copy/paste operations based on
feedback from Syver Enstad. (Thanks)
Added a shell.help() method to display some help info.
Changed sort of items in the namespace viewer to case insensitive.
Changed attributes.sort(lambda x, y: cmp(x.upper(), y.upper())) in
advance of an upcoming fix to an autocompletion matching bug in wxSTC.
Improved support for ZODB by allowing namespace drilldown into BTrees.
Added shell.PasteAndRun() to support pasting multiple commands into
the shell from the clipboard. Ctrl+Shift+V or v.
Enter now always processes a command (or copies down a previous one.)
To insert a line break, press Ctrl+Enter.
Escape key clears the current, unexecuted command.
History retrieval changed to replace current command. Added new keys
to insert from history - Shift+Up and Shift+Down.
Better call tips on objects with __call__ methods.
Improved call tip positioning calculation.
0.7 (10/15/2001 to 12/11/2001)
==============================
Changed how command history retrieval functions work. Added Alt-P,
Alt-N as keybindings for Retrieve-Previous, Retrieve-Next.
Added full support for mult-line commands, similar to IDLE.
Changed introspect.getAttributeNames() to do a case insensitive sort.
Changed Cut/Copy/Paste to deal with prompts intelligently. Cut and
Copy remove all prompts. Paste can handle prompted or not-prompted
text.
Added CopyWithPrompts() method attached to Ctrl-Shift-C for those
times when you really do want all the prompts left intact.
Improved handling of the shell's read-only zone.
Changed CrustFrame.__init__ parameter spec to include all parameters
allowed by a wxFrame.
Changed FillingText to be read-only.
Renamed PyCrust.py to PyCrustApp.py to eliminate package/module name
conflicts that kept you from doing "from PyCrust import shell" inside
files located in the PyCrust directory.
Renamed PyFilling.py to PyFillingApp.py and PyShell.py to
PyShellApp.py to maintain consistency.
Removed the __date__ property from all modules.
Fixed bug in introspect.getCallTip(), reported by Kevin Altis.
0.6.1 (9/19/2001 to 10/12/2001)
===============================
Changed Shell.run() to always position to the end of existing text, as
suggested by Raul Cota.
Changed introspect.getAllAttributeNames() to break circular references
in object.__class__, which occurs in Zope/ZODB extension classes.
Changed filling.FillingTree.getChildren() to introspect extension
classes.
Fixed minor bugs in introspect.getCallTip() that were interfering with
call tips for Zope/ZODB extension class methods.
In preparation for wxPython 2.3.2, added code to fix a font sizing
problem. Versions of wxPython prior to 2.3.2 had a sizing bug on Win
platform where the font was 2 points larger than what was specified.
Added a hack to introspect.getAllAttributeNames() to "wake up" ZODB
objects that are asleep - in a "ghost" state. Otherwise it returns
incomplete info.
0.6 (8/21/2001 to 9/12/2001)
============================
Added PyFilling.py and filling.py.
PyShell.py and PyFilling.py can now be run standalone, as well as
PyCrust.py.
Added crust.py and moved some code from PyCrust.py to it.
Added command history retrieval features submitted by Richie Hindle.
Changed shell.write() to replace line endings with OS-specific
endings. Changed shell.py and interpreter.py to use os.linesep in
strings having hardcoded line endings.
Added shell.redirectStdin(), shell.redirectStdout() and
shell.redirectStderr() to allow the surrounding app to toggle requests
that the specified sys.std* be redirected to the shell. These can also
be run from within the shell itself, of course.
The shell now adds the current working directory "." to the search
path:
sys.path.insert(0, os.curdir)
Added support for distutils installations.
0.5.4 (8/17/2001 to 8/20/2001)
==============================
Changed default font size under *nix to:
'size' : 12,
'lnsize' : 10,
Changed Shell to expect a parameter referencing an Interpreter class,
rather than an intepreter instance, to facilitate subclassing of
Interpreter, which effectively broke when the Editor class was
eliminated.
Fixed PyCrustAlaCarte.py, which had been broken by previous changes.
Created InterpreterAlaCarte class as an example for use in the demo.
Split PyCrust.py into PyCrust.py and PyShell.py in anticipation of
PyFilling.
0.5.3 (8/16/2001)
=================
Added patch to PyCrust.py to fix wxPython bug:
wxID_SELECTALL = NewId() # This *should* be defined by wxPython.
0.5.2 (8/14/2001 to 8/15/2001)
==============================
Shortened module names by dropping "PyCrust" as a prefix.
Changed version to VERSION in version module.
Added Options menu to PyCrust application.
Eliminated the Editor class (and editor module) by merging with Shell.
This means that Shell "is a" wxStyledTextCtrl rather than "has a".
There just wasn't enough non-gui code to justify the separation. Plus,
Shell will be much easier for gui toolkits/designers to deal with now.
0.5.1 (8/10/2001 to 8/14/2001)
==============================
Added introspect module.
Moved some functionality from PyCrustInterp to introspect.
Changed introspect.getRoot() to no longer remove whitespace from the
command. This was a remnant of a previous approach that, when left as
part of the current approach, turned out to be a really bad thing.
Changed introspect.getRoot() to allow commands of '', "", """""", [],
(), and {} to pass through. This allows you to type them, followed by
a dot, and get autocomplete options on them.
Changed introspect.getRoot() to identify some situations where strings
shouldn't be considered roots. For example:
>>> import PyCrust # To illustrate the potential problem.
>>> len('PyCrust.py')
Typing the dot at the end of "PyCrust" in the second line above should
NOT result in an autocompletion list because "PyCrust" is part of a
string in this context, not a reference to the PyCrust module
object. Similar reasoning applies to call tips. For example:
>>> len('dir(')
Typing the left paren at the end of "dir" should NOT result in a call
tip.
Both features now behave properly in the examples given. However,
there is still the case where whitespace precedes the potential root
and that is NOT handled properly. For example:
>>> len('this is a dir(')
and
>>> len('This is PyCrust.py')
More code needs to be written to handle more complex situations.
Added locals=None parameter to Shell.__init__().
Added support for magic attribute retrieval. Users can change this
with:
>>> shell.editor.autoCompleteIncludeMagic = 0
Added the ability to set filters on auto completion to exclude
attributes prefixed with a single or double underscore. Users can
exclude one or the other or both with:
>>> shell.editor.autoCompleteExcludeSingle = 1
>>> shell.editor.autoCompleteExcludeDouble = 1
0.5 (8/8/2001)
==============
Mostly just a final version change before creating a release.
0.4 (8/4/2001 to 8/7/2001)
==========================
Changed version/revision handling.
Fixed bugs.
0.3 (8/2/2001 to 8/3/2001)
==========================
Removed lots of cruft.
Added lots of docstrings.
Imported to CVS repository at SourceForge.
Added call tips.
0.2 (7/30/2001 to 8/2/2001)
===========================
Renamed several files.
Added command autocompletion.
Added menus to PyCrust.py: File, Edit and Help
Added sample applications: PyCrustAlaCarte.py, PyCrustAlaMode.py, and
PyCrustMinimus.py.
0.1 (7/1/2001 to 7/19/2001)
===========================
Added basic syntax coloring much like Boa.
Added read-only logging much like IDLE.
Can retrieve a previous command by putting the cursor back on that
line and hitting enter.
Stdin and raw_input operate properly so you can now do help() and
license() without hanging.
Redefined "quit", "exit", and "close" to display a better-than-nothing
response.
Home key honors the prompt.
Created SourceForge account, but nothing was posted.
In the beginning, there was pie... (7/1/2001)
=============================================
Blame it all on IDLE, Boa and PythonWin. I was using all three, got
frustrated with their dissimilarities, and began to let everyone know
how I felt. At the same time, Scintilla looked like an interesting
tool to build a shell around. And while I didn't receive much in the
way of positive feedback, let alone encouragement, I just couldn't let
go of the idea of a Scintilla-based Python shell. Then the PythonCard
project got to the point where they were talking about including a
shell in their development environment. That was all the incentive I
needed. PyCrust had to happen...
CVS Information
===============
$Date$
$Revision$
$Id$

View File

@@ -1,39 +1,70 @@
#!/usr/bin/env python
"""PyCrustApp is a python shell and namespace browser application."""
# The next two lines, and the other code below that makes use of
# ``__main__`` and ``original``, serve the purpose of cleaning up the
# main namespace to look as much as possible like the regular Python
# shell environment.
import __main__
original = __main__.__dict__.keys()
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
from wxPython.wx import *
from crust import CrustFrame
from wxPython import wx
try:
True
except NameError:
True = 1==1
False = 1==0
class App(wxApp):
class App(wx.wxApp):
"""PyCrust standalone application."""
def OnInit(self):
wxInitAllImageHandlers()
locals = {'__app__': 'PyCrust Standalone Application'}
self.crustFrame = CrustFrame(locals=locals)
self.crustFrame.SetSize((750, 525))
self.crustFrame.Show(true)
self.crustFrame.crust.shell.SetFocus()
self.SetTopWindow(self.crustFrame)
from wxPython import wx
wx.wxInitAllImageHandlers()
locals = __main__.__dict__
from crust import CrustFrame
self.frame = CrustFrame(locals=locals)
self.frame.SetSize((800, 600))
self.frame.Show()
self.SetTopWindow(self.frame)
# Add the application object to the sys module's namespace.
# This allows a shell user to do:
# >>> import sys
# >>> sys.application.whatever
# >>> sys.app.whatever
import sys
sys.application = self
return true
sys.app = self
return 1
'''
The main() function needs to handle being imported, such as with the
pycrust script that wxPython installs:
#!/usr/bin/env python
from wxPython.lib.PyCrust.PyCrustApp import main
main()
'''
def main():
application = App(1)
application.MainLoop()
import __main__
md = __main__.__dict__
keepers = original
keepers.append('App')
for key in md.keys():
if key not in keepers:
del md[key]
app = App(0)
if md.has_key('App') and md['App'] is App:
del md['App']
if md.has_key('__main__') and md['__main__'] is __main__:
del md['__main__']
app.MainLoop()
if __name__ == '__main__':
main()

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python
"""PyFillingApp is a python namespace inspection application."""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
@@ -6,30 +6,40 @@ __cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# We use this object to get more introspection when run standalone.
application = None
app = None
import filling
# These are imported just to have something interesting to inspect.
from PyCrust import crust
from PyCrust import interpreter
from PyCrust import introspect
from PyCrust import pseudo
from PyCrust import shell
import crust
import interpreter
import introspect
import pseudo
import shell
import sys
from wxPython import wx
try:
True
except NameError:
True = 1==1
False = 1==0
class App(filling.App):
def OnInit(self):
filling.App.OnInit(self)
self.root = self.fillingFrame.filling.tree.root
return True
def main():
"""Create and run the application."""
global application
application = filling.App(0)
root = application.fillingFrame.filling.fillingTree.root
application.fillingFrame.filling.fillingTree.Expand(root)
application.MainLoop()
global app
app = App(0)
app.fillingFrame.filling.tree.Expand(app.root)
app.MainLoop()
if __name__ == '__main__':
main()

View File

@@ -1,40 +1,71 @@
#!/usr/bin/env python
"""PyShellApp is a python shell application."""
# The next two lines, and the other code below that makes use of
# ``__main__`` and ``original``, serve the purpose of cleaning up the
# main namespace to look as much as possible like the regular Python
# shell environment.
import __main__
original = __main__.__dict__.keys()
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
from wxPython.wx import *
from shell import ShellFrame
from wxPython import wx
try:
True
except NameError:
True = 1==1
False = 1==0
class App(wxApp):
class App(wx.wxApp):
"""PyShell standalone application."""
def OnInit(self):
wxInitAllImageHandlers()
locals = {'__app__': 'PyShell Standalone Application'}
self.shellFrame = ShellFrame(locals=locals)
self.shellFrame.SetSize((750, 525))
self.shellFrame.Show(true)
self.shellFrame.shell.SetFocus()
self.SetTopWindow(self.shellFrame)
from wxPython import wx
wx.wxInitAllImageHandlers()
locals = __main__.__dict__
from shell import ShellFrame
self.frame = ShellFrame(locals=locals)
self.frame.SetSize((750, 525))
self.frame.Show()
self.SetTopWindow(self.frame)
self.frame.shell.SetFocus()
# Add the application object to the sys module's namespace.
# This allows a shell user to do:
# >>> import sys
# >>> sys.application.whatever
# >>> sys.app.whatever
import sys
sys.application = self
return true
sys.app = self
return 1
'''
The main() function needs to handle being imported, such as with the
pycrust script that wxPython installs:
#!/usr/bin/env python
from wxPython.lib.PyCrust.PyCrustApp import main
main()
'''
def main():
application = App(1)
application.MainLoop()
import __main__
md = __main__.__dict__
keepers = original
keepers.append('App')
for key in md.keys():
if key not in keepers:
del md[key]
app = App(0)
if md.has_key('App') and md['App'] is App:
del md['App']
if md.has_key('__main__') and md['__main__'] is __main__:
del md['__main__']
app.MainLoop()
if __name__ == '__main__':
main()

View File

@@ -1,68 +1,79 @@
PyCrust - The Flakiest Python Shell
=====================================
PyCrust - The Flakiest Python Shell
=====================================
Half-baked by Patrick K. O'Brien (pobrien@orbtech.com)
==============================================================
* Orbtech - "Your source for Python programming expertise." *
* Sample all our half-baked Python goods at www.orbtech.com. *
==============================================================
Orbtech - "Your source for Python programming expertise."
Sample all our half-baked Python goods at www.orbtech.com.
What is PyCrust?
----------------
PyCrust is an interactive Python environment written in Python.
PyCrust components can run standalone or be integrated into other
development environments and/or other Python applications.
PyCrust comes with an interactive Python shell (PyShell), an
interactive namespace/object tree control (PyFilling) and an
PyCrust comes with an interactive Python shell (PyShell), an
interactive namespace/object tree control (PyFilling) and an
integrated, split-window combination of the two (PyCrust).
What is PyCrust good for?
-------------------------
Have you ever tried to bake a pie without one? Well, you
shouldn't build a Python program without a PyCrust either.
Have you ever tried to bake a pie without one? Well, you shouldn't
build a Python program without a PyCrust either.
What else do I need to use PyCrust?
-----------------------------------
PyCrust requires Python 2.1 or later, and wxPython 2.3.1 or later.
PyCrust requires Python 2.1.3 or later, and wxPython 2.4 or later.
PyCrust uses wxPython and the Scintilla wrapper (wxStyledTextCtrl).
Python is available at http://www.python.org/.
wxPython is available at http://www.wxpython.org/.
Python is available at http://www.python.org/. wxPython is available
at http://www.wxpython.org/.
Where can I get the latest version of PyCrust?
----------------------------------------------
The latest production version ships with wxPython.
The latest developer version is available in CVS at:
The latest production version ships with wxPython. The latest
developer version is available in CVS at:
http://sourceforge.net/cvs/?group_id=31263
Where is the PyCrust project hosted?
------------------------------------
At SourceForge, of course. The SourceForge summary page:
http://sourceforge.net/projects/pycrust/
I found a bug in PyCrust, what do I do with it?
-----------------------------------------------
You can send it to me at pobrien@orbtech.com.
I want a new feature added to PyCrust. Will you do it?
------------------------------------------------------
Flattery and money will get you anything. Short of that, you
can send me a request and I'll see what I can do.
Flattery and money will get you anything. Short of that, you can send
me a request and I'll see what I can do.
Does PyCrust have a mailing list full of wonderful people?
----------------------------------------------------------
As a matter of fact, we do. Join the PyCrust mailing lists at:
http://sourceforge.net/mail/?group_id=31263
What is the CVS information for this README file?
-------------------------------------------------
$Date$
$Revision$
$Id$

View File

@@ -4,78 +4,163 @@ __author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
from wxPython.wx import *
from shell import Shell
from wxPython import wx
from filling import Filling
from version import VERSION
import os
from shell import Shell
from shellmenu import ShellMenu
from version import VERSION
try:
True
except NameError:
True = 1==1
False = 1==0
class Crust(wxSplitterWindow):
class Crust(wx.wxSplitterWindow):
"""PyCrust Crust based on wxSplitterWindow."""
name = 'PyCrust Crust'
revision = __revision__
def __init__(self, parent, id=-1, pos=wxDefaultPosition, \
size=wxDefaultSize, style=wxSP_3D, name='Crust Window', \
rootObject=None, rootLabel=None, rootIsNamespace=1, \
intro='', locals=None, \
def __init__(self, parent, id=-1, pos=wx.wxDefaultPosition,
size=wx.wxDefaultSize, style=wx.wxSP_3D,
name='Crust Window', rootObject=None, rootLabel=None,
rootIsNamespace=True, intro='', locals=None,
InterpClass=None, *args, **kwds):
"""Create a PyCrust Crust instance."""
wxSplitterWindow.__init__(self, parent, id, pos, size, style, name)
self.shell = Shell(parent=self, introText=intro, \
locals=locals, InterpClass=InterpClass, \
wx.wxSplitterWindow.__init__(self, parent, id, pos, size, style, name)
self.shell = Shell(parent=self, introText=intro,
locals=locals, InterpClass=InterpClass,
*args, **kwds)
self.filling = Filling(parent=self, \
rootObject=self.shell.interp.locals, \
rootLabel=rootLabel, rootIsNamespace=1)
"""Add 'filling' to the interpreter's locals."""
if rootObject is None:
rootObject = self.shell.interp.locals
self.notebook = wx.wxNotebook(parent=self, id=-1)
self.shell.interp.locals['notebook'] = self.notebook
self.filling = Filling(parent=self.notebook,
rootObject=rootObject,
rootLabel=rootLabel,
rootIsNamespace=rootIsNamespace)
# Add 'filling' to the interpreter's locals.
self.shell.interp.locals['filling'] = self.filling
self.SplitHorizontally(self.shell, self.filling, 300)
self.notebook.AddPage(page=self.filling, text='Namespace', select=True)
self.calltip = Calltip(parent=self.notebook)
self.notebook.AddPage(page=self.calltip, text='Calltip')
self.sessionlisting = SessionListing(parent=self.notebook)
self.notebook.AddPage(page=self.sessionlisting, text='Session')
self.dispatcherlisting = DispatcherListing(parent=self.notebook)
self.notebook.AddPage(page=self.dispatcherlisting, text='Dispatcher')
from wxd import wx_
self.wxdocs = Filling(parent=self.notebook,
rootObject=wx_,
rootLabel='wx',
rootIsNamespace=False,
static=True)
self.notebook.AddPage(page=self.wxdocs, text='wxPython Docs')
from wxd import stc_
self.stcdocs = Filling(parent=self.notebook,
rootObject=stc_.StyledTextCtrl,
rootLabel='StyledTextCtrl',
rootIsNamespace=False,
static=True)
self.notebook.AddPage(page=self.stcdocs, text='StyledTextCtrl Docs')
self.SplitHorizontally(self.shell, self.notebook, 300)
self.SetMinimumPaneSize(1)
# Temporary hack to share menus between PyCrust and PyShell.
from shell import ShellMenu
class Calltip(wx.wxTextCtrl):
"""Text control containing the most recent shell calltip."""
class CrustFrame(wxFrame, ShellMenu):
def __init__(self, parent=None, id=-1):
import dispatcher
style = wx.wxTE_MULTILINE | wx.wxTE_READONLY | wx.wxTE_RICH2
wx.wxTextCtrl.__init__(self, parent=parent, id=id, style=style)
self.SetBackgroundColour(wx.wxColour(255, 255, 232))
dispatcher.connect(receiver=self.display, signal='Shell.calltip')
def display(self, calltip):
"""Receiver for Shell.calltip signal."""
self.SetValue(calltip)
class SessionListing(wx.wxTextCtrl):
"""Text control containing all commands for session."""
def __init__(self, parent=None, id=-1):
import dispatcher
style = wx.wxTE_MULTILINE | wx.wxTE_READONLY | \
wx.wxTE_RICH2 | wx.wxTE_DONTWRAP
wx.wxTextCtrl.__init__(self, parent=parent, id=id, style=style)
dispatcher.connect(receiver=self.push, signal='Interpreter.push')
def push(self, command, more):
"""Receiver for Interpreter.push signal."""
if command and not more:
self.SetInsertionPointEnd()
start, end = self.GetSelection()
if start != end:
self.SetSelection(0, 0)
self.AppendText(command + '\n')
class DispatcherListing(wx.wxTextCtrl):
"""Text control containing all dispatches for session."""
def __init__(self, parent=None, id=-1):
import dispatcher
style = wx.wxTE_MULTILINE | wx.wxTE_READONLY | \
wx.wxTE_RICH2 | wx.wxTE_DONTWRAP
wx.wxTextCtrl.__init__(self, parent=parent, id=id, style=style)
dispatcher.connect(receiver=self.spy)
def spy(self, signal, sender):
"""Receiver for Any signal from Any sender."""
text = '%r from %s' % (signal, sender)
self.SetInsertionPointEnd()
start, end = self.GetSelection()
if start != end:
self.SetSelection(0, 0)
self.AppendText(text + '\n')
class CrustFrame(wx.wxFrame, ShellMenu):
"""Frame containing all the PyCrust components."""
name = 'PyCrust Frame'
revision = __revision__
def __init__(self, parent=None, id=-1, title='PyCrust', \
pos=wxDefaultPosition, size=wxDefaultSize, \
style=wxDEFAULT_FRAME_STYLE, \
rootObject=None, rootLabel=None, rootIsNamespace=1, \
def __init__(self, parent=None, id=-1, title='PyCrust',
pos=wx.wxDefaultPosition, size=wx.wxDefaultSize,
style=wx.wxDEFAULT_FRAME_STYLE,
rootObject=None, rootLabel=None, rootIsNamespace=True,
locals=None, InterpClass=None, *args, **kwds):
"""Create a PyCrust CrustFrame instance."""
wxFrame.__init__(self, parent, id, title, pos, size, style)
intro = 'Welcome To PyCrust %s - The Flakiest Python Shell' % VERSION
intro += '\nSponsored by Orbtech - Your source for Python programming expertise.'
wx.wxFrame.__init__(self, parent, id, title, pos, size, style)
intro = 'PyCrust %s - The Flakiest Python Shell' % VERSION
intro += '\nSponsored by Orbtech - '
intro += 'Your source for Python programming expertise.'
self.CreateStatusBar()
self.SetStatusText(intro.replace('\n', ', '))
import images
self.SetIcon(images.getPyCrustIcon())
self.crust = Crust(parent=self, intro=intro, \
rootObject=rootObject, \
rootLabel=rootLabel, \
rootIsNamespace=rootIsNamespace, \
locals=locals, \
self.crust = Crust(parent=self, intro=intro,
rootObject=rootObject,
rootLabel=rootLabel,
rootIsNamespace=rootIsNamespace,
locals=locals,
InterpClass=InterpClass, *args, **kwds)
# Override the filling so that status messages go to the status bar.
self.crust.filling.fillingTree.setStatusText = self.SetStatusText
self.crust.filling.tree.setStatusText = self.SetStatusText
# Override the shell so that status messages go to the status bar.
self.crust.shell.setStatusText = self.SetStatusText
# Fix a problem with the sash shrinking to nothing.
self.crust.filling.SetSashPosition(200)
# Set focus to the shell editor.
self.crust.shell.SetFocus()
# Temporary hack to share menus between PyCrust and PyShell.
self.shell = self.crust.shell
self.createMenus()
EVT_CLOSE(self, self.OnCloseWindow)
wx.EVT_CLOSE(self, self.OnCloseWindow)
# Set focus to the shell editor.
self.crust.shell.SetFocus()
def OnCloseWindow(self, event):
self.crust.shell.destroy()

View File

@@ -0,0 +1,266 @@
"""Provides global signal dispatching services."""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
import exceptions
import types
import weakref
try:
True
except NameError:
True = 1==1
False = 1==0
class DispatcherError(exceptions.Exception):
def __init__(self, args=None):
self.args = args
class Parameter:
"""Used to represent default parameter values."""
def __repr__(self):
return self.__class__.__name__
class Any(Parameter): pass
Any = Any()
class Anonymous(Parameter): pass
Anonymous = Anonymous()
connections = {}
senders = {}
_boundMethods = weakref.WeakKeyDictionary()
def connect(receiver, signal=Any, sender=Any, weak=True):
"""Connect receiver to sender for signal.
If sender is Any, receiver will receive signal from any sender.
If signal is Any, receiver will receive any signal from sender.
If sender is None, receiver will receive signal from Anonymous.
If signal is Any and sender is None, receiver will receive any
signal from Anonymous.
If signal is Any and sender is Any, receiver will receive any
signal from any sender.
If weak is true, weak references will be used."""
if signal is None:
raise DispatcherError, 'signal cannot be None'
if weak:
receiver = safeRef(receiver)
senderkey = id(sender)
signals = {}
if connections.has_key(senderkey):
signals = connections[senderkey]
else:
connections[senderkey] = signals
# Keep track of senders for cleanup.
if sender not in (None, Any):
def remove(object, senderkey=senderkey):
_removeSender(senderkey=senderkey)
# Skip objects that can not be weakly referenced, which means
# they won't be automatically cleaned up, but that's too bad.
try:
weakSender = weakref.ref(sender, remove)
senders[senderkey] = weakSender
except:
pass
receivers = []
if signals.has_key(signal):
receivers = signals[signal]
else:
signals[signal] = receivers
try:
receivers.remove(receiver)
except ValueError:
pass
receivers.append(receiver)
def disconnect(receiver, signal=Any, sender=Any, weak=True):
"""Disconnect receiver from sender for signal.
Disconnecting is not required. The use of disconnect is the same as for
connect, only in reverse. Think of it as undoing a previous connection."""
if signal is None:
raise DispatcherError, 'signal cannot be None'
if weak:
receiver = safeRef(receiver)
senderkey = id(sender)
try:
receivers = connections[senderkey][signal]
except KeyError:
raise DispatcherError, \
'No receivers for signal %r from sender %s' % (signal, sender)
try:
receivers.remove(receiver)
except ValueError:
raise DispatcherError, \
'No connection to receiver %s for signal %r from sender %s' % \
(receiver, signal, sender)
_cleanupConnections(senderkey, signal)
def send(signal, sender=Anonymous, **kwds):
"""Send signal from sender to all connected receivers.
Return a list of tuple pairs [(receiver, response), ... ].
If sender is not specified, signal is sent anonymously."""
senderkey = id(sender)
anykey = id(Any)
# Get receivers that receive *this* signal from *this* sender.
receivers = []
try:
receivers.extend(connections[senderkey][signal])
except KeyError:
pass
# Add receivers that receive *any* signal from *this* sender.
anyreceivers = []
try:
anyreceivers = connections[senderkey][Any]
except KeyError:
pass
for receiver in anyreceivers:
if receivers.count(receiver) == 0:
receivers.append(receiver)
# Add receivers that receive *this* signal from *any* sender.
anyreceivers = []
try:
anyreceivers = connections[anykey][signal]
except KeyError:
pass
for receiver in anyreceivers:
if receivers.count(receiver) == 0:
receivers.append(receiver)
# Add receivers that receive *any* signal from *any* sender.
anyreceivers = []
try:
anyreceivers = connections[anykey][Any]
except KeyError:
pass
for receiver in anyreceivers:
if receivers.count(receiver) == 0:
receivers.append(receiver)
# Call each receiver with whatever arguments it can accept.
# Return a list of tuple pairs [(receiver, response), ... ].
responses = []
for receiver in receivers:
if type(receiver) is weakref.ReferenceType \
or isinstance(receiver, BoundMethodWeakref):
# Dereference the weak reference.
receiver = receiver()
if receiver is None:
# This receiver is dead, so skip it.
continue
response = _call(receiver, signal=signal, sender=sender, **kwds)
responses += [(receiver, response)]
return responses
def _call(receiver, **kwds):
"""Call receiver with only arguments it can accept."""
## if type(receiver) is types.InstanceType:
if hasattr(receiver, '__call__') and \
(hasattr(receiver.__call__, 'im_func') or hasattr(receiver.__call__, 'im_code')):
# receiver is a class instance; assume it is callable.
# Reassign receiver to the actual method that will be called.
receiver = receiver.__call__
if hasattr(receiver, 'im_func'):
# receiver is a method. Drop the first argument, usually 'self'.
fc = receiver.im_func.func_code
acceptable = fc.co_varnames[1:fc.co_argcount]
elif hasattr(receiver, 'func_code'):
# receiver is a function.
fc = receiver.func_code
acceptable = fc.co_varnames[0:fc.co_argcount]
else:
raise DispatcherError, 'Unknown receiver %s of type %s' % (receiver, type(receiver))
if not (fc.co_flags & 8):
# fc does not have a **kwds type parameter, therefore
# remove unacceptable arguments.
for arg in kwds.keys():
if arg not in acceptable:
del kwds[arg]
return receiver(**kwds)
def safeRef(object):
"""Return a *safe* weak reference to a callable object."""
if hasattr(object, 'im_self'):
if object.im_self is not None:
# Turn a bound method into a BoundMethodWeakref instance.
# Keep track of these instances for lookup by disconnect().
selfkey = object.im_self
funckey = object.im_func
if not _boundMethods.has_key(selfkey):
_boundMethods[selfkey] = weakref.WeakKeyDictionary()
if not _boundMethods[selfkey].has_key(funckey):
_boundMethods[selfkey][funckey] = \
BoundMethodWeakref(boundMethod=object)
return _boundMethods[selfkey][funckey]
return weakref.ref(object, _removeReceiver)
class BoundMethodWeakref:
"""BoundMethodWeakref class."""
def __init__(self, boundMethod):
"""Return a weak-reference-like instance for a bound method."""
self.isDead = 0
def remove(object, self=self):
"""Set self.isDead to true when method or instance is destroyed."""
self.isDead = 1
_removeReceiver(receiver=self)
self.weakSelf = weakref.ref(boundMethod.im_self, remove)
self.weakFunc = weakref.ref(boundMethod.im_func, remove)
def __repr__(self):
"""Return the closest representation."""
return '<bound method weakref for %s.%s>' % (self.weakSelf, self.weakFunc)
def __call__(self):
"""Return a strong reference to the bound method."""
if self.isDead:
return None
else:
object = self.weakSelf()
method = self.weakFunc().__name__
try: # wxPython hack to handle wxDead objects.
return getattr(object, method)
except AttributeError:
## _removeReceiver(receiver=self)
return None
def _removeReceiver(receiver):
"""Remove receiver from connections."""
for senderkey in connections.keys():
for signal in connections[senderkey].keys():
receivers = connections[senderkey][signal]
try:
receivers.remove(receiver)
except:
pass
_cleanupConnections(senderkey, signal)
def _cleanupConnections(senderkey, signal):
"""Delete any empty signals for senderkey. Delete senderkey if empty."""
receivers = connections[senderkey][signal]
if not receivers:
# No more connected receivers. Therefore, remove the signal.
signals = connections[senderkey]
del signals[signal]
if not signals:
# No more signal connections. Therefore, remove the sender.
_removeSender(senderkey)
def _removeSender(senderkey):
"""Remove senderkey from connections."""
del connections[senderkey]
# Senderkey will only be in senders dictionary if sender
# could be weakly referenced.
try:
del senders[senderkey]
except:
pass

View File

@@ -1,163 +1,217 @@
"""PyCrust Filling is the gui tree control through which a user can navigate
the local namespace or any object."""
"""PyCrust Filling is the gui tree control through which a user can
navigate the local namespace or any object."""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
from wxPython.wx import *
from wxPython.stc import *
from wxPython import wx
from wxPython import stc
from version import VERSION
import dispatcher
import inspect
import introspect
import keyword
import sys
import types
try:
True
except NameError:
True = 1==1
False = 1==0
COMMONTYPES = [getattr(types, t) for t in dir(types) \
if not t.startswith('_') \
and t not in ('ClassType', 'InstanceType', 'ModuleType')]
DOCTYPES = ('BuiltinFunctionType', 'BuiltinMethodType', 'ClassType',
'FunctionType', 'GeneratorType', 'InstanceType',
'LambdaType', 'MethodType', 'ModuleType',
'UnboundMethodType', 'method-wrapper')
SIMPLETYPES = [getattr(types, t) for t in dir(types) \
if not t.startswith('_') and t not in DOCTYPES]
try:
COMMONTYPES.append(type(''.__repr__)) # Method-wrapper in version 2.2.x.
except AttributeError:
pass
class FillingTree(wxTreeCtrl):
class FillingTree(wx.wxTreeCtrl):
"""PyCrust FillingTree based on wxTreeCtrl."""
name = 'PyCrust Filling Tree'
revision = __revision__
def __init__(self, parent, id=-1, pos=wxDefaultPosition, \
size=wxDefaultSize, style=wxTR_HAS_BUTTONS, \
rootObject=None, rootLabel=None, rootIsNamespace=0):
def __init__(self, parent, id=-1, pos=wx.wxDefaultPosition,
size=wx.wxDefaultSize, style=wx.wxTR_DEFAULT_STYLE,
rootObject=None, rootLabel=None, rootIsNamespace=0,
static=False):
"""Create a PyCrust FillingTree instance."""
wxTreeCtrl.__init__(self, parent, id, pos, size)
wx.wxTreeCtrl.__init__(self, parent, id, pos, size, style)
self.rootIsNamespace = rootIsNamespace
if not rootObject:
import __main__
rootObject = __main__
import __main__
if rootObject is None:
rootObject = __main__.__dict__
self.rootIsNamespace = 1
if not rootLabel: rootLabel = 'Ingredients'
rootData = wxTreeItemData(rootObject)
self.root = self.AddRoot(rootLabel, -1, -1, rootData)
self.SetItemHasChildren(self.root, self.hasChildren(self.root))
EVT_TREE_ITEM_EXPANDING(self, self.GetId(), self.OnItemExpanding)
EVT_TREE_ITEM_COLLAPSED(self, self.GetId(), self.OnItemCollapsed)
EVT_TREE_SEL_CHANGED(self, self.GetId(), self.OnSelChanged)
if rootObject is __main__.__dict__ and rootLabel is None:
rootLabel = 'locals()'
if not rootLabel:
rootLabel = 'Ingredients'
rootData = wx.wxTreeItemData(rootObject)
self.item = self.root = self.AddRoot(rootLabel, -1, -1, rootData)
self.SetItemHasChildren(self.root, self.hasChildren(rootObject))
wx.EVT_TREE_ITEM_EXPANDING(self, self.GetId(), self.OnItemExpanding)
wx.EVT_TREE_ITEM_COLLAPSED(self, self.GetId(), self.OnItemCollapsed)
wx.EVT_TREE_SEL_CHANGED(self, self.GetId(), self.OnSelChanged)
wx.EVT_TREE_ITEM_ACTIVATED(self, self.GetId(), self.OnItemActivated)
if not static:
dispatcher.connect(receiver=self.push, signal='Interpreter.push')
def hasChildren(self, o):
def push(self, command, more):
"""Receiver for Interpreter.push signal."""
self.display()
def OnItemExpanding(self, event):
"""Add children to the item."""
busy = wx.wxBusyCursor()
item = event.GetItem()
if self.IsExpanded(item):
return
self.addChildren(item)
# self.SelectItem(item)
def OnItemCollapsed(self, event):
"""Remove all children from the item."""
busy = wx.wxBusyCursor()
item = event.GetItem()
# self.CollapseAndReset(item)
# self.DeleteChildren(item)
# self.SelectItem(item)
def OnSelChanged(self, event):
"""Display information about the item."""
busy = wx.wxBusyCursor()
self.item = event.GetItem()
self.display()
def OnItemActivated(self, event):
"""Launch a DirFrame."""
item = event.GetItem()
text = self.getFullName(item)
obj = self.GetPyData(item)
frame = FillingFrame(parent=self, size=(600, 100), rootObject=obj,
rootLabel=text, rootIsNamespace=False)
frame.Show()
def hasChildren(self, obj):
"""Return true if object has children."""
if self.getChildren(o):
return true
if self.getChildren(obj):
return True
else:
return false
return False
def getChildren(self, o):
"""Return a dictionary with the attributes or contents of object."""
busy = wxBusyCursor()
otype = type(o)
if (otype is types.DictType) \
or str(otype)[17:23] == 'BTrees' and hasattr(o, 'keys'):
return o
def getChildren(self, obj):
"""Return dictionary with attributes or contents of object."""
busy = wx.wxBusyCursor()
otype = type(obj)
if otype is types.DictType \
or str(otype)[17:23] == 'BTrees' and hasattr(obj, 'keys'):
return obj
d = {}
if otype is types.ListType:
for n in range(len(o)):
if otype is types.ListType or otype is types.TupleType:
for n in range(len(obj)):
key = '[' + str(n) + ']'
d[key] = o[n]
d[key] = obj[n]
if otype not in COMMONTYPES:
for key in introspect.getAttributeNames(o):
# Believe it or not, some attributes can disappear, such as
# the exc_traceback attribute of the sys module. So this is
# nested in a try block.
for key in introspect.getAttributeNames(obj):
# Believe it or not, some attributes can disappear,
# such as the exc_traceback attribute of the sys
# module. So this is nested in a try block.
try:
d[key] = getattr(o, key)
d[key] = getattr(obj, key)
except:
pass
return d
def OnItemExpanding(self, event):
busy = wxBusyCursor()
selection = event.GetItem()
if self.IsExpanded(selection):
return
o = self.GetPyData(selection)
children = self.getChildren(o)
def addChildren(self, item):
self.DeleteChildren(item)
obj = self.GetPyData(item)
children = self.getChildren(obj)
if not children:
return
list = children.keys()
try:
list.sort(lambda x, y: cmp(x.lower(), y.lower()))
except:
pass
for item in list:
itemtext = str(item)
# Show string dictionary items with single quotes, except for
# the first level of items, if they represent a namespace.
if type(o) is types.DictType \
and type(item) is types.StringType \
and (selection != self.root \
or (selection == self.root and not self.rootIsNamespace)):
itemtext = repr(item)
child = self.AppendItem(selection, itemtext, -1, -1, \
wxTreeItemData(children[item]))
self.SetItemHasChildren(child, self.hasChildren(children[item]))
keys = children.keys()
keys.sort(lambda x, y: cmp(x.lower(), y.lower()))
for key in keys:
itemtext = str(key)
# Show string dictionary items with single quotes, except
# for the first level of items, if they represent a
# namespace.
if type(obj) is types.DictType \
and type(key) is types.StringType \
and (item != self.root \
or (item == self.root and not self.rootIsNamespace)):
itemtext = repr(key)
child = children[key]
data = wx.wxTreeItemData(child)
branch = self.AppendItem(parent=item, text=itemtext, data=data)
self.SetItemHasChildren(branch, self.hasChildren(child))
def OnItemCollapsed(self, event):
"""Remove all children from the item."""
busy = wxBusyCursor()
item = event.GetItem()
self.DeleteChildren(item)
def OnSelChanged(self, event):
busy = wxBusyCursor()
item = event.GetItem()
if item == self.root:
self.setText('')
def display(self):
item = self.item
if self.IsExpanded(item):
self.addChildren(item)
self.setText('')
obj = self.GetPyData(item)
if obj is None: # Windows bug fix.
return
o = self.GetPyData(item)
otype = type(o)
self.SetItemHasChildren(item, self.hasChildren(obj))
otype = type(obj)
text = ''
text += self.getFullName(item)
text += '\n\nType: ' + str(otype)
try:
value = str(o)
value = str(obj)
except:
value = ''
if otype is types.StringType or otype is types.UnicodeType:
value = repr(o)
value = repr(obj)
text += '\n\nValue: ' + value
if otype not in SIMPLETYPES:
try:
text += '\n\nDocstring:\n\n"""' + \
inspect.getdoc(obj).strip() + '"""'
except:
pass
if otype is types.InstanceType:
try:
text += '\n\nClass Definition:\n\n' + \
inspect.getsource(o.__class__)
inspect.getsource(obj.__class__)
except:
try:
text += '\n\n"""' + inspect.getdoc(o).strip() + '"""'
except:
pass
pass
else:
try:
text += '\n\nSource Code:\n\n' + \
inspect.getsource(o)
inspect.getsource(obj)
except:
try:
text += '\n\n"""' + inspect.getdoc(o).strip() + '"""'
except:
pass
pass
self.setText(text)
def getFullName(self, item, partial=''):
"""Return a syntactically proper name for item."""
parent = self.GetItemParent(item)
parento = self.GetPyData(parent)
name = self.GetItemText(item)
parent = None
obj = None
if item != self.root:
parent = self.GetItemParent(item)
obj = self.GetPyData(parent)
# Apply dictionary syntax to dictionary items, except the root
# and first level children of a namepace.
if (type(parento) is types.DictType \
or str(type(parento))[17:23] == 'BTrees' \
and hasattr(parento, 'keys')) \
if (type(obj) is types.DictType \
or str(type(obj))[17:23] == 'BTrees' \
and hasattr(obj, 'keys')) \
and ((item != self.root and parent != self.root) \
or (parent == self.root and not self.rootIsNamespace)):
name = '[' + name + ']'
@@ -177,19 +231,19 @@ class FillingTree(wxTreeCtrl):
def setText(self, text):
"""Display information about the current selection."""
# This method will most likely be replaced by the enclosing app
# to do something more interesting, like write to a text control.
# This method will likely be replaced by the enclosing app to
# do something more interesting, like write to a text control.
print text
def setStatusText(self, text):
"""Display status information."""
# This method will most likely be replaced by the enclosing app
# to do something more interesting, like write to a status bar.
# This method will likely be replaced by the enclosing app to
# do something more interesting, like write to a status bar.
print text
if wxPlatform == '__WXMSW__':
if wx.wxPlatform == '__WXMSW__':
faces = { 'times' : 'Times New Roman',
'mono' : 'Courier New',
'helv' : 'Lucida Console',
@@ -199,12 +253,6 @@ if wxPlatform == '__WXMSW__':
'lnsize' : 9,
'backcol': '#FFFFFF',
}
# Versions of wxPython prior to 2.3.2 had a sizing bug on Win platform.
# The font was 2 points too large. So we need to reduce the font size.
if ((wxMAJOR_VERSION, wxMINOR_VERSION) == (2, 3) and wxRELEASE_NUMBER < 2) \
or (wxMAJOR_VERSION <= 2 and wxMINOR_VERSION <= 2):
faces['size'] -= 2
faces['lnsize'] -= 2
else: # GTK
faces = { 'times' : 'Times',
'mono' : 'Courier',
@@ -216,24 +264,45 @@ else: # GTK
}
class FillingText(wxStyledTextCtrl):
class FillingText(stc.wxStyledTextCtrl):
"""PyCrust FillingText based on wxStyledTextCtrl."""
name = 'PyCrust Filling Text'
revision = __revision__
def __init__(self, parent, id=-1, pos=wxDefaultPosition, \
size=wxDefaultSize, style=wxCLIP_CHILDREN):
def __init__(self, parent, id=-1, pos=wx.wxDefaultPosition,
size=wx.wxDefaultSize, style=wx.wxCLIP_CHILDREN,
static=False):
"""Create a PyCrust FillingText instance."""
wxStyledTextCtrl.__init__(self, parent, id, pos, size, style)
stc.wxStyledTextCtrl.__init__(self, parent, id, pos, size, style)
# Configure various defaults and user preferences.
self.config()
dispatcher.connect(receiver=self.fontsizer, signal='FontIncrease')
dispatcher.connect(receiver=self.fontsizer, signal='FontDecrease')
dispatcher.connect(receiver=self.fontsizer, signal='FontDefault')
if not static:
dispatcher.connect(receiver=self.push, signal='Interpreter.push')
def push(self, command, more):
"""Receiver for Interpreter.push signal."""
self.Refresh()
def fontsizer(self, signal):
"""Receiver for Font* signals."""
size = self.GetZoom()
if signal == 'FontIncrease':
size += 1
elif signal == 'FontDecrease':
size -= 1
elif signal == 'FontDefault':
size = 0
self.SetZoom(size)
def config(self):
"""Configure shell based on user preferences."""
self.SetMarginWidth(1, 0)
self.SetLexer(wxSTC_LEX_PYTHON)
self.SetLexer(stc.wxSTC_LEX_PYTHON)
self.SetKeyWords(0, ' '.join(keyword.kwlist))
self.setStyles(faces)
@@ -250,96 +319,117 @@ class FillingText(wxStyledTextCtrl):
"""Configure font size, typeface and color for lexer."""
# Default style
self.StyleSetSpec(wxSTC_STYLE_DEFAULT, "face:%(mono)s,size:%(size)d" % faces)
self.StyleSetSpec(stc.wxSTC_STYLE_DEFAULT,
"face:%(mono)s,size:%(size)d" % faces)
self.StyleClearAll()
# Built in styles
self.StyleSetSpec(wxSTC_STYLE_LINENUMBER, "back:#C0C0C0,face:%(mono)s,size:%(lnsize)d" % faces)
self.StyleSetSpec(wxSTC_STYLE_CONTROLCHAR, "face:%(mono)s" % faces)
self.StyleSetSpec(wxSTC_STYLE_BRACELIGHT, "fore:#0000FF,back:#FFFF88")
self.StyleSetSpec(wxSTC_STYLE_BRACEBAD, "fore:#FF0000,back:#FFFF88")
self.StyleSetSpec(stc.wxSTC_STYLE_LINENUMBER,
"back:#C0C0C0,face:%(mono)s,size:%(lnsize)d" % faces)
self.StyleSetSpec(stc.wxSTC_STYLE_CONTROLCHAR,
"face:%(mono)s" % faces)
self.StyleSetSpec(stc.wxSTC_STYLE_BRACELIGHT,
"fore:#0000FF,back:#FFFF88")
self.StyleSetSpec(stc.wxSTC_STYLE_BRACEBAD,
"fore:#FF0000,back:#FFFF88")
# Python styles
self.StyleSetSpec(wxSTC_P_DEFAULT, "face:%(mono)s" % faces)
self.StyleSetSpec(wxSTC_P_COMMENTLINE, "fore:#007F00,face:%(mono)s" % faces)
self.StyleSetSpec(wxSTC_P_NUMBER, "")
self.StyleSetSpec(wxSTC_P_STRING, "fore:#7F007F,face:%(mono)s" % faces)
self.StyleSetSpec(wxSTC_P_CHARACTER, "fore:#7F007F,face:%(mono)s" % faces)
self.StyleSetSpec(wxSTC_P_WORD, "fore:#00007F,bold")
self.StyleSetSpec(wxSTC_P_TRIPLE, "fore:#7F0000")
self.StyleSetSpec(wxSTC_P_TRIPLEDOUBLE, "fore:#000033,back:#FFFFE8")
self.StyleSetSpec(wxSTC_P_CLASSNAME, "fore:#0000FF,bold")
self.StyleSetSpec(wxSTC_P_DEFNAME, "fore:#007F7F,bold")
self.StyleSetSpec(wxSTC_P_OPERATOR, "")
self.StyleSetSpec(wxSTC_P_IDENTIFIER, "")
self.StyleSetSpec(wxSTC_P_COMMENTBLOCK, "fore:#7F7F7F")
self.StyleSetSpec(wxSTC_P_STRINGEOL, "fore:#000000,face:%(mono)s,back:#E0C0E0,eolfilled" % faces)
self.StyleSetSpec(stc.wxSTC_P_DEFAULT,
"face:%(mono)s" % faces)
self.StyleSetSpec(stc.wxSTC_P_COMMENTLINE,
"fore:#007F00,face:%(mono)s" % faces)
self.StyleSetSpec(stc.wxSTC_P_NUMBER,
"")
self.StyleSetSpec(stc.wxSTC_P_STRING,
"fore:#7F007F,face:%(mono)s" % faces)
self.StyleSetSpec(stc.wxSTC_P_CHARACTER,
"fore:#7F007F,face:%(mono)s" % faces)
self.StyleSetSpec(stc.wxSTC_P_WORD,
"fore:#00007F,bold")
self.StyleSetSpec(stc.wxSTC_P_TRIPLE,
"fore:#7F0000")
self.StyleSetSpec(stc.wxSTC_P_TRIPLEDOUBLE,
"fore:#000033,back:#FFFFE8")
self.StyleSetSpec(stc.wxSTC_P_CLASSNAME,
"fore:#0000FF,bold")
self.StyleSetSpec(stc.wxSTC_P_DEFNAME,
"fore:#007F7F,bold")
self.StyleSetSpec(stc.wxSTC_P_OPERATOR,
"")
self.StyleSetSpec(stc.wxSTC_P_IDENTIFIER,
"")
self.StyleSetSpec(stc.wxSTC_P_COMMENTBLOCK,
"fore:#7F7F7F")
self.StyleSetSpec(stc.wxSTC_P_STRINGEOL,
"fore:#000000,face:%(mono)s,back:#E0C0E0,eolfilled" % faces)
def SetText(self, *args, **kwds):
self.SetReadOnly(0)
wxStyledTextCtrl.SetText(self, *args, **kwds)
stc.wxStyledTextCtrl.SetText(self, *args, **kwds)
self.SetReadOnly(1)
class Filling(wxSplitterWindow):
class Filling(wx.wxSplitterWindow):
"""PyCrust Filling based on wxSplitterWindow."""
name = 'PyCrust Filling'
revision = __revision__
def __init__(self, parent, id=-1, pos=wxDefaultPosition, \
size=wxDefaultSize, style=wxSP_3D, name='Filling Window', \
rootObject=None, rootLabel=None, rootIsNamespace=0):
def __init__(self, parent, id=-1, pos=wx.wxDefaultPosition,
size=wx.wxDefaultSize, style=wx.wxSP_3D,
name='Filling Window', rootObject=None,
rootLabel=None, rootIsNamespace=0, static=False):
"""Create a PyCrust Filling instance."""
wxSplitterWindow.__init__(self, parent, id, pos, size, style, name)
self.fillingTree = FillingTree(parent=self, rootObject=rootObject, \
rootLabel=rootLabel, \
rootIsNamespace=rootIsNamespace)
self.fillingText = FillingText(parent=self)
self.SplitVertically(self.fillingTree, self.fillingText, 200)
wx.wxSplitterWindow.__init__(self, parent, id, pos, size, style, name)
self.tree = FillingTree(parent=self, rootObject=rootObject,
rootLabel=rootLabel,
rootIsNamespace=rootIsNamespace,
static=static)
self.text = FillingText(parent=self, static=static)
self.SplitVertically(self.tree, self.text, 200)
self.SetMinimumPaneSize(1)
# Override the filling so that descriptions go to fillingText.
self.fillingTree.setText = self.fillingText.SetText
# Select the root item.
self.fillingTree.SelectItem(self.fillingTree.root)
# Override the filling so that descriptions go to FillingText.
self.tree.setText = self.text.SetText
# Display the root item.
## self.tree.SelectItem(self.tree.root)
self.tree.display()
class FillingFrame(wxFrame):
class FillingFrame(wx.wxFrame):
"""Frame containing the PyCrust filling, or namespace tree component."""
name = 'PyCrust Filling Frame'
revision = __revision__
def __init__(self, parent=None, id=-1, title='PyFilling', \
pos=wxDefaultPosition, size=wxDefaultSize, \
style=wxDEFAULT_FRAME_STYLE, rootObject=None, \
rootLabel=None, rootIsNamespace=0):
def __init__(self, parent=None, id=-1, title='PyFilling',
pos=wx.wxDefaultPosition, size=wx.wxDefaultSize,
style=wx.wxDEFAULT_FRAME_STYLE, rootObject=None,
rootLabel=None, rootIsNamespace=0, static=False):
"""Create a PyCrust FillingFrame instance."""
wxFrame.__init__(self, parent, id, title, pos, size, style)
intro = 'Welcome To PyFilling - The Tastiest Namespace Inspector'
wx.wxFrame.__init__(self, parent, id, title, pos, size, style)
intro = 'PyFilling - The Tastiest Namespace Inspector'
self.CreateStatusBar()
self.SetStatusText(intro)
if wxPlatform == '__WXMSW__':
import os
filename = os.path.join(os.path.dirname(__file__), 'PyCrust.ico')
icon = wxIcon(filename, wxBITMAP_TYPE_ICO)
self.SetIcon(icon)
self.filling = Filling(parent=self, rootObject=rootObject, \
rootLabel=rootLabel, \
rootIsNamespace=rootIsNamespace)
# Override the filling so that status messages go to the status bar.
self.filling.fillingTree.setStatusText = self.SetStatusText
import images
self.SetIcon(images.getPyCrustIcon())
self.filling = Filling(parent=self, rootObject=rootObject,
rootLabel=rootLabel,
rootIsNamespace=rootIsNamespace,
static=static)
# Override so that status messages go to the status bar.
self.filling.tree.setStatusText = self.SetStatusText
class App(wxApp):
class App(wx.wxApp):
"""PyFilling standalone application."""
def OnInit(self):
wx.wxInitAllImageHandlers()
self.fillingFrame = FillingFrame()
self.fillingFrame.Show(true)
self.fillingFrame.Show(True)
self.SetTopWindow(self.fillingFrame)
return true
return True

View File

@@ -7,15 +7,22 @@ __revision__ = "$Revision$"[11:-2]
import os
import sys
from code import InteractiveInterpreter
import dispatcher
import introspect
try:
True
except NameError:
True = 1==1
False = 1==0
class Interpreter(InteractiveInterpreter):
"""PyCrust Interpreter based on code.InteractiveInterpreter."""
revision = __revision__
def __init__(self, locals=None, rawin=None, \
def __init__(self, locals=None, rawin=None,
stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr):
"""Create an interactive interpreter object."""
InteractiveInterpreter.__init__(self, locals=locals)
@@ -26,8 +33,8 @@ class Interpreter(InteractiveInterpreter):
import __builtin__
__builtin__.raw_input = rawin
del __builtin__
copyright = \
'Type "copyright", "credits" or "license" for more information.'
copyright = 'Type "help", "copyright", "credits" or "license"'
copyright += ' for more information.'
self.introText = 'Python %s on %s%s%s' % \
(sys.version, sys.platform, os.linesep, copyright)
try:
@@ -47,29 +54,32 @@ class Interpreter(InteractiveInterpreter):
"""Send command to the interpreter to be executed.
Because this may be called recursively, we append a new list
onto the commandBuffer list and then append commands into that.
If the passed in command is part of a multi-line command we keep
appending the pieces to the last list in commandBuffer until we
have a complete command. If not, we delete that last list."""
onto the commandBuffer list and then append commands into
that. If the passed in command is part of a multi-line
command we keep appending the pieces to the last list in
commandBuffer until we have a complete command. If not, we
delete that last list."""
command = str(command) # In case the command is unicode.
if not self.more:
try: del self.commandBuffer[-1]
except IndexError: pass
if not self.more: self.commandBuffer.append([])
self.commandBuffer[-1].append(command)
source = '\n'.join(self.commandBuffer[-1])
self.more = self.runsource(source)
return self.more
more = self.more = self.runsource(source)
dispatcher.send(signal='Interpreter.push', sender=self,
command=command, more=more, source=source)
return more
def runsource(self, source):
"""Compile and run source code in the interpreter."""
stdin, stdout, stderr = sys.stdin, sys.stdout, sys.stderr
sys.stdin = self.stdin
sys.stdout = self.stdout
sys.stderr = self.stderr
sys.stdin, sys.stdout, sys.stderr = \
self.stdin, self.stdout, self.stderr
more = InteractiveInterpreter.runsource(self, source)
# If sys.std* is still what we set it to, then restore it.
# But, if the executed source changed sys.std*, assume it
# was meant to be changed and leave it. Power to the people.
# But, if the executed source changed sys.std*, assume it was
# meant to be changed and leave it. Power to the people.
if sys.stdin == self.stdin:
sys.stdin = stdin
if sys.stdout == self.stdout:
@@ -86,22 +96,28 @@ class Interpreter(InteractiveInterpreter):
"""Return list of auto-completion options for a command.
The list of options will be based on the locals namespace."""
return introspect.getAutoCompleteList(command, self.locals, *args, **kwds)
stdin, stdout, stderr = sys.stdin, sys.stdout, sys.stderr
sys.stdin, sys.stdout, sys.stderr = \
self.stdin, self.stdout, self.stderr
l = introspect.getAutoCompleteList(command, self.locals,
*args, **kwds)
sys.stdin, sys.stdout, sys.stderr = stdin, stdout, stderr
return l
def getCallTip(self, command='', *args, **kwds):
"""Return call tip text for a command.
The call tip information will be based on the locals namespace."""
Call tip information will be based on the locals namespace."""
return introspect.getCallTip(command, self.locals, *args, **kwds)
class InterpreterAlaCarte(Interpreter):
"""PyCrustAlaCarte Demo Interpreter."""
def __init__(self, locals, rawin, stdin, stdout, stderr, \
def __init__(self, locals, rawin, stdin, stdout, stderr,
ps1='main prompt', ps2='continuation prompt'):
"""Create an interactive interpreter object."""
Interpreter.__init__(self, locals=locals, rawin=rawin, \
Interpreter.__init__(self, locals=locals, rawin=rawin,
stdin=stdin, stdout=stdout, stderr=stderr)
sys.ps1 = ps1
sys.ps2 = ps2

View File

@@ -1,15 +1,24 @@
"""Provides a variety of introspective-type support functions for things
like call tips and command auto completion."""
"""Provides a variety of introspective-type support functions for
things like call tips and command auto completion."""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
from __future__ import nested_scopes
import cStringIO
import inspect
import string
import tokenize
import types
def getAutoCompleteList(command='', locals=None, includeMagic=1, \
try:
True
except NameError:
True = 1==1
False = 1==0
def getAutoCompleteList(command='', locals=None, includeMagic=1,
includeSingle=1, includeDouble=1):
"""Return list of auto-completion options for command.
@@ -25,19 +34,20 @@ def getAutoCompleteList(command='', locals=None, includeMagic=1, \
except:
pass
else:
attributes = getAttributeNames(object, includeMagic, \
attributes = getAttributeNames(object, includeMagic,
includeSingle, includeDouble)
return attributes
def getAttributeNames(object, includeMagic=1, includeSingle=1, includeDouble=1):
"""Return list of unique attributes, including inherited, for an object."""
def getAttributeNames(object, includeMagic=1, includeSingle=1,
includeDouble=1):
"""Return list of unique attributes, including inherited, for object."""
attributes = []
dict = {}
if not hasattrAlwaysReturnsTrue(object):
# Add some attributes that don't always get picked up.
# If they don't apply, they'll get filtered out at the end.
attributes += ['__bases__', '__class__', '__dict__', '__name__', \
'func_closure', 'func_code', 'func_defaults', \
# Add some attributes that don't always get picked up. If
# they don't apply, they'll get filtered out at the end.
attributes += ['__bases__', '__class__', '__dict__', '__name__',
'func_closure', 'func_code', 'func_defaults',
'func_dict', 'func_doc', 'func_globals', 'func_name']
if includeMagic:
try: attributes += object._getAttributeNames()
@@ -65,19 +75,20 @@ def hasattrAlwaysReturnsTrue(object):
return hasattr(object, 'bogu5_123_aTTri8ute')
def getAllAttributeNames(object):
"""Return mapping of all attributes, including inherited, for an object.
"""Return dict of all attributes, including inherited, for an object.
Recursively walk through a class and all base classes.
"""
attrdict = {} # (object, technique, count): [list of attributes]
# !!!
# !!! Do Not use hasattr() as a test anywhere in this function,
# !!! because it is unreliable with remote objects - xmlrpc, soap, etc.
# !!! They always return true for hasattr().
# Do Not use hasattr() as a test anywhere in this function,
# because it is unreliable with remote objects: xmlrpc, soap, etc.
# They always return true for hasattr().
# !!!
try:
# Yes, this can fail if object is an instance of a class with
# __str__ (or __repr__) having a bug or raising an exception. :-(
# Yes, this can fail if object is an instance of a class with
# __str__ (or __repr__) having a bug or raising an
# exception. :-(
key = str(object)
except:
key = 'anonymous'
@@ -102,7 +113,8 @@ def getAllAttributeNames(object):
pass
else:
if klass is object:
# Break a circular reference. This happens with extension classes.
# Break a circular reference. This happens with extension
# classes.
pass
else:
attrdict.update(getAllAttributeNames(klass))
@@ -152,7 +164,7 @@ def getCallTip(command='', locals=None):
if dropSelf:
# The first parameter to a method is a reference to an
# instance, usually coded as "self", and is usually passed
# automatically by Python and therefore we want to drop it.
# automatically by Python; therefore we want to drop it.
temp = argspec.split(',')
if len(temp) == 1: # No other arguments.
argspec = '()'
@@ -167,10 +179,15 @@ def getCallTip(command='', locals=None):
# "Return call tip text for a command."
# tip3 is the rest of the docstring, like:
# "The call tip information will be based on ... <snip>
firstline = doc.split('\n')[0].lstrip()
if tip1 == firstline:
tip1 = ''
else:
tip1 += '\n\n'
docpieces = doc.split('\n\n')
tip2 = docpieces[0]
tip3 = '\n\n'.join(docpieces[1:])
tip = '%s\n\n%s\n\n%s' % (tip1, tip2, tip3)
tip = '%s%s\n\n%s' % (tip1, tip2, tip3)
else:
tip = tip1
calltip = (name, argspec[1:-1], tip.strip())
@@ -179,47 +196,108 @@ def getCallTip(command='', locals=None):
def getRoot(command, terminator=None):
"""Return the rightmost root portion of an arbitrary Python command.
Return only the root portion that can be eval()'d without side effects.
The command would normally terminate with a "(" or ".". The terminator
and anything after the terminator will be dropped."""
root = ''
validChars = "._" + string.uppercase + string.lowercase + string.digits
emptyTypes = ("''", '""', '""""""', "''''''", '[]', '()', '{}')
validSeparators = string.whitespace + ',+-*/=%<>&|^~:([{'
# Drop the final terminator and anything that follows.
Return only the root portion that can be eval()'d without side
effects. The command would normally terminate with a '(' or
'.'. The terminator and anything after the terminator will be
dropped."""
command = rtrimTerminus(command, terminator)
if len(command) == 0:
root = ''
elif command in emptyTypes and terminator in ('.', '', None):
# Let empty type delimiter pairs go through.
root = command
tokens = getTokens(command)
if not tokens:
return ''
if tokens[-1][0] is tokenize.ENDMARKER:
# Remove the end marker.
del tokens[-1]
if terminator == '.' and \
(tokens[-1][1] <> '.' or tokens[-1][0] is not tokenize.OP):
# Trap decimals in numbers, versus the dot operator.
return ''
else:
# Go backward through the command until we hit an "invalid" character.
i = len(command)
while i and command[i-1] in validChars:
i -= 1
# Default to everything from the "invalid" character to the end.
root = command[i:]
# Override certain exceptions.
if i > 0 and command[i-1] in ("'", '"'):
# Detect situations where we are in the middle of a string.
# This code catches the simplest case, but needs to catch others.
root = ''
elif ((2 <= i < len(command) and command[i] == '.') \
or (2 <= i <= len(command) and terminator in ('.', '', None))) \
and command[i-2:i] in emptyTypes:
# Allow empty types to get through.
# Don't confuse an empty tupple with an argumentless callable.
if i == 2 or (i >= 3 and command[i-3] in validSeparators):
root = command[i-2:]
return root
# Strip off the terminator.
command = command[:-1]
command = command.rstrip()
tokens = getTokens(command)
tokens.reverse()
line = ''
start = None
prefix = ''
laststring = '.'
emptyTypes = ('[]', '()', '{}')
for token in tokens:
tokentype = token[0]
tokenstring = token[1]
line = token[4]
if tokentype is tokenize.ENDMARKER:
continue
if tokentype in (tokenize.NAME, tokenize.STRING, tokenize.NUMBER) \
and laststring != '.':
# We've reached something that's not part of the root.
if prefix and line[token[3][1]] != ' ':
# If it doesn't have a space after it, remove the prefix.
prefix = ''
break
if tokentype in (tokenize.NAME, tokenize.STRING, tokenize.NUMBER) \
or (tokentype is tokenize.OP and tokenstring == '.'):
if prefix:
# The prefix isn't valid because it comes after a dot.
prefix = ''
break
else:
# start represents the last known good point in the line.
start = token[2][1]
elif len(tokenstring) == 1 and tokenstring in ('[({])}'):
# Remember, we're working backwords.
# So prefix += tokenstring would be wrong.
if prefix in emptyTypes and tokenstring in ('[({'):
# We've already got an empty type identified so now we
# are in a nested situation and we can break out with
# what we've got.
break
else:
prefix = tokenstring + prefix
else:
# We've reached something that's not part of the root.
break
laststring = tokenstring
if start is None:
start = len(line)
root = line[start:]
if prefix in emptyTypes:
# Empty types are safe to be eval()'d and introspected.
root = prefix + root
return root
def getTokens(command):
"""Return list of token tuples for command."""
command = str(command) # In case the command is unicode, which fails.
f = cStringIO.StringIO(command)
# tokens is a list of token tuples, each looking like:
# (type, string, (srow, scol), (erow, ecol), line)
tokens = []
# Can't use list comprehension:
# tokens = [token for token in tokenize.generate_tokens(f.readline)]
# because of need to append as much as possible before TokenError.
try:
## This code wasn't backward compatible with Python 2.1.3.
##
## for token in tokenize.generate_tokens(f.readline):
## tokens.append(token)
# This works with Python 2.1.3 (with nested_scopes).
def eater(*args):
tokens.append(args)
tokenize.tokenize_loop(f.readline, eater)
except tokenize.TokenError:
# This is due to a premature EOF, which we expect since we are
# feeding in fragments of Python code.
pass
return tokens
def rtrimTerminus(command, terminator=None):
"""Return command minus the final terminator and anything that follows."""
"""Return command minus anything that fillows the final terminator."""
if terminator:
pieces = command.split(terminator)
if len(pieces) > 1:
command = terminator.join(pieces[:-1])
command = terminator.join(pieces[:-1]) + terminator
return command
def getBaseObject(object):
@@ -228,12 +306,14 @@ def getBaseObject(object):
# Builtin functions don't have an argspec that we can get.
dropSelf = 0
elif inspect.ismethod(object):
# Get the function from the object otherwise inspect.getargspec()
# complains that the object isn't a Python function.
# Get the function from the object otherwise
# inspect.getargspec() complains that the object isn't a
# Python function.
try:
if object.im_self is None:
# This is an unbound method so we do not drop self from the
# argspec, since an instance must be passed as the first arg.
# This is an unbound method so we do not drop self
# from the argspec, since an instance must be passed
# as the first arg.
dropSelf = 0
else:
dropSelf = 1
@@ -269,6 +349,3 @@ def getConstructor(object):
if constructor is not None:
return constructor
return None

View File

@@ -4,88 +4,97 @@ __author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
try:
True
except NameError:
True = 1==1
False = 1==0
class PseudoKeyword:
"""A callable class that calls a method passed as a parameter.
Good for creating a pseudo keyword in the python runtime
environment. The keyword is really an object that has a repr()
that calls itself which calls the method that was passed in the
init of the object. All this just to avoid having to type in the
closing parens on a method. So, for example:
>>> quit = PseudoKeyword(SomeObject.someMethod)
>>> quit
SomeObject.someMethod gets executed as if it had been called
directly and the user didn't have to type the parens, like
"quit()". This technique is most applicable for pseudo keywords
'quit()'. This technique is most applicable for pseudo keywords
like quit, exit and help.
If SomeObject.someMethod can take parameters, they can still be
passed by using the keyword in the traditional way with parens.
"""
If SomeObject.someMethod can take parameters, they can still be
passed by using the keyword in the traditional way with parens."""
def __init__(self, method):
"""Create a callable object that executes method when called."""
if callable(method):
self.method = method
else:
raise ValueError, 'method must be callable'
def __call__(self, *args, **kwds):
self.method(*args, **kwds)
def __repr__(self):
self()
return ''
class PseudoFile:
def __init__(self):
"""Create a file-like object."""
pass
def readline(self):
pass
def write(self, s):
pass
def writelines(self, l):
map(self.write, l)
def flush(self):
pass
def isatty(self):
pass
class PseudoFileIn(PseudoFile):
def __init__(self, readline):
def __init__(self, readline, readlines=None):
if callable(readline):
self.readline = readline
else:
raise ValueError, 'readline must be callable'
if callable(readlines):
self.readlines = readlines
def isatty(self):
return 1
class PseudoFileOut(PseudoFile):
def __init__(self, write):
if callable(write):
self.write = write
else:
raise ValueError, 'write must be callable'
def isatty(self):
return 1
class PseudoFileErr(PseudoFile):
def __init__(self, write):
@@ -93,9 +102,6 @@ class PseudoFileErr(PseudoFile):
self.write = write
else:
raise ValueError, 'write must be callable'
def isatty(self):
return 1

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,226 @@
"""Shell menu mixin shared by shell and crust."""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
from wxPython import wx
import sys
from version import VERSION
try:
True
except NameError:
True = 1==1
False = 1==0
ID_AUTOCOMP = wx.wxNewId()
ID_AUTOCOMP_SHOW = wx.wxNewId()
ID_AUTOCOMP_INCLUDE_MAGIC = wx.wxNewId()
ID_AUTOCOMP_INCLUDE_SINGLE = wx.wxNewId()
ID_AUTOCOMP_INCLUDE_DOUBLE = wx.wxNewId()
ID_CALLTIPS = wx.wxNewId()
ID_CALLTIPS_SHOW = wx.wxNewId()
ID_COPY_PLUS = wx.wxNewId()
ID_PASTE_PLUS = wx.wxNewId()
ID_WRAP = wx.wxNewId()
class ShellMenu:
"""Mixin class to add standard menu items."""
def createMenus(self):
m = self.fileMenu = wx.wxMenu()
m.AppendSeparator()
m.Append(wx.wxID_EXIT, 'E&xit', 'Exit PyCrust')
m = self.editMenu = wx.wxMenu()
m.Append(wx.wxID_UNDO, '&Undo \tCtrl+Z',
'Undo the last action')
m.Append(wx.wxID_REDO, '&Redo \tCtrl+Y',
'Redo the last undone action')
m.AppendSeparator()
m.Append(wx.wxID_CUT, 'Cu&t \tCtrl+X',
'Cut the selection')
m.Append(wx.wxID_COPY, '&Copy \tCtrl+C',
'Copy the selection - removing prompts')
m.Append(ID_COPY_PLUS, 'Cop&y Plus \tCtrl+Shift+C',
'Copy the selection - retaining prompts')
m.Append(wx.wxID_PASTE, '&Paste \tCtrl+V', 'Paste')
m.Append(ID_PASTE_PLUS, 'Past&e Plus \tCtrl+Shift+V',
'Paste and run commands')
m.AppendSeparator()
m.Append(wx.wxID_CLEAR, 'Cle&ar',
'Delete the selection')
m.Append(wx.wxID_SELECTALL, 'Select A&ll \tCtrl+A',
'Select all text')
m = self.autocompMenu = wx.wxMenu()
m.Append(ID_AUTOCOMP_SHOW, 'Show Auto Completion',
'Show auto completion during dot syntax', 1)
m.Append(ID_AUTOCOMP_INCLUDE_MAGIC, 'Include Magic Attributes',
'Include attributes visible to __getattr__ and __setattr__',
1)
m.Append(ID_AUTOCOMP_INCLUDE_SINGLE, 'Include Single Underscores',
'Include attibutes prefixed by a single underscore', 1)
m.Append(ID_AUTOCOMP_INCLUDE_DOUBLE, 'Include Double Underscores',
'Include attibutes prefixed by a double underscore', 1)
m = self.calltipsMenu = wx.wxMenu()
m.Append(ID_CALLTIPS_SHOW, 'Show Call Tips',
'Show call tips with argument specifications', 1)
m = self.optionsMenu = wx.wxMenu()
m.AppendMenu(ID_AUTOCOMP, '&Auto Completion', self.autocompMenu,
'Auto Completion Options')
m.AppendMenu(ID_CALLTIPS, '&Call Tips', self.calltipsMenu,
'Call Tip Options')
m.Append(ID_WRAP, '&Wrap Lines',
'Wrap lines at right edge', 1)
m = self.helpMenu = wx.wxMenu()
m.AppendSeparator()
m.Append(wx.wxID_ABOUT, '&About...', 'About PyCrust')
b = self.menuBar = wx.wxMenuBar()
b.Append(self.fileMenu, '&File')
b.Append(self.editMenu, '&Edit')
b.Append(self.optionsMenu, '&Options')
b.Append(self.helpMenu, '&Help')
self.SetMenuBar(b)
wx.EVT_MENU(self, wx.wxID_EXIT, self.OnExit)
wx.EVT_MENU(self, wx.wxID_UNDO, self.OnUndo)
wx.EVT_MENU(self, wx.wxID_REDO, self.OnRedo)
wx.EVT_MENU(self, wx.wxID_CUT, self.OnCut)
wx.EVT_MENU(self, wx.wxID_COPY, self.OnCopy)
wx.EVT_MENU(self, ID_COPY_PLUS, self.OnCopyPlus)
wx.EVT_MENU(self, wx.wxID_PASTE, self.OnPaste)
wx.EVT_MENU(self, ID_PASTE_PLUS, self.OnPastePlus)
wx.EVT_MENU(self, wx.wxID_CLEAR, self.OnClear)
wx.EVT_MENU(self, wx.wxID_SELECTALL, self.OnSelectAll)
wx.EVT_MENU(self, wx.wxID_ABOUT, self.OnAbout)
wx.EVT_MENU(self, ID_AUTOCOMP_SHOW,
self.OnAutoCompleteShow)
wx.EVT_MENU(self, ID_AUTOCOMP_INCLUDE_MAGIC,
self.OnAutoCompleteIncludeMagic)
wx.EVT_MENU(self, ID_AUTOCOMP_INCLUDE_SINGLE,
self.OnAutoCompleteIncludeSingle)
wx.EVT_MENU(self, ID_AUTOCOMP_INCLUDE_DOUBLE,
self.OnAutoCompleteIncludeDouble)
wx.EVT_MENU(self, ID_CALLTIPS_SHOW,
self.OnCallTipsShow)
wx.EVT_MENU(self, ID_WRAP, self.OnWrap)
wx.EVT_UPDATE_UI(self, wx.wxID_UNDO, self.OnUpdateMenu)
wx.EVT_UPDATE_UI(self, wx.wxID_REDO, self.OnUpdateMenu)
wx.EVT_UPDATE_UI(self, wx.wxID_CUT, self.OnUpdateMenu)
wx.EVT_UPDATE_UI(self, wx.wxID_COPY, self.OnUpdateMenu)
wx.EVT_UPDATE_UI(self, ID_COPY_PLUS, self.OnUpdateMenu)
wx.EVT_UPDATE_UI(self, wx.wxID_PASTE, self.OnUpdateMenu)
wx.EVT_UPDATE_UI(self, ID_PASTE_PLUS, self.OnUpdateMenu)
wx.EVT_UPDATE_UI(self, wx.wxID_CLEAR, self.OnUpdateMenu)
wx.EVT_UPDATE_UI(self, ID_AUTOCOMP_SHOW, self.OnUpdateMenu)
wx.EVT_UPDATE_UI(self, ID_AUTOCOMP_INCLUDE_MAGIC, self.OnUpdateMenu)
wx.EVT_UPDATE_UI(self, ID_AUTOCOMP_INCLUDE_SINGLE, self.OnUpdateMenu)
wx.EVT_UPDATE_UI(self, ID_AUTOCOMP_INCLUDE_DOUBLE, self.OnUpdateMenu)
wx.EVT_UPDATE_UI(self, ID_CALLTIPS_SHOW, self.OnUpdateMenu)
wx.EVT_UPDATE_UI(self, ID_WRAP, self.OnUpdateMenu)
def OnExit(self, event):
self.Close(True)
def OnUndo(self, event):
self.shell.Undo()
def OnRedo(self, event):
self.shell.Redo()
def OnCut(self, event):
self.shell.Cut()
def OnCopy(self, event):
self.shell.Copy()
def OnCopyPlus(self, event):
self.shell.CopyWithPrompts()
def OnPaste(self, event):
self.shell.Paste()
def OnPastePlus(self, event):
self.shell.PasteAndRun()
def OnClear(self, event):
self.shell.Clear()
def OnSelectAll(self, event):
self.shell.SelectAll()
def OnAbout(self, event):
"""Display an About PyCrust window."""
title = 'About PyCrust'
text = 'PyCrust %s\n\n' % VERSION + \
'Yet another Python shell, only flakier.\n\n' + \
'Half-baked by Patrick K. O\'Brien,\n' + \
'the other half is still in the oven.\n\n' + \
'Shell Revision: %s\n' % self.shell.revision + \
'Interpreter Revision: %s\n\n' % self.shell.interp.revision + \
'Python Version: %s\n' % sys.version.split()[0] + \
'wxPython Version: %s\n' % wx.__version__ + \
'Platform: %s\n' % sys.platform
dialog = wx.wxMessageDialog(self, text, title,
wx.wxOK | wx.wxICON_INFORMATION)
dialog.ShowModal()
dialog.Destroy()
def OnAutoCompleteShow(self, event):
self.shell.autoComplete = event.IsChecked()
def OnAutoCompleteIncludeMagic(self, event):
self.shell.autoCompleteIncludeMagic = event.IsChecked()
def OnAutoCompleteIncludeSingle(self, event):
self.shell.autoCompleteIncludeSingle = event.IsChecked()
def OnAutoCompleteIncludeDouble(self, event):
self.shell.autoCompleteIncludeDouble = event.IsChecked()
def OnCallTipsShow(self, event):
self.shell.autoCallTip = event.IsChecked()
def OnWrap(self, event):
self.shell.SetWrapMode(event.IsChecked())
def OnUpdateMenu(self, event):
"""Update menu items based on current status."""
id = event.GetId()
if id == wx.wxID_UNDO:
event.Enable(self.shell.CanUndo())
elif id == wx.wxID_REDO:
event.Enable(self.shell.CanRedo())
elif id == wx.wxID_CUT:
event.Enable(self.shell.CanCut())
elif id == wx.wxID_COPY:
event.Enable(self.shell.CanCopy())
elif id == ID_COPY_PLUS:
event.Enable(self.shell.CanCopy())
elif id == wx.wxID_PASTE:
event.Enable(self.shell.CanPaste())
elif id == ID_PASTE_PLUS:
event.Enable(self.shell.CanPaste())
elif id == wx.wxID_CLEAR:
event.Enable(self.shell.CanCut())
elif id == ID_AUTOCOMP_SHOW:
event.Check(self.shell.autoComplete)
elif id == ID_AUTOCOMP_INCLUDE_MAGIC:
event.Check(self.shell.autoCompleteIncludeMagic)
elif id == ID_AUTOCOMP_INCLUDE_SINGLE:
event.Check(self.shell.autoCompleteIncludeSingle)
elif id == ID_AUTOCOMP_INCLUDE_DOUBLE:
event.Check(self.shell.autoCompleteIncludeDouble)
elif id == ID_CALLTIPS_SHOW:
event.Check(self.shell.autoCallTip)
elif id == ID_WRAP:
event.Check(self.shell.GetWrapMode())

View File

@@ -1,10 +1,11 @@
"""Provides an object representing the current "version" or "release" of
PyCrust as a whole. Individual classes, such as the shell, filling and
interpreter, each have a revision property based on the CVS Revision."""
"""Provides an object representing the current 'version' or 'release'
of PyCrust as a whole. Individual classes, such as the shell, filling
and interpreter, each have a revision property based on the CVS
Revision."""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
VERSION = '0.7.2'
VERSION = '0.9'

View File

@@ -0,0 +1,56 @@
"""Wrap is a command line utility that runs a wxPython program with
additional runtime-tools, such as PyCrust."""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
import os
import sys
from wxPython import wx
from crust import CrustFrame as Frame
try:
True
except NameError:
True = 1==1
False = 1==0
def wrap(app):
wx.wxInitAllImageHandlers()
frame = Frame()
frame.SetSize((750, 525))
frame.Show(True)
frame.shell.interp.locals['app'] = app
app.MainLoop()
def main(argv):
if len(argv) < 2:
print "Please specify a module name."
raise SystemExit
name = argv[1]
if name[-3:] == '.py':
name = name[:-3]
module = __import__(name)
# Find the App class.
App = None
d = module.__dict__
for item in d.keys():
try:
if issubclass(d[item], wx.wxApp):
App = d[item]
except (NameError, TypeError):
pass
if App is None:
print "No App class found."
raise SystemExit
app = App()
wrap(app)
if __name__ == '__main__':
sys.path.insert(0, os.curdir)
main(sys.argv)

View File

@@ -0,0 +1,58 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import Object
import Parameters as wx
class AcceleratorEntry:
""""""
def __init__(self):
""""""
pass
def __del__(self):
""""""
pass
def GetCommand(self):
""""""
pass
def GetFlags(self):
""""""
pass
def GetKeyCode(self):
""""""
pass
def Set(self):
""""""
pass
class AcceleratorTable(Object):
""""""
def __init__(self):
""""""
pass
def __del__(self):
""""""
pass

View File

@@ -0,0 +1,358 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import EvtHandler
import Parameters as wx
try:
True
except NameError:
True = 1==1
False = 1==0
class PyApp(EvtHandler):
"""Python Application base class.
It is used to:
- set and get application-wide properties;
- implement the windowing system message or event loop;
- initiate application processing via App.OnInit;
- allow default processing of events not handled by other objects
in the application."""
def __init__(self):
"""Create a PyApp instance."""
pass
def Dispatch(self):
"""Dispatches the next event in the windowing system event
queue.
This can be used for programming event loops."""
pass
def ExitMainLoop(self):
"""Call this to explicitly exit the main message (event) loop.
You should normally exit the main loop (and the application)
by deleting the top window, which wxPython does automatically."""
pass
def GetAppName(self):
"""Return the application name."""
pass
def GetAssertMode(self):
"""Return the current assertion mode."""
pass
def GetAuto3D(self):
"""Returns True if 3D control mode is on, False otherwise.
Windows only."""
pass
def GetClassName(self):
"""Return the class name of the application."""
pass
def GetExitOnFrameDelete(self):
"""Returns True if the application will exit when the
top-level window is deleted, False otherwise."""
pass
def GetPrintMode(self):
"""Deprecated."""
pass
def GetTopWindow(self):
"""Return the top window.
If the top window hasn't been set using App.SetTopWindow,
this method will find the first top-level window (frame or
dialog) and return that."""
pass
def GetUseBestVisual(self):
"""Return True if the application will use the best visual on
systems that support different visuals, False otherwise."""
pass
def GetVendorName(self):
"""Return the application's vendor name."""
pass
def Initialized(self):
"""Return True if the application has been initialized
(i.e. if App.OnInit has returned successfully). This can be
useful for error message routines to determine which method of
output is best for the current state of the program (some
windowing systems may not like dialogs to pop up before the
main loop has been entered)."""
pass
def MainLoop(self):
"""Called by wxWindows on creation of the application.
Override this if you wish to provide your own
(environment-dependent) main loop.
Return 0 under X, and the wParam of the WM_QUIT message under
Windows."""
pass
def OnAssert(self, file, line, cond, msg):
"""Called when an assert failure occurs, i.e. the condition
specified in ASSERT macro evaluated to FALSE. It is only
called in debug mode (when __WXDEBUG__ is defined) as asserts
are not left in the release code at all.
The base class version show the default assert failure dialog
box proposing to the user to stop the program, continue or
ignore all subsequent asserts.
file is the name of the source file where the assert occured
line is the line number in this file where the assert occured
cond is the condition of the failed assert in string form
msg is the message specified as argument to ASSERT_MSG or
FAIL_MSG, will be NULL if just ASSERT or FAIL was used"""
pass
def OnExit(self):
"""Provide this member function for any processing which needs
to be done as the application is about to exit. OnExit is
called after destroying all application windows and controls,
but before wxWindows cleanup."""
pass
def OnInit(self):
"""This must be provided by the application, and will usually
create the application's main window, optionally calling
App.SetTopWindow.
Return True to continue processing, False to exit the
application."""
pass
def OnInitGui(self):
"""Called just after the platform's GUI has been initialized,
but before the App.OnInit() gets called. Rarely needed in
practice. Unlike App.OnInit(), does not need to return
True/False."""
pass
def Pending(self):
"""Return True if unprocessed events are in the window system
event queue."""
pass
def ProcessIdle(self):
"""Sends the EVT_IDLE event and is called inside the MainLoop.
You only need this if you implement your own main loop."""
pass
def SetAppName(self, name):
"""Set the name of the application."""
pass
def SetAssertMode(self, mode):
"""Lets you control how C++ assertions are processed.
Valid modes are: PYAPP_ASSERT_SUPPRESS,
PYAPP_ASSERT_EXCEPTION, and PYAPP_ASSERT_DIALOG. Using
_SUPPRESS will give you behavior like the old final builds and
the assert will be ignored, _EXCEPTION is the new default
described above, and _DIALOG is like the default in 2.3.3.1
and prior hybrid builds. You can also combine _EXCEPTION and
_DIALOG if you wish, although I don't know why you would."""
pass
def SetAuto3D(self, auto3D):
"""Switches automatic 3D controls on or off. Windows only.
If auto3D is True, all controls will be created with 3D
appearances unless overridden for a control or dialog. The
default is True."""
pass
def SetClassName(self, name):
"""Set the class name of the application."""
pass
def SetExitOnFrameDelete(self, flag):
"""If flag is True (the default), the application will exit
when the top-level frame is deleted. If False, the
application will continue to run."""
pass
def SetPrintMode(self, mode):
"""Deprecated."""
pass
def SetTopWindow(self, window):
"""Set the 'top' window.
You can call this from within App.OnInit to let wxWindows
know which is the main window. You don't have to set the top
window; it is only a convenience so that (for example) certain
dialogs without parents can use a specific window as the top
window. If no top window is specified by the application,
wxWindows just uses the first frame or dialog in its top-level
window list, when it needs to use the top window."""
pass
def SetUseBestVisual(self, flag):
"""Allows the programmer to specify whether the application
will use the best visual on systems that support several
visual on the same display. This is typically the case under
Solaris and IRIX, where the default visual is only 8-bit
whereas certain applications are supposed to run in TrueColour
mode.
Note that this function has to be called in the constructor of
the App instance and won't have any effect when called later
on.
This function currently only has effect under GTK."""
pass
def SetVendorName(self, name):
"""Sets the name of application's vendor. The name will be
used in registry access."""
pass
def Yield(self, onlyIfNeeded=False):
"""Yields control to pending messages in the windowing system.
This can be useful, for example, when a time-consuming process
writes to a text window. Without an occasional yield, the
text window will not be updated properly, and on systems with
cooperative multitasking, such as Windows 3.1 other processes
will not respond.
Caution should be exercised, however, since yielding may allow
the user to perform actions which are not compatible with the
current task. Disabling menu items or whole menus during
processing can avoid unwanted reentrance of code: see
wx.SafeYield for a better function.
Calling Yield() recursively is normally an error and an assert
failure is raised in debug build if such situation is
detected. However if the the onlyIfNeeded parameter is True,
the method will just silently return False instead."""
pass
from wxPython.wx import wxPlatform
_redirect = (wxPlatform == '__WXMSW__' or wxPlatform == '__WXMAC__')
del wxPlatform
class App(PyApp):
"""The main application class.
Inherit from this class and implement an OnInit method that
creates a frame and then calls self.SetTopWindow(frame)."""
def __init__(self, redirect=_redirect, filename=None, useBestVisual=False):
"""Create an App instance.
redirect defaults to True on Windows and Mac. If redirect is
True, stdio goes to an output window or a file if filename is
not None."""
pass
del _redirect
class PyOnDemandOutputWindow:
"""Used by App to display stdout and stderr messages if app is
created using App(redirect=True). Mostly useful on Windows or
Mac where apps aren't always launched from the command line."""
pass
class PySimpleApp(App):
"""Use instead of App for simple apps with a simple frame or
dialog, particularly for testing."""
def __init__(self, flag=0):
"""Create a PySimpleApp instance.
flag is the same as App's redirect parameter to redirect stdio."""
pass
def OnInit(self):
"""Automatically does a wx.InitAllImageHandlers()."""
pass
class PyWidgetTester(App):
"""Use instead of App for testing widgets. Provides a frame
containing an instance of a widget.
Create a PyWidgetTester instance with the desired size for the
frame, then create the widget and show the frame using SetWidget."""
def __init__(self, size=(250, 100)):
"""Create a PyWidgetTester instance, with no stdio redirection.
size is for the frame to hold the widget."""
pass
def OnInit(self):
"""Creates a frame that will hold the widget to be tested."""
pass
def SetWidget(self, widgetClass, *args):
"""Create a widgetClass instance using the supplied args and
with a frame as parent, then show the frame."""
pass
class SingleInstanceChecker:
"""Allows one to check that only a single instance of a program is
running. To do it, you should create an object of this class. As
long as this object is alive, calls to IsAnotherRunning() from
other processes will return True.
As the object should have the life span as big as possible, it
makes sense to create it either as a global or in App.OnInit()."""
def __init__(self, name, path=wx.EmptyString):
"""Create a SingleInstanceChecker instance.
name should be as unique as possible. It is used as the mutex
name under Win32 and the lock file name under Unix.
App.GetAppName() and wx.GetUserId() are commonly used.
path is optional and is ignored under Win32 and used as the
directory to create the lock file in under Unix (default is
wx.GetHomeDir())."""
pass
def Create(self, name, path=wx.EmptyString):
"""Create a SingleInstanceChecker instance."""
pass
def IsAnotherRunning(self):
"""Return True if another copy of this program is already running."""
pass

View File

@@ -0,0 +1,206 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
import Parameters as wx
class Object:
"""Base class for all other wxPython classes."""
def __init__(self):
"""Create a Object instance."""
pass
def Destroy(self):
"""Destroy the Object instance."""
pass
def GetClassName(self):
"""Return the name of the class."""
pass
class EvtHandler(Object):
"""Base class that can handle events from the windowing system.
If the handler is part of a chain, the destructor will unlink
itself and restore the previous and next handlers so that they
point to each other."""
def __init__(self):
"""Create a EvtHandler instance."""
pass
def AddPendingEvent(self, event):
"""Post an event to be processed later.
event is an Event instance to add to process queue.
The difference between sending an event (using the
ProcessEvent method) and posting it is that in the first case
the event is processed before the function returns, while in
the second case, the function returns immediately and the
event will be processed sometime later (usually during the
next event loop iteration).
A copy of event is made by the function, so the original can
be deleted as soon as function returns (it is common that the
original is created on the stack). This requires that the
Event::Clone method be implemented by event so that it can
be duplicated and stored until it gets processed.
This is also the method to call for inter-thread
communication. It will post events safely between different
threads which means that this method is thread-safe by using
critical sections where needed. In a multi-threaded program,
you often need to inform the main GUI thread about the status
of other working threads and such notification should be done
using this method.
This method automatically wakes up idle handling if the
underlying window system is currently idle and thus would not
send any idle events. (Waking up idle handling is done
calling WakeUpIdle.)"""
pass
def Connect(self, id, lastId, eventType, func):
"""Connects the given function dynamically with the event
handler, id and event type. This is an alternative to the use
of static event tables.
id is the identifier (or first of the identifier range) to be
associated with the event handler function.
lastId is the second part of the identifier range to be
associated with the event handler function.
eventType is the event type to be associated with this event
handler.
function is the event handler function.
userData is data to be associated with the event table entry."""
pass
def Disconnect(self, id, lastId=-1, eventType=wx.EVT_NULL):
"""Disconnects the given function dynamically from the event
handler, using the specified parameters as search criteria and
returning True if a matching function has been found and
removed. This method can only disconnect functions which have
been added using the EvtHandler.Connect method. There is no
way to disconnect functions connected using the (static) event
tables.
id is the identifier (or first of the identifier range) to be
associated with the event handler function.
lastId is the second part of the identifier range to be
associated with the event handler function.
eventType is the event type to be associated with this event
handler.
function is the event handler function.
userData is data to be associated with the event table entry."""
pass
def GetEvtHandlerEnabled(self):
"""Return True if the event handler is enabled, False
otherwise."""
pass
def GetNextHandler(self):
"""Return the next handler in the chain."""
pass
def GetPreviousHandler(self):
"""Return the previous handler in the chain."""
pass
def ProcessEvent(self, event):
"""Processes an event, searching event tables and calling zero
or more suitable event handler function(s). Return True if a
suitable event handler function was found and executed, and
the function did not call Event.Skip().
event is an Event to process.
Normally, your application would not call this function: it is
called in the wxPython implementation to dispatch incoming
user interface events to the framework (and application).
However, you might need to call it if implementing new
functionality (such as a new control) where you define new
event types, as opposed to allowing the user to override
virtual functions.
An instance where you might actually override the ProcessEvent
function is where you want to direct event processing to event
handlers not normally noticed by wxWindows. For example, in
the document/view architecture, documents and views are
potential event handlers. When an event reaches a frame,
ProcessEvent will need to be called on the associated document
and view in case event handler functions are associated with
these objects. The property classes library (Property) also
overrides ProcessEvent for similar reasons.
The normal order of event table searching is as follows:
1. If the object is disabled (via a call to
EvtHandler.SetEvtHandlerEnabled) the function skips to step
(6).
2. If the object is a Window, ProcessEvent is recursively
called on the window's Validator. If this returns TRUE, the
function exits.
3. SearchEventTable is called for this event handler. If this
fails, the base class table is tried, and so on until no more
tables exist or an appropriate function was found, in which
case the function exits.
4. The search is applied down the entire chain of event
handlers (usually the chain has a length of one). If this
succeeds, the function exits.
5. If the object is a Window and the event is a
CommandEvent, ProcessEvent is recursively applied to the
parent window's event handler. If this returns TRUE, the
function exits.
6. Finally, ProcessEvent is called on the App object.
See also:
EvtHandler::SearchEventTable"""
pass
def SetEvtHandlerEnabled(self, enabled):
"""Enable or disable the event handler.
You can use this function to avoid having to remove the event
handler from the chain, for example when implementing a dialog
editor and changing from edit to test mode."""
pass
def SetNextHandler(self, handler):
"""Set the pointer to the next handler."""
pass
def SetPreviousHandler(self, handler):
"""Set the pointer to the previous handler."""
pass

View File

@@ -0,0 +1,485 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import Object
import Parameters as wx
class Clipboard(Object):
""""""
def AddData(self):
""""""
pass
def Clear(self):
""""""
pass
def Close(self):
""""""
pass
def Flush(self):
""""""
pass
def GetData(self):
""""""
pass
def IsOpened(self):
""""""
pass
def IsSupported(self):
""""""
pass
def Open(self):
""""""
pass
def SetData(self):
""""""
pass
def UsePrimarySelection(self):
""""""
pass
def __init__(self):
""""""
pass
class DataFormat:
""""""
def GetId(self):
""""""
pass
def GetType(self):
""""""
pass
def SetId(self):
""""""
pass
def SetType(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class DataObject:
""""""
def GetAllFormats(self):
""""""
pass
def GetDataHere(self):
""""""
pass
def GetDataSize(self):
""""""
pass
def GetFormatCount(self):
""""""
pass
def GetPreferredFormat(self):
""""""
pass
def IsSupportedFormat(self):
""""""
pass
def SetData(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class DataObjectComposite(DataObject):
""""""
def Add(self):
""""""
pass
def __init__(self):
""""""
pass
class DataObjectSimple(DataObject):
""""""
def GetFormat(self):
""""""
pass
def SetFormat(self):
""""""
pass
def __init__(self):
""""""
pass
class PyDataObjectSimple(DataObjectSimple):
""""""
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
class BitmapDataObject(DataObjectSimple):
""""""
def GetBitmap(self):
""""""
pass
def SetBitmap(self):
""""""
pass
def __init__(self):
""""""
pass
class PyBitmapDataObject(BitmapDataObject):
""""""
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
class CustomDataObject(DataObjectSimple):
""""""
def GetData(self):
""""""
pass
def GetSize(self):
""""""
pass
def SetData(self):
""""""
pass
def TakeData(self):
""""""
pass
def __init__(self):
""""""
pass
class DragImage(Object):
""""""
def BeginDrag(self):
""""""
pass
def BeginDrag2(self):
""""""
pass
def EndDrag(self):
""""""
pass
def GetImageRect(self):
""""""
pass
def Hide(self):
""""""
pass
def Move(self):
""""""
pass
def RedrawImage(self):
""""""
pass
def SetBackingBitmap(self):
""""""
pass
def Show(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class DropSource:
""""""
def DoDragDrop(self):
""""""
pass
def GetDataObject(self):
""""""
pass
def SetCursor(self):
""""""
pass
def SetData(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
def base_GiveFeedback(self):
""""""
pass
class DropTarget:
""""""
def __init__(self):
""""""
pass
class PyDropTarget(DropTarget):
""""""
def GetData(self):
""""""
pass
def GetDataObject(self):
""""""
pass
def SetDataObject(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
def base_OnDragOver(self):
""""""
pass
def base_OnDrop(self):
""""""
pass
def base_OnEnter(self):
""""""
pass
def base_OnLeave(self):
""""""
pass
class FileDataObject(DataObjectSimple):
""""""
def GetFilenames(self):
""""""
pass
def __init__(self):
""""""
pass
class FileDropTarget(PyDropTarget):
""""""
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
def base_OnData(self):
""""""
pass
def base_OnDragOver(self):
""""""
pass
def base_OnDrop(self):
""""""
pass
def base_OnEnter(self):
""""""
pass
def base_OnLeave(self):
""""""
pass
class TextDataObject(DataObjectSimple):
""""""
def GetText(self):
""""""
pass
def GetTextLength(self):
""""""
pass
def SetText(self):
""""""
pass
def __init__(self):
""""""
pass
class PyTextDataObject(TextDataObject):
""""""
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
class TextDropTarget(PyDropTarget):
""""""
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
def base_OnData(self):
""""""
pass
def base_OnDragOver(self):
""""""
pass
def base_OnDrop(self):
""""""
pass
def base_OnEnter(self):
""""""
pass
def base_OnLeave(self):
""""""
pass
class URLDataObject(DataObjectComposite):
""""""
def GetURL(self):
""""""
pass
def SetURL(self):
""""""
pass
def __init__(self):
""""""
pass

View File

@@ -0,0 +1,199 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
import Parameters as wx
class ConfigBase:
""""""
def DeleteAll(self):
""""""
pass
def DeleteEntry(self):
""""""
pass
def DeleteGroup(self):
""""""
pass
def Exists(self):
""""""
pass
def ExpandEnvVars(self):
""""""
pass
def Flush(self):
""""""
pass
def GetAppName(self):
""""""
pass
def GetEntryType(self):
""""""
pass
def GetFirstEntry(self):
""""""
pass
def GetFirstGroup(self):
""""""
pass
def GetNextEntry(self):
""""""
pass
def GetNextGroup(self):
""""""
pass
def GetNumberOfEntries(self):
""""""
pass
def GetNumberOfGroups(self):
""""""
pass
def GetPath(self):
""""""
pass
def GetStyle(self):
""""""
pass
def GetVendorName(self):
""""""
pass
def HasEntry(self):
""""""
pass
def HasGroup(self):
""""""
pass
def IsExpandingEnvVars(self):
""""""
pass
def IsRecordingDefaults(self):
""""""
pass
def Read(self):
""""""
pass
def ReadBool(self):
""""""
pass
def ReadFloat(self):
""""""
pass
def ReadInt(self):
""""""
pass
def RenameEntry(self):
""""""
pass
def RenameGroup(self):
""""""
pass
def SetAppName(self):
""""""
pass
def SetExpandEnvVars(self):
""""""
pass
def SetPath(self):
""""""
pass
def SetRecordDefaults(self):
""""""
pass
def SetStyle(self):
""""""
pass
def SetVendorName(self):
""""""
pass
def Write(self):
""""""
pass
def WriteBool(self):
""""""
pass
def WriteFloat(self):
""""""
pass
def WriteInt(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class Config(ConfigBase):
""""""
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class FileConfig(ConfigBase):
""""""
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,485 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
import Parameters as wx
class Point:
""""""
def Set(self):
""""""
pass
def __add__(self):
""""""
pass
def __del__(self):
""""""
pass
def __eq__(self):
""""""
pass
def __getattr__(self):
""""""
pass
def __getitem__(self):
""""""
pass
def __init__(self):
""""""
pass
def __len__(self):
""""""
pass
def __ne__(self):
""""""
pass
def __nonzero__(self):
""""""
pass
def __setattr__(self):
""""""
pass
def __setitem__(self):
""""""
pass
def __str__(self):
""""""
pass
def __sub__(self):
""""""
pass
def asTuple(self):
""""""
pass
class Point2DDouble:
""""""
def GetCrossProduct(self):
""""""
pass
def GetDistance(self):
""""""
pass
def GetDistanceSquare(self):
""""""
pass
def GetDotProduct(self):
""""""
pass
def GetFloor(self):
""""""
pass
def GetRounded(self):
""""""
pass
def GetVectorAngle(self):
""""""
pass
def GetVectorLength(self):
""""""
pass
def Normalize(self):
""""""
pass
def SetPolarCoordinates(self):
""""""
pass
def SetVectorAngle(self):
""""""
pass
def SetVectorLength(self):
""""""
pass
def __eq__(self):
""""""
pass
def __getattr__(self):
""""""
pass
def __getitem__(self):
""""""
pass
def __iadd__(self):
""""""
pass
def __idiv__(self):
""""""
pass
def __imul__(self):
""""""
pass
def __init__(self):
""""""
pass
def __isub__(self):
""""""
pass
def __len__(self):
""""""
pass
def __ne__(self):
""""""
pass
def __neg__(self):
""""""
pass
def __nonzero__(self):
""""""
pass
def __setattr__(self):
""""""
pass
def __setitem__(self):
""""""
pass
def __str__(self):
""""""
pass
def asTuple(self):
""""""
pass
class RealPoint:
""""""
def Set(self):
""""""
pass
def __add__(self):
""""""
pass
def __del__(self):
""""""
pass
def __eq__(self):
""""""
pass
def __getattr__(self):
""""""
pass
def __getitem__(self):
""""""
pass
def __init__(self):
""""""
pass
def __len__(self):
""""""
pass
def __ne__(self):
""""""
pass
def __nonzero__(self):
""""""
pass
def __setattr__(self):
""""""
pass
def __setitem__(self):
""""""
pass
def __str__(self):
""""""
pass
def __sub__(self):
""""""
pass
def asTuple(self):
""""""
pass
class Rect:
""""""
def GetBottom(self):
""""""
pass
def GetHeight(self):
""""""
pass
def GetLeft(self):
""""""
pass
def GetPosition(self):
""""""
pass
def GetRight(self):
""""""
pass
def GetSize(self):
""""""
pass
def GetTop(self):
""""""
pass
def GetWidth(self):
""""""
pass
def GetX(self):
""""""
pass
def GetY(self):
""""""
pass
def Inflate(self):
""""""
pass
def Inside(self):
""""""
pass
def SetBottom(self):
""""""
pass
def SetHeight(self):
""""""
pass
def SetLeft(self):
""""""
pass
def SetPosition(self):
""""""
pass
def SetRight(self):
""""""
pass
def SetSize(self):
""""""
pass
def SetTop(self):
""""""
pass
def SetWidth(self):
""""""
pass
def SetX(self):
""""""
pass
def SetY(self):
""""""
pass
def __add__(self):
""""""
pass
def __del__(self):
""""""
pass
def __eq__(self):
""""""
pass
def __getattr__(self):
""""""
pass
def __getitem__(self):
""""""
pass
def __init__(self):
""""""
pass
def __len__(self):
""""""
pass
def __ne__(self):
""""""
pass
def __nonzero__(self):
""""""
pass
def __setattr__(self):
""""""
pass
def __setitem__(self):
""""""
pass
def __str__(self):
""""""
pass
def asTuple(self):
""""""
pass
class Size:
""""""
def GetHeight(self):
""""""
pass
def GetWidth(self):
""""""
pass
def GetX(self):
""""""
pass
def GetY(self):
""""""
pass
def Set(self):
""""""
pass
def SetHeight(self):
""""""
pass
def SetWidth(self):
""""""
pass
def __del__(self):
""""""
pass
def __eq__(self):
""""""
pass
def __getattr__(self):
""""""
pass
def __getitem__(self):
""""""
pass
def __init__(self):
""""""
pass
def __len__(self):
""""""
pass
def __ne__(self):
""""""
pass
def __nonzero__(self):
""""""
pass
def __setattr__(self):
""""""
pass
def __setitem__(self):
""""""
pass
def __str__(self):
""""""
pass
def asTuple(self):
""""""
pass

View File

@@ -0,0 +1,553 @@
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
import Parameters as wx
class DateSpan:
""""""
def Add(self):
""""""
pass
def GetDays(self):
""""""
pass
def GetMonths(self):
""""""
pass
def GetTotalDays(self):
""""""
pass
def GetWeeks(self):
""""""
pass
def GetYears(self):
""""""
pass
def Multiply(self):
""""""
pass
def Neg(self):
""""""
pass
def SetDays(self):
""""""
pass
def SetMonths(self):
""""""
pass
def SetWeeks(self):
""""""
pass
def SetYears(self):
""""""
pass
def Subtract(self):
""""""
pass
def __add__(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
def __mul__(self):
""""""
pass
def __neg__(self):
""""""
pass
def __rmul__(self):
""""""
pass
def __sub__(self):
""""""
pass
class DateTime:
""""""
def AddDS(self):
""""""
pass
def AddTS(self):
""""""
pass
def Format(self):
""""""
pass
def FormatDate(self):
""""""
pass
def FormatISODate(self):
""""""
pass
def FormatISOTime(self):
""""""
pass
def FormatTime(self):
""""""
pass
def GetDay(self):
""""""
pass
def GetDayOfYear(self):
""""""
pass
def GetHour(self):
""""""
pass
def GetJDN(self):
""""""
pass
def GetJulianDayNumber(self):
""""""
pass
def GetLastMonthDay(self):
""""""
pass
def GetLastWeekDay(self):
""""""
pass
def GetMJD(self):
""""""
pass
def GetMillisecond(self):
""""""
pass
def GetMinute(self):
""""""
pass
def GetModifiedJulianDayNumber(self):
""""""
pass
def GetMonth(self):
""""""
pass
def GetNextWeekDay(self):
""""""
pass
def GetPrevWeekDay(self):
""""""
pass
def GetRataDie(self):
""""""
pass
def GetSecond(self):
""""""
pass
def GetTicks(self):
""""""
pass
def GetWeek(self):
""""""
pass
def GetWeekDay(self):
""""""
pass
def GetWeekDayInSameWeek(self):
""""""
pass
def GetWeekOfMonth(self):
""""""
pass
def GetWeekOfYear(self):
""""""
pass
def GetYear(self):
""""""
pass
def GetYearDay(self):
""""""
pass
def IsBetween(self):
""""""
pass
def IsDST(self):
""""""
pass
def IsEarlierThan(self):
""""""
pass
def IsEqualTo(self):
""""""
pass
def IsEqualUpTo(self):
""""""
pass
def IsLaterThan(self):
""""""
pass
def IsSameDate(self):
""""""
pass
def IsSameTime(self):
""""""
pass
def IsStrictlyBetween(self):
""""""
pass
def IsValid(self):
""""""
pass
def IsWorkDay(self):
""""""
pass
def MakeGMT(self):
""""""
pass
def MakeTimezone(self):
""""""
pass
def ParseDate(self):
""""""
pass
def ParseDateTime(self):
""""""
pass
def ParseFormat(self):
""""""
pass
def ParseRfc822Date(self):
""""""
pass
def ParseTime(self):
""""""
pass
def ResetTime(self):
""""""
pass
def Set(self):
""""""
pass
def SetDay(self):
""""""
pass
def SetHMS(self):
""""""
pass
def SetHour(self):
""""""
pass
def SetJDN(self):
""""""
pass
def SetMillisecond(self):
""""""
pass
def SetMinute(self):
""""""
pass
def SetMonth(self):
""""""
pass
def SetSecond(self):
""""""
pass
def SetTimeT(self):
""""""
pass
def SetToCurrent(self):
""""""
pass
def SetToLastMonthDay(self):
""""""
pass
def SetToLastWeekDay(self):
""""""
pass
def SetToNextWeekDay(self):
""""""
pass
def SetToPrevWeekDay(self):
""""""
pass
def SetToTheWeek(self):
""""""
pass
def SetToWeekDay(self):
""""""
pass
def SetToWeekDayInSameWeek(self):
""""""
pass
def SetToYearDay(self):
""""""
pass
def SetYear(self):
""""""
pass
def Subtract(self):
""""""
pass
def SubtractDS(self):
""""""
pass
def SubtractTS(self):
""""""
pass
def ToGMT(self):
""""""
pass
def ToTimezone(self):
""""""
pass
def __add__(self):
""""""
pass
def __cmp__(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
def __str__(self):
""""""
pass
def __sub__(self):
""""""
pass
def _wxDateTimePtr__add__DS(self):
""""""
pass
def _wxDateTimePtr__add__TS(self):
""""""
pass
def _wxDateTimePtr__sub__DS(self):
""""""
pass
def _wxDateTimePtr__sub__DT(self):
""""""
pass
def _wxDateTimePtr__sub__TS(self):
""""""
pass
class TimeSpan:
""""""
def Abs(self):
""""""
pass
def Add(self):
""""""
pass
def Format(self):
""""""
pass
def GetDays(self):
""""""
pass
def GetHours(self):
""""""
pass
def GetMilliseconds(self):
""""""
pass
def GetMinutes(self):
""""""
pass
def GetSeconds(self):
""""""
pass
def GetWeeks(self):
""""""
pass
def IsEqualTo(self):
""""""
pass
def IsLongerThan(self):
""""""
pass
def IsNegative(self):
""""""
pass
def IsNull(self):
""""""
pass
def IsPositive(self):
""""""
pass
def IsShorterThan(self):
""""""
pass
def Multiply(self):
""""""
pass
def Neg(self):
""""""
pass
def Subtract(self):
""""""
pass
def __add__(self):
""""""
pass
def __cmp__(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
def __mul__(self):
""""""
pass
def __neg__(self):
""""""
pass
def __rmul__(self):
""""""
pass
def __sub__(self):
""""""
pass

View File

@@ -0,0 +1,471 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import Object
from Frames import Frame
import Parameters as wx
from Window import TopLevelWindow
class Dialog(TopLevelWindow):
""""""
def Centre(self):
""""""
pass
def Create(self):
""""""
pass
def CreateButtonSizer(self):
""""""
pass
def CreateTextSizer(self):
""""""
pass
def EndModal(self):
""""""
pass
def GetReturnCode(self):
""""""
pass
def IsModal(self):
""""""
pass
def SetModal(self):
""""""
pass
def SetReturnCode(self):
""""""
pass
def ShowModal(self):
""""""
pass
def __init__(self):
""""""
pass
class ColourDialog(Dialog):
""""""
def GetColourData(self):
""""""
pass
def ShowModal(self):
""""""
pass
def __init__(self):
""""""
pass
class ColourData(Object):
""""""
def GetChooseFull(self):
""""""
pass
def GetColour(self):
""""""
pass
def GetCustomColour(self):
""""""
pass
def SetChooseFull(self):
""""""
pass
def SetColour(self):
""""""
pass
def SetCustomColour(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class ColourDatabase(Object):
""""""
def Append(self):
""""""
pass
def FindColour(self):
""""""
pass
def FindName(self):
""""""
pass
def __init__(self):
""""""
pass
class DirDialog(Dialog):
""""""
def GetMessage(self):
""""""
pass
def GetPath(self):
""""""
pass
def GetStyle(self):
""""""
pass
def SetMessage(self):
""""""
pass
def SetPath(self):
""""""
pass
def ShowModal(self):
""""""
pass
def __init__(self):
""""""
pass
class FileDialog(Dialog):
""""""
def GetDirectory(self):
""""""
pass
def GetFilename(self):
""""""
pass
def GetFilenames(self):
""""""
pass
def GetFilterIndex(self):
""""""
pass
def GetMessage(self):
""""""
pass
def GetPath(self):
""""""
pass
def GetPaths(self):
""""""
pass
def GetStyle(self):
""""""
pass
def GetWildcard(self):
""""""
pass
def SetDirectory(self):
""""""
pass
def SetFilename(self):
""""""
pass
def SetFilterIndex(self):
""""""
pass
def SetMessage(self):
""""""
pass
def SetPath(self):
""""""
pass
def SetStyle(self):
""""""
pass
def SetWildcard(self):
""""""
pass
def ShowModal(self):
""""""
pass
def __init__(self):
""""""
pass
class FindReplaceDialog(Dialog):
""""""
def Create(self):
""""""
pass
def GetData(self):
""""""
pass
def SetData(self):
""""""
pass
def __init__(self):
""""""
pass
class FindReplaceData(Object):
""""""
def GetFindString(self):
""""""
pass
def GetFlags(self):
""""""
pass
def GetReplaceString(self):
""""""
pass
def SetFindString(self):
""""""
pass
def SetFlags(self):
""""""
pass
def SetReplaceString(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class FontDialog(Dialog):
""""""
def GetFontData(self):
""""""
pass
def ShowModal(self):
""""""
pass
def __init__(self):
""""""
pass
class FontData(Object):
""""""
def EnableEffects(self):
""""""
pass
def GetAllowSymbols(self):
""""""
pass
def GetChosenFont(self):
""""""
pass
def GetColour(self):
""""""
pass
def GetEnableEffects(self):
""""""
pass
def GetInitialFont(self):
""""""
pass
def GetShowHelp(self):
""""""
pass
def SetAllowSymbols(self):
""""""
pass
def SetChosenFont(self):
""""""
pass
def SetColour(self):
""""""
pass
def SetInitialFont(self):
""""""
pass
def SetRange(self):
""""""
pass
def SetShowHelp(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class MessageDialog(Dialog):
""""""
def ShowModal(self):
""""""
pass
def __init__(self):
""""""
pass
class MultiChoiceDialog(Dialog):
""""""
def GetSelections(self):
""""""
pass
def SetSelections(self):
""""""
pass
def __init__(self):
""""""
pass
class ProgressDialog(Frame):
""""""
def Resume(self):
""""""
pass
def Update(self):
""""""
pass
def __init__(self):
""""""
pass
class SingleChoiceDialog(Dialog):
""""""
def GetSelection(self):
""""""
pass
def GetStringSelection(self):
""""""
pass
def SetSelection(self):
""""""
pass
def ShowModal(self):
""""""
pass
def __init__(self):
""""""
pass
class TextEntryDialog(Dialog):
""""""
def GetValue(self):
""""""
pass
def SetValue(self):
""""""
pass
def ShowModal(self):
""""""
pass
def __init__(self):
""""""
pass

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,25 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
class PyAssertionError(AssertionError):
""""""
pass
class PyDeadObjectError(AttributeError):
"""Instances of wx objects that are OOR capable will have their
__class__ attribute changed to a _wxPyDeadObject class when the
C++ object is deleted. Subsequent attempts to access object
attributes will raise this error, rather than segfault."""
pass

View File

@@ -0,0 +1,794 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
def EVT_ACTIVATE(win, func):
""""""
pass
def EVT_ACTIVATE_APP(win, func):
""""""
pass
def EVT_BUTTON(win, id, func):
""""""
pass
def EVT_CALCULATE_LAYOUT():
""""""
pass
def EVT_CHAR(win, func):
""""""
pass
def EVT_CHAR_HOOK(win, func):
""""""
pass
def EVT_CHECKBOX(win, id, func):
""""""
pass
def EVT_CHECKLISTBOX(win, id, func):
""""""
pass
def EVT_CHILD_FOCUS(win, func):
""""""
pass
def EVT_CHOICE(win, id, func):
""""""
pass
def EVT_CLOSE(win, func):
""""""
pass
def EVT_COMBOBOX(win, id, func):
""""""
pass
def EVT_COMMAND(win, id, cmd, func):
""""""
pass
def EVT_COMMAND_ENTER(win, id, func):
""""""
pass
def EVT_COMMAND_FIND():
""""""
pass
def EVT_COMMAND_FIND_CLOSE():
""""""
pass
def EVT_COMMAND_FIND_NEXT():
""""""
pass
def EVT_COMMAND_FIND_REPLACE():
""""""
pass
def EVT_COMMAND_FIND_REPLACE_ALL():
""""""
pass
def EVT_COMMAND_KILL_FOCUS(win, id, func):
""""""
pass
def EVT_COMMAND_LEFT_CLICK(win, id, func):
""""""
pass
def EVT_COMMAND_LEFT_DCLICK(win, id, func):
""""""
pass
def EVT_COMMAND_RANGE(win, id1, id2, cmd, func):
""""""
pass
def EVT_COMMAND_RIGHT_CLICK(win, id, func):
""""""
pass
def EVT_COMMAND_RIGHT_DCLICK(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLL(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLLWIN(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLLWIN_BOTTOM(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLLWIN_LINEDOWN(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLLWIN_LINEUP(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLLWIN_PAGEDOWN(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLLWIN_PAGEUP(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLLWIN_THUMBRELEASE(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLLWIN_THUMBTRACK(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLLWIN_TOP(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLL_BOTTOM(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLL_ENDSCROLL(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLL_LINEDOWN(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLL_LINEUP(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLL_PAGEDOWN(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLL_PAGEUP(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLL_THUMBRELEASE(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLL_THUMBTRACK(win, id, func):
""""""
pass
def EVT_COMMAND_SCROLL_TOP(win, id, func):
""""""
pass
def EVT_COMMAND_SET_FOCUS(win, id, func):
""""""
pass
def EVT_CONTEXT_MENU(win, func):
""""""
pass
def EVT_DISPLAY_CHANGED(win, func):
""""""
pass
def EVT_DROP_FILES(win, func):
""""""
pass
def EVT_END_PROCESS(eh, id, func):
""""""
pass
def EVT_END_SESSION(win, func):
""""""
pass
def EVT_ENTER_WINDOW(win, func):
""""""
pass
def EVT_ERASE_BACKGROUND(win, func):
""""""
pass
def EVT_ICONIZE(win, func):
""""""
pass
def EVT_IDLE(win, func):
""""""
pass
def EVT_INIT_DIALOG(win, func):
""""""
pass
def EVT_JOYSTICK_EVENTS(win, func):
""""""
pass
def EVT_JOY_DOWN(win, func):
""""""
pass
def EVT_JOY_MOVE(win, func):
""""""
pass
def EVT_JOY_UP(win, func):
""""""
pass
def EVT_JOY_ZMOVE(win, func):
""""""
pass
def EVT_KEY_DOWN(win, func):
""""""
pass
def EVT_KEY_UP(win, func):
""""""
pass
def EVT_KILL_FOCUS(win, func):
""""""
pass
def EVT_LEAVE_WINDOW(win, func):
""""""
pass
def EVT_LEFT_DCLICK(win, func):
""""""
pass
def EVT_LEFT_DOWN(win, func):
""""""
pass
def EVT_LEFT_UP(win, func):
""""""
pass
def EVT_LISTBOX(win, id, func):
""""""
pass
def EVT_LISTBOX_DCLICK(win, id, func):
""""""
pass
def EVT_LIST_BEGIN_DRAG():
""""""
pass
def EVT_LIST_BEGIN_LABEL_EDIT():
""""""
pass
def EVT_LIST_BEGIN_RDRAG():
""""""
pass
def EVT_LIST_CACHE_HINT():
""""""
pass
def EVT_LIST_COL_BEGIN_DRAG():
""""""
pass
def EVT_LIST_COL_CLICK():
""""""
pass
def EVT_LIST_COL_DRAGGING():
""""""
pass
def EVT_LIST_COL_END_DRAG():
""""""
pass
def EVT_LIST_COL_RIGHT_CLICK():
""""""
pass
def EVT_LIST_DELETE_ALL_ITEMS():
""""""
pass
def EVT_LIST_DELETE_ITEM():
""""""
pass
def EVT_LIST_END_LABEL_EDIT():
""""""
pass
def EVT_LIST_GET_INFO():
""""""
pass
def EVT_LIST_INSERT_ITEM():
""""""
pass
def EVT_LIST_ITEM_ACTIVATED():
""""""
pass
def EVT_LIST_ITEM_DESELECTED():
""""""
pass
def EVT_LIST_ITEM_FOCUSED():
""""""
pass
def EVT_LIST_ITEM_MIDDLE_CLICK():
""""""
pass
def EVT_LIST_ITEM_RIGHT_CLICK():
""""""
pass
def EVT_LIST_ITEM_SELECTED():
""""""
pass
def EVT_LIST_KEY_DOWN():
""""""
pass
def EVT_LIST_SET_INFO():
""""""
pass
def EVT_MAXIMIZE(win, func):
""""""
pass
def EVT_MENU(win, id, func):
""""""
pass
def EVT_MENU_CLOSE(win, func):
""""""
pass
def EVT_MENU_HIGHLIGHT(win, id, func):
""""""
pass
def EVT_MENU_HIGHLIGHT_ALL(win, func):
""""""
pass
def EVT_MENU_OPEN(win, func):
""""""
pass
def EVT_MENU_RANGE(win, id1, id2, func):
""""""
pass
def EVT_MIDDLE_DCLICK(win, func):
""""""
pass
def EVT_MIDDLE_DOWN(win, func):
""""""
pass
def EVT_MIDDLE_UP(win, func):
""""""
pass
def EVT_MOTION(win, func):
""""""
pass
def EVT_MOUSEWHEEL(win, func):
""""""
pass
def EVT_MOUSE_CAPTURE_CHANGED(win, func):
""""""
pass
def EVT_MOUSE_EVENTS(win, func):
""""""
pass
def EVT_MOVE(win, func):
""""""
pass
def EVT_NAVIGATION_KEY(win, func):
""""""
pass
def EVT_NOTEBOOK_PAGE_CHANGED(win, id, func):
""""""
pass
def EVT_NOTEBOOK_PAGE_CHANGING(win, id, func):
""""""
pass
def EVT_PAINT(win, func):
""""""
pass
def EVT_PALETTE_CHANGED(win, func):
""""""
pass
def EVT_QUERY_END_SESSION(win, func):
""""""
pass
def EVT_QUERY_LAYOUT_INFO():
""""""
pass
def EVT_QUERY_NEW_PALETTE(win, func):
""""""
pass
def EVT_RADIOBOX(win, id, func):
""""""
pass
def EVT_RADIOBUTTON(win, id, func):
""""""
pass
def EVT_RIGHT_DCLICK(win, func):
""""""
pass
def EVT_RIGHT_DOWN(win, func):
""""""
pass
def EVT_RIGHT_UP(win, func):
""""""
pass
def EVT_SASH_DRAGGED(win, id, func):
""""""
pass
def EVT_SASH_DRAGGED_RANGE(win, id1, id2, func):
""""""
pass
def EVT_SCROLL(win, func):
""""""
pass
def EVT_SCROLLWIN(win, func):
""""""
pass
def EVT_SCROLLWIN_BOTTOM(win, func):
""""""
pass
def EVT_SCROLLWIN_LINEDOWN(win, func):
""""""
pass
def EVT_SCROLLWIN_LINEUP(win, func):
""""""
pass
def EVT_SCROLLWIN_PAGEDOWN(win, func):
""""""
pass
def EVT_SCROLLWIN_PAGEUP(win, func):
""""""
pass
def EVT_SCROLLWIN_THUMBRELEASE(win, func):
""""""
pass
def EVT_SCROLLWIN_THUMBTRACK(win, func):
""""""
pass
def EVT_SCROLLWIN_TOP(win, func):
""""""
pass
def EVT_SCROLL_BOTTOM(win, func):
""""""
pass
def EVT_SCROLL_ENDSCROLL(win, func):
""""""
pass
def EVT_SCROLL_LINEDOWN(win, func):
""""""
pass
def EVT_SCROLL_LINEUP(win, func):
""""""
pass
def EVT_SCROLL_PAGEDOWN(win, func):
""""""
pass
def EVT_SCROLL_PAGEUP(win, func):
""""""
pass
def EVT_SCROLL_THUMBRELEASE(win, func):
""""""
pass
def EVT_SCROLL_THUMBTRACK(win, func):
""""""
pass
def EVT_SCROLL_TOP(win, func):
""""""
pass
def EVT_SET_CURSOR(win, func):
""""""
pass
def EVT_SET_FOCUS(win, func):
""""""
pass
def EVT_SHOW(win, func):
""""""
pass
def EVT_SIZE():
""""""
pass
def EVT_SLIDER(win, id, func):
""""""
pass
def EVT_SPIN(win, id, func):
""""""
pass
def EVT_SPINCTRL(win, id, func):
""""""
pass
def EVT_SPIN_DOWN(win, id, func):
""""""
pass
def EVT_SPIN_UP(win, id, func):
""""""
pass
def EVT_SPLITTER_DOUBLECLICKED(win, id, func):
""""""
pass
def EVT_SPLITTER_SASH_POS_CHANGED(win, id, func):
""""""
pass
def EVT_SPLITTER_SASH_POS_CHANGING(win, id, func):
""""""
pass
def EVT_SPLITTER_UNSPLIT(win, id, func):
""""""
pass
def EVT_SYS_COLOUR_CHANGED(win, func):
""""""
pass
def EVT_TASKBAR_LEFT_DCLICK(win, func):
""""""
pass
def EVT_TASKBAR_LEFT_DOWN(win, func):
""""""
pass
def EVT_TASKBAR_LEFT_UP(win, func):
""""""
pass
def EVT_TASKBAR_MOVE(win, func):
""""""
pass
def EVT_TASKBAR_RIGHT_DCLICK(win, func):
""""""
pass
def EVT_TASKBAR_RIGHT_DOWN(win, func):
""""""
pass
def EVT_TASKBAR_RIGHT_UP(win, func):
""""""
pass
def EVT_TEXT(win, id, func):
""""""
pass
def EVT_TEXT_ENTER(win, id, func):
""""""
pass
def EVT_TEXT_MAXLEN(win, id, func):
""""""
pass
def EVT_TEXT_URL(win, id, func):
""""""
pass
def EVT_TIMER(win, id, func):
""""""
pass
def EVT_TOGGLEBUTTON(win, id, func):
""""""
pass
def EVT_TOOL(win, id, func):
""""""
pass
def EVT_TOOL_ENTER(win, id, func):
""""""
pass
def EVT_TOOL_RANGE(win, id, id2, func):
""""""
pass
def EVT_TOOL_RCLICKED(win, id, func):
""""""
pass
def EVT_TOOL_RCLICKED_RANGE(win, id, id2, func):
""""""
pass
def EVT_TREE_BEGIN_DRAG():
""""""
pass
def EVT_TREE_BEGIN_LABEL_EDIT():
""""""
pass
def EVT_TREE_BEGIN_RDRAG():
""""""
pass
def EVT_TREE_DELETE_ITEM():
""""""
pass
def EVT_TREE_END_DRAG():
""""""
pass
def EVT_TREE_END_LABEL_EDIT():
""""""
pass
def EVT_TREE_GET_INFO():
""""""
pass
def EVT_TREE_ITEM_ACTIVATED():
""""""
pass
def EVT_TREE_ITEM_COLLAPSED():
""""""
pass
def EVT_TREE_ITEM_COLLAPSING():
""""""
pass
def EVT_TREE_ITEM_EXPANDED():
""""""
pass
def EVT_TREE_ITEM_EXPANDING():
""""""
pass
def EVT_TREE_ITEM_MIDDLE_CLICK():
""""""
pass
def EVT_TREE_ITEM_RIGHT_CLICK():
""""""
pass
def EVT_TREE_KEY_DOWN():
""""""
pass
def EVT_TREE_SEL_CHANGED():
""""""
pass
def EVT_TREE_SEL_CHANGING():
""""""
pass
def EVT_TREE_SET_INFO():
""""""
pass
def EVT_UPDATE_UI(win, id, func):
""""""
pass
def EVT_UPDATE_UI_RANGE(win, id, id2, func):
""""""
pass
def EVT_VLBOX(win, id, func):
""""""
pass
def EVT_WINDOW_CREATE(win, func):
""""""
pass
def EVT_WINDOW_DESTROY(win, func):
""""""
pass

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,193 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import Object
import Parameters as wx
class FSFile(Object):
""""""
def GetAnchor(self):
""""""
pass
def GetLocation(self):
""""""
pass
def GetMimeType(self):
""""""
pass
def GetModificationTime(self):
""""""
pass
def GetStream(self):
""""""
pass
def __init__(self):
""""""
pass
class FileSystem(Object):
""""""
def ChangePathTo(self):
""""""
pass
def FindFirst(self):
""""""
pass
def FindNext(self):
""""""
pass
def GetPath(self):
""""""
pass
def OpenFile(self):
""""""
pass
def __init__(self):
""""""
pass
class CPPFileSystemHandler(Object):
""""""
def __init__(self):
""""""
pass
class FileSystemHandler(CPPFileSystemHandler):
""""""
def CanOpen(self):
""""""
pass
def FindFirst(self):
""""""
pass
def FindNext(self):
""""""
pass
def GetAnchor(self):
""""""
pass
def GetLeftLocation(self):
""""""
pass
def GetMimeTypeFromExt(self):
""""""
pass
def GetProtocol(self):
""""""
pass
def GetRightLocation(self):
""""""
pass
def OpenFile(self):
""""""
pass
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
class InternetFSHandler(CPPFileSystemHandler):
""""""
def CanOpen(self):
""""""
pass
def OpenFile(self):
""""""
pass
def __init__(self):
""""""
pass
class MemoryFSHandler(CPPFileSystemHandler):
""""""
def CanOpen(self):
""""""
pass
def FindFirst(self):
""""""
pass
def FindNext(self):
""""""
pass
def OpenFile(self):
""""""
pass
def __init__(self):
""""""
pass
class ZipFSHandler(CPPFileSystemHandler):
""""""
def CanOpen(self):
""""""
pass
def FindFirst(self):
""""""
pass
def FindNext(self):
""""""
pass
def OpenFile(self):
""""""
pass
def __init__(self):
""""""
pass

View File

@@ -0,0 +1,440 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import Object
import Parameters as wx
from Window import TopLevelWindow, Window
class Frame(TopLevelWindow):
"""A frame is a window whose size and position can (usually) be
changed by the user. It usually has thick borders and a title bar,
and can optionally contain a menu bar, toolbar and status bar. A
frame can contain any window that is not a frame or dialog.
A frame that has a status bar and toolbar created via the
CreateStatusBar/CreateToolBar functions manages these windows, and
adjusts the value returned by GetClientSize to reflect the
remaining size available to application windows.
An application should normally define a CloseEvent handler for the
frame to respond to system close events, for example so that
related data and subwindows can be cleaned up."""
def __init__(self, parent, id, title, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE,
name=wx.PyFrameNameStr):
"""Create a Frame instance.
parent - The window parent. This may be NULL. If it is
non-NULL, the frame will always be displayed on top of the
parent window on Windows.
id - The window identifier. It may take a value of -1 to
indicate a default value.
title - The caption to be displayed on the frame's title bar.
pos - The window position. A value of (-1, -1) indicates a
default position, chosen by either the windowing system or
wxWindows, depending on platform.
size - The window size. A value of (-1, -1) indicates a
default size, chosen by either the windowing system or
wxWindows, depending on platform.
style - The window style.
name - The name of the window. This parameter is used to
associate a name with the item, allowing the application user
to set Motif resource values for individual windows."""
pass
def Create(self, parent, id, title, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE,
name=wx.PyFrameNameStr):
"""Create a Frame instance."""
pass
def Command(self, id):
"""Simulate a menu command; id is a menu item identifier."""
pass
def CreateStatusBar(self, number=1, style=wx.ST_SIZEGRIP, id=-1,
name=wx.PyStatusLineNameStr):
"""Create a status bar at the bottom of frame.
number - The number of fields to create. Specify a value
greater than 1 to create a multi-field status bar.
style - The status bar style. See wx.StatusBar for a list of
valid styles.
id - The status bar window identifier. If -1, an identifier
will be chosen by wxWindows.
name - The status bar window name.
The width of the status bar is the whole width of the frame
(adjusted automatically when resizing), and the height and
text size are chosen by the host windowing system.
By default, the status bar is an instance of wx.StatusBar."""
pass
def CreateToolBar(self, style=wx.NO_BORDER|wx.TB_HORIZONTAL, id=-1,
name=wx.PyToolBarNameStr):
"""Create a toolbar at the top or left of frame.
style - The toolbar style. See wxToolBar for a list of valid
styles.
id - The toolbar window identifier. If -1, an identifier will
be chosen by wxWindows.
name - The toolbar window name.
By default, the toolbar is an instance of wx.ToolBar (which is
defined to be a suitable toolbar class on each platform, such
as wx.ToolBar95).
When a toolbar has been created with this function, or made
known to the frame with wx.Frame.SetToolBar, the frame will
manage the toolbar position and adjust the return value from
wx.Window.GetClientSize to reflect the available space for
application windows."""
pass
def DoGiveHelp(self, text, show):
"""Show help text (typically in the statusbar).
show is False if you are hiding the help, True otherwise.
Meant to be overridden if a derived frame wants to do
something else with help text from menus and etc. The default
implementation simply calls Frame.SetStatusText."""
pass
def GetClientAreaOrigin(self):
"""Return origin of frame client area (in client coordinates).
It may be different from (0, 0) if the frame has a toolbar."""
pass
def GetMenuBar(self):
"""Return menubar currently associated with frame (if any)."""
pass
def GetStatusBar(self):
"""Return status bar currently associated with frame (if any)."""
pass
def GetStatusBarPane(self):
"""Return status bar pane used to display menu and toolbar
help."""
pass
def GetToolBar(self):
"""Return toolbar currently associated with frame (if any)."""
pass
def PopStatusText(self, number=0):
"""Redraw status bar with previous status text.
number - The status field (starting from zero)."""
pass
def ProcessCommand(self, id):
"""Process menu command; return True if processed.
id is the menu command identifier."""
pass
def PushStatusText(self, text, number=0):
"""Set status bar text and redraw status bar, remembering
previous text.
text - The text for the status field.
number - The status field (starting from zero).
Use an empty string to clear the status bar."""
pass
def SendSizeEvent(self):
"""Send a dummy size event to the frame forcing it to
reevaluate its children positions. It is sometimes useful to
call this function after adding or deleting a children after
the frame creation or if a child size changes.
Note that if the frame is using either sizers or constraints
for the children layout, it is enough to call Frame.Layout()
directly and this function should not be used in this case."""
pass
def SetMenuBar(self, menubar):
"""Show the menu bar in the frame.
menuBar - The menu bar to associate with the frame.
If the frame is destroyed, the menu bar and its menus will be
destroyed also, so do not delete the menu bar explicitly
(except by resetting the frame's menu bar to another frame or
NULL).
Under Windows, a call to Frame.OnSize is generated, so be sure
to initialize data members properly before calling SetMenuBar.
Note that it is not possible to call this function twice for
the same frame object."""
pass
def SetStatusBar(self, statBar):
"""Associate a status bar with the frame."""
pass
def SetStatusBarPane(self, n):
"""Set the status bar pane used to display menu and toolbar
help. Using -1 disables help display."""
pass
def SetStatusText(self, text, number=0):
"""Set status bar text and redraw status bar.
text - The text for the status field.
number - The status field (starting from zero).
Use an empty string to clear the status bar."""
pass
def SetStatusWidths(self, choices):
"""Sets the widths of the fields in the status bar.
choices - a Python list of integers, each of which is a status
field width in pixels. A value of -1 indicates that the field
is variable width; at least one field must be -1.
The widths of the variable fields are calculated from the
total width of all fields, minus the sum of widths of the
non-variable fields, divided by the number of variable fields."""
pass
def SetToolBar(self, toolbar):
"""Associate a toolbar with the frame."""
pass
class LayoutAlgorithm(Object):
""""""
def __init__(self):
""""""
pass
def LayoutFrame(self):
""""""
pass
def LayoutMDIFrame(self):
""""""
pass
def LayoutWindow(self):
""""""
pass
class MDIChildFrame(Frame):
""""""
def __init__(self):
""""""
pass
def Create(self):
""""""
pass
def Activate(self):
""""""
pass
def Maximize(self):
""""""
pass
def Restore(self):
""""""
pass
class MDIClientWindow(Window):
""""""
def __init__(self):
""""""
pass
def Create(self):
""""""
pass
class MDIParentFrame(Frame):
""""""
def __init__(self):
""""""
pass
def Create(self):
""""""
pass
def ActivateNext(self):
""""""
pass
def ActivatePrevious(self):
""""""
pass
def ArrangeIcons(self):
""""""
pass
def Cascade(self):
""""""
pass
def GetActiveChild(self):
""""""
pass
def GetClientWindow(self):
""""""
pass
def GetToolBar(self):
""""""
pass
def Tile(self):
""""""
pass
class MiniFrame(Frame):
""""""
def __init__(self):
""""""
pass
def Create(self):
""""""
pass
class SplashScreen(Frame):
""""""
def __init__(self):
""""""
pass
def GetSplashStyle(self):
""""""
pass
def GetSplashWindow(self):
""""""
pass
def GetTimeout(self):
""""""
pass
class SplashScreenWindow(Window):
""""""
def __init__(self):
""""""
pass
def GetBitmap(self):
""""""
pass
def SetBitmap(self):
""""""
pass
class StatusBar(Window):
""""""
def __init__(self):
""""""
pass
def Create(self):
""""""
pass
def GetBorderX(self):
""""""
pass
def GetBorderY(self):
""""""
pass
def GetFieldRect(self):
""""""
pass
def GetFieldsCount(self):
""""""
pass
def GetStatusText(self):
""""""
pass
def PopStatusText(self):
""""""
pass
def PushStatusText(self):
""""""
pass
def SetFieldsCount(self):
""""""
pass
def SetMinHeight(self):
""""""
pass
def SetStatusText(self):
""""""
pass
def SetStatusWidths(self):
""""""
pass

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,127 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import Object
import Parameters as wx
from Window import Window
class PopupWindow(Window):
""""""
def Create(self):
""""""
pass
def Position(self):
""""""
pass
def __init__(self):
""""""
pass
class PopupTransientWindow(PopupWindow):
""""""
def Dismiss(self):
""""""
pass
def Popup(self):
""""""
pass
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
class TipProvider:
""""""
def GetCurrentTip(self):
""""""
pass
def GetTip(self):
""""""
pass
def PreprocessTip(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class PyTipProvider(TipProvider):
""""""
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
class TipWindow(PopupTransientWindow):
""""""
def Close(self):
""""""
pass
def SetBoundingRect(self):
""""""
pass
def __init__(self):
""""""
pass
class ToolTip(Object):
""""""
def GetTip(self):
""""""
pass
def GetWindow(self):
""""""
pass
def SetTip(self):
""""""
pass
def __init__(self):
""""""
pass

View File

@@ -0,0 +1,142 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import Object
import Parameters as wx
class ImageHandler(Object):
""""""
def CanRead(self):
""""""
pass
def GetExtension(self):
""""""
pass
def GetMimeType(self):
""""""
pass
def GetName(self):
""""""
pass
def GetType(self):
""""""
pass
def SetExtension(self):
""""""
pass
def SetMimeType(self):
""""""
pass
def SetName(self):
""""""
pass
def SetType(self):
""""""
pass
def __init__(self):
""""""
pass
class BMPHandler(ImageHandler):
""""""
def __init__(self):
""""""
pass
class GIFHandler(ImageHandler):
""""""
def __init__(self):
""""""
pass
class ICOHandler(BMPHandler):
""""""
def __init__(self):
""""""
pass
class CURHandler(ICOHandler):
""""""
def __init__(self):
""""""
pass
class ANIHandler(CURHandler):
""""""
def __init__(self):
""""""
pass
class JPEGHandler(ImageHandler):
""""""
def __init__(self):
""""""
pass
class PCXHandler(ImageHandler):
""""""
def __init__(self):
""""""
pass
class PNGHandler(ImageHandler):
""""""
def __init__(self):
""""""
pass
class PNMHandler(ImageHandler):
""""""
def __init__(self):
""""""
pass
class TIFFHandler(ImageHandler):
""""""
def __init__(self):
""""""
pass

View File

@@ -0,0 +1,197 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import Object
import Parameters as wx
class Joystick(Object):
""""""
def GetButtonState(self):
""""""
pass
def GetManufacturerId(self):
""""""
pass
def GetMaxAxes(self):
""""""
pass
def GetMaxButtons(self):
""""""
pass
def GetMovementThreshold(self):
""""""
pass
def GetNumberAxes(self):
""""""
pass
def GetNumberButtons(self):
""""""
pass
def GetNumberJoysticks(self):
""""""
pass
def GetPOVCTSPosition(self):
""""""
pass
def GetPOVPosition(self):
""""""
pass
def GetPollingMax(self):
""""""
pass
def GetPollingMin(self):
""""""
pass
def GetPosition(self):
""""""
pass
def GetProductId(self):
""""""
pass
def GetProductName(self):
""""""
pass
def GetRudderMax(self):
""""""
pass
def GetRudderMin(self):
""""""
pass
def GetRudderPosition(self):
""""""
pass
def GetUMax(self):
""""""
pass
def GetUMin(self):
""""""
pass
def GetUPosition(self):
""""""
pass
def GetVMax(self):
""""""
pass
def GetVMin(self):
""""""
pass
def GetVPosition(self):
""""""
pass
def GetXMax(self):
""""""
pass
def GetXMin(self):
""""""
pass
def GetYMax(self):
""""""
pass
def GetYMin(self):
""""""
pass
def GetZMax(self):
""""""
pass
def GetZMin(self):
""""""
pass
def GetZPosition(self):
""""""
pass
def HasPOV(self):
""""""
pass
def HasPOV4Dir(self):
""""""
pass
def HasPOVCTS(self):
""""""
pass
def HasRudder(self):
""""""
pass
def HasU(self):
""""""
pass
def HasV(self):
""""""
pass
def HasZ(self):
""""""
pass
def IsOk(self):
""""""
pass
def ReleaseCapture(self):
""""""
pass
def SetCapture(self):
""""""
pass
def SetMovementThreshold(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass

View File

@@ -0,0 +1,80 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import Object
import Parameters as wx
class IndividualLayoutConstraint(Object):
""""""
def Above(self):
""""""
pass
def Absolute(self):
""""""
pass
def AsIs(self):
""""""
pass
def Below(self):
""""""
pass
def LeftOf(self):
""""""
pass
def PercentOf(self):
""""""
pass
def RightOf(self):
""""""
pass
def SameAs(self):
""""""
pass
def Set(self):
""""""
pass
def Unconstrained(self):
""""""
pass
def __init__(self):
""""""
pass
class LayoutConstraints(Object):
""""""
def __getattr__(self):
""""""
pass
def __init__(self):
""""""
pass
def __setattr__(self):
""""""
pass

View File

@@ -0,0 +1,145 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
import Parameters as wx
class Log:
""""""
def Flush(self):
""""""
pass
def GetVerbose(self):
""""""
pass
def HasPendingMessages(self):
""""""
pass
def TimeStamp(self):
""""""
pass
def __init__(self):
""""""
pass
class PyLog(Log):
""""""
def Destroy(self):
""""""
pass
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
class LogChain(Log):
""""""
def GetOldLog(self):
""""""
pass
def IsPassingMessages(self):
""""""
pass
def PassMessages(self):
""""""
pass
def SetLog(self):
""""""
pass
def __init__(self):
""""""
pass
class LogGui(Log):
""""""
def __init__(self):
""""""
pass
class LogNull:
""""""
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class LogStderr(Log):
""""""
def __init__(self):
""""""
pass
class LogTextCtrl(Log):
""""""
def __init__(self):
""""""
pass
class LogWindow(Log):
""""""
def GetFrame(self):
""""""
pass
def GetOldLog(self):
""""""
pass
def IsPassingMessages(self):
""""""
pass
def PassMessages(self):
""""""
pass
def Show(self):
""""""
pass
def __init__(self):
""""""
pass

View File

@@ -0,0 +1,477 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import Object, EvtHandler
import Parameters as wx
from Window import Window
class FileHistory(Object):
""""""
def AddFileToHistory(self):
""""""
pass
def AddFilesToMenu(self):
""""""
pass
def AddFilesToThisMenu(self):
""""""
pass
def GetCount(self):
""""""
pass
def GetHistoryFile(self):
""""""
pass
def GetMaxFiles(self):
""""""
pass
def GetNoHistoryFiles(self):
""""""
pass
def Load(self):
""""""
pass
def RemoveFileFromHistory(self):
""""""
pass
def RemoveMenu(self):
""""""
pass
def Save(self):
""""""
pass
def UseMenu(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class Menu(EvtHandler):
""""""
def Append(self):
""""""
pass
def AppendCheckItem(self):
""""""
pass
def AppendItem(self):
""""""
pass
def AppendMenu(self):
""""""
pass
def AppendRadioItem(self):
""""""
pass
def AppendSeparator(self):
""""""
pass
def Break(self):
""""""
pass
def Check(self):
""""""
pass
def Delete(self):
""""""
pass
def DeleteItem(self):
""""""
pass
def Destroy(self):
""""""
pass
def DestroyId(self):
""""""
pass
def DestroyItem(self):
""""""
pass
def Enable(self):
""""""
pass
def FindItem(self):
""""""
pass
def FindItemById(self):
""""""
pass
def GetEventHandler(self):
""""""
pass
def GetHelpString(self):
""""""
pass
def GetInvokingWindow(self):
""""""
pass
def GetLabel(self):
""""""
pass
def GetMenuItemCount(self):
""""""
pass
def GetMenuItems(self):
""""""
pass
def GetParent(self):
""""""
pass
def GetStyle(self):
""""""
pass
def GetTitle(self):
""""""
pass
def Insert(self):
""""""
pass
def InsertCheckItem(self):
""""""
pass
def InsertItem(self):
""""""
pass
def InsertMenu(self):
""""""
pass
def InsertRadioItem(self):
""""""
pass
def InsertSeparator(self):
""""""
pass
def IsAttached(self):
""""""
pass
def IsChecked(self):
""""""
pass
def IsEnabled(self):
""""""
pass
def Prepend(self):
""""""
pass
def PrependCheckItem(self):
""""""
pass
def PrependItem(self):
""""""
pass
def PrependMenu(self):
""""""
pass
def PrependRadioItem(self):
""""""
pass
def PrependSeparator(self):
""""""
pass
def Remove(self):
""""""
pass
def RemoveItem(self):
""""""
pass
def SetEventHandler(self):
""""""
pass
def SetHelpString(self):
""""""
pass
def SetInvokingWindow(self):
""""""
pass
def SetLabel(self):
""""""
pass
def SetParent(self):
""""""
pass
def SetTitle(self):
""""""
pass
def UpdateUI(self):
""""""
pass
def __init__(self):
""""""
pass
class MenuBar(Window):
""""""
def Append(self):
""""""
pass
def Check(self):
""""""
pass
def Enable(self):
""""""
pass
def EnableTop(self):
""""""
pass
def FindItemById(self):
""""""
pass
def FindMenu(self):
""""""
pass
def FindMenuItem(self):
""""""
pass
def GetHelpString(self):
""""""
pass
def GetLabel(self):
""""""
pass
def GetLabelTop(self):
""""""
pass
def GetMenu(self):
""""""
pass
def GetMenuCount(self):
""""""
pass
def Insert(self):
""""""
pass
def IsChecked(self):
""""""
pass
def IsEnabled(self):
""""""
pass
def IsEnabledTop(self):
""""""
pass
def Remove(self):
""""""
pass
def Replace(self):
""""""
pass
def SetHelpString(self):
""""""
pass
def SetLabel(self):
""""""
pass
def SetLabelTop(self):
""""""
pass
def __init__(self):
""""""
pass
class MenuItem(Object):
""""""
def Check(self):
""""""
pass
def Enable(self):
""""""
pass
def GetAccel(self):
""""""
pass
def GetBitmap(self):
""""""
pass
def GetHelp(self):
""""""
pass
def GetId(self):
""""""
pass
def GetKind(self):
""""""
pass
def GetLabel(self):
""""""
pass
def GetMenu(self):
""""""
pass
def GetSubMenu(self):
""""""
pass
def GetText(self):
""""""
pass
def IsCheckable(self):
""""""
pass
def IsChecked(self):
""""""
pass
def IsEnabled(self):
""""""
pass
def IsSeparator(self):
""""""
pass
def IsSubMenu(self):
""""""
pass
def SetAccel(self):
""""""
pass
def SetBitmap(self):
""""""
pass
def SetCheckable(self):
""""""
pass
def SetHelp(self):
""""""
pass
def SetId(self):
""""""
pass
def SetSubMenu(self):
""""""
pass
def SetText(self):
""""""
pass
def Toggle(self):
""""""
pass
def __init__(self):
""""""
pass

View File

@@ -0,0 +1,185 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
import Parameters as wx
class FileType:
""""""
def GetAllCommands(self):
""""""
pass
def GetDescription(self):
""""""
pass
def GetExtensions(self):
""""""
pass
def GetIcon(self):
""""""
pass
def GetIconInfo(self):
""""""
pass
def GetMimeType(self):
""""""
pass
def GetMimeTypes(self):
""""""
pass
def GetOpenCommand(self):
""""""
pass
def GetPrintCommand(self):
""""""
pass
def SetCommand(self):
""""""
pass
def SetDefaultIcon(self):
""""""
pass
def Unassociate(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class FileTypeInfo:
""""""
def GetDescription(self):
""""""
pass
def GetExtensions(self):
""""""
pass
def GetExtensionsCount(self):
""""""
pass
def GetIconFile(self):
""""""
pass
def GetIconIndex(self):
""""""
pass
def GetMimeType(self):
""""""
pass
def GetOpenCommand(self):
""""""
pass
def GetPrintCommand(self):
""""""
pass
def GetShortDesc(self):
""""""
pass
def IsValid(self):
""""""
pass
def SetIcon(self):
""""""
pass
def SetShortDesc(self):
""""""
pass
def __init__(self):
""""""
pass
class MimeTypesManager:
""""""
def AddFallback(self):
""""""
pass
def Associate(self):
""""""
pass
def ClearData(self):
""""""
pass
def EnumAllFileTypes(self):
""""""
pass
def GetFileTypeFromExtension(self):
""""""
pass
def GetFileTypeFromMimeType(self):
""""""
pass
def Initialize(self):
""""""
pass
def ReadMailcap(self):
""""""
pass
def ReadMimeTypes(self):
""""""
pass
def Unassociate(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass

View File

@@ -0,0 +1,558 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import Object
import Parameters as wx
class ArtProvider(Object):
""""""
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
class BusyCursor:
""""""
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class BusyInfo(Object):
""""""
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class Caret:
""""""
def GetPosition(self):
""""""
pass
def GetPositionTuple(self):
""""""
pass
def GetSize(self):
""""""
pass
def GetSizeTuple(self):
""""""
pass
def GetWindow(self):
""""""
pass
def Hide(self):
""""""
pass
def IsOk(self):
""""""
pass
def IsVisible(self):
""""""
pass
def Move(self):
""""""
pass
def MoveXY(self):
""""""
pass
def SetSize(self):
""""""
pass
def SetSizeWH(self):
""""""
pass
def Show(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class EncodingConverter(Object):
""""""
def Convert(self):
""""""
pass
def Init(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class DirItemData(Object):
""""""
def SetNewDirName(self):
""""""
pass
def __getattr__(self):
""""""
pass
def __init__(self):
""""""
pass
def __setattr__(self):
""""""
pass
class Effects(Object):
""""""
def DrawSunkenEdge(self):
""""""
pass
def GetDarkShadow(self):
""""""
pass
def GetFaceColour(self):
""""""
pass
def GetHighlightColour(self):
""""""
pass
def GetLightShadow(self):
""""""
pass
def GetMediumShadow(self):
""""""
pass
def Set(self):
""""""
pass
def SetDarkShadow(self):
""""""
pass
def SetFaceColour(self):
""""""
pass
def SetHighlightColour(self):
""""""
pass
def SetLightShadow(self):
""""""
pass
def SetMediumShadow(self):
""""""
pass
def TileBitmap(self):
""""""
pass
def __init__(self):
""""""
pass
class FontEnumerator:
""""""
def EnumerateEncodings(self):
""""""
pass
def EnumerateFacenames(self):
""""""
pass
def GetEncodings(self):
""""""
pass
def GetFacenames(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
class FontMapper:
""""""
def CharsetToEncoding(self):
""""""
pass
def GetAltForEncoding(self):
""""""
pass
def IsEncodingAvailable(self):
""""""
pass
def SetConfig(self):
""""""
pass
def SetConfigPath(self):
""""""
pass
def SetDialogParent(self):
""""""
pass
def SetDialogTitle(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class LanguageInfo:
""""""
def __getattr__(self):
""""""
pass
def __init__(self):
""""""
pass
def __setattr__(self):
""""""
pass
class Locale:
""""""
def AddCatalog(self):
""""""
pass
def GetCanonicalName(self):
""""""
pass
def GetLanguage(self):
""""""
pass
def GetLocale(self):
""""""
pass
def GetName(self):
""""""
pass
def GetString(self):
""""""
pass
def GetSysName(self):
""""""
pass
def Init(self):
""""""
pass
def IsLoaded(self):
""""""
pass
def IsOk(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class NativeFontInfo:
""""""
def FromString(self):
""""""
pass
def FromUserString(self):
""""""
pass
def GetEncoding(self):
""""""
pass
def GetFaceName(self):
""""""
pass
def GetFamily(self):
""""""
pass
def GetPointSize(self):
""""""
pass
def GetStyle(self):
""""""
pass
def GetUnderlined(self):
""""""
pass
def GetWeight(self):
""""""
pass
def Init(self):
""""""
pass
def SetEncoding(self):
""""""
pass
def SetFaceName(self):
""""""
pass
def SetFamily(self):
""""""
pass
def SetPointSize(self):
""""""
pass
def SetStyle(self):
""""""
pass
def SetUnderlined(self):
""""""
pass
def SetWeight(self):
""""""
pass
def ToString(self):
""""""
pass
def ToUserString(self):
""""""
pass
def __init__(self):
""""""
pass
def __str__(self):
""""""
pass
class PyTimer(Object):
""""""
def GetInterval(self):
""""""
pass
def IsOneShot(self):
""""""
pass
def IsRunning(self):
""""""
pass
def SetOwner(self):
""""""
pass
def Start(self):
""""""
pass
def Stop(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class StopWatch:
""""""
def Pause(self):
""""""
pass
def Resume(self):
""""""
pass
def Start(self):
""""""
pass
def Time(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class SystemSettings:
""""""
def __init__(self):
""""""
pass
class Timer(PyTimer):
""""""
def __init__(self, evtHandler=None, id=-1):
"""Create a Timer instance."""
pass
class Wave(Object):
""""""
def IsOk(self):
""""""
pass
def Play(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class WindowDisabler:
""""""
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass

View File

@@ -0,0 +1,240 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
import Parameters as wx
from Window import Window
try:
True
except NameError:
True = 1==1
False = 1==0
class Panel(Window):
""""""
def __init__(self, parent, id, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=wx.TAB_TRAVERSAL,
name=wx.PyPanelNameStr):
""""""
pass
def Create(self, parent, id, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=wx.TAB_TRAVERSAL,
name=wx.PyPanelNameStr):
""""""
pass
def InitDialog(self):
""""""
pass
class PyPanel(Panel):
""""""
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
def base_AcceptsFocus(self):
""""""
pass
def base_AcceptsFocusFromKeyboard(self):
""""""
pass
def base_AddChild(self):
""""""
pass
def base_DoGetBestSize(self):
""""""
pass
def base_DoGetClientSize(self):
""""""
pass
def base_DoGetPosition(self):
""""""
pass
def base_DoGetSize(self):
""""""
pass
def base_DoGetVirtualSize(self):
""""""
pass
def base_DoMoveWindow(self):
""""""
pass
def base_DoSetClientSize(self):
""""""
pass
def base_DoSetSize(self):
""""""
pass
def base_DoSetVirtualSize(self):
""""""
pass
def base_GetMaxSize(self):
""""""
pass
def base_InitDialog(self):
""""""
pass
def base_RemoveChild(self):
""""""
pass
def base_TransferDataFromWindow(self):
""""""
pass
def base_TransferDataToWindow(self):
""""""
pass
def base_Validate(self):
""""""
pass
class ScrolledWindow(Panel):
""""""
def __init__(self, parent, id=-1, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=wx.HSCROLL|wx.VSCROLL,
name=wx.PyPanelNameStr):
""""""
pass
def Create(self, parent, id=-1, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=wx.HSCROLL|wx.VSCROLL,
name=wx.PyPanelNameStr):
""""""
pass
def AdjustScrollbars(self):
""""""
pass
def CalcScrolledPosition(self, *args):
"""*args can be a point or (x, y) tuple"""
pass
def CalcScrolledPosition1(self, pt):
""""""
pass
def CalcScrolledPosition2(self, x, y):
""""""
pass
def CalcUnscrolledPosition(self, *args):
"""*args can be a point or (x, y) tuple"""
pass
def CalcUnscrolledPosition1(self, pt):
""""""
pass
def CalcUnscrolledPosition2(self, x, y):
""""""
pass
def EnableScrolling(self, xScrolling, yScrolling):
""""""
pass
def GetScaleX(self):
""""""
pass
def GetScaleY(self):
""""""
pass
def GetScrollPageSize(self, orient):
""""""
pass
def GetScrollPixelsPerUnit(self):
""""""
pass
def GetTargetWindow(self):
""""""
pass
def GetViewStart(self):
""""""
pass
def IsRetained(self):
""""""
pass
def Layout(self):
""""""
pass
def PrepareDC(self, dc):
""""""
pass
def Scroll(self, x, y):
""""""
pass
def SetScale(self, xs, ys):
""""""
pass
def SetScrollPageSize(self, orient, pageSize):
""""""
pass
def SetScrollRate(self, xstep, ystep):
"""Set the x, y scrolling increments."""
pass
def SetScrollbars(self, pixelsPerUnitX, pixelsPerUnitY,
noUnitsX, noUnitsY, xPos=0, yPos=0, noRefresh=False):
""""""
pass
def SetTargetWindow(self, window):
""""""
pass
def ViewStart(self):
""""""
pass

View File

@@ -0,0 +1,68 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
class _Param:
"""Used by this module to represent default wxPython parameter values,
including parameter representations like style=wx.HSCROLL|wx.VSCROLL."""
def __init__(self, value=None):
if value is None:
value = 'wx.' + self.__class__.__name__
self.value = value
def __repr__(self):
return self.value
def __or__(self, other):
value = '%s|%s' % (self, other)
return self.__class__(value)
_params = (
'BOTH',
'DEFAULT_FRAME_STYLE',
'DefaultPosition',
'DefaultSize',
'DefaultValidator',
'EmptyString',
'EVT_NULL',
'HSCROLL',
'NO_BORDER',
'NULL',
'NullColour',
'PyFrameNameStr',
'PyNOTEBOOK_NAME',
'PyPanelNameStr',
'PyStatusLineNameStr',
'PySTCNameStr',
'PyToolBarNameStr',
'SIZE_AUTO',
'SIZE_USE_EXISTING',
'ST_SIZEGRIP',
'TAB_TRAVERSAL',
'TB_HORIZONTAL',
'VSCROLL',
)
## Create classes, then instances, like this:
## class BOTH(Param): pass
## BOTH = BOTH()
for _param in _params:
exec 'class %s(_Param): pass' % _param
exec '%s = %s()' % (_param, _param)
del _param
del _params
del _Param

View File

@@ -0,0 +1,651 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import Object
from Dialogs import Dialog
from Frames import Frame
import Parameters as wx
class PageSetupDialog(Dialog):
""""""
def GetPageSetupData(self):
""""""
pass
def ShowModal(self):
""""""
pass
def __init__(self):
""""""
pass
class PageSetupDialogData(Object):
""""""
def EnableHelp(self):
""""""
pass
def EnableMargins(self):
""""""
pass
def EnableOrientation(self):
""""""
pass
def EnablePaper(self):
""""""
pass
def EnablePrinter(self):
""""""
pass
def GetDefaultInfo(self):
""""""
pass
def GetDefaultMinMargins(self):
""""""
pass
def GetEnableHelp(self):
""""""
pass
def GetEnableMargins(self):
""""""
pass
def GetEnableOrientation(self):
""""""
pass
def GetEnablePaper(self):
""""""
pass
def GetEnablePrinter(self):
""""""
pass
def GetMarginBottomRight(self):
""""""
pass
def GetMarginTopLeft(self):
""""""
pass
def GetMinMarginBottomRight(self):
""""""
pass
def GetMinMarginTopLeft(self):
""""""
pass
def GetPaperId(self):
""""""
pass
def GetPaperSize(self):
""""""
pass
def GetPrintData(self):
""""""
pass
def Ok(self):
""""""
pass
def SetDefaultInfo(self):
""""""
pass
def SetDefaultMinMargins(self):
""""""
pass
def SetMarginBottomRight(self):
""""""
pass
def SetMarginTopLeft(self):
""""""
pass
def SetMinMarginBottomRight(self):
""""""
pass
def SetMinMarginTopLeft(self):
""""""
pass
def SetPaperId(self):
""""""
pass
def SetPaperSize(self):
""""""
pass
def SetPrintData(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class PrintDialog(Dialog):
""""""
def GetPrintDC(self):
""""""
pass
def GetPrintDialogData(self):
""""""
pass
def ShowModal(self):
""""""
pass
def __init__(self):
""""""
pass
class PrintDialogData(Object):
""""""
def EnableHelp(self):
""""""
pass
def EnablePageNumbers(self):
""""""
pass
def EnablePrintToFile(self):
""""""
pass
def EnableSelection(self):
""""""
pass
def GetAllPages(self):
""""""
pass
def GetCollate(self):
""""""
pass
def GetFromPage(self):
""""""
pass
def GetMaxPage(self):
""""""
pass
def GetMinPage(self):
""""""
pass
def GetNoCopies(self):
""""""
pass
def GetPrintData(self):
""""""
pass
def GetPrintToFile(self):
""""""
pass
def GetToPage(self):
""""""
pass
def Ok(self):
""""""
pass
def SetCollate(self):
""""""
pass
def SetFromPage(self):
""""""
pass
def SetMaxPage(self):
""""""
pass
def SetMinPage(self):
""""""
pass
def SetNoCopies(self):
""""""
pass
def SetPrintData(self):
""""""
pass
def SetPrintToFile(self):
""""""
pass
def SetSetupDialog(self):
""""""
pass
def SetToPage(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class PreviewFrame(Frame):
""""""
def Initialize(self):
""""""
pass
def __init__(self):
""""""
pass
class PrintData(Object):
""""""
def GetCollate(self):
""""""
pass
def GetColour(self):
""""""
pass
def GetDuplex(self):
""""""
pass
def GetFilename(self):
""""""
pass
def GetFontMetricPath(self):
""""""
pass
def GetNoCopies(self):
""""""
pass
def GetOrientation(self):
""""""
pass
def GetPaperId(self):
""""""
pass
def GetPaperSize(self):
""""""
pass
def GetPreviewCommand(self):
""""""
pass
def GetPrintMode(self):
""""""
pass
def GetPrinterCommand(self):
""""""
pass
def GetPrinterName(self):
""""""
pass
def GetPrinterOptions(self):
""""""
pass
def GetPrinterScaleX(self):
""""""
pass
def GetPrinterScaleY(self):
""""""
pass
def GetPrinterTranslateX(self):
""""""
pass
def GetPrinterTranslateY(self):
""""""
pass
def GetQuality(self):
""""""
pass
def Ok(self):
""""""
pass
def SetCollate(self):
""""""
pass
def SetColour(self):
""""""
pass
def SetDuplex(self):
""""""
pass
def SetFilename(self):
""""""
pass
def SetFontMetricPath(self):
""""""
pass
def SetNoCopies(self):
""""""
pass
def SetOrientation(self):
""""""
pass
def SetPaperId(self):
""""""
pass
def SetPaperSize(self):
""""""
pass
def SetPreviewCommand(self):
""""""
pass
def SetPrintMode(self):
""""""
pass
def SetPrinterCommand(self):
""""""
pass
def SetPrinterName(self):
""""""
pass
def SetPrinterOptions(self):
""""""
pass
def SetPrinterScaleX(self):
""""""
pass
def SetPrinterScaleY(self):
""""""
pass
def SetPrinterScaling(self):
""""""
pass
def SetPrinterTranslateX(self):
""""""
pass
def SetPrinterTranslateY(self):
""""""
pass
def SetPrinterTranslation(self):
""""""
pass
def SetQuality(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class PrintPreview(Object):
""""""
def GetCanvas(self):
""""""
pass
def GetCurrentPage(self):
""""""
pass
def GetFrame(self):
""""""
pass
def GetMaxPage(self):
""""""
pass
def GetMinPage(self):
""""""
pass
def GetPrintDialogData(self):
""""""
pass
def GetPrintout(self):
""""""
pass
def GetPrintoutForPrinting(self):
""""""
pass
def GetZoom(self):
""""""
pass
def Ok(self):
""""""
pass
def Print(self):
""""""
pass
def SetCanvas(self):
""""""
pass
def SetCurrentPage(self):
""""""
pass
def SetFrame(self):
""""""
pass
def SetPrintout(self):
""""""
pass
def SetZoom(self):
""""""
pass
def __init__(self):
""""""
pass
class Printer(Object):
""""""
def CreateAbortWindow(self):
""""""
pass
def GetPrintDialogData(self):
""""""
pass
def Print(self):
""""""
pass
def PrintDialog(self):
""""""
pass
def ReportError(self):
""""""
pass
def Setup(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass
class Printout(Object):
""""""
def Destroy(self):
""""""
pass
def GetDC(self):
""""""
pass
def GetPPIPrinter(self):
""""""
pass
def GetPPIScreen(self):
""""""
pass
def GetPageSizeMM(self):
""""""
pass
def GetPageSizePixels(self):
""""""
pass
def IsPreview(self):
""""""
pass
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
def base_GetPageInfo(self):
""""""
pass
def base_HasPage(self):
""""""
pass
def base_OnBeginDocument(self):
""""""
pass
def base_OnBeginPrinting(self):
""""""
pass
def base_OnEndDocument(self):
""""""
pass
def base_OnEndPrinting(self):
""""""
pass
def base_OnPreparePrinting(self):
""""""
pass

View File

@@ -0,0 +1,77 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import EvtHandler
class Process(EvtHandler):
""""""
def CloseOutput(self):
""""""
pass
def Destroy(self):
""""""
pass
def Detach(self):
""""""
pass
def GetErrorStream(self):
""""""
pass
def GetInputStream(self):
""""""
pass
def GetOutputStream(self):
""""""
pass
def IsErrorAvailable(self):
""""""
pass
def IsInputAvailable(self):
""""""
pass
def IsInputOpened(self):
""""""
pass
def IsRedirected(self):
""""""
pass
def Redirect(self):
""""""
pass
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
def base_OnTerminate(self):
""""""
pass

View File

@@ -0,0 +1,226 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
import Parameters as wx
from Window import Window
class SashWindow(Window):
""""""
def Create(self):
""""""
pass
def GetDefaultBorderSize(self):
""""""
pass
def GetEdgeMargin(self):
""""""
pass
def GetExtraBorderSize(self):
""""""
pass
def GetMaximumSizeX(self):
""""""
pass
def GetMaximumSizeY(self):
""""""
pass
def GetMinimumSizeX(self):
""""""
pass
def GetMinimumSizeY(self):
""""""
pass
def GetSashVisible(self):
""""""
pass
def HasBorder(self):
""""""
pass
def SetDefaultBorderSize(self):
""""""
pass
def SetExtraBorderSize(self):
""""""
pass
def SetMaximumSizeX(self):
""""""
pass
def SetMaximumSizeY(self):
""""""
pass
def SetMinimumSizeX(self):
""""""
pass
def SetMinimumSizeY(self):
""""""
pass
def SetSashBorder(self):
""""""
pass
def SetSashVisible(self):
""""""
pass
def __init__(self):
""""""
pass
class SashLayoutWindow(SashWindow):
""""""
def Create(self):
""""""
pass
def GetAlignment(self):
""""""
pass
def GetOrientation(self):
""""""
pass
def SetAlignment(self):
""""""
pass
def SetDefaultSize(self):
""""""
pass
def SetOrientation(self):
""""""
pass
def __init__(self):
""""""
pass
class SplitterWindow(Window):
""""""
def Create(self):
""""""
pass
def GetBorderSize(self):
""""""
pass
def GetMinimumPaneSize(self):
""""""
pass
def GetNeedUpdating(self):
""""""
pass
def GetSashPosition(self):
""""""
pass
def GetSashSize(self):
""""""
pass
def GetSplitMode(self):
""""""
pass
def GetWindow1(self):
""""""
pass
def GetWindow2(self):
""""""
pass
def Initialize(self):
""""""
pass
def IsSplit(self):
""""""
pass
def ReplaceWindow(self):
""""""
pass
def SetBorderSize(self):
""""""
pass
def SetMinimumPaneSize(self):
""""""
pass
def SetNeedUpdating(self):
""""""
pass
def SetSashPosition(self):
""""""
pass
def SetSashSize(self):
""""""
pass
def SetSplitMode(self):
""""""
pass
def SizeWindows(self):
""""""
pass
def SplitHorizontally(self):
""""""
pass
def SplitVertically(self):
""""""
pass
def Unsplit(self):
""""""
pass
def __init__(self):
""""""
pass

View File

@@ -0,0 +1,488 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import Object
import Parameters as wx
class Sizer(Object):
""""""
def Add(self):
""""""
pass
def AddMany(self):
""""""
pass
def AddSizer(self):
""""""
pass
def AddSpacer(self):
""""""
pass
def AddWindow(self):
""""""
pass
def Clear(self):
""""""
pass
def DeleteWindows(self):
""""""
pass
def Destroy(self):
""""""
pass
def Fit(self):
""""""
pass
def FitInside(self):
""""""
pass
def GetChildren(self):
""""""
pass
def GetMinSize(self):
""""""
pass
def GetMinSizeTuple(self):
""""""
pass
def GetPosition(self):
""""""
pass
def GetPositionTuple(self):
""""""
pass
def GetSize(self):
""""""
pass
def GetSizeTuple(self):
""""""
pass
def Hide(self):
""""""
pass
def HideSizer(self):
""""""
pass
def HideWindow(self):
""""""
pass
def Insert(self):
""""""
pass
def InsertSizer(self):
""""""
pass
def InsertSpacer(self):
""""""
pass
def InsertWindow(self):
""""""
pass
def IsShown(self):
""""""
pass
def IsShownSizer(self):
""""""
pass
def IsShownWindow(self):
""""""
pass
def Layout(self):
""""""
pass
def Prepend(self):
""""""
pass
def PrependSizer(self):
""""""
pass
def PrependSpacer(self):
""""""
pass
def PrependWindow(self):
""""""
pass
def Remove(self):
""""""
pass
def RemovePos(self):
""""""
pass
def RemoveSizer(self):
""""""
pass
def RemoveWindow(self):
""""""
pass
def SetDimension(self):
""""""
pass
def SetItemMinSize(self):
""""""
pass
def SetItemMinSizePos(self):
""""""
pass
def SetItemMinSizeSizer(self):
""""""
pass
def SetItemMinSizeWindow(self):
""""""
pass
def SetMinSize(self):
""""""
pass
def SetSizeHints(self):
""""""
pass
def SetVirtualSizeHints(self):
""""""
pass
def Show(self):
""""""
pass
def ShowItems(self):
""""""
pass
def ShowSizer(self):
""""""
pass
def ShowWindow(self):
""""""
pass
def __init__(self):
""""""
pass
def _setOORInfo(self):
""""""
pass
class SizerItem(Object):
""""""
def CalcMin(self):
""""""
pass
def DeleteWindows(self):
""""""
pass
def GetBorder(self):
""""""
pass
def GetFlag(self):
""""""
pass
def GetOption(self):
""""""
pass
def GetPosition(self):
""""""
pass
def GetRatio(self):
""""""
pass
def GetSize(self):
""""""
pass
def GetSizer(self):
""""""
pass
def GetUserData(self):
""""""
pass
def GetWindow(self):
""""""
pass
def IsShown(self):
""""""
pass
def IsSizer(self):
""""""
pass
def IsSpacer(self):
""""""
pass
def IsWindow(self):
""""""
pass
def SetBorder(self):
""""""
pass
def SetDimension(self):
""""""
pass
def SetFlag(self):
""""""
pass
def SetInitSize(self):
""""""
pass
def SetOption(self):
""""""
pass
def SetRatio(self):
""""""
pass
def SetRatioSize(self):
""""""
pass
def SetRatioWH(self):
""""""
pass
def SetSizer(self):
""""""
pass
def SetWindow(self):
""""""
pass
def Show(self):
""""""
pass
def __init__(self):
""""""
pass
class BoxSizer(Sizer):
""""""
def CalcMin(self):
""""""
pass
def GetOrientation(self):
""""""
pass
def RecalcSizes(self):
""""""
pass
def SetOrientation(self):
""""""
pass
def __init__(self):
""""""
pass
class GridSizer(Sizer):
""""""
def CalcMin(self):
""""""
pass
def GetCols(self):
""""""
pass
def GetHGap(self):
""""""
pass
def GetRows(self):
""""""
pass
def GetVGap(self):
""""""
pass
def RecalcSizes(self):
""""""
pass
def SetCols(self):
""""""
pass
def SetHGap(self):
""""""
pass
def SetRows(self):
""""""
pass
def SetVGap(self):
""""""
pass
def __init__(self):
""""""
pass
class FlexGridSizer(GridSizer):
""""""
def AddGrowableCol(self):
""""""
pass
def AddGrowableRow(self):
""""""
pass
def CalcMin(self):
""""""
pass
def RecalcSizes(self):
""""""
pass
def RemoveGrowableCol(self):
""""""
pass
def RemoveGrowableRow(self):
""""""
pass
def __init__(self):
""""""
pass
class NotebookSizer(Sizer):
""""""
def CalcMin(self):
""""""
pass
def GetNotebook(self):
""""""
pass
def RecalcSizes(self):
""""""
pass
def __init__(self):
""""""
pass
class PySizer(Sizer):
""""""
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
class StaticBoxSizer(BoxSizer):
""""""
def CalcMin(self):
""""""
pass
def GetStaticBox(self):
""""""
pass
def RecalcSizes(self):
""""""
pass
def __init__(self):
""""""
pass

View File

@@ -0,0 +1,96 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
class InputStream:
""""""
def CanRead(self):
""""""
pass
def Eof(self):
""""""
pass
def GetC(self):
""""""
pass
def LastRead(self):
""""""
pass
def Peek(self):
""""""
pass
def SeekI(self):
""""""
pass
def TellI(self):
""""""
pass
def Ungetch(self):
""""""
pass
def __init__(self):
""""""
pass
def close(self):
""""""
pass
def eof(self):
""""""
pass
def flush(self):
""""""
pass
def read(self):
""""""
pass
def readline(self):
""""""
pass
def readlines(self):
""""""
pass
def seek(self):
""""""
pass
def tell(self):
""""""
pass
class OutputStream:
""""""
def __init__(self):
""""""
pass
def write(self):
""""""
pass

View File

@@ -0,0 +1,643 @@
"""wxStyledTextControl constants for documentation.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
from wxPython import wx
from wxPython import stc
"""
>>> from wxPython import stc_c
>>> def gen_constants():
... print '# Begin generated constants.'
... for item in dir(stc_c): # dir returns a sorted list.
... if not callable(stc_c.__dict__[item]) \
... and not item.startswith('__'):
... print item, '=', 'stc.' + item, ' #', \
... repr(stc_c.__dict__[item])
... print '# End generated constants.'
"""
# Begin generated constants.
STC_USE_DND = stc.STC_USE_DND # 1
wxEVT_STC_CHANGE = stc.wxEVT_STC_CHANGE # 10206
wxEVT_STC_CHARADDED = stc.wxEVT_STC_CHARADDED # 10208
wxEVT_STC_DOUBLECLICK = stc.wxEVT_STC_DOUBLECLICK # 10213
wxEVT_STC_DO_DROP = stc.wxEVT_STC_DO_DROP # 10227
wxEVT_STC_DRAG_OVER = stc.wxEVT_STC_DRAG_OVER # 10226
wxEVT_STC_DWELLEND = stc.wxEVT_STC_DWELLEND # 10224
wxEVT_STC_DWELLSTART = stc.wxEVT_STC_DWELLSTART # 10223
wxEVT_STC_KEY = stc.wxEVT_STC_KEY # 10212
wxEVT_STC_MACRORECORD = stc.wxEVT_STC_MACRORECORD # 10216
wxEVT_STC_MARGINCLICK = stc.wxEVT_STC_MARGINCLICK # 10217
wxEVT_STC_MODIFIED = stc.wxEVT_STC_MODIFIED # 10215
wxEVT_STC_NEEDSHOWN = stc.wxEVT_STC_NEEDSHOWN # 10218
wxEVT_STC_PAINTED = stc.wxEVT_STC_PAINTED # 10220
wxEVT_STC_POSCHANGED = stc.wxEVT_STC_POSCHANGED # 10219
wxEVT_STC_ROMODIFYATTEMPT = stc.wxEVT_STC_ROMODIFYATTEMPT # 10211
wxEVT_STC_SAVEPOINTLEFT = stc.wxEVT_STC_SAVEPOINTLEFT # 10210
wxEVT_STC_SAVEPOINTREACHED = stc.wxEVT_STC_SAVEPOINTREACHED # 10209
wxEVT_STC_START_DRAG = stc.wxEVT_STC_START_DRAG # 10225
wxEVT_STC_STYLENEEDED = stc.wxEVT_STC_STYLENEEDED # 10207
wxEVT_STC_UPDATEUI = stc.wxEVT_STC_UPDATEUI # 10214
wxEVT_STC_URIDROPPED = stc.wxEVT_STC_URIDROPPED # 10222
wxEVT_STC_USERLISTSELECTION = stc.wxEVT_STC_USERLISTSELECTION # 10221
wxEVT_STC_ZOOM = stc.wxEVT_STC_ZOOM # 10228
wxSTC_ADA_CHARACTER = stc.wxSTC_ADA_CHARACTER # 5
wxSTC_ADA_COMMENT = stc.wxSTC_ADA_COMMENT # 1
wxSTC_ADA_DEFAULT = stc.wxSTC_ADA_DEFAULT # 0
wxSTC_ADA_IDENTIFIER = stc.wxSTC_ADA_IDENTIFIER # 7
wxSTC_ADA_NUMBER = stc.wxSTC_ADA_NUMBER # 2
wxSTC_ADA_OPERATOR = stc.wxSTC_ADA_OPERATOR # 6
wxSTC_ADA_STRING = stc.wxSTC_ADA_STRING # 4
wxSTC_ADA_STRINGEOL = stc.wxSTC_ADA_STRINGEOL # 8
wxSTC_ADA_WORD = stc.wxSTC_ADA_WORD # 3
wxSTC_AVE_COMMENT = stc.wxSTC_AVE_COMMENT # 1
wxSTC_AVE_DEFAULT = stc.wxSTC_AVE_DEFAULT # 0
wxSTC_AVE_ENUM = stc.wxSTC_AVE_ENUM # 7
wxSTC_AVE_IDENTIFIER = stc.wxSTC_AVE_IDENTIFIER # 9
wxSTC_AVE_KEYWORD = stc.wxSTC_AVE_KEYWORD # 4
wxSTC_AVE_NUMBER = stc.wxSTC_AVE_NUMBER # 2
wxSTC_AVE_OPERATOR = stc.wxSTC_AVE_OPERATOR # 10
wxSTC_AVE_STATEMENT = stc.wxSTC_AVE_STATEMENT # 5
wxSTC_AVE_STRING = stc.wxSTC_AVE_STRING # 6
wxSTC_AVE_STRINGEOL = stc.wxSTC_AVE_STRINGEOL # 8
wxSTC_AVE_WORD = stc.wxSTC_AVE_WORD # 3
wxSTC_BAAN_COMMENT = stc.wxSTC_BAAN_COMMENT # 1
wxSTC_BAAN_COMMENTDOC = stc.wxSTC_BAAN_COMMENTDOC # 2
wxSTC_BAAN_DEFAULT = stc.wxSTC_BAAN_DEFAULT # 0
wxSTC_BAAN_IDENTIFIER = stc.wxSTC_BAAN_IDENTIFIER # 8
wxSTC_BAAN_NUMBER = stc.wxSTC_BAAN_NUMBER # 3
wxSTC_BAAN_OPERATOR = stc.wxSTC_BAAN_OPERATOR # 7
wxSTC_BAAN_PREPROCESSOR = stc.wxSTC_BAAN_PREPROCESSOR # 6
wxSTC_BAAN_STRING = stc.wxSTC_BAAN_STRING # 5
wxSTC_BAAN_STRINGEOL = stc.wxSTC_BAAN_STRINGEOL # 9
wxSTC_BAAN_WORD = stc.wxSTC_BAAN_WORD # 4
wxSTC_BAAN_WORD2 = stc.wxSTC_BAAN_WORD2 # 10
wxSTC_BAT_COMMAND = stc.wxSTC_BAT_COMMAND # 5
wxSTC_BAT_COMMENT = stc.wxSTC_BAT_COMMENT # 1
wxSTC_BAT_DEFAULT = stc.wxSTC_BAT_DEFAULT # 0
wxSTC_BAT_HIDE = stc.wxSTC_BAT_HIDE # 4
wxSTC_BAT_IDENTIFIER = stc.wxSTC_BAT_IDENTIFIER # 6
wxSTC_BAT_LABEL = stc.wxSTC_BAT_LABEL # 3
wxSTC_BAT_OPERATOR = stc.wxSTC_BAT_OPERATOR # 7
wxSTC_BAT_WORD = stc.wxSTC_BAT_WORD # 2
wxSTC_B_COMMENT = stc.wxSTC_B_COMMENT # 1
wxSTC_B_DATE = stc.wxSTC_B_DATE # 8
wxSTC_B_DEFAULT = stc.wxSTC_B_DEFAULT # 0
wxSTC_B_IDENTIFIER = stc.wxSTC_B_IDENTIFIER # 7
wxSTC_B_KEYWORD = stc.wxSTC_B_KEYWORD # 3
wxSTC_B_NUMBER = stc.wxSTC_B_NUMBER # 2
wxSTC_B_OPERATOR = stc.wxSTC_B_OPERATOR # 6
wxSTC_B_PREPROCESSOR = stc.wxSTC_B_PREPROCESSOR # 5
wxSTC_B_STRING = stc.wxSTC_B_STRING # 4
wxSTC_CACHE_CARET = stc.wxSTC_CACHE_CARET # 1
wxSTC_CACHE_DOCUMENT = stc.wxSTC_CACHE_DOCUMENT # 3
wxSTC_CACHE_NONE = stc.wxSTC_CACHE_NONE # 0
wxSTC_CACHE_PAGE = stc.wxSTC_CACHE_PAGE # 2
wxSTC_CARET_EVEN = stc.wxSTC_CARET_EVEN # 8
wxSTC_CARET_JUMPS = stc.wxSTC_CARET_JUMPS # 16
wxSTC_CARET_SLOP = stc.wxSTC_CARET_SLOP # 1
wxSTC_CARET_STRICT = stc.wxSTC_CARET_STRICT # 4
wxSTC_CASE_LOWER = stc.wxSTC_CASE_LOWER # 2
wxSTC_CASE_MIXED = stc.wxSTC_CASE_MIXED # 0
wxSTC_CASE_UPPER = stc.wxSTC_CASE_UPPER # 1
wxSTC_CHARSET_ANSI = stc.wxSTC_CHARSET_ANSI # 0
wxSTC_CHARSET_ARABIC = stc.wxSTC_CHARSET_ARABIC # 178
wxSTC_CHARSET_BALTIC = stc.wxSTC_CHARSET_BALTIC # 186
wxSTC_CHARSET_CHINESEBIG5 = stc.wxSTC_CHARSET_CHINESEBIG5 # 136
wxSTC_CHARSET_DEFAULT = stc.wxSTC_CHARSET_DEFAULT # 1
wxSTC_CHARSET_EASTEUROPE = stc.wxSTC_CHARSET_EASTEUROPE # 238
wxSTC_CHARSET_GB2312 = stc.wxSTC_CHARSET_GB2312 # 134
wxSTC_CHARSET_GREEK = stc.wxSTC_CHARSET_GREEK # 161
wxSTC_CHARSET_HANGUL = stc.wxSTC_CHARSET_HANGUL # 129
wxSTC_CHARSET_HEBREW = stc.wxSTC_CHARSET_HEBREW # 177
wxSTC_CHARSET_JOHAB = stc.wxSTC_CHARSET_JOHAB # 130
wxSTC_CHARSET_MAC = stc.wxSTC_CHARSET_MAC # 77
wxSTC_CHARSET_OEM = stc.wxSTC_CHARSET_OEM # 255
wxSTC_CHARSET_RUSSIAN = stc.wxSTC_CHARSET_RUSSIAN # 204
wxSTC_CHARSET_SHIFTJIS = stc.wxSTC_CHARSET_SHIFTJIS # 128
wxSTC_CHARSET_SYMBOL = stc.wxSTC_CHARSET_SYMBOL # 2
wxSTC_CHARSET_THAI = stc.wxSTC_CHARSET_THAI # 222
wxSTC_CHARSET_TURKISH = stc.wxSTC_CHARSET_TURKISH # 162
wxSTC_CHARSET_VIETNAMESE = stc.wxSTC_CHARSET_VIETNAMESE # 163
wxSTC_CMD_BACKTAB = stc.wxSTC_CMD_BACKTAB # 2328
wxSTC_CMD_CANCEL = stc.wxSTC_CMD_CANCEL # 2325
wxSTC_CMD_CHARLEFT = stc.wxSTC_CMD_CHARLEFT # 2304
wxSTC_CMD_CHARLEFTEXTEND = stc.wxSTC_CMD_CHARLEFTEXTEND # 2305
wxSTC_CMD_CHARRIGHT = stc.wxSTC_CMD_CHARRIGHT # 2306
wxSTC_CMD_CHARRIGHTEXTEND = stc.wxSTC_CMD_CHARRIGHTEXTEND # 2307
wxSTC_CMD_CLEAR = stc.wxSTC_CMD_CLEAR # 2180
wxSTC_CMD_COPY = stc.wxSTC_CMD_COPY # 2178
wxSTC_CMD_CUT = stc.wxSTC_CMD_CUT # 2177
wxSTC_CMD_DELETEBACK = stc.wxSTC_CMD_DELETEBACK # 2326
wxSTC_CMD_DELETEBACKNOTLINE = stc.wxSTC_CMD_DELETEBACKNOTLINE # 2344
wxSTC_CMD_DELLINELEFT = stc.wxSTC_CMD_DELLINELEFT # 2395
wxSTC_CMD_DELLINERIGHT = stc.wxSTC_CMD_DELLINERIGHT # 2396
wxSTC_CMD_DELWORDLEFT = stc.wxSTC_CMD_DELWORDLEFT # 2335
wxSTC_CMD_DELWORDRIGHT = stc.wxSTC_CMD_DELWORDRIGHT # 2336
wxSTC_CMD_DOCUMENTEND = stc.wxSTC_CMD_DOCUMENTEND # 2318
wxSTC_CMD_DOCUMENTENDEXTEND = stc.wxSTC_CMD_DOCUMENTENDEXTEND # 2319
wxSTC_CMD_DOCUMENTSTART = stc.wxSTC_CMD_DOCUMENTSTART # 2316
wxSTC_CMD_DOCUMENTSTARTEXTEND = stc.wxSTC_CMD_DOCUMENTSTARTEXTEND # 2317
wxSTC_CMD_EDITTOGGLEOVERTYPE = stc.wxSTC_CMD_EDITTOGGLEOVERTYPE # 2324
wxSTC_CMD_FORMFEED = stc.wxSTC_CMD_FORMFEED # 2330
wxSTC_CMD_HOME = stc.wxSTC_CMD_HOME # 2312
wxSTC_CMD_HOMEDISPLAY = stc.wxSTC_CMD_HOMEDISPLAY # 2345
wxSTC_CMD_HOMEDISPLAYEXTEND = stc.wxSTC_CMD_HOMEDISPLAYEXTEND # 2346
wxSTC_CMD_HOMEEXTEND = stc.wxSTC_CMD_HOMEEXTEND # 2313
wxSTC_CMD_LINECUT = stc.wxSTC_CMD_LINECUT # 2337
wxSTC_CMD_LINEDELETE = stc.wxSTC_CMD_LINEDELETE # 2338
wxSTC_CMD_LINEDOWN = stc.wxSTC_CMD_LINEDOWN # 2300
wxSTC_CMD_LINEDOWNEXTEND = stc.wxSTC_CMD_LINEDOWNEXTEND # 2301
wxSTC_CMD_LINEEND = stc.wxSTC_CMD_LINEEND # 2314
wxSTC_CMD_LINEENDDISPLAY = stc.wxSTC_CMD_LINEENDDISPLAY # 2347
wxSTC_CMD_LINEENDDISPLAYEXTEND = stc.wxSTC_CMD_LINEENDDISPLAYEXTEND # 2348
wxSTC_CMD_LINEENDEXTEND = stc.wxSTC_CMD_LINEENDEXTEND # 2315
wxSTC_CMD_LINESCROLLDOWN = stc.wxSTC_CMD_LINESCROLLDOWN # 2342
wxSTC_CMD_LINESCROLLUP = stc.wxSTC_CMD_LINESCROLLUP # 2343
wxSTC_CMD_LINETRANSPOSE = stc.wxSTC_CMD_LINETRANSPOSE # 2339
wxSTC_CMD_LINEUP = stc.wxSTC_CMD_LINEUP # 2302
wxSTC_CMD_LINEUPEXTEND = stc.wxSTC_CMD_LINEUPEXTEND # 2303
wxSTC_CMD_LOWERCASE = stc.wxSTC_CMD_LOWERCASE # 2340
wxSTC_CMD_NEWLINE = stc.wxSTC_CMD_NEWLINE # 2329
wxSTC_CMD_PAGEDOWN = stc.wxSTC_CMD_PAGEDOWN # 2322
wxSTC_CMD_PAGEDOWNEXTEND = stc.wxSTC_CMD_PAGEDOWNEXTEND # 2323
wxSTC_CMD_PAGEUP = stc.wxSTC_CMD_PAGEUP # 2320
wxSTC_CMD_PAGEUPEXTEND = stc.wxSTC_CMD_PAGEUPEXTEND # 2321
wxSTC_CMD_PASTE = stc.wxSTC_CMD_PASTE # 2179
wxSTC_CMD_REDO = stc.wxSTC_CMD_REDO # 2011
wxSTC_CMD_SELECTALL = stc.wxSTC_CMD_SELECTALL # 2013
wxSTC_CMD_TAB = stc.wxSTC_CMD_TAB # 2327
wxSTC_CMD_UNDO = stc.wxSTC_CMD_UNDO # 2176
wxSTC_CMD_UPPERCASE = stc.wxSTC_CMD_UPPERCASE # 2341
wxSTC_CMD_VCHOME = stc.wxSTC_CMD_VCHOME # 2331
wxSTC_CMD_VCHOMEEXTEND = stc.wxSTC_CMD_VCHOMEEXTEND # 2332
wxSTC_CMD_WORDLEFT = stc.wxSTC_CMD_WORDLEFT # 2308
wxSTC_CMD_WORDLEFTEXTEND = stc.wxSTC_CMD_WORDLEFTEXTEND # 2309
wxSTC_CMD_WORDPARTLEFT = stc.wxSTC_CMD_WORDPARTLEFT # 2390
wxSTC_CMD_WORDPARTLEFTEXTEND = stc.wxSTC_CMD_WORDPARTLEFTEXTEND # 2391
wxSTC_CMD_WORDPARTRIGHT = stc.wxSTC_CMD_WORDPARTRIGHT # 2392
wxSTC_CMD_WORDPARTRIGHTEXTEND = stc.wxSTC_CMD_WORDPARTRIGHTEXTEND # 2393
wxSTC_CMD_WORDRIGHT = stc.wxSTC_CMD_WORDRIGHT # 2310
wxSTC_CMD_WORDRIGHTEXTEND = stc.wxSTC_CMD_WORDRIGHTEXTEND # 2311
wxSTC_CMD_ZOOMIN = stc.wxSTC_CMD_ZOOMIN # 2333
wxSTC_CMD_ZOOMOUT = stc.wxSTC_CMD_ZOOMOUT # 2334
wxSTC_CONF_COMMENT = stc.wxSTC_CONF_COMMENT # 1
wxSTC_CONF_DEFAULT = stc.wxSTC_CONF_DEFAULT # 0
wxSTC_CONF_DIRECTIVE = stc.wxSTC_CONF_DIRECTIVE # 9
wxSTC_CONF_EXTENSION = stc.wxSTC_CONF_EXTENSION # 4
wxSTC_CONF_IDENTIFIER = stc.wxSTC_CONF_IDENTIFIER # 3
wxSTC_CONF_IP = stc.wxSTC_CONF_IP # 8
wxSTC_CONF_NUMBER = stc.wxSTC_CONF_NUMBER # 2
wxSTC_CONF_OPERATOR = stc.wxSTC_CONF_OPERATOR # 7
wxSTC_CONF_PARAMETER = stc.wxSTC_CONF_PARAMETER # 5
wxSTC_CONF_STRING = stc.wxSTC_CONF_STRING # 6
wxSTC_CP_UTF8 = stc.wxSTC_CP_UTF8 # 65001
wxSTC_CURSORNORMAL = stc.wxSTC_CURSORNORMAL # -1
wxSTC_CURSORWAIT = stc.wxSTC_CURSORWAIT # 3
wxSTC_C_CHARACTER = stc.wxSTC_C_CHARACTER # 7
wxSTC_C_COMMENT = stc.wxSTC_C_COMMENT # 1
wxSTC_C_COMMENTDOC = stc.wxSTC_C_COMMENTDOC # 3
wxSTC_C_COMMENTDOCKEYWORD = stc.wxSTC_C_COMMENTDOCKEYWORD # 17
wxSTC_C_COMMENTDOCKEYWORDERROR = stc.wxSTC_C_COMMENTDOCKEYWORDERROR # 18
wxSTC_C_COMMENTLINE = stc.wxSTC_C_COMMENTLINE # 2
wxSTC_C_COMMENTLINEDOC = stc.wxSTC_C_COMMENTLINEDOC # 15
wxSTC_C_DEFAULT = stc.wxSTC_C_DEFAULT # 0
wxSTC_C_IDENTIFIER = stc.wxSTC_C_IDENTIFIER # 11
wxSTC_C_NUMBER = stc.wxSTC_C_NUMBER # 4
wxSTC_C_OPERATOR = stc.wxSTC_C_OPERATOR # 10
wxSTC_C_PREPROCESSOR = stc.wxSTC_C_PREPROCESSOR # 9
wxSTC_C_REGEX = stc.wxSTC_C_REGEX # 14
wxSTC_C_STRING = stc.wxSTC_C_STRING # 6
wxSTC_C_STRINGEOL = stc.wxSTC_C_STRINGEOL # 12
wxSTC_C_UUID = stc.wxSTC_C_UUID # 8
wxSTC_C_VERBATIM = stc.wxSTC_C_VERBATIM # 13
wxSTC_C_WORD = stc.wxSTC_C_WORD # 5
wxSTC_C_WORD2 = stc.wxSTC_C_WORD2 # 16
wxSTC_DIFF_ADDED = stc.wxSTC_DIFF_ADDED # 6
wxSTC_DIFF_COMMAND = stc.wxSTC_DIFF_COMMAND # 2
wxSTC_DIFF_COMMENT = stc.wxSTC_DIFF_COMMENT # 1
wxSTC_DIFF_DEFAULT = stc.wxSTC_DIFF_DEFAULT # 0
wxSTC_DIFF_DELETED = stc.wxSTC_DIFF_DELETED # 5
wxSTC_DIFF_HEADER = stc.wxSTC_DIFF_HEADER # 3
wxSTC_DIFF_POSITION = stc.wxSTC_DIFF_POSITION # 4
wxSTC_EDGE_BACKGROUND = stc.wxSTC_EDGE_BACKGROUND # 2
wxSTC_EDGE_LINE = stc.wxSTC_EDGE_LINE # 1
wxSTC_EDGE_NONE = stc.wxSTC_EDGE_NONE # 0
wxSTC_EIFFEL_CHARACTER = stc.wxSTC_EIFFEL_CHARACTER # 5
wxSTC_EIFFEL_COMMENTLINE = stc.wxSTC_EIFFEL_COMMENTLINE # 1
wxSTC_EIFFEL_DEFAULT = stc.wxSTC_EIFFEL_DEFAULT # 0
wxSTC_EIFFEL_IDENTIFIER = stc.wxSTC_EIFFEL_IDENTIFIER # 7
wxSTC_EIFFEL_NUMBER = stc.wxSTC_EIFFEL_NUMBER # 2
wxSTC_EIFFEL_OPERATOR = stc.wxSTC_EIFFEL_OPERATOR # 6
wxSTC_EIFFEL_STRING = stc.wxSTC_EIFFEL_STRING # 4
wxSTC_EIFFEL_STRINGEOL = stc.wxSTC_EIFFEL_STRINGEOL # 8
wxSTC_EIFFEL_WORD = stc.wxSTC_EIFFEL_WORD # 3
wxSTC_EOL_CR = stc.wxSTC_EOL_CR # 1
wxSTC_EOL_CRLF = stc.wxSTC_EOL_CRLF # 0
wxSTC_EOL_LF = stc.wxSTC_EOL_LF # 2
wxSTC_ERR_BORLAND = stc.wxSTC_ERR_BORLAND # 5
wxSTC_ERR_CMD = stc.wxSTC_ERR_CMD # 4
wxSTC_ERR_CTAG = stc.wxSTC_ERR_CTAG # 9
wxSTC_ERR_DEFAULT = stc.wxSTC_ERR_DEFAULT # 0
wxSTC_ERR_DIFF_ADDITION = stc.wxSTC_ERR_DIFF_ADDITION # 11
wxSTC_ERR_DIFF_CHANGED = stc.wxSTC_ERR_DIFF_CHANGED # 10
wxSTC_ERR_DIFF_DELETION = stc.wxSTC_ERR_DIFF_DELETION # 12
wxSTC_ERR_DIFF_MESSAGE = stc.wxSTC_ERR_DIFF_MESSAGE # 13
wxSTC_ERR_GCC = stc.wxSTC_ERR_GCC # 2
wxSTC_ERR_LUA = stc.wxSTC_ERR_LUA # 8
wxSTC_ERR_MS = stc.wxSTC_ERR_MS # 3
wxSTC_ERR_NET = stc.wxSTC_ERR_NET # 7
wxSTC_ERR_PERL = stc.wxSTC_ERR_PERL # 6
wxSTC_ERR_PYTHON = stc.wxSTC_ERR_PYTHON # 1
wxSTC_FIND_MATCHCASE = stc.wxSTC_FIND_MATCHCASE # 4
wxSTC_FIND_REGEXP = stc.wxSTC_FIND_REGEXP # 2097152
wxSTC_FIND_WHOLEWORD = stc.wxSTC_FIND_WHOLEWORD # 2
wxSTC_FIND_WORDSTART = stc.wxSTC_FIND_WORDSTART # 1048576
wxSTC_FOLDLEVELBASE = stc.wxSTC_FOLDLEVELBASE # 1024
wxSTC_FOLDLEVELHEADERFLAG = stc.wxSTC_FOLDLEVELHEADERFLAG # 8192
wxSTC_FOLDLEVELNUMBERMASK = stc.wxSTC_FOLDLEVELNUMBERMASK # 4095
wxSTC_FOLDLEVELWHITEFLAG = stc.wxSTC_FOLDLEVELWHITEFLAG # 4096
wxSTC_HBA_COMMENTLINE = stc.wxSTC_HBA_COMMENTLINE # 82
wxSTC_HBA_DEFAULT = stc.wxSTC_HBA_DEFAULT # 81
wxSTC_HBA_IDENTIFIER = stc.wxSTC_HBA_IDENTIFIER # 86
wxSTC_HBA_NUMBER = stc.wxSTC_HBA_NUMBER # 83
wxSTC_HBA_START = stc.wxSTC_HBA_START # 80
wxSTC_HBA_STRING = stc.wxSTC_HBA_STRING # 85
wxSTC_HBA_STRINGEOL = stc.wxSTC_HBA_STRINGEOL # 87
wxSTC_HBA_WORD = stc.wxSTC_HBA_WORD # 84
wxSTC_HB_COMMENTLINE = stc.wxSTC_HB_COMMENTLINE # 72
wxSTC_HB_DEFAULT = stc.wxSTC_HB_DEFAULT # 71
wxSTC_HB_IDENTIFIER = stc.wxSTC_HB_IDENTIFIER # 76
wxSTC_HB_NUMBER = stc.wxSTC_HB_NUMBER # 73
wxSTC_HB_START = stc.wxSTC_HB_START # 70
wxSTC_HB_STRING = stc.wxSTC_HB_STRING # 75
wxSTC_HB_STRINGEOL = stc.wxSTC_HB_STRINGEOL # 77
wxSTC_HB_WORD = stc.wxSTC_HB_WORD # 74
wxSTC_HJA_COMMENT = stc.wxSTC_HJA_COMMENT # 57
wxSTC_HJA_COMMENTDOC = stc.wxSTC_HJA_COMMENTDOC # 59
wxSTC_HJA_COMMENTLINE = stc.wxSTC_HJA_COMMENTLINE # 58
wxSTC_HJA_DEFAULT = stc.wxSTC_HJA_DEFAULT # 56
wxSTC_HJA_DOUBLESTRING = stc.wxSTC_HJA_DOUBLESTRING # 63
wxSTC_HJA_KEYWORD = stc.wxSTC_HJA_KEYWORD # 62
wxSTC_HJA_NUMBER = stc.wxSTC_HJA_NUMBER # 60
wxSTC_HJA_REGEX = stc.wxSTC_HJA_REGEX # 67
wxSTC_HJA_SINGLESTRING = stc.wxSTC_HJA_SINGLESTRING # 64
wxSTC_HJA_START = stc.wxSTC_HJA_START # 55
wxSTC_HJA_STRINGEOL = stc.wxSTC_HJA_STRINGEOL # 66
wxSTC_HJA_SYMBOLS = stc.wxSTC_HJA_SYMBOLS # 65
wxSTC_HJA_WORD = stc.wxSTC_HJA_WORD # 61
wxSTC_HJ_COMMENT = stc.wxSTC_HJ_COMMENT # 42
wxSTC_HJ_COMMENTDOC = stc.wxSTC_HJ_COMMENTDOC # 44
wxSTC_HJ_COMMENTLINE = stc.wxSTC_HJ_COMMENTLINE # 43
wxSTC_HJ_DEFAULT = stc.wxSTC_HJ_DEFAULT # 41
wxSTC_HJ_DOUBLESTRING = stc.wxSTC_HJ_DOUBLESTRING # 48
wxSTC_HJ_KEYWORD = stc.wxSTC_HJ_KEYWORD # 47
wxSTC_HJ_NUMBER = stc.wxSTC_HJ_NUMBER # 45
wxSTC_HJ_REGEX = stc.wxSTC_HJ_REGEX # 52
wxSTC_HJ_SINGLESTRING = stc.wxSTC_HJ_SINGLESTRING # 49
wxSTC_HJ_START = stc.wxSTC_HJ_START # 40
wxSTC_HJ_STRINGEOL = stc.wxSTC_HJ_STRINGEOL # 51
wxSTC_HJ_SYMBOLS = stc.wxSTC_HJ_SYMBOLS # 50
wxSTC_HJ_WORD = stc.wxSTC_HJ_WORD # 46
wxSTC_HPA_CHARACTER = stc.wxSTC_HPA_CHARACTER # 110
wxSTC_HPA_CLASSNAME = stc.wxSTC_HPA_CLASSNAME # 114
wxSTC_HPA_COMMENTLINE = stc.wxSTC_HPA_COMMENTLINE # 107
wxSTC_HPA_DEFAULT = stc.wxSTC_HPA_DEFAULT # 106
wxSTC_HPA_DEFNAME = stc.wxSTC_HPA_DEFNAME # 115
wxSTC_HPA_IDENTIFIER = stc.wxSTC_HPA_IDENTIFIER # 117
wxSTC_HPA_NUMBER = stc.wxSTC_HPA_NUMBER # 108
wxSTC_HPA_OPERATOR = stc.wxSTC_HPA_OPERATOR # 116
wxSTC_HPA_START = stc.wxSTC_HPA_START # 105
wxSTC_HPA_STRING = stc.wxSTC_HPA_STRING # 109
wxSTC_HPA_TRIPLE = stc.wxSTC_HPA_TRIPLE # 112
wxSTC_HPA_TRIPLEDOUBLE = stc.wxSTC_HPA_TRIPLEDOUBLE # 113
wxSTC_HPA_WORD = stc.wxSTC_HPA_WORD # 111
wxSTC_HPHP_COMMENT = stc.wxSTC_HPHP_COMMENT # 124
wxSTC_HPHP_COMMENTLINE = stc.wxSTC_HPHP_COMMENTLINE # 125
wxSTC_HPHP_DEFAULT = stc.wxSTC_HPHP_DEFAULT # 118
wxSTC_HPHP_HSTRING = stc.wxSTC_HPHP_HSTRING # 119
wxSTC_HPHP_HSTRING_VARIABLE = stc.wxSTC_HPHP_HSTRING_VARIABLE # 126
wxSTC_HPHP_NUMBER = stc.wxSTC_HPHP_NUMBER # 122
wxSTC_HPHP_OPERATOR = stc.wxSTC_HPHP_OPERATOR # 127
wxSTC_HPHP_SIMPLESTRING = stc.wxSTC_HPHP_SIMPLESTRING # 120
wxSTC_HPHP_VARIABLE = stc.wxSTC_HPHP_VARIABLE # 123
wxSTC_HPHP_WORD = stc.wxSTC_HPHP_WORD # 121
wxSTC_HP_CHARACTER = stc.wxSTC_HP_CHARACTER # 95
wxSTC_HP_CLASSNAME = stc.wxSTC_HP_CLASSNAME # 99
wxSTC_HP_COMMENTLINE = stc.wxSTC_HP_COMMENTLINE # 92
wxSTC_HP_DEFAULT = stc.wxSTC_HP_DEFAULT # 91
wxSTC_HP_DEFNAME = stc.wxSTC_HP_DEFNAME # 100
wxSTC_HP_IDENTIFIER = stc.wxSTC_HP_IDENTIFIER # 102
wxSTC_HP_NUMBER = stc.wxSTC_HP_NUMBER # 93
wxSTC_HP_OPERATOR = stc.wxSTC_HP_OPERATOR # 101
wxSTC_HP_START = stc.wxSTC_HP_START # 90
wxSTC_HP_STRING = stc.wxSTC_HP_STRING # 94
wxSTC_HP_TRIPLE = stc.wxSTC_HP_TRIPLE # 97
wxSTC_HP_TRIPLEDOUBLE = stc.wxSTC_HP_TRIPLEDOUBLE # 98
wxSTC_HP_WORD = stc.wxSTC_HP_WORD # 96
wxSTC_H_ASP = stc.wxSTC_H_ASP # 15
wxSTC_H_ASPAT = stc.wxSTC_H_ASPAT # 16
wxSTC_H_ATTRIBUTE = stc.wxSTC_H_ATTRIBUTE # 3
wxSTC_H_ATTRIBUTEUNKNOWN = stc.wxSTC_H_ATTRIBUTEUNKNOWN # 4
wxSTC_H_CDATA = stc.wxSTC_H_CDATA # 17
wxSTC_H_COMMENT = stc.wxSTC_H_COMMENT # 9
wxSTC_H_DEFAULT = stc.wxSTC_H_DEFAULT # 0
wxSTC_H_DOUBLESTRING = stc.wxSTC_H_DOUBLESTRING # 6
wxSTC_H_ENTITY = stc.wxSTC_H_ENTITY # 10
wxSTC_H_NUMBER = stc.wxSTC_H_NUMBER # 5
wxSTC_H_OTHER = stc.wxSTC_H_OTHER # 8
wxSTC_H_QUESTION = stc.wxSTC_H_QUESTION # 18
wxSTC_H_SCRIPT = stc.wxSTC_H_SCRIPT # 14
wxSTC_H_SGML_1ST_PARAM = stc.wxSTC_H_SGML_1ST_PARAM # 23
wxSTC_H_SGML_1ST_PARAM_COMMENT = stc.wxSTC_H_SGML_1ST_PARAM_COMMENT # 30
wxSTC_H_SGML_BLOCK_DEFAULT = stc.wxSTC_H_SGML_BLOCK_DEFAULT # 31
wxSTC_H_SGML_COMMAND = stc.wxSTC_H_SGML_COMMAND # 22
wxSTC_H_SGML_COMMENT = stc.wxSTC_H_SGML_COMMENT # 29
wxSTC_H_SGML_DEFAULT = stc.wxSTC_H_SGML_DEFAULT # 21
wxSTC_H_SGML_DOUBLESTRING = stc.wxSTC_H_SGML_DOUBLESTRING # 24
wxSTC_H_SGML_ENTITY = stc.wxSTC_H_SGML_ENTITY # 28
wxSTC_H_SGML_ERROR = stc.wxSTC_H_SGML_ERROR # 26
wxSTC_H_SGML_SIMPLESTRING = stc.wxSTC_H_SGML_SIMPLESTRING # 25
wxSTC_H_SGML_SPECIAL = stc.wxSTC_H_SGML_SPECIAL # 27
wxSTC_H_SINGLESTRING = stc.wxSTC_H_SINGLESTRING # 7
wxSTC_H_TAG = stc.wxSTC_H_TAG # 1
wxSTC_H_TAGEND = stc.wxSTC_H_TAGEND # 11
wxSTC_H_TAGUNKNOWN = stc.wxSTC_H_TAGUNKNOWN # 2
wxSTC_H_VALUE = stc.wxSTC_H_VALUE # 19
wxSTC_H_XCCOMMENT = stc.wxSTC_H_XCCOMMENT # 20
wxSTC_H_XMLEND = stc.wxSTC_H_XMLEND # 13
wxSTC_H_XMLSTART = stc.wxSTC_H_XMLSTART # 12
wxSTC_INDIC0_MASK = stc.wxSTC_INDIC0_MASK # 32
wxSTC_INDIC1_MASK = stc.wxSTC_INDIC1_MASK # 64
wxSTC_INDIC2_MASK = stc.wxSTC_INDIC2_MASK # 128
wxSTC_INDICS_MASK = stc.wxSTC_INDICS_MASK # 224
wxSTC_INDIC_DIAGONAL = stc.wxSTC_INDIC_DIAGONAL # 3
wxSTC_INDIC_MAX = stc.wxSTC_INDIC_MAX # 7
wxSTC_INDIC_PLAIN = stc.wxSTC_INDIC_PLAIN # 0
wxSTC_INDIC_SQUIGGLE = stc.wxSTC_INDIC_SQUIGGLE # 1
wxSTC_INDIC_STRIKE = stc.wxSTC_INDIC_STRIKE # 4
wxSTC_INDIC_TT = stc.wxSTC_INDIC_TT # 2
wxSTC_INVALID_POSITION = stc.wxSTC_INVALID_POSITION # -1
wxSTC_KEY_ADD = stc.wxSTC_KEY_ADD # 310
wxSTC_KEY_BACK = stc.wxSTC_KEY_BACK # 8
wxSTC_KEY_DELETE = stc.wxSTC_KEY_DELETE # 308
wxSTC_KEY_DIVIDE = stc.wxSTC_KEY_DIVIDE # 312
wxSTC_KEY_DOWN = stc.wxSTC_KEY_DOWN # 300
wxSTC_KEY_END = stc.wxSTC_KEY_END # 305
wxSTC_KEY_ESCAPE = stc.wxSTC_KEY_ESCAPE # 7
wxSTC_KEY_HOME = stc.wxSTC_KEY_HOME # 304
wxSTC_KEY_INSERT = stc.wxSTC_KEY_INSERT # 309
wxSTC_KEY_LEFT = stc.wxSTC_KEY_LEFT # 302
wxSTC_KEY_NEXT = stc.wxSTC_KEY_NEXT # 307
wxSTC_KEY_PRIOR = stc.wxSTC_KEY_PRIOR # 306
wxSTC_KEY_RETURN = stc.wxSTC_KEY_RETURN # 13
wxSTC_KEY_RIGHT = stc.wxSTC_KEY_RIGHT # 303
wxSTC_KEY_SUBTRACT = stc.wxSTC_KEY_SUBTRACT # 311
wxSTC_KEY_TAB = stc.wxSTC_KEY_TAB # 9
wxSTC_KEY_UP = stc.wxSTC_KEY_UP # 301
wxSTC_LASTSTEPINUNDOREDO = stc.wxSTC_LASTSTEPINUNDOREDO # 256
wxSTC_LEXER_START = stc.wxSTC_LEXER_START # 4000
wxSTC_LEX_ADA = stc.wxSTC_LEX_ADA # 20
wxSTC_LEX_ASP = stc.wxSTC_LEX_ASP # 29
wxSTC_LEX_AUTOMATIC = stc.wxSTC_LEX_AUTOMATIC # 1000
wxSTC_LEX_AVE = stc.wxSTC_LEX_AVE # 19
wxSTC_LEX_BAAN = stc.wxSTC_LEX_BAAN # 31
wxSTC_LEX_BATCH = stc.wxSTC_LEX_BATCH # 12
wxSTC_LEX_BULLANT = stc.wxSTC_LEX_BULLANT # 27
wxSTC_LEX_CONF = stc.wxSTC_LEX_CONF # 17
wxSTC_LEX_CONTAINER = stc.wxSTC_LEX_CONTAINER # 0
wxSTC_LEX_CPP = stc.wxSTC_LEX_CPP # 3
wxSTC_LEX_DIFF = stc.wxSTC_LEX_DIFF # 16
wxSTC_LEX_EIFFEL = stc.wxSTC_LEX_EIFFEL # 23
wxSTC_LEX_EIFFELKW = stc.wxSTC_LEX_EIFFELKW # 24
wxSTC_LEX_ERRORLIST = stc.wxSTC_LEX_ERRORLIST # 10
wxSTC_LEX_HTML = stc.wxSTC_LEX_HTML # 4
wxSTC_LEX_LATEX = stc.wxSTC_LEX_LATEX # 14
wxSTC_LEX_LISP = stc.wxSTC_LEX_LISP # 21
wxSTC_LEX_LUA = stc.wxSTC_LEX_LUA # 15
wxSTC_LEX_MAKEFILE = stc.wxSTC_LEX_MAKEFILE # 11
wxSTC_LEX_MATLAB = stc.wxSTC_LEX_MATLAB # 32
wxSTC_LEX_NNCRONTAB = stc.wxSTC_LEX_NNCRONTAB # 26
wxSTC_LEX_NULL = stc.wxSTC_LEX_NULL # 1
wxSTC_LEX_PASCAL = stc.wxSTC_LEX_PASCAL # 18
wxSTC_LEX_PERL = stc.wxSTC_LEX_PERL # 6
wxSTC_LEX_PHP = stc.wxSTC_LEX_PHP # 30
wxSTC_LEX_PROPERTIES = stc.wxSTC_LEX_PROPERTIES # 9
wxSTC_LEX_PYTHON = stc.wxSTC_LEX_PYTHON # 2
wxSTC_LEX_RUBY = stc.wxSTC_LEX_RUBY # 22
wxSTC_LEX_SCRIPTOL = stc.wxSTC_LEX_SCRIPTOL # 33
wxSTC_LEX_SQL = stc.wxSTC_LEX_SQL # 7
wxSTC_LEX_TCL = stc.wxSTC_LEX_TCL # 25
wxSTC_LEX_VB = stc.wxSTC_LEX_VB # 8
wxSTC_LEX_VBSCRIPT = stc.wxSTC_LEX_VBSCRIPT # 28
wxSTC_LEX_XCODE = stc.wxSTC_LEX_XCODE # 13
wxSTC_LEX_XML = stc.wxSTC_LEX_XML # 5
wxSTC_LISP_COMMENT = stc.wxSTC_LISP_COMMENT # 1
wxSTC_LISP_DEFAULT = stc.wxSTC_LISP_DEFAULT # 0
wxSTC_LISP_IDENTIFIER = stc.wxSTC_LISP_IDENTIFIER # 9
wxSTC_LISP_KEYWORD = stc.wxSTC_LISP_KEYWORD # 3
wxSTC_LISP_NUMBER = stc.wxSTC_LISP_NUMBER # 2
wxSTC_LISP_OPERATOR = stc.wxSTC_LISP_OPERATOR # 10
wxSTC_LISP_STRING = stc.wxSTC_LISP_STRING # 6
wxSTC_LISP_STRINGEOL = stc.wxSTC_LISP_STRINGEOL # 8
wxSTC_LUA_CHARACTER = stc.wxSTC_LUA_CHARACTER # 7
wxSTC_LUA_COMMENT = stc.wxSTC_LUA_COMMENT # 1
wxSTC_LUA_COMMENTDOC = stc.wxSTC_LUA_COMMENTDOC # 3
wxSTC_LUA_COMMENTLINE = stc.wxSTC_LUA_COMMENTLINE # 2
wxSTC_LUA_DEFAULT = stc.wxSTC_LUA_DEFAULT # 0
wxSTC_LUA_IDENTIFIER = stc.wxSTC_LUA_IDENTIFIER # 11
wxSTC_LUA_LITERALSTRING = stc.wxSTC_LUA_LITERALSTRING # 8
wxSTC_LUA_NUMBER = stc.wxSTC_LUA_NUMBER # 4
wxSTC_LUA_OPERATOR = stc.wxSTC_LUA_OPERATOR # 10
wxSTC_LUA_PREPROCESSOR = stc.wxSTC_LUA_PREPROCESSOR # 9
wxSTC_LUA_STRING = stc.wxSTC_LUA_STRING # 6
wxSTC_LUA_STRINGEOL = stc.wxSTC_LUA_STRINGEOL # 12
wxSTC_LUA_WORD = stc.wxSTC_LUA_WORD # 5
wxSTC_LUA_WORD2 = stc.wxSTC_LUA_WORD2 # 13
wxSTC_LUA_WORD3 = stc.wxSTC_LUA_WORD3 # 14
wxSTC_LUA_WORD4 = stc.wxSTC_LUA_WORD4 # 15
wxSTC_LUA_WORD5 = stc.wxSTC_LUA_WORD5 # 16
wxSTC_LUA_WORD6 = stc.wxSTC_LUA_WORD6 # 17
wxSTC_L_COMMAND = stc.wxSTC_L_COMMAND # 1
wxSTC_L_COMMENT = stc.wxSTC_L_COMMENT # 4
wxSTC_L_DEFAULT = stc.wxSTC_L_DEFAULT # 0
wxSTC_L_MATH = stc.wxSTC_L_MATH # 3
wxSTC_L_TAG = stc.wxSTC_L_TAG # 2
wxSTC_MAKE_COMMENT = stc.wxSTC_MAKE_COMMENT # 1
wxSTC_MAKE_DEFAULT = stc.wxSTC_MAKE_DEFAULT # 0
wxSTC_MAKE_IDENTIFIER = stc.wxSTC_MAKE_IDENTIFIER # 3
wxSTC_MAKE_IDEOL = stc.wxSTC_MAKE_IDEOL # 9
wxSTC_MAKE_OPERATOR = stc.wxSTC_MAKE_OPERATOR # 4
wxSTC_MAKE_PREPROCESSOR = stc.wxSTC_MAKE_PREPROCESSOR # 2
wxSTC_MAKE_TARGET = stc.wxSTC_MAKE_TARGET # 5
wxSTC_MARGIN_NUMBER = stc.wxSTC_MARGIN_NUMBER # 1
wxSTC_MARGIN_SYMBOL = stc.wxSTC_MARGIN_SYMBOL # 0
wxSTC_MARKER_MAX = stc.wxSTC_MARKER_MAX # 31
wxSTC_MARKNUM_FOLDER = stc.wxSTC_MARKNUM_FOLDER # 30
wxSTC_MARKNUM_FOLDEREND = stc.wxSTC_MARKNUM_FOLDEREND # 25
wxSTC_MARKNUM_FOLDERMIDTAIL = stc.wxSTC_MARKNUM_FOLDERMIDTAIL # 27
wxSTC_MARKNUM_FOLDEROPEN = stc.wxSTC_MARKNUM_FOLDEROPEN # 31
wxSTC_MARKNUM_FOLDEROPENMID = stc.wxSTC_MARKNUM_FOLDEROPENMID # 26
wxSTC_MARKNUM_FOLDERSUB = stc.wxSTC_MARKNUM_FOLDERSUB # 29
wxSTC_MARKNUM_FOLDERTAIL = stc.wxSTC_MARKNUM_FOLDERTAIL # 28
wxSTC_MARK_ARROW = stc.wxSTC_MARK_ARROW # 2
wxSTC_MARK_ARROWDOWN = stc.wxSTC_MARK_ARROWDOWN # 6
wxSTC_MARK_ARROWS = stc.wxSTC_MARK_ARROWS # 24
wxSTC_MARK_BACKGROUND = stc.wxSTC_MARK_BACKGROUND # 22
wxSTC_MARK_BOXMINUS = stc.wxSTC_MARK_BOXMINUS # 14
wxSTC_MARK_BOXMINUSCONNECTED = stc.wxSTC_MARK_BOXMINUSCONNECTED # 15
wxSTC_MARK_BOXPLUS = stc.wxSTC_MARK_BOXPLUS # 12
wxSTC_MARK_BOXPLUSCONNECTED = stc.wxSTC_MARK_BOXPLUSCONNECTED # 13
wxSTC_MARK_CHARACTER = stc.wxSTC_MARK_CHARACTER # 10000
wxSTC_MARK_CIRCLE = stc.wxSTC_MARK_CIRCLE # 0
wxSTC_MARK_CIRCLEMINUS = stc.wxSTC_MARK_CIRCLEMINUS # 20
wxSTC_MARK_CIRCLEMINUSCONNECTED = stc.wxSTC_MARK_CIRCLEMINUSCONNECTED # 21
wxSTC_MARK_CIRCLEPLUS = stc.wxSTC_MARK_CIRCLEPLUS # 18
wxSTC_MARK_CIRCLEPLUSCONNECTED = stc.wxSTC_MARK_CIRCLEPLUSCONNECTED # 19
wxSTC_MARK_DOTDOTDOT = stc.wxSTC_MARK_DOTDOTDOT # 23
wxSTC_MARK_EMPTY = stc.wxSTC_MARK_EMPTY # 5
wxSTC_MARK_LCORNER = stc.wxSTC_MARK_LCORNER # 10
wxSTC_MARK_LCORNERCURVE = stc.wxSTC_MARK_LCORNERCURVE # 16
wxSTC_MARK_MINUS = stc.wxSTC_MARK_MINUS # 7
wxSTC_MARK_PLUS = stc.wxSTC_MARK_PLUS # 8
wxSTC_MARK_ROUNDRECT = stc.wxSTC_MARK_ROUNDRECT # 1
wxSTC_MARK_SHORTARROW = stc.wxSTC_MARK_SHORTARROW # 4
wxSTC_MARK_SMALLRECT = stc.wxSTC_MARK_SMALLRECT # 3
wxSTC_MARK_TCORNER = stc.wxSTC_MARK_TCORNER # 11
wxSTC_MARK_TCORNERCURVE = stc.wxSTC_MARK_TCORNERCURVE # 17
wxSTC_MARK_VLINE = stc.wxSTC_MARK_VLINE # 9
wxSTC_MASK_FOLDERS = stc.wxSTC_MASK_FOLDERS # -33554432
wxSTC_MATLAB_COMMAND = stc.wxSTC_MATLAB_COMMAND # 2
wxSTC_MATLAB_COMMENT = stc.wxSTC_MATLAB_COMMENT # 1
wxSTC_MATLAB_DEFAULT = stc.wxSTC_MATLAB_DEFAULT # 0
wxSTC_MATLAB_IDENTIFIER = stc.wxSTC_MATLAB_IDENTIFIER # 7
wxSTC_MATLAB_KEYWORD = stc.wxSTC_MATLAB_KEYWORD # 4
wxSTC_MATLAB_NUMBER = stc.wxSTC_MATLAB_NUMBER # 3
wxSTC_MATLAB_OPERATOR = stc.wxSTC_MATLAB_OPERATOR # 6
wxSTC_MATLAB_STRING = stc.wxSTC_MATLAB_STRING # 5
wxSTC_MODEVENTMASKALL = stc.wxSTC_MODEVENTMASKALL # 3959
wxSTC_MOD_BEFOREDELETE = stc.wxSTC_MOD_BEFOREDELETE # 2048
wxSTC_MOD_BEFOREINSERT = stc.wxSTC_MOD_BEFOREINSERT # 1024
wxSTC_MOD_CHANGEFOLD = stc.wxSTC_MOD_CHANGEFOLD # 8
wxSTC_MOD_CHANGEMARKER = stc.wxSTC_MOD_CHANGEMARKER # 512
wxSTC_MOD_CHANGESTYLE = stc.wxSTC_MOD_CHANGESTYLE # 4
wxSTC_MOD_DELETETEXT = stc.wxSTC_MOD_DELETETEXT # 2
wxSTC_MOD_INSERTTEXT = stc.wxSTC_MOD_INSERTTEXT # 1
wxSTC_NNCRONTAB_ASTERISK = stc.wxSTC_NNCRONTAB_ASTERISK # 6
wxSTC_NNCRONTAB_COMMENT = stc.wxSTC_NNCRONTAB_COMMENT # 1
wxSTC_NNCRONTAB_DEFAULT = stc.wxSTC_NNCRONTAB_DEFAULT # 0
wxSTC_NNCRONTAB_ENVIRONMENT = stc.wxSTC_NNCRONTAB_ENVIRONMENT # 9
wxSTC_NNCRONTAB_IDENTIFIER = stc.wxSTC_NNCRONTAB_IDENTIFIER # 10
wxSTC_NNCRONTAB_KEYWORD = stc.wxSTC_NNCRONTAB_KEYWORD # 4
wxSTC_NNCRONTAB_MODIFIER = stc.wxSTC_NNCRONTAB_MODIFIER # 5
wxSTC_NNCRONTAB_NUMBER = stc.wxSTC_NNCRONTAB_NUMBER # 7
wxSTC_NNCRONTAB_SECTION = stc.wxSTC_NNCRONTAB_SECTION # 3
wxSTC_NNCRONTAB_STRING = stc.wxSTC_NNCRONTAB_STRING # 8
wxSTC_NNCRONTAB_TASK = stc.wxSTC_NNCRONTAB_TASK # 2
wxSTC_OPTIONAL_START = stc.wxSTC_OPTIONAL_START # 3000
wxSTC_PERFORMED_REDO = stc.wxSTC_PERFORMED_REDO # 64
wxSTC_PERFORMED_UNDO = stc.wxSTC_PERFORMED_UNDO # 32
wxSTC_PERFORMED_USER = stc.wxSTC_PERFORMED_USER # 16
wxSTC_PL_ARRAY = stc.wxSTC_PL_ARRAY # 13
wxSTC_PL_BACKTICKS = stc.wxSTC_PL_BACKTICKS # 20
wxSTC_PL_CHARACTER = stc.wxSTC_PL_CHARACTER # 7
wxSTC_PL_COMMENTLINE = stc.wxSTC_PL_COMMENTLINE # 2
wxSTC_PL_DATASECTION = stc.wxSTC_PL_DATASECTION # 21
wxSTC_PL_DEFAULT = stc.wxSTC_PL_DEFAULT # 0
wxSTC_PL_ERROR = stc.wxSTC_PL_ERROR # 1
wxSTC_PL_HASH = stc.wxSTC_PL_HASH # 14
wxSTC_PL_HERE_DELIM = stc.wxSTC_PL_HERE_DELIM # 22
wxSTC_PL_HERE_Q = stc.wxSTC_PL_HERE_Q # 23
wxSTC_PL_HERE_QQ = stc.wxSTC_PL_HERE_QQ # 24
wxSTC_PL_HERE_QX = stc.wxSTC_PL_HERE_QX # 25
wxSTC_PL_IDENTIFIER = stc.wxSTC_PL_IDENTIFIER # 11
wxSTC_PL_LONGQUOTE = stc.wxSTC_PL_LONGQUOTE # 19
wxSTC_PL_NUMBER = stc.wxSTC_PL_NUMBER # 4
wxSTC_PL_OPERATOR = stc.wxSTC_PL_OPERATOR # 10
wxSTC_PL_POD = stc.wxSTC_PL_POD # 3
wxSTC_PL_PREPROCESSOR = stc.wxSTC_PL_PREPROCESSOR # 9
wxSTC_PL_PUNCTUATION = stc.wxSTC_PL_PUNCTUATION # 8
wxSTC_PL_REGEX = stc.wxSTC_PL_REGEX # 17
wxSTC_PL_REGSUBST = stc.wxSTC_PL_REGSUBST # 18
wxSTC_PL_SCALAR = stc.wxSTC_PL_SCALAR # 12
wxSTC_PL_STRING = stc.wxSTC_PL_STRING # 6
wxSTC_PL_STRING_Q = stc.wxSTC_PL_STRING_Q # 26
wxSTC_PL_STRING_QQ = stc.wxSTC_PL_STRING_QQ # 27
wxSTC_PL_STRING_QR = stc.wxSTC_PL_STRING_QR # 29
wxSTC_PL_STRING_QW = stc.wxSTC_PL_STRING_QW # 30
wxSTC_PL_STRING_QX = stc.wxSTC_PL_STRING_QX # 28
wxSTC_PL_SYMBOLTABLE = stc.wxSTC_PL_SYMBOLTABLE # 15
wxSTC_PL_WORD = stc.wxSTC_PL_WORD # 5
wxSTC_PRINT_BLACKONWHITE = stc.wxSTC_PRINT_BLACKONWHITE # 2
wxSTC_PRINT_COLOURONWHITE = stc.wxSTC_PRINT_COLOURONWHITE # 3
wxSTC_PRINT_COLOURONWHITEDEFAULTBG = stc.wxSTC_PRINT_COLOURONWHITEDEFAULTBG # 4
wxSTC_PRINT_INVERTLIGHT = stc.wxSTC_PRINT_INVERTLIGHT # 1
wxSTC_PRINT_NORMAL = stc.wxSTC_PRINT_NORMAL # 0
wxSTC_PROPS_ASSIGNMENT = stc.wxSTC_PROPS_ASSIGNMENT # 3
wxSTC_PROPS_COMMENT = stc.wxSTC_PROPS_COMMENT # 1
wxSTC_PROPS_DEFAULT = stc.wxSTC_PROPS_DEFAULT # 0
wxSTC_PROPS_DEFVAL = stc.wxSTC_PROPS_DEFVAL # 4
wxSTC_PROPS_SECTION = stc.wxSTC_PROPS_SECTION # 2
wxSTC_P_CHARACTER = stc.wxSTC_P_CHARACTER # 4
wxSTC_P_CLASSNAME = stc.wxSTC_P_CLASSNAME # 8
wxSTC_P_COMMENTBLOCK = stc.wxSTC_P_COMMENTBLOCK # 12
wxSTC_P_COMMENTLINE = stc.wxSTC_P_COMMENTLINE # 1
wxSTC_P_DEFAULT = stc.wxSTC_P_DEFAULT # 0
wxSTC_P_DEFNAME = stc.wxSTC_P_DEFNAME # 9
wxSTC_P_IDENTIFIER = stc.wxSTC_P_IDENTIFIER # 11
wxSTC_P_NUMBER = stc.wxSTC_P_NUMBER # 2
wxSTC_P_OPERATOR = stc.wxSTC_P_OPERATOR # 10
wxSTC_P_STRING = stc.wxSTC_P_STRING # 3
wxSTC_P_STRINGEOL = stc.wxSTC_P_STRINGEOL # 13
wxSTC_P_TRIPLE = stc.wxSTC_P_TRIPLE # 6
wxSTC_P_TRIPLEDOUBLE = stc.wxSTC_P_TRIPLEDOUBLE # 7
wxSTC_P_WORD = stc.wxSTC_P_WORD # 5
wxSTC_SCMOD_ALT = stc.wxSTC_SCMOD_ALT # 4
wxSTC_SCMOD_CTRL = stc.wxSTC_SCMOD_CTRL # 2
wxSTC_SCMOD_SHIFT = stc.wxSTC_SCMOD_SHIFT # 1
wxSTC_SCRIPTOL_CHARACTER = stc.wxSTC_SCRIPTOL_CHARACTER # 7
wxSTC_SCRIPTOL_COMMENT = stc.wxSTC_SCRIPTOL_COMMENT # 1
wxSTC_SCRIPTOL_COMMENTBASIC = stc.wxSTC_SCRIPTOL_COMMENTBASIC # 19
wxSTC_SCRIPTOL_COMMENTDOC = stc.wxSTC_SCRIPTOL_COMMENTDOC # 3
wxSTC_SCRIPTOL_COMMENTDOCKEYWORD = stc.wxSTC_SCRIPTOL_COMMENTDOCKEYWORD # 17
wxSTC_SCRIPTOL_COMMENTDOCKEYWORDERROR = stc.wxSTC_SCRIPTOL_COMMENTDOCKEYWORDERROR # 18
wxSTC_SCRIPTOL_COMMENTLINE = stc.wxSTC_SCRIPTOL_COMMENTLINE # 2
wxSTC_SCRIPTOL_COMMENTLINEDOC = stc.wxSTC_SCRIPTOL_COMMENTLINEDOC # 15
wxSTC_SCRIPTOL_DEFAULT = stc.wxSTC_SCRIPTOL_DEFAULT # 0
wxSTC_SCRIPTOL_IDENTIFIER = stc.wxSTC_SCRIPTOL_IDENTIFIER # 11
wxSTC_SCRIPTOL_NUMBER = stc.wxSTC_SCRIPTOL_NUMBER # 4
wxSTC_SCRIPTOL_OPERATOR = stc.wxSTC_SCRIPTOL_OPERATOR # 10
wxSTC_SCRIPTOL_PREPROCESSOR = stc.wxSTC_SCRIPTOL_PREPROCESSOR # 9
wxSTC_SCRIPTOL_REGEX = stc.wxSTC_SCRIPTOL_REGEX # 14
wxSTC_SCRIPTOL_STRING = stc.wxSTC_SCRIPTOL_STRING # 6
wxSTC_SCRIPTOL_STRINGEOL = stc.wxSTC_SCRIPTOL_STRINGEOL # 12
wxSTC_SCRIPTOL_UUID = stc.wxSTC_SCRIPTOL_UUID # 8
wxSTC_SCRIPTOL_VERBATIM = stc.wxSTC_SCRIPTOL_VERBATIM # 13
wxSTC_SCRIPTOL_WORD = stc.wxSTC_SCRIPTOL_WORD # 5
wxSTC_SCRIPTOL_WORD2 = stc.wxSTC_SCRIPTOL_WORD2 # 16
wxSTC_START = stc.wxSTC_START # 2000
wxSTC_STYLE_BRACEBAD = stc.wxSTC_STYLE_BRACEBAD # 35
wxSTC_STYLE_BRACELIGHT = stc.wxSTC_STYLE_BRACELIGHT # 34
wxSTC_STYLE_CONTROLCHAR = stc.wxSTC_STYLE_CONTROLCHAR # 36
wxSTC_STYLE_DEFAULT = stc.wxSTC_STYLE_DEFAULT # 32
wxSTC_STYLE_INDENTGUIDE = stc.wxSTC_STYLE_INDENTGUIDE # 37
wxSTC_STYLE_LASTPREDEFINED = stc.wxSTC_STYLE_LASTPREDEFINED # 39
wxSTC_STYLE_LINENUMBER = stc.wxSTC_STYLE_LINENUMBER # 33
wxSTC_STYLE_MAX = stc.wxSTC_STYLE_MAX # 127
wxSTC_TIME_FOREVER = stc.wxSTC_TIME_FOREVER # 10000000
wxSTC_USE_POPUP = stc.wxSTC_USE_POPUP # 1
wxSTC_VISIBLE_SLOP = stc.wxSTC_VISIBLE_SLOP # 1
wxSTC_VISIBLE_STRICT = stc.wxSTC_VISIBLE_STRICT # 4
wxSTC_WRAP_NONE = stc.wxSTC_WRAP_NONE # 0
wxSTC_WRAP_WORD = stc.wxSTC_WRAP_WORD # 1
wxSTC_WS_INVISIBLE = stc.wxSTC_WS_INVISIBLE # 0
wxSTC_WS_VISIBLEAFTERINDENT = stc.wxSTC_WS_VISIBLEAFTERINDENT # 2
wxSTC_WS_VISIBLEALWAYS = stc.wxSTC_WS_VISIBLEALWAYS # 1
# End generated constants.

View File

@@ -0,0 +1,26 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
class MutexGuiLocker:
""""""
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass

View File

@@ -0,0 +1,403 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import Object
from Controls import Control
import Parameters as wx
class ToolBarBase(Control):
""""""
def AddCheckLabelTool(self):
""""""
pass
def AddCheckTool(self):
""""""
pass
def AddControl(self):
""""""
pass
def AddLabelTool(self):
""""""
pass
def AddRadioLabelTool(self):
""""""
pass
def AddRadioTool(self):
""""""
pass
def AddSeparator(self):
""""""
pass
def AddSimpleTool(self):
""""""
pass
def AddTool(self):
""""""
pass
def ClearTools(self):
""""""
pass
def DeleteTool(self):
""""""
pass
def DeleteToolByPos(self):
""""""
pass
def DoAddTool(self):
""""""
pass
def DoInsertTool(self):
""""""
pass
def EnableTool(self):
""""""
pass
def FindControl(self):
""""""
pass
def FindToolForPosition(self):
""""""
pass
def GetMargins(self):
""""""
pass
def GetMaxCols(self):
""""""
pass
def GetMaxRows(self):
""""""
pass
def GetToolBitmapSize(self):
""""""
pass
def GetToolClientData(self):
""""""
pass
def GetToolEnabled(self):
""""""
pass
def GetToolLongHelp(self):
""""""
pass
def GetToolMargins(self):
""""""
pass
def GetToolPacking(self):
""""""
pass
def GetToolSeparation(self):
""""""
pass
def GetToolShortHelp(self):
""""""
pass
def GetToolSize(self):
""""""
pass
def GetToolState(self):
""""""
pass
def InsertControl(self):
""""""
pass
def InsertLabelTool(self):
""""""
pass
def InsertSeparator(self):
""""""
pass
def InsertSimpleTool(self):
""""""
pass
def InsertTool(self):
""""""
pass
def IsVertical(self):
""""""
pass
def Realize(self):
""""""
pass
def RemoveTool(self):
""""""
pass
def SetMargins(self):
""""""
pass
def SetMarginsXY(self):
""""""
pass
def SetMaxRowsCols(self):
""""""
pass
def SetRows(self):
""""""
pass
def SetToggle(self):
""""""
pass
def SetToolBitmapSize(self):
""""""
pass
def SetToolClientData(self):
""""""
pass
def SetToolLongHelp(self):
""""""
pass
def SetToolPacking(self):
""""""
pass
def SetToolSeparation(self):
""""""
pass
def SetToolShortHelp(self):
""""""
pass
def ToggleTool(self):
""""""
pass
def __init__(self):
""""""
pass
class ToolBar(ToolBarBase):
""""""
def Create(self):
""""""
pass
def FindToolForPosition(self):
""""""
pass
def __init__(self):
""""""
pass
class ToolBarSimple(ToolBarBase):
""""""
def Create(self):
""""""
pass
def FindToolForPosition(self):
""""""
pass
def __init__(self):
""""""
pass
class ToolBarToolBase(Object):
""""""
def Attach(self):
""""""
pass
def CanBeToggled(self):
""""""
pass
def Destroy(self):
""""""
pass
def Detach(self):
""""""
pass
def Enable(self):
""""""
pass
def GetBitmap(self):
""""""
pass
def GetBitmap1(self):
""""""
pass
def GetBitmap2(self):
""""""
pass
def GetClientData(self):
""""""
pass
def GetControl(self):
""""""
pass
def GetDisabledBitmap(self):
""""""
pass
def GetId(self):
""""""
pass
def GetKind(self):
""""""
pass
def GetLabel(self):
""""""
pass
def GetLongHelp(self):
""""""
pass
def GetNormalBitmap(self):
""""""
pass
def GetShortHelp(self):
""""""
pass
def GetStyle(self):
""""""
pass
def GetToolBar(self):
""""""
pass
def IsButton(self):
""""""
pass
def IsControl(self):
""""""
pass
def IsEnabled(self):
""""""
pass
def IsSeparator(self):
""""""
pass
def IsToggled(self):
""""""
pass
def SetBitmap1(self):
""""""
pass
def SetBitmap2(self):
""""""
pass
def SetClientData(self):
""""""
pass
def SetDisabledBitmap(self):
""""""
pass
def SetLabel(self):
""""""
pass
def SetLongHelp(self):
""""""
pass
def SetNormalBitmap(self):
""""""
pass
def SetShortHelp(self):
""""""
pass
def SetToggle(self):
""""""
pass
def Toggle(self):
""""""
pass
def __init__(self):
""""""
pass

View File

@@ -0,0 +1,402 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import Object
from Controls import Control
import Parameters as wx
class TreeCtrl(Control):
""""""
def AddRoot(self):
""""""
pass
def AppendItem(self):
""""""
pass
def AssignImageList(self):
""""""
pass
def AssignStateImageList(self):
""""""
pass
def Collapse(self):
""""""
pass
def CollapseAndReset(self):
""""""
pass
def Create(self):
""""""
pass
def Delete(self):
""""""
pass
def DeleteAllItems(self):
""""""
pass
def DeleteChildren(self):
""""""
pass
def EditLabel(self):
""""""
pass
def EnsureVisible(self):
""""""
pass
def Expand(self):
""""""
pass
def GetBoundingRect(self):
""""""
pass
def GetChildrenCount(self):
""""""
pass
def GetCount(self):
""""""
pass
def GetEditControl(self):
""""""
pass
def GetFirstChild(self):
""""""
pass
def GetFirstVisibleItem(self):
""""""
pass
def GetImageList(self):
""""""
pass
def GetIndent(self):
""""""
pass
def GetItemBackgroundColour(self):
""""""
pass
def GetItemData(self):
""""""
pass
def GetItemFont(self):
""""""
pass
def GetItemImage(self):
""""""
pass
def GetItemParent(self):
""""""
pass
def GetItemSelectedImage(self):
""""""
pass
def GetItemText(self):
""""""
pass
def GetItemTextColour(self):
""""""
pass
def GetLastChild(self):
""""""
pass
def GetNextChild(self):
""""""
pass
def GetNextSibling(self):
""""""
pass
def GetNextVisible(self):
""""""
pass
def GetPrevSibling(self):
""""""
pass
def GetPrevVisible(self):
""""""
pass
def GetPyData(self):
""""""
pass
def GetRootItem(self):
""""""
pass
def GetSelection(self):
""""""
pass
def GetSelections(self):
""""""
pass
def GetSpacing(self):
""""""
pass
def GetStateImageList(self):
""""""
pass
def HitTest(self):
""""""
pass
def InsertItem(self):
""""""
pass
def InsertItemBefore(self):
""""""
pass
def IsBold(self):
""""""
pass
def IsExpanded(self):
""""""
pass
def IsSelected(self):
""""""
pass
def IsVisible(self):
""""""
pass
def ItemHasChildren(self):
""""""
pass
def PrependItem(self):
""""""
pass
def ScrollTo(self):
""""""
pass
def SelectItem(self):
""""""
pass
def SetImageList(self):
""""""
pass
def SetIndent(self):
""""""
pass
def SetItemBackgroundColour(self):
""""""
pass
def SetItemBold(self):
""""""
pass
def SetItemData(self):
""""""
pass
def SetItemFont(self):
""""""
pass
def SetItemHasChildren(self):
""""""
pass
def SetItemImage(self):
""""""
pass
def SetItemSelectedImage(self):
""""""
pass
def SetItemText(self):
""""""
pass
def SetItemTextColour(self):
""""""
pass
def SetPyData(self):
""""""
pass
def SetSpacing(self):
""""""
pass
def SetStateImageList(self):
""""""
pass
def SortChildren(self):
""""""
pass
def Toggle(self):
""""""
pass
def Unselect(self):
""""""
pass
def UnselectAll(self):
""""""
pass
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
class TreeItemAttr:
""""""
def GetBackgroundColour(self):
""""""
pass
def GetFont(self):
""""""
pass
def GetTextColour(self):
""""""
pass
def HasBackgroundColour(self):
""""""
pass
def HasFont(self):
""""""
pass
def HasTextColour(self):
""""""
pass
def SetBackgroundColour(self):
""""""
pass
def SetFont(self):
""""""
pass
def SetTextColour(self):
""""""
pass
def __init__(self):
""""""
pass
class TreeItemData(Object):
""""""
def GetData(self):
""""""
pass
def GetId(self):
""""""
pass
def SetData(self):
""""""
pass
def SetId(self):
""""""
pass
def __init__(self):
""""""
pass
class TreeItemId:
""""""
def IsOk(self):
""""""
pass
def Ok(self):
""""""
pass
def __cmp__(self):
""""""
pass
def __del__(self):
""""""
pass
def __init__(self):
""""""
pass

View File

@@ -0,0 +1,56 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import EvtHandler
import Parameters as wx
try:
True
except NameError:
True = 1==1
False = 1==0
class Validator(EvtHandler):
""""""
def __init__(self):
""""""
pass
def Clone(self):
""""""
pass
def GetWindow(self):
""""""
pass
def SetWindow(self, window):
""""""
pass
class PyValidator(Validator):
""""""
def __init__(self):
""""""
pass
def _setCallbackInfo(self, _class, incref=True):
""""""
pass

View File

@@ -0,0 +1,850 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
from Base import EvtHandler
import Parameters as wx
try:
True
except NameError:
True = 1==1
False = 1==0
class Window(EvtHandler):
""""""
def __init__(self, parent, id, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=0, name=wx.PyPanelNameStr):
""""""
pass
def AcceptsFocus(self):
""""""
pass
def AddChild(self, child):
""""""
pass
def CaptureMouse(self):
""""""
pass
def Center(self, direction=wx.BOTH):
""""""
pass
def CenterOnParent(self, direction=wx.BOTH):
""""""
pass
def CenterOnScreen(self, direction=wx.BOTH):
""""""
pass
def Centre(self, direction=wx.BOTH):
""""""
pass
def CentreOnParent(self, direction=wx.BOTH):
""""""
pass
def CentreOnScreen(self, direction=wx.BOTH):
""""""
pass
def Clear(self):
""""""
pass
def ClientToScreen(self, pt):
""""""
pass
def ClientToScreenXY(self, x, y):
""""""
pass
def Close(self, force=False):
""""""
pass
def ConvertDialogPointToPixels(self, pt):
""""""
pass
def ConvertDialogSizeToPixels(self, sz):
""""""
pass
def ConvertPixelPointToDialog(self, pt):
""""""
pass
def ConvertPixelSizeToDialog(self, sz):
""""""
pass
def Create(self, parent, id, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=0, name=wx.PyPanelNameStr):
""""""
pass
def DLG_PNT(self, win, point_or_x, y=None):
""""""
pass
def DLG_SZE(self, win, size_width, height=None):
""""""
pass
def Destroy(self):
""""""
pass
def DestroyChildren(self):
""""""
pass
def DragAcceptFiles(self, accept):
"""Windows only."""
pass
def Enable(self, enable):
""""""
pass
def FindWindowById(self, id):
""""""
pass
def FindWindowByName(self, name):
""""""
pass
def Fit(self):
""""""
pass
def FitInside(self):
""""""
pass
def Freeze(self):
""""""
pass
def GetAcceleratorTable(self):
""""""
pass
def GetAdjustedBestSize(self):
""""""
pass
def GetAutoLayout(self):
""""""
pass
def GetBackgroundColour(self):
""""""
pass
def GetBestSize(self):
""""""
pass
def GetBestVirtualSize(self):
""""""
pass
def GetBorder(self):
""""""
pass
def GetCaret(self):
""""""
pass
def GetCharHeight(self):
""""""
pass
def GetCharWidth(self):
""""""
pass
def GetChildren(self):
""""""
pass
def GetClientAreaOrigin(self):
""""""
pass
def GetClientRect(self):
""""""
pass
def GetClientSize(self):
""""""
pass
def GetClientSizeTuple(self):
""""""
pass
def GetConstraints(self):
""""""
pass
def GetContainingSizer(self):
""""""
pass
def GetCursor(self):
""""""
pass
def GetDefaultItem(self):
""""""
pass
def GetDropTarget(self):
""""""
pass
def GetEventHandler(self):
""""""
pass
def GetFont(self):
""""""
pass
def GetForegroundColour(self):
""""""
pass
def GetFullTextExtent(self):
""""""
pass
def GetGrandParent(self):
""""""
pass
def GetHandle(self):
""""""
pass
def GetHelpText(self):
""""""
pass
def GetId(self):
""""""
pass
def GetLabel(self):
""""""
pass
def GetMaxSize(self):
""""""
pass
def GetName(self):
""""""
pass
def GetParent(self):
""""""
pass
def GetPosition(self):
""""""
pass
def GetPositionTuple(self):
""""""
pass
def GetRect(self):
""""""
pass
def GetScrollPos(self, orientation):
""""""
pass
def GetScrollRange(self, orientation):
""""""
pass
def GetScrollThumb(self, orientation):
""""""
pass
def GetSize(self):
""""""
pass
def GetSizeTuple(self):
""""""
pass
def GetSizer(self):
""""""
pass
def GetTextExtent(self, string):
""""""
pass
def GetTitle(self):
""""""
pass
def GetToolTip(self):
""""""
pass
def GetUpdateRegion(self):
""""""
pass
def GetValidator(self):
""""""
pass
def GetVirtualSize(self):
""""""
pass
def GetVirtualSizeTuple(self):
""""""
pass
def GetWindowStyleFlag(self):
""""""
pass
def HasCapture(self):
""""""
pass
def HasScrollbar(self, orient):
""""""
pass
def Hide(self):
""""""
pass
def HitTest(self, pt):
""""""
pass
def InitDialog(self):
""""""
pass
def IsBeingDeleted(self):
""""""
pass
def IsEnabled(self):
""""""
pass
def IsExposed(self, x, y, w=0, h=0):
""""""
pass
def IsExposedPoint(self, pt):
""""""
pass
def IsExposedRect(self, rect):
""""""
pass
def IsRetained(self):
""""""
pass
def IsShown(self):
""""""
pass
def IsTopLevel(self):
""""""
pass
def Layout(self):
""""""
pass
def LineDown(self):
""""""
pass
def LineUp(self):
""""""
pass
def LoadFromResource(self, parent, resourceName, resourceTable=wx.NULL):
"""Only if USE_WX_RESOURCES."""
pass
def Lower(self):
""""""
pass
def MakeModal(self, flag=True):
""""""
pass
def Move(self, point, flags=wx.SIZE_USE_EXISTING):
""""""
pass
def MoveXY(self, x, y, flags=wx.SIZE_USE_EXISTING):
""""""
pass
def OnPaint(self, event):
"""Windows only."""
pass
def PageDown(self):
""""""
pass
def PageUp(self):
""""""
pass
def PopEventHandler(self, deleteHandler=False):
""""""
pass
def PopupMenu(self, menu, pos):
""""""
pass
def PopupMenuXY(self, menu, x, y):
""""""
pass
def PushEventHandler(self, handler):
""""""
pass
def Raise(self):
""""""
pass
def Refresh(self, eraseBackground=True, rect=wx.NULL):
""""""
pass
def RefreshRect(self, rect):
""""""
pass
def ReleaseMouse(self):
""""""
pass
def RemoveChild(self, child):
""""""
pass
def RemoveEventHandler(self, handler):
""""""
pass
def Reparent(self, newParent):
""""""
pass
def ScreenToClient(self, pt):
""""""
pass
def ScreenToClientXY(self, x, y):
""""""
pass
def ScrollLines(self, lines):
""""""
pass
def ScrollPages(self, pages):
""""""
pass
def ScrollWindow(self, dx, dy, rect=wx.NULL):
""""""
pass
def SetAcceleratorTable(self, accel):
""""""
pass
def SetAutoLayout(self, autoLayout):
""""""
pass
def SetBackgroundColour(self, colour):
""""""
pass
def SetCaret(self, caret):
""""""
pass
def SetClientSize(self, size):
""""""
pass
def SetClientSizeWH(self, width, height):
""""""
pass
def SetConstraints(self, constraints):
""""""
pass
def SetContainingSizer(self, sizer):
""""""
pass
def SetCursor(self, cursor):
""""""
pass
def SetDefaultItem(self, btn):
""""""
pass
def SetDimensions(self):
""""""
pass
def SetDropTarget(self, target):
""""""
pass
def SetEventHandler(self, handler):
""""""
pass
def SetExtraStyle(self, exStyle):
""""""
pass
def SetFocus(self):
""""""
pass
def SetFocusFromKbd(self):
""""""
pass
def SetFont(self, font):
""""""
pass
def SetForegroundColour(self, colour):
""""""
pass
def SetHelpText(self, helpText):
""""""
pass
def SetHelpTextForId(self, text):
""""""
pass
def SetId(self, id):
""""""
pass
def SetLabel(self, label):
""""""
pass
def SetName(self, name):
""""""
pass
def SetPosition(self, pos, flags=wx.SIZE_USE_EXISTING):
""""""
pass
def SetRect(self, rect, sizeFlags=wx.SIZE_AUTO):
""""""
pass
def SetScrollPos(self, orientation, pos, refresh=True):
""""""
pass
def SetScrollbar(self, orientation, pos, thumbSize, range, refresh=True):
""""""
pass
def SetSize(self, x, y, width, height, sizeFlags=wx.SIZE_AUTO):
""""""
pass
def SetSizeHints(self, minW, minH, maxW=-1, maxH=-1, incW=-1, incH=-1):
""""""
pass
def SetSizer(self, sizer, deleteOld=True):
""""""
pass
def SetSizerAndFit(self, sizer, deleteOld=True):
""""""
pass
def SetTitle(self, title):
""""""
pass
def SetTmpDefaultItem(self, win):
""""""
pass
def SetToolTip(self, tooltip):
""""""
pass
def SetToolTipString(self, tip):
""""""
pass
def SetValidator(self, validator):
""""""
pass
def SetVirtualSize(self, size):
""""""
pass
def SetVirtualSizeHints(self, minW, minH, maxW=-1, maxH=-1):
""""""
pass
def SetVirtualSizeWH(self, x, y):
""""""
pass
def SetWindowStyle(self, style):
""""""
pass
def SetWindowStyleFlag(self, style):
""""""
pass
def Show(self, show=True):
""""""
pass
def Thaw(self):
""""""
pass
def TransferDataFromWindow(self):
""""""
pass
def TransferDataToWindow(self):
""""""
pass
def UnsetConstraints(self, constraints):
""""""
pass
def Update(self):
""""""
pass
def UpdateWindowUI(self):
""""""
pass
def Validate(self):
""""""
pass
def WarpPointer(self, x, y):
""""""
pass
class PyWindow(Window):
""""""
def __init__(self):
""""""
pass
def _setCallbackInfo(self):
""""""
pass
def base_AcceptsFocus(self):
""""""
pass
def base_AcceptsFocusFromKeyboard(self):
""""""
pass
def base_AddChild(self):
""""""
pass
def base_DoGetBestSize(self):
""""""
pass
def base_DoGetClientSize(self):
""""""
pass
def base_DoGetPosition(self):
""""""
pass
def base_DoGetSize(self):
""""""
pass
def base_DoGetVirtualSize(self):
""""""
pass
def base_DoMoveWindow(self):
""""""
pass
def base_DoSetClientSize(self):
""""""
pass
def base_DoSetSize(self):
""""""
pass
def base_DoSetVirtualSize(self):
""""""
pass
def base_GetMaxSize(self):
""""""
pass
def base_InitDialog(self):
""""""
pass
def base_RemoveChild(self):
""""""
pass
def base_TransferDataFromWindow(self):
""""""
pass
def base_TransferDataToWindow(self):
""""""
pass
def base_Validate(self):
""""""
pass
class TopLevelWindow(Window):
""""""
def Create(self):
""""""
pass
def GetIcon(self):
""""""
pass
def GetTitle(self):
""""""
pass
def Iconize(self):
""""""
pass
def IsFullScreen(self):
""""""
pass
def IsIconized(self):
""""""
pass
def IsMaximized(self):
""""""
pass
def Maximize(self):
""""""
pass
def Restore(self):
""""""
pass
def SetIcon(self):
""""""
pass
def SetIcons(self):
""""""
pass
def SetTitle(self):
""""""
pass
def ShowFullScreen(self):
""""""
pass
def __init__(self):
""""""
pass

View File

@@ -0,0 +1 @@
# Orbtech python package.

View File

@@ -0,0 +1,17 @@
"""Decorator utility for documentation and shell scripting.
When you import stc from this module, all of the classes get decorated
with docstrings from our decoration class definitions.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
from wxPython import stc
import stc_
import decorator
decorator.decorate(real=stc, decoration=stc_)

View File

@@ -0,0 +1,17 @@
"""Decorator utility for documentation and shell scripting.
When you import wx from this module, all of the classes get decorated
with docstrings from our decoration class definitions.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
from wxPython import wx
import wx_
import decorator
decorator.decorate(real=wx, decoration=wx_)

View File

@@ -0,0 +1,92 @@
"""Decorator utility for documentation and shell scripting."""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
import inspect
try:
True
except NameError:
True = 1==1
False = 1==0
def decorate(real, decoration):
"""Decorate real module with docstrings from decoration module."""
realdict = real.__dict__
for item in decoration.__dict__.values():
if inspect.isclass(item):
decorateClass(item, realdict)
elif inspect.isfunction(item):
decorateFunction(item, realdict)
def decorateClass(item, realdict):
classname = item.__name__
if not classname.startswith('wx'):
classname = 'wx' + classname
try:
wxclass = realdict[classname]
except:
print classname
else:
if item.__doc__:
wxclass.__doc__ = item.__doc__
# Get attributes from only the item's local dictionary!
for attrname, attr in item.__dict__.items():
# If the attribute has a docstring, and the wx class has a
# matching attribute.
if hasattr(attr, '__doc__') and hasattr(wxclass, attrname):
if inspect.isfunction(attr):
# Class methods are functions.
doc = getdoc(attr, drop=True)
# Is getattr() okay, or do we want to only look in
# the wxclass.__dict__ and wxclassPtr.__dict__?
wxattr = getattr(wxclass, attrname)
# Our class code may be defined incorrectly, and
# the wxattr may not actually be a class method,
# but that's okay because the following attempt
# will simply fail.
try:
func = wxattr.im_func
func.__doc__ = doc
except:
pass
def decorateFunction(item, realdict):
funcname = item.__name__
if funcname in realdict.keys():
func = realdict[funcname]
doc = getdoc(item, drop=False)
try:
# Built-in functions have a read-only docstring. :-(
func.__doc__ = doc
except:
# print funcname
pass
def getdoc(attr, drop=False):
"""Return a docstring for attr, which should be a method."""
doc = ''
if attr.__doc__:
doc = inspect.getdoc(attr).strip()
name = attr.__name__
# tip is a string with name(argspec), like: "SetLabel(label)"
tip = ''
argspec = apply(inspect.formatargspec, inspect.getargspec(attr))
# The first parameter to a method is a reference to an instance,
# usually coded as "self", and is usually passed automatically by
# Python and therefore we want to drop it.
temp = argspec.split(',')
if len(temp) == 1: # No other arguments.
argspec = '()'
elif drop: # Drop the first argument.
argspec = '(' + ','.join(temp[1:]).lstrip()
else:
argspec = ','.join(temp).lstrip()
tip = name + argspec
firstline = doc.split('\n')[0].lstrip()
if tip != firstline:
doc = '%s\n\n%s' % (tip, doc)
return doc

View File

@@ -0,0 +1,71 @@
import inspect
from wxPython import wx
def scan():
d = wx.__dict__
newd = {}
keys = d.keys()
keys.sort()
for key in keys:
if key.endswith('Ptr'):
# Skip
pass
elif key+'Ptr' in keys:
# Rename
newd[key] = d[key+'Ptr']
else:
# Include as is
newd[key] = d[key]
d = newd
keys = d.keys()
keys.sort()
for key in keys:
value = d[key]
if inspect.isclass(value):
# genClass(value)
pass
elif callable(value):
genFunction(value)
pass
else:
# print type(value), value
pass
def genClass(cls):
sp4 = ' ' * 4
name = cls.__name__
if name.endswith('Ptr'):
name = name[:-3]
## if name != 'wxNotebook':
## return
parent = ''
if cls.__bases__:
parent = cls.__bases__[0].__name__
if parent.endswith('Ptr'):
parent = parent[:-3]
parent = '(%s)' % parent
items = cls.__dict__.keys()
items.sort()
print
print 'class %s%s:' % (name, parent)
print sp4 + '""""""'
print
for item in items:
attr = cls.__dict__[item]
if inspect.isfunction(attr):
print sp4 + 'def ' + item + '(self):'
print sp4 + sp4 + '""""""'
print sp4 + sp4 + 'pass'
print
def genFunction(func):
sp4 = ' ' * 4
name = func.__name__
print 'def %s():' % name
print sp4 + '""""""'
print sp4 + 'pass'
print

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,62 @@
"""Decorator classes for documentation and shell scripting.
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
__cvsid__ = "$Id$"
__revision__ = "$Revision$"[11:-2]
# These are not the real wxPython classes. These are Python versions
# for documentation purposes. They are also used to apply docstrings
# to the real wxPython classes, which are SWIG-generated wrappers for
# C-language classes.
_topics = {
'Accelerators': None,
'App': None,
'Base': None,
'ClipDragDrop': None,
'Config': None,
'Controls': None,
'DataStructures': None,
'DateTime': None,
'Dialogs': None,
'Drawing': None,
'Errors': None,
'EventFunctions': None,
'Events': None,
'FileSystem': None,
'Frames': None,
'Functions': None,
'Help': None,
'ImageHandlers': None,
'Joystick': None,
'LayoutConstraints': None,
'Logging': None,
'Menus': None,
'MimeTypes': None,
'Misc': None,
'Panel': None,
'Printing': None,
'Process': None,
'SashSplitter': None,
'Sizers': None,
'Streams': None,
'Threading': None,
'ToolBar': None,
'Tree': None,
'Validators': None,
'Window': None,
}
for topic in _topics.keys():
_topics[topic] = __import__(topic, globals())
exec 'from %s import *' % topic
del topic # Cleanup the namespace.
try:
del wx # Cleanup any module that imports Parameters as wx.
except:
pass

View File

@@ -21,7 +21,7 @@ getwxPythonImage
PythonBitmaps
--This takes a single argument. If it tests true,
--This takes a single argument. If it tests True,
getPythonPoweredBitmap() is returned, else getwxPythonBitmap() is
returned.

View File

@@ -28,13 +28,15 @@ wxGenBitmapToggleButton the same but with bitmaps.
"""
from wxPython.wx import *
import imageutils
#----------------------------------------------------------------------
class wxGenButtonEvent(wxPyCommandEvent):
def __init__(self, eventType, ID):
wxPyCommandEvent.__init__(self, eventType, ID)
self.isDown = false
self.isDown = False
self.theButton = None
def SetIsDown(self, isDown):
@@ -63,10 +65,10 @@ class wxGenButton(wxPyControl):
style = wxNO_BORDER
wxPyControl.__init__(self, parent, ID, pos, size, style, validator, name)
self.up = true
self.up = True
self.bezelWidth = 2
self.hasFocus = false
self.useFocusInd = true
self.hasFocus = False
self.useFocusInd = True
self.SetLabel(label)
self.SetPosition(pos)
@@ -131,6 +133,11 @@ class wxGenButton(wxPyControl):
return self.IsShown() and self.IsEnabled()
def Enable(self, enable=True):
wxPyControl.Enable(self, enable)
self.Refresh()
def SetBezelWidth(self, width):
"""Set the width of the 3D effect"""
self.bezelWidth = width
@@ -187,7 +194,7 @@ class wxGenButton(wxPyControl):
def _GetLabelSize(self):
""" used internally """
w, h = self.GetTextExtent(self.GetLabel())
return w, h, true
return w, h, True
def Notify(self):
@@ -270,7 +277,7 @@ class wxGenButton(wxPyControl):
def OnLeftDown(self, event):
if not self.IsEnabled():
return
self.up = false
self.up = False
self.CaptureMouse()
self.SetFocus()
self.Refresh()
@@ -278,35 +285,36 @@ class wxGenButton(wxPyControl):
def OnLeftUp(self, event):
if not self.IsEnabled():
if not self.IsEnabled() or not self.HasCapture():
return
self.ReleaseMouse()
if not self.up: # if the button was down when the mouse was released...
self.Notify()
self.up = true
self.Refresh()
event.Skip()
if self.HasCapture():
self.ReleaseMouse()
if not self.up: # if the button was down when the mouse was released...
self.Notify()
self.up = True
self.Refresh()
event.Skip()
def OnMotion(self, event):
if not self.IsEnabled():
if not self.IsEnabled() or not self.HasCapture():
return
if event.LeftIsDown():
if event.LeftIsDown() and self.HasCapture():
x,y = event.GetPositionTuple()
w,h = self.GetClientSizeTuple()
if self.up and x<w and x>=0 and y<h and y>=0:
self.up = false
self.up = False
self.Refresh()
return
if not self.up and (x<0 or y<0 or x>=w or y>=h):
self.up = true
self.up = True
self.Refresh()
return
event.Skip()
def OnGainFocus(self, event):
self.hasFocus = true
self.hasFocus = True
dc = wxClientDC(self)
w, h = self.GetClientSizeTuple()
if self.useFocusInd:
@@ -314,7 +322,7 @@ class wxGenButton(wxPyControl):
def OnLoseFocus(self, event):
self.hasFocus = false
self.hasFocus = False
dc = wxClientDC(self)
w, h = self.GetClientSizeTuple()
if self.useFocusInd:
@@ -323,14 +331,14 @@ class wxGenButton(wxPyControl):
def OnKeyDown(self, event):
if self.hasFocus and event.KeyCode() == ord(" "):
self.up = false
self.up = False
self.Refresh()
event.Skip()
def OnKeyUp(self, event):
if self.hasFocus and event.KeyCode() == ord(" "):
self.up = true
self.up = True
self.Notify()
self.Refresh()
event.Skip()
@@ -343,10 +351,10 @@ class wxGenBitmapButton(wxGenButton):
pos = wxDefaultPosition, size = wxDefaultSize,
style = 0, validator = wxDefaultValidator,
name = "genbutton"):
self.bmpLabel = bitmap
self.bmpDisabled = None
self.bmpFocus = None
self.bmpSelected = None
self.SetBitmapLabel(bitmap)
wxGenButton.__init__(self, parent, ID, "", pos, size, style, validator, name)
@@ -367,22 +375,32 @@ class wxGenBitmapButton(wxGenButton):
def SetBitmapFocus(self, bitmap):
"""Set bitmap to display when the button has the focus"""
self.bmpFocus = bitmap
self.SetUseFocusIndicator(false)
self.SetUseFocusIndicator(False)
def SetBitmapSelected(self, bitmap):
"""Set bitmap to display when the button is selected (pressed down)"""
self.bmpSelected = bitmap
def SetBitmapLabel(self, bitmap):
"""Set the bitmap to display normally. This is the only one that is required."""
def SetBitmapLabel(self, bitmap, createOthers=True):
"""
Set the bitmap to display normally.
This is the only one that is required. If
createOthers is True, then the other bitmaps
will be generated on the fly. Currently,
only the disabled bitmap is generated.
"""
self.bmpLabel = bitmap
if bitmap is not None and createOthers:
image = wxImageFromBitmap(bitmap)
imageutils.grayOut(image)
self.SetBitmapDisabled(wxBitmapFromImage(image))
def _GetLabelSize(self):
""" used internally """
if not self.bmpLabel:
return -1, -1, false
return self.bmpLabel.GetWidth()+2, self.bmpLabel.GetHeight()+2, false
return -1, -1, False
return self.bmpLabel.GetWidth()+2, self.bmpLabel.GetHeight()+2, False
def DrawLabel(self, dc, width, height, dw=0, dy=0):
bmp = self.bmpLabel
@@ -415,7 +433,7 @@ class wxGenBitmapTextButton(wxGenBitmapButton): # generic bitmapped button w
""" used internally """
w, h = self.GetTextExtent(self.GetLabel())
if not self.bmpLabel:
return w, h, true # if there isn't a bitmap use the size of the text
return w, h, True # if there isn't a bitmap use the size of the text
w_bmp = self.bmpLabel.GetWidth()+2
h_bmp = self.bmpLabel.GetHeight()+2
@@ -424,7 +442,7 @@ class wxGenBitmapTextButton(wxGenBitmapButton): # generic bitmapped button w
height = h_bmp
else:
height = h
return width, height, true
return width, height, True
def DrawLabel(self, dc, width, height, dw=0, dy=0):
@@ -456,10 +474,10 @@ class wxGenBitmapTextButton(wxGenBitmapButton): # generic bitmapped button w
pos_x = (width-bw-tw)/2+dw # adjust for bitmap and text to centre
if bmp !=None:
dc.DrawBitmap(bmp, pos_x, (height-bh)/2+dy, hasMask) # draw bitmap if available
dc.DrawBitmap(bmp, pos_x, (height-bh)/2+dy, hasMask) # draw bitmap if available
pos_x = pos_x + 2 # extra spacing from bitmap
dc.DrawText(label, pos_x + dw+bw, (height-th)/2+dy) # draw the text
dc.DrawText(label, pos_x + dw+bw, (height-th)/2+dy) # draw the text
#----------------------------------------------------------------------
@@ -468,9 +486,12 @@ class wxGenBitmapTextButton(wxGenBitmapButton): # generic bitmapped button w
class __ToggleMixin:
def SetToggle(self, flag):
self.up = not flag
self.Refresh()
SetValue = SetToggle
def GetToggle(self):
return not self.up
GetValue = GetToggle
def OnLeftDown(self, event):
if not self.IsEnabled():
@@ -482,16 +503,33 @@ class __ToggleMixin:
self.Refresh()
def OnLeftUp(self, event):
if not self.IsEnabled():
if not self.IsEnabled() or not self.HasCapture():
return
if self.up != self.saveUp:
self.Notify()
self.ReleaseMouse()
self.Refresh()
if self.HasCapture():
if self.up != self.saveUp:
self.Notify()
self.ReleaseMouse()
self.Refresh()
def OnKeyDown(self, event):
event.Skip()
def OnMotion(self, event):
if not self.IsEnabled():
return
if event.LeftIsDown() and self.HasCapture():
x,y = event.GetPositionTuple()
w,h = self.GetClientSizeTuple()
if x<w and x>=0 and y<h and y>=0:
self.up = not self.saveUp
self.Refresh()
return
if (x<0 or y<0 or x>=w or y>=h):
self.up = self.saveUp
self.Refresh()
return
event.Skip()
def OnKeyUp(self, event):
if self.hasFocus and event.KeyCode() == ord(" "):
self.up = not self.up

View File

@@ -13,7 +13,6 @@
from wxPython.wx import *
from CDate import *
import string, time
CalDays = [6, 0, 1, 2, 3, 4, 5]
@@ -44,7 +43,7 @@ class CalDraw:
self.DefParms()
def DefParms(self):
self.num_auto = TRUE # auto scale of the cal number day size
self.num_auto = True # auto scale of the cal number day size
self.num_size = 12 # default size of calendar if no auto size
self.max_num_size = 12 # maximum size for calendar number
@@ -53,7 +52,7 @@ class CalDraw:
self.num_indent_horz = 0 # points indent from position, used to offset if not centered
self.num_indent_vert = 0
self.week_auto = TRUE # auto scale of week font text
self.week_auto = True # auto scale of week font text
self.week_size = 10
self.max_week_size = 12
@@ -71,13 +70,13 @@ class CalDraw:
self.font = wxSWISS
self.bold = wxNORMAL
self.hide_title = FALSE
self.hide_grid = FALSE
self.outer_border = TRUE
self.hide_title = False
self.hide_grid = False
self.outer_border = True
self.title_offset = 0
self.cal_week_scale = 0.7
self.show_weekend = FALSE
self.show_weekend = False
self.cal_type = "NORMAL"
def SetWeekColor(self, font_color, week_color): # set font and background color for week title
@@ -123,7 +122,7 @@ class CalDraw:
self.InitScale()
self.DrawBorder()
if self.hide_title is FALSE:
if self.hide_title is False:
self.DrawMonth()
self.Center()
@@ -131,7 +130,7 @@ class CalDraw:
self.DrawGrid()
self.GetRect()
if self.show_weekend is TRUE: # highlight weekend dates
if self.show_weekend is True: # highlight weekend dates
self.SetWeekEnd()
self.AddSelect(sel_lst) # overrides the weekend highlight
@@ -154,7 +153,7 @@ class CalDraw:
self.DC.SetBrush(brush)
self.DC.SetPen(wxPen(wxNamedColour(self.border_color), 1))
if self.outer_border is TRUE:
if self.outer_border is True:
rect = wxRect(self.cx_st, self.cy_st, self.sizew, self.sizeh) # full display window area
self.DC.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
@@ -245,7 +244,7 @@ class CalDraw:
rect_w = self.gridx[7]-self.gridx[0]
f = wxFont(10, self.font, wxNORMAL, self.bold) # initial font setting
if self.week_auto == TRUE:
if self.week_auto == True:
test_size = self.max_week_size # max size
test_day = ' Sun '
while test_size > 2:
@@ -289,7 +288,7 @@ class CalDraw:
def DrawNum(self): # draw the day numbers
f = wxFont(10, self.font, wxNORMAL, self.bold) # initial font setting
if self.num_auto == TRUE:
if self.num_auto == True:
test_size = self.max_num_size # max size
test_day = ' 99 '
while test_size > 2:
@@ -362,7 +361,7 @@ class CalDraw:
brush = wxBrush(wxNamedColour(sel_color), wxSOLID)
self.DC.SetBrush(brush)
if self.hide_grid is FALSE:
if self.hide_grid is False:
self.DC.SetPen(wxPen(wxNamedColour(self.grid_color), 0))
else:
self.DC.SetPen(wxPen(wxNamedColour(self.back_color), 0))
@@ -384,7 +383,7 @@ class CalDraw:
y2 = y1 + self.cheight
for i in range(8):
if self.hide_grid is FALSE:
if self.hide_grid is False:
self.DC.DrawLine(x1, y1, x1, y2)
self.gridx.append(x1)
x1 = x1 + self.dl_w
@@ -394,7 +393,7 @@ class CalDraw:
x2 = x1 + self.cwidth
for i in range(8):
if self.hide_grid is FALSE:
if self.hide_grid is False:
self.DC.DrawLine(x1, y1, x2, y1)
self.gridy.append(y1)
if i == 0:
@@ -429,10 +428,10 @@ class wxCalendar(wxWindow):
self.grid_color = 'BLACK'
self.back_color = 'WHITE'
self.hide_grid = FALSE
self.hide_grid = False
self.sel_color = 'RED'
self.hide_title = FALSE
self.show_weekend = FALSE
self.hide_title = False
self.show_weekend = False
self.cal_type = "NORMAL"
self.week_color = 'LIGHT GREY'
@@ -460,10 +459,10 @@ class wxCalendar(wxWindow):
# control some of the main calendar attributes
def HideTitle(self):
self.hide_title = TRUE
self.hide_title = True
def HideGrid(self):
self.hide_grid = TRUE
self.hide_grid = True
# determine the calendar rectangle click area and draw a selection
@@ -606,13 +605,13 @@ class wxCalendar(wxWindow):
self.select_list.append(list_val)
def ShowWeekEnd(self):
self.show_weekend = TRUE # highlight weekend
self.show_weekend = True # highlight weekend
def SetBusType(self):
self.cal_type = "BUS"
def OnSize(self, evt):
self.Refresh(false)
self.Refresh(False)
evt.Skip()
def OnPaint(self, event):
@@ -685,7 +684,7 @@ class wxCalendar(wxWindow):
def SelectDay(self, key):
sel_size = 1
self.DrawRect(self.sel_key, self.back_color, sel_size) # clear large selection
if self.hide_grid is FALSE:
if self.hide_grid is False:
self.DrawRect(self.sel_key, self.grid_color)
self.DrawRect(key, self.sel_color, sel_size)

View File

@@ -0,0 +1,26 @@
"""
wxPyColourChooser
Copyright (C) 2002 Michael Gilfix <mgilfix@eecs.tufts.edu>
This file is part of wxPyColourChooser.
This version of wxPyColourChooser is open source; you can redistribute it
and/or modify it under the licensed terms.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
"""
from pycolourchooser import *
# For the American in you
wxPyColorChooser = wxPyColourChooser
__all__ = [
'canvas',
'pycolourbox',
'pycolourchooser',
'pycolourslider',
'pypalette',
]

View File

@@ -0,0 +1,120 @@
"""
wxPyColourChooser
Copyright (C) 2002 Michael Gilfix <mgilfix@eecs.tufts.edu>
This file is part of wxPyColourChooser.
This version of wxPyColourChooser is open source; you can redistribute it
and/or modify it under the licensed terms.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
"""
from wxPython.wx import *
class BitmapBuffer(wxMemoryDC):
"""A screen buffer class.
This class implements a screen output buffer. Data is meant to
be drawn in the buffer class and then blitted directly to the
output device, or on-screen window.
"""
def __init__(self, width, height, colour):
"""Initialize the empty buffer object."""
wxMemoryDC.__init__(self)
self.width = width
self.height = height
self.colour = colour
self.bitmap = wxEmptyBitmap(self.width, self.height)
self.SelectObject(self.bitmap)
# Initialize the buffer to the background colour
self.SetBackground(wxBrush(self.colour, wxSOLID))
self.Clear()
# Make each logical unit of the buffer equal to 1 pixel
self.SetMapMode(wxMM_TEXT)
def GetBitmap(self):
"""Returns the internal bitmap for direct drawing."""
return self.bitmap
class Canvas(wxWindow):
"""A canvas class for arbitrary drawing.
The Canvas class implements a window that allows for drawing
arbitrary graphics. It implements a double buffer scheme and
blits the off-screen buffer to the window during paint calls
by the windowing system for speed.
Some other methods for determining the canvas colour and size
are also provided.
"""
def __init__(self, parent, id,
pos=wxDefaultPosition,
size=wxDefaultSize,
style=wxSIMPLE_BORDER):
"""Creates a canvas instance and initializes the off-screen
buffer. Also sets the handler for rendering the canvas
automatically via size and paint calls from the windowing
system."""
wxWindow.__init__(self, parent, id, pos, size, style)
# Perform an intial sizing
self.ReDraw()
# Register event handlers
EVT_SIZE(self, self.onSize)
EVT_PAINT(self, self.onPaint)
def MakeNewBuffer(self):
size = self.GetSizeTuple()
self.buffer = BitmapBuffer(size[0], size[1],
self.GetBackgroundColour())
def onSize(self, event):
"""Perform actual redraw to off-screen buffer only when the
size of the canvas has changed. This saves a lot of computation
since the same image can be re-used, provided the canvas size
hasn't changed."""
self.MakeNewBuffer()
self.DrawBuffer()
self.Refresh()
def ReDraw(self):
"""Explicitly tells the canvas to redraw it's contents."""
self.onSize(None)
def Refresh(self):
"""Re-draws the buffer contents on-screen."""
dc = wxClientDC(self)
self.Blit(dc)
def onPaint(self, event):
"""Renders the off-screen buffer on-screen."""
dc = wxPaintDC(self)
self.Blit(dc)
def Blit(self, dc):
"""Performs the blit of the buffer contents on-screen."""
width, height = self.buffer.GetSize()
dc.BeginDrawing()
dc.Blit(0, 0, width, height, self.buffer, 0, 0)
dc.EndDrawing()
def GetBoundingRect(self):
"""Returns a tuple that contains the co-ordinates of the
top-left and bottom-right corners of the canvas."""
x, y = self.GetPositionTuple()
w, h = self.GetSize()
return(x, y + h, x + w, y)
def DrawBuffer(self):
"""Actual drawing function for drawing into the off-screen
buffer. To be overrideen in the implementing class. Do nothing
by default."""
pass

View File

@@ -0,0 +1,24 @@
"""
wxPyColourChooser
Copyright (C) 2002 Michael Gilfix <mgilfix@eecs.tufts.edu>
This file is part of wxPyColourChooser.
This version of wxPyColourChooser is open source; you can redistribute it
and/or modify it under the licensed terms.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
"""
try:
import gettext
gettext.bindtextdomain('wxpycolourchooser')
gettext.textdomain('wxpycolourchooser')
_ = gettext.gettext
except Exception, strerror:
print "Warning: Couldn't import translation function: %(str)s" %{ 'str' : strerror }
print "Defaulting to En"
_ = lambda x: x

View File

@@ -0,0 +1,79 @@
"""
wxPyColourChooser
Copyright (C) 2002 Michael Gilfix <mgilfix@eecs.tufts.edu>
This file is part of wxPyColourChooser.
This version of wxPyColourChooser is open source; you can redistribute it
and/or modify it under the licensed terms.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
"""
from wxPython.wx import *
class PyColourBox(wxPanel):
"""A Colour Selection Box
The Colour selection box implements button like behavior but contains
a solid-filled, coloured sub-box. Placing the colour in a sub-box allows
for filling in the main panel's background for a high-lighting effect.
"""
def __init__(self, parent, id, colour=(0, 0, 0), size=(25, 20)):
"""Creates a new colour box instance and initializes the colour
content."""
wxPanel.__init__(self, parent, id,
size=wxSize(size[0], size[1]))
self.colour_box = wxPanel(self, -1, style=wxSIMPLE_BORDER)
sizer = wxGridSizer(1, 1)
sizer.Add(self.colour_box, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL)
sizer.SetItemMinSize(self.colour_box, size[0] - 5, size[1] - 5)
self.SetAutoLayout(True)
self.SetSizer(sizer)
self.Layout()
self.real_bg = self.GetBackgroundColour()
self.SetColourTuple(colour)
def GetColourBox(self):
"""Returns a reference to the internal box object containing the
color. This function is useful for setting up event handlers for
the box."""
return self.colour_box
def GetColour(self):
"""Returns a wxColour object indicating the box's current colour."""
return self.colour_box.GetBackgroundColour()
def SetColour(self, colour):
"""Accepts a wxColour object and sets the box's current color."""
self.colour_box.SetBackgroundColour(colour)
self.colour_box.Refresh()
def SetColourTuple(self, colour):
"""Sets the box's current couple to the given tuple."""
self.colour = colour
self.colour_box.SetBackgroundColour(apply(wxColour, self.colour))
def Update(self):
wxPanel.Update(self)
self.colour_box.Update()
def SetHighlight(self, val):
"""Accepts a boolean 'val' toggling the box's highlighting."""
# XXX This code has been disabled for now until I can figure out
# how to get this to work reliably across all platforms.
if val:
#A wxColourPtr is returned in windows, making this difficult
red =(self.real_bg.Red() - 45) % 255
green =(self.real_bg.Green() - 45) % 255
blue =(self.real_bg.Blue() - 45) % 255
new_colour = wxColour(red, green, blue)
self.SetBackgroundColour(new_colour)
else:
self.SetBackgroundColour(self.real_bg)
self.Refresh()

View File

@@ -0,0 +1,385 @@
"""
wxPyColourChooser
Copyright (C) 2002 Michael Gilfix <mgilfix@eecs.tufts.edu>
This file is part of wxPyColourChooser.
This version of wxPyColourChooser is open source; you can redistribute it
and/or modify it under the licensed terms.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
"""
import pycolourbox
import pypalette
import pycolourslider
import colorsys
from intl import _
from wxPython.wx import *
class wxPyColourChooser(wxPanel):
"""A Pure-Python implementation of the colour chooser dialog.
The PyColourChooser is a pure python implementation of the colour
chooser dialog. It's useful for embedding the colour choosing functionality
inside other widgets, when the pop-up dialog is undesirable. It can also
be used as a drop-in replacement on the GTK platform, as the native
dialog is kind of ugly.
"""
colour_names = [
'ORANGE',
'GOLDENROD',
'WHEAT',
'SPRING GREEN',
'SKY BLUE',
'SLATE BLUE',
'MEDIUM VIOLET RED',
'PURPLE',
'RED',
'YELLOW',
'MEDIUM SPRING GREEN',
'PALE GREEN',
'CYAN',
'LIGHT STEEL BLUE',
'ORCHID',
'LIGHT MAGENTA',
'BROWN',
'YELLOW',
'GREEN',
'CADET BLUE',
'MEDIUM BLUE',
'MAGENTA',
'MAROON',
'ORANGE RED',
'FIREBRICK',
'CORAL',
'FOREST GREEN',
'AQUAMARINE',
'BLUE',
'NAVY',
'THISTLE',
'MEDIUM VIOLET RED',
'INDIAN RED',
'GOLD',
'MEDIUM SEA GREEN',
'MEDIUM BLUE',
'MIDNIGHT BLUE',
'GREY',
'PURPLE',
'KHAKI',
'BLACK',
'MEDIUM FOREST GREEN',
'KHAKI',
'DARK GREY',
'SEA GREEN',
'LIGHT GREY',
'MEDIUM SLATE BLUE',
'WHITE',
]
# Generate the custom colours. These colours are shared across
# all instances of the colour chooser
NO_CUSTOM_COLOURS = 16
custom_colours = [ (wxColour(255, 255, 255),
pycolourslider.PyColourSlider.HEIGHT / 2)
] * NO_CUSTOM_COLOURS
last_custom = 0
idADD_CUSTOM = wxNewId()
idSCROLL = wxNewId()
def __init__(self, parent, id):
"""Creates an instance of the colour chooser. Note that it is best to
accept the given size of the colour chooser as it is currently not
resizeable."""
wxPanel.__init__(self, parent, id)
self.basic_label = wxStaticText(self, -1, _("Basic Colours:"))
self.custom_label = wxStaticText(self, -1, _("Custom Colours:"))
self.add_button = wxButton(self, self.idADD_CUSTOM, _("Add to Custom Colours"))
EVT_BUTTON(self, self.idADD_CUSTOM, self.onAddCustom)
# Since we're going to be constructing widgets that require some serious
# computation, let's process any events (like redraws) right now
wxYield()
# Create the basic colours palette
self.colour_boxs = [ ]
colour_grid = wxGridSizer(6, 8)
for name in self.colour_names:
new_id = wxNewId()
box = pycolourbox.PyColourBox(self, new_id)
EVT_LEFT_DOWN(box.GetColourBox(), lambda x, b=box: self.onBasicClick(x, b))
self.colour_boxs.append(box)
colour_grid.Add(box, 0, wxEXPAND)
# Create the custom colours palette
self.custom_boxs = [ ]
custom_grid = wxGridSizer(2, 8)
for wxcolour, slidepos in self.custom_colours:
new_id = wxNewId()
custom = pycolourbox.PyColourBox(self, new_id)
EVT_LEFT_DOWN(custom.GetColourBox(), lambda x, b=custom: self.onCustomClick(x, b))
custom.SetColour(wxcolour)
custom_grid.Add(custom, 0, wxEXPAND)
self.custom_boxs.append(custom)
csizer = wxBoxSizer(wxVERTICAL)
csizer.Add(1, 25)
csizer.Add(self.basic_label, 0, wxEXPAND)
csizer.Add(1, 5)
csizer.Add(colour_grid, 0, wxEXPAND)
csizer.Add(1, 25)
csizer.Add(self.custom_label, 0, wxEXPAND)
csizer.Add(1, 5)
csizer.Add(custom_grid, 0, wxEXPAND)
csizer.Add(1, 5)
csizer.Add(self.add_button, 0, wxEXPAND)
self.palette = pypalette.PyPalette(self, -1)
self.colour_slider = pycolourslider.PyColourSlider(self, -1)
self.slider = wxSlider(self, self.idSCROLL, 86, 0, self.colour_slider.HEIGHT - 1,
style=wxSL_VERTICAL, size=wxSize(15, self.colour_slider.HEIGHT))
EVT_COMMAND_SCROLL(self, self.idSCROLL, self.onScroll)
psizer = wxBoxSizer(wxHORIZONTAL)
psizer.Add(self.palette, 0, 0)
psizer.Add(10, 1)
psizer.Add(self.colour_slider, 0, wxALIGN_CENTER_VERTICAL)
psizer.Add(self.slider, 0, wxALIGN_CENTER_VERTICAL)
# Register mouse events for dragging across the palette
EVT_LEFT_DOWN(self.palette, self.onPaletteDown)
EVT_LEFT_UP(self.palette, self.onPaletteUp)
EVT_MOTION(self.palette, self.onPaletteMotion)
self.mouse_down = False
self.solid = pycolourbox.PyColourBox(self, -1, size=wxSize(75, 50))
slabel = wxStaticText(self, -1, _("Solid Colour"))
ssizer = wxBoxSizer(wxVERTICAL)
ssizer.Add(self.solid, 0, 0)
ssizer.Add(1, 2)
ssizer.Add(slabel, 0, wxALIGN_CENTER_HORIZONTAL)
hlabel = wxStaticText(self, -1, _("H:"))
self.hentry = wxTextCtrl(self, -1)
self.hentry.SetSize((40, -1))
slabel = wxStaticText(self, -1, _("S:"))
self.sentry = wxTextCtrl(self, -1)
self.sentry.SetSize((40, -1))
vlabel = wxStaticText(self, -1, _("V:"))
self.ventry = wxTextCtrl(self, -1)
self.ventry.SetSize((40, -1))
hsvgrid = wxFlexGridSizer(1, 6, 2, 2)
hsvgrid.AddMany ([
(hlabel, 0, wxALIGN_CENTER_VERTICAL), (self.hentry, 0, 0),
(slabel, 0, wxALIGN_CENTER_VERTICAL), (self.sentry, 0, 0),
(vlabel, 0, wxALIGN_CENTER_VERTICAL), (self.ventry, 0, 0),
])
rlabel = wxStaticText(self, -1, _("R:"))
self.rentry = wxTextCtrl(self, -1)
self.rentry.SetSize((40, -1))
glabel = wxStaticText(self, -1, _("G:"))
self.gentry = wxTextCtrl(self, -1)
self.gentry.SetSize((40, -1))
blabel = wxStaticText(self, -1, _("B:"))
self.bentry = wxTextCtrl(self, -1)
self.bentry.SetSize((40, -1))
lgrid = wxFlexGridSizer(1, 6, 2, 2)
lgrid.AddMany([
(rlabel, 0, wxALIGN_CENTER_VERTICAL), (self.rentry, 0, 0),
(glabel, 0, wxALIGN_CENTER_VERTICAL), (self.gentry, 0, 0),
(blabel, 0, wxALIGN_CENTER_VERTICAL), (self.bentry, 0, 0),
])
gsizer = wxGridSizer(2, 1)
gsizer.SetVGap (10)
gsizer.SetHGap (2)
gsizer.Add(hsvgrid, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL)
gsizer.Add(lgrid, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL)
hsizer = wxBoxSizer(wxHORIZONTAL)
hsizer.Add(ssizer, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL)
hsizer.Add(gsizer, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL)
vsizer = wxBoxSizer(wxVERTICAL)
vsizer.Add(1, 5)
vsizer.Add(psizer, 0, 0)
vsizer.Add(1, 15)
vsizer.Add(hsizer, 0, wxEXPAND)
sizer = wxBoxSizer(wxHORIZONTAL)
sizer.Add(5, 1)
sizer.Add(csizer, 0, wxEXPAND)
sizer.Add(10, 1)
sizer.Add(vsizer, 0, wxEXPAND)
self.SetAutoLayout(True)
self.SetSizer(sizer)
sizer.Fit(self)
self.InitColours()
self.UpdateColour(self.solid.GetColour())
def InitColours(self):
"""Initializes the pre-set palette colours."""
for i in range(len(self.colour_names)):
colour = wxTheColourDatabase.FindColour(self.colour_names[i])
self.colour_boxs[i].SetColourTuple((colour.Red(),
colour.Green(),
colour.Blue()))
def onBasicClick(self, event, box):
"""Highlights the selected colour box and updates the solid colour
display and colour slider to reflect the choice."""
if hasattr(self, '_old_custom_highlight'):
self._old_custom_highlight.SetHighlight(False)
if hasattr(self, '_old_colour_highlight'):
self._old_colour_highlight.SetHighlight(False)
box.SetHighlight(True)
self._old_colour_highlight = box
self.UpdateColour(box.GetColour())
def onCustomClick(self, event, box):
"""Highlights the selected custom colour box and updates the solid
colour display and colour slider to reflect the choice."""
if hasattr(self, '_old_colour_highlight'):
self._old_colour_highlight.SetHighlight(False)
if hasattr(self, '_old_custom_highlight'):
self._old_custom_highlight.SetHighlight(False)
box.SetHighlight(True)
self._old_custom_highlight = box
# Update the colour panel and then the slider accordingly
box_index = self.custom_boxs.index(box)
base_colour, slidepos = self.custom_colours[box_index]
self.UpdateColour(box.GetColour())
self.slider.SetValue(slidepos)
def onAddCustom(self, event):
"""Adds a custom colour to the custom colour box set. Boxes are
chosen in a round-robin fashion, eventually overwriting previously
added colours."""
# Store the colour and slider position so we can restore the
# custom colours just as they were
self.setCustomColour(self.last_custom,
self.solid.GetColour(),
self.colour_slider.GetBaseColour(),
self.slider.GetValue())
self.last_custom = (self.last_custom + 1) % self.NO_CUSTOM_COLOURS
def setCustomColour (self, index, true_colour, base_colour, slidepos):
"""Sets the custom colour at the given index. true_colour is wxColour
object containing the actual rgb value of the custom colour.
base_colour (wxColour) and slidepos (int) are used to configure the
colour slider and set everything to its original position."""
self.custom_boxs[index].SetColour(true_colour)
self.custom_colours[index] = (base_colour, slidepos)
def UpdateColour(self, colour):
"""Performs necessary updates for when the colour selection has
changed."""
# Reset the palette to erase any highlighting
self.palette.ReDraw()
# Set the color info
self.solid.SetColour(colour)
self.colour_slider.SetBaseColour(colour)
self.colour_slider.ReDraw()
self.slider.SetValue(0)
self.UpdateEntries(colour)
def UpdateEntries(self, colour):
"""Updates the color levels to display the new values."""
# Temporary bindings
r = colour.Red()
g = colour.Green()
b = colour.Blue()
# Update the RGB entries
self.rentry.SetValue(str(r))
self.gentry.SetValue(str(g))
self.bentry.SetValue(str(b))
# Convert to HSV
h,s,v = colorsys.rgb_to_hsv(r / 255.0, g / 255.0, b / 255.0)
self.hentry.SetValue("%.2f" % (h))
self.sentry.SetValue("%.2f" % (s))
self.ventry.SetValue("%.2f" % (v))
def onPaletteDown(self, event):
"""Stores state that the mouse has been pressed and updates
the selected colour values."""
self.mouse_down = True
self.palette.ReDraw()
self.doPaletteClick(event.m_x, event.m_y)
def onPaletteUp(self, event):
"""Stores state that the mouse is no longer depressed."""
self.mouse_down = False
def onPaletteMotion(self, event):
"""Updates the colour values during mouse motion while the
mouse button is depressed."""
if self.mouse_down:
self.doPaletteClick(event.m_x, event.m_y)
def doPaletteClick(self, m_x, m_y):
"""Updates the colour values based on the mouse location
over the palette."""
# Get the colour value and update
colour = self.palette.GetValue(m_x, m_y)
self.UpdateColour(colour)
# Highlight a fresh selected area
self.palette.ReDraw()
self.palette.HighlightPoint(m_x, m_y)
# Force an onscreen update
self.solid.Update()
self.colour_slider.Refresh()
def onScroll(self, event):
"""Updates the solid colour display to reflect the changing slider."""
value = self.slider.GetValue()
colour = self.colour_slider.GetValue(value)
self.solid.SetColour(colour)
self.UpdateEntries(colour)
def SetValue(self, colour):
"""Updates the colour chooser to reflect the given wxColour."""
self.UpdateColour(colour)
def GetValue(self):
"""Returns a wxColour object indicating the current colour choice."""
return self.solid.GetColour()
def main():
"""Simple test display."""
class App(wxApp):
def OnInit(self):
frame = wxFrame(NULL, -1, 'PyColourChooser Test')
chooser = wxPyColourChooser(frame, -1)
sizer = wxBoxSizer(wxVERTICAL)
sizer.Add(chooser, 0, 0)
frame.SetAutoLayout(True)
frame.SetSizer(sizer)
sizer.Fit(frame)
frame.Show(True)
self.SetTopWindow(frame)
return True
app = App()
app.MainLoop()
if __name__ == '__main__':
main()

View File

@@ -0,0 +1,82 @@
"""
wxPyColourChooser
Copyright (C) 2002 Michael Gilfix
This file is part of wxPyColourChooser.
You should have received a file COPYING containing license terms
along with this program; if not, write to Michael Gilfix
(mgilfix@eecs.tufts.edu) for a copy.
This version of wxPyColourChooser is open source; you can redistribute it and/or
modify it under the terms listed in the file COPYING.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
"""
import canvas
import colorsys
from wxPython.wx import *
class PyColourSlider(canvas.Canvas):
"""A Pure-Python Colour Slider
The colour slider displays transitions from value 0 to value 1 in
HSV, allowing the user to select a colour within the transition
spectrum.
This class is best accompanying by a wxSlider that allows the user
to select a particular colour shade.
"""
HEIGHT = 172
WIDTH = 12
def __init__(self, parent, id, colour=None):
"""Creates a blank slider instance. A colour must be set before the
slider will be filled in."""
# Set the base colour first since our base class calls the buffer
# drawing function
self.SetBaseColour(colour)
canvas.Canvas.__init__(self, parent, id,
size=wxSize(self.WIDTH, self.HEIGHT))
def SetBaseColour(self, colour):
"""Sets the base, or target colour, to use as the central colour
when calculating colour transitions."""
self.base_colour = colour
def GetBaseColour(self):
"""Return the current colour used as a colour base for filling out
the slider."""
return self.base_colour
def GetValue(self, pos):
"""Returns the colour value for a position on the slider. The position
must be within the valid height of the slider, or results can be
unpredictable."""
return self.buffer.GetPixel(0, pos)
def DrawBuffer(self):
"""Actual implementation of the widget's drawing. We simply draw
from value 0.0 to value 1.0 in HSV."""
if self.base_colour is None:
return
target_red = self.base_colour.Red()
target_green = self.base_colour.Green()
target_blue = self.base_colour.Blue()
h,s,v = colorsys.rgb_to_hsv(target_red / 255.0, target_green / 255.0,
target_blue / 255.0)
v = 1.0
vstep = 1.0 / self.HEIGHT
for y_pos in range(0, self.HEIGHT):
r,g,b = [c * 255.0 for c in colorsys.hsv_to_rgb(h,s,v)]
colour = wxColour(int(r), int(g),(b))
self.buffer.SetPen(wxPen(colour, 1, wxSOLID))
self.buffer.DrawRectangle(0, y_pos, 15, 1)
v = v - vstep

View File

@@ -0,0 +1,214 @@
"""
wxPyColourChooser
Copyright (C) 2002 Michael Gilfix
This file is part of wxPyColourChooser.
You should have received a file COPYING containing license terms
along with this program; if not, write to Michael Gilfix
(mgilfix@eecs.tufts.edu) for a copy.
This version of wxPyColourChooser is open source; you can redistribute it and/or
modify it under the terms listed in the file COPYING.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
"""
import canvas
import colorsys
import cStringIO, zlib
from wxPython.wx import *
# Bitmap functions generated from img2py
def getData():
return zlib.decompress(
'x\xdaUV{<\x93{\x18\x1f:\xe3\xc8Xj\xa3a\xe6R\x9db*B.3\x93\xeb\xe9\x1c\xb7\
\xe4\xb2r9\x8c\xe5\x12e\xc9\xda\x88\x9a\xb4\x83\xcet\xa1N\xae\x85\xe3\xb2\
\xe1,\xb7\xc2\x8a\xd0\x99D\xc8t\xdc\x86r\x1f\x96\\\x16k:\xebC\xe78\xef\xe7\
\xf3\xbe\xbf?\xde\xf7\xf9=\xcf\xf3\xbd<\xbf\xf7WgG;\x90,L\x16\x00\x00\x80\
\x1c\xec\xad]\xc5+[|7\xc8\x00\xc5O\xccv\xddE\xf1\xb2\x8d`\xe5\xe0&#\xbebdpT\
\x00`\xbb\x94\x835\xc6\x8d\x989\x97\xd5N\xca\xb3\x05\xdb\xdc\x9c[\xd0\xf4\
\xd2\xe6\x7f\xb9\xd3\xaa\xe9\x85\xd3\xd5\xd9\xbe]\xa7\xf2\xf1\xf2\x1b\xef\
\x1b\xe6\xb7\tF\xca\t`\xef\xf9\xb5\xa2\x87\xe1\x8d\xd3\x8ft\xef\x06z\xa5\x8f\
\xd7\x04\xf6y\xaf\xfbT\x0e\xad~\xce\xf1E\xa7\xc7\xe9\r\x8c\xab\xb7\xad_\xe4/\
r\xf9\xb1\xbe\x97[\xb3\x88\xfcx\xd6\\\xdf\x15\x88\xca\xcc\xc0\xb0\x10\xef\
\x81B\x9a\xf3Xzq\x1c\xb9\xa2E\xb2\xd3v\x80\xfd90@Ju[\xc3H\xe0\xea\xca\xdc\
\xfbr\xde\xbb\xf0U\xcd\xf4\xd7\xfe\xabc\xbaN\xc2\xe3\xcc>T\xa6)(\xaa\x9f\xe7\
\n\xaa\xe9\x00gcz\xa8Y\xb4\x8a\xc4\x0fr\x9a\x89\xe4\x9eJ\xe7\xa6z\xaf\xf7\
\xcc\xc4\x11YI\xbfx\n@y\x04\x01\x00\nL\xd8\xb3#\xfa\x0e\'\xb7\xc1n\x98\xd3h\
\xd5\x14\xd50\xeaA\x0bd\x8a\x16\x07\x96\xa0#\x13/!\xbf\xf1\xe5\x94)\xd5\xc3\
\xfe\x9ej\x0c<\x8b<8\x89\x98\xcb\x9ek\x18X^\xf9\xa9\xffJ\r/\xd93\xda\xc2\xfd\
\xfa\tt\xb9\xa3\x07\xe8u1\xc5\\O\xe9w\x94\xd6\n\x1e\xe8\xb1Q#@Z\xe2\x10\xd1\
\xcb\xc7\x17\xbd\x9e\x94\x14~\xf9\xd6\xe0\xb1\xb3\xe8\xd8\x07E\xe4\xa6F\x87\
\xbe6:K\xf8\xfanrn\x8b\xa4=e\xb3\x98\xf3\xc8\xde|\x0b\xf0\xb5\xb7\xfb\x0e\
\xf5\x83:m3\xcbs\xfe*T\xc7\x89\xe1\x1a\xc8X=\xbfZ\xc4#\xd0\xee\x93d\xb6lL\
\x15\xe4\xe3\xf7\xd8w\r\x1eK\xe0\xce\xad-`\x19g\xe6\x1f\xc8}\xcc}\xee\xecF\
\x19_\xa6PUq\xee\xa2\x80\x1d\xbc\xf5\x14g\xe04\xa4\xc0EZB\xe6[\x1al\xb2!,\
\xac\xa4\xf3O\x83\xa5y\x96(\xa7\xdd\xc61\x1aX\xa4X\xa8\x96\xdf2\x93\x067\x1c\
\xf0\xed\x10\xaa\xe3\xe9\x96\xac\'l\x14\xb7\xc1\x0ed\x85\x96\xb1\x84m&d\x872\
\x1f)\xe6wt\xd6\tV\xbe\xd4\xbe\xeaE\xcf\xaca\x92f4*Z\xce\xf8\xa0\xd9\x97\xa2\
+\xcc\x90$\xbb\xac8\x0b\xf7\x93\xfa\xb6\xf2\x92\x9d\xa0M\xec\xc6\xaa<\x17\
\xad\x8d\'\xc29\xd1uQjcU}\x8a\x1c\xbf\x9fg\x12\x9c\x1f\\4RZ8\xe2\xf5s@J\t\
\xc5\rU\x92\xab\xf6B\xb3\x97\x8f^\xb8\xa5_\xd0\x98tQ\xa6KA\x12\x0c\x14gl\xc0\
\x00\xe4f*=\xa3\x1ef\x0c\rU<\xb1sO\xaa\x0c\x82;\r)\xc8\x9c\xc0\x1f9CMch\xd4\
\x9fn\xde/g\xc3C\xb0\xb0\x8cuS6\xf3;\x8d2q\x7fG7\x88;\xb4~9\xd5e\xa1}\x7f\
\xd5\xa9Z\x88\x99\xaft+\xeca?\xa2qh\xaf\x8af\xbf\x82\xfe%\xac\xf6\nC_\xc6D\
\xc6Ry\xb3\xb7N\x11"\xcfU\xbb@m\x86AY\na\xfa;\xa1\x93\x96\xf2i\xd0\x04S\x90~\
\x1b\xb8z[1C\xde\x15w\xed\x0b\xd8\xd0\xbe\\\x19\x84\x84\xfe\x1bE\re\xda\x1az\
6\xe6\xbe!+\x86V\xbd\xfb\xc3\xfb\xd9[\xff\xc0\x8c\xc5\nH<\x82U#2S\t\xc8\x1en\
\xa7\xb5E\xde\x14W\xd2w\xe3\xf0\x18\x02\xa0\xf7\xad\xb6\xb2\x96\xfb\xbbH\x02\
\x0b\x85P\xb7\xe4\x02!\xe6a\xc4d\xe8]\x17\xa4\x8bk2G\xaf\xa2p\\\x8e\xd0\x8e\
\t\nf\xce\xf0\x10}O\xc1\x95\x9e\x80\xa6\x91\x8d\xae0\xcf\xa0\xc7\x97-h\xc3\
\x1f\xb8"l\x14\xcaz9\xffYl\x15.l|\xc4\x94\xdd&\x9c\x9f\xf8\xb8f7\x08cA\x1e\
\x85\x11,\xb0\xba\xf1\x87639\xfbJ\xef~e\xf3\xdbK\xd4\xe7\xec\xa5\x92\x17\xf7\
\x1aO\xe3*\xd5\xf3\xcbA\xef\xf4\xa4[\x1d\xaf\xd7>M-\xf1\xb9@\xea\x96x\xd9(\
\x06Z\xec+J\xed\xe5\xd45\x95\xe1\xba\xeb\xf4\xa4\xa3i\xbb\x82}\xd0\xf6Lh\xe8\
E4;0\x9aPk\x0emo~G\x04\xb6&u\xb31\x80\xdao\x01\xf5P\x1d\xd8\x05\x92qmV\xf6R\
\x17\x89\x1a-\xf4\x15P*\xf9?|\xcea\xa9\x8f\x99~6\x92^\xf8\x03s\x11;v\xe2D\
\xc4^\x1c>Q\xbfY\xd0n\xbaE\xc0b=\x91\x0c=[U\x86\xfb\x06\xb52\x92\x19M1uz<\
\xb1\xa4r~4\x83E\xe2y\x08\x0f\nQ\x84\xe8\xfa\xfa\xea\x13\x0e\xd4\x95\x91\\\
\x7f\xf6)\x08`\xb6\x89\xc5\x95^\xff\xe2\\\x03X\xe4\xbe\x88x\x8f\xe34\xb7\xe6\
\xbe\t\xf8\\w\x9c\xd3\x1a\xee\x98\xeeW\x92\xad\x83\x99\xb6B\xcb\x8f\xbdD\x86\
\xc6\xe3\xab\x1b\xb2\xdf\x08:9\xbc\x9e\xf3\xf9h\xd1\xec\xd98\xc8%\x0b\x87c\
\xb8\xbc\x0f\xad\x89\xca\xa5\x94J\xa9\x88j\x1ddo\x91u\x84\xf3\xcd\xea\xc5\
\xf6\x99\xab\xe0\xd7-\x92\xff:\xe6)T\x07\x0bd\x1b\xa9+9\xa4\x86\xec2F\xa1\
\xa6\x7f\xbc\xd1C\x9e\xf4=D\x12\xa2\x07\x94\t\xb1\xe8\xb5\xfb\x94\x14q~R\xa1\
\xe6Y<\xad\xcb\x94j\xbc\xb3##\x0f\xd0 \xbf\xc9\x01\xf8\xad\xb8V\x82sdO7\xbd\
\xbe\xd5Bd\x9f\xc0m#\xd4h<j\xf5*\x84\x86VKt\x0c4\xc1QkD\xbd\xee\xd0\xdc\xcc\
\xad\xc5bN\'\x8f\x1b\x92\x95\x8e\xdf,\xb1\xfa\xe0\xc7f\xd5\xc7\x95\xd1&\xe06\
\xcb\xb4t/\xa0KTj\xd0\xe2\xfb\xd2\xc3!\xf1\xcb?\r7_\x14K$xs(\xfa}~\xe2\xd9\
\xe5gP\xd4\xfaq\x97\xb1\x0b\xd2]\xe5|\x19o2(Vm\xfe>\xe5\x13jZ\xdan\x98\xf3\
\xe4:\x1ep\x93B\xec6?\tO\x0eaB\x99>\xc6Zkr\xcf!\x1b\x84|\xb5\xdb\x8b*O\xb4\
\xe7\x14Ko\xa0\x93\xecmq\xd7\xf0\xbd\x12\x07\x8d\x95\xd7\x7f\xf5&\xb8bmj\xda\
/&`>e\xeb\xfc\x14a\x19\x94S\x7f\xd2\xb5:\x8c\x04\x8f\x91\x03\xc2Q\x0e\xff{\
\x93\xc7\xea\xd6\xbb\x1b\x0e7\xe7E\xa6\xae\x9d\xc6\x85%\x9e\xfbnc\xe3\xff\
\xd4\xa2`9\x13\xa3\x97\x9e\xa4\x9b\x06\xa5\x9f\xec\x9f\x1a\x0c\xf0\xfe\xcd\
\x021\x9b\x0cM\xc06\xfd u:\xe7:g\x02\xc1r\x926\x9b\x7f\xe2\xf9\xe3\xed\xf1qU\
\xbe\xbf\xe8\x91\t\x0c0\xfb-\xe5%d\xef\x19v\x966\xec\xaaB\xe2`N[\x8c\xda\x98\
\xf4\xb4\x83\x13\xcc\x8a\x83\x81\xa3\x91%\xdb\xad\xab\xff\x87\xe1\xba\xda\
\xb5\xdb\xf0\x17\xfd\xf4F\x18KTNH\xf5J\xbc\x97\xdfB:\xa7\x96\xdf/k\x1c\xeaF_\
\x8c\xfc\xdfap\x1e\x99\xae8\x94b\xa1t<\xb54.3c\xd9\xe8y=u9FM;D\xa6\xc0\xea~\
\x0f"O\xee\x81\xdc\xa3\xb2\x1a\xa0\xa7\x02\xb9\x7f>\xfdg\x974\xc8\x0b\xbaU6P\
\xe7\x14\xd8\xd5 \x90\xbc\x0b\xf0\xb7\xc4\x7f\x08\xfaPl\xf5\xa7\x96\xac\xc2\
\x0f*\x05\xf3\x83\xe8\xce\xa7\xc4\x8c\xdbX\xa4U\x9b\xeeW\xe9\xf1\xbf\xa4Q#\
\xcbDQ\x18h\x02\xca\'\xca\xee),1"\x8d\xfb<\x15\xafl\xb8\xb3z\x18\x18\xaf\xb6\
I$\xa2\xbc\xe5\xe5J\xbe\x00\r\x08&<\x0eK\x98\x0e.[\xd1\xea`\xa9\xe2\x96\xae-\
d9%\xc0 \x85\xc5{c_\x03x\xaf\x8f\x98P= 0\x8e\xff\xaa\xf5>7\xfeO\x7f\x1b\xcbm\
\xb1W\xa7\t\x9b\xe1w\x02\xc5\xb5\x9fM/\x8d\xab\xe4u\r\x06\xa0\xd6\xc9\xb5\
\xf2\xb7J\x01\xda<\r\x9f\xd1\x06\x03\xea>\xab\x9d\xe6\xde\xb4\xbb\xb1\xc6\
\xa3EP\x1e\x17\x16\xf2\x1c\xa7\x823\xa7\xcc~\xd1\xdb\xb2\xcb\xbd\xe1\xdb\xf0\
W(,\xe9XD)3I\xc4\x15z_\x98\x8b\xb2v\xdb\x13\xd0\xb8\xf3U"\xb713\xaf\xa0\x1dC\
j\x0b\xb0\xf9\xfd\xef\x0ex\xd7l\xa5\xc1\xf7Z\xd2\x12\x1f\xbe\r\x87Shjm\xe3\
\x1c\x92\xbc\xc7^\x9e\xe5\x84\xf9\xb8\xcb\x88+\x12\xb4M\xee\xb0\xbb\xcd\xc4\
\x9c\xc7V\x1f\xde\x1b\x02\xb0!\x0c\xbeY&\xf6\xe9\xdd[u:0\x0f)(\xc5g\n\xd5\
\xb6\xcc\xf0st\n\x113\x81Q\xcc\xef\xaa\x1b\x9a#\xad|\x12\x98\xd8\xf7"\xa2\
\xa2\xd7\xdbwz+\x08\xb8\x0c\x9d&mZ\\-<\xbaG6j\x9cy@\x8ah\x10@\x8e\xd9\x12\
\x9dK\x00\xf3\xabdo\x1f\x8b\x80\x9c\xf7i^#\xc1X\x7f-\x13R](\x17\xa0\x89p\x9c\
L\x1a\xc5\x9c\x88U\xde\xc7\x9d\xd04\x04\x8en\x11\x8112\xbd\xf6J\x96wP\x06\
\xcd\xa9x\x08\xf7\xc3\xfc\x0e\xceE\xef\xf9j\xd50\x19~\x02~\xf7C\x13\xae\xd8\
\xea\x8e\xc9\x8c\xafpU\xc8\x8d\xaa\xe5\x88Q\xfan\x93\xf7\xf0(\xb0\x93\xf5NH\
\x1f\xae\xc5\xf8\xaa\x97F4\x19;\x19\xe4=\x89\xe0\xae\x15\xc9\xb6\xfe\xe2\xce\
\x1e\xca\xe6\x1a\n<\t\xa9].x\x03\xfd\x1c\x86Fd?\xbd\x17|z\x03\xa8\xafX[N"|\
\x16\xa3#\x0e\x92\xf0h{^+K\x04/!\x8f\xac\xf4\xe4\xbbH\xa9.\x85q\xdd\x93\xc7\
\xbb`\x96\xbb\xb5\xefQ\xdc\x9ch+G\xf8\xbf\xf6b\xdc\xfbww\xcf\xc7\x85\xf7\n@\
\x8d[\xdc\x1b\x8e\xd5\x85\x1c\xf0@JG\x08\xc9;\n\xfb\x9dX\xc5\x8e\t\\\xb3g#\
\xa0\xa2\xb7`\n\x96\x116?\xda\x83\xea\xa1\x7f.Y\x9f\xcb\xda_\x8c\xe9\x01s\
\x0f\xf6\x03\xb7:\xa0\xc6\x94\xaat\xc4\x96r\x1c\x12\x06\x1dZ\xf7\x10V\xd5\
\x088\x02N\xc6\xcc\x05y\xd7\xc0T\x07,c\xea\xb2\xcf\xc7=>y\x87M_\x9a\x86\x12\
\xa5\x92\x83\n_"\x84\xff\x8b7\x95\xfeu\x02\x9c\xf7\xe4\xfacQyo\xda\xbb\t\xed\
\xdeS\xd3\xb7\x04/j\xdb\x96\xae\xec\xd3\x01\xb8P\x8ap\x8c7\x88\xc2\xa8\xfd\
\x1d\xd5\xd1=\xab$*\x8c\x9dd\xacu\x07\xe3\xa6X\xed\x1d\xb9eHd@\x8f\xb7\xd4V\
\xdc\x95\x0f\xa91\xba\xe3s?\n\x12\xf2\x97\xefh\xf4\x1d\x89\x04\xccC)\x8f\x83\
\xbf\x84\xd5\xe0A\xb7\xccC\xf9\xc3fGA\x92\xe4\x12\x89\x03\x14bb\xdfe\xd9\x7f\
\x0f\x86\xc6R\xf9wC\x114\xe0\xdd\xae9\xc9ef\x92\xb6\x12\x1eU\'ZW\xa2\xe9\xa7\
4\x15\xfdb\nr\x17\xf1\xe15IkA\xe5\x12aM[&\x93T\x16\xa5\x92x\xf8\xc3\xd4\xca\
\xd8[\x96]wPNO\t!5\xaf&\xfarlLC\xdd\x00\xdd\x8e\x13qc\xea&]nAb\x8b1>)9\x047\
\xc5\x8e\x1a\xd5\x84\x8b\x7f\x8f\x01\x0e6\x8e\xd6eV~W\xff\x01[x\x1b=' )
def getBitmap():
return wxBitmapFromImage(getImage())
def getImage():
stream = cStringIO.StringIO(getData())
return wxImageFromStream(stream)
class PyPalette(canvas.Canvas):
"""The Pure-Python Palette
The PyPalette is a pure python implementation of a colour palette. The
palette implementation here imitates the palette layout used by MS
Windows and Adobe Photoshop.
The actual palette image has been embedded as an XPM for speed. The
actual reverse-engineered drawing algorithm is provided in the
GeneratePaletteBMP() method. The algorithm is tweakable by supplying
the granularity factor to improve speed at the cost of display
beauty. Since the generator isn't used in real time, no one will
likely care :) But if you need it for some sort of unforeseen realtime
application, it's there.
"""
HORIZONTAL_STEP = 2
VERTICAL_STEP = 4
def __init__(self, parent, id):
"""Creates a palette object."""
# Load the pre-generated palette XPM
self.palette = getBitmap ()
canvas.Canvas.__init__ (self, parent, id, size=wxSize(200, 192))
def GetValue(self, x, y):
"""Returns a colour value at a specific x, y coordinate pair. This
is useful for determining the colour found a specific mouse click
in an external event handler."""
return self.buffer.GetPixel(x, y)
def DrawBuffer(self):
"""Draws the palette XPM into the memory buffer."""
#self.GeneratePaletteBMP ("foo.bmp")
self.buffer.DrawBitmap(self.palette, 0, 0, 0)
def HighlightPoint(self, x, y):
"""Highlights an area of the palette with a little circle around
the coordinate point"""
colour = wxColour(0, 0, 0)
self.buffer.SetPen(wxPen(colour, 1, wxSOLID))
self.buffer.SetBrush(wxBrush(colour, wxTRANSPARENT))
self.buffer.DrawCircle(x, y, 3)
self.Refresh()
def GeneratePaletteBMP(self, file_name, granularity=1):
"""The actual palette drawing algorithm.
This used to be 100% reverse engineered by looking at the
values on the MS map, but has since been redone Correctly(tm)
according to the HSV (hue, saturation, value) colour model by
Charl P. Botha <http://cpbotha.net/>.
Speed is tweakable by changing the granularity factor, but
that affects how nice the output looks (makes the vertical
blocks bigger. This method was used to generate the embedded
XPM data."""
self.vertical_step = self.VERTICAL_STEP * granularity
width, height = self.GetSize ()
# simply iterate over hue (horizontal) and saturation (vertical)
value = 1.0
for y in range(0, height, self.vertical_step):
saturation = 1.0 - float(y) / float(height)
for x in range(0, width, self.HORIZONTAL_STEP):
hue = float(x) / float(width)
r,g,b = colorsys.hsv_to_rgb(hue, saturation, value)
colour = wxColour(r * 255.0, g * 255.0, b * 255.0)
self.buffer.SetPen(wxPen(colour, 1, wxSOLID))
self.buffer.SetBrush(wxBrush(colour, wxSOLID))
self.buffer.DrawRectangle(x, y,
self.HORIZONTAL_STEP,
self.vertical_step)
# this code is now simpler (and works)
bitmap = self.buffer.GetBitmap()
image = wxImageFromBitmap(bitmap)
image.SaveFile (file_name, wxBITMAP_TYPE_XPM)

View File

@@ -76,7 +76,7 @@ class ColourSelect(wxButton):
def OnClick(self, event):
data = wxColourData()
data.SetChooseFull(true)
data.SetChooseFull(True)
data.SetColour(self.set_colour_val)
dlg = wxColourDialog(self.GetParent(), data)
changed = dlg.ShowModal() == wxID_OK

View File

@@ -1,47 +1,59 @@
from wxPython.wx import *
#----------------------------------------------------------------------
# Name: wxPython.lib.dialogs
# Purpose: wxScrolledMessageDialog, wxMultipleChoiceDialog and
# function wrappers for the common dialogs by Kevin Altis.
#
# Author: Various
#
# Created: 3-January-2002
# RCS-ID: $Id$
# Copyright: (c) 2002 by Total Control Software
# Licence: wxWindows license
#----------------------------------------------------------------------
from wxPython import wx
from layoutf import Layoutf
import string
#----------------------------------------------------------------------
class wxScrolledMessageDialog(wxDialog):
def __init__(self, parent, msg, caption, pos = wxDefaultPosition, size = (500,300)):
wxDialog.__init__(self, parent, -1, caption, pos, size)
class wxScrolledMessageDialog(wx.wxDialog):
def __init__(self, parent, msg, caption, pos = wx.wxDefaultPosition, size = (500,300)):
wx.wxDialog.__init__(self, parent, -1, caption, pos, size)
x, y = pos
if x == -1 and y == -1:
self.CenterOnScreen(wxBOTH)
text = wxTextCtrl(self, -1, msg, wxDefaultPosition,
wxDefaultSize,
wxTE_MULTILINE | wxTE_READONLY)
ok = wxButton(self, wxID_OK, "OK")
self.CenterOnScreen(wx.wxBOTH)
text = wx.wxTextCtrl(self, -1, msg, wx.wxDefaultPosition,
wx.wxDefaultSize,
wx.wxTE_MULTILINE | wx.wxTE_READONLY)
ok = wx.wxButton(self, wx.wxID_OK, "OK")
text.SetConstraints(Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self,ok)))
ok.SetConstraints(Layoutf('b=b5#1;x%w50#1;w!80;h!25', (self,)))
self.SetAutoLayout(TRUE)
self.SetAutoLayout(1)
self.Layout()
class wxMultipleChoiceDialog(wxDialog):
def __init__(self, parent, msg, title, lst, pos = wxDefaultPosition, size = (200,200)):
wxDialog.__init__(self, parent, -1, title, pos, size)
class wxMultipleChoiceDialog(wx.wxDialog):
def __init__(self, parent, msg, title, lst, pos = wx.wxDefaultPosition, size = (200,200)):
wx.wxDialog.__init__(self, parent, -1, title, pos, size)
x, y = pos
if x == -1 and y == -1:
self.CenterOnScreen(wxBOTH)
dc = wxClientDC(self)
self.CenterOnScreen(wx.wxBOTH)
dc = wx.wxClientDC(self)
height = 0
for line in string.split(msg,'\n'):
for line in msg.splitlines():
height = height + dc.GetTextExtent(msg)[1] + 4
stat = wxStaticText(self, -1, msg)
self.lbox = wxListBox(self, 100, wxDefaultPosition,
wxDefaultSize, lst, wxLB_MULTIPLE)
ok = wxButton(self, wxID_OK, "OK")
cancel = wxButton(self, wxID_CANCEL, "Cancel")
stat = wx.wxStaticText(self, -1, msg)
self.lbox = wx.wxListBox(self, 100, wx.wxDefaultPosition,
wx.wxDefaultSize, lst, wx.wxLB_MULTIPLE)
ok = wx.wxButton(self, wx.wxID_OK, "OK")
cancel = wx.wxButton(self, wx.wxID_CANCEL, "Cancel")
stat.SetConstraints(Layoutf('t=t10#1;l=l5#1;r=r5#1;h!%d' % (height,),
(self,)))
self.lbox.SetConstraints(Layoutf('t=b10#2;l=l5#1;r=r5#1;b=t5#3',
(self, stat, ok)))
ok.SetConstraints(Layoutf('b=b5#1;x%w25#1;w!80;h!25', (self,)))
cancel.SetConstraints(Layoutf('b=b5#1;x%w75#1;w!80;h!25', (self,)))
self.SetAutoLayout(TRUE)
self.SetAutoLayout(1)
self.lst = lst
self.Layout()
@@ -56,46 +68,317 @@ class wxMultipleChoiceDialog(wxDialog):
return tuple(val)
#----------------------------------------------------------------------
"""
function wrappers for wxPython system dialogs
Author: Kevin Altis
Date: 2003-1-2
Rev: 3
This is the third refactor of the PythonCard dialog.py module
for inclusion in the main wxPython distribution. There are a number of
design decisions and subsequent code refactoring to be done, so I'm
releasing this just to get some feedback.
rev 3:
- result dictionary replaced by DialogResults class instance
- should message arg be replaced with msg? most wxWindows dialogs
seem to use the abbreviation?
rev 2:
- All dialog classes have been replaced by function wrappers
- Changed arg lists to more closely match wxWindows docs and wxPython.lib.dialogs
- changed 'returned' value to the actual button id the user clicked on
- added a returnedString value for the string version of the return value
- reworked colorDialog and fontDialog so you can pass in just a color or font
for the most common usage case
- probably need to use colour instead of color to match the English English
spelling in wxWindows (sigh)
- I still think we could lose the parent arg and just always use None
"""
class DialogResults:
def __init__(self, returned):
self.returned = returned
self.accepted = returned in (wx.wxID_OK, wx.wxID_YES)
self.returnedString = returnedString(returned)
def __repr__(self):
return str(self.__dict__)
def returnedString(ret):
if ret == wx.wxID_OK:
return "Ok"
elif ret == wx.wxID_CANCEL:
return "Cancel"
elif ret == wx.wxID_YES:
return "Yes"
elif ret == wx.wxID_NO:
return "No"
# findDialog was created before wxPython got a Find/Replace dialog
# but it may be instructive as to how a function wrapper can
# be added for your own custom dialogs
# this dialog is always modal, while wxFindReplaceDialog is
# modeless and so doesn't lend itself to a function wrapper
def findDialog(parent=None, searchText='', wholeWordsOnly=0, caseSensitive=0):
dlg = wx.wxDialog(parent, -1, "Find", wx.wxDefaultPosition, wx.wxSize(370, 120))
wx.wxStaticText(dlg, -1, 'Find what:', wx.wxPoint(7, 10))
wSearchText = wx.wxTextCtrl(dlg, -1, searchText,
wx.wxPoint(70, 7), wx.wxSize(195, -1))
wSearchText.SetValue(searchText)
wx.wxButton(dlg, wx.wxID_OK, "Find Next", wx.wxPoint(280, 5), wx.wxDefaultSize).SetDefault()
wx.wxButton(dlg, wx.wxID_CANCEL, "Cancel", wx.wxPoint(280, 35), wx.wxDefaultSize)
wWholeWord = wx.wxCheckBox(dlg, -1, 'Match whole word only',
wx.wxPoint(7, 35), wx.wxDefaultSize, wx.wxNO_BORDER)
if wholeWordsOnly:
wWholeWord.SetValue(1)
wCase = wx.wxCheckBox(dlg, -1, 'Match case',
wx.wxPoint(7, 55), wx.wxDefaultSize, wx.wxNO_BORDER)
if caseSensitive:
wCase.SetValue(1)
wSearchText.SetSelection(0, len(wSearchText.GetValue()))
wSearchText.SetFocus()
result = DialogResults(dlg.ShowModal())
result.text = wSearchText.GetValue()
result.wholeword = wWholeWord.GetValue()
result.casesensitive = wCase.GetValue()
dlg.Destroy()
return result
def colorDialog(parent=None, colorData=None, color=None):
if colorData:
dialog = wx.wxColourDialog(parent, colorData)
else:
dialog = wx.wxColourDialog(parent)
dialog.GetColourData().SetChooseFull(1)
if color is not None:
dialog.GetColourData().SetColour(color)
result = DialogResults(dialog.ShowModal())
result.colorData = dialog.GetColourData()
result.color = result.colorData.GetColour().Get()
dialog.Destroy()
return result
# it is easier to just duplicate the code than
# try and replace color with colour in the result
def colourDialog(parent=None, colourData=None, colour=None):
if colourData:
dialog = wx.wxColourDialog(parent, colourData)
else:
dialog = wx.wxColourDialog(parent)
dialog.GetColourData().SetChooseFull(1)
if colour is not None:
dialog.GetColourData().SetColour(color)
result = DialogResults(dialog.ShowModal())
result.colourData = dialog.GetColourData()
result.colour = result.colourData.GetColour().Get()
dialog.Destroy()
return result
def fontDialog(parent=None, fontData=None, font=None):
if fontData is None:
fontData = wx.wxFontData()
if font is not None:
aFontData.SetInitialFont(font)
dialog = wx.wxFontDialog(parent, fontData)
result = DialogResults(dialog.ShowModal())
if result.accepted:
fontData = dialog.GetFontData()
result.fontData = fontData
result.color = fontData.GetColour().Get()
result.colour = result.color
result.font = fontData.GetChosenFont()
else:
result.color = None
result.colour = None
result.font = None
dialog.Destroy()
return result
def textEntryDialog(parent=None, message='', title='', defaultText='', style=wx.wxOK | wx.wxCANCEL):
dialog = wx.wxTextEntryDialog(parent, message, title, defaultText, style)
result = DialogResults(dialog.ShowModal())
result.text = dialog.GetValue()
dialog.Destroy()
return result
def messageDialog(parent=None, message='', title='Message box',
aStyle = wx.wxOK | wx.wxCANCEL | wx.wxCENTRE,
pos=wx.wxDefaultPosition):
dialog = wx.wxMessageDialog(parent, message, title, aStyle, pos)
result = DialogResults(dialog.ShowModal())
dialog.Destroy()
return result
# KEA alerts are common, so I'm providing a class rather than
# requiring the user code to set up the right icons and buttons
# the with messageDialog function
def alertDialog(parent=None, message='', title='Alert', pos=wx.wxDefaultPosition):
return messageDialog(parent, message, title, wx.wxICON_EXCLAMATION | wx.wxOK, pos)
def scrolledMessageDialog(parent=None, message='', title='', pos=wx.wxDefaultPosition, size=(500,300)):
dialog = wxScrolledMessageDialog(parent, message, title, pos, size)
result = DialogResults(dialog.ShowModal())
dialog.Destroy()
return result
def fileDialog(parent=None, title='Open', directory='', filename='', wildcard='*.*',
style=wx.wxOPEN | wx.wxMULTIPLE):
dialog = wx.wxFileDialog(parent, title, directory, filename, wildcard, style)
result = DialogResults(dialog.ShowModal())
if result.accepted:
result.paths = dialog.GetPaths()
else:
result.paths = None
dialog.Destroy()
return result
# openFileDialog and saveFileDialog are convenience functions
# they represent the most common usages of the fileDialog
# with the most common style options
def openFileDialog(parent=None, title='Open', directory='', filename='',
wildcard='All Files (*.*)|*.*',
style=wx.wxOPEN | wx.wxMULTIPLE):
return fileDialog(parent, title, directory, filename, wildcard, style)
def saveFileDialog(parent=None, title='Save', directory='', filename='',
wildcard='All Files (*.*)|*.*',
style=wx.wxSAVE | wx.wxHIDE_READONLY | wx.wxOVERWRITE_PROMPT):
return fileDialog(parent, title, directory, filename, wildcard, style)
def dirDialog(parent=None, message='Choose a directory', path='', style=0,
pos=wx.wxDefaultPosition, size=wx.wxDefaultSize):
dialog = wx.wxDirDialog(parent, message, path, style, pos, size)
result = DialogResults(dialog.ShowModal())
if result.accepted:
result.path = dialog.GetPath()
else:
result.path = None
dialog.Destroy()
return result
directoryDialog = dirDialog
def singleChoiceDialog(parent=None, message='', title='', lst=[],
style=wx.wxOK | wx.wxCANCEL | wx.wxCENTRE):
dialog = wx.wxSingleChoiceDialog(parent,
message,
title,
lst,
style)
result = DialogResults(dialog.ShowModal())
result.selection = dialog.GetStringSelection()
dialog.Destroy()
return result
def multipleChoiceDialog(parent=None, message='', title='', lst=[], pos=wx.wxDefaultPosition, size=(200,200)):
dialog = wxMultipleChoiceDialog(parent, message, title, lst, pos, size)
result = DialogResults(dialog.ShowModal())
result.selection = dialog.GetValueString()
dialog.Destroy()
return result
if __name__ == '__main__':
class MyFrame(wxFrame):
def __init__(self):
wxFrame.__init__(self, NULL, -1, "hello",
wxDefaultPosition, wxSize(200,200))
wxButton(self, 100, "Multiple Test",wxPoint(0,0))
wxButton(self, 101, "Message Test", wxPoint(0,100))
EVT_BUTTON(self, 100, self.OnMultipleTest)
EVT_BUTTON(self, 101, self.OnMessageTest)
class MyApp(wx.wxApp):
def OnMultipleTest(self, event):
self.lst = [ 'apple', 'pear', 'banana', 'coconut', 'orange',
'etc', 'etc..', 'etc...' ]
dlg = wxMultipleChoiceDialog(self,
"Pick some from\n this list\nblabla",
"m.s.d.", self.lst)
if (dlg.ShowModal() == wxID_OK):
print "Selection:", dlg.GetValue(), " -> ", dlg.GetValueString()
def OnMessageTest(self, event):
import sys;
f = open(sys.argv[0],"r")
msg = f.read()
dlg = wxScrolledMessageDialog(self, msg, "message test")
dlg.ShowModal()
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame()
frame.Show(TRUE)
frame = wx.wxFrame(wx.NULL, -1, "Dialogs", size=(400, 200))
panel = wx.wxPanel(frame, -1)
self.panel = panel
frame.Show(1)
dialogNames = [
'alertDialog',
'colorDialog',
'directoryDialog',
'fileDialog',
'findDialog',
'fontDialog',
'messageDialog',
'multipleChoiceDialog',
'openFileDialog',
'saveFileDialog',
'scrolledMessageDialog',
'singleChoiceDialog',
'textEntryDialog',
]
self.nameList = wx.wxListBox(panel, -1, (0, 0), (130, 180), dialogNames, style=wx.wxLB_SINGLE)
wx.EVT_LISTBOX(panel, self.nameList.GetId(), self.OnNameListSelected)
tstyle = wx.wxTE_RICH2 | wx.wxTE_PROCESS_TAB | wx.wxTE_MULTILINE
self.text1 = wx.wxTextCtrl(panel, -1, pos=(150, 0), size=(200, 180), style=tstyle)
self.SetTopWindow(frame)
return TRUE
return 1
def OnNameListSelected(self, evt):
import pprint
sel = evt.GetString()
result = None
if sel == 'alertDialog':
result = alertDialog(message='Danger Will Robinson')
elif sel == 'colorDialog':
result = colorDialog()
elif sel == 'directoryDialog':
result = directoryDialog()
elif sel == 'fileDialog':
wildcard = "JPG files (*.jpg;*.jpeg)|*.jpeg;*.JPG;*.JPEG;*.jpg|GIF files (*.gif)|*.GIF;*.gif|All Files (*.*)|*.*"
result = fileDialog(None, 'Open', '', '', wildcard)
elif sel == 'findDialog':
result = findDialog()
elif sel == 'fontDialog':
result = fontDialog()
elif sel == 'messageDialog':
result = messageDialog(None, 'Hello from Python and wxPython!',
'A Message Box', wx.wxOK | wx.wxICON_INFORMATION)
#wx.wxYES_NO | wx.wxNO_DEFAULT | wx.wxCANCEL | wx.wxICON_INFORMATION)
#result = messageDialog(None, 'message', 'title')
elif sel == 'multipleChoiceDialog':
result = multipleChoiceDialog(None, "message", "title", ['one', 'two', 'three'])
elif sel == 'openFileDialog':
result = openFileDialog()
elif sel == 'saveFileDialog':
result = saveFileDialog()
elif sel == 'scrolledMessageDialog':
msg = "Can't find the file dialog.py"
try:
# read this source file and then display it
import sys
filename = sys.argv[-1]
fp = open(filename)
message = fp.read()
fp.close()
except:
pass
result = scrolledMessageDialog(None, message, filename)
elif sel == 'singleChoiceDialog':
result = singleChoiceDialog(None, "message", "title", ['one', 'two', 'three'])
elif sel == 'textEntryDialog':
result = textEntryDialog(None, "message", "title", "text")
if result:
#self.text1.SetValue(pprint.pformat(result.__dict__))
self.text1.SetValue(str(result))
app = MyApp(0)
app.MainLoop()

View File

@@ -24,7 +24,6 @@
import os, time
from wxPython.wx import *
from string import *
import selection
import images
@@ -123,7 +122,7 @@ class wxEditor(wxScrolledWindow):
if wxPlatform == "__WXMSW__":
return wxFont(10, wxMODERN, wxNORMAL, wxNORMAL)
else:
return wxFont(12, wxMODERN, wxNORMAL, wxNORMAL, false)
return wxFont(12, wxMODERN, wxNORMAL, wxNORMAL, False)
def UnixKeyHack(self, key):
# this will be obsolete when we get the new wxWindows patch
@@ -163,7 +162,7 @@ class wxEditor(wxScrolledWindow):
if dc.Ok():
self.SetCharDimensions()
self.KeepCursorOnScreen()
self.DrawSimpleCursor(0,0,dc, true)
self.DrawSimpleCursor(0,0,dc, True)
self.Draw(dc)
def OnPaint(self, event):
@@ -257,7 +256,7 @@ class wxEditor(wxScrolledWindow):
self.DrawSimpleCursor(x, y, dc)
def DrawSimpleCursor(self, xp, yp, dc = None, old=false):
def DrawSimpleCursor(self, xp, yp, dc = None, old=False):
if not dc:
dc = wxClientDC(self)
@@ -354,13 +353,13 @@ class wxEditor(wxScrolledWindow):
return len(self.lines)
def UnTouchBuffer(self):
self.bufferTouched = FALSE
self.bufferTouched = False
def BufferWasTouched(self):
return self.bufferTouched
def TouchBuffer(self):
self.bufferTouched = TRUE
self.bufferTouched = True
##-------------------------- Mouse scroll timing functions
@@ -368,7 +367,7 @@ class wxEditor(wxScrolledWindow):
def InitScrolling(self):
# we don't rely on the windows system to scroll for us; we just
# redraw the screen manually every time
self.EnableScrolling(FALSE, FALSE)
self.EnableScrolling(False, False)
self.nextScrollTime = 0
self.SCROLLDELAY = 0.050 # seconds
self.scrollTimer = wxTimer(self)
@@ -377,12 +376,12 @@ class wxEditor(wxScrolledWindow):
def CanScroll(self):
if time.time() > self.nextScrollTime:
self.nextScrollTime = time.time() + self.SCROLLDELAY
return true
return True
else:
return false
return False
def SetScrollTimer(self):
oneShot = true
oneShot = True
self.scrollTimer.Start(1000*self.SCROLLDELAY/2, oneShot)
EVT_TIMER(self, -1, self.OnTimer)
@@ -449,7 +448,7 @@ class wxEditor(wxScrolledWindow):
def OnMotion(self, event):
if event.LeftIsDown() and self.HasCapture():
self.Selecting = true
self.Selecting = True
self.MouseToCursor(event)
self.SelectUpdate()
@@ -467,8 +466,8 @@ class wxEditor(wxScrolledWindow):
if self.SelectEnd is None:
self.OnClick()
else:
self.Selecting = false
self.SelectNotify(false, self.SelectBegin, self.SelectEnd)
self.Selecting = False
self.SelectNotify(False, self.SelectBegin, self.SelectEnd)
self.ReleaseMouse()
self.scrollTimer.Stop()
@@ -630,8 +629,8 @@ class wxEditor(wxScrolledWindow):
def SelectOff(self):
self.SelectBegin = None
self.SelectEnd = None
self.Selecting = false
self.SelectNotify(false,None,None)
self.Selecting = False
self.SelectNotify(False,None,None)
def CopySelection(self, event):
selection = self.FindSelection()
@@ -650,7 +649,7 @@ class wxEditor(wxScrolledWindow):
def CopyToClipboard(self, linesOfText):
do = wxTextDataObject()
do.SetText(string.join(linesOfText, os.linesep))
do.SetText(os.linesep.join(linesOfText))
wxTheClipboard.Open()
wxTheClipboard.SetData(do)
wxTheClipboard.Close()
@@ -837,29 +836,29 @@ class wxEditor(wxScrolledWindow):
keySettingFunction(action)
if not action.has_key(key):
return false
return False
if event.ShiftDown():
if not self.Selecting:
self.Selecting = true
self.Selecting = True
self.SelectBegin = (self.cy, self.cx)
action[key](event)
self.SelectEnd = (self.cy, self.cx)
else:
action[key](event)
if self.Selecting:
self.Selecting = false
self.Selecting = False
self.SelectNotify(self.Selecting, self.SelectBegin, self.SelectEnd)
self.UpdateView()
return true
return True
def MoveSpecialKey(self, event, key):
return self.Move(self.SetMoveSpecialFuncs, key, event)
def MoveSpecialControlKey(self, event, key):
if not event.ControlDown():
return false
return False
return self.Move(self.SetMoveSpecialControlFuncs, key, event)
def Dispatch(self, keySettingFunction, key, event):
@@ -868,21 +867,21 @@ class wxEditor(wxScrolledWindow):
if action.has_key(key):
action[key](event)
self.UpdateView()
return true
return false
return True
return False
def ModifierKey(self, key, event, modifierKeyDown, MappingFunc):
if not modifierKeyDown:
return false
return False
key = self.UnixKeyHack(key)
try:
key = chr(key)
except:
return false
return False
if not self.Dispatch(MappingFunc, key, event):
wxBell()
return true
return True
def ControlKey(self, event, key):
return self.ModifierKey(key, event, event.ControlDown(), self.SetControlFuncs)
@@ -892,14 +891,14 @@ class wxEditor(wxScrolledWindow):
def SpecialControlKey(self, event, key):
if not event.ControlDown():
return false
return False
if not self.Dispatch(self.SetSpecialControlFuncs, key, event):
wxBell()
return true
return True
def ShiftKey(self, event, key):
if not event.ShiftDown():
return false
return False
return self.Dispatch(self.SetShiftFuncs, key, event)
def NormalChar(self, event, key):

View File

@@ -1,5 +1,5 @@
TRUE = 1
FALSE = 0
True = 1
False = 0
def RestOfLine(sx, width, data, bool):
if len(data) == 0 and sx == 0:
@@ -10,16 +10,16 @@ def RestOfLine(sx, width, data, bool):
def Selection(SelectBegin,SelectEnd, sx, width, line, data):
if SelectEnd is None or SelectBegin is None:
return RestOfLine(sx, width, data, FALSE)
return RestOfLine(sx, width, data, False)
(bRow, bCol) = SelectBegin
(eRow, eCol) = SelectEnd
if (eRow < bRow):
(bRow, bCol) = SelectEnd
(eRow, eCol) = SelectBegin
if (line < bRow or eRow < line):
return RestOfLine(sx, width, data, FALSE)
return RestOfLine(sx, width, data, False)
if (bRow < line and line < eRow):
return RestOfLine(sx, width, data, TRUE)
return RestOfLine(sx, width, data, True)
if (bRow == eRow) and (eCol < bCol):
(bCol, eCol) = (eCol, bCol)
# selection either starts or ends on this line
@@ -31,12 +31,12 @@ def Selection(SelectBegin,SelectEnd, sx, width, line, data):
pieces = []
if (sx < bCol):
if bCol <= end:
pieces += [(data[sx:bCol], FALSE)]
pieces += [(data[sx:bCol], False)]
else:
return [(data[sx:end], FALSE)]
pieces += [(data[max(bCol,sx):min(eCol,end)], TRUE)]
return [(data[sx:end], False)]
pieces += [(data[max(bCol,sx):min(eCol,end)], True)]
if (eCol < end):
pieces += [(data[eCol:end], FALSE)]
pieces += [(data[eCol:end], False)]
return pieces

View File

@@ -0,0 +1,519 @@
#---------------------------------------------------------------------------
# Name: wxPython.lib.evtmgr
# Purpose: An easier, more "Pythonic" and more OO method of registering
# handlers for wxWindows events using the Publish/Subscribe
# pattern.
#
# Author: Robb Shecter and Robin Dunn
#
# Created: 12-December-2002
# RCS-ID: $Id$
# Copyright: (c) 2002 by Robb Shecter <robb@acm.org>
# Licence: wxWindows license
#---------------------------------------------------------------------------
"""
A module that allows multiple handlers to respond to single wxWindows
events. This allows true NxN Observer/Observable connections: One
event can be received by multiple handlers, and one handler can
receive multiple events.
There are two ways to register event handlers. The first way is
similar to standard wxPython handler registration:
from wxPython.lib.evtmgr import eventManager
eventManager.Register(handleEvents, EVT_BUTTON, win=frame, id=101)
There's also a new object-oriented way to register for events. This
invocation is equivalent to the one above, but does not require the
programmer to declare or track control ids or parent containers:
eventManager.Register(handleEvents, EVT_BUTTON, myButton)
This module is Python 2.1+ compatible.
Author: Robb Shecter
"""
from wxPython import wx
import pubsub
#---------------------------------------------------------------------------
class EventManager:
"""
This is the main class in the module, and is the only class that
the application programmer needs to use. There is a pre-created
instance of this class called 'eventManager'. It should not be
necessary to create other instances.
"""
def __init__(self):
self.eventAdapterDict = {}
self.messageAdapterDict = {}
self.windowTopicLookup = {}
self.listenerTopicLookup = {}
self.__publisher = pubsub.Publisher()
self.EMPTY_LIST = []
def Register(self, listener, event, source=None, win=None, id=None):
"""
Registers a listener function (or any callable object) to
receive events of type event coming from the source window.
For example:
eventManager.Register(self.OnButton, EVT_BUTTON, theButton)
Alternatively, the specific window where the event is
delivered, and/or the ID of the event source can be specified.
For example:
eventManager.Register(self.OnButton, EVT_BUTTON, win=self, id=ID_BUTTON)
or
eventManager.Register(self.OnButton, EVT_BUTTON, theButton, self)
"""
# 1. Check if the 'event' is actually one of the multi-
# event macros.
if _macroInfo.isMultiEvent(event):
raise 'Cannot register the macro, '+`event`+'. Register instead the individual events.'
# Support a more OO API. This allows the GUI widget itself to
# be specified, and the id to be retrieved from the system,
# instead of kept track of explicitly by the programmer.
# (Being used to doing GUI work with Java, this seems to me to be
# the natural way of doing things.)
if source is not None:
id = source.GetId()
if win is None:
# Some widgets do not function as their own windows.
win = self._determineWindow(source)
topic = (event, win, id)
# Create an adapter from the PS system back to wxEvents, and
# possibly one from wxEvents:
if not self.__haveMessageAdapter(listener, topic):
messageAdapter = MessageAdapter(eventHandler=listener, topicPattern=topic)
try:
self.messageAdapterDict[topic][listener] = messageAdapter
except KeyError:
self.messageAdapterDict[topic] = {}
self.messageAdapterDict[topic][listener] = messageAdapter
if not self.eventAdapterDict.has_key(topic):
self.eventAdapterDict[topic] = EventAdapter(event, win, id)
else:
# Throwing away a duplicate request
pass
# For time efficiency when deregistering by window:
try:
self.windowTopicLookup[win].append(topic)
except KeyError:
self.windowTopicLookup[win] = []
self.windowTopicLookup[win].append(topic)
# For time efficiency when deregistering by listener:
try:
self.listenerTopicLookup[listener].append(topic)
except KeyError:
self.listenerTopicLookup[listener] = []
self.listenerTopicLookup[listener].append(topic)
# See if the source understands the listeningFor protocol.
# This is a bit of a test I'm working on - it allows classes
# to know when their events are being listened to. I use
# it to enable chaining events from contained windows only
# when needed.
if source is not None:
try:
# Let the source know that we're listening for this
# event.
source.listeningFor(event)
except AttributeError:
pass
# Some aliases for Register, just for kicks
Bind = Register
Subscribe = Register
def DeregisterWindow(self, win):
"""
Deregister all events coming from the given window.
"""
win = self._determineWindow(win)
topics = self.__getTopics(win)
if topics:
for aTopic in topics:
self.__deregisterTopic(aTopic)
del self.windowTopicLookup[win]
def DeregisterListener(self, listener):
"""
Deregister all event notifications for the given listener.
"""
try:
topicList = self.listenerTopicLookup[listener]
except KeyError:
return
for topic in topicList:
topicDict = self.messageAdapterDict[topic]
if topicDict.has_key(listener):
topicDict[listener].Destroy()
del topicDict[listener]
if len(topicDict) == 0:
self.eventAdapterDict[topic].Destroy()
del self.eventAdapterDict[topic]
del self.messageAdapterDict[topic]
del self.listenerTopicLookup[listener]
def GetStats(self):
"""
Return a dictionary with data about my state.
"""
stats = {}
stats['Adapters: Message'] = reduce(lambda x,y: x+y, map(len, self.messageAdapterDict.values()))
stats['Adapters: Event'] = len(self.eventAdapterDict)
stats['Topics: Total'] = len(self.__getTopics())
stats['Topics: Dead'] = len(self.GetDeadTopics())
return stats
def DeregisterDeadTopics(self):
"""
Deregister any entries relating to dead
wxPython objects. Not sure if this is an
important issue; 1) My app code always de-registers
listeners it doesn't need. 2) I don't think
that lingering references to these dead objects
is a problem.
"""
for topic in self.GetDeadTopics():
self.DeregisterTopic(topic)
def GetDeadTopics(self):
"""
Return a list of topics relating to dead wxPython
objects.
"""
return filter(self.__isDeadTopic, self.__getTopics())
def __winString(self, aWin):
"""
A string rep of a window for debugging
"""
try:
name = aWin.GetClassName()
i = id(aWin)
return '%s #%d' % (name, i)
except wx.wxPyDeadObjectError:
return '(dead wxObject)'
def __topicString(self, aTopic):
"""
A string rep of a topic for debugging
"""
return '[%-26s %s]' % (aTopic[0].__name__, self.winString(aTopic[1]))
def __listenerString(self, aListener):
"""
A string rep of a listener for debugging
"""
try:
return aListener.im_class.__name__ + '.' + aListener.__name__
except:
return 'Function ' + aListener.__name__
def __deregisterTopic(self, aTopic):
try:
messageAdapterList = self.messageAdapterDict[aTopic].values()
except KeyError:
# This topic isn't valid. Probably because it was deleted
# by listener.
return
for messageAdapter in messageAdapterList:
messageAdapter.Destroy()
self.eventAdapterDict[aTopic].Destroy()
del self.messageAdapterDict[aTopic]
del self.eventAdapterDict[aTopic]
def __getTopics(self, win=None):
if win is None:
return self.messageAdapterDict.keys()
if win is not None:
try:
return self.windowTopicLookup[win]
except KeyError:
return self.EMPTY_LIST
def __isDeadWxObject(self, anObject):
return isinstance(anObject, wx._wxPyDeadObject)
def __isDeadTopic(self, aTopic):
return self.__isDeadWxObject(aTopic[1])
def __haveMessageAdapter(self, eventHandler, topicPattern):
"""
Return True if there's already a message adapter
with these specs.
"""
try:
return self.messageAdapterDict[topicPattern].has_key(eventHandler)
except KeyError:
return 0
def _determineWindow(self, aComponent):
"""
Return the window that corresponds to this component.
A window is something that supports the Connect protocol.
Most things registered with the event manager are a window,
but there are apparently some exceptions. If more are
discovered, the implementation can be changed to a dictionary
lookup along the lines of class : function-to-get-window.
"""
if isinstance(aComponent, wx.wxMenuItem):
return aComponent.GetMenu()
else:
return aComponent
#---------------------------------------------------------------------------
# From here down is implementaion and support classes, although you may
# find some of them useful in other contexts.
#---------------------------------------------------------------------------
class EventMacroInfo:
"""
A class that provides information about event macros.
"""
def __init__(self):
self.lookupTable = {}
def getEventTypes(self, eventMacro):
"""
Return the list of event types that the given
macro corresponds to.
"""
try:
return self.lookupTable[eventMacro]
except KeyError:
win = FakeWindow()
try:
eventMacro(win, None, None)
except TypeError:
eventMacro(win, None)
self.lookupTable[eventMacro] = win.eventTypes
return win.eventTypes
def eventIsA(self, event, macroList):
"""
Return True if the event is one of the given
macros.
"""
eventType = event.GetEventType()
for macro in macroList:
if eventType in self.getEventTypes(macro):
return 1
return 0
def macroIsA(self, macro, macroList):
"""
Return True if the macro is in the macroList.
The added value of this method is that it takes
multi-events into account. The macroList parameter
will be coerced into a sequence if needed.
"""
if callable(macroList):
macroList = (macroList,)
testList = self.getEventTypes(macro)
eventList = []
for m in macroList:
eventList.extend(self.getEventTypes(m))
# Return True if every element in testList is in eventList
for element in testList:
if element not in eventList:
return 0
return 1
def isMultiEvent(self, macro):
"""
Return True if the given macro actually causes
multiple events to be registered.
"""
return len(self.getEventTypes(macro)) > 1
#---------------------------------------------------------------------------
class FakeWindow:
"""
Used internally by the EventMacroInfo class. The FakeWindow is
the most important component of the macro-info utility: it
implements the Connect() protocol of wxWindow, but instead of
registering for events, it keeps track of what parameters were
passed to it.
"""
def __init__(self):
self.eventTypes = []
def Connect(self, id1, id2, eventType, handlerFunction):
self.eventTypes.append(eventType)
#---------------------------------------------------------------------------
class EventAdapter:
"""
A class that adapts incoming wxWindows events to
Publish/Subscribe messages.
In other words, this is the object that's seen by the
wxWindows system. Only one of these registers for any
particular wxWindows event. It then relays it into the
PS system, which lets many listeners respond.
"""
def __init__(self, func, win, id):
"""
Instantiate a new adapter. Pre-compute my Publish/Subscribe
topic, which is constant, and register with wxWindows.
"""
self.publisher = pubsub.Publisher()
self.topic = ((func, win, id),)
self.id = id
self.win = win
self.eventType = _macroInfo.getEventTypes(func)[0]
# Register myself with the wxWindows event system
try:
func(win, id, self.handleEvent)
self.callStyle = 3
except TypeError:
func(win, self.handleEvent)
self.callStyle = 2
def disconnect(self):
if self.callStyle == 3:
return self.win.Disconnect(self.id, -1, self.eventType)
else:
return self.win.Disconnect(-1, -1, self.eventType)
def handleEvent(self, event):
"""
In response to a wxWindows event, send a PS message
"""
self.publisher.sendMessage(topic=self.topic, data=event)
def Destroy(self):
try:
if not self.disconnect():
print 'disconnect failed'
except wx.wxPyDeadObjectError:
print 'disconnect failed: dead object' ##????
#---------------------------------------------------------------------------
class MessageAdapter:
"""
A class that adapts incoming Publish/Subscribe messages
to wxWindows event calls.
This class works opposite the EventAdapter, and
retrieves the information an EventAdapter has sent in a message.
Strictly speaking, this class is not required: Event listeners
could pull the original wxEvent object out of the PS Message
themselves.
However, by pairing an instance of this class with each wxEvent
handler, the handlers can use the standard API: they receive an
event as a parameter.
"""
def __init__(self, eventHandler, topicPattern):
"""
Instantiate a new MessageAdapter that send wxEvents to the
given eventHandler.
"""
self.eventHandler = eventHandler
pubsub.Publisher().subscribe(listener=self.deliverEvent, topic=(topicPattern,))
def deliverEvent(self, message):
event = message.data # Extract the wxEvent
self.eventHandler(event) # Perform the call as wxWindows would
def Destroy(self):
pubsub.Publisher().unsubscribe(listener=self.deliverEvent)
#---------------------------------------------------------------------------
# Create globals
_macroInfo = EventMacroInfo()
# For now a singleton is not enforced. Should it be or can we trust
# the programmers?
eventManager = EventManager()
#---------------------------------------------------------------------------
# simple test code
if __name__ == '__main__':
from wxPython.wx import wxPySimpleApp, wxFrame, wxToggleButton, wxBoxSizer, wxHORIZONTAL, EVT_MOTION, EVT_LEFT_DOWN, EVT_TOGGLEBUTTON, wxALL
app = wxPySimpleApp()
frame = wxFrame(None, -1, 'Event Test', size=(300,300))
button = wxToggleButton(frame, -1, 'Listen for Mouse Events')
sizer = wxBoxSizer(wxHORIZONTAL)
sizer.Add(button, 0, 0 | wxALL, 10)
frame.SetAutoLayout(1)
frame.SetSizer(sizer)
#
# Demonstrate 1) register/deregister, 2) Multiple listeners receiving
# one event, and 3) Multiple events going to one listener.
#
def printEvent(event):
print 'Name:',event.GetClassName(),'Timestamp',event.GetTimestamp()
def enableFrameEvents(event):
# Turn the output of mouse events on and off
if event.IsChecked():
print '\nEnabling mouse events...'
eventManager.Register(printEvent, EVT_MOTION, frame)
eventManager.Register(printEvent, EVT_LEFT_DOWN, frame)
else:
print '\nDisabling mouse events...'
eventManager.DeregisterWindow(frame)
# Send togglebutton events to both the on/off code as well
# as the function that prints to stdout.
eventManager.Register(printEvent, EVT_TOGGLEBUTTON, button)
eventManager.Register(enableFrameEvents, EVT_TOGGLEBUTTON, button)
frame.CenterOnScreen()
frame.Show(1)
app.MainLoop()

View File

@@ -13,7 +13,7 @@ encoding, and color. See the example on the bottom for a better idea
of how this works.
Note that start and end tags for the string are provided if enclose is
true, so for instance, renderToBitmap("X<sub>1</sub>") will work.
True, so for instance, renderToBitmap("X<sub>1</sub>") will work.
"""
# Copyright 2001 Timothy Hochberg

View File

@@ -64,7 +64,7 @@ class FileBrowseButton(wxPanel):
self.fileMask = fileMask
self.fileMode = fileMode
self.changeCallback = changeCallback
self.callCallback = true
self.callCallback = True
# get background to match it
@@ -99,14 +99,14 @@ class FileBrowseButton(wxPanel):
box.Add( self.textControl, 1, wxLEFT|wxCENTER, 5)
self.browseButton = self.createBrowseButton()
box.Add( self.browseButton, 0, wxCENTER)
box.Add( self.browseButton, 0, wxLEFT|wxCENTER, 5)
# add a border around the whole thing and resize the panel to fit
outsidebox = wxBoxSizer(wxVERTICAL)
outsidebox.Add(box, 1, wxEXPAND|wxALL, 3)
outsidebox.Fit(self)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer( outsidebox )
self.Layout()
if type( size ) == types.TupleType:
@@ -195,7 +195,7 @@ class FileBrowseButton(wxPanel):
def SetLabel( self, value ):
""" Set the label's current text """
rvalue = self.label.SetLabel( value )
self.Refresh( true )
self.Refresh( True )
return rvalue
@@ -404,7 +404,7 @@ if __name__ == "__main__":
ID = wxNewId()
innerbox.Add( wxButton( panel, ID,"Change Value", ), 1, wxEXPAND)
EVT_BUTTON( self, ID, self.OnChangeValue )
panel.SetAutoLayout(true)
panel.SetAutoLayout(True)
panel.SetSizer( innerbox )
self.history={"c:\\temp":1, "c:\\tmp":1, "r:\\temp":1,"z:\\temp":1}
@@ -417,7 +417,7 @@ if __name__ == "__main__":
self.history[event.GetString ()]=1
def OnCloseMe(self, event):
self.Close(true)
self.Close(True)
def OnChangeLabel( self, event ):
self.bottomcontrol.SetLabel( "Label Updated" )
def OnChangeValue( self, event ):
@@ -433,9 +433,9 @@ if __name__ == "__main__":
wxImage_AddHandler(wxGIFHandler())
frame = DemoFrame(NULL)
#frame = RulesPanel(NULL )
frame.Show(true)
frame.Show(True)
self.SetTopWindow(frame)
return true
return True
def test( ):
app = DemoApp(0)

View File

@@ -50,8 +50,8 @@ else:
wxToolBar subclass which can be dragged off its frame and later
replaced there. Drag on the toolbar to release it, close it like
a normal window to make it return to its original
position. Programmatically, call SetFloatable(true) and then
Float(true) to float, Float(false) to dock.
position. Programmatically, call SetFloatable(True) and then
Float(True) to float, Float(False) to dock.
"""
def __init__(self,*_args,**_kwargs):
@@ -175,7 +175,7 @@ else:
newpos = self.parentframe.GetPosition()
newpos.y = newpos.y + _DOCKTHRESHOLD * 2
self.floatframe.SetPosition(newpos)
self.floatframe.Show(true)
self.floatframe.Show(True)
EVT_CLOSE(self.floatframe, self.OnDock)
#EVT_MOVE(self.floatframe, self.OnMove)
@@ -208,9 +208,9 @@ else:
#homepos = homepos[0], homepos[1] + self.titleheight
#floatpos = self.floatframe.GetPositionTuple()
#if abs(homepos[0] - floatpos[0]) < 35 and abs(homepos[1] - floatpos[1]) < 35:
# self._SetFauxBarVisible(true)
# self._SetFauxBarVisible(True)
#else:
# self._SetFauxBarVisible(false)
# self._SetFauxBarVisible(False)
def OnMouse(self, e):
@@ -240,7 +240,7 @@ else:
if e.Dragging():
if not self.IsFloating():
self.Float(true)
self.Float(True)
self.oldpos = (e.GetX(), e.GetY())
else:
if hasattr(self, 'oldpos'):

View File

@@ -0,0 +1,419 @@
#----------------------------------------------------------------------------
# Name: GridColMover.py
# Purpose: Grid Column Mover Extension
#
# Author: Gerrit van Dyk (email: gerritvd@decillion.net)
#
# Version 0.1
# Date: Nov 19, 2002
# RCS-ID: $Id$
# Licence: wxWindows license
#----------------------------------------------------------------------------
from wxPython.wx import *
from wxPython.grid import wxGridPtr
#----------------------------------------------------------------------------
# event class and macors
wxEVT_COMMAND_GRID_COL_MOVE = wxNewEventType()
wxEVT_COMMAND_GRID_ROW_MOVE = wxNewEventType()
def EVT_GRID_COL_MOVE(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_GRID_COL_MOVE, func)
def EVT_GRID_ROW_MOVE(win,id,func):
win.Connect(id, -1, wxEVT_COMMAND_GRID_ROW_MOVE, func)
class wxGridColMoveEvent(wxPyCommandEvent):
def __init__(self, id, dCol, bCol):
wxPyCommandEvent.__init__(self, id = id)
self.SetEventType(wxEVT_COMMAND_GRID_COL_MOVE)
self.moveColumn = dCol
self.beforeColumn = bCol
def GetMoveColumn(self):
return self.moveColumn
def GetBeforeColumn(self):
return self.beforeColumn
class wxGridRowMoveEvent(wxPyCommandEvent):
def __init__(self, id, dRow, bRow):
wxPyCommandEvent.__init__(self,id = id)
self.SetEventType(wxEVT_COMMAND_GRID_ROW_MOVE)
self.moveRow = dRow
self.beforeRow = bRow
def GetMoveRow(self):
return self.moveRow
def GetBeforeRow(self):
return self.beforeRow
#----------------------------------------------------------------------------
# graft new methods into the wxGridPtr class
def _ColToRect(self,col):
if self.GetNumberRows() > 0:
rect = self.CellToRect(0,col)
else:
rect = wxRect()
rect.height = self.GetColLabelSize()
rect.width = self.GetColSize(col)
for cCol in range(0,col):
rect.x += self.GetColSize(cCol)
rect.y = self.GetGridColLabelWindow().GetPosition()[1]
return rect
wxGridPtr.ColToRect = _ColToRect
def _RowToRect(self,row):
if self.GetNumberCols() > 0:
rect = self.CellToRect(row,0)
else:
rect = wxRect()
rect.width = self.GetRowLabelSize()
rect.height = self.GetRowSize(row)
for cRow in range(0,row):
rect.y += self.GetRowSize(cRow)
rect.x = self.GetGridRowLabelWindow().GetPosition()[0]
return rect
wxGridPtr.RowToRect = _RowToRect
#----------------------------------------------------------------------------
class ColDragWindow(wxWindow):
def __init__(self,parent,image,dragCol):
wxWindow.__init__(self,parent,wxSIMPLE_BORDER)
self.image = image
self.SetSize((self.image.GetWidth(),self.image.GetHeight()))
self.ux = parent.GetScrollPixelsPerUnit()[0]
self.moveColumn = dragCol
EVT_PAINT(self,self.OnPaint)
def DisplayAt(self,pos,y):
x = self.GetPositionTuple()[0]
if x == pos:
self.Refresh() # Need to display insertion point
else:
self.MoveXY(pos,y)
def GetMoveColumn(self):
return self.moveColumn
def _GetInsertionInfo(self):
parent = self.GetParent()
sx = parent.GetViewStart()[0] * self.ux
sx -= parent._rlSize
x = self.GetPositionTuple()[0]
w = self.GetSizeTuple()[0]
sCol = parent.XToCol(x + sx)
eCol = parent.XToCol(x + w + sx)
iPos = xPos = xCol = 99999
centerPos = x + sx + (w / 2)
for col in range(sCol,eCol + 1):
cx = parent.ColToRect(col)[0]
if abs(cx - centerPos) < iPos:
iPos = abs(cx - centerPos)
xCol = col
xPos = cx
if xCol < 0 or xCol > parent.GetNumberCols():
xCol = parent.GetNumberCols()
return (xPos - sx - x,xCol)
def GetInsertionColumn(self):
return self._GetInsertionInfo()[1]
def GetInsertionPos(self):
return self._GetInsertionInfo()[0]
def OnPaint(self,evt):
dc = wxPaintDC(self)
w,h = self.GetSize()
dc.DrawBitmap(self.image,0,0)
dc.SetPen(wxPen(wxBLACK,1,wxSOLID))
dc.SetBrush(wxTRANSPARENT_BRUSH)
dc.DrawRectangle(0,0,w,h)
iPos = self.GetInsertionPos()
dc.DrawLine(iPos,h - 10,iPos,h)
class RowDragWindow(wxWindow):
def __init__(self,parent,image,dragRow):
wxWindow.__init__(self,parent,wxSIMPLE_BORDER)
self.image = image
self.SetSize((self.image.GetWidth(),self.image.GetHeight()))
self.uy = parent.GetScrollPixelsPerUnit()[1]
self.moveRow = dragRow
EVT_PAINT(self,self.OnPaint)
def DisplayAt(self,x,pos):
y = self.GetPositionTuple()[1]
if y == pos:
self.Refresh() # Need to display insertion point
else:
self.MoveXY(x,pos)
def GetMoveRow(self):
return self.moveRow
def _GetInsertionInfo(self):
parent = self.GetParent()
sy = parent.GetViewStart()[1] * self.uy
sy -= parent._clSize
y = self.GetPositionTuple()[1]
h = self.GetSizeTuple()[1]
sRow = parent.YToRow(y + sy)
eRow = parent.YToRow(y + h + sy)
iPos = yPos = yRow = 99999
centerPos = y + sy + (h / 2)
for row in range(sRow,eRow + 1):
cy = parent.RowToRect(row)[1]
if abs(cy - centerPos) < iPos:
iPos = abs(cy - centerPos)
yRow = row
yPos = cy
if yRow < 0 or yRow > parent.GetNumberRows():
yRow = parent.GetNumberRows()
return (yPos - sy - y,yRow)
def GetInsertionRow(self):
return self._GetInsertionInfo()[1]
def GetInsertionPos(self):
return self._GetInsertionInfo()[0]
def OnPaint(self,evt):
dc = wxPaintDC(self)
w,h = self.GetSize()
dc.DrawBitmap(self.image,0,0)
dc.SetPen(wxPen(wxBLACK,1,wxSOLID))
dc.SetBrush(wxTRANSPARENT_BRUSH)
dc.DrawRectangle(0,0,w,h)
iPos = self.GetInsertionPos()
dc.DrawLine(w - 10,iPos,w,iPos)
#----------------------------------------------------------------------------
class wxGridColMover(wxEvtHandler):
def __init__(self,grid):
wxEvtHandler.__init__(self)
self.grid = grid
self.grid._rlSize = self.grid.GetRowLabelSize()
self.lwin = grid.GetGridColLabelWindow()
self.lwin.PushEventHandler(self)
self.colWin = None
self.ux = self.grid.GetScrollPixelsPerUnit()[0]
self.startX = -10
self.cellX = 0
self.didMove = False
self.isDragging = False
EVT_MOTION(self,self.OnMouseMove)
EVT_LEFT_DOWN(self,self.OnPress)
EVT_LEFT_UP(self,self.OnRelease)
def OnMouseMove(self,evt):
if self.isDragging:
if abs(self.startX - evt.m_x) >= 3:
self.didMove = True
sx,y = self.grid.GetViewStart()
w,h = self.lwin.GetClientSizeTuple()
x = sx * self.ux
if (evt.m_x + x) < x:
x = evt.m_x + x
elif evt.m_x > w:
x += evt.m_x - w
if x < 1: x = 0
else: x /= self.ux
if x != sx:
if wxPlatform == '__WXMSW__':
self.colWin.Show(False)
self.grid.Scroll(x,y)
x,y = self.lwin.ClientToScreenXY(evt.m_x,0)
x,y = self.grid.ScreenToClientXY(x,y)
if not self.colWin.IsShown():
self.colWin.Show(True)
px = x - self.cellX
if px < 0 + self.grid._rlSize: px = 0 + self.grid._rlSize
if px > w - self.colWin.GetSizeTuple()[0] + self.grid._rlSize:
px = w - self.colWin.GetSizeTuple()[0] + self.grid._rlSize
self.colWin.DisplayAt(px,y)
return
evt.Skip()
def OnPress(self,evt):
self.startX = evt.m_x
sx = self.grid.GetViewStart()[0] * self.ux
sx -= self.grid._rlSize
px,py = self.lwin.ClientToScreenXY(evt.m_x,evt.m_y)
px,py = self.grid.ScreenToClientXY(px,py)
if self.grid.XToEdgeOfCol(px + sx) != wxNOT_FOUND:
evt.Skip()
return
self.isDragging = True
self.didMove = False
col = self.grid.XToCol(px + sx)
rect = self.grid.ColToRect(col)
self.cellX = px + sx - rect.x
size = self.lwin.GetSizeTuple()
rect.y = 0
rect.x -= sx + self.grid._rlSize
rect.height = size[1]
colImg = self._CaptureImage(rect)
self.colWin = ColDragWindow(self.grid,colImg,col)
self.colWin.Show(False)
self.lwin.CaptureMouse()
def OnRelease(self,evt):
if self.isDragging:
self.lwin.ReleaseMouse()
self.colWin.Show(False)
self.isDragging = False
if not self.didMove:
px = self.lwin.ClientToScreenXY(self.startX,0)[0]
px = self.grid.ScreenToClientXY(px,0)[0]
sx = self.grid.GetViewStart()[0] * self.ux
sx -= self.grid._rlSize
col = self.grid.XToCol(px+sx)
if col != wxNOT_FOUND:
self.grid.SelectCol(col,evt.m_controlDown)
return
else:
bCol = self.colWin.GetInsertionColumn()
dCol = self.colWin.GetMoveColumn()
wxPostEvent(self,wxGridColMoveEvent(self.grid.GetId(),
dCol,bCol))
self.colWin.Destroy()
evt.Skip()
def _CaptureImage(self,rect):
bmp = wxEmptyBitmap(rect.width,rect.height)
memdc = wxMemoryDC()
memdc.SelectObject(bmp)
dc = wxWindowDC(self.lwin)
memdc.Blit(0,0,rect.width,rect.height,dc,rect.x,rect.y)
memdc.SelectObject(wxNullBitmap)
return bmp
class wxGridRowMover(wxEvtHandler):
def __init__(self,grid):
wxEvtHandler.__init__(self)
self.grid = grid
self.grid._clSize = self.grid.GetColLabelSize()
self.lwin = grid.GetGridRowLabelWindow()
self.lwin.PushEventHandler(self)
self.rowWin = None
self.uy = self.grid.GetScrollPixelsPerUnit()[1]
self.startY = -10
self.cellY = 0
self.didMove = False
self.isDragging = False
EVT_MOTION(self,self.OnMouseMove)
EVT_LEFT_DOWN(self,self.OnPress)
EVT_LEFT_UP(self,self.OnRelease)
def OnMouseMove(self,evt):
if self.isDragging:
if abs(self.startY - evt.m_y) >= 3:
self.didMove = True
x,sy = self.grid.GetViewStart()
w,h = self.lwin.GetClientSizeTuple()
y = sy * self.uy
if (evt.m_y + y) < y:
y = evt.m_y + y
elif evt.m_y > h:
y += evt.m_y - h
if y < 1: y = 0
else: y /= self.uy
if y != sy:
if wxPlatform == '__WXMSW__':
self.rowWin.Show(False)
self.grid.Scroll(x,y)
x,y = self.lwin.ClientToScreenXY(0,evt.m_y)
x,y = self.grid.ScreenToClientXY(x,y)
if not self.rowWin.IsShown():
self.rowWin.Show(True)
py = y - self.cellY
if py < 0 + self.grid._clSize: py = 0 + self.grid._clSize
if py > h - self.rowWin.GetSizeTuple()[1] + self.grid._clSize:
py = h - self.rowWin.GetSizeTuple()[1] + self.grid._clSize
self.rowWin.DisplayAt(x,py)
return
evt.Skip()
def OnPress(self,evt):
self.startY = evt.m_y
sy = self.grid.GetViewStart()[1] * self.uy
sy -= self.grid._clSize
px,py = self.lwin.ClientToScreenXY(evt.m_x,evt.m_y)
px,py = self.grid.ScreenToClientXY(px,py)
if self.grid.YToEdgeOfRow(py + sy) != wxNOT_FOUND:
evt.Skip()
return
self.isDragging = True
self.didMove = False
row = self.grid.YToRow(py + sy)
rect = self.grid.RowToRect(row)
self.cellY = py + sy - rect.y
size = self.lwin.GetSizeTuple()
rect.x = 0
rect.y -= sy + self.grid._clSize
rect.width = size[0]
rowImg = self._CaptureImage(rect)
self.rowWin = RowDragWindow(self.grid,rowImg,row)
self.rowWin.Show(False)
self.lwin.CaptureMouse()
def OnRelease(self,evt):
if self.isDragging:
self.lwin.ReleaseMouse()
self.rowWin.Show(False)
self.isDragging = False
if not self.didMove:
py = self.lwin.ClientToScreenXY(0,self.startY)[1]
py = self.grid.ScreenToClientXY(0,py)[1]
sy = self.grid.GetViewStart()[1] * self.uy
sy -= self.grid._clSize
row = self.grid.YToRow(py + sy)
if row != wxNOT_FOUND:
self.grid.SelectRow(row,evt.m_controlDown)
return
else:
bRow = self.rowWin.GetInsertionRow()
dRow = self.rowWin.GetMoveRow()
wxPostEvent(self,wxGridRowMoveEvent(self.grid.GetId(),
dRow,bRow))
self.rowWin.Destroy()
evt.Skip()
def _CaptureImage(self,rect):
bmp = wxEmptyBitmap(rect.width,rect.height)
memdc = wxMemoryDC()
memdc.SelectObject(bmp)
dc = wxWindowDC(self.lwin)
memdc.Blit(0,0,rect.width,rect.height,dc,rect.x,rect.y)
memdc.SelectObject(wxNullBitmap)
return bmp
#----------------------------------------------------------------------------

View File

@@ -126,8 +126,8 @@ class wxGridSizer(wxPySizer):
sz = self.GetSize()
pt = self.GetPosition()
w = (sz.width - (ncols - 1) * self.hgap) / ncols;
h = (sz.height - (nrows - 1) * self.vgap) / nrows;
w = (sz.width - (ncols - 1) * self.hgap) / ncols;
h = (sz.height - (nrows - 1) * self.vgap) / nrows;
x = pt.x
for c in range(ncols):

View File

@@ -14,10 +14,10 @@
# View "All Image" File Types as default filter
# Sort the file list
# Use newer "re" function for patterns
#---------------------------------------------------------------------------
import os, sys, string
import os, sys
from wxPython.wx import *
dir_path = os.getcwd()
@@ -29,8 +29,8 @@ def ConvertBMP(file_nm):
fl_fld = os.path.splitext(file_nm)
ext = fl_fld[1]
ext = string.lower(ext[1:])
if ext == 'bmp':
ext = ext[1:].lower()
if ext == 'bmp':
image = wxImage(file_nm, wxBITMAP_TYPE_BMP)
elif ext == 'gif':
image = wxImage(file_nm, wxBITMAP_TYPE_GIF)
@@ -93,31 +93,31 @@ class ImageView(wxWindow):
def DrawImage(self, dc):
try:
image = self.image
image = self.image
except:
return
self.DrawBorder(dc)
if image is None:
return
bmp = image.ConvertToBitmap()
iwidth = bmp.GetWidth() # dimensions of image file
iheight = bmp.GetHeight()
diffx = (self.image_sizex - iwidth)/2 # center calc
if iwidth >= self.image_sizex -10: # if image width fits in window adjust
diffx = 5
iwidth = self.image_sizex - 10
diffy = (self.image_sizey - iheight)/2 # center calc
if iheight >= self.image_sizey - 10: # if image height fits in window adjust
diffy = 5
iheight = self.image_sizey - 10
image.Rescale(iwidth, iheight) # rescale to fit the window
image.ConvertToBitmap()
image.ConvertToBitmap()
bmp = image.ConvertToBitmap()
dc.DrawBitmap(bmp, diffx, diffy) # draw the image to window
@@ -125,40 +125,40 @@ class ImageView(wxWindow):
class ImageDialog(wxDialog):
def __init__(self, parent, set_dir = None):
wxDialog.__init__(self, parent, -1, "Image Browser", wxPyDefaultPosition, wxSize(400, 400))
self.x_pos = 30 # initial display positions
self.y_pos = 20
self.delta = 20
self.delta = 20
size = wxSize(80, 25)
self.set_dir = os.getcwd()
if set_dir != None:
if os.path.exists(set_dir): # set to working directory if nothing set
self.set_dir = set_dir
self.dir_x = self.x_pos
self.dir_y = self.y_pos
self.DisplayDir() # display the directory value
self.y_pos = self.y_pos + self.delta
mID = NewId()
mID = wxNewId()
wxButton(self, mID, ' Set Directory ', wxPoint(self.x_pos, self.y_pos), size).SetDefault()
EVT_BUTTON(self, mID, self.SetDirect)
self.type_posy = self.y_pos # save the y position for the image type combo
self.type_posy = self.y_pos # save the y position for the image type combo
self.fl_ext = '*.bmp' # initial setting for file filtering
self.GetFiles() # get the file list
self.y_pos = self.y_pos + self.delta + 10
self.list_height = 150
# List of Labels
mID = NewId()
mID = wxNewId()
self.tb = tb = wxListBox(self, mID, wxPoint(self.x_pos, self.y_pos), wxSize(160, self.list_height), self.fl_list, wxLB_SINGLE)
EVT_LISTBOX(self, mID, self.OnListClick)
EVT_LISTBOX_DCLICK(self, mID, self.OnListDClick)
@@ -170,13 +170,13 @@ class ImageDialog(wxDialog):
image_sizey = self.list_height
self.fl_types = ["All Images", "Bmp", "Gif", "Png", "Jpg", "Ico", "Pnm", "Pcx", "Tif", "All Files"]
self.fl_ext_types = { "All Images": "All", "Bmp": "*.bmp", "Gif": "*.gif", "Png": "*.png", "Jpg": "*.jpg",
self.fl_ext_types = { "All Images": "All", "Bmp": "*.bmp", "Gif": "*.gif", "Png": "*.png", "Jpg": "*.jpg",
"Ico": "*.ico", "Pnm": "*.pnm", "Pcx": "*.pcx", "Tif": "*.tif", "All Files": "*.*" }
self.set_type = self.fl_types[0] # initial file filter setting
self.fl_ext = self.fl_ext_types[self.set_type]
mID = NewId()
mID = wxNewId()
self.sel_type = wxComboBox(self, mID, self.set_type, wxPoint(image_posx , self.type_posy), wxSize(150, -1), self.fl_types, wxCB_DROPDOWN)
EVT_COMBOBOX(self, mID, self.OnSetType)
@@ -184,7 +184,7 @@ class ImageDialog(wxDialog):
self.y_pos = self.y_pos + height + 20
mID = NewId()
mID = wxNewId()
wxButton(self, mID, ' Select ', wxPoint(100, self.y_pos), size).SetDefault()
EVT_BUTTON(self, mID, self.OnOk)
@@ -193,7 +193,7 @@ class ImageDialog(wxDialog):
self.y_pos = self.y_pos + self.delta
fsize = wxSize(400, self.y_pos + 50) # resize dialog for final vertical position
self.SetSize(fsize)
self.ResetFiles()
def GetFiles(self): # get the file list using directory and extension values
@@ -204,7 +204,7 @@ class ImageDialog(wxDialog):
self.fl_val = FindFiles(self, self.set_dir, filter)
all_files = all_files + self.fl_val.files # add to list of files
self.fl_list = all_files
else:
else:
self.fl_val = FindFiles(self, self.set_dir, self.fl_ext)
self.fl_list = self.fl_val.files
@@ -212,19 +212,19 @@ class ImageDialog(wxDialog):
def DisplayDir(self): # display the working directory
wxStaticText(self, -1, self.set_dir, wxPoint(self.dir_x, self.dir_y), wxSize(250, -1))
def OnSetType(self, event):
val = event.GetString() # get file type value
self.fl_ext = self.fl_ext_types[val]
self.ResetFiles()
self.ResetFiles()
def OnListDClick(self, event):
self.OnOk(0)
def OnListClick(self, event):
val = event.GetSelection()
self.SetListValue(val)
def SetListValue(self, val):
file_nm = self.fl_list[val]
self.set_file = file_val = os.path.join(self.set_dir, file_nm)
@@ -237,7 +237,7 @@ class ImageDialog(wxDialog):
self.set_dir = dlg.GetPath()
self.ResetFiles()
dlg.Destroy()
def ResetFiles(self): # refresh the display with files and initial image
self.DisplayDir()
self.GetFiles()
@@ -247,13 +247,13 @@ class ImageDialog(wxDialog):
self.SetListValue(0)
except:
self.image_view.SetValue(None)
def GetFile(self):
return self.set_file
def GetDirectory(self):
return self.set_dir
def OnCancel(self, event):
self.result = None
self.EndModal(wxID_CANCEL)
@@ -278,23 +278,23 @@ class FindFiles:
dirlist = [".."]
self.dir = dir
self.file = ""
mask = string.upper(mask)
mask = mask.upper()
pattern = self.MakeRegex(mask)
for i in os.listdir(dir):
if i == "." or i == "..":
continue
continue
path = os.path.join(dir, i)
path = string.upper(path)
value = string.upper(i)
path = path.upper()
value = i.upper()
if pattern.match(value) != None:
filelist.append(i)
self.files = filelist
self.files = filelist
def MakeRegex(self, pattern):
import re
f = "" # Set up a regex for file names
f = "" # Set up a regex for file names
for ch in pattern:
if ch == "*":
f = f + ".*"

View File

@@ -0,0 +1,45 @@
#----------------------------------------------------------------------
# Name: wxPython.lib.imageutils
# Purpose: A collection of functions for simple image manipulations
#
# Author: Robb Shecter
#
# Created: 7-Nov-2002
# RCS-ID: $Id$
# Copyright: (c) 2002 by
# Licence: wxWindows license
#----------------------------------------------------------------------
from __future__ import nested_scopes
def grayOut(anImage):
"""
Convert the given image (in place) to a grayed-out
version, appropriate for a 'disabled' appearance.
"""
factor = 0.7 # 0 < f < 1. Higher is grayer.
if anImage.HasMask():
maskColor = (anImage.GetMaskRed(), anImage.GetMaskGreen(), anImage.GetMaskBlue())
else:
maskColor = None
data = map(ord, list(anImage.GetData()))
for i in range(0, len(data), 3):
pixel = (data[i], data[i+1], data[i+2])
pixel = makeGray(pixel, factor, maskColor)
for x in range(3):
data[i+x] = pixel[x]
anImage.SetData(''.join(map(chr, data)))
def makeGray((r,g,b), factor, maskColor):
"""
Make a pixel grayed-out. If the pixel
matches the maskColor, it won't be
changed.
"""
if (r,g,b) != maskColor:
return map(lambda x: ((230 - x) * factor) + x, (r,g,b))
else:
return (r,g,b)

View File

@@ -121,7 +121,7 @@ see the appropriate "stub" file in the wxPython demo.
"""
from wxPython.wx import *
import string, sys, types, tempfile, os
import sys, tempfile, os
class _MyStatusBar(wxStatusBar):
def __init__(self, parent,callbacks=None,useopenbutton=0):
@@ -187,7 +187,7 @@ class _MyStatusBar(wxStatusBar):
self.button2.SetLabel ("Open New File")
self.useopenbutton = 1 - self.useopenbutton
self.OnSize("")
self.button2.Refresh(TRUE)
self.button2.Refresh(True)
self.Refresh()
@@ -269,7 +269,7 @@ class wxPyInformationalMessagesFrame:
useopenbutton=hasattr(self,
"nofile"))
self.frame.SetStatusBar(self.frame.sb)
self.frame.Show(true)
self.frame.Show(True)
EVT_CLOSE(self.frame, self.OnCloseWindow)
if hasattr(self,"nofile"):
@@ -341,7 +341,7 @@ class wxPyInformationalMessagesFrame:
if m is not None:# and m.__dict__.has_key("__debug__"):
m.__dict__["__debug__"] = 0
if self.frame is not None: # typically true, but, e.g., allows
if self.frame is not None: # typically True, but, e.g., allows
# DisableOutput method (which calls this
# one) to be called when the frame is not
# actually open, so that it is always safe

View File

@@ -0,0 +1,866 @@
#----------------------------------------------------------------------------
# Name: wxPython.lib.intctrl.py
# Author: Will Sadkin
# Created: 01/16/2003
# Copyright: (c) 2003 by Will Sadkin
# RCS-ID: $Id$
# License: wxWindows license
#----------------------------------------------------------------------------
# NOTE:
# This was written to provide a standard integer edit control for wxPython.
#
# wxIntCtrl permits integer (long) values to be retrieved or set via
# .GetValue() and .SetValue(), and provides an EVT_INT() event function
# for trapping changes to the control.
#
# It supports negative integers as well as the naturals, and does not
# permit leading zeros or an empty control; attempting to delete the
# contents of the control will result in a (selected) value of zero,
# thus preserving a legitimate integer value, or an empty control
# (if a value of None is allowed for the control.) Similarly, replacing the
# contents of the control with '-' will result in a selected (absolute)
# value of -1.
#
# wxIntCtrl also supports range limits, with the option of either
# enforcing them or simply coloring the text of the control if the limits
# are exceeded.
from wxPython.wx import *
import types, string
from sys import maxint
MAXINT = maxint # (constants should be in upper case)
MININT = -maxint-1
#----------------------------------------------------------------------------
wxEVT_COMMAND_INT_UPDATED = wxNewEventType()
# wxWindows' wxTextCtrl translates Composite "control key"
# events into single events before returning them to its OnChar
# routine. The doc says that this results in 1 for Ctrl-A, 2 for
# Ctrl-B, etc. However, there are no wxPython or wxWindows
# symbols for them, so I'm defining codes for Ctrl-X (cut) and
# Ctrl-V (paste) here for readability:
WXK_CTRL_X = (ord('X')+1) - ord('A')
WXK_CTRL_V = (ord('V')+1) - ord('A')
def EVT_INT(win, id, func):
"""Used to trap events indicating that the current
integer value of the control has been changed."""
win.Connect(id, -1, wxEVT_COMMAND_INT_UPDATED, func)
class wxIntUpdatedEvent(wxPyCommandEvent):
def __init__(self, id, value = 0, object=None):
wxPyCommandEvent.__init__(self, wxEVT_COMMAND_INT_UPDATED, id)
self.__value = value
self.SetEventObject(object)
def GetValue(self):
"""Retrieve the value of the control at the time
this event was generated."""
return self.__value
#----------------------------------------------------------------------------
class wxIntValidator( wxPyValidator ):
"""
Validator class used with wxIntCtrl; handles all validation of input
prior to changing the value of the underlying wxTextCtrl.
"""
def __init__(self):
wxPyValidator.__init__(self)
EVT_CHAR(self, self.OnChar)
def Clone (self):
return self.__class__()
def Validate(self, window): # window here is the *parent* of the ctrl
"""
Because each operation on the control is vetted as it's made,
the value of the control is always valid.
"""
return 1
def OnChar(self, event):
"""
Validates keystrokes to make sure the resulting value will a legal
value. Erasing the value causes it to be set to 0, with the value
selected, so it can be replaced. Similarly, replacing the value
with a '-' sign causes the value to become -1, with the value
selected. Leading zeros are removed if introduced by selection,
and are prevented from being inserted.
"""
key = event.KeyCode()
ctrl = event.GetEventObject()
value = ctrl.GetValue()
textval = wxTextCtrl.GetValue(ctrl)
allow_none = ctrl.IsNoneAllowed()
pos = ctrl.GetInsertionPoint()
sel_start, sel_to = ctrl.GetSelection()
select_len = sel_to - sel_start
# (Uncomment for debugging:)
## print 'keycode:', key
## print 'pos:', pos
## print 'sel_start, sel_to:', sel_start, sel_to
## print 'select_len:', select_len
## print 'textval:', textval
# set defaults for processing:
allow_event = 1
set_to_none = 0
set_to_zero = 0
set_to_minus_one = 0
paste = 0
internally_set = 0
new_value = value
new_text = textval
new_pos = pos
# Validate action, and predict resulting value, so we can
# range check the result and validate that too.
if key in (WXK_DELETE, WXK_BACK, WXK_CTRL_X):
if select_len:
new_text = textval[:sel_start] + textval[sel_to:]
elif key == WXK_DELETE and pos < len(textval):
new_text = textval[:pos] + textval[pos+1:]
elif key == WXK_BACK and pos > 0:
new_text = textval[:pos-1] + textval[pos:]
# (else value shouldn't change)
if new_text in ('', '-'):
# Deletion of last significant digit:
if allow_none and new_text == '':
new_value = None
set_to_none = 1
else:
new_value = 0
set_to_zero = 1
else:
try:
new_value = ctrl._fromGUI(new_text)
except ValueError:
allow_event = 0
elif key == WXK_CTRL_V: # (see comments at top of file)
# Only allow paste if number:
paste_text = ctrl._getClipboardContents()
new_text = textval[:sel_start] + paste_text + textval[sel_to:]
if new_text == '' and allow_none:
new_value = None
set_to_none = 1
else:
try:
# Convert the resulting strings, verifying they
# are legal integers and will fit in proper
# size if ctrl limited to int. (if not,
# disallow event.)
new_value = ctrl._fromGUI(new_text)
if paste_text:
paste_value = ctrl._fromGUI(paste_text)
else:
paste_value = 0
new_pos = sel_start + len(str(paste_value))
# if resulting value is 0, truncate and highlight value:
if new_value == 0 and len(new_text) > 1:
set_to_zero = 1
elif paste_value == 0:
# Disallow pasting a leading zero with nothing selected:
if( select_len == 0
and value is not None
and ( (value >= 0 and pos == 0)
or (value < 0 and pos in [0,1]) ) ):
allow_event = 0
paste = 1
except ValueError:
allow_event = 0
elif key < WXK_SPACE or key > 255:
pass # event ok
elif chr(key) == '-':
# Allow '-' to result in -1 if replacing entire contents:
if( value is None
or (value == 0 and pos == 0)
or (select_len >= len(str(abs(value)))) ):
new_value = -1
set_to_minus_one = 1
# else allow negative sign only at start, and only if
# number isn't already zero or negative:
elif pos != 0 or (value is not None and value < 0):
allow_event = 0
else:
new_text = '-' + textval
new_pos = 1
try:
new_value = ctrl._fromGUI(new_text)
except ValueError:
allow_event = 0
elif chr(key) in string.digits:
# disallow inserting a leading zero with nothing selected
if( chr(key) == '0'
and select_len == 0
and value is not None
and ( (value >= 0 and pos == 0)
or (value < 0 and pos in [0,1]) ) ):
allow_event = 0
# disallow inserting digits before the minus sign:
elif value is not None and value < 0 and pos == 0:
allow_event = 0
else:
new_text = textval[:sel_start] + chr(key) + textval[sel_to:]
try:
new_value = ctrl._fromGUI(new_text)
except ValueError:
allow_event = 0
else:
# not a legal char
allow_event = 0
if allow_event:
# Do range checking for new candidate value:
if ctrl.IsLimited() and not ctrl.IsInBounds(new_value):
allow_event = 0
elif new_value is not None:
# ensure resulting text doesn't result in a leading 0:
if not set_to_zero and not set_to_minus_one:
if( (new_value > 0 and new_text[0] == '0')
or (new_value < 0 and new_text[1] == '0')
or (new_value == 0 and select_len > 1 ) ):
# Allow replacement of leading chars with
# zero, but remove the leading zero, effectively
# making this like "remove leading digits"
# Account for leading zero when positioning cursor:
if( key == WXK_BACK
or (paste and paste_value == 0 and new_pos > 0) ):
new_pos = new_pos - 1
wxCallAfter(ctrl.SetValue, new_value)
wxCallAfter(ctrl.SetInsertionPoint, new_pos)
internally_set = 1
elif paste:
# Always do paste numerically, to remove
# leading/trailing spaces
wxCallAfter(ctrl.SetValue, new_value)
wxCallAfter(ctrl.SetInsertionPoint, new_pos)
internally_set = 1
elif (new_value == 0 and len(new_text) > 1 ):
allow_event = 0
if allow_event:
ctrl._colorValue(new_value) # (one way or t'other)
# (Uncomment for debugging:)
## if allow_event:
## print 'new value:', new_value
## if paste: print 'paste'
## if set_to_none: print 'set_to_none'
## if set_to_zero: print 'set_to_zero'
## if set_to_minus_one: print 'set_to_minus_one'
## if internally_set: print 'internally_set'
## else:
## print 'new text:', new_text
## print 'disallowed'
## print
if allow_event:
if set_to_none:
wxCallAfter(ctrl.SetValue, new_value)
elif set_to_zero:
# select to "empty" numeric value
wxCallAfter(ctrl.SetValue, new_value)
wxCallAfter(ctrl.SetInsertionPoint, 0)
wxCallAfter(ctrl.SetSelection, 0, 1)
elif set_to_minus_one:
wxCallAfter(ctrl.SetValue, new_value)
wxCallAfter(ctrl.SetInsertionPoint, 1)
wxCallAfter(ctrl.SetSelection, 1, 2)
elif not internally_set:
event.Skip() # allow base wxTextCtrl to finish processing
elif not wxValidator_IsSilent():
wxBell()
def TransferToWindow(self):
""" Transfer data from validator to window.
The default implementation returns False, indicating that an error
occurred. We simply return True, as we don't do any data transfer.
"""
return True # Prevent wxDialog from complaining.
def TransferFromWindow(self):
""" Transfer data from window to validator.
The default implementation returns False, indicating that an error
occurred. We simply return True, as we don't do any data transfer.
"""
return True # Prevent wxDialog from complaining.
#----------------------------------------------------------------------------
class wxIntCtrl(wxTextCtrl):
"""
This class provides a control that takes and returns integers as
value, and provides bounds support and optional value limiting.
wxIntCtrl(
parent, id = -1,
value = 0,
min = None,
max = None,
limited = False,
allow_none = False,
allow_long = False,
default_color = wxBLACK,
oob_color = wxRED,
pos = wxDefaultPosition,
size = wxDefaultSize,
style = 0,
name = "integer")
value
If no initial value is set, the default will be zero, or
the minimum value, if specified. If an illegal string is specified,
a ValueError will result. (You can always later set the initial
value with SetValue() after instantiation of the control.)
min
The minimum value that the control should allow. This can be
adjusted with SetMin(). If the control is not limited, any value
below this bound will be colored with the current out-of-bounds color.
If min < -sys.maxint-1 and the control is configured to not allow long
values, the minimum bound will still be set to the long value, but
the implicit bound will be -sys.maxint-1.
max
The maximum value that the control should allow. This can be
adjusted with SetMax(). If the control is not limited, any value
above this bound will be colored with the current out-of-bounds color.
if max > sys.maxint and the control is configured to not allow long
values, the maximum bound will still be set to the long value, but
the implicit bound will be sys.maxint.
limited
Boolean indicating whether the control prevents values from
exceeding the currently set minimum and maximum values (bounds).
If False and bounds are set, out-of-bounds values will
be colored with the current out-of-bounds color.
allow_none
Boolean indicating whether or not the control is allowed to be
empty, representing a value of None for the control.
allow_long
Boolean indicating whether or not the control is allowed to hold
and return a long as well as an int.
default_color
Color value used for in-bounds values of the control.
oob_color
Color value used for out-of-bounds values of the control
when the bounds are set but the control is not limited.
"""
def __init__ (
self, parent, id=-1,
value = 0, min=None, max=None,
limited = 0, allow_none = 0, allow_long = 0,
default_color = wxBLACK, oob_color = wxRED,
pos = wxDefaultPosition, size = wxDefaultSize,
style = 0, name = "integer",
):
# Establish attrs required for any operation on value:
self.__min = None
self.__max = None
self.__limited = 0
self.__default_color = wxBLACK
self.__oob_color = wxRED
self.__allow_none = 0
self.__allow_long = 0
wxTextCtrl.__init__(
self, parent, id, self._toGUI(0),
pos, size, style, wxIntValidator(), name )
# The following lets us set out our "integer update" events:
EVT_TEXT( self, self.GetId(), self.OnText )
# Establish parameters, with appropriate error checking
self.SetBounds(min, max)
self.SetLimited(limited)
self.SetColors(default_color, oob_color)
self.SetNoneAllowed(allow_none)
self.SetLongAllowed(allow_long)
self.SetValue(value)
def OnText( self, event ):
"""
Handles an event indicating that the text control's value
has changed, and issue EVT_INT event.
"""
try:
self.GetEventHandler().ProcessEvent(
wxIntUpdatedEvent( self.GetId(), self.GetValue(), self ) )
except ValueError:
return
# let normal processing of the text continue
event.Skip()
def GetValue(self):
"""
Returns the current integer (long) value of the control.
"""
return self._fromGUI( wxTextCtrl.GetValue(self) )
def SetValue(self, value):
"""
Sets the value of the control to the integer value specified.
The resulting actual value of the control may be altered to
conform with the bounds set on the control if limited,
or colored if not limited but the value is out-of-bounds.
A ValueError exception will be raised if an invalid value
is specified.
"""
wxTextCtrl.SetValue( self, self._toGUI(value) )
self._colorValue()
def SetMin(self, min=None):
"""
Sets the minimum value of the control. If a value of None
is provided, then the control will have no explicit minimum value.
If the value specified is greater than the current maximum value,
then the function returns 0 and the minimum will not change from
its current setting. On success, the function returns 1.
If successful and the current value is lower than the new lower
bound, if the control is limited, the value will be automatically
adjusted to the new minimum value; if not limited, the value in the
control will be colored with the current out-of-bounds color.
If min > -sys.maxint-1 and the control is configured to not allow longs,
the function will return 0, and the min will not be set.
"""
if( self.__max is None
or min is None
or (self.__max is not None and self.__max >= min) ):
self.__min = min
if self.IsLimited() and min is not None and self.GetValue() < min:
self.SetValue(min)
else:
self._colorValue()
return 1
else:
return 0
def GetMin(self):
"""
Gets the minimum value of the control. It will return the current
minimum integer, or None if not specified.
"""
return self.__min
def SetMax(self, max=None):
"""
Sets the maximum value of the control. If a value of None
is provided, then the control will have no explicit maximum value.
If the value specified is less than the current minimum value, then
the function returns 0 and the maximum will not change from its
current setting. On success, the function returns 1.
If successful and the current value is greater than the new upper
bound, if the control is limited the value will be automatically
adjusted to this maximum value; if not limited, the value in the
control will be colored with the current out-of-bounds color.
If max > sys.maxint and the control is configured to not allow longs,
the function will return 0, and the max will not be set.
"""
if( self.__min is None
or max is None
or (self.__min is not None and self.__min <= max) ):
self.__max = max
if self.IsLimited() and max is not None and self.GetValue() > max:
self.SetValue(max)
else:
self._colorValue()
return 1
else:
return 0
def GetMax(self):
"""
Gets the maximum value of the control. It will return the current
maximum integer, or None if not specified.
"""
return self.__max
def SetBounds(self, min=None, max=None):
"""
This function is a convenience function for setting the min and max
values at the same time. The function only applies the maximum bound
if setting the minimum bound is successful, and returns True
only if both operations succeed.
NOTE: leaving out an argument will remove the corresponding bound.
"""
ret = self.SetMin(min)
return ret and self.SetMax(max)
def GetBounds(self):
"""
This function returns a two-tuple (min,max), indicating the
current bounds of the control. Each value can be None if
that bound is not set.
"""
return (self.__min, self.__max)
def SetLimited(self, limited):
"""
If called with a value of True, this function will cause the control
to limit the value to fall within the bounds currently specified.
If the control's value currently exceeds the bounds, it will then
be limited accordingly.
If called with a value of 0, this function will disable value
limiting, but coloring of out-of-bounds values will still take
place if bounds have been set for the control.
"""
self.__limited = limited
if limited:
min = self.GetMin()
max = self.GetMax()
if not min is None and self.GetValue() < min:
self.SetValue(min)
elif not max is None and self.GetValue() > max:
self.SetValue(max)
else:
self._colorValue()
def IsLimited(self):
"""
Returns True if the control is currently limiting the
value to fall within the current bounds.
"""
return self.__limited
def IsInBounds(self, value=None):
"""
Returns True if no value is specified and the current value
of the control falls within the current bounds. This function can
also be called with a value to see if that value would fall within
the current bounds of the given control.
"""
if value is None:
value = self.GetValue()
if( not (value is None and self.IsNoneAllowed())
and type(value) not in (types.IntType, types.LongType) ):
raise ValueError (
'wxIntCtrl requires integer values, passed %s'% repr(value) )
min = self.GetMin()
max = self.GetMax()
if min is None: min = value
if max is None: max = value
# if bounds set, and value is None, return False
if value == None and (min is not None or max is not None):
return 0
else:
return min <= value <= max
def SetNoneAllowed(self, allow_none):
"""
Change the behavior of the validation code, allowing control
to have a value of None or not, as appropriate. If the value
of the control is currently None, and allow_none is 0, the
value of the control will be set to the minimum value of the
control, or 0 if no lower bound is set.
"""
self.__allow_none = allow_none
if not allow_none and self.GetValue() is None:
min = self.GetMin()
if min is not None: self.SetValue(min)
else: self.SetValue(0)
def IsNoneAllowed(self):
return self.__allow_none
def SetLongAllowed(self, allow_long):
"""
Change the behavior of the validation code, allowing control
to have a long value or not, as appropriate. If the value
of the control is currently long, and allow_long is 0, the
value of the control will be adjusted to fall within the
size of an integer type, at either the sys.maxint or -sys.maxint-1,
for positive and negative values, respectively.
"""
current_value = self.GetValue()
if not allow_long and type(current_value) is types.LongType:
if current_value > 0:
self.SetValue(MAXINT)
else:
self.SetValue(MININT)
self.__allow_long = allow_long
def IsLongAllowed(self):
return self.__allow_long
def SetColors(self, default_color=wxBLACK, oob_color=wxRED):
"""
Tells the control what colors to use for normal and out-of-bounds
values. If the value currently exceeds the bounds, it will be
recolored accordingly.
"""
self.__default_color = default_color
self.__oob_color = oob_color
self._colorValue()
def GetColors(self):
"""
Returns a tuple of (default_color, oob_color), indicating
the current color settings for the control.
"""
return self.__default_color, self.__oob_color
def _colorValue(self, value=None):
"""
Colors text with oob_color if current value exceeds bounds
set for control.
"""
if not self.IsInBounds(value):
self.SetForegroundColour(self.__oob_color)
else:
self.SetForegroundColour(self.__default_color)
self.Refresh()
def _toGUI( self, value ):
"""
Conversion function used to set the value of the control; does
type and bounds checking and raises ValueError if argument is
not a valid value.
"""
if value is None and self.IsNoneAllowed():
return ''
elif type(value) == types.LongType and not self.IsLongAllowed():
raise ValueError (
'wxIntCtrl requires integer value, passed long' )
elif type(value) not in (types.IntType, types.LongType):
raise ValueError (
'wxIntCtrl requires integer value, passed %s'% repr(value) )
elif self.IsLimited():
min = self.GetMin()
max = self.GetMax()
if not min is None and value < min:
raise ValueError (
'value is below minimum value of control %d'% value )
if not max is None and value > max:
raise ValueError (
'value exceeds value of control %d'% value )
return str(value)
def _fromGUI( self, value ):
"""
Conversion function used in getting the value of the control.
"""
if value == '':
if not self.IsNoneAllowed():
return 0
else:
return None
else:
try:
return int( value )
except ValueError:
if self.IsLongAllowed():
return long( value )
else:
raise
def Cut( self ):
"""
Override the wxTextCtrl's .Cut function, with our own
that does validation. Will result in a value of 0
if entire contents of control are removed.
"""
sel_start, sel_to = self.GetSelection()
select_len = sel_to - sel_start
textval = wxTextCtrl.GetValue(self)
do = wxTextDataObject()
do.SetText(textval[sel_start:sel_to])
wxTheClipboard.Open()
wxTheClipboard.SetData(do)
wxTheClipboard.Close()
if select_len == len(wxTextCtrl.GetValue(self)):
if not self.IsNoneAllowed():
self.SetValue(0)
self.SetInsertionPoint(0)
self.SetSelection(0,1)
else:
self.SetValue(None)
else:
new_value = self._fromGUI(textval[:sel_start] + textval[sel_to:])
self.SetValue(new_value)
def _getClipboardContents( self ):
"""
Subroutine for getting the current contents of the clipboard.
"""
do = wxTextDataObject()
wxTheClipboard.Open()
success = wxTheClipboard.GetData(do)
wxTheClipboard.Close()
if not success:
return None
else:
# Remove leading and trailing spaces before evaluating contents
return do.GetText().strip()
def Paste( self ):
"""
Override the wxTextCtrl's .Paste function, with our own
that does validation. Will raise ValueError if not a
valid integerizable value.
"""
paste_text = self._getClipboardContents()
if paste_text:
# (conversion will raise ValueError if paste isn't legal)
sel_start, sel_to = self.GetSelection()
text = wxTextCtrl.GetValue( self )
new_text = text[:sel_start] + paste_text + text[sel_to:]
if new_text == '' and self.IsNoneAllowed():
self.SetValue(None)
else:
value = self._fromGUI(new_text)
self.SetValue(value)
new_pos = sel_start + len(paste_text)
wxCallAfter(self.SetInsertionPoint, new_pos)
#===========================================================================
if __name__ == '__main__':
import traceback
class myDialog(wxDialog):
def __init__(self, parent, id, title,
pos = wxPyDefaultPosition, size = wxPyDefaultSize,
style = wxDEFAULT_DIALOG_STYLE ):
wxDialog.__init__(self, parent, id, title, pos, size, style)
self.int_ctrl = wxIntCtrl(self, NewId(), size=(55,20))
self.OK = wxButton( self, wxID_OK, "OK")
self.Cancel = wxButton( self, wxID_CANCEL, "Cancel")
vs = wxBoxSizer( wxVERTICAL )
vs.AddWindow( self.int_ctrl, 0, wxALIGN_CENTRE|wxALL, 5 )
hs = wxBoxSizer( wxHORIZONTAL )
hs.AddWindow( self.OK, 0, wxALIGN_CENTRE|wxALL, 5 )
hs.AddWindow( self.Cancel, 0, wxALIGN_CENTRE|wxALL, 5 )
vs.AddSizer(hs, 0, wxALIGN_CENTRE|wxALL, 5 )
self.SetAutoLayout( True )
self.SetSizer( vs )
vs.Fit( self )
vs.SetSizeHints( self )
EVT_INT(self, self.int_ctrl.GetId(), self.OnInt)
def OnInt(self, event):
print 'int now', event.GetValue()
class TestApp(wxApp):
def OnInit(self):
try:
self.frame = wxFrame(NULL, -1, "Test",
wxPoint(20,20), wxSize(120,100) )
self.panel = wxPanel(self.frame, -1)
button = wxButton(self.panel, 10, "Push Me",
wxPoint(20, 20))
EVT_BUTTON(self, 10, self.OnClick)
except:
traceback.print_exc()
return False
return True
def OnClick(self, event):
dlg = myDialog(self.panel, -1, "test wxIntCtrl")
dlg.int_ctrl.SetValue(501)
dlg.int_ctrl.SetInsertionPoint(1)
dlg.int_ctrl.SetSelection(1,2)
rc = dlg.ShowModal()
print 'final value', dlg.int_ctrl.GetValue()
del dlg
self.frame.Destroy()
def Show(self):
self.frame.Show(True)
try:
app = TestApp(0)
app.Show()
app.MainLoop()
except:
traceback.print_exc()

View File

@@ -1,7 +1,7 @@
from wxPython.wx import wxLayoutConstraints,\
wxTop, wxLeft, wxBottom, wxRight, \
wxHeight, wxWidth, wxCentreX, wxCentreY
import re,string
import re
class Layoutf(wxLayoutConstraints):
"""
@@ -130,8 +130,8 @@ time of this writing not documented.
self.pack(pstr,winlist)
def pack(self, pstr, winlist):
pstr = string.lower(pstr)
for item in string.split(pstr,';'):
pstr = pstr.lower()
for item in pstr.split(';'):
m = self.rexp1.match(item)
if m:
g = list(m.groups())
@@ -159,8 +159,8 @@ time of this writing not documented.
else: func(winlist[g[4]], cmp)
def debug_pack(self, pstr, winlist):
pstr = string.lower(pstr)
for item in string.split(pstr,';'):
pstr = pstr.lower()
for item in pstr.split(';'):
m = self.rexp1.match(item)
if m:
g = list(m.groups())
@@ -202,7 +202,7 @@ if __name__=='__main__':
wxPyDefaultPosition, wxSize(500, 300))
EVT_CLOSE(self, self.OnCloseWindow)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
EVT_BUTTON(self, 100, self.OnButton)
EVT_BUTTON(self, 101, self.OnAbout)
@@ -234,7 +234,7 @@ if __name__=='__main__':
wxStaticText(self.panelD, -1, "Panel D", wxPoint(4, 4)).SetBackgroundColour(wxGREEN)
def OnButton(self, event):
self.Close(true)
self.Close(True)
def OnAbout(self, event):
try:

View File

@@ -11,6 +11,7 @@
#----------------------------------------------------------------------------
from wxPython.wx import *
import locale
#----------------------------------------------------------------------------
@@ -105,7 +106,12 @@ class wxColumnSorterMixin:
item1 = self.itemDataMap[key1][col]
item2 = self.itemDataMap[key2][col]
cmpVal = cmp(item1, item2)
#--- Internationalization of string sorting with locale module
if type(item1) == type('') or type(item2) == type(''):
cmpVal = locale.strcoll(str(item1), str(item2))
else:
cmpVal = cmp(item1, item2)
#---
# If the items are equal then pick something else to make the sort value unique
if cmpVal == 0:
@@ -132,137 +138,102 @@ class wxColumnSorterMixin:
class wxListCtrlAutoWidthMixin:
""" A mix-in class that automatically resizes the last column to take up
the remaining width of the wxListCtrl.
the remaining width of the wxListCtrl.
This causes the wxListCtrl to automatically take up the full width of
the list, without either a horizontal scroll bar (unless absolutely
necessary) or empty space to the right of the last column.
This causes the wxListCtrl to automatically take up the full width of
the list, without either a horizontal scroll bar (unless absolutely
necessary) or empty space to the right of the last column.
NOTE: This only works for report-style lists.
NOTE: This only works for report-style lists.
WARNING: If you override the EVT_SIZE event in your wxListCtrl, make
sure you call event.Skip() to ensure that the mixin's
_OnResize method is called.
WARNING: If you override the EVT_SIZE event in your wxListCtrl, make
sure you call event.Skip() to ensure that the mixin's
_OnResize method is called.
This mix-in class was written by Erik Westra <ewestra@wave.co.nz>
This mix-in class was written by Erik Westra <ewestra@wave.co.nz>
"""
def __init__(self):
""" Standard initialiser.
"""
self._needResize = false
self._lastColMinWidth = None
""" Standard initialiser.
"""
self._lastColMinWidth = None
EVT_SIZE(self, self._onResize)
EVT_LIST_COL_END_DRAG(self, self.GetId(), self._onEndColDrag)
EVT_IDLE(self, self._onIdle)
EVT_SIZE(self, self._onResize)
EVT_LIST_COL_END_DRAG(self, self.GetId(), self._onResize)
def resizeLastColumn(self, minWidth):
""" Resize the last column appropriately.
""" Resize the last column appropriately.
If the list's columns are too wide to fit within the window, we use
a horizontal scrollbar. Otherwise, we expand the right-most column
to take up the remaining free space in the list.
If the list's columns are too wide to fit within the window, we use
a horizontal scrollbar. Otherwise, we expand the right-most column
to take up the remaining free space in the list.
This method is called automatically when the wxListCtrl is resized;
you can also call it yourself whenever you want the last column to
be resized appropriately (eg, when adding, removing or resizing
columns).
This method is called automatically when the wxListCtrl is resized;
you can also call it yourself whenever you want the last column to
be resized appropriately (eg, when adding, removing or resizing
columns).
'minWidth' is the preferred minimum width for the last column.
"""
self._lastColMinWidth = minWidth
self._doResize()
'minWidth' is the preferred minimum width for the last column.
"""
self._lastColMinWidth = minWidth
self._doResize()
# =====================
# == Private Methods ==
# =====================
def _onResize(self, event):
""" Respond to the wxListCtrl being resized.
""" Respond to the wxListCtrl being resized.
We automatically resize the last column in the list.
"""
self._doResize()
event.Skip()
def _onEndColDrag(self, event):
""" Respond to the user resizing one of our columns.
We resize the last column in the list to match. Note that, because
of a quirk in the way columns are resized under MS Windows, we
actually have to do the column resize in idle time.
"""
self._needResize = true
event.Skip()
def _onIdle(self, event):
""" Respond to an idle event.
We resize the last column, if we've been asked to do so.
"""
if self._needResize:
self._doResize()
self.Refresh() # Fixes redraw problem under MS Windows.
self._needResize = false
We automatically resize the last column in the list.
"""
wxCallAfter(self._doResize)
event.Skip()
def _doResize(self):
""" Resize the last column as appropriate.
""" Resize the last column as appropriate.
If the list's columns are too wide to fit within the window, we use
a horizontal scrollbar. Otherwise, we expand the right-most column
to take up the remaining free space in the list.
If the list's columns are too wide to fit within the window, we use
a horizontal scrollbar. Otherwise, we expand the right-most column
to take up the remaining free space in the list.
We remember the current size of the last column, before resizing,
as the preferred minimum width if we haven't previously been given
or calculated a minimum width. This ensure that repeated calls to
_doResize() don't cause the last column to size itself too large.
"""
numCols = self.GetColumnCount()
if numCols == 0: return # Nothing to resize.
We remember the current size of the last column, before resizing,
as the preferred minimum width if we haven't previously been given
or calculated a minimum width. This ensure that repeated calls to
_doResize() don't cause the last column to size itself too large.
"""
numCols = self.GetColumnCount()
if numCols == 0: return # Nothing to resize.
if self._lastColMinWidth == None:
self._lastColMinWidth = self.GetColumnWidth(numCols - 1)
if self._lastColMinWidth == None:
self._lastColMinWidth = self.GetColumnWidth(numCols - 1)
listWidth = self.GetSize().width
if self.GetItemCount() > self.GetCountPerPage():
# We're showing the vertical scrollbar -> allow for scrollbar width
scrollWidth = wxSystemSettings_GetSystemMetric(wxSYS_VSCROLL_X)
listWidth = listWidth - scrollWidth
# We're showing the vertical scrollbar -> allow for scrollbar width
# NOTE: on GTK, the scrollbar is included in the client size, but on
# Windows it is not included
listWidth = self.GetClientSize().width
if wxPlatform != '__WXMSW__':
if self.GetItemCount() > self.GetCountPerPage():
scrollWidth = wxSystemSettings_GetSystemMetric(wxSYS_VSCROLL_X)
listWidth = listWidth - scrollWidth
totColWidth = 0 # Width of all columns except last one.
for col in range(numCols-1):
totColWidth = totColWidth + self.GetColumnWidth(col)
totColWidth = 0 # Width of all columns except last one.
for col in range(numCols-1):
totColWidth = totColWidth + self.GetColumnWidth(col)
lastColWidth = self.GetColumnWidth(numCols - 1)
lastColWidth = self.GetColumnWidth(numCols - 1)
# NOTE: This is the extra number of pixels required to make the
# wxListCtrl size correctly, at least under Windows 2000.
# Unfortunately, different OSs and even different versions of the
# same OS may implement the wxListCtrl differently, so different
# margins may be needed to get the columns resized correctly. No
# doubt the margin could be calculated in a more intelligent
# manner...
if wxPlatform == '__WXMSW__':
margin = 6
elif wxPlatform == '__WXGTK__':
margin = 8
else:
margin = 0
if totColWidth + self._lastColMinWidth > listWidth:
# We haven't got the width to show the last column at its minimum
# width -> set it to its minimum width and allow the horizontal
# scrollbar to show.
self.SetColumnWidth(numCols-1, self._lastColMinWidth)
return
if totColWidth + self._lastColMinWidth > listWidth - margin:
# We haven't got the width to show the last column at its minimum
# width -> set it to its minimum width and allow the horizontal
# scrollbar to show.
self.SetColumnWidth(numCols-1, self._lastColMinWidth)
return
# Resize the last column to take up the remaining available space.
# Resize the last column to take up the remaining available space.
self.SetColumnWidth(numCols-1, listWidth - totColWidth - margin)
self.SetColumnWidth(numCols-1, listWidth - totColWidth)

View File

@@ -0,0 +1,389 @@
"""
A mixin class for doing "RubberBand"-ing on a window.
by "Robb Shecter" <rs@onsitetech.com>
$Id$
"""
from wxPython.wx import *
import Image
#
# Some miscellaneous mathematical and geometrical functions
#
def isNegative(aNumber):
"""
x < 0: 1
else: 0
"""
return aNumber < 0
def normalizeBox(box):
"""
Convert any negative measurements in the current
box to positive, and adjust the origin.
"""
x, y, w, h = box
if w < 0:
x += (w+1)
w *= -1
if h < 0:
y += (h+1)
h *= -1
return (x, y, w, h)
def boxToExtent(box):
"""
Convert a box specification to an extent specification.
I put this into a seperate function after I realized that
I had been implementing it wrong in several places.
"""
b = normalizeBox(box)
return (b[0], b[1], b[0]+b[2]-1, b[1]+b[3]-1)
def pointInBox(x, y, box):
"""
Return True if the given point is contained in the box.
"""
e = boxToExtent(box)
return x >= e[0] and x <= e[2] and y >= e[1] and y <= e[3]
def pointOnBox(x, y, box, thickness=1):
"""
Return True if the point is on the outside edge
of the box. The thickness defines how thick the
edge should be. This is necessary for HCI reasons:
For example, it's normally very difficult for a user
to manuever the mouse onto a one pixel border.
"""
outerBox = box
innerBox = (box[0]+thickness, box[1]+thickness, box[2]-(thickness*2), box[3]-(thickness*2))
return pointInBox(x, y, outerBox) and not pointInBox(x, y, innerBox)
def getCursorPosition(x, y, box, thickness=1):
"""
Return a position number in the range 0 .. 7 to indicate
where on the box border the point is. The layout is:
0 1 2
7 3
6 5 4
"""
x0, y0, x1, y1 = boxToExtent(box)
w, h = box[2], box[3]
delta = thickness - 1
p = None
if pointInBox(x, y, (x0, y0, thickness, thickness)):
p = 0
elif pointInBox(x, y, (x1-delta, y0, thickness, thickness)):
p = 2
elif pointInBox(x, y, (x1-delta, y1-delta, thickness, thickness)):
p = 4
elif pointInBox(x, y, (x0, y1-delta, thickness, thickness)):
p = 6
elif pointInBox(x, y, (x0+thickness, y0, w-(thickness*2), thickness)):
p = 1
elif pointInBox(x, y, (x1-delta, y0+thickness, thickness, h-(thickness*2))):
p = 3
elif pointInBox(x, y, (x0+thickness, y1-delta, w-(thickness*2), thickness)):
p = 5
elif pointInBox(x, y, (x0, y0+thickness, thickness, h-(thickness*2))):
p = 7
return p
class RubberBand:
"""
A stretchable border which is drawn on top of an
image to define an area.
"""
def __init__(self, drawingSurface, aspectRatio=None):
self.__THICKNESS = 5
self.drawingSurface = drawingSurface
self.aspectRatio = aspectRatio
self.hasLetUp = 0
self.currentlyMoving = None
self.currentBox = None
self.__enabled = 1
self.__currentCursor = None
EVT_MOUSE_EVENTS(drawingSurface, self.__handleMouseEvents)
EVT_PAINT(drawingSurface, self.__handleOnPaint)
def __setEnabled(self, enabled):
self.__enabled = enabled
def __isEnabled(self):
return self.__enabled
def __handleOnPaint(self, event):
#print 'paint'
event.Skip()
def __isMovingCursor(self):
"""
Return True if the current cursor is one used to
mean moving the rubberband.
"""
return self.__currentCursor == wxCURSOR_HAND
def __isSizingCursor(self):
"""
Return True if the current cursor is one of the ones
I may use to signify sizing.
"""
sizingCursors = [wxCURSOR_SIZENESW,
wxCURSOR_SIZENS,
wxCURSOR_SIZENWSE,
wxCURSOR_SIZEWE,
wxCURSOR_SIZING,
wxCURSOR_CROSS]
try:
sizingCursors.index(self.__currentCursor)
return 1
except ValueError:
return 0
def __handleMouseEvents(self, event):
"""
React according to the new event. This is the main
entry point into the class. This method contains the
logic for the class's behavior.
"""
if not self.enabled:
return
x, y = event.GetPosition()
# First make sure we have started a box.
if self.currentBox == None and not event.LeftDown():
# No box started yet. Set cursor to the initial kind.
self.__setCursor(wxCURSOR_CROSS)
return
if event.LeftDown():
if self.currentBox == None:
# No RB Box, so start a new one.
self.currentBox = (x, y, 0, 0)
self.hasLetUp = 0
elif self.__isSizingCursor():
# Starting a sizing operation. Change the origin.
position = getCursorPosition(x, y, self.currentBox, thickness=self.__THICKNESS)
self.currentBox = self.__denormalizeBox(position, self.currentBox)
elif event.Dragging() and event.LeftIsDown():
# Use the cursor type to determine operation
if self.__isMovingCursor():
if self.currentlyMoving or pointInBox(x, y, self.currentBox):
if not self.currentlyMoving:
self.currentlyMoving = (x - self.currentBox[0], y - self.currentBox[1])
self.__moveTo(x - self.currentlyMoving[0], y - self.currentlyMoving[1])
elif self.__isSizingCursor():
self.__resizeBox(x, y)
elif event.LeftUp():
self.hasLetUp = 1
self.currentlyMoving = None
self.__normalizeBox()
elif event.Moving() and not event.Dragging():
# Simple mouse movement event
self.__mouseMoved(x,y)
def __denormalizeBox(self, position, box):
x, y, w, h = box
b = box
if position == 2 or position == 3:
b = (x, y + (h-1), w, h * -1)
elif position == 0 or position == 1 or position == 7:
b = (x + (w-1), y + (h-1), w * -1, h * -1)
elif position == 6:
b = (x + (w-1), y, w * -1, h)
return b
def __resizeBox(self, x, y):
"""
Resize and repaint the box based on the given mouse
coordinates.
"""
# Implement the correct behavior for dragging a side
# of the box: Only change one dimension.
if not self.aspectRatio:
if self.__currentCursor == wxCURSOR_SIZENS:
x = None
elif self.__currentCursor == wxCURSOR_SIZEWE:
y = None
x0,y0,w0,h0 = self.currentBox
currentExtent = boxToExtent(self.currentBox)
if x == None:
if w0 < 1:
w0 += 1
else:
w0 -= 1
x = x0 + w0
if y == None:
if h0 < 1:
h0 += 1
else:
h0 -= 1
y = y0 + h0
x1,y1 = x, y
w, h = abs(x1-x0)+1, abs(y1-y0)+1
if self.aspectRatio:
w = max(w, int(h * self.aspectRatio))
h = int(w / self.aspectRatio)
w *= [1,-1][isNegative(x1-x0)]
h *= [1,-1][isNegative(y1-y0)]
newbox = (x0, y0, w, h)
self.__drawAndErase(boxToDraw=normalizeBox(newbox), boxToErase=normalizeBox(self.currentBox))
self.currentBox = (x0, y0, w, h)
def __normalizeBox(self):
"""
Convert any negative measurements in the current
box to positive, and adjust the origin.
"""
self.currentBox = normalizeBox(self.currentBox)
def __mouseMoved(self, x, y):
"""
Called when the mouse moved without any buttons pressed
or dragging being done.
"""
# Are we on the bounding box?
if pointOnBox(x, y, self.currentBox, thickness=self.__THICKNESS):
position = getCursorPosition(x, y, self.currentBox, thickness=self.__THICKNESS)
cursor = [
wxCURSOR_SIZENWSE,
wxCURSOR_SIZENS,
wxCURSOR_SIZENESW,
wxCURSOR_SIZEWE,
wxCURSOR_SIZENWSE,
wxCURSOR_SIZENS,
wxCURSOR_SIZENESW,
wxCURSOR_SIZEWE
] [position]
self.__setCursor(cursor)
elif pointInBox(x, y, self.currentBox):
self.__setCursor(wxCURSOR_HAND)
else:
self.__setCursor()
def __setCursor(self, id=None):
"""
Set the mouse cursor to the given id.
"""
if self.__currentCursor != id: # Avoid redundant calls
if id:
self.drawingSurface.SetCursor(wxStockCursor(id))
else:
self.drawingSurface.SetCursor(wxNullCursor)
self.__currentCursor = id
def __moveCenterTo(self, x, y):
"""
Move the rubber band so that its center is at (x,y).
"""
x0, y0, w, h = self.currentBox
x2, y2 = x - (w/2), y - (h/2)
self.__moveTo(x2, y2)
def __moveTo(self, x, y):
"""
Move the rubber band so that its origin is at (x,y).
"""
newbox = (x, y, self.currentBox[2], self.currentBox[3])
self.__drawAndErase(boxToDraw=newbox, boxToErase=self.currentBox)
self.currentBox = newbox
def __drawAndErase(self, boxToDraw, boxToErase=None):
"""
Draw one box shape and possibly erase another.
"""
dc = wxClientDC(self.drawingSurface)
dc.BeginDrawing()
dc.SetPen(wxPen(wxWHITE, 1, wxDOT))
dc.SetBrush(wxTRANSPARENT_BRUSH)
dc.SetLogicalFunction(wxXOR)
if boxToErase:
dc.DrawRectangle(*boxToErase)
dc.DrawRectangle(*boxToDraw)
dc.EndDrawing()
def __dumpMouseEvent(self, event):
print 'Moving: ',event.Moving()
print 'Dragging: ',event.Dragging()
print 'LeftDown: ',event.LeftDown()
print 'LeftisDown: ',event.LeftIsDown()
print 'LeftUp: ',event.LeftUp()
print 'Position: ',event.GetPosition()
print 'x,y: ',event.GetX(),event.GetY()
print
#
# The public API:
#
def reset(self, aspectRatio=None):
"""
Clear the existing rubberband
"""
self.currentBox = None
self.aspectRatio = aspectRatio
self.drawingSurface.Refresh()
def getCurrentExtent(self):
"""
Return (x0, y0, x1, y1) or None if
no drawing has yet been done.
"""
if not self.currentBox:
extent = None
else:
extent = boxToExtent(self.currentBox)
return extent
enabled = property(__isEnabled, __setEnabled, None, 'True if I am responding to mouse events')
if __name__ == '__main__':
app = wxPySimpleApp()
frame = wxFrame(None, -1, title='RubberBand Test', size=(300,300))
# Add a panel that the rubberband will work on.
panel = wxPanel(frame, -1)
panel.SetBackgroundColour(wxBLUE)
# Create the rubberband
frame.rubberBand = RubberBand(drawingSurface=panel)
frame.rubberBand.reset(aspectRatio=0.5)
# Add a button that creates a new rubberband
def __newRubberBand(event):
frame.rubberBand.reset()
button = wxButton(frame, 100, 'Reset Rubberband')
EVT_BUTTON(frame, 100, __newRubberBand)
# Layout the frame
sizer = wxBoxSizer(wxVERTICAL)
sizer.Add(panel, 1, wxEXPAND | wxALL, 5)
sizer.Add(button, 0, wxALIGN_CENTER | wxALL, 5)
frame.SetAutoLayout(1)
frame.SetSizer(sizer)
frame.Show(1)
app.MainLoop()

View File

@@ -0,0 +1,726 @@
#----------------------------------------------------------------------
# Name: multisash
# Purpose: Multi Sash control
#
# Author: Gerrit van Dyk
#
# Created: 2002/11/20
# Version: 0.1
# RCS-ID: $Id$
# License: wxWindows licensie
#----------------------------------------------------------------------
from wxPython.wx import *
MV_HOR = 0
MV_VER = not MV_HOR
SH_SIZE = 5
CR_SIZE = SH_SIZE * 3
#----------------------------------------------------------------------
class wxMultiSash(wxWindow):
def __init__(self, *_args,**_kwargs):
apply(wxWindow.__init__,(self,) + _args,_kwargs)
self._defChild = EmptyChild
self.child = wxMultiSplit(self,self,wxPoint(0,0),self.GetSize())
EVT_SIZE(self,self.OnMultiSize)
def SetDefaultChildClass(self,childCls):
self._defChild = childCls
self.child.DefaultChildChanged()
def OnMultiSize(self,evt):
self.child.SetSize(self.GetSize())
def UnSelect(self):
self.child.UnSelect()
def Clear(self):
old = self.child
self.child = wxMultiSplit(self,self,wxPoint(0,0),self.GetSize())
old.Destroy()
self.child.OnSize(None)
def GetSaveData(self):
saveData = {}
saveData['_defChild'] = str(self._defChild)
saveData['child'] = self.child.GetSaveData()
return saveData
def SetSaveData(self,data):
dChild = data['_defChild']
mod = dChild.split('.')[0]
exec 'import %s' % mod
self._defChild = eval(dChild)
old = self.child
self.child = wxMultiSplit(self,self,wxPoint(0,0),self.GetSize())
self.child.SetSaveData(data['child'])
old.Destroy()
self.OnMultiSize(None)
self.child.OnSize(None)
#----------------------------------------------------------------------
class wxMultiSplit(wxWindow):
def __init__(self,multiView,parent,pos,size,view1 = None):
wxWindow.__init__(self,id = -1,parent = parent,pos = pos,size = size,
style = wxCLIP_CHILDREN)
self.multiView = multiView
self.view2 = None
if view1:
self.view1 = view1
self.view1.Reparent(self)
self.view1.MoveXY(0,0)
else:
self.view1 = wxMultiViewLeaf(self.multiView,self,
wxPoint(0,0),self.GetSize())
self.direction = None
EVT_SIZE(self,self.OnSize)
def GetSaveData(self):
saveData = {}
if self.view1:
saveData['view1'] = self.view1.GetSaveData()
if isinstance(self.view1,wxMultiSplit):
saveData['view1IsSplit'] = 1
if self.view2:
saveData['view2'] = self.view2.GetSaveData()
if isinstance(self.view2,wxMultiSplit):
saveData['view2IsSplit'] = 1
saveData['direction'] = self.direction
v1,v2 = self.GetPositionTuple()
saveData['x'] = v1
saveData['y'] = v2
v1,v2 = self.GetSizeTuple()
saveData['w'] = v1
saveData['h'] = v2
return saveData
def SetSaveData(self,data):
self.direction = data['direction']
self.SetDimensions(data['x'],data['y'],data['w'],data['h'])
v1Data = data.get('view1',None)
if v1Data:
isSplit = data.get('view1IsSplit',None)
old = self.view1
if isSplit:
self.view1 = wxMultiSplit(self.multiView,self,
wxPoint(0,0),self.GetSize())
else:
self.view1 = wxMultiViewLeaf(self.multiView,self,
wxPoint(0,0),self.GetSize())
self.view1.SetSaveData(v1Data)
if old:
old.Destroy()
v2Data = data.get('view2',None)
if v2Data:
isSplit = data.get('view2IsSplit',None)
old = self.view2
if isSplit:
self.view2 = wxMultiSplit(self.multiView,self,
wxPoint(0,0),self.GetSize())
else:
self.view2 = wxMultiViewLeaf(self.multiView,self,
wxPoint(0,0),self.GetSize())
self.view2.SetSaveData(v2Data)
if old:
old.Destroy()
if self.view1:
self.view1.OnSize(None)
if self.view2:
self.view2.OnSize(None)
def UnSelect(self):
if self.view1:
self.view1.UnSelect()
if self.view2:
self.view2.UnSelect()
def DefaultChildChanged(self):
if not self.view2:
self.view1.DefaultChildChanged()
def AddLeaf(self,direction,caller,pos):
if self.view2:
if caller == self.view1:
self.view1 = wxMultiSplit(self.multiView,self,
caller.GetPosition(),
caller.GetSize(),
caller)
self.view1.AddLeaf(direction,caller,pos)
else:
self.view2 = wxMultiSplit(self.multiView,self,
caller.GetPosition(),
caller.GetSize(),
caller)
self.view2.AddLeaf(direction,caller,pos)
else:
self.direction = direction
w,h = self.GetSizeTuple()
if direction == MV_HOR:
x,y = (pos,0)
w1,h1 = (w-pos,h)
w2,h2 = (pos,h)
else:
x,y = (0,pos)
w1,h1 = (w,h-pos)
w2,h2 = (w,pos)
self.view2 = wxMultiViewLeaf(self.multiView,self,
wxPoint(x,y),wxSize(w1,h1))
self.view1.SetSize(wxSize(w2,h2))
self.view2.OnSize(None)
def DestroyLeaf(self,caller):
if not self.view2: # We will only have 2 windows if
return # we need to destroy any
parent = self.GetParent() # Another splitview
if parent == self.multiView: # We'r at the root
if caller == self.view1:
old = self.view1
self.view1 = self.view2
self.view2 = None
old.Destroy()
else:
self.view2.Destroy()
self.view2 = None
self.view1.SetSize(self.GetSize())
self.view1.Move(self.GetPosition())
else:
w,h = self.GetSizeTuple()
x,y = self.GetPositionTuple()
if caller == self.view1:
if self == parent.view1:
parent.view1 = self.view2
else:
parent.view2 = self.view2
self.view2.Reparent(parent)
self.view2.SetDimensions(x,y,w,h)
else:
if self == parent.view1:
parent.view1 = self.view1
else:
parent.view2 = self.view1
self.view1.Reparent(parent)
self.view1.SetDimensions(x,y,w,h)
self.view1 = None
self.view2 = None
self.Destroy()
def CanSize(self,side,view):
if self.SizeTarget(side,view):
return True
return False
def SizeTarget(self,side,view):
if self.direction == side and self.view2 and view == self.view1:
return self
parent = self.GetParent()
if parent != self.multiView:
return parent.SizeTarget(side,self)
return None
def SizeLeaf(self,leaf,pos,side):
if self.direction != side:
return
if not (self.view1 and self.view2):
return
if pos < 10: return
w,h = self.GetSizeTuple()
if side == MV_HOR:
if pos > w - 10: return
else:
if pos > h - 10: return
if side == MV_HOR:
self.view1.SetDimensions(0,0,pos,h)
self.view2.SetDimensions(pos,0,w-pos,h)
else:
self.view1.SetDimensions(0,0,w,pos)
self.view2.SetDimensions(0,pos,w,h-pos)
def OnSize(self,evt):
if not self.view2:
self.view1.SetSize(self.GetSize())
self.view1.OnSize(None)
return
v1w,v1h = self.view1.GetSizeTuple()
v2w,v2h = self.view2.GetSizeTuple()
v1x,v1y = self.view1.GetPositionTuple()
v2x,v2y = self.view2.GetPositionTuple()
w,h = self.GetSizeTuple()
if v1x != v2x:
ratio = float(w) / float((v1w + v2w))
v1w *= ratio
v2w = w - v1w
v2x = v1w
else:
v1w = v2w = w
if v1y != v2y:
ratio = float(h) / float((v1h + v2h))
v1h *= ratio
v2h = h - v1h
v2y = v1h
else:
v1h = v2h = h
self.view1.SetDimensions(v1x,v1y,v1w,v1h)
self.view2.SetDimensions(v2x,v2y,v2w,v2h)
self.view1.OnSize(None)
self.view2.OnSize(None)
#----------------------------------------------------------------------
class wxMultiViewLeaf(wxWindow):
def __init__(self,multiView,parent,pos,size):
wxWindow.__init__(self,id = -1,parent = parent,pos = pos,size = size,
style = wxCLIP_CHILDREN)
self.multiView = multiView
self.sizerHor = MultiSizer(self,MV_HOR)
self.sizerVer = MultiSizer(self,MV_VER)
self.creatorHor = MultiCreator(self,MV_HOR)
self.creatorVer = MultiCreator(self,MV_VER)
self.detail = MultiClient(self,multiView._defChild)
self.closer = MultiCloser(self)
EVT_SIZE(self,self.OnSize)
def GetSaveData(self):
saveData = {}
saveData['detailClass'] = str(self.detail.child.__class__)
if hasattr(self.detail.child,'GetSaveData'):
attr = getattr(self.detail.child,'GetSaveData')
if callable(attr):
dData = attr()
if dData:
saveData['detail'] = dData
v1,v2 = self.GetPositionTuple()
saveData['x'] = v1
saveData['y'] = v2
v1,v2 = self.GetSizeTuple()
saveData['w'] = v1
saveData['h'] = v2
return saveData
def SetSaveData(self,data):
dChild = data['detailClass']
mod = dChild.split('.')[0]
exec 'import %s' % mod
detClass = eval(dChild)
self.SetDimensions(data['x'],data['y'],data['w'],data['h'])
old = self.detail
self.detail = MultiClient(self,detClass)
dData = data.get('detail',None)
if dData:
if hasattr(self.detail.child,'SetSaveData'):
attr = getattr(self.detail.child,'SetSaveData')
if callable(attr):
attr(dData)
old.Destroy()
self.detail.OnSize(None)
def UnSelect(self):
self.detail.UnSelect()
def DefaultChildChanged(self):
self.detail.SetNewChildCls(self.multiView._defChild)
def AddLeaf(self,direction,pos):
if pos < 10: return
w,h = self.GetSizeTuple()
if direction == MV_VER:
if pos > h - 10: return
else:
if pos > w - 10: return
self.GetParent().AddLeaf(direction,self,pos)
def DestroyLeaf(self):
self.GetParent().DestroyLeaf(self)
def SizeTarget(self,side):
return self.GetParent().SizeTarget(side,self)
def CanSize(self,side):
return self.GetParent().CanSize(side,self)
def OnSize(self,evt):
self.sizerHor.OnSize(evt)
self.sizerVer.OnSize(evt)
self.creatorHor.OnSize(evt)
self.creatorVer.OnSize(evt)
self.detail.OnSize(evt)
self.closer.OnSize(evt)
#----------------------------------------------------------------------
class MultiClient(wxWindow):
def __init__(self,parent,childCls):
w,h = self.CalcSize(parent)
wxWindow.__init__(self,id = -1,parent = parent,
pos = wxPoint(0,0),
size = wxSize(w,h),
style = wxCLIP_CHILDREN | wxSUNKEN_BORDER)
self.child = childCls(self)
self.child.MoveXY(2,2)
self.normalColour = self.GetBackgroundColour()
self.selected = False
EVT_SET_FOCUS(self,self.OnSetFocus)
EVT_CHILD_FOCUS(self,self.OnChildFocus)
def UnSelect(self):
if self.selected:
self.selected = False
self.SetBackgroundColour(self.normalColour)
self.Refresh()
def Select(self):
self.GetParent().multiView.UnSelect()
self.selected = True
self.SetBackgroundColour(wxColour(255,255,0)) # Yellow
self.Refresh()
def CalcSize(self,parent):
w,h = parent.GetSizeTuple()
w -= SH_SIZE
h -= SH_SIZE
return (w,h)
def OnSize(self,evt):
w,h = self.CalcSize(self.GetParent())
self.SetDimensions(0,0,w,h)
w,h = self.GetClientSizeTuple()
self.child.SetSize(wxSize(w-4,h-4))
def SetNewChildCls(self,childCls):
if self.child:
self.child.Destroy()
self.child = None
self.child = childCls(self)
self.child.MoveXY(2,2)
def OnSetFocus(self,evt):
self.Select()
def OnChildFocus(self,evt):
self.OnSetFocus(evt)
## from Funcs import FindFocusedChild
## child = FindFocusedChild(self)
## EVT_KILL_FOCUS(child,self.OnChildKillFocus)
#----------------------------------------------------------------------
class MultiSizer(wxWindow):
def __init__(self,parent,side):
self.side = side
x,y,w,h = self.CalcSizePos(parent)
wxWindow.__init__(self,id = -1,parent = parent,
pos = wxPoint(x,y),
size = wxSize(w,h),
style = wxCLIP_CHILDREN)
self.px = None # Previous X
self.py = None # Previous Y
self.isDrag = False # In Dragging
self.dragTarget = None # View being sized
EVT_LEAVE_WINDOW(self,self.OnLeave)
EVT_ENTER_WINDOW(self,self.OnEnter)
EVT_MOTION(self,self.OnMouseMove)
EVT_LEFT_DOWN(self,self.OnPress)
EVT_LEFT_UP(self,self.OnRelease)
def CalcSizePos(self,parent):
pw,ph = parent.GetSizeTuple()
if self.side == MV_HOR:
x = CR_SIZE + 2
y = ph - SH_SIZE
w = pw - CR_SIZE - SH_SIZE - 2
h = SH_SIZE
else:
x = pw - SH_SIZE
y = CR_SIZE + 2 + SH_SIZE
w = SH_SIZE
h = ph - CR_SIZE - SH_SIZE - 4 - SH_SIZE # For Closer
return (x,y,w,h)
def OnSize(self,evt):
x,y,w,h = self.CalcSizePos(self.GetParent())
self.SetDimensions(x,y,w,h)
def OnLeave(self,evt):
self.SetCursor(wxStockCursor(wxCURSOR_ARROW))
def OnEnter(self,evt):
if not self.GetParent().CanSize(not self.side):
return
if self.side == MV_HOR:
self.SetCursor(wxStockCursor(wxCURSOR_SIZENS))
else:
self.SetCursor(wxStockCursor(wxCURSOR_SIZEWE))
def OnMouseMove(self,evt):
if self.isDrag:
DrawSash(self.dragTarget,self.px,self.py,self.side)
self.px,self.py = self.ClientToScreenXY(evt.m_x,evt.m_y)
self.px,self.py = self.dragTarget.ScreenToClientXY(self.px,self.py)
DrawSash(self.dragTarget,self.px,self.py,self.side)
else:
evt.Skip()
def OnPress(self,evt):
self.dragTarget = self.GetParent().SizeTarget(not self.side)
if self.dragTarget:
self.isDrag = True
self.px,self.py = self.ClientToScreenXY(evt.m_x,evt.m_y)
self.px,self.py = self.dragTarget.ScreenToClientXY(self.px,self.py)
DrawSash(self.dragTarget,self.px,self.py,self.side)
self.CaptureMouse()
else:
evt.Skip()
def OnRelease(self,evt):
if self.isDrag:
DrawSash(self.dragTarget,self.px,self.py,self.side)
self.ReleaseMouse()
self.isDrag = False
if self.side == MV_HOR:
self.dragTarget.SizeLeaf(self.GetParent(),
self.py,not self.side)
else:
self.dragTarget.SizeLeaf(self.GetParent(),
self.px,not self.side)
self.dragTarget = None
else:
evt.Skip()
#----------------------------------------------------------------------
class MultiCreator(wxWindow):
def __init__(self,parent,side):
self.side = side
x,y,w,h = self.CalcSizePos(parent)
wxWindow.__init__(self,id = -1,parent = parent,
pos = wxPoint(x,y),
size = wxSize(w,h),
style = wxCLIP_CHILDREN)
self.px = None # Previous X
self.py = None # Previous Y
self.isDrag = False # In Dragging
EVT_LEAVE_WINDOW(self,self.OnLeave)
EVT_ENTER_WINDOW(self,self.OnEnter)
EVT_MOTION(self,self.OnMouseMove)
EVT_LEFT_DOWN(self,self.OnPress)
EVT_LEFT_UP(self,self.OnRelease)
EVT_PAINT(self,self.OnPaint)
def CalcSizePos(self,parent):
pw,ph = parent.GetSizeTuple()
if self.side == MV_HOR:
x = 2
y = ph - SH_SIZE
w = CR_SIZE
h = SH_SIZE
else:
x = pw - SH_SIZE
y = 4 + SH_SIZE # Make provision for closer
w = SH_SIZE
h = CR_SIZE
return (x,y,w,h)
def OnSize(self,evt):
x,y,w,h = self.CalcSizePos(self.GetParent())
self.SetDimensions(x,y,w,h)
def OnLeave(self,evt):
self.SetCursor(wxStockCursor(wxCURSOR_ARROW))
def OnEnter(self,evt):
if self.side == MV_HOR:
self.SetCursor(wxStockCursor(wxCURSOR_HAND))
else:
self.SetCursor(wxStockCursor(wxCURSOR_POINT_LEFT))
def OnMouseMove(self,evt):
if self.isDrag:
parent = self.GetParent()
DrawSash(parent,self.px,self.py,self.side)
self.px,self.py = self.ClientToScreenXY(evt.m_x,evt.m_y)
self.px,self.py = parent.ScreenToClientXY(self.px,self.py)
DrawSash(parent,self.px,self.py,self.side)
else:
evt.Skip()
def OnPress(self,evt):
self.isDrag = True
parent = self.GetParent()
self.px,self.py = self.ClientToScreenXY(evt.m_x,evt.m_y)
self.px,self.py = parent.ScreenToClientXY(self.px,self.py)
DrawSash(parent,self.px,self.py,self.side)
self.CaptureMouse()
def OnRelease(self,evt):
if self.isDrag:
parent = self.GetParent()
DrawSash(parent,self.px,self.py,self.side)
self.ReleaseMouse()
self.isDrag = False
if self.side == MV_HOR:
parent.AddLeaf(MV_VER,self.py)
else:
parent.AddLeaf(MV_HOR,self.px)
else:
evt.Skip()
def OnPaint(self,evt):
dc = wxPaintDC(self)
dc.SetBackground(wxBrush(self.GetBackgroundColour(),wxSOLID))
dc.Clear()
highlight = wxPen(wxSystemSettings_GetSystemColour(
wxSYS_COLOUR_BTNHIGHLIGHT),1,wxSOLID)
shadow = wxPen(wxSystemSettings_GetSystemColour(
wxSYS_COLOUR_BTNSHADOW),1,wxSOLID)
black = wxPen(wxBLACK,1,wxSOLID)
w,h = self.GetSizeTuple()
w -= 1
h -= 1
# Draw outline
dc.SetPen(highlight)
dc.DrawLine(0,0,0,h)
dc.DrawLine(0,0,w,0)
dc.SetPen(black)
dc.DrawLine(0,h,w+1,h)
dc.DrawLine(w,0,w,h)
dc.SetPen(shadow)
dc.DrawLine(w-1,2,w-1,h)
#----------------------------------------------------------------------
class MultiCloser(wxWindow):
def __init__(self,parent):
x,y,w,h = self.CalcSizePos(parent)
wxWindow.__init__(self,id = -1,parent = parent,
pos = wxPoint(x,y),
size = wxSize(w,h),
style = wxCLIP_CHILDREN)
self.down = False
self.entered = False
EVT_LEFT_DOWN(self,self.OnPress)
EVT_LEFT_UP(self,self.OnRelease)
EVT_PAINT(self,self.OnPaint)
EVT_LEAVE_WINDOW(self,self.OnLeave)
EVT_ENTER_WINDOW(self,self.OnEnter)
def OnLeave(self,evt):
self.SetCursor(wxStockCursor(wxCURSOR_ARROW))
self.entered = False
def OnEnter(self,evt):
self.SetCursor(wxStockCursor(wxCURSOR_BULLSEYE))
self.entered = True
def OnPress(self,evt):
self.down = True
evt.Skip()
def OnRelease(self,evt):
if self.down and self.entered:
self.GetParent().DestroyLeaf()
else:
evt.Skip()
self.down = False
def OnPaint(self,evt):
dc = wxPaintDC(self)
dc.SetBackground(wxBrush(wxRED,wxSOLID))
dc.Clear()
def CalcSizePos(self,parent):
pw,ph = parent.GetSizeTuple()
x = pw - SH_SIZE
w = SH_SIZE
h = SH_SIZE + 2
y = 1
return (x,y,w,h)
def OnSize(self,evt):
x,y,w,h = self.CalcSizePos(self.GetParent())
self.SetDimensions(x,y,w,h)
#----------------------------------------------------------------------
class EmptyChild(wxWindow):
def __init__(self,parent):
wxWindow.__init__(self,parent,-1, style = wxCLIP_CHILDREN)
#----------------------------------------------------------------------
def DrawSash(win,x,y,direction):
dc = wxScreenDC()
dc.StartDrawingOnTopWin(win)
bmp = wxEmptyBitmap(8,8)
bdc = wxMemoryDC()
bdc.SelectObject(bmp)
bdc.DrawRectangle(-1,-1,10,10)
for i in range(8):
for j in range(8):
if ((i + j) & 1):
bdc.DrawPoint(i,j)
brush = wxBrush(wxColour(0,0,0))
brush.SetStipple(bmp)
dc.SetBrush(brush)
dc.SetLogicalFunction(wxXOR)
body_w,body_h = win.GetClientSizeTuple()
if y < 0:
y = 0
if y > body_h:
y = body_h
if x < 0:
x = 0
if x > body_w:
x = body_w
if direction == MV_HOR:
x = 0
else:
y = 0
x,y = win.ClientToScreenXY(x,y)
w = body_w
h = body_h
if direction == MV_HOR:
dc.DrawRectangle(x,y-2,w,4)
else:
dc.DrawRectangle(x-2,y,4,h)
dc.EndDrawingOnTop()

View File

@@ -47,9 +47,9 @@ class MVCTreeNode:
if self.kids is None:
self.kids = []
self.data = data
self.expanded = false
self.selected = false
self.built = false
self.expanded = False
self.selected = False
self.built = False
self.scale = 0
def GetChildren(self):
@@ -136,7 +136,7 @@ class Painter:
self.bgcolor = wxNamedColour("WHITE")
self.fgcolor = wxNamedColour("BLUE")
self.linecolor = wxNamedColour("GREY")
self.font = wxFont(9, wxDEFAULT, wxNORMAL, wxNORMAL, false)
self.font = wxFont(9, wxDEFAULT, wxNORMAL, wxNORMAL, False)
self.bmp = None
def GetFont(self):
@@ -239,10 +239,10 @@ class wxTreeModel:
raise NotImplementedError
def IsEditable(self, node):
return false
return False
def SetEditable(self, node):
return false
return False
class NodePainter:
"""
@@ -330,10 +330,10 @@ class BasicTreeModel(wxTreeModel):
return not self.children.has_key(node)
def IsEditable(self, node):
return false
return False
def SetEditable(self, node, bool):
return false
return False
class FileEditor(Editor):
@@ -374,9 +374,9 @@ class FileEditor(Editor):
def _key(self, evt):
if evt.KeyCode() == WXK_RETURN:
self.EndEdit(true)
self.EndEdit(True)
elif evt.KeyCode() == WXK_ESCAPE:
self.EndEdit(false)
self.EndEdit(False)
else:
evt.Skip()
@@ -385,7 +385,7 @@ class FileEditor(Editor):
pos = evt.GetPosition()
edsize = self.editcomp.GetSize()
if pos.x < 0 or pos.y < 0 or pos.x > edsize.width or pos.y > edsize.height:
self.EndEdit(false)
self.EndEdit(False)
class FileWrapper:
@@ -405,11 +405,10 @@ class FSTreeModel(BasicTreeModel):
"""
def __init__(self, path):
BasicTreeModel.__init__(self)
import string
fw = FileWrapper(path, string.split(path, os.sep)[-1])
fw = FileWrapper(path, path.split(os.sep)[-1])
self._Build(path, fw)
self.SetRoot(fw)
self._editable = true
self._editable = True
def _Build(self, path, fileWrapper):
for name in os.listdir(path):
fw = FileWrapper(path, name)
@@ -431,13 +430,12 @@ class LateFSTreeModel(FSTreeModel):
"""
def __init__(self, path):
BasicTreeModel.__init__(self)
import string
name = string.split(path, os.sep)[-1]
name = path.split(os.sep)[-1]
pathpart = path[:-len(name)]
fw = FileWrapper(pathpart, name)
self._Build(path, fw)
self.SetRoot(fw)
self._editable = true
self._editable = True
self.children = {}
self.parents = {}
def _Build(self, path, parent):
@@ -496,8 +494,8 @@ class Rect:
if other.y >= self.y:
if other.width + other.x <= self.width + self.x:
if other.height + other.y <= self.height + self.y:
return true
return false
return True
return False
def __str__(self):
return "Rect: " + str([self.x, self.y, self.width, self.height])
@@ -616,7 +614,7 @@ class TreePainter(Painter):
if node.expanded:
for kid in node.kids:
if not self.paintWalk(kid, dc, paintRects):
return false
return False
for kid in node.kids:
px = (kid.projx - self.tree.layout.NODE_STEP) + 5
py = kid.projy + kid.height/2
@@ -640,7 +638,7 @@ class TreePainter(Painter):
if not node.expanded:
dc.DrawLine(px, py -2, px, py + 3)
dc.DrawLine(px -2, py, px + 3, py)
return true
return True
def OnMouse(self, evt):
Painter.OnMouse(self, evt)
@@ -752,12 +750,12 @@ class wxMVCTree(wxScrolledWindow):
painter = None, *args, **kwargs):
apply(wxScrolledWindow.__init__, (self, parent, id), kwargs)
self.nodemap = {}
self._multiselect = false
self._multiselect = False
self._selections = []
self._assumeChildren = false
self._scrollx = false
self._scrolly = false
self.doubleBuffered = false
self._assumeChildren = False
self._scrollx = False
self._scrolly = False
self.doubleBuffered = False
self._lastPhysicalSize = self.GetSize()
self._editors = []
if not model:
@@ -773,10 +771,10 @@ class wxMVCTree(wxScrolledWindow):
if not painter:
painter = TreePainter(self)
self.painter = painter
self.SetFont(wxFont(9, wxDEFAULT, wxNORMAL, wxNORMAL, false))
self.SetFont(wxFont(9, wxDEFAULT, wxNORMAL, wxNORMAL, False))
EVT_MOUSE_EVENTS(self, self.OnMouse)
EVT_KEY_DOWN(self, self.OnKeyDown)
self.doubleBuffered = true
self.doubleBuffered = True
EVT_SIZE(self, self.OnSize)
EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
EVT_PAINT(self, self.OnPaint)
@@ -785,7 +783,7 @@ class wxMVCTree(wxScrolledWindow):
def Refresh(self):
if self.doubleBuffered:
self.painter.ClearBuffer()
wxScrolledWindow.Refresh(self, false)
wxScrolledWindow.Refresh(self, False)
def GetPainter(self):
return self.painter
@@ -876,7 +874,7 @@ class wxMVCTree(wxScrolledWindow):
self._selections = []
self.layoutRoot = MVCTreeNode()
self.layoutRoot.data = self.model.GetRoot()
self.layoutRoot.expanded = true
self.layoutRoot.expanded = True
self.LoadChildren(self.layoutRoot)
self.currentRoot = self.layoutRoot
self.offset = [0,0]
@@ -897,7 +895,7 @@ class wxMVCTree(wxScrolledWindow):
layoutNode.Add(p)
p.data = self.GetModel().GetChildAt(layoutNode.data, i)
self.nodemap[p.data]=p
layoutNode.built = true
layoutNode.built = True
if not self._assumeChildren:
for kid in layoutNode.kids:
self.LoadChildren(kid)
@@ -925,10 +923,10 @@ class wxMVCTree(wxScrolledWindow):
return
for node in nodeTuple:
treenode = self.nodemap[node]
treenode.selected = true
treenode.selected = True
for node in self._selections:
treenode = self.nodemap[node]
node.selected = false
node.selected = False
self._selections = list(nodeTuple)
e = wxMVCTreeEvent(wxEVT_MVCTREE_SEL_CHANGED, self.GetId(), nodeTuple[0], nodes = nodeTuple)
self.GetEventHandler().ProcessEvent(e)
@@ -964,9 +962,9 @@ class wxMVCTree(wxScrolledWindow):
e = wxMVCTreeNotifyEvent(wxEVT_MVCTREE_END_EDIT, self.GetId(), node)
self.GetEventHandler().ProcessEvent(e)
if not e.notify.IsAllowed():
return false
return False
self._currentEditor = None
return true
return True
def SetExpanded(self, node, bool):
@@ -997,7 +995,7 @@ class wxMVCTree(wxScrolledWindow):
def IsExpanded(self, node):
return self.nodemap[node].expanded
def AddToSelection(self, nodeOrTuple, enableMulti = true, shiftMulti = false):
def AddToSelection(self, nodeOrTuple, enableMulti = True, shiftMulti = False):
nodeTuple = nodeOrTuple
if type(nodeOrTuple)!= type(()):
nodeTuple = (nodeOrTuple,)
@@ -1009,13 +1007,13 @@ class wxMVCTree(wxScrolledWindow):
if not (self.IsMultiSelect() and (enableMulti or shiftMulti)):
for node in self._selections:
treenode = self.nodemap[node]
treenode.selected = false
treenode.selected = False
changeparents.append(treenode)
node = nodeTuple[0]
self._selections = [node]
treenode = self.nodemap[node]
changeparents.append(treenode)
treenode.selected = true
treenode.selected = True
else:
if shiftMulti:
for node in nodeTuple:
@@ -1026,11 +1024,11 @@ class wxMVCTree(wxScrolledWindow):
for kid in oldtreenode.parent.kids:
if kid == treenode or kid == oldtreenode:
found = not found
kid.selected = true
kid.selected = True
self._selections.append(kid.data)
changeparents.append(kid)
elif found:
kid.selected = true
kid.selected = True
self._selections.append(kid.data)
changeparents.append(kid)
else:
@@ -1040,7 +1038,7 @@ class wxMVCTree(wxScrolledWindow):
except ValueError:
self._selections.append(node)
treenode = self.nodemap[node]
treenode.selected = true
treenode.selected = True
changeparents.append(treenode)
e = wxMVCTreeEvent(wxEVT_MVCTREE_SEL_CHANGED, self.GetId(), nodeTuple[0], nodes = nodeTuple)
self.GetEventHandler().ProcessEvent(e)
@@ -1059,7 +1057,7 @@ class wxMVCTree(wxScrolledWindow):
self._selections.remove(node)
treenode = self.nodemap[node]
changeparents.append(treenode)
treenode.selected = false
treenode.selected = False
e = wxMVCTreeEvent(wxEVT_MVCTREE_SEL_CHANGED, self.GetId(), node, nodes = nodeTuple)
self.GetEventHandler().ProcessEvent(e)
dc = wxClientDC(self)
@@ -1103,14 +1101,14 @@ class wxMVCTree(wxScrolledWindow):
to paint the control.
"""
try:
self.EnableScrolling(false, false)
self.EnableScrolling(False, False)
if not self.laidOut:
self.layout.Layout(self.currentRoot)
self.laidOut = true
self.transformed = false
self.laidOut = True
self.transformed = False
if not self.transformed:
self.transform.Transform(self.currentRoot, self.offset, self.rotation)
self.transformed = true
self.transformed = True
tsize = None
tsize = list(self.transform.GetSize())
tsize[0] = tsize[0] + 50

View File

@@ -0,0 +1,243 @@
#----------------------------------------------------------------------
# Name: popup
# Purpose: Generic popup control
#
# Author: Gerrit van Dyk
#
# Created: 2002/11/20
# Version: 0.1
# RCS-ID: $Id$
# License: wxWindows license
#----------------------------------------------------------------------
from wxPython.wx import *
from wxPython.lib.buttons import wxGenButtonEvent
class PopButton(wxPyControl):
def __init__(self,*_args,**_kwargs):
apply(wxPyControl.__init__,(self,) + _args,_kwargs)
self.up = True
self.didDown = False
self.InitColours()
EVT_LEFT_DOWN(self, self.OnLeftDown)
EVT_LEFT_UP(self, self.OnLeftUp)
EVT_MOTION(self, self.OnMotion)
EVT_PAINT(self, self.OnPaint)
def InitColours(self):
faceClr = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNFACE)
self.faceDnClr = faceClr
self.SetBackgroundColour(faceClr)
shadowClr = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNSHADOW)
highlightClr = wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNHIGHLIGHT)
self.shadowPen = wxPen(shadowClr, 1, wxSOLID)
self.highlightPen = wxPen(highlightClr, 1, wxSOLID)
self.blackPen = wxPen(wxBLACK, 1, wxSOLID)
def Notify(self):
evt = wxGenButtonEvent(wxEVT_COMMAND_BUTTON_CLICKED, self.GetId())
evt.SetIsDown(not self.up)
evt.SetButtonObj(self)
evt.SetEventObject(self)
self.GetEventHandler().ProcessEvent(evt)
def OnEraseBackground(self, event):
pass
def OnLeftDown(self, event):
if not self.IsEnabled():
return
self.didDown = True
self.up = False
self.CaptureMouse()
self.GetParent().textCtrl.SetFocus()
self.Refresh()
event.Skip()
def OnLeftUp(self, event):
if not self.IsEnabled():
return
if self.didDown:
self.ReleaseMouse()
if not self.up:
self.Notify()
self.up = True
self.Refresh()
self.didDown = False
event.Skip()
def OnMotion(self, event):
if not self.IsEnabled():
return
if event.LeftIsDown():
if self.didDown:
x,y = event.GetPositionTuple()
w,h = self.GetClientSizeTuple()
if self.up and x<w and x>=0 and y<h and y>=0:
self.up = False
self.Refresh()
return
if not self.up and (x<0 or y<0 or x>=w or y>=h):
self.up = True
self.Refresh()
return
event.Skip()
def DrawBezel(self, dc, x1, y1, x2, y2):
# draw the upper left sides
if self.up:
dc.SetPen(self.highlightPen)
else:
dc.SetPen(self.shadowPen)
for i in range(2):
dc.DrawLine(x1+i, y1, x1+i, y2-i)
dc.DrawLine(x1, y1+i, x2-i, y1+i)
# draw the lower right sides
if self.up:
dc.SetPen(self.shadowPen)
else:
dc.SetPen(self.highlightPen)
for i in range(2):
dc.DrawLine(x1+i, y2-i, x2+1, y2-i)
dc.DrawLine(x2-i, y1+i, x2-i, y2)
def DrawArrow(self,dc):
size = self.GetSize()
mx = size.x / 2
my = size.y / 2
dc.SetPen(self.highlightPen)
dc.DrawLine(mx-5,my-5,mx+5,my-5)
dc.DrawLine(mx-5,my-5,mx,my+5)
dc.SetPen(self.shadowPen)
dc.DrawLine(mx+4,my-5,mx,my+5)
dc.SetPen(self.blackPen)
dc.DrawLine(mx+5,my-5,mx,my+5)
def OnPaint(self, event):
width, height = self.GetClientSizeTuple()
x1 = y1 = 0
x2 = width - 1
y2 = height - 1
dc = wxBufferedPaintDC(self)
if self.up:
dc.SetBackground(wxBrush(self.GetBackgroundColour(), wxSOLID))
else:
dc.SetBackground(wxBrush(self.faceDnClr, wxSOLID))
dc.Clear()
self.DrawBezel(dc, x1, y1, x2, y2)
self.DrawArrow(dc)
#---------------------------------------------------------------------------
# Tried to use wxPopupWindow but the control misbehaves on MSW
class wxPopupDialog(wxDialog):
def __init__(self,parent,content = None):
wxDialog.__init__(self,parent,-1,'', style = wxSTAY_ON_TOP)
self.ctrl = parent
self.win = wxWindow(self,-1,pos = wxPoint(0,0),style = 0)
if content:
self.SetContent(content)
def SetContent(self,content):
self.content = content
self.content.Reparent(self.win)
self.content.Show(True)
self.win.SetClientSize(self.content.GetSize())
self.SetSize(self.win.GetSize())
def Display(self):
pos = self.ctrl.ClientToScreen( (0,0) )
dSize = wxGetDisplaySize()
selfSize = self.GetSize()
tcSize = self.ctrl.GetSize()
pos.x -= (selfSize.x - tcSize.x) / 2
if pos.x + selfSize.x > dSize.x:
pos.x = dSize.x - selfSize.x
if pos.x < 0:
pos.x = 0
pos.y += tcSize.height
if pos.y + selfSize.y > dSize.y:
pos.y = dSize.y - selfSize.y
if pos.y < 0:
pos.y = 0
self.MoveXY(pos.x,pos.y)
self.ctrl.FormatContent()
self.ShowModal()
#---------------------------------------------------------------------------
class wxPopupControl(wxPyControl):
def __init__(self,*_args,**_kwargs):
if _kwargs.has_key('value'):
del _kwargs['value']
apply(wxPyControl.__init__,(self,) + _args,_kwargs)
self.textCtrl = wxTextCtrl(self,-1,'',pos = wxPoint(0,0))
self.bCtrl = PopButton(self,-1)
self.pop = None
self.content = None
self.OnSize(None)
EVT_SIZE(self,self.OnSize)
EVT_BUTTON(self.bCtrl,self.bCtrl.GetId(),self.OnButton)
def OnSize(self,evt):
w,h = self.GetClientSizeTuple()
self.textCtrl.SetDimensions(0,0,w-17,h)
self.bCtrl.SetDimensions(w-17,0,17,h)
def OnButton(self,evt):
if not self.pop:
if self.content:
self.pop = wxPopupDialog(self,self.content)
del self.content
else:
print 'No Content to pop'
if self.pop:
self.pop.Display()
def Enable(self,flag):
wxPyControl.Enable(self,flag)
self.textCtrl.Enable(flag)
self.bCtrl.Enable(flag)
def SetPopupContent(self,content):
if not self.pop:
self.content = content
self.content.Show(False)
else:
self.pop.SetContent(content)
def FormatContent(self):
pass
def PopDown(self):
if self.pop:
self.pop.EndModal(1)
def SetValue(self,value):
self.textCtrl.SetValue(value)
def GetValue(self):
return self.textCtrl.GetValue()
# an alias
wxPopupCtrl = wxPopupControl

View File

@@ -15,7 +15,7 @@
# add index to data list after parsing total pages for paging
#----------------------------------------------------------------------------
import os, sys, string, copy
import os, sys, copy
from wxPython.wx import *
import copy
@@ -45,14 +45,14 @@ class PrintBase:
fcolour = font["Colour"]
return wxColour(fcolour[0], fcolour[1], fcolour[2])
def OutTextRegion(self, textout, txtdraw = TRUE):
textlines = string.splitfields(textout, '\n')
def OutTextRegion(self, textout, txtdraw = True):
textlines = textout.split('\n')
y = copy.copy(self.y) + self.pt_space_before
for text in textlines:
remain = 'X'
while remain != "":
vout, remain = self.SetFlow(text, self.region)
if self.draw == TRUE and txtdraw == TRUE:
if self.draw == True and txtdraw == True:
test_out = self.TestFull(vout)
if self.align == wxALIGN_LEFT:
self.DC.DrawText(test_out, self.indent+self.pcell_left_margin, y)
@@ -88,12 +88,12 @@ class PrintBase:
def SetFlow(self, ln_text, width):
width = width - self.pcell_right_margin
text = ""
split = string.split(ln_text)
split = ln_text.split()
if len(split) == 1:
return ln_text, ""
try:
w, h = self.DC.GetTextExtent(split[0])
w, h = self.DC.GetTextExtent(" " + split[0])
if w >= width:
return ln_text, ""
except:
@@ -101,7 +101,7 @@ class PrintBase:
cnt = 0
for word in split:
bword = " " + word # blank + word
bword = " " + word # blank + word
length = len(bword)
w, h = self.DC.GetTextExtent(text + bword)
@@ -109,12 +109,12 @@ class PrintBase:
text = text + bword
cnt = cnt + 1
else:
remain = string.joinfields(split[cnt:],' ')
text = string.strip(text)
remain = ' '.join(split[cnt:])
text = text.strip()
return text, remain
remain = string.joinfields(split[cnt:],' ')
vout = string.strip(text)
remain = ' '.join(split[cnt:])
vout = text.strip()
return vout, remain
def SetChar(self, ln_text, width): # truncate string to fit into width
@@ -128,8 +128,8 @@ class PrintBase:
text = text + val
return text
def OutTextPageWidth(self, textout, y_out, align, indent, txtdraw = TRUE):
textlines = string.splitfields(textout, '\n')
def OutTextPageWidth(self, textout, y_out, align, indent, txtdraw = True):
textlines = textout.split('\n')
y = copy.copy(y_out)
pagew = self.parent.page_width * self.pwidth # full page width
@@ -140,7 +140,7 @@ class PrintBase:
remain = 'X'
while remain != "":
vout, remain = self.SetFlow(text, pagew)
if self.draw == TRUE and txtdraw == TRUE:
if self.draw == True and txtdraw == True:
test_out = vout
if align == wxALIGN_LEFT:
self.DC.DrawText(test_out, indent, y)
@@ -169,7 +169,7 @@ class PrintBase:
def GetNow(self):
full = str(wxDateTime_Now()) # get the current date and time in print format
flds = string.splitfields(full)
flds = full.split()
date = flds[0]
time = flds[1]
return date, time
@@ -350,26 +350,26 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
x, y = self.DC.GetTextExtent("W")
self.space = y
if self.total_pages == None:
if self.total_pages is None:
self.GetTotalPages() # total pages for display/printing
self.data_cnt = self.page_index[self.page-1]
self.draw = TRUE
self.draw = True
self.PrintHeader()
self.PrintFooter()
self.OutPage()
def GetTotalPages(self):
self.data_cnt = 0
self.draw = FALSE
self.draw = False
self.page_index = [0]
cnt = 0
while 1:
test = self.OutPage()
self.page_index.append(self.data_cnt)
if test == FALSE:
if test == False:
break
cnt = cnt + 1
@@ -383,23 +383,23 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
if self.label != []: # check if header defined
self.PrintLabel()
else:
return FALSE
return False
for val in self.data:
try:
row_val = self.data[self.data_cnt]
except:
self.FinishDraw()
return FALSE
return False
max_y = self.PrintRow(row_val, FALSE) # test to see if row will fit in remaining space
max_y = self.PrintRow(row_val, False) # test to see if row will fit in remaining space
test = max_y + self.space
if test > self.y_end:
break
self.ColourRowCells(max_y-self.y+self.space) # colour the row/column
max_y = self.PrintRow(row_val, TRUE) # row fits - print text
max_y = self.PrintRow(row_val, True) # row fits - print text
self.DrawGridLine() # top line of cell
self.y = max_y + self.space
@@ -411,9 +411,9 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
self.FinishDraw()
if self.data_cnt == len(self.data): # last value in list
return FALSE
return False
return TRUE
return True
def PrintLabel(self):
@@ -431,7 +431,7 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
self.align = wxALIGN_LEFT
max_out = self.OutTextRegion(vtxt, TRUE)
max_out = self.OutTextRegion(vtxt, True)
if max_out > max_y:
max_y = max_out
self.col = self.col + 1
@@ -440,7 +440,7 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
self.y = max_y + self.label_space
def PrintHeader(self): # print the header array
if self.draw == FALSE:
if self.draw == False:
return
for val in self.parent.header:
@@ -457,10 +457,10 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
else:
addtext = ""
self.OutTextPageWidth(text+addtext, self.pheader_margin, val["Align"], header_indent, TRUE)
self.OutTextPageWidth(text+addtext, self.pheader_margin, val["Align"], header_indent, True)
def PrintFooter(self): # print the header array
if self.draw == FALSE:
if self.draw == False:
return
footer_pos = self.parent.page_height * self.pheight - self.pfooter_margin + self.vertical_offset
@@ -484,7 +484,7 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
else:
addtext = ""
self.OutTextPageWidth(text+addtext, footer_pos, val["Align"], footer_indent, TRUE)
self.OutTextPageWidth(text+addtext, footer_pos, val["Align"], footer_indent, True)
def LabelColorRow(self, colour):
@@ -494,13 +494,13 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
self.DC.DrawRectangle(self.column[0], self.y, self.end_x-self.column[0]+1, height)
def ColourRowCells(self, height):
if self.draw == FALSE:
if self.draw == False:
return
col = 0
for colour in self.column_bgcolour:
cellcolour = self.GetCellColour(self.data_cnt, col)
if cellcolour != None:
if cellcolour is not None:
colour = cellcolour
brush = wxBrush(colour, wxSOLID)
@@ -512,7 +512,7 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
self.DC.DrawRectangle(start_x, self.y, width, height)
col = col + 1
def PrintRow(self, row_val, draw = TRUE, align = wxALIGN_LEFT):
def PrintRow(self, row_val, draw = True, align = wxALIGN_LEFT):
self.SetPrintFont(self.text_font)
self.pt_space_before = self.text_pt_space_before # set the point spacing
@@ -527,7 +527,7 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
fcolour = self.column_txtcolour[self.col] # set font colour
celltext = self.GetCellText(self.data_cnt, self.col)
if celltext != None:
if celltext is not None:
fcolour = celltext # override the column colour
self.DC.SetTextForeground(fcolour)
@@ -565,7 +565,7 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
self.DrawColumns() # draw all vertical lines
def DrawGridLine(self):
if self.draw == TRUE:
if self.draw == True:
try:
size = self.row_line_size[self.data_cnt]
except:
@@ -583,7 +583,7 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
self.DC.DrawLine(self.column[0], y_out, self.end_x, y_out)
def DrawColumns(self):
if self.draw == TRUE:
if self.draw == True:
col = 0
for val in self.column:
try:
@@ -800,30 +800,30 @@ class PrintTable:
def SetHeader(self, text = "", type = "Text", font=None, align = None, indent = None, colour = None, size = None):
set = { "Text": text }
if font == None:
if font is None:
set["Font"] = copy.copy(self.default_font)
else:
set["Font"] = font
if colour != None:
if colour is not None:
setfont = set["Font"]
setfont["Colour"] = self.GetColour(colour)
if size != None:
if size is not None:
setfont = set["Font"]
setfont["Size"] = size
if align == None:
if align is None:
set["Align"] = self.header_align
else:
set["Align"] = align
if indent == None:
if indent is None:
set["Indent"] = self.header_indent
else:
set["Indent"] = indent
if type == None:
if type is None:
set["Type"] = self.header_type
else:
set["Type"] = type
@@ -833,30 +833,30 @@ class PrintTable:
def SetFooter(self, text = "", type = None, font=None, align = None, indent = None, colour = None, size = None):
set = { "Text": text }
if font == None:
if font is None:
set["Font"] = copy.copy(self.default_font)
else:
set["Font"] = font
if colour != None:
if colour is not None:
setfont = set["Font"]
setfont["Colour"] = self.GetColour(colour)
if size != None:
if size is not None:
setfont = set["Font"]
setfont["Size"] = size
if align == None:
if align is None:
set["Align"] = self.footer_align
else:
set["Align"] = align
if indent == None:
if indent is None:
set["Indent"] = self.footer_indent
else:
set["Indent"] = indent
if type == None:
if type is None:
set["Type"] = self.footer_type
else:
set["Type"] = type
@@ -879,7 +879,7 @@ class PrintTable:
if self.parentFrame:
frame.SetPosition(self.preview_frame_pos)
frame.SetSize(self.preview_frame_size)
frame.Show(true)
frame.Show(True)
def Print(self):
pdd = wxPrintDialogData()
@@ -905,7 +905,7 @@ class PrintTable:
if self.preview is None:
table.SetPSize(size[0]/self.page_width, size[1]/self.page_height)
table.SetPTSize(size[0], size[1])
table.SetPreview(FALSE)
table.SetPreview(False)
else:
if self.preview == 1:
table.scale = self.scale
@@ -933,9 +933,9 @@ class PrintTable:
def HasPage(self, page):
if page <= self.page_total:
return true
return True
else:
return false
return False
def SetPage(self, page):
self.page = page
@@ -956,9 +956,9 @@ class PrintTable:
class PrintGrid:
def __init__(self, parent, grid, format = [], total_col = None, total_row = None):
if total_row == None:
if total_row is None:
total_row = grid.GetNumberRows()
if total_col == None:
if total_col is None:
total_col = grid.GetNumberCols()
self.total_row = total_row
@@ -1025,7 +1025,7 @@ class SetPrintout(wxPrintout):
end = self.canvas.HasPage(page)
return end
except:
return true
return True
def GetPageInfo(self):
try:
@@ -1084,7 +1084,7 @@ class SetPrintout(wxPrintout):
self.canvas.SetPageSize(self.psizew, self.psizeh)
self.canvas.DoDrawing(dc)
return true
return True

View File

@@ -0,0 +1,382 @@
#---------------------------------------------------------------------------
# Name: wxPython.lib.pubsub
# Purpose: The Publish/Subscribe framework used by evtmgr.EventManager
#
# Author: Robb Shecter and Robin Dunn
#
# Created: 12-December-2002
# RCS-ID: $Id$
# Copyright: (c) 2002 by Robb Shecter <robb@acm.org>
# Licence: wxWindows license
#---------------------------------------------------------------------------
"""
This module has classes for implementing the Publish/Subscribe design
pattern.
It's a very flexible PS implementation: The message topics are tuples
of any length, containing any objects (that can be used as hash keys).
A subscriber's topic matches any message topic for which it's a
sublist.
It also has many optimizations to favor time efficiency (ie., run-time
speed). I did this because I use it to support extreme uses. For
example, piping every wxWindows mouse event through to multiple
listeners, and expecting the app to have no noticeable slowdown. This
has made the code somewhat obfuscated, but I've done my best to
document it.
The Server and Message classes are the two that clients interact
with..
This module is compatible with Python 2.1.
Author: Robb Shecter
"""
#---------------------------------------------------------------------------
class Publisher:
"""
The publish/subscribe server. This class is a Singleton.
"""
def __init__(self):
self.topicDict = {}
self.functionDict = {}
self.subscribeAllList = []
self.messageCount = 0
self.deliveryCount = 0
#
# Public API
#
def subscribe(self, topic, listener):
"""
Add the given subscription to the list. This will
add an entry recording the fact that the listener wants
to get messages for (at least) the given topic. This
method may be called multiple times for one listener,
registering it with many topics. It can also be invoked
many times for a particular topic, each time with a
different listener.
listener: expected to be either a method or function that
takes zero or one parameters. (Not counting 'self' in the
case of methods. If it accepts a parameter, it will be given
a reference to a Message object.
topic: will be converted to a tuple if it isn't one.
It's a pattern matches any topic that it's a sublist
of. For example, this pattern:
('sports',)
would match these:
('sports',)
('sports', 'baseball')
('sports', 'baseball', 'highscores')
but not these:
()
('news')
(12345)
"""
if not callable(listener):
raise TypeError('The P/S listener, '+`listener`+', is not callable.')
aTopic = Topic(topic)
# Determine now (at registration time) how many parameters
# the listener expects, and get a reference to a function which
# calls it correctly at message-send time.
callableVersion = self.__makeCallable(listener)
# Add this tuple to a list which is in a dict keyed by
# the topic's first element.
self.__addTopicToCorrectList(aTopic, listener, callableVersion)
# Add to a dict in order to speed-up unsubscribing.
self.__addFunctionLookup(listener, aTopic)
def unsubscribe(self, listener):
"""
Remove the given listener from the registry,
for all topics that it's associated with.
"""
if not callable(listener):
raise TypeError('The P/S listener, '+`listener`+', is not callable.')
topicList = self.getAssociatedTopics(listener)
for aTopic in topicList:
subscriberList = self.__getTopicList(aTopic)
listToKeep = []
for subscriber in subscriberList:
if subscriber[0] != listener:
listToKeep.append(subscriber)
self.__setTopicList(aTopic, listToKeep)
self.__delFunctionLookup(listener)
def getAssociatedTopics(self, listener):
"""
Return a list of topics the given listener is
registered with.
"""
return self.functionDict.get(listener, [])
def sendMessage(self, topic, data=None):
"""
Relay a message to registered listeners.
"""
aTopic = Topic(topic)
message = Message(aTopic.items, data)
topicList = self.__getTopicList(aTopic)
# Send to the matching topics
for subscriber in topicList:
if subscriber[1].matches(aTopic):
subscriber[2](message)
# Send to any listeners registered for ALL
for subscriber in self.subscribeAllList:
subscriber[2](message)
#
# Private methods
#
def __makeCallable(self, function):
"""
Return a function that is what the server
will actually call.
This is a time optimization: this removes a test
for the number of parameters from the inner loop
of sendMessage().
"""
parameters = self.__parameterCount(function)
if parameters == 0:
# Return a function that calls the listener
# with no arguments.
return lambda m, f=function: f()
elif parameters == 1:
# Return a function that calls the listener
# with one argument (which will be the message).
return lambda m, f=function: f(m)
else:
raise TypeError('The publish/subscribe listener, '+`function`+', has wrong parameter count')
def __parameterCount(self, callableObject):
"""
Return the effective number of parameters required
by the callable object. In other words, the 'self'
parameter of methods is not counted.
"""
try:
# Try to handle this like a method
return callableObject.im_func.func_code.co_argcount - 1
except AttributeError:
pass
try:
# Try to handle this like a function
return callableObject.func_code.co_argcount
except AttributeError:
raise 'Cannot determine if this is a method or function: '+str(callableObject)
def __addFunctionLookup(self, aFunction, aTopic):
try:
aList = self.functionDict[aFunction]
except KeyError:
aList = []
self.functionDict[aFunction] = aList
aList.append(aTopic)
def __delFunctionLookup(self, aFunction):
try:
del self.functionDict[aFunction]
except KeyError:
print 'Warning: listener not found. Logic error in PublishSubscribe?', aFunction
def __addTopicToCorrectList(self, topic, listener, callableVersion):
if len(topic.items) == 0:
self.subscribeAllList.append((listener, topic, callableVersion))
else:
self.__getTopicList(topic).append((listener, topic, callableVersion))
def __getTopicList(self, aTopic):
"""
Return the correct sublist of subscribers based on the
given topic.
"""
try:
elementZero = aTopic.items[0]
except IndexError:
return self.subscribeAllList
try:
subList = self.topicDict[elementZero]
except KeyError:
subList = []
self.topicDict[elementZero] = subList
return subList
def __setTopicList(self, aTopic, aSubscriberList):
try:
self.topicDict[aTopic.items[0]] = aSubscriberList
except IndexError:
self.subscribeAllList = aSubscriberList
def __call__(self):
return self
# Create an instance with the same name as the class, effectivly
# hiding the class object so it can't be instantiated any more. From
# this point forward any calls to Publisher() will invoke the __call__
# of this instance which just returns itself.
#
# The only flaw with this approach is that you can't derive a new
# class from Publisher without jumping through hoops. If this ever
# becomes an issue then a new Singleton implementaion will need to be
# employed.
Publisher = Publisher()
#---------------------------------------------------------------------------
class Message:
"""
A simple container object for the two components of
a message; the topic and the data.
"""
def __init__(self, topic, data):
self.topic = topic
self.data = data
def __str__(self):
return '[Topic: '+`self.topic`+', Data: '+`self.data`+']'
#---------------------------------------------------------------------------
class Topic:
"""
A class that represents a publish/subscribe topic.
Currently, it's only used internally in the framework; the
API expects and returns plain old tuples.
It currently exists mostly as a place to keep the matches()
function. This function, though, could also correctly be
seen as an attribute of the P/S server. Getting rid of this
class would also mean one fewer object instantiation per
message send.
"""
listType = type([])
tupleType = type(())
def __init__(self, items):
# Make sure we have a tuple.
if type(items) == self.__class__.listType:
items = tuple(items)
elif type(items) != self.__class__.tupleType:
items = (items,)
self.items = items
self.length = len(items)
def matches(self, aTopic):
"""
Consider myself to be a topic pattern,
and return True if I match the given specific
topic. For example,
a = ('sports')
b = ('sports','baseball')
a.matches(b) --> 1
b.matches(a) --> 0
"""
# The question this method answers is equivalent to;
# is my list a sublist of aTopic's? So, my algorithm
# is: 1) make a copy of the aTopic list which is
# truncated to the pattern's length. 2) Test for
# equality.
#
# This algorithm may be somewhat memory-intensive,
# because it creates a temporary list on each
# call to match. A possible to-do would be to
# re-write this with a hand-coded loop.
return (self.items == aTopic.items[:self.length])
def __repr__(self):
import string
return '<Topic>' + string.join(map(repr, self.items), ', ') + '</Topic>'
def __eq__(self, aTopic):
"""
Return True if I equal the given topic. We're considered
equal if our tuples are equal.
"""
if type(self) != type(aTopic):
return 0
else:
return self.items == aTopic.items
def __ne__(self, aTopic):
"""
Return False if I equal the given topic.
"""
return not self == aTopic
#---------------------------------------------------------------------------
#
# Code for a simple command-line test
#
if __name__ == '__main__':
class SimpleListener:
def __init__(self, number):
self.number = number
def notify(self, message):
print '#'+str(self.number)+' got the message:', message
# Build a list of ten listeners.
lList = []
for x in range(10):
lList.append(SimpleListener(x))
server = Publisher()
# Everyone's interested in politics...
for x in lList:
Publisher().subscribe(topic='politics', listener=x.notify) # also tests singleton
# But only the first four are interested in trivia.
for x in lList[:4]:
server.subscribe(topic='trivia', listener=x.notify)
# This one subscribes to everything.
everythingListener = SimpleListener(999)
server.subscribe(topic=(), listener=everythingListener.notify)
# Now send out two messages, testing topic matching.
server.sendMessage(topic='trivia', data='What is the capitol of Oregon?')
server.sendMessage(topic=('politics','germany'), data='The Greens have picked up another seat in the Bundestag.')
#---------------------------------------------------------------------------

View File

@@ -30,7 +30,7 @@ etc... But it's a good start.
from wxPython.wx import *
from wxPython.stc import *
import sys, string, keyword
import sys, keyword
from code import InteractiveInterpreter
#----------------------------------------------------------------------
@@ -238,7 +238,7 @@ class PyShellWindow(wxStyledTextCtrl, InteractiveInterpreter):
lastPos = self.GetTextLength()
if self.lastPromptPos and self.lastPromptPos != lastPos:
self.SetLexer(wxSTC_LEX_PYTHON)
self.SetKeywords(0, string.join(keyword.kwlist))
self.SetKeywords(0, ' '.join(keyword.kwlist))
self.Colourise(self.lastPromptPos, lastPos)
@@ -248,7 +248,7 @@ class PyShellWindow(wxStyledTextCtrl, InteractiveInterpreter):
def OnUpdateUI(self, evt):
# check for matching braces
braceAtCaret = -1
braceOpposite = -1
braceOpposite = -1
charBefore = None
caretPos = self.GetCurrentPos()
if caretPos > 0:

View File

@@ -72,7 +72,6 @@ from wxPython.wx import *
import xmlrpcserver,xmlrpclib
import threading
import SocketServer
import string
import new
import sys
@@ -305,7 +304,7 @@ class rpcMixin:
event.rpcStatusLock.acquire()
doQuit = 0
try:
methsplit = string.split(event.method,'.')
methsplit = event.method.split('.')
meth = self
for piece in methsplit:
meth = getattr(meth,piece)
@@ -388,8 +387,8 @@ if __name__ == '__main__':
self.frame = rpcFrame(NULL, -1, "wxPython RPCDemo", wxDefaultPosition,
wxSize(300,300),
rpcHost='localhost',rpcPort=port)
self.frame.Show(TRUE)
return TRUE
self.frame.Show(True)
return True
def testcon(port):

View File

@@ -0,0 +1,85 @@
#----------------------------------------------------------------------------
# Name: wxScrolledPanel.py
# Author: Will Sadkin
# Created: 03/21/2003
# Copyright: (c) 2003 by Will Sadkin
# RCS-ID: $Id$
# License: wxWindows license
#----------------------------------------------------------------------------
#
from wxPython.wx import *
class wxScrolledPanel( wxScrolledWindow ):
"""
wxScrolledPanel fills a "hole" in the implementation of wxScrolledWindow,
providing automatic scrollbar and scrolling behavior and the tab traversal
management that wxScrolledWindow lacks. This code was based on the original
demo code showing how to do this, but is now available for general use
as a proper class (and the demo is now converted to just use it.)
"""
def __init__(self, parent, id=-1,
pos = wxDefaultPosition, size = wxDefaultSize,
style = wxTAB_TRAVERSAL, name = "scrolledpanel"):
wxScrolledWindow.__init__(self, parent, -1,
pos=pos, size=size,
style=style, name=name)
def SetupScrolling(self, scroll_x=True, scroll_y=True, rate_x=1, rate_y=1):
"""
This function sets up the event handling necessary to handle
scrolling properly. It should be called within the __init__
function of any class that is derived from wxScrolledPanel,
once the controls on the panel have been constructed and
thus the size of the scrolling area can be determined.
"""
# The following is all that is needed to integrate the sizer and the
# scrolled window.
if not scroll_x: rate_x = 0
if not scroll_y: rate_y = 0
self.SetScrollRate(rate_x, rate_y)
self.GetSizer().SetVirtualSizeHints(self)
EVT_CHILD_FOCUS(self, self.OnChildFocus)
wxCallAfter(self.Scroll, 0, 0) # scroll back to top after initial events
def OnChildFocus(self, evt):
# If the child window that gets the focus is not visible,
# this handler will try to scroll enough to see it.
evt.Skip()
child = evt.GetWindow()
sppu_x, sppu_y = self.GetScrollPixelsPerUnit()
vs_x, vs_y = self.GetViewStart()
cpos = child.GetPosition()
csz = child.GetSize()
new_vs_x, new_vs_y = -1, -1
# is it before the left edge?
if cpos.x < 0 and sppu_x > 0:
new_vs_x = cpos.x / sppu_x
# is it above the top?
if cpos.y < 0 and sppu_y > 0:
new_vs_y = cpos.y / sppu_y
# is it past the right edge ?
if cpos.x + csz.width > self.GetClientSize().width and sppu_x > 0:
diff = (cpos.x + csz.width - self.GetClientSize().width) / sppu_x
new_vs_x = vs_x + diff + 1
# is it below the bottom ?
if cpos.y + csz.height > self.GetClientSize().height and sppu_y > 0:
diff = (cpos.y + csz.height - self.GetClientSize().height) / sppu_y
new_vs_y = vs_y + diff + 1
# if we need to adjust
if new_vs_x != -1 or new_vs_y != -1:
self.Scroll(new_vs_x, new_vs_y)

View File

@@ -5,7 +5,7 @@
from wxPython.wx import *
from wxPython.grid import *
from string import *
import string
#---------------------------------------------------------------------------
class CTextCellEditor(wxTextCtrl):
@@ -20,26 +20,26 @@ class CTextCellEditor(wxTextCtrl):
key = evt.GetKeyCode()
if key == WXK_DOWN:
self._grid.DisableCellEditControl() # Commit the edit
self._grid.MoveCursorDown(false) # Change the current cell
self._grid.MoveCursorDown(False) # Change the current cell
elif key == WXK_UP:
self._grid.DisableCellEditControl() # Commit the edit
self._grid.MoveCursorUp(false) # Change the current cell
self._grid.MoveCursorUp(False) # Change the current cell
elif key == WXK_LEFT:
self._grid.DisableCellEditControl() # Commit the edit
self._grid.MoveCursorLeft(false) # Change the current cell
self._grid.MoveCursorLeft(False) # Change the current cell
elif key == WXK_RIGHT:
self._grid.DisableCellEditControl() # Commit the edit
self._grid.MoveCursorRight(false) # Change the current cell
self._grid.MoveCursorRight(False) # Change the current cell
evt.Skip() # Continue event
#---------------------------------------------------------------------------
class CCellEditor(wxPyGridCellEditor):
""" Custom cell editor """
def __init__(self, grid):
wxPyGridCellEditor.__init__(self)
self._grid = grid # Save a reference to the grid
def Create(self, parent, id, evtHandler):
""" Create the actual edit control. Must derive from wxControl.
Must Override
@@ -68,7 +68,7 @@ class CCellEditor(wxPyGridCellEditor):
"""
# Call base class method.
self.base_PaintBackground(self, rect, attr)
def BeginEdit(self, row, col, grid):
""" Fetch the value from the table and prepare edit control to begin editing.
Set the focus to the edit control. Must Override.
@@ -76,19 +76,19 @@ class CCellEditor(wxPyGridCellEditor):
self._startValue = grid.GetTable().GetValue(row, col)
self._tc.SetValue(self._startValue)
self._tc.SetFocus()
# Select the text when initiating an edit so that subsequent typing
# replaces the contents.
self._tc.SetSelection(0, self._tc.GetLastPosition())
def EndEdit(self, row, col, grid):
""" Commit editing the current cell. Returns true if the value has changed.
""" Commit editing the current cell. Returns True if the value has changed.
If necessary, the control may be destroyed. Must Override.
"""
changed = false # Assume value not changed
changed = False # Assume value not changed
val = self._tc.GetValue() # Get value in edit control
if val != self._startValue: # Compare
changed = true # If different then changed is true
changed = True # If different then changed is True
grid.GetTable().SetValue(row, col, val) # Update the table
self._startValue = '' # Clear the class' start value
self._tc.SetValue('') # Clear contents of the edit control
@@ -101,7 +101,7 @@ class CCellEditor(wxPyGridCellEditor):
self._tc.SetInsertionPointEnd()
def IsAcceptedKey(self, evt):
""" Return true to allow the given key to start editing. The base class
""" Return True to allow the given key to start editing. The base class
version only checks that the event has no modifiers. F2 is special
and will always start the editor.
"""
@@ -117,15 +117,15 @@ class CCellEditor(wxPyGridCellEditor):
if key in [WXK_NUMPAD0, WXK_NUMPAD1, WXK_NUMPAD2, WXK_NUMPAD3, WXK_NUMPAD4,
WXK_NUMPAD5, WXK_NUMPAD6, WXK_NUMPAD7, WXK_NUMPAD8, WXK_NUMPAD9]:
ch = chr(ord('0') + key - WXK_NUMPAD0)
elif key == WXK_BACK: # Empty text control when init w/ back key
ch = ""
# Handle normal keys
elif key < 256 and key >= 0 and chr(key) in string.printable:
ch = chr(key)
if not evt.ShiftDown():
ch = string.lower(ch)
ch = ch.lower()
if ch is not None: # If are at this point with a key,
self._tc.SetValue(ch) # replace the contents of the text control.
self._tc.SetInsertionPointEnd() # Move to the end so that subsequent keys are appended
@@ -150,7 +150,7 @@ class CCellEditor(wxPyGridCellEditor):
class CSheet(wxGrid):
def __init__(self, parent):
wxGrid.__init__(self, parent, -1)
# Init variables
self._lastCol = -1 # Init last cell column clicked
self._lastRow = -1 # Init last cell row clicked
@@ -159,7 +159,7 @@ class CSheet(wxGrid):
self.RegisterDataType(wxGRID_VALUE_STRING,
wxGridCellStringRenderer(),
CCellEditor(self))
self.CreateGrid(4, 3) # By default start with a 4 x 3 grid
self.SetColLabelSize(18) # Default sizes and alignment
self.SetRowLabelSize(50)
@@ -167,8 +167,8 @@ class CSheet(wxGrid):
self.SetColSize(0, 75) # Default column sizes
self.SetColSize(1, 75)
self.SetColSize(2, 75)
# Sink events
# Sink events
EVT_GRID_CELL_LEFT_CLICK( self, self.OnLeftClick)
EVT_GRID_CELL_RIGHT_CLICK( self, self.OnRightClick)
EVT_GRID_CELL_LEFT_DCLICK( self, self.OnLeftDoubleClick)
@@ -183,7 +183,7 @@ class CSheet(wxGrid):
# Save the last cell coordinates
self._lastRow, self._lastCol = event.GetRow(), event.GetCol()
event.Skip()
def OnRowSize(self, event):
event.Skip()
@@ -192,48 +192,48 @@ class CSheet(wxGrid):
def OnCellChange(self, event):
event.Skip()
def OnLeftClick(self, event):
""" Override left-click behavior to prevent left-click edit initiation """
# Save the cell clicked
currCell = (event.GetRow(), event.GetCol())
# Suppress event if same cell clicked twice in a row.
# This prevents a single-click from initiating an edit.
if currCell != (self._lastRow, self._lastCol): event.Skip()
def OnRightClick(self, event):
""" Move grid cursor when a cell is right-clicked """
self.SetGridCursor( event.GetRow(), event.GetCol() )
event.Skip()
def OnLeftDoubleClick(self, event):
""" Initiate the cell editor on a double-click """
# Move grid cursor to double-clicked cell
if self.CanEnableCellControl():
self.SetGridCursor( event.GetRow(), event.GetCol() )
self.EnableCellEditControl(true) # Show the cell editor
self.EnableCellEditControl(True) # Show the cell editor
event.Skip()
def OnRangeSelect(self, event):
""" Track which cells are selected so that copy/paste behavior can be implemented """
# If a single cell is selected, then Selecting() returns false (0)
# If a single cell is selected, then Selecting() returns False (0)
# and range coords are entire grid. In this case cancel previous selection.
# If more than one cell is selected, then Selecting() is true (1)
# If more than one cell is selected, then Selecting() is True (1)
# and range accurately reflects selected cells. Save them.
# If more cells are added to a selection, selecting remains true (1)
# If more cells are added to a selection, selecting remains True (1)
self._selected = None
if event.Selecting():
self._selected = ((event.GetTopRow(), event.GetLeftCol()),
(event.GetBottomRow(), event.GetRightCol()))
event.Skip()
def Copy(self):
""" Copy the currently selected cells to the clipboard """
# TODO: raise an error when there are no cells selected?
if self._selected == None: return
((r1, c1), (r2, c2)) = self._selected
# Build a string to put on the clipboard
# (Is there a faster way to do this in Python?)
crlf = chr(13) + chr(10)
@@ -245,7 +245,7 @@ class CSheet(wxGrid):
s += tab
s += self.GetCellValue(row, c2)
s += crlf
# Put the string on the clipboard
if wxTheClipboard.Open():
wxTheClipboard.Clear()
@@ -261,15 +261,15 @@ class CSheet(wxGrid):
wxTheClipboard.Close()
if not success: return # Exit on failure
s = td.GetText() # Get the text
crlf = chr(13) + chr(10) # CrLf characters
tab = chr(9) # Tab character
rows = split(s, crlf) # split into rows
rows = s.split(crlf) # split into rows
rows = rows[0:-1] # leave out last element, which is always empty
for i in range(0, len(rows)): # split rows into elements
rows[i] = split(rows[i], tab)
rows[i] = rows[i].split(tab)
# Get the starting and ending cell range to paste into
if self._selected == None: # If no cells selected...
r1 = self.GetGridCursorRow() # Start the paste at the current location
@@ -278,7 +278,7 @@ class CSheet(wxGrid):
c2 = self.GetNumberCols()-1
else: # If cells selected, only paste there
((r1, c1), (r2, c2)) = self._selected
# Enter data into spreadsheet cells one at a time
r = r1 # Init row and column counters
c = c1
@@ -306,8 +306,8 @@ class CSheet(wxGrid):
def SetNumberRows(self, numRows=1):
""" Set the number of rows in the sheet """
# Check for non-negative number
if numRows < 0: return false
if numRows < 0: return False
# Adjust number of rows
curRows = self.GetNumberRows()
if curRows < numRows:
@@ -315,13 +315,13 @@ class CSheet(wxGrid):
elif curRows > numRows:
self.DeleteRows(numRows, curRows - numRows)
return true
return True
def SetNumberCols(self, numCols=1):
""" Set the number of columns in the sheet """
# Check for non-negative number
if numCols < 0: return false
if numCols < 0: return False
# Adjust number of rows
curCols = self.GetNumberCols()
if curCols < numCols:
@@ -329,4 +329,4 @@ class CSheet(wxGrid):
elif curCols > numCols:
self.DeleteCols(numCols, curCols - numCols)
return true
return True

View File

@@ -29,7 +29,7 @@ History:
__version__ ="$Revision$"
# $RCSfile$
import sys, string, code, traceback
import sys, code, traceback
from wxPython.wx import *
from wxPython.html import *
@@ -58,11 +58,11 @@ class PyShellInput(wxPanel):
tid =wxNewId()
self.entry =wxTextCtrl(self, tid, style = wxTE_MULTILINE)
EVT_CHAR(self.entry, self.OnChar)
self.entry.SetFont(wxFont(9, wxMODERN, wxNORMAL, wxNORMAL, false))
self.entry.SetFont(wxFont(9, wxMODERN, wxNORMAL, wxNORMAL, False))
sizer =wxBoxSizer(wxVERTICAL)
sizer.AddMany([(self.label, 0, wxEXPAND), (self.entry, 1, wxEXPAND)])
self.SetSizer(sizer)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
EVT_SET_FOCUS(self, self.OnSetFocus)
# when in "continuation" mode,
# two consecutive newlines are required
@@ -90,7 +90,7 @@ class PyShellInput(wxPanel):
return
text =self.entry.GetValue()
# weird CRLF thingy
text =string.replace(text, "\r\n", "\n")
text = text.replace("\r\n", "\n")
# see if we've finished
if (not (self.first_line or text[-1] =="\n") # in continuation mode
or (text[-1] =="\\") # escaped newline
@@ -153,7 +153,7 @@ class PyShellOutput(wxPanel):
self.client =self.html # used in OnSize()
self.text =self.intro
self.html.SetPage(self.text)
self.html.SetAutoLayout(TRUE)
self.html.SetAutoLayout(True)
self.line_buffer =""
# refreshes are annoying
self.in_batch =0
@@ -193,9 +193,9 @@ class PyShellOutput(wxPanel):
if 0 and __debug__: sys.__stdout__.write(text)
# handle entities
for (symbol, eref) in self.erefs:
text =string.replace(text, symbol, eref)
text = text.replace(symbol, eref)
# replace newlines
text =string.replace(text, "\n", style[2])
text = text.replace("\n", style[2])
# add to contents
self.text =self.text +style[0] +text +style[1]
if not self.in_batch: self.UpdWindow()
@@ -302,14 +302,14 @@ class PyShell(wxPanel):
(etype, value, tb) =sys.exc_info()
# remove myself from traceback
tblist =traceback.extract_tb(tb)[1:]
msg =string.join(traceback.format_exception_only(etype, value)
msg = ' '.join(traceback.format_exception_only(etype, value)
+traceback.format_list(tblist))
self.output.write_exc(msg)
def ShowSyntaxError(self):
"""display message about syntax error (no traceback here)"""
(etype, value, tb) =sys.exc_info()
msg =string.join(traceback.format_exception_only(etype, value))
msg = ' '.join(traceback.format_exception_only(etype, value))
self.output.write_exc(msg)
def OnSize(self, event):
@@ -328,7 +328,7 @@ if __name__ == '__main__':
"""Demonstrates usage of both default and customized shells"""
def OnInit(self):
frame = MyFrame()
frame.Show(TRUE)
frame.Show(True)
self.SetTopWindow(frame)
## PyShellInput.PS1 =" let's get some work done..."
## PyShellInput.PS2 =" ok, what do you really mean?"
@@ -344,8 +344,8 @@ if __name__ == '__main__':
## "<br>&lt;-- move this sash to see html debug output</I><br>\n"
## PyShellOutput.html_debug =1
## frame = MyFrame(title="Customized wxPython Shell")
## frame.Show(TRUE)
return TRUE
## frame.Show(True)
return True
app = MyApp(0)
app.MainLoop()

View File

@@ -57,7 +57,7 @@ class SplashScreen(wxFrame):
EVT_PAINT(self, self.OnPaint)
EVT_ERASE_BACKGROUND(self, self.OnEraseBG)
self.Show(true)
self.Show(True)
class SplashTimer(wxTimer):
@@ -73,16 +73,16 @@ class SplashScreen(wxFrame):
def OnPaint(self, event):
dc = wxPaintDC(self)
dc.DrawBitmap(self.bitmap, 0,0, false)
dc.DrawBitmap(self.bitmap, 0,0, False)
def OnEraseBG(self, event):
pass
def OnSplashExitDefault(self, event=None):
self.Close(true)
self.Close(True)
def OnCloseWindow(self, event=None):
self.Show(false)
self.Show(False)
self.timer.Stop()
del self.timer
self.Destroy()
@@ -100,12 +100,12 @@ if __name__ == "__main__":
wxImage_AddHandler(wxPNGHandler())
wxImage_AddHandler(wxGIFHandler())
self.splash = SplashScreen(NULL, bitmapfile="splashscreen.jpg", callback=self.OnSplashExit)
self.splash.Show(true)
self.splash.Show(True)
self.SetTopWindow(self.splash)
return true
return True
def OnSplashExit(self, event=None):
print "Yay! Application callback worked!"
self.splash.Close(true)
self.splash.Close(True)
del self.splash
### Build working windows here...
def test(sceneGraph=None):

View File

@@ -16,7 +16,6 @@
"""
from wxPython.wx import *
import string
#----------------------------------------------------------------------
@@ -65,6 +64,8 @@ class wxGenStaticText(wxPyControl):
style = self.GetWindowStyleFlag()
if not style & wxST_NO_AUTORESIZE:
self.SetSize(self.GetBestSize())
self.Refresh()
def SetFont(self, font):
"""
@@ -75,6 +76,7 @@ class wxGenStaticText(wxPyControl):
style = self.GetWindowStyleFlag()
if not style & wxST_NO_AUTORESIZE:
self.SetSize(self.GetBestSize())
self.Refresh()
def DoGetBestSize(self):
@@ -94,13 +96,17 @@ class wxGenStaticText(wxPyControl):
def AcceptsFocus(self):
"""Overridden base class virtual."""
return false
return False
def OnPaint(self, event):
width, height = self.GetClientSize()
dc = wxBufferedPaintDC(self)
#dc = wxPaintDC(self)
width, height = self.GetClientSize()
if not width or not height:
return
dc.SetBackground(wxBrush(self.GetBackgroundColour(), wxSOLID))
dc.SetTextForeground(self.GetForegroundColour())
dc.Clear()
dc.SetFont(self.GetFont())
label = self.GetLabel()

Some files were not shown because too many files have changed in this diff Show More