docstrign tweaks
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27848 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
fa003c13c7
commit
fdc775af55
@ -829,7 +829,6 @@ by pressing <Enter> such as the OK button on a wx.Dialog.", "");
|
||||
"Set this child as temporary default", "");
|
||||
|
||||
|
||||
// Navigates in the specified direction by sending a wxNavigationKeyEvent
|
||||
DocDeclAStr(
|
||||
virtual bool , Navigate(int flags = wxNavigationKeyEvent::IsForward),
|
||||
"Navigate(self, int flags=NavigationKeyEvent.IsForward) -> bool",
|
||||
@ -837,14 +836,13 @@ by pressing <Enter> such as the OK button on a wx.Dialog.", "");
|
||||
`wx.NavigationKeyEvent`.", "
|
||||
|
||||
:param flags: A combination of the ``IsForward`` and ``WinChange``
|
||||
values in the `wx.NavigationKeyEvent` class, which
|
||||
determine if the navigation should be in forward or
|
||||
reverse order, and if it should be able to cross
|
||||
parent window boundaries, such as between notebook
|
||||
pages or MDI child frames. Typically the status of
|
||||
the Shift key (for forward or reverse) or the
|
||||
Control key (for WinChange) would be used to
|
||||
determine how to set the flags.
|
||||
values in the `wx.NavigationKeyEvent` class, which determine
|
||||
if the navigation should be in forward or reverse order, and
|
||||
if it should be able to cross parent window boundaries, such
|
||||
as between notebook pages or MDI child frames. Typically the
|
||||
status of the Shift key (for forward or reverse) or the
|
||||
Control key (for WinChange) would be used to determine how to
|
||||
set the flags.
|
||||
|
||||
One situation in which you may wish to call this method is from a text
|
||||
control custom keypress handler to do the default navigation behaviour
|
||||
|
@ -735,21 +735,23 @@ class AnalogClockWindow(wx.PyWindow):
|
||||
|
||||
def SetClockStyle(self, style):
|
||||
"""
|
||||
Set the clock style, acording to the options:
|
||||
Set the clock style, acording to these options:
|
||||
|
||||
SHOW_QUARTERS_TICKS - Show marks for hours 3, 6, 9, 12
|
||||
SHOW_HOURS_TICKS - Show marks for all hours
|
||||
SHOW_MINUTES_TICKS - Show marks for minutes
|
||||
==================== ================================
|
||||
SHOW_QUARTERS_TICKS Show marks for hours 3, 6, 9, 12
|
||||
SHOW_HOURS_TICKS Show marks for all hours
|
||||
SHOW_MINUTES_TICKS Show marks for minutes
|
||||
|
||||
SHOW_HOURS_HAND - Show hours hand
|
||||
SHOW_MINUTES_HAND - Show minutes hand
|
||||
SHOW_SECONDS_HAND - Show seconds hand
|
||||
SHOW_HOURS_HAND Show hours hand
|
||||
SHOW_MINUTES_HAND Show minutes hand
|
||||
SHOW_SECONDS_HAND Show seconds hand
|
||||
|
||||
SHOW_SHADOWS - Show hands and marks shadows
|
||||
SHOW_SHADOWS Show hands and marks shadows
|
||||
|
||||
ROTATE_TICKS - Align tick marks to watch
|
||||
OVERLAP_TICKS - Draw tick marks for minutes even
|
||||
ROTATE_TICKS Align tick marks to watch
|
||||
OVERLAP_TICKS Draw tick marks for minutes even
|
||||
when they match the hours marks.
|
||||
==================== ================================
|
||||
"""
|
||||
|
||||
self.clockStyle = style
|
||||
@ -759,14 +761,17 @@ class AnalogClockWindow(wx.PyWindow):
|
||||
"""
|
||||
Set the ticks styles, acording to the options below.
|
||||
|
||||
TICKS_NONE = Don't show tick marks.
|
||||
TICKS_SQUARE = Use squares as tick marks.
|
||||
TICKS_CIRCLE = Use circles as tick marks.
|
||||
TICKS_POLY = Use a polygon as tick marks. The polygon
|
||||
must be passed using SetTickShapes,
|
||||
otherwise the default polygon will be used.
|
||||
TICKS_DECIMAL = Use decimal numbers.
|
||||
TICKS_ROMAN = Use Roman numbers.
|
||||
================= =====================================
|
||||
TICKS_NONE Don't show tick marks.
|
||||
TICKS_SQUARE Use squares as tick marks.
|
||||
TICKS_CIRCLE Use circles as tick marks.
|
||||
TICKS_POLY Use a polygon as tick marks. The
|
||||
polygon must be passed using
|
||||
SetTickShapes, otherwise the default
|
||||
polygon will be used.
|
||||
TICKS_DECIMAL Use decimal numbers.
|
||||
TICKS_ROMAN Use Roman numbers.
|
||||
================= =====================================
|
||||
"""
|
||||
|
||||
if h:
|
||||
|
@ -19,19 +19,19 @@
|
||||
import wx
|
||||
|
||||
class LayoutAnchors(wx.LayoutConstraints):
|
||||
""" A class that implements Delphi's Anchors with wx.LayoutConstraints.
|
||||
"""
|
||||
A class that implements Delphi's Anchors with wx.LayoutConstraints.
|
||||
|
||||
Anchored sides maintain the distance from the edge of the
|
||||
control to the same edge of the parent.
|
||||
When neither side is selected, the control keeps the same
|
||||
relative position to both sides.
|
||||
Anchored sides maintain the distance from the edge of the control
|
||||
to the same edge of the parent. When neither side is selected,
|
||||
the control keeps the same relative position to both sides.
|
||||
|
||||
The current position and size of the control and it's parent
|
||||
is used when setting up the constraints. To change the size or
|
||||
position of an already anchored control, set the constraints to
|
||||
None, reposition or resize and reapply the anchors.
|
||||
The current position and size of the control and it's parent is
|
||||
used when setting up the constraints. To change the size or
|
||||
position of an already anchored control, set the constraints to
|
||||
None, reposition or resize and reapply the anchors.
|
||||
|
||||
Examples:
|
||||
Examples::
|
||||
|
||||
Let's anchor the right and bottom edge of a control and
|
||||
resize it's parent.
|
||||
@ -59,6 +59,7 @@ class LayoutAnchors(wx.LayoutConstraints):
|
||||
| +-------*-------+ |
|
||||
+-------------------+
|
||||
* = anchored edge
|
||||
|
||||
"""
|
||||
def __init__(self, control, left=1, top=1, right=0, bottom=0):
|
||||
wx.LayoutConstraints.__init__(self)
|
||||
|
@ -63,17 +63,17 @@ class EventManager:
|
||||
"""
|
||||
Registers a listener function (or any callable object) to
|
||||
receive events of type event coming from the source window.
|
||||
For example:
|
||||
|
||||
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:
|
||||
|
||||
For example::
|
||||
eventManager.Register(self.OnButton, EVT_BUTTON, win=self, id=ID_BUTTON)
|
||||
or
|
||||
|
||||
or::
|
||||
eventManager.Register(self.OnButton, EVT_BUTTON, theButton, self)
|
||||
|
||||
"""
|
||||
|
||||
# 1. Check if the 'event' is actually one of the multi-
|
||||
|
@ -3,42 +3,40 @@
|
||||
# o Updated for 2.5 compatability.
|
||||
#
|
||||
|
||||
"""<font weight="bold" size="16">FancyText</font> -- <font style="italic" size="16">methods for rendering XML specified text</font>
|
||||
<font family="swiss" size="12">
|
||||
"""
|
||||
FancyText -- methods for rendering XML specified text
|
||||
|
||||
This module exports four main methods::
|
||||
<font family="fixed" style="slant">
|
||||
|
||||
def GetExtent(str, dc=None, enclose=True)
|
||||
def GetFullExtent(str, dc=None, enclose=True)
|
||||
def RenderToBitmap(str, background=None, enclose=True)
|
||||
def RenderToDC(str, dc, x, y, enclose=True)
|
||||
</font>
|
||||
In all cases, 'str' is an XML string. Note that start and end tags
|
||||
are only required if *enclose* is set to False. In this case the
|
||||
text should be wrapped in FancyText tags.
|
||||
|
||||
In all cases, 'str' is an XML string. Note that start and end tags are
|
||||
only required if *enclose* is set to False. In this case the text
|
||||
should be wrapped in FancyText tags.
|
||||
|
||||
In addition, the module exports one class::
|
||||
<font family="fixed" style="slant">
|
||||
|
||||
class StaticFancyText(self, window, id, text, background, ...)
|
||||
</font>
|
||||
This class works similar to StaticText except it interprets its text
|
||||
|
||||
This class works similar to StaticText except it interprets its text
|
||||
as FancyText.
|
||||
|
||||
The text can support<sup>superscripts</sup> and <sub>subscripts</sub>, text
|
||||
in different <font size="20">sizes</font>, <font color="blue">colors</font>, <font style="italic">styles</font>, <font weight="bold">weights</font> and
|
||||
<font family="script">families</font>. It also supports a limited set of symbols,
|
||||
currently <times/>, <infinity/>, <angle/> as well as greek letters in both
|
||||
upper case (<Alpha/><Beta/>...<Omega/>) and lower case (<alpha/><beta/>...<omega/>).
|
||||
The text can support superscripts and subscripts, text in different
|
||||
sizes, colors, styles, weights and families. It also supports a
|
||||
limited set of symbols, currently *times*, *infinity*, *angle* as well
|
||||
as greek letters in both upper case (*Alpha* *Beta*... *Omega*) and
|
||||
lower case (*alpha* *beta*... *omega*).
|
||||
|
||||
We can use doctest/guitest to display this string in all its marked up glory.
|
||||
<font family="fixed">
|
||||
>>> frame = wx.Frame(wx.NULL, -1, "FancyText demo", wx.DefaultPosition)
|
||||
>>> sft = StaticFancyText(frame, -1, __doc__, wx.Brush("light grey", wx.SOLID))
|
||||
>>> sft = StaticFancyText(frame, -1, testText, wx.Brush("light grey", wx.SOLID))
|
||||
>>> frame.SetClientSize(sft.GetSize())
|
||||
>>> didit = frame.Show()
|
||||
>>> from guitest import PauseTests; PauseTests()
|
||||
|
||||
</font></font>
|
||||
The End"""
|
||||
"""
|
||||
|
||||
# Copyright 2001-2003 Timothy Hochberg
|
||||
# Use as you see fit. No warantees, I cannot be held responsible, etc.
|
||||
@ -403,11 +401,49 @@ renderToDC = RenderToDC
|
||||
# Test Driver
|
||||
|
||||
def test():
|
||||
testText =
|
||||
"""<font weight="bold" size="16">FancyText</font> -- <font style="italic" size="16">methods for rendering XML specified text</font>
|
||||
<font family="swiss" size="12">
|
||||
This module exports four main methods::
|
||||
<font family="fixed" style="slant">
|
||||
def GetExtent(str, dc=None, enclose=True)
|
||||
def GetFullExtent(str, dc=None, enclose=True)
|
||||
def RenderToBitmap(str, background=None, enclose=True)
|
||||
def RenderToDC(str, dc, x, y, enclose=True)
|
||||
</font>
|
||||
In all cases, 'str' is an XML string. Note that start and end tags
|
||||
are only required if *enclose* is set to False. In this case the
|
||||
text should be wrapped in FancyText tags.
|
||||
|
||||
In addition, the module exports one class::
|
||||
<font family="fixed" style="slant">
|
||||
class StaticFancyText(self, window, id, text, background, ...)
|
||||
</font>
|
||||
This class works similar to StaticText except it interprets its text
|
||||
as FancyText.
|
||||
|
||||
The text can support<sup>superscripts</sup> and <sub>subscripts</sub>, text
|
||||
in different <font size="20">sizes</font>, <font color="blue">colors</font>, <font style="italic">styles</font>, <font weight="bold">weights</font> and
|
||||
<font family="script">families</font>. It also supports a limited set of symbols,
|
||||
currently <times/>, <infinity/>, <angle/> as well as greek letters in both
|
||||
upper case (<Alpha/><Beta/>...<Omega/>) and lower case (<alpha/><beta/>...<omega/>).
|
||||
|
||||
We can use doctest/guitest to display this string in all its marked up glory.
|
||||
<font family="fixed">
|
||||
>>> frame = wx.Frame(wx.NULL, -1, "FancyText demo", wx.DefaultPosition)
|
||||
>>> sft = StaticFancyText(frame, -1, __doc__, wx.Brush("light grey", wx.SOLID))
|
||||
>>> frame.SetClientSize(sft.GetSize())
|
||||
>>> didit = frame.Show()
|
||||
>>> from guitest import PauseTests; PauseTests()
|
||||
|
||||
</font></font>
|
||||
The End"""
|
||||
|
||||
app = wx.PySimpleApp()
|
||||
box = wx.BoxSizer(wx.VERTICAL)
|
||||
frame = wx.Frame(None, -1, "FancyText demo", wx.DefaultPosition)
|
||||
frame.SetBackgroundColour("light grey")
|
||||
sft = StaticFancyText(frame, -1, __doc__)
|
||||
sft = StaticFancyText(frame, -1, testText)
|
||||
box.Add(sft, 1, wx.EXPAND)
|
||||
frame.SetSizer(box)
|
||||
frame.SetAutoLayout(True)
|
||||
|
@ -24,42 +24,37 @@ import wx
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class FileBrowseButton(wx.Panel):
|
||||
""" A control to allow the user to type in a filename
|
||||
or browse with the standard file dialog to select file
|
||||
|
||||
__init__ (
|
||||
parent, id, pos, size -- passed directly to wxPanel initialisation
|
||||
style = wxTAB_TRAVERSAL -- passed directly to wxPanel initialisation
|
||||
labelText -- Text for label to left of text field
|
||||
buttonText -- Text for button which launches the file dialog
|
||||
toolTip -- Help text
|
||||
dialogTitle -- Title used in file dialog
|
||||
startDirectory -- Default directory for file dialog startup
|
||||
fileMask -- File mask (glob pattern, such as *.*) to use in file dialog
|
||||
fileMode -- wxOPEN or wxSAVE, indicates type of file dialog to use
|
||||
changeCallback -- callback receives all > > changes in value of control
|
||||
)
|
||||
GetValue() -- retrieve current value of text control
|
||||
SetValue(string) -- set current value of text control
|
||||
label -- pointer to internal label widget
|
||||
textControl -- pointer to internal text control
|
||||
browseButton -- pointer to button
|
||||
"""
|
||||
A control to allow the user to type in a filename or browse with
|
||||
the standard file dialog to select file
|
||||
"""
|
||||
def __init__ (self, parent, id= -1,
|
||||
pos = wx.DefaultPosition, size = wx.DefaultSize,
|
||||
style = wx.TAB_TRAVERSAL,
|
||||
labelText= "File Entry:",
|
||||
buttonText= "Browse",
|
||||
toolTip= "Type filename or click browse to choose file",
|
||||
# following are the values for a file dialog box
|
||||
dialogTitle = "Choose a file",
|
||||
startDirectory = ".",
|
||||
initialValue = "",
|
||||
fileMask = "*.*",
|
||||
fileMode = wx.OPEN,
|
||||
# callback for when value changes (optional)
|
||||
changeCallback= lambda x:x
|
||||
pos = wx.DefaultPosition,
|
||||
size = wx.DefaultSize,
|
||||
style = wx.TAB_TRAVERSAL,
|
||||
labelText= "File Entry:",
|
||||
buttonText= "Browse",
|
||||
toolTip= "Type filename or click browse to choose file",
|
||||
# following are the values for a file dialog box
|
||||
dialogTitle = "Choose a file",
|
||||
startDirectory = ".",
|
||||
initialValue = "",
|
||||
fileMask = "*.*",
|
||||
fileMode = wx.OPEN,
|
||||
# callback for when value changes (optional)
|
||||
changeCallback= lambda x:x
|
||||
):
|
||||
"""
|
||||
:param labelText: Text for label to left of text field
|
||||
:param buttonText: Text for button which launches the file dialog
|
||||
:param toolTip: Help text
|
||||
:param dialogTitle: Title used in file dialog
|
||||
:param startDirectory: Default directory for file dialog startup
|
||||
:param fileMask: File mask (glob pattern, such as *.*) to use in file dialog
|
||||
:param fileMode: wx.OPEN or wx.SAVE, indicates type of file dialog to use
|
||||
:param changeCallback: callback receives all changes in value of control
|
||||
"""
|
||||
|
||||
# store variables
|
||||
self.labelText = labelText
|
||||
self.buttonText = buttonText
|
||||
@ -176,11 +171,13 @@ class FileBrowseButton(wx.Panel):
|
||||
|
||||
|
||||
def GetValue (self):
|
||||
""" Convenient access to text control value """
|
||||
"""
|
||||
retrieve current value of text control
|
||||
"""
|
||||
return self.textControl.GetValue()
|
||||
|
||||
def SetValue (self, value, callBack=1):
|
||||
""" Convenient setting of text control value """
|
||||
"""set current value of text control"""
|
||||
save = self.callCallback
|
||||
self.callCallback = callBack
|
||||
self.textControl.SetValue(value)
|
||||
@ -207,27 +204,34 @@ class FileBrowseButton(wx.Panel):
|
||||
|
||||
|
||||
class FileBrowseButtonWithHistory( FileBrowseButton ):
|
||||
""" with following additions:
|
||||
"""
|
||||
with following additions:
|
||||
__init__(..., history=None)
|
||||
|
||||
history -- optional list of paths for initial history drop-down
|
||||
(must be passed by name, not a positional argument)
|
||||
If history is callable it will must return a list used
|
||||
for the history drop-down
|
||||
|
||||
changeCallback -- as for FileBrowseButton, but with a work-around
|
||||
for win32 systems which don't appear to create wx.EVT_COMBOBOX
|
||||
events properly. There is a (slight) chance that this work-around
|
||||
will cause some systems to create two events for each Combobox
|
||||
selection. If you discover this condition, please report it!
|
||||
|
||||
As for a FileBrowseButton.__init__ otherwise.
|
||||
|
||||
GetHistoryControl()
|
||||
Return reference to the control which implements interfaces
|
||||
required for manipulating the history list. See GetHistoryControl
|
||||
documentation for description of what that interface is.
|
||||
|
||||
GetHistory()
|
||||
Return current history list
|
||||
|
||||
SetHistory( value=(), selectionIndex = None )
|
||||
Set current history list, if selectionIndex is not None, select that index
|
||||
|
||||
"""
|
||||
def __init__( self, *arguments, **namedarguments):
|
||||
self.history = namedarguments.get( "history" )
|
||||
@ -257,12 +261,15 @@ class FileBrowseButtonWithHistory( FileBrowseButton ):
|
||||
|
||||
|
||||
def GetHistoryControl( self ):
|
||||
"""Return a pointer to the control which provides (at least)
|
||||
the following methods for manipulating the history list.:
|
||||
"""
|
||||
Return a pointer to the control which provides (at least)
|
||||
the following methods for manipulating the history list:
|
||||
|
||||
Append( item ) -- add item
|
||||
Clear() -- clear all items
|
||||
Delete( index ) -- 0-based index to delete from list
|
||||
SetSelection( index ) -- 0-based index to select in list
|
||||
|
||||
Semantics of the methods follow those for the wxComboBox control
|
||||
"""
|
||||
return self.textControl
|
||||
|
@ -942,18 +942,22 @@ class ScaledText(DrawObject, TextObjectMixin, XYObjectMixin):
|
||||
|
||||
Family:
|
||||
Font family, a generic way of referring to fonts without
|
||||
specifying actual facename. One of:
|
||||
specifying actual facename. One of::
|
||||
wx.DEFAULT: Chooses a default font.
|
||||
wx.DECORATI: A decorative font.
|
||||
wx.ROMAN: A formal, serif font.
|
||||
wx.SCRIPT: A handwriting font.
|
||||
wx.SWISS: A sans-serif font.
|
||||
wx.MODERN: A fixed pitch font.
|
||||
|
||||
NOTE: these are only as good as the wxWindows defaults, which aren't so good.
|
||||
|
||||
Style:
|
||||
One of wx.NORMAL, wx.SLANT and wx.ITALIC.
|
||||
|
||||
Weight:
|
||||
One of wx.NORMAL, wx.LIGHT and wx.BOLD.
|
||||
|
||||
Underline:
|
||||
The value can be True or False. At present this may have an an
|
||||
effect on Windows only.
|
||||
@ -1952,8 +1956,8 @@ def _makeFloatCanvasAddMethods(): ## lrk's code for doing this in module __init_
|
||||
addshapemethod = getaddshapemethod()
|
||||
methodname = "Add" + classname
|
||||
setattr(FloatCanvas, methodname, addshapemethod)
|
||||
docstring = "Creates %s and adds its reference to the canvas.\n" % classname
|
||||
docstring += "Argument protocol same as %s class" % classname
|
||||
docstring = " Creates %s and adds its reference to the canvas.\n" % classname
|
||||
docstring += " Argument protocol same as %s class" % classname
|
||||
if klass.__doc__:
|
||||
docstring += ", whose docstring is:\n%s" % klass.__doc__
|
||||
FloatCanvas.__dict__[methodname].__doc__ = docstring
|
||||
|
Loading…
Reference in New Issue
Block a user