Updated PyCrust to version 0.9
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19642 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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
|
Added fontIncrease, fontDecrease, fontDefault signals, receivers and
|
||||||
keybindings:
|
keybindings:
|
||||||
@@ -23,6 +23,7 @@ documentation and docstrings for wxPython classes and functions.
|
|||||||
Introduced new tabbed interface:
|
Introduced new tabbed interface:
|
||||||
|
|
||||||
* Namespace
|
* Namespace
|
||||||
|
* Calltip
|
||||||
* Session
|
* Session
|
||||||
* Dispatcher
|
* Dispatcher
|
||||||
* wxPython Docs
|
* wxPython Docs
|
||||||
|
@@ -29,16 +29,16 @@ class App(wx.wxApp):
|
|||||||
wx.wxInitAllImageHandlers()
|
wx.wxInitAllImageHandlers()
|
||||||
locals = __main__.__dict__
|
locals = __main__.__dict__
|
||||||
from crust import CrustFrame
|
from crust import CrustFrame
|
||||||
self.crustFrame = CrustFrame(locals=locals)
|
self.frame = CrustFrame(locals=locals)
|
||||||
self.crustFrame.SetSize((800, 600))
|
self.frame.SetSize((800, 600))
|
||||||
self.crustFrame.Show()
|
self.frame.Show()
|
||||||
self.SetTopWindow(self.crustFrame)
|
self.SetTopWindow(self.frame)
|
||||||
# Add the application object to the sys module's namespace.
|
# Add the application object to the sys module's namespace.
|
||||||
# This allows a shell user to do:
|
# This allows a shell user to do:
|
||||||
# >>> import sys
|
# >>> import sys
|
||||||
# >>> sys.application.whatever
|
# >>> sys.app.whatever
|
||||||
import sys
|
import sys
|
||||||
sys.application = self
|
sys.app = self
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@@ -59,12 +59,12 @@ def main():
|
|||||||
for key in md.keys():
|
for key in md.keys():
|
||||||
if key not in keepers:
|
if key not in keepers:
|
||||||
del md[key]
|
del md[key]
|
||||||
application = App(0)
|
app = App(0)
|
||||||
if md.has_key('App') and md['App'] is App:
|
if md.has_key('App') and md['App'] is App:
|
||||||
del md['App']
|
del md['App']
|
||||||
if md.has_key('__main__') and md['__main__'] is __main__:
|
if md.has_key('__main__') and md['__main__'] is __main__:
|
||||||
del md['__main__']
|
del md['__main__']
|
||||||
application.MainLoop()
|
app.MainLoop()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
@@ -29,17 +29,17 @@ class App(wx.wxApp):
|
|||||||
wx.wxInitAllImageHandlers()
|
wx.wxInitAllImageHandlers()
|
||||||
locals = __main__.__dict__
|
locals = __main__.__dict__
|
||||||
from shell import ShellFrame
|
from shell import ShellFrame
|
||||||
self.shellFrame = ShellFrame(locals=locals)
|
self.frame = ShellFrame(locals=locals)
|
||||||
self.shellFrame.SetSize((750, 525))
|
self.frame.SetSize((750, 525))
|
||||||
self.shellFrame.Show()
|
self.frame.Show()
|
||||||
self.SetTopWindow(self.shellFrame)
|
self.SetTopWindow(self.frame)
|
||||||
self.shellFrame.shell.SetFocus()
|
self.frame.shell.SetFocus()
|
||||||
# Add the application object to the sys module's namespace.
|
# Add the application object to the sys module's namespace.
|
||||||
# This allows a shell user to do:
|
# This allows a shell user to do:
|
||||||
# >>> import sys
|
# >>> import sys
|
||||||
# >>> sys.application.whatever
|
# >>> sys.app.whatever
|
||||||
import sys
|
import sys
|
||||||
sys.application = self
|
sys.app = self
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@@ -60,12 +60,12 @@ def main():
|
|||||||
for key in md.keys():
|
for key in md.keys():
|
||||||
if key not in keepers:
|
if key not in keepers:
|
||||||
del md[key]
|
del md[key]
|
||||||
application = App(0)
|
app = App(0)
|
||||||
if md.has_key('App') and md['App'] is App:
|
if md.has_key('App') and md['App'] is App:
|
||||||
del md['App']
|
del md['App']
|
||||||
if md.has_key('__main__') and md['__main__'] is __main__:
|
if md.has_key('__main__') and md['__main__'] is __main__:
|
||||||
del md['__main__']
|
del md['__main__']
|
||||||
application.MainLoop()
|
app.MainLoop()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
@@ -44,30 +44,46 @@ class Crust(wx.wxSplitterWindow):
|
|||||||
rootIsNamespace=rootIsNamespace)
|
rootIsNamespace=rootIsNamespace)
|
||||||
# Add 'filling' to the interpreter's locals.
|
# Add 'filling' to the interpreter's locals.
|
||||||
self.shell.interp.locals['filling'] = self.filling
|
self.shell.interp.locals['filling'] = self.filling
|
||||||
## self.notebook.AddPage(pPage=self.filling, strText='Namespace', bSelect=True)
|
self.notebook.AddPage(page=self.filling, text='Namespace', select=True)
|
||||||
self.notebook.AddPage(self.filling, 'Namespace', True)
|
self.calltip = Calltip(parent=self.notebook)
|
||||||
|
self.notebook.AddPage(page=self.calltip, text='Calltip')
|
||||||
self.sessionlisting = SessionListing(parent=self.notebook)
|
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.dispatcherlisting = DispatcherListing(parent=self.notebook)
|
||||||
self.notebook.AddPage(self.dispatcherlisting, 'Dispatcher')
|
self.notebook.AddPage(page=self.dispatcherlisting, text='Dispatcher')
|
||||||
from wxd import wx_
|
from wxd import wx_
|
||||||
self.wxdocs = Filling(parent=self.notebook,
|
self.wxdocs = Filling(parent=self.notebook,
|
||||||
rootObject=wx_,
|
rootObject=wx_,
|
||||||
rootLabel='wx',
|
rootLabel='wx',
|
||||||
rootIsNamespace=False,
|
rootIsNamespace=False,
|
||||||
static=True)
|
static=True)
|
||||||
self.notebook.AddPage(self.wxdocs, 'wxPython Docs')
|
self.notebook.AddPage(page=self.wxdocs, text='wxPython Docs')
|
||||||
from wxd import stc_
|
from wxd import stc_
|
||||||
self.stcdocs = Filling(parent=self.notebook,
|
self.stcdocs = Filling(parent=self.notebook,
|
||||||
rootObject=stc_.StyledTextCtrl,
|
rootObject=stc_.StyledTextCtrl,
|
||||||
rootLabel='StyledTextCtrl',
|
rootLabel='StyledTextCtrl',
|
||||||
rootIsNamespace=False,
|
rootIsNamespace=False,
|
||||||
static=True)
|
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.SplitHorizontally(self.shell, self.notebook, 300)
|
||||||
self.SetMinimumPaneSize(1)
|
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):
|
class SessionListing(wx.wxTextCtrl):
|
||||||
"""Text control containing all commands for session."""
|
"""Text control containing all commands for session."""
|
||||||
|
|
||||||
|
@@ -117,11 +117,11 @@ class FillingTree(wx.wxTreeCtrl):
|
|||||||
"""Return dictionary with attributes or contents of object."""
|
"""Return dictionary with attributes or contents of object."""
|
||||||
busy = wx.wxBusyCursor()
|
busy = wx.wxBusyCursor()
|
||||||
otype = type(obj)
|
otype = type(obj)
|
||||||
if otype is dict \
|
if otype is types.DictType \
|
||||||
or str(otype)[17:23] == 'BTrees' and hasattr(obj, 'keys'):
|
or str(otype)[17:23] == 'BTrees' and hasattr(obj, 'keys'):
|
||||||
return obj
|
return obj
|
||||||
d = {}
|
d = {}
|
||||||
if isinstance(obj, (list, tuple)):
|
if otype is types.ListType or otype is types.TupleType:
|
||||||
for n in range(len(obj)):
|
for n in range(len(obj)):
|
||||||
key = '[' + str(n) + ']'
|
key = '[' + str(n) + ']'
|
||||||
d[key] = obj[n]
|
d[key] = obj[n]
|
||||||
|
@@ -996,6 +996,7 @@ Platform: %s""" % \
|
|||||||
# In case there isn't enough room, only go back to the
|
# In case there isn't enough room, only go back to the
|
||||||
# fallback.
|
# fallback.
|
||||||
tippos = max(tippos, fallback)
|
tippos = max(tippos, fallback)
|
||||||
|
dispatcher.send(signal='Shell.calltip', sender=self, calltip=tip)
|
||||||
self.CallTipShow(tippos, tip)
|
self.CallTipShow(tippos, tip)
|
||||||
|
|
||||||
def writeOut(self, text):
|
def writeOut(self, text):
|
||||||
|
@@ -7,5 +7,5 @@ __author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
|
|||||||
__cvsid__ = "$Id$"
|
__cvsid__ = "$Id$"
|
||||||
__revision__ = "$Revision$"[11:-2]
|
__revision__ = "$Revision$"[11:-2]
|
||||||
|
|
||||||
VERSION = '0.9b'
|
VERSION = '0.9'
|
||||||
|
|
||||||
|
@@ -13,6 +13,13 @@ __revision__ = "$Revision$"[11:-2]
|
|||||||
|
|
||||||
|
|
||||||
from Base import EvtHandler
|
from Base import EvtHandler
|
||||||
|
import Parameters as wx
|
||||||
|
|
||||||
|
try:
|
||||||
|
True
|
||||||
|
except NameError:
|
||||||
|
True = 1==1
|
||||||
|
False = 1==0
|
||||||
|
|
||||||
|
|
||||||
class PyApp(EvtHandler):
|
class PyApp(EvtHandler):
|
||||||
@@ -33,14 +40,6 @@ class PyApp(EvtHandler):
|
|||||||
"""Create a PyApp instance."""
|
"""Create a PyApp instance."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __del__(self):
|
|
||||||
""""""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def _setCallbackInfo(self):
|
|
||||||
""""""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def Dispatch(self):
|
def Dispatch(self):
|
||||||
"""Dispatches the next event in the windowing system event
|
"""Dispatches the next event in the windowing system event
|
||||||
queue.
|
queue.
|
||||||
@@ -153,7 +152,10 @@ class PyApp(EvtHandler):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def OnInitGui(self):
|
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
|
pass
|
||||||
|
|
||||||
def Pending(self):
|
def Pending(self):
|
||||||
@@ -258,62 +260,27 @@ class PyApp(EvtHandler):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
from wxPython.wx import wxPlatform
|
||||||
|
_redirect = (wxPlatform == '__WXMSW__' or wxPlatform == '__WXMAC__')
|
||||||
|
del wxPlatform
|
||||||
|
|
||||||
|
|
||||||
class App(PyApp):
|
class App(PyApp):
|
||||||
"""The main application class.
|
"""The main application class.
|
||||||
|
|
||||||
Inherit from this class and implement an OnInit method that
|
Inherit from this class and implement an OnInit method that
|
||||||
creates a frame and then calls self.SetTopWindow(frame)."""
|
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
|
redirect defaults to True on Windows and Mac. If redirect is
|
||||||
## file. It is included here simply as a reference:
|
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):
|
del _redirect
|
||||||
## 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
|
|
||||||
|
|
||||||
|
|
||||||
class PyOnDemandOutputWindow:
|
class PyOnDemandOutputWindow:
|
||||||
@@ -339,32 +306,53 @@ class PySimpleApp(App):
|
|||||||
|
|
||||||
|
|
||||||
class PyWidgetTester(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
|
pass
|
||||||
|
|
||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
""""""
|
"""Creates a frame that will hold the widget to be tested."""
|
||||||
pass
|
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
|
pass
|
||||||
|
|
||||||
|
|
||||||
class SingleInstanceChecker:
|
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
|
pass
|
||||||
|
|
||||||
def Create(self):
|
def Create(self, name, path=wx.EmptyString):
|
||||||
""""""
|
"""Create a SingleInstanceChecker instance."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def IsAnotherRunning(self):
|
def IsAnotherRunning(self):
|
||||||
""""""
|
"""Return True if another copy of this program is already running."""
|
||||||
pass
|
pass
|
||||||
|
@@ -42,10 +42,6 @@ class EvtHandler(Object):
|
|||||||
"""Create a EvtHandler instance."""
|
"""Create a EvtHandler instance."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _setOORInfo(self):
|
|
||||||
""""""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def AddPendingEvent(self, event):
|
def AddPendingEvent(self, event):
|
||||||
"""Post an event to be processed later.
|
"""Post an event to be processed later.
|
||||||
|
|
||||||
|
@@ -16,6 +16,12 @@ from Base import Object
|
|||||||
import Parameters as wx
|
import Parameters as wx
|
||||||
from Window import Window
|
from Window import Window
|
||||||
|
|
||||||
|
try:
|
||||||
|
True
|
||||||
|
except NameError:
|
||||||
|
True = 1==1
|
||||||
|
False = 1==0
|
||||||
|
|
||||||
|
|
||||||
class Control(Window):
|
class Control(Window):
|
||||||
"""Base class for a control or 'widget'.
|
"""Base class for a control or 'widget'.
|
||||||
|
@@ -18,92 +18,221 @@ from Window import TopLevelWindow, Window
|
|||||||
|
|
||||||
|
|
||||||
class Frame(TopLevelWindow):
|
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,
|
def __init__(self, parent, id, title, pos=wx.DefaultPosition,
|
||||||
size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE,
|
size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE,
|
||||||
name=wx.PyFrameNameStr):
|
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."""
|
"""Create a Frame instance."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def Create(self):
|
def Command(self, id):
|
||||||
""""""
|
"""Simulate a menu command; id is a menu item identifier."""
|
||||||
pass
|
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
|
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
|
pass
|
||||||
|
|
||||||
def CreateToolBar(self):
|
def DoGiveHelp(self, text, show):
|
||||||
""""""
|
"""Show help text (typically in the statusbar).
|
||||||
pass
|
|
||||||
|
|
||||||
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
|
pass
|
||||||
|
|
||||||
def GetClientAreaOrigin(self):
|
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
|
pass
|
||||||
|
|
||||||
def GetMenuBar(self):
|
def GetMenuBar(self):
|
||||||
""""""
|
"""Return menubar currently associated with frame (if any)."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def GetStatusBar(self):
|
def GetStatusBar(self):
|
||||||
""""""
|
"""Return status bar currently associated with frame (if any)."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def GetStatusBarPane(self):
|
def GetStatusBarPane(self):
|
||||||
""""""
|
"""Return status bar pane used to display menu and toolbar
|
||||||
|
help."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def GetToolBar(self):
|
def GetToolBar(self):
|
||||||
""""""
|
"""Return toolbar currently associated with frame (if any)."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def PopStatusText(self):
|
def PopStatusText(self, number=0):
|
||||||
""""""
|
"""Redraw status bar with previous status text.
|
||||||
|
|
||||||
|
number - The status field (starting from zero)."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def ProcessCommand(self):
|
def ProcessCommand(self, id):
|
||||||
""""""
|
"""Process menu command; return True if processed.
|
||||||
|
|
||||||
|
id is the menu command identifier."""
|
||||||
pass
|
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
|
pass
|
||||||
|
|
||||||
def SendSizeEvent(self):
|
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
|
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
|
pass
|
||||||
|
|
||||||
def SetStatusBar(self):
|
def SetStatusBar(self, statBar):
|
||||||
""""""
|
"""Associate a status bar with the frame."""
|
||||||
pass
|
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
|
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
|
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
|
pass
|
||||||
|
|
||||||
def SetToolBar(self):
|
def SetToolBar(self, toolbar):
|
||||||
""""""
|
"""Associate a toolbar with the frame."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@@ -309,5 +438,3 @@ class StatusBar(Window):
|
|||||||
def SetStatusWidths(self):
|
def SetStatusWidths(self):
|
||||||
""""""
|
""""""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@@ -67,13 +67,11 @@ def Button_GetDefaultSize():
|
|||||||
""""""
|
""""""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
## def CallAfter():
|
def CallAfter(callable, *args, **kw):
|
||||||
## """"""
|
"""Call the specified function after the current and pending event
|
||||||
## pass
|
handlers have been completed. This is also good for making GUI
|
||||||
|
method calls from non-GUI threads."""
|
||||||
import wx as wxpy
|
pass
|
||||||
CallAfter = wxpy.CallAfter
|
|
||||||
del wxpy
|
|
||||||
|
|
||||||
def Caret_GetBlinkTime():
|
def Caret_GetBlinkTime():
|
||||||
""""""
|
""""""
|
||||||
|
@@ -15,6 +15,12 @@ __revision__ = "$Revision$"[11:-2]
|
|||||||
import Parameters as wx
|
import Parameters as wx
|
||||||
from Window import Window
|
from Window import Window
|
||||||
|
|
||||||
|
try:
|
||||||
|
True
|
||||||
|
except NameError:
|
||||||
|
True = 1==1
|
||||||
|
False = 1==0
|
||||||
|
|
||||||
|
|
||||||
class Panel(Window):
|
class Panel(Window):
|
||||||
""""""
|
""""""
|
||||||
|
@@ -12,13 +12,13 @@ __revision__ = "$Revision$"[11:-2]
|
|||||||
# C-language classes.
|
# C-language classes.
|
||||||
|
|
||||||
|
|
||||||
class Param:
|
class _Param:
|
||||||
"""Used by this module to represent default wxPython parameter values,
|
"""Used by this module to represent default wxPython parameter values,
|
||||||
including parameter representations like style=wx.HSCROLL|wx.VSCROLL."""
|
including parameter representations like style=wx.HSCROLL|wx.VSCROLL."""
|
||||||
|
|
||||||
def __init__(self, value=None):
|
def __init__(self, value=None):
|
||||||
if value is None:
|
if value is None:
|
||||||
value = self.__class__.__name__
|
value = 'wx.' + self.__class__.__name__
|
||||||
self.value = value
|
self.value = value
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
@@ -28,55 +28,41 @@ class Param:
|
|||||||
value = '%s|%s' % (self, other)
|
value = '%s|%s' % (self, other)
|
||||||
return self.__class__(value)
|
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
|
## Create classes, then instances, like this:
|
||||||
NULL = NULL()
|
|
||||||
|
|
||||||
class BOTH(Param): pass
|
## class BOTH(Param): pass
|
||||||
BOTH = BOTH()
|
## BOTH = BOTH()
|
||||||
|
|
||||||
class DEFAULT_FRAME_STYLE(Param): pass
|
for _param in _params:
|
||||||
DEFAULT_FRAME_STYLE = DEFAULT_FRAME_STYLE()
|
exec 'class %s(_Param): pass' % _param
|
||||||
|
exec '%s = %s()' % (_param, _param)
|
||||||
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()
|
|
||||||
|
|
||||||
|
del _param
|
||||||
|
del _params
|
||||||
|
del _Param
|
||||||
|
@@ -15,6 +15,12 @@ __revision__ = "$Revision$"[11:-2]
|
|||||||
from Base import EvtHandler
|
from Base import EvtHandler
|
||||||
import Parameters as wx
|
import Parameters as wx
|
||||||
|
|
||||||
|
try:
|
||||||
|
True
|
||||||
|
except NameError:
|
||||||
|
True = 1==1
|
||||||
|
False = 1==0
|
||||||
|
|
||||||
|
|
||||||
class Validator(EvtHandler):
|
class Validator(EvtHandler):
|
||||||
""""""
|
""""""
|
||||||
|
@@ -15,6 +15,12 @@ __revision__ = "$Revision$"[11:-2]
|
|||||||
from Base import EvtHandler
|
from Base import EvtHandler
|
||||||
import Parameters as wx
|
import Parameters as wx
|
||||||
|
|
||||||
|
try:
|
||||||
|
True
|
||||||
|
except NameError:
|
||||||
|
True = 1==1
|
||||||
|
False = 1==0
|
||||||
|
|
||||||
|
|
||||||
class Window(EvtHandler):
|
class Window(EvtHandler):
|
||||||
""""""
|
""""""
|
||||||
|
@@ -7,10 +7,16 @@ __revision__ = "$Revision$"[11:-2]
|
|||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
|
try:
|
||||||
|
True
|
||||||
|
except NameError:
|
||||||
|
True = 1==1
|
||||||
|
False = 1==0
|
||||||
|
|
||||||
def decorate(real, decoration):
|
def decorate(real, decoration):
|
||||||
"""Decorate real module with docstrings from decoration module."""
|
"""Decorate real module with docstrings from decoration module."""
|
||||||
realdict = real.__dict__
|
realdict = real.__dict__
|
||||||
for item in decoration.__dict__.itervalues():
|
for item in decoration.__dict__.values():
|
||||||
if inspect.isclass(item):
|
if inspect.isclass(item):
|
||||||
decorateClass(item, realdict)
|
decorateClass(item, realdict)
|
||||||
elif inspect.isfunction(item):
|
elif inspect.isfunction(item):
|
||||||
|
@@ -50,8 +50,13 @@ _topics = {
|
|||||||
'Window': None,
|
'Window': None,
|
||||||
}
|
}
|
||||||
|
|
||||||
for topic in _topics:
|
for topic in _topics.keys():
|
||||||
_topics[topic] = __import__(topic, globals())
|
_topics[topic] = __import__(topic, globals())
|
||||||
exec 'from %s import *' % topic
|
exec 'from %s import *' % topic
|
||||||
|
|
||||||
del topic # Cleanup the namespace.
|
del topic # Cleanup the namespace.
|
||||||
|
|
||||||
|
try:
|
||||||
|
del wx # Cleanup any module that imports Parameters as wx.
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
Reference in New Issue
Block a user