diff --git a/wxPython/wxPython/lib/PyCrust/CHANGES.txt b/wxPython/wxPython/lib/PyCrust/CHANGES.txt index dde8560573..1e2bdafe8e 100644 --- a/wxPython/wxPython/lib/PyCrust/CHANGES.txt +++ b/wxPython/wxPython/lib/PyCrust/CHANGES.txt @@ -7,8 +7,8 @@ ----------------------------------------- -0.9 (2/27/2003 to //2003) -========================= +0.9 (2/27/2003 to 3/20/2003) +============================ Added fontIncrease, fontDecrease, fontDefault signals, receivers and keybindings: @@ -23,6 +23,7 @@ documentation and docstrings for wxPython classes and functions. Introduced new tabbed interface: * Namespace +* Calltip * Session * Dispatcher * wxPython Docs diff --git a/wxPython/wxPython/lib/PyCrust/PyCrustApp.py b/wxPython/wxPython/lib/PyCrust/PyCrustApp.py index 1720f48aa5..036e368002 100755 --- a/wxPython/wxPython/lib/PyCrust/PyCrustApp.py +++ b/wxPython/wxPython/lib/PyCrust/PyCrustApp.py @@ -29,16 +29,16 @@ class App(wx.wxApp): wx.wxInitAllImageHandlers() locals = __main__.__dict__ from crust import CrustFrame - self.crustFrame = CrustFrame(locals=locals) - self.crustFrame.SetSize((800, 600)) - self.crustFrame.Show() - self.SetTopWindow(self.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 + sys.app = self return 1 ''' @@ -59,12 +59,12 @@ def main(): for key in md.keys(): if key not in keepers: del md[key] - application = App(0) + 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__'] - application.MainLoop() + app.MainLoop() if __name__ == '__main__': main() diff --git a/wxPython/wxPython/lib/PyCrust/PyShellApp.py b/wxPython/wxPython/lib/PyCrust/PyShellApp.py index 7876d17933..2ef7aae07f 100755 --- a/wxPython/wxPython/lib/PyCrust/PyShellApp.py +++ b/wxPython/wxPython/lib/PyCrust/PyShellApp.py @@ -29,17 +29,17 @@ class App(wx.wxApp): wx.wxInitAllImageHandlers() locals = __main__.__dict__ from shell import ShellFrame - self.shellFrame = ShellFrame(locals=locals) - self.shellFrame.SetSize((750, 525)) - self.shellFrame.Show() - self.SetTopWindow(self.shellFrame) - self.shellFrame.shell.SetFocus() + 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 + sys.app = self return 1 ''' @@ -60,12 +60,12 @@ def main(): for key in md.keys(): if key not in keepers: del md[key] - application = App(0) + 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__'] - application.MainLoop() + app.MainLoop() if __name__ == '__main__': main() diff --git a/wxPython/wxPython/lib/PyCrust/crust.py b/wxPython/wxPython/lib/PyCrust/crust.py index 176180b05f..caeb20f6db 100644 --- a/wxPython/wxPython/lib/PyCrust/crust.py +++ b/wxPython/wxPython/lib/PyCrust/crust.py @@ -44,30 +44,46 @@ class Crust(wx.wxSplitterWindow): rootIsNamespace=rootIsNamespace) # Add 'filling' to the interpreter's locals. self.shell.interp.locals['filling'] = self.filling -## self.notebook.AddPage(pPage=self.filling, strText='Namespace', bSelect=True) - self.notebook.AddPage(self.filling, 'Namespace', True) + 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(self.sessionlisting, 'Session') + self.notebook.AddPage(page=self.sessionlisting, text='Session') self.dispatcherlisting = DispatcherListing(parent=self.notebook) - self.notebook.AddPage(self.dispatcherlisting, 'Dispatcher') + 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(self.wxdocs, 'wxPython Docs') + 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(self.stcdocs, 'StyledTextCtrl Docs') + self.notebook.AddPage(page=self.stcdocs, text='StyledTextCtrl Docs') self.SplitHorizontally(self.shell, self.notebook, 300) self.SetMinimumPaneSize(1) +class Calltip(wx.wxTextCtrl): + """Text control containing the most recent shell calltip.""" + + 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.""" diff --git a/wxPython/wxPython/lib/PyCrust/filling.py b/wxPython/wxPython/lib/PyCrust/filling.py index 787933e2fe..9a846b4def 100644 --- a/wxPython/wxPython/lib/PyCrust/filling.py +++ b/wxPython/wxPython/lib/PyCrust/filling.py @@ -117,11 +117,11 @@ class FillingTree(wx.wxTreeCtrl): """Return dictionary with attributes or contents of object.""" busy = wx.wxBusyCursor() otype = type(obj) - if otype is dict \ + if otype is types.DictType \ or str(otype)[17:23] == 'BTrees' and hasattr(obj, 'keys'): return obj d = {} - if isinstance(obj, (list, tuple)): + if otype is types.ListType or otype is types.TupleType: for n in range(len(obj)): key = '[' + str(n) + ']' d[key] = obj[n] diff --git a/wxPython/wxPython/lib/PyCrust/shell.py b/wxPython/wxPython/lib/PyCrust/shell.py index dc20e07401..f522356f09 100644 --- a/wxPython/wxPython/lib/PyCrust/shell.py +++ b/wxPython/wxPython/lib/PyCrust/shell.py @@ -996,6 +996,7 @@ Platform: %s""" % \ # In case there isn't enough room, only go back to the # fallback. tippos = max(tippos, fallback) + dispatcher.send(signal='Shell.calltip', sender=self, calltip=tip) self.CallTipShow(tippos, tip) def writeOut(self, text): diff --git a/wxPython/wxPython/lib/PyCrust/version.py b/wxPython/wxPython/lib/PyCrust/version.py index 54c2eb7348..3950c4a402 100644 --- a/wxPython/wxPython/lib/PyCrust/version.py +++ b/wxPython/wxPython/lib/PyCrust/version.py @@ -7,5 +7,5 @@ __author__ = "Patrick K. O'Brien " __cvsid__ = "$Id$" __revision__ = "$Revision$"[11:-2] -VERSION = '0.9b' +VERSION = '0.9' diff --git a/wxPython/wxPython/lib/PyCrust/wxd/App.py b/wxPython/wxPython/lib/PyCrust/wxd/App.py index 1aa141a70f..8da71fecf6 100644 --- a/wxPython/wxPython/lib/PyCrust/wxd/App.py +++ b/wxPython/wxPython/lib/PyCrust/wxd/App.py @@ -13,6 +13,13 @@ __revision__ = "$Revision$"[11:-2] from Base import EvtHandler +import Parameters as wx + +try: + True +except NameError: + True = 1==1 + False = 1==0 class PyApp(EvtHandler): @@ -27,20 +34,12 @@ class PyApp(EvtHandler): - initiate application processing via App.OnInit; - allow default processing of events not handled by other objects - in the application.""" + in the application.""" def __init__(self): """Create a PyApp instance.""" pass - def __del__(self): - """""" - pass - - def _setCallbackInfo(self): - """""" - pass - def Dispatch(self): """Dispatches the next event in the windowing system event queue. @@ -153,7 +152,10 @@ class PyApp(EvtHandler): 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): @@ -258,62 +260,27 @@ class PyApp(EvtHandler): 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. -## The following implementation was taken from the wx.py source -## file. It is included here simply as a reference: + 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 -## _defRedirect = (wxPlatform == '__WXMSW__' or wxPlatform == '__WXMAC__') -## class wxApp(wxPyApp): -## error = 'wxApp.error' -## outputWindowClass = wxPyOnDemandOutputWindow - -## def __init__(self, redirect=_defRedirect, filename=None, -## useBestVisual=false): -## pass -## wxPyApp.__init__(self) -## self.stdioWin = None -## self.saveStdio = (sys.stdout, sys.stderr) - -## # This has to be done before OnInit -## self.SetUseBestVisual(useBestVisual) - -## if redirect: -## self.RedirectStdio(filename) - -## # this initializes wxWindows and then calls our OnInit -## _wxStart(self.OnInit) - -## def __del__(self): -## try: -## self.RestoreStdio() -## except: -## pass - -## def SetTopWindow(self, frame): -## if self.stdioWin: -## self.stdioWin.SetParent(frame) -## wxPyApp.SetTopWindow(self, frame) - -## def MainLoop(self): -## wxPyApp.MainLoop(self) -## self.RestoreStdio() - -## def RedirectStdio(self, filename): -## if filename: -## sys.stdout = sys.stderr = open(filename, 'a') -## else: -## self.stdioWin = self.outputWindowClass() -## sys.stdout = sys.stderr = self.stdioWin - -## def RestoreStdio(self): -## sys.stdout, sys.stderr = self.saveStdio +del _redirect class PyOnDemandOutputWindow: @@ -339,32 +306,53 @@ class PySimpleApp(App): class PyWidgetTester(App): - """""" + """Use instead of App for testing widgets. Provides a frame + containing an instance of a widget. - def __init__(self): - """""" + 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): - """""" + 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. - def __init__(self): - """""" + 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): - """""" + 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 diff --git a/wxPython/wxPython/lib/PyCrust/wxd/Base.py b/wxPython/wxPython/lib/PyCrust/wxd/Base.py index bf2af301d0..fd5c706bbb 100644 --- a/wxPython/wxPython/lib/PyCrust/wxd/Base.py +++ b/wxPython/wxPython/lib/PyCrust/wxd/Base.py @@ -42,10 +42,6 @@ class EvtHandler(Object): """Create a EvtHandler instance.""" pass - def _setOORInfo(self): - """""" - pass - def AddPendingEvent(self, event): """Post an event to be processed later. diff --git a/wxPython/wxPython/lib/PyCrust/wxd/Controls.py b/wxPython/wxPython/lib/PyCrust/wxd/Controls.py index 9d1d77983a..1d1fad0210 100644 --- a/wxPython/wxPython/lib/PyCrust/wxd/Controls.py +++ b/wxPython/wxPython/lib/PyCrust/wxd/Controls.py @@ -16,6 +16,12 @@ from Base import Object import Parameters as wx from Window import Window +try: + True +except NameError: + True = 1==1 + False = 1==0 + class Control(Window): """Base class for a control or 'widget'. diff --git a/wxPython/wxPython/lib/PyCrust/wxd/Frames.py b/wxPython/wxPython/lib/PyCrust/wxd/Frames.py index 4ec3542fe7..94c0e72074 100644 --- a/wxPython/wxPython/lib/PyCrust/wxd/Frames.py +++ b/wxPython/wxPython/lib/PyCrust/wxd/Frames.py @@ -18,92 +18,221 @@ 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 Create(self): - """""" + def Command(self, id): + """Simulate a menu command; id is a menu item identifier.""" pass - def Command(self): - """""" + 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 CreateStatusBar(self): - """""" + 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 CreateToolBar(self): - """""" - pass + def DoGiveHelp(self, text, show): + """Show help text (typically in the statusbar). - def DoGiveHelp(self): - """""" + 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): - """""" + def PopStatusText(self, number=0): + """Redraw status bar with previous status text. + + number - The status field (starting from zero).""" pass - def ProcessCommand(self): - """""" + def ProcessCommand(self, id): + """Process menu command; return True if processed. + + id is the menu command identifier.""" pass - def PushStatusText(self): - """""" + 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): - """""" + 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): - """""" + def SetStatusBar(self, statBar): + """Associate a status bar with the frame.""" pass - def SetStatusBarPane(self): - """""" + 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): - """""" + 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): - """""" + 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): - """""" + def SetToolBar(self, toolbar): + """Associate a toolbar with the frame.""" pass @@ -309,5 +438,3 @@ class StatusBar(Window): def SetStatusWidths(self): """""" pass - - diff --git a/wxPython/wxPython/lib/PyCrust/wxd/Functions.py b/wxPython/wxPython/lib/PyCrust/wxd/Functions.py index 0ce7741e60..67af4e18be 100644 --- a/wxPython/wxPython/lib/PyCrust/wxd/Functions.py +++ b/wxPython/wxPython/lib/PyCrust/wxd/Functions.py @@ -67,13 +67,11 @@ def Button_GetDefaultSize(): """""" pass -## def CallAfter(): -## """""" -## pass - -import wx as wxpy -CallAfter = wxpy.CallAfter -del wxpy +def CallAfter(callable, *args, **kw): + """Call the specified function after the current and pending event + handlers have been completed. This is also good for making GUI + method calls from non-GUI threads.""" + pass def Caret_GetBlinkTime(): """""" diff --git a/wxPython/wxPython/lib/PyCrust/wxd/Panel.py b/wxPython/wxPython/lib/PyCrust/wxd/Panel.py index a28c3d4e4a..41e535b7ce 100644 --- a/wxPython/wxPython/lib/PyCrust/wxd/Panel.py +++ b/wxPython/wxPython/lib/PyCrust/wxd/Panel.py @@ -15,6 +15,12 @@ __revision__ = "$Revision$"[11:-2] import Parameters as wx from Window import Window +try: + True +except NameError: + True = 1==1 + False = 1==0 + class Panel(Window): """""" diff --git a/wxPython/wxPython/lib/PyCrust/wxd/Parameters.py b/wxPython/wxPython/lib/PyCrust/wxd/Parameters.py index 81ba979976..2bc3c79592 100644 --- a/wxPython/wxPython/lib/PyCrust/wxd/Parameters.py +++ b/wxPython/wxPython/lib/PyCrust/wxd/Parameters.py @@ -12,13 +12,13 @@ __revision__ = "$Revision$"[11:-2] # C-language classes. -class Param: +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 = self.__class__.__name__ + value = 'wx.' + self.__class__.__name__ self.value = value def __repr__(self): @@ -28,55 +28,41 @@ class Param: 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', + ) -class NULL(Param): pass -NULL = NULL() +## Create classes, then instances, like this: -class BOTH(Param): pass -BOTH = BOTH() +## class BOTH(Param): pass +## BOTH = BOTH() -class DEFAULT_FRAME_STYLE(Param): pass -DEFAULT_FRAME_STYLE = DEFAULT_FRAME_STYLE() - -class DefaultPosition(Param): pass -DefaultPosition = DefaultPosition() - -class DefaultSize(Param): pass -DefaultSize = DefaultSize() - -class DefaultValidator(Param): pass -DefaultValidator = DefaultValidator() - -class EVT_NULL(Param): pass -EVT_NULL = EVT_NULL() - -class HSCROLL(Param): pass -HSCROLL = HSCROLL() - -class NullColour(Param): pass -NullColour = NullColour() - -class PyFrameNameStr(Param): pass -PyFrameNameStr = PyFrameNameStr() - -class PyNOTEBOOK_NAME(Param): pass -PyNOTEBOOK_NAME = PyNOTEBOOK_NAME() - -class PyPanelNameStr(Param): pass -PyPanelNameStr = PyPanelNameStr() - -class PySTCNameStr(Param): pass -PySTCNameStr = PySTCNameStr() - -class SIZE_AUTO(Param): pass -SIZE_AUTO = SIZE_AUTO() - -class SIZE_USE_EXISTING(Param): pass -SIZE_USE_EXISTING = SIZE_USE_EXISTING() - -class TAB_TRAVERSAL(Param): pass -TAB_TRAVERSAL = TAB_TRAVERSAL() - -class VSCROLL(Param): pass -VSCROLL = VSCROLL() +for _param in _params: + exec 'class %s(_Param): pass' % _param + exec '%s = %s()' % (_param, _param) +del _param +del _params +del _Param diff --git a/wxPython/wxPython/lib/PyCrust/wxd/Validators.py b/wxPython/wxPython/lib/PyCrust/wxd/Validators.py index 88f1054a0e..6c5e87e240 100644 --- a/wxPython/wxPython/lib/PyCrust/wxd/Validators.py +++ b/wxPython/wxPython/lib/PyCrust/wxd/Validators.py @@ -15,6 +15,12 @@ __revision__ = "$Revision$"[11:-2] from Base import EvtHandler import Parameters as wx +try: + True +except NameError: + True = 1==1 + False = 1==0 + class Validator(EvtHandler): """""" diff --git a/wxPython/wxPython/lib/PyCrust/wxd/Window.py b/wxPython/wxPython/lib/PyCrust/wxd/Window.py index 16ec016480..51392a094d 100644 --- a/wxPython/wxPython/lib/PyCrust/wxd/Window.py +++ b/wxPython/wxPython/lib/PyCrust/wxd/Window.py @@ -15,6 +15,12 @@ __revision__ = "$Revision$"[11:-2] from Base import EvtHandler import Parameters as wx +try: + True +except NameError: + True = 1==1 + False = 1==0 + class Window(EvtHandler): """""" diff --git a/wxPython/wxPython/lib/PyCrust/wxd/decorator.py b/wxPython/wxPython/lib/PyCrust/wxd/decorator.py index 26b619d3f9..6765268f5b 100644 --- a/wxPython/wxPython/lib/PyCrust/wxd/decorator.py +++ b/wxPython/wxPython/lib/PyCrust/wxd/decorator.py @@ -7,10 +7,16 @@ __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__.itervalues(): + for item in decoration.__dict__.values(): if inspect.isclass(item): decorateClass(item, realdict) elif inspect.isfunction(item): diff --git a/wxPython/wxPython/lib/PyCrust/wxd/wx_.py b/wxPython/wxPython/lib/PyCrust/wxd/wx_.py index c2ba522a49..492d623714 100644 --- a/wxPython/wxPython/lib/PyCrust/wxd/wx_.py +++ b/wxPython/wxPython/lib/PyCrust/wxd/wx_.py @@ -50,8 +50,13 @@ _topics = { 'Window': None, } -for topic in _topics: +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