mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-07-21 04:31:09 +02:00
⁉️ Trim trailing whitespace *.md; *.rst
⁉️ Not sure if the generated *.rst stuff is intended to have
whitespace or not, so seperating this from the other commits, so easy to
revert if necessary.
This commit is contained in:
6
.github/issue_template.md
vendored
6
.github/issue_template.md
vendored
@@ -1,6 +1,6 @@
|
||||
<!-- For bugs or other problems please provide the following details in addition to
|
||||
your issue report, if applicable. See also https://wxpython.org/pages/how-to-submit-issue/
|
||||
|
||||
<!-- For bugs or other problems please provide the following details in addition to
|
||||
your issue report, if applicable. See also https://wxpython.org/pages/how-to-submit-issue/
|
||||
|
||||
For issues about building on Linux, please read this page before reporting it here:
|
||||
https://wxpython.org/blog/2017-08-17-builds-for-linux-with-pip/
|
||||
-->
|
||||
|
6
.github/pull_request_template.md
vendored
6
.github/pull_request_template.md
vendored
@@ -1,8 +1,8 @@
|
||||
<!-- Be sure to set the issue number that this PR fixes or implements below, and give
|
||||
a good description. If this PR is for a new feature or enhancement, then it's
|
||||
okay to remove the "Fixes #..." below, but be sure to give an even better
|
||||
a good description. If this PR is for a new feature or enhancement, then it's
|
||||
okay to remove the "Fixes #..." below, but be sure to give an even better
|
||||
description of the PR in that case.
|
||||
|
||||
|
||||
See also https://wxpython.org/pages/contributor-guide/ -->
|
||||
|
||||
Fixes #NNNN
|
||||
|
@@ -51,7 +51,7 @@ Changes in this release include the following:
|
||||
* Fixed wx.richtext.RichTextBuffer.GetExtWildcard to return a tuple of 2
|
||||
values, as was done in Classic. (#594)
|
||||
|
||||
* Various fixes in UltimateListCtrl, HyperTreeList and CheckListCtrlMixin.
|
||||
* Various fixes in UltimateListCtrl, HyperTreeList and CheckListCtrlMixin.
|
||||
(#592, #349, #612)
|
||||
|
||||
* Fixes in TextEditMixin to ensure that the new value is passed in the
|
||||
|
@@ -116,8 +116,8 @@ available in Phoenix::
|
||||
|
||||
|
||||
|
||||
Static Methods
|
||||
--------------
|
||||
Static Methods
|
||||
--------------
|
||||
|
||||
In the distant past when SWIG was generating wrapper code for C++ static
|
||||
methods it would create a standalone function named ``ClassName_MethodName``
|
||||
@@ -130,7 +130,7 @@ the problem simply change the underscore to a dot, for example you should
|
||||
change this::
|
||||
|
||||
c = wx.SystemSettings_GetColour(wx.SYS_COLOUR_MENUTEXT)
|
||||
|
||||
|
||||
to this::
|
||||
|
||||
c = wx.SystemSettings.GetColour(wx.SYS_COLOUR_MENUTEXT)
|
||||
@@ -199,28 +199,28 @@ that is using the old names to use the new ones instead::
|
||||
wx.NORMAL = wx.FONTWEIGHT_NORMAL
|
||||
wx.LIGHT = wx.FONTWEIGHT_LIGHT
|
||||
wx.BOLD = wx.FONTWEIGHT_BOLD
|
||||
|
||||
|
||||
wx.NORMAL = wx.FONTSTYLE_NORMAL
|
||||
wx.ITALIC = wx.FONTSTYLE_ITALIC
|
||||
wx.SLANT = wx.FONTSTYLE_SLANT
|
||||
|
||||
wx.SOLID = wx.PENSTYLE_SOLID
|
||||
wx.DOT = wx.PENSTYLE_DOT
|
||||
wx.LONG_DASH = wx.PENSTYLE_LONG_DASH
|
||||
wx.SHORT_DASH = wx.PENSTYLE_SHORT_DASH
|
||||
wx.DOT_DASH = wx.PENSTYLE_DOT_DASH
|
||||
wx.USER_DASH = wx.PENSTYLE_USER_DASH
|
||||
wx.TRANSPARENT = wx.PENSTYLE_TRANSPARENT
|
||||
|
||||
wx.STIPPLE_MASK_OPAQUE = wx.BRUSHSTYLE_STIPPLE_MASK_OPAQUE
|
||||
wx.STIPPLE_MASK = wx.BRUSHSTYLE_STIPPLE_MASK
|
||||
wx.STIPPLE = wx.BRUSHSTYLE_STIPPLE
|
||||
wx.BDIAGONAL_HATCH = wx.BRUSHSTYLE_BDIAGONAL_HATCH
|
||||
wx.CROSSDIAG_HATCH = wx.BRUSHSTYLE_CROSSDIAG_HATCH
|
||||
wx.FDIAGONAL_HATCH = wx.BRUSHSTYLE_FDIAGONAL_HATCH
|
||||
wx.CROSS_HATCH = wx.BRUSHSTYLE_CROSS_HATCH
|
||||
wx.HORIZONTAL_HATCH = wx.BRUSHSTYLE_HORIZONTAL_HATCH
|
||||
wx.VERTICAL_HATCH = wx.BRUSHSTYLE_VERTICAL_HATCH
|
||||
wx.SOLID = wx.PENSTYLE_SOLID
|
||||
wx.DOT = wx.PENSTYLE_DOT
|
||||
wx.LONG_DASH = wx.PENSTYLE_LONG_DASH
|
||||
wx.SHORT_DASH = wx.PENSTYLE_SHORT_DASH
|
||||
wx.DOT_DASH = wx.PENSTYLE_DOT_DASH
|
||||
wx.USER_DASH = wx.PENSTYLE_USER_DASH
|
||||
wx.TRANSPARENT = wx.PENSTYLE_TRANSPARENT
|
||||
|
||||
wx.STIPPLE_MASK_OPAQUE = wx.BRUSHSTYLE_STIPPLE_MASK_OPAQUE
|
||||
wx.STIPPLE_MASK = wx.BRUSHSTYLE_STIPPLE_MASK
|
||||
wx.STIPPLE = wx.BRUSHSTYLE_STIPPLE
|
||||
wx.BDIAGONAL_HATCH = wx.BRUSHSTYLE_BDIAGONAL_HATCH
|
||||
wx.CROSSDIAG_HATCH = wx.BRUSHSTYLE_CROSSDIAG_HATCH
|
||||
wx.FDIAGONAL_HATCH = wx.BRUSHSTYLE_FDIAGONAL_HATCH
|
||||
wx.CROSS_HATCH = wx.BRUSHSTYLE_CROSS_HATCH
|
||||
wx.HORIZONTAL_HATCH = wx.BRUSHSTYLE_HORIZONTAL_HATCH
|
||||
wx.VERTICAL_HATCH = wx.BRUSHSTYLE_VERTICAL_HATCH
|
||||
|
||||
|
||||
|
||||
@@ -238,9 +238,9 @@ or other conditional statement to see if it is safe to use, like this::
|
||||
|
||||
if someWindow:
|
||||
someWindow.doSomething()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
wx.PyAssertionError --> wx.wxAssertionError
|
||||
-------------------------------------------
|
||||
|
||||
@@ -412,16 +412,16 @@ where the data object should fetch from or copy to a specific memory location.
|
||||
wx.DataObjectSimple.__init__(self)
|
||||
self.SetFormat(wx.DataFormat("my data format"))
|
||||
self.myData = bytes(value)
|
||||
|
||||
|
||||
def GetDataSize(self):
|
||||
return len(self.myData)
|
||||
|
||||
|
||||
def GetDataHere(self, buf):
|
||||
# copy our local data value to buf
|
||||
assert isinstance(buf, memoryview)
|
||||
buf[:] = self.myData
|
||||
return True
|
||||
|
||||
|
||||
def SetData(self, buf):
|
||||
# copy from buf to our local data value
|
||||
assert isinstance(buf, memoryview)
|
||||
|
@@ -45,12 +45,12 @@ these fields are recognized and formatted nicely:
|
||||
|
||||
* ``param``, ``parameter``, ``arg``, ``argument``, ``key``,
|
||||
``keyword``: Description of a parameter.
|
||||
|
||||
|
||||
* ``type``: Type of a parameter.
|
||||
|
||||
* ``raises``, ``raise``, ``except``, ``exception``: That (and when) a
|
||||
specific exception is raised.
|
||||
|
||||
|
||||
* ``var``, ``ivar``, ``cvar``: Description of a variable.
|
||||
|
||||
* ``returns``, ``return``: Description of the return value.
|
||||
@@ -168,19 +168,19 @@ admonitions:
|
||||
a severe limitation of a method, class or function. In the Phoenix
|
||||
world, this may also indicate that a particular widget is not
|
||||
supported under one or more platforms;
|
||||
|
||||
|
||||
3. ``.. deprecated::`` : used to mark deprecated methods, classes or
|
||||
functions;
|
||||
|
||||
4. ``.. availability::`` : normally employed to make the user
|
||||
understand on which platform(s) a particular functionality is
|
||||
supported/available;
|
||||
|
||||
|
||||
5. ``.. seealso::`` or ``:see:`` : added primarily to facilitate the
|
||||
browsing of the docs, this admonition should be employed every time
|
||||
you think a user may be interested in seeing a related/similar
|
||||
method or a function providing an alternative implementation;
|
||||
|
||||
|
||||
6. ``.. todo::`` : used to mark incomplete methods/functions, or
|
||||
simply as a remainder for the user and the developer that some more
|
||||
functionality needs to be added.
|
||||
@@ -196,7 +196,7 @@ this::
|
||||
- The note contains all indented body elements
|
||||
following.
|
||||
- It includes this bullet list.
|
||||
|
||||
|
||||
|
||||
|
|
||||
|
||||
@@ -244,21 +244,21 @@ documentation, please follow these conventions:
|
||||
2. At the very top of the snippet file (on the first line), put your
|
||||
name, or your alias, or anything you use as internet name preceeded
|
||||
by a double-hash, i.e.:
|
||||
|
||||
|
||||
``##Andrea Gavana``
|
||||
|
||||
|
||||
|
||||
|
||||
So that your source code looks more or less like this::
|
||||
|
||||
|
||||
##Chris Barker
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
A simple test of the GridBagSizer
|
||||
http://wiki.wxpython.org/index.cgi/WriteItYourself
|
||||
"""
|
||||
|
||||
|
||||
# Whatever code here...
|
||||
def SendSizeEvent(self):
|
||||
def SendSizeEvent(self):
|
||||
self.AdjustMySize()
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ especially on Linux/Mac platforms.
|
||||
If you wish to contribute a screenshot of a widget to be included in
|
||||
the documentation, please follow these conventions:
|
||||
|
||||
- If the widget is a class belonging to the main `wx` namespace,
|
||||
- If the widget is a class belonging to the main `wx` namespace,
|
||||
use the full class name in lower case (i.e., `wx.Frame` ==>
|
||||
`wx.frame.png`);
|
||||
|
||||
|
@@ -21,7 +21,7 @@ using :meth:`wx.DC.Blit`(), or to be used as a drawing surface.
|
||||
.. seealso:: :ref:`wx.MemoryDC` for an example of drawing onto a bitmap.
|
||||
|
||||
|
||||
All wxPython platforms support XPMs for small bitmaps and icons.
|
||||
All wxPython platforms support XPMs for small bitmaps and icons.
|
||||
|
||||
|
||||
|
||||
|
@@ -11,7 +11,7 @@
|
||||
Introduction
|
||||
------------
|
||||
|
||||
A book control is a convenient way of displaying multiple pages of information, displayed one page at a time.
|
||||
A book control is a convenient way of displaying multiple pages of information, displayed one page at a time.
|
||||
wxPython has five variants of this control:
|
||||
|
||||
- :ref:`wx.Choicebook`: controlled by a :ref:`wx.Choice`
|
||||
|
@@ -61,7 +61,7 @@ By calling :meth:`wx.FileHistory.UseMenu` you can associate a file
|
||||
menu with the file history. The menu will then be used for appending
|
||||
filenames that are added to the history.
|
||||
|
||||
.. note::
|
||||
.. note::
|
||||
|
||||
Please notice that currently if the history already contained
|
||||
filenames when UseMenu() is called (e.g. when initializing a second
|
||||
|
@@ -72,7 +72,7 @@ background of a window::
|
||||
|
||||
data = wx.ColourData()
|
||||
data.SetChooseFull(True)
|
||||
|
||||
|
||||
for i in xrange(16):
|
||||
colour = wx.Colour(i*16, i*16, i*16)
|
||||
data.SetCustomColour(i, colour)
|
||||
@@ -186,14 +186,14 @@ The wildcard may be a specification for multiple types of file with a
|
||||
description for each, such as::
|
||||
|
||||
wildcard = "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
|
||||
|
||||
|
||||
|
||||
|
||||
.. _dirdialog overview:
|
||||
|
||||
DirDialog Overview
|
||||
-------------------
|
||||
|
||||
|
||||
|
||||
This dialog shows a directory selector dialog, allowing the user to
|
||||
select a single directory.
|
||||
|
@@ -124,11 +124,11 @@ Here is what can be done:
|
||||
:ref:`wx.DateTime` resulting in a new :ref:`wx.DateTime` object and also 2
|
||||
objects of the same span class can be added together giving another
|
||||
object of the same class.
|
||||
|
||||
|
||||
* **Subtraction**: the same types of operations as above are allowed
|
||||
and, additionally, a difference between two :ref:`wx.DateTime` objects
|
||||
can be taken and this will yield :ref:`wx.TimeSpan`.
|
||||
|
||||
|
||||
* **Multiplication**: a :ref:`wx.TimeSpan` or :ref:`wx.DateSpan` object can
|
||||
be multiplied by an integer number resulting in an object of the
|
||||
same type.
|
||||
|
@@ -80,8 +80,8 @@ bottom of the dialog. This is done as follows, in
|
||||
new :ref:`wx.ScrolledWindow` object, using the old top-level sizer for
|
||||
the scrolled window and creating a new top-level sizer to lay out
|
||||
the scrolled window and standard button sizer.
|
||||
|
||||
|
||||
|
||||
|
||||
.. _layout adaptation code:
|
||||
|
||||
Customising scrolling adaptation
|
||||
@@ -134,8 +134,8 @@ not fool-proof, and may fail in the following situations:
|
||||
- The dialog makes assumptions about the sizer hierarchy, for example
|
||||
to show or hide children of the top-level sizer. However, the
|
||||
original sizer hierarchy will still hold until `Show` or `ShowModal`
|
||||
is called.
|
||||
|
||||
is called.
|
||||
|
||||
You can help make sure that your dialogs will continue to function
|
||||
after adaptation by:
|
||||
|
||||
|
@@ -21,19 +21,19 @@ by the user elsewhere, you should implement the following steps:
|
||||
initialized with the data you wish to drag. For example::
|
||||
|
||||
my_data = wx.TextDataObject("This text will be dragged.")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
- **Drag start**: To start the dragging process (typically in response
|
||||
to a mouse click) you must call :meth:`wx.DropSource.DoDragDrop` like
|
||||
this::
|
||||
|
||||
|
||||
dragSource = wx.DropSource(self)
|
||||
dragSource.SetData(my_data)
|
||||
result = dragSource.DoDragDrop(True)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
- **Dragging**: The call to `DoDragDrop()` blocks the program until
|
||||
the user releases the mouse button (unless you override the
|
||||
:meth:`wx.DropSource.GiveFeedback` function to do something
|
||||
@@ -42,23 +42,23 @@ by the user elsewhere, you should implement the following steps:
|
||||
Windows or any program supporting the XDnD protocol under X
|
||||
Windows), the corresponding :ref:`wx.DropTarget` methods are called -
|
||||
see below.
|
||||
|
||||
|
||||
- **Processing the result**: `DoDragDrop()` returns an effect code
|
||||
which is one of the values of :ref:`wx.DragResult`::
|
||||
|
||||
if result == wx.DragCopy:
|
||||
# Copy the data
|
||||
CopyMyData()
|
||||
|
||||
|
||||
elif result == wx.DragMove:
|
||||
# Move the data
|
||||
MoveMyData()
|
||||
|
||||
|
||||
else:
|
||||
# Default, do nothing
|
||||
pass
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
To be a `drop` target, i.e. to receive the data dropped by the user
|
||||
you should follow the instructions below:
|
||||
|
||||
@@ -70,7 +70,7 @@ you should follow the instructions below:
|
||||
methods. Alternatively, you may derive from :ref:`wx.TextDropTarget`
|
||||
or :ref:`wx.FileDropTarget` and override their `OnDropText()` or
|
||||
`OnDropFiles()` method.
|
||||
|
||||
|
||||
- **Drop**: When the user releases the mouse over a window, wxPython
|
||||
asks the associated :ref:`wx.DropTarget` object if it accepts the
|
||||
data. For this, a :ref:`wx.DataObject` must be associated with the
|
||||
@@ -79,11 +79,11 @@ you should follow the instructions below:
|
||||
well, then :meth:`wx.DropTarget.OnData` will get called and the
|
||||
:ref:`wx.DataObject` belonging to the drop target can get filled
|
||||
with data.
|
||||
|
||||
|
||||
- **The end**: After processing the data, `DoDragDrop()` returns
|
||||
either ``wx.DragCopy`` or ``wx.DragMove`` depending on the state of
|
||||
the keys ``Ctrl``, ``Shift`` and ``Alt`` at the moment of the
|
||||
drop. There is currently no way for the drop target to change this
|
||||
return code.
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -49,7 +49,7 @@ To be more precise, each event is described by:
|
||||
several buttons, all generating the same button click event),
|
||||
checking the event source object or its id allows to distinguish
|
||||
between them.
|
||||
|
||||
|
||||
|
||||
|
||||
.. _event handling:
|
||||
@@ -82,7 +82,7 @@ usually in the code of the class defining the handler itself, call its
|
||||
wx.Frame.__init__(self, parent)
|
||||
|
||||
# Other initialization code...
|
||||
|
||||
|
||||
self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT)
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ event handler::
|
||||
wx.Frame.__init__(self, parent)
|
||||
|
||||
# Other initialization code...
|
||||
|
||||
|
||||
self.Bind(wx.EVT_MENU, OnFrameExit, id=wx.ID_EXIT)
|
||||
|
||||
|
||||
@@ -189,8 +189,8 @@ having handled the event and the search continues):
|
||||
8. Finally, i.e., if the event is still not processed, the
|
||||
:ref:`wx.App` object itself (which derives from
|
||||
:ref:`wx.EvtHandler`) gets a last chance to process it.
|
||||
|
||||
|
||||
|
||||
|
||||
**Please pay close attention to step 6!** People often overlook or get
|
||||
confused by this powerful feature of the wxPython event processing
|
||||
system. The details of event propagation up the window hierarchy are
|
||||
@@ -313,8 +313,8 @@ You can bind the events normally via either binding syntax::
|
||||
|
||||
self.Bind(EVT_SOME_NEW_EVENT, self.handler)
|
||||
EVT_SOME_NEW_EVENT(self, self.handler)
|
||||
|
||||
|
||||
|
||||
|
||||
You can also attach arbitrary data to the event during its creation,
|
||||
then post it to whatever window you choose::
|
||||
|
||||
@@ -322,8 +322,8 @@ then post it to whatever window you choose::
|
||||
evt = SomeNewEvent(attr1="hello", attr2=654)
|
||||
# Post the event
|
||||
wx.PostEvent(target, evt)
|
||||
|
||||
|
||||
|
||||
|
||||
When handling events with such arbitrary data, you can fetch the data
|
||||
via attributes, named the same as the names passed in during the event
|
||||
instance creation. That is, given the two keyword arguments passed to
|
||||
@@ -334,8 +334,8 @@ instance creation. That is, given the two keyword arguments passed to
|
||||
# Given the above constructed event, the following is true
|
||||
evt.attr1 == "hello"
|
||||
evt.attr2 == 654
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Miscellaneous Notes
|
||||
|
@@ -73,7 +73,7 @@ It is not used by global protocols like HTTP but it becomes handy when
|
||||
nesting protocols - for example you may want to access files in a ZIP
|
||||
archive:
|
||||
|
||||
``file:archives/cpp_doc.zip#zip:reference/fopen.htm#syntax``
|
||||
``file:archives/cpp_doc.zip#zip:reference/fopen.htm#syntax``
|
||||
|
||||
In this example, the protocol is ``"zip"``, right location is
|
||||
``"reference/fopen.htm"``, anchor is ``"syntax"`` and left location is
|
||||
@@ -103,7 +103,7 @@ The following virtual file system handlers are part of wxPython so far:
|
||||
stored in memory (such as bitmaps) as if they were regular
|
||||
files. See :ref:`wx.MemoryFSHandler` for details. URL is prefixed with
|
||||
memory:, e.g. ``"memory:myfile.htm"``.
|
||||
|
||||
|
||||
|
||||
In addition, :ref:`FileSystem` itself can access local files.
|
||||
|
||||
|
@@ -42,12 +42,12 @@ be transported to a different Windows machine or other platform.
|
||||
.. note:: There is currently a difference between the appearance of
|
||||
fonts on the two platforms, if the mapping mode is anything
|
||||
other than ``MM_TEXT``. Under X, font size is always specified in
|
||||
points. Under MS Windows, the unit for text is points but
|
||||
points. Under MS Windows, the unit for text is points but
|
||||
the text is scaled according to the current mapping mode. However,
|
||||
user scaling on a device context will also scale fonts under both
|
||||
environments.
|
||||
|
||||
|
||||
|
||||
|
||||
Native font information
|
||||
-----------------------
|
||||
|
||||
@@ -70,4 +70,4 @@ font.
|
||||
implemented for Windows and Unix (GTK+ and Motif) ports only, all
|
||||
the methods are available for all the ports and should be used to
|
||||
make your program work correctly when they are implemented later.
|
||||
|
||||
|
||||
|
@@ -34,7 +34,7 @@ some of the formatting functions::
|
||||
class GridFrame(wx.Frame):
|
||||
def __init__(self, parent):
|
||||
wx.Frame.__init__(self, parent)
|
||||
|
||||
|
||||
# Create a wxGrid object
|
||||
grid = wx.grid.Grid(self, -1)
|
||||
|
||||
@@ -70,7 +70,7 @@ some of the formatting functions::
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
|
||||
app = wx.App(0)
|
||||
frame = GridFrame(None)
|
||||
app.MainLoop()
|
||||
@@ -80,10 +80,10 @@ Here is a list of classes related to :class:`~wx.grid.Grid`:
|
||||
|
||||
- :class:`~wx.grid.Grid`: The main grid control class itself.
|
||||
- :class:`~wx.grid.GridTableBase`: The base class for grid data provider.
|
||||
- :class:`~wx.grid.GridStringTable`: Simple :class:`~wx.grid.GridTableBase` implementation
|
||||
supporting only string data items and storing them all in memory (hence suitable
|
||||
- :class:`~wx.grid.GridStringTable`: Simple :class:`~wx.grid.GridTableBase` implementation
|
||||
supporting only string data items and storing them all in memory (hence suitable
|
||||
for not too large grids only).
|
||||
- :class:`~wx.grid.GridCellAttr`: A cell attribute, allowing to customize its appearance
|
||||
- :class:`~wx.grid.GridCellAttr`: A cell attribute, allowing to customize its appearance
|
||||
as well as the renderer and editor used for displaying and editing it.
|
||||
- :class:`~wx.grid.GridCellAttrProvider`: The object responsible for storing and retrieving the cell attributes.
|
||||
- :class:`~wx.grid.GridColLabelWindow`: The window showing the grid columns labels.
|
||||
|
@@ -156,7 +156,7 @@ lines which are ignored)::
|
||||
All filenames (including the Default topic) are relative to the location of
|
||||
the ``".hhp"`` file.
|
||||
|
||||
.. note::
|
||||
.. note::
|
||||
|
||||
For localization, in addition the ``".hhp"`` file may contain the line::
|
||||
|
||||
@@ -165,7 +165,7 @@ the ``".hhp"`` file.
|
||||
which specifies what charset (e.g. "iso8859_1") was used in contents and
|
||||
index files. Please note that this line is incompatible with MS HTML Help
|
||||
Workshop and it would either silently remove it or complain with some error.
|
||||
|
||||
|
||||
|
||||
Contents file (.hhc)
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -334,7 +334,7 @@ containers unmodified (in other words, number of OpenContainer and
|
||||
CloseContainer calls should be same within :meth:`~wx.html.HtmlTagHandler.HandleTag` 's
|
||||
body).
|
||||
|
||||
.. note::
|
||||
.. note::
|
||||
|
||||
Notice that it would be usually better to use
|
||||
:meth:`~wx.html.HtmlContainerCell.InsertCell` instead of adding text to the parser
|
||||
|
@@ -13,7 +13,7 @@
|
||||
|
||||
"Internationalization" (often referred to as i18n) is the process to change an
|
||||
application so that all user visible texts are translated to the user selected
|
||||
language and that things like dates, money amounts and numbers in general are
|
||||
language and that things like dates, money amounts and numbers in general are
|
||||
shown in a format the user is familiar with/or used to.
|
||||
|
||||
The easiest way to show what is needed is by using a little code sample.
|
||||
@@ -26,7 +26,7 @@ Prepare the source code
|
||||
-----------------------
|
||||
|
||||
Text translation in Python is done using gettext [1]_ , to ensure that all
|
||||
wxPython labels are also translated we will use :class:`wx.Locale` and
|
||||
wxPython labels are also translated we will use :class:`wx.Locale` and
|
||||
:func:`wx.GetTranslation` .
|
||||
|
||||
How to prepare your source code to enable translation of texts::
|
||||
|
@@ -108,9 +108,9 @@ Some of advantages in using wxPython log functions are:
|
||||
:func:`wx.LogError` in this situation, the exact error code (and the
|
||||
corresponding error message) will be given to the user together with
|
||||
"high level" message about data file writing error.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.. _log messages selection:
|
||||
|
||||
Log Messages Selection
|
||||
@@ -222,8 +222,8 @@ of course, may also be used without any change. There are:
|
||||
- :ref:`wx.LogNull`: The last log class is quite particular: it doesn't
|
||||
do anything. The objects of this class may be instantiated to
|
||||
(temporarily) suppress output of `LogXXX` functions.
|
||||
|
||||
|
||||
|
||||
|
||||
The log targets can also be combined: for example you may wish to
|
||||
redirect the messages somewhere else (for example, to a log file) but
|
||||
also process them as normally. For this the :ref:`wx.LogChain`,
|
||||
@@ -338,13 +338,13 @@ nothing happens.
|
||||
For example::
|
||||
|
||||
wx.LogTrace(wx.TRACE_OleCalls, "Foo.Bar() called")
|
||||
|
||||
|
||||
|
||||
|
||||
will log the message if it was preceded by::
|
||||
|
||||
wx.Log.AddTraceMask(wx.TRACE_OleCalls)
|
||||
|
||||
|
||||
|
||||
|
||||
The standard trace masks are given in the :func:`wx.LogTrace`
|
||||
documentation.
|
||||
|
||||
|
@@ -103,63 +103,63 @@ This is taken from the wxPython demo::
|
||||
import wx
|
||||
import wx.richtext as rt
|
||||
import images
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
class RichTextFrame(wx.Frame):
|
||||
|
||||
|
||||
def __init__(self, *args, **kw):
|
||||
|
||||
|
||||
wx.Frame.__init__(self, *args, **kw)
|
||||
|
||||
|
||||
self.MakeMenuBar()
|
||||
self.MakeToolBar()
|
||||
self.CreateStatusBar()
|
||||
self.SetStatusText("Welcome to wx.richtext.RichTextCtrl!")
|
||||
|
||||
|
||||
self.rtc = rt.RichTextCtrl(self, style=wx.VSCROLL|wx.HSCROLL|wx.NO_BORDER);
|
||||
wx.CallAfter(self.rtc.SetFocus)
|
||||
|
||||
|
||||
self.rtc.Freeze()
|
||||
self.rtc.BeginSuppressUndo()
|
||||
|
||||
|
||||
self.rtc.BeginParagraphSpacing(0, 20)
|
||||
|
||||
|
||||
self.rtc.BeginAlignment(rt.TEXT_ALIGNMENT_CENTRE)
|
||||
self.rtc.BeginBold()
|
||||
|
||||
|
||||
self.rtc.BeginFontSize(14)
|
||||
self.rtc.WriteText("Welcome to wxRichTextCtrl, a wxWidgets control for editing and presenting " \
|
||||
"styled text and images")
|
||||
self.rtc.EndFontSize()
|
||||
self.rtc.Newline()
|
||||
|
||||
|
||||
self.rtc.BeginItalic()
|
||||
self.rtc.WriteText("by Julian Smart")
|
||||
self.rtc.EndItalic()
|
||||
|
||||
|
||||
self.rtc.EndBold()
|
||||
|
||||
|
||||
self.rtc.Newline()
|
||||
self.rtc.WriteImage(images._rt_zebra.GetImage())
|
||||
|
||||
|
||||
self.rtc.EndAlignment()
|
||||
|
||||
|
||||
self.rtc.Newline()
|
||||
self.rtc.Newline()
|
||||
|
||||
|
||||
self.rtc.WriteText("What can you do with this thing? ")
|
||||
self.rtc.WriteImage(images._rt_smiley.GetImage())
|
||||
self.rtc.WriteText(" Well, you can change text ")
|
||||
|
||||
|
||||
self.rtc.BeginTextColour((255, 0, 0))
|
||||
self.rtc.WriteText("colour, like this red bit.")
|
||||
self.rtc.EndTextColour()
|
||||
|
||||
|
||||
self.rtc.BeginTextColour((0, 0, 255))
|
||||
self.rtc.WriteText(" And this blue bit.")
|
||||
self.rtc.EndTextColour()
|
||||
|
||||
|
||||
self.rtc.WriteText(" Naturally you can make things ")
|
||||
self.rtc.BeginBold()
|
||||
self.rtc.WriteText("bold ")
|
||||
@@ -170,121 +170,121 @@ This is taken from the wxPython demo::
|
||||
self.rtc.BeginUnderline()
|
||||
self.rtc.WriteText("or underlined.")
|
||||
self.rtc.EndUnderline()
|
||||
|
||||
|
||||
self.rtc.BeginFontSize(14)
|
||||
self.rtc.WriteText(" Different font sizes on the same line is allowed, too.")
|
||||
self.rtc.EndFontSize()
|
||||
|
||||
|
||||
self.rtc.WriteText(" Next we'll show an indented paragraph.")
|
||||
|
||||
|
||||
self.rtc.BeginLeftIndent(60)
|
||||
self.rtc.Newline()
|
||||
|
||||
|
||||
self.rtc.WriteText("It was in January, the most down-trodden month of an Edinburgh winter. " \
|
||||
"An attractive woman came into the cafe, which is nothing remarkable.")
|
||||
self.rtc.EndLeftIndent()
|
||||
|
||||
|
||||
self.rtc.Newline()
|
||||
|
||||
|
||||
self.rtc.WriteText("Next, we'll show a first-line indent, achieved using BeginLeftIndent(100, -40).")
|
||||
|
||||
|
||||
self.rtc.BeginLeftIndent(100, -40)
|
||||
self.rtc.Newline()
|
||||
|
||||
|
||||
self.rtc.WriteText("It was in January, the most down-trodden month of an Edinburgh winter. " \
|
||||
"An attractive woman came into the cafe, which is nothing remarkable.")
|
||||
self.rtc.EndLeftIndent()
|
||||
|
||||
|
||||
self.rtc.Newline()
|
||||
|
||||
|
||||
self.rtc.WriteText("Numbered bullets are possible, again using sub-indents:")
|
||||
|
||||
|
||||
self.rtc.BeginNumberedBullet(1, 100, 60)
|
||||
self.rtc.Newline()
|
||||
|
||||
|
||||
self.rtc.WriteText("This is my first item. Note that wxRichTextCtrl doesn't automatically do numbering, " \
|
||||
"but this will be added later.")
|
||||
|
||||
|
||||
self.rtc.EndNumberedBullet()
|
||||
|
||||
|
||||
self.rtc.BeginNumberedBullet(2, 100, 60)
|
||||
self.rtc.Newline()
|
||||
|
||||
|
||||
self.rtc.WriteText("This is my second item.")
|
||||
self.rtc.EndNumberedBullet()
|
||||
|
||||
|
||||
self.rtc.Newline()
|
||||
|
||||
|
||||
self.rtc.WriteText("The following paragraph is right-indented:")
|
||||
|
||||
|
||||
self.rtc.BeginRightIndent(200)
|
||||
self.rtc.Newline()
|
||||
|
||||
|
||||
self.rtc.WriteText("It was in January, the most down-trodden month of an Edinburgh winter. " \
|
||||
"An attractive woman came into the cafe, which is nothing remarkable.")
|
||||
self.rtc.EndRightIndent()
|
||||
|
||||
|
||||
self.rtc.Newline()
|
||||
|
||||
|
||||
self.rtc.WriteText("The following paragraph is right-aligned with 1.5 line spacing:")
|
||||
|
||||
|
||||
self.rtc.BeginAlignment(rt.TEXT_ALIGNMENT_RIGHT)
|
||||
self.rtc.BeginLineSpacing(rt.TEXT_ATTR_LINE_SPACING_HALF)
|
||||
self.rtc.Newline()
|
||||
|
||||
|
||||
self.rtc.WriteText("It was in January, the most down-trodden month of an Edinburgh winter. " \
|
||||
"An attractive woman came into the cafe, which is nothing remarkable.")
|
||||
self.rtc.EndLineSpacing()
|
||||
self.rtc.EndAlignment()
|
||||
|
||||
|
||||
self.rtc.Newline()
|
||||
self.rtc.WriteText("Other notable features of wxRichTextCtrl include:")
|
||||
|
||||
|
||||
self.rtc.BeginSymbolBullet('*', 100, 60)
|
||||
self.rtc.Newline()
|
||||
self.rtc.WriteText("Compatibility with wxTextCtrl API")
|
||||
self.rtc.EndSymbolBullet()
|
||||
|
||||
|
||||
self.rtc.BeginSymbolBullet('*', 100, 60)
|
||||
self.rtc.Newline()
|
||||
self.rtc.WriteText("Easy stack-based BeginXXX()...EndXXX() style setting in addition to SetStyle()")
|
||||
self.rtc.EndSymbolBullet()
|
||||
|
||||
|
||||
self.rtc.BeginSymbolBullet('*', 100, 60)
|
||||
self.rtc.Newline()
|
||||
self.rtc.WriteText("XML loading and saving")
|
||||
self.rtc.EndSymbolBullet()
|
||||
|
||||
|
||||
self.rtc.BeginSymbolBullet('*', 100, 60)
|
||||
self.rtc.Newline()
|
||||
self.rtc.WriteText("Undo/Redo, with batching option and Undo suppressing")
|
||||
self.rtc.EndSymbolBullet()
|
||||
|
||||
|
||||
self.rtc.BeginSymbolBullet('*', 100, 60)
|
||||
self.rtc.Newline()
|
||||
self.rtc.WriteText("Clipboard copy and paste")
|
||||
self.rtc.EndSymbolBullet()
|
||||
|
||||
|
||||
self.rtc.BeginSymbolBullet('*', 100, 60)
|
||||
self.rtc.Newline()
|
||||
self.rtc.WriteText("wxRichTextStyleSheet with named character and paragraph styles, and control for " \
|
||||
"applying named styles")
|
||||
self.rtc.EndSymbolBullet()
|
||||
|
||||
|
||||
self.rtc.BeginSymbolBullet('*', 100, 60)
|
||||
self.rtc.Newline()
|
||||
self.rtc.WriteText("A design that can easily be extended to other content types, ultimately with text " \
|
||||
"boxes, tables, controls, and so on")
|
||||
self.rtc.EndSymbolBullet()
|
||||
|
||||
|
||||
self.rtc.BeginSymbolBullet('*', 100, 60)
|
||||
self.rtc.Newline()
|
||||
|
||||
|
||||
# Make a style suitable for showing a URL
|
||||
urlStyle = rt.TextAttrEx()
|
||||
urlStyle.SetTextColour(wx.BLUE)
|
||||
urlStyle.SetFontUnderlined(True)
|
||||
|
||||
|
||||
self.rtc.WriteText("RichTextCtrl can also display URLs, such as this one: ")
|
||||
self.rtc.BeginStyle(urlStyle)
|
||||
self.rtc.BeginURL("http://wxPython.org/")
|
||||
@@ -292,27 +292,27 @@ This is taken from the wxPython demo::
|
||||
self.rtc.EndURL();
|
||||
self.rtc.EndStyle();
|
||||
self.rtc.WriteText(". Click on the URL to generate an event.")
|
||||
|
||||
|
||||
self.rtc.Bind(wx.EVT_TEXT_URL, self.OnURL)
|
||||
|
||||
|
||||
self.rtc.Newline()
|
||||
self.rtc.WriteText("Note: this sample content was generated programmatically from within the " \
|
||||
"MyFrame constructor " \
|
||||
"in the demo. The images were loaded from inline XPMs. Enjoy wxRichTextCtrl!")
|
||||
|
||||
|
||||
self.rtc.EndParagraphSpacing()
|
||||
|
||||
|
||||
self.rtc.EndSuppressUndo()
|
||||
self.rtc.Thaw()
|
||||
|
||||
|
||||
|
||||
|
||||
def OnURL(self, evt):
|
||||
|
||||
|
||||
wx.MessageBox(evt.GetString(), "URL Clicked")
|
||||
|
||||
|
||||
|
||||
|
||||
def OnFileOpen(self, evt):
|
||||
|
||||
|
||||
# This gives us a string suitable for the file dialog based on
|
||||
# the file handlers that are loaded
|
||||
wildcard, types = rt.RichTextBuffer.GetExtWildcard(save=False)
|
||||
@@ -325,25 +325,25 @@ This is taken from the wxPython demo::
|
||||
fileType = types[dlg.GetFilterIndex()]
|
||||
self.rtc.LoadFile(path, fileType)
|
||||
dlg.Destroy()
|
||||
|
||||
|
||||
|
||||
|
||||
def OnFileSave(self, evt):
|
||||
|
||||
|
||||
if not self.rtc.GetFilename():
|
||||
self.OnFileSaveAs(evt)
|
||||
return
|
||||
|
||||
|
||||
self.rtc.SaveFile()
|
||||
|
||||
|
||||
|
||||
|
||||
def OnFileSaveAs(self, evt):
|
||||
|
||||
|
||||
wildcard, types = rt.RichTextBuffer.GetExtWildcard(save=True)
|
||||
|
||||
|
||||
dlg = wx.FileDialog(self, "Choose a filename",
|
||||
wildcard=wildcard,
|
||||
style=wx.SAVE)
|
||||
|
||||
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
path = dlg.GetPath()
|
||||
if path:
|
||||
@@ -352,24 +352,24 @@ This is taken from the wxPython demo::
|
||||
if not path.endswith(ext):
|
||||
path += '.' + ext
|
||||
self.rtc.SaveFile(path, fileType)
|
||||
|
||||
|
||||
dlg.Destroy()
|
||||
|
||||
|
||||
|
||||
|
||||
def OnFileViewHTML(self, evt):
|
||||
|
||||
|
||||
# Get an instance of the html file handler, use it to save the
|
||||
# document to a StringIO stream, and then display the
|
||||
# resulting html text in a dialog with a HtmlWindow.
|
||||
handler = rt.RichTextHTMLHandler()
|
||||
handler.SetFlags(rt.RICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY)
|
||||
handler.SetFontSizeMapping([7,9,11,12,14,22,100])
|
||||
|
||||
|
||||
import cStringIO
|
||||
stream = cStringIO.StringIO()
|
||||
if not handler.SaveStream(self.rtc.GetBuffer(), stream):
|
||||
return
|
||||
|
||||
|
||||
import wx.html
|
||||
dlg = wx.Dialog(self, title="HTML", style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)
|
||||
html = wx.html.HtmlWindow(dlg, size=(500,400), style=wx.BORDER_SUNKEN)
|
||||
@@ -380,49 +380,49 @@ This is taken from the wxPython demo::
|
||||
sizer.Add(btn, 0, wx.ALL|wx.CENTER, 10)
|
||||
dlg.SetSizer(sizer)
|
||||
sizer.Fit(dlg)
|
||||
|
||||
|
||||
dlg.ShowModal()
|
||||
|
||||
|
||||
handler.DeleteTemporaryImages()
|
||||
|
||||
|
||||
|
||||
|
||||
def OnFileExit(self, evt):
|
||||
|
||||
|
||||
self.Close(True)
|
||||
|
||||
|
||||
|
||||
|
||||
def OnBold(self, evt):
|
||||
|
||||
|
||||
self.rtc.ApplyBoldToSelection()
|
||||
|
||||
|
||||
|
||||
|
||||
def OnItalic(self, evt):
|
||||
|
||||
|
||||
self.rtc.ApplyItalicToSelection()
|
||||
|
||||
|
||||
|
||||
|
||||
def OnUnderline(self, evt):
|
||||
|
||||
|
||||
self.rtc.ApplyUnderlineToSelection()
|
||||
|
||||
|
||||
|
||||
|
||||
def OnAlignLeft(self, evt):
|
||||
|
||||
|
||||
self.rtc.ApplyAlignmentToSelection(rt.TEXT_ALIGNMENT_LEFT)
|
||||
|
||||
|
||||
|
||||
|
||||
def OnAlignRight(self, evt):
|
||||
|
||||
|
||||
self.rtc.ApplyAlignmentToSelection(rt.TEXT_ALIGNMENT_RIGHT)
|
||||
|
||||
|
||||
|
||||
|
||||
def OnAlignCenter(self, evt):
|
||||
|
||||
|
||||
self.rtc.ApplyAlignmentToSelection(rt.TEXT_ALIGNMENT_CENTRE)
|
||||
|
||||
|
||||
|
||||
|
||||
def OnIndentMore(self, evt):
|
||||
|
||||
|
||||
attr = rt.TextAttrEx()
|
||||
attr.SetFlags(rt.TEXT_ATTR_LEFT_INDENT)
|
||||
ip = self.rtc.GetInsertionPoint()
|
||||
@@ -430,14 +430,14 @@ This is taken from the wxPython demo::
|
||||
r = rt.RichTextRange(ip, ip)
|
||||
if self.rtc.HasSelection():
|
||||
r = self.rtc.GetSelectionRange()
|
||||
|
||||
|
||||
attr.SetLeftIndent(attr.GetLeftIndent() + 100)
|
||||
attr.SetFlags(rt.TEXT_ATTR_LEFT_INDENT)
|
||||
self.rtc.SetStyle(r, attr)
|
||||
|
||||
|
||||
|
||||
|
||||
def OnIndentLess(self, evt):
|
||||
|
||||
|
||||
attr = rt.TextAttrEx()
|
||||
attr.SetFlags(rt.TEXT_ATTR_LEFT_INDENT)
|
||||
ip = self.rtc.GetInsertionPoint()
|
||||
@@ -445,15 +445,15 @@ This is taken from the wxPython demo::
|
||||
r = rt.RichTextRange(ip, ip)
|
||||
if self.rtc.HasSelection():
|
||||
r = self.rtc.GetSelectionRange()
|
||||
|
||||
|
||||
if attr.GetLeftIndent() >= 100:
|
||||
attr.SetLeftIndent(attr.GetLeftIndent() - 100)
|
||||
attr.SetFlags(rt.TEXT_ATTR_LEFT_INDENT)
|
||||
self.rtc.SetStyle(r, attr)
|
||||
|
||||
|
||||
|
||||
|
||||
def OnParagraphSpacingMore(self, evt):
|
||||
|
||||
|
||||
attr = rt.TextAttrEx()
|
||||
attr.SetFlags(rt.TEXT_ATTR_PARA_SPACING_AFTER)
|
||||
ip = self.rtc.GetInsertionPoint()
|
||||
@@ -461,14 +461,14 @@ This is taken from the wxPython demo::
|
||||
r = rt.RichTextRange(ip, ip)
|
||||
if self.rtc.HasSelection():
|
||||
r = self.rtc.GetSelectionRange()
|
||||
|
||||
|
||||
attr.SetParagraphSpacingAfter(attr.GetParagraphSpacingAfter() + 20);
|
||||
attr.SetFlags(rt.TEXT_ATTR_PARA_SPACING_AFTER)
|
||||
self.rtc.SetStyle(r, attr)
|
||||
|
||||
|
||||
|
||||
|
||||
def OnParagraphSpacingLess(self, evt):
|
||||
|
||||
|
||||
attr = rt.TextAttrEx()
|
||||
attr.SetFlags(rt.TEXT_ATTR_PARA_SPACING_AFTER)
|
||||
ip = self.rtc.GetInsertionPoint()
|
||||
@@ -476,15 +476,15 @@ This is taken from the wxPython demo::
|
||||
r = rt.RichTextRange(ip, ip)
|
||||
if self.rtc.HasSelection():
|
||||
r = self.rtc.GetSelectionRange()
|
||||
|
||||
|
||||
if attr.GetParagraphSpacingAfter() >= 20:
|
||||
attr.SetParagraphSpacingAfter(attr.GetParagraphSpacingAfter() - 20);
|
||||
attr.SetFlags(rt.TEXT_ATTR_PARA_SPACING_AFTER)
|
||||
self.rtc.SetStyle(r, attr)
|
||||
|
||||
|
||||
|
||||
|
||||
def OnLineSpacingSingle(self, evt):
|
||||
|
||||
|
||||
attr = rt.TextAttrEx()
|
||||
attr.SetFlags(rt.TEXT_ATTR_LINE_SPACING)
|
||||
ip = self.rtc.GetInsertionPoint()
|
||||
@@ -492,14 +492,14 @@ This is taken from the wxPython demo::
|
||||
r = rt.RichTextRange(ip, ip)
|
||||
if self.rtc.HasSelection():
|
||||
r = self.rtc.GetSelectionRange()
|
||||
|
||||
|
||||
attr.SetFlags(rt.TEXT_ATTR_LINE_SPACING)
|
||||
attr.SetLineSpacing(10)
|
||||
self.rtc.SetStyle(r, attr)
|
||||
|
||||
|
||||
|
||||
|
||||
def OnLineSpacingHalf(self, evt):
|
||||
|
||||
|
||||
attr = rt.TextAttrEx()
|
||||
attr.SetFlags(rt.TEXT_ATTR_LINE_SPACING)
|
||||
ip = self.rtc.GetInsertionPoint()
|
||||
@@ -507,14 +507,14 @@ This is taken from the wxPython demo::
|
||||
r = rt.RichTextRange(ip, ip)
|
||||
if self.rtc.HasSelection():
|
||||
r = self.rtc.GetSelectionRange()
|
||||
|
||||
|
||||
attr.SetFlags(rt.TEXT_ATTR_LINE_SPACING)
|
||||
attr.SetLineSpacing(15)
|
||||
self.rtc.SetStyle(r, attr)
|
||||
|
||||
|
||||
|
||||
|
||||
def OnLineSpacingDouble(self, evt):
|
||||
|
||||
|
||||
attr = rt.TextAttrEx()
|
||||
attr.SetFlags(rt.TEXT_ATTR_LINE_SPACING)
|
||||
ip = self.rtc.GetInsertionPoint()
|
||||
@@ -522,17 +522,17 @@ This is taken from the wxPython demo::
|
||||
r = rt.RichTextRange(ip, ip)
|
||||
if self.rtc.HasSelection():
|
||||
r = self.rtc.GetSelectionRange()
|
||||
|
||||
|
||||
attr.SetFlags(rt.TEXT_ATTR_LINE_SPACING)
|
||||
attr.SetLineSpacing(20)
|
||||
self.rtc.SetStyle(r, attr)
|
||||
|
||||
|
||||
|
||||
|
||||
def OnFont(self, evt):
|
||||
|
||||
|
||||
if not self.rtc.HasSelection():
|
||||
return
|
||||
|
||||
|
||||
r = self.rtc.GetSelectionRange()
|
||||
fontData = wx.FontData()
|
||||
fontData.EnableEffects(False)
|
||||
@@ -540,7 +540,7 @@ This is taken from the wxPython demo::
|
||||
attr.SetFlags(rt.TEXT_ATTR_FONT)
|
||||
if self.rtc.GetStyle(self.rtc.GetInsertionPoint(), attr):
|
||||
fontData.SetInitialFont(attr.GetFont())
|
||||
|
||||
|
||||
dlg = wx.FontDialog(self, fontData)
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
fontData = dlg.GetFontData()
|
||||
@@ -550,16 +550,16 @@ This is taken from the wxPython demo::
|
||||
attr.SetFont(font)
|
||||
self.rtc.SetStyle(r, attr)
|
||||
dlg.Destroy()
|
||||
|
||||
|
||||
|
||||
|
||||
def OnColour(self, evt):
|
||||
|
||||
|
||||
colourData = wx.ColourData()
|
||||
attr = rt.TextAttrEx()
|
||||
attr.SetFlags(rt.TEXT_ATTR_TEXT_COLOUR)
|
||||
if self.rtc.GetStyle(self.rtc.GetInsertionPoint(), attr):
|
||||
colourData.SetColour(attr.GetTextColour())
|
||||
|
||||
|
||||
dlg = wx.ColourDialog(self, colourData)
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
colourData = dlg.GetColourData()
|
||||
@@ -573,55 +573,55 @@ This is taken from the wxPython demo::
|
||||
attr.SetTextColour(colour)
|
||||
self.rtc.SetStyle(r, attr)
|
||||
dlg.Destroy()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def OnUpdateBold(self, evt):
|
||||
|
||||
|
||||
evt.Check(self.rtc.IsSelectionBold())
|
||||
|
||||
|
||||
|
||||
|
||||
def OnUpdateItalic(self, evt):
|
||||
|
||||
|
||||
evt.Check(self.rtc.IsSelectionItalics())
|
||||
|
||||
|
||||
|
||||
|
||||
def OnUpdateUnderline(self, evt):
|
||||
|
||||
|
||||
evt.Check(self.rtc.IsSelectionUnderlined())
|
||||
|
||||
|
||||
|
||||
|
||||
def OnUpdateAlignLeft(self, evt):
|
||||
|
||||
|
||||
evt.Check(self.rtc.IsSelectionAligned(rt.TEXT_ALIGNMENT_LEFT))
|
||||
|
||||
|
||||
|
||||
|
||||
def OnUpdateAlignCenter(self, evt):
|
||||
|
||||
|
||||
evt.Check(self.rtc.IsSelectionAligned(rt.TEXT_ALIGNMENT_CENTRE))
|
||||
|
||||
|
||||
|
||||
|
||||
def OnUpdateAlignRight(self, evt):
|
||||
|
||||
|
||||
evt.Check(self.rtc.IsSelectionAligned(rt.TEXT_ALIGNMENT_RIGHT))
|
||||
|
||||
|
||||
|
||||
|
||||
def ForwardEvent(self, evt):
|
||||
|
||||
|
||||
# The RichTextCtrl can handle menu and update events for undo,
|
||||
# redo, cut, copy, paste, delete, and select all, so just
|
||||
# forward the event to it.
|
||||
self.rtc.ProcessEvent(evt)
|
||||
|
||||
|
||||
|
||||
|
||||
def MakeMenuBar(self):
|
||||
|
||||
|
||||
def doBind(item, handler, updateUI=None):
|
||||
|
||||
|
||||
self.Bind(wx.EVT_MENU, handler, item)
|
||||
if updateUI is not None:
|
||||
self.Bind(wx.EVT_UPDATE_UI, updateUI, item)
|
||||
|
||||
|
||||
fileMenu = wx.Menu()
|
||||
doBind( fileMenu.Append(-1, "&Open\tCtrl+O", "Open a file"),
|
||||
self.OnFileOpen )
|
||||
@@ -635,7 +635,7 @@ This is taken from the wxPython demo::
|
||||
fileMenu.AppendSeparator()
|
||||
doBind( fileMenu.Append(-1, "E&xit\tCtrl+Q", "Quit this program"),
|
||||
self.OnFileExit )
|
||||
|
||||
|
||||
editMenu = wx.Menu()
|
||||
doBind( editMenu.Append(wx.ID_UNDO, "&Undo\tCtrl+Z"),
|
||||
self.ForwardEvent, self.ForwardEvent)
|
||||
@@ -653,7 +653,7 @@ This is taken from the wxPython demo::
|
||||
editMenu.AppendSeparator()
|
||||
doBind( editMenu.Append(wx.ID_SELECTALL, "Select A&ll\tCtrl+A"),
|
||||
self.ForwardEvent, self.ForwardEvent )
|
||||
|
||||
|
||||
formatMenu = wx.Menu()
|
||||
doBind( formatMenu.AppendCheckItem(-1, "&Bold\tCtrl+B"),
|
||||
self.OnBold, self.OnUpdateBold)
|
||||
@@ -680,22 +680,22 @@ This is taken from the wxPython demo::
|
||||
doBind( formatMenu.Append(-1, "Double Line Spacing"), self.OnLineSpacingDouble)
|
||||
formatMenu.AppendSeparator()
|
||||
doBind( formatMenu.Append(-1, "&Font..."), self.OnFont)
|
||||
|
||||
|
||||
mb = wx.MenuBar()
|
||||
mb.Append(fileMenu, "&File")
|
||||
mb.Append(editMenu, "&Edit")
|
||||
mb.Append(formatMenu, "F&ormat")
|
||||
self.SetMenuBar(mb)
|
||||
|
||||
|
||||
|
||||
|
||||
def MakeToolBar(self):
|
||||
|
||||
|
||||
def doBind(item, handler, updateUI=None):
|
||||
|
||||
|
||||
self.Bind(wx.EVT_TOOL, handler, item)
|
||||
if updateUI is not None:
|
||||
self.Bind(wx.EVT_UPDATE_UI, updateUI, item)
|
||||
|
||||
|
||||
tbar = self.CreateToolBar()
|
||||
doBind( tbar.AddTool(-1, images._rt_open.GetBitmap(),
|
||||
shortHelpString="Open"), self.OnFileOpen)
|
||||
@@ -737,65 +737,65 @@ This is taken from the wxPython demo::
|
||||
shortHelpString="Font"), self.OnFont)
|
||||
doBind( tbar.AddTool(-1, images._rt_colour.GetBitmap(),
|
||||
shortHelpString="Font Colour"), self.OnColour)
|
||||
|
||||
|
||||
tbar.Realize()
|
||||
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestPanel(wx.Panel):
|
||||
|
||||
|
||||
def __init__(self, parent):
|
||||
|
||||
|
||||
wx.Panel.__init__(self, parent, -1)
|
||||
|
||||
|
||||
b = wx.Button(self, -1, "Show the RichTextCtrl sample", (50,50))
|
||||
self.Bind(wx.EVT_BUTTON, self.OnButton, b)
|
||||
|
||||
|
||||
self.AddRTCHandlers()
|
||||
|
||||
|
||||
|
||||
|
||||
def AddRTCHandlers(self):
|
||||
|
||||
|
||||
# make sure we haven't already added them.
|
||||
if rt.RichTextBuffer.FindHandlerByType(rt.RICHTEXT_TYPE_HTML) is not None:
|
||||
return
|
||||
|
||||
|
||||
# This would normally go in your app's OnInit method. I'm
|
||||
# not sure why these file handlers are not loaded by
|
||||
# default by the C++ richtext code, I guess it's so you
|
||||
# can change the name or extension if you wanted...
|
||||
rt.RichTextBuffer.AddHandler(rt.RichTextHTMLHandler())
|
||||
rt.RichTextBuffer.AddHandler(rt.RichTextXMLHandler())
|
||||
|
||||
|
||||
# ...like this
|
||||
rt.RichTextBuffer.AddHandler(rt.RichTextXMLHandler(name="Other XML",
|
||||
ext="ox",
|
||||
type=99))
|
||||
|
||||
|
||||
# This is needed for the view as HTML option since we tell it
|
||||
# to store the images in the memory file system.
|
||||
wx.FileSystem.AddHandler(wx.MemoryFSHandler())
|
||||
|
||||
|
||||
|
||||
|
||||
def OnButton(self, evt):
|
||||
|
||||
|
||||
win = RichTextFrame(self, -1, "wx.richtext.RichTextCtrl",
|
||||
size=(700, 500),
|
||||
style = wx.DEFAULT_FRAME_STYLE)
|
||||
win.Show(True)
|
||||
|
||||
|
||||
# give easy access to the demo's PyShell if it's running
|
||||
self.rtfrm = win
|
||||
self.rtc = win.rtc
|
||||
|
||||
|
||||
|
||||
|
||||
app = wx.App(0)
|
||||
|
||||
|
||||
frame = wx.Frame(None)
|
||||
panel = TestPanel(frame)
|
||||
frame.Show()
|
||||
|
||||
|
||||
app.MainLoop()
|
||||
|
||||
|
||||
@@ -826,7 +826,7 @@ There are four main notions of style within a control:
|
||||
:meth:`~wx.richtext.RichTextCtrl.SetFont` changes the font for the
|
||||
basic style. The basic style is set with
|
||||
:meth:`~wx.richtext.RichTextCtrl.SetBasicStyle`.
|
||||
|
||||
|
||||
+ **Paragraph style**: Each paragraph has attributes that are set
|
||||
independently from other paragraphs and independently from the
|
||||
content within the paragraph. Normally, these attributes are
|
||||
|
@@ -80,8 +80,8 @@ font. The window is sized so that you can only see 16 lines at a
|
||||
time. You would use::
|
||||
|
||||
SetScrollbar(wx.VERTICAL, 0, 16, 50)
|
||||
|
||||
|
||||
|
||||
|
||||
.. note:: Note that with the window at this size, the thumb position
|
||||
can never go above 50 minus 16, or 34. You can determine how many
|
||||
lines are currently visible by dividing the current view size by
|
||||
|
@@ -160,20 +160,20 @@ looking at the :meth:`wx.BoxSizer.Add` signature:
|
||||
|
||||
Appends a child to the sizer.
|
||||
|
||||
:param `window`: a window, a spacer or another sizer to be added to the sizer. Its initial size
|
||||
(either set explicitly by the user or calculated internally) is interpreted as the minimal and
|
||||
:param `window`: a window, a spacer or another sizer to be added to the sizer. Its initial size
|
||||
(either set explicitly by the user or calculated internally) is interpreted as the minimal and
|
||||
in many cases also the initial size.
|
||||
:param int proportion: this parameter is used in :class:`wx.BoxSizer` to indicate if a child of a sizer
|
||||
can change its size in the main orientation of the :class:`wx.BoxSizer` - where 0 stands for not changeable
|
||||
and a value of more than zero is interpreted relative to the value of other children of the same
|
||||
:class:`wx.BoxSizer`. For example, you might have a horizontal :class:`wx.BoxSizer` with three children, two
|
||||
of which are supposed to change their size with the sizer. Then the two stretchable windows would
|
||||
:param int proportion: this parameter is used in :class:`wx.BoxSizer` to indicate if a child of a sizer
|
||||
can change its size in the main orientation of the :class:`wx.BoxSizer` - where 0 stands for not changeable
|
||||
and a value of more than zero is interpreted relative to the value of other children of the same
|
||||
:class:`wx.BoxSizer`. For example, you might have a horizontal :class:`wx.BoxSizer` with three children, two
|
||||
of which are supposed to change their size with the sizer. Then the two stretchable windows would
|
||||
get a value of 1 each to make them grow and shrink equally with the sizer's horizontal dimension.
|
||||
:param int flag: OR-combination of flags affecting sizer's behaviour.
|
||||
:param int border: determines the border width, if the flag parameter is set to include any border flag.
|
||||
:param object userData: allows an extra object to be attached to the sizer item, for use in derived
|
||||
:param object userData: allows an extra object to be attached to the sizer item, for use in derived
|
||||
classes when sizing information is more complex than the proportion and flag will allow for.
|
||||
|
||||
|
||||
:rtype: :class:`wx.SizerItem`
|
||||
|
||||
|
||||
@@ -191,19 +191,19 @@ set to 0; we'll worry about them later.
|
||||
sizer.Add(wx.Button(self, -1, 'An extremely long button text'), 0, 0, 0)
|
||||
sizer.Add(wx.Button(self, -1, 'Small button'), 0, 0, 0)
|
||||
self.SetSizer(sizer)
|
||||
|
||||
|
||||
|
||||
You'll notice a couple of things about this:
|
||||
|
||||
* The buttons are just big enough to accommodate the text in them. In
|
||||
fact, any control placed into a sizer this way will appear at its
|
||||
minimum size unless we change the parameters.
|
||||
|
||||
|
||||
* The window size is not changed to fit the sizer. This results in a
|
||||
lot of ugly empty space.
|
||||
|
||||
|
||||
Let's worry about the second issue first. To make the window size more appropriate, we can set
|
||||
Let's worry about the second issue first. To make the window size more appropriate, we can set
|
||||
the size hints to tell the enclosing window to adjust to the size of the sizer:
|
||||
|
||||
.. figure:: _static/images/overviews/boxsizer2.png
|
||||
@@ -233,15 +233,15 @@ are in relation to each other. In a vertical sizer, this changes the
|
||||
height; in a horizontal sizer, this changes the width. Here are some
|
||||
examples:
|
||||
|
||||
.. list-table::
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 40 10
|
||||
:class: centertable
|
||||
|
||||
* - Code
|
||||
|
||||
|
||||
- Resulting Image
|
||||
|
||||
|
||||
* - .. code-block:: python
|
||||
:emphasize-lines: 3,4
|
||||
|
||||
@@ -273,22 +273,22 @@ examples:
|
||||
|
||||
- .. figure:: _static/images/overviews/boxsizer32.png
|
||||
:align: left
|
||||
|
||||
|
||||
|
||||
|
|
||||
|
||||
If one of the `proportion` parameters is 0, that :class:`wx.Window`
|
||||
will be the minimum size, and the others will resize proportionally:
|
||||
|
||||
.. list-table::
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 40 10
|
||||
:class: centertable
|
||||
|
||||
* - Code
|
||||
|
||||
|
||||
- Resulting Image
|
||||
|
||||
|
||||
* - .. code-block:: python
|
||||
:emphasize-lines: 4,5
|
||||
|
||||
@@ -303,7 +303,7 @@ will be the minimum size, and the others will resize proportionally:
|
||||
- .. figure:: _static/images/overviews/boxsizer33.png
|
||||
:align: left
|
||||
|
||||
* - Same code as above, with window resized. The top button (proportion 0) is still the minimum height,
|
||||
* - Same code as above, with window resized. The top button (proportion 0) is still the minimum height,
|
||||
and the third button is still twice the height of the second.
|
||||
|
||||
- .. figure:: _static/images/overviews/boxsizer34.png
|
||||
@@ -338,15 +338,15 @@ specific kind of sizer used.
|
||||
Let's start with the simplest case: the alignment flags. These are
|
||||
pretty self-explanatory.
|
||||
|
||||
.. list-table::
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 40 10
|
||||
:class: centertable
|
||||
|
||||
* - Code
|
||||
|
||||
|
||||
- Resulting Image
|
||||
|
||||
|
||||
* - .. code-block:: python
|
||||
:emphasize-lines: 4
|
||||
|
||||
@@ -380,15 +380,15 @@ pretty self-explanatory.
|
||||
|
||||
Next is the ``wx.EXPAND`` flag. This is synonymous with ``wx.GROW``.
|
||||
|
||||
.. list-table::
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 40 10
|
||||
:class: centertable
|
||||
|
||||
* - Code
|
||||
|
||||
|
||||
- Resulting Image
|
||||
|
||||
|
||||
* - .. code-block:: python
|
||||
:emphasize-lines: 4
|
||||
|
||||
@@ -405,24 +405,24 @@ Next is the ``wx.EXPAND`` flag. This is synonymous with ``wx.GROW``.
|
||||
|
||||
|
||||
|
||||
You can see that the first button takes its minimum size, and the second one grows to match it. This affects
|
||||
controls in the opposite manner of the second parameter; ``wx.EXPAND`` in a vertical sizer causes horizontal
|
||||
You can see that the first button takes its minimum size, and the second one grows to match it. This affects
|
||||
controls in the opposite manner of the second parameter; ``wx.EXPAND`` in a vertical sizer causes horizontal
|
||||
expansion, and in a horizontal sizer it causes vertical expansion.
|
||||
|
||||
Next is ``wx.SHAPED``. This flag ensures that the width and height of the object stay proportional to each other.
|
||||
It doesn't make much sense for buttons, but can be excellent for bitmaps, which would be contorted or clipped
|
||||
Next is ``wx.SHAPED``. This flag ensures that the width and height of the object stay proportional to each other.
|
||||
It doesn't make much sense for buttons, but can be excellent for bitmaps, which would be contorted or clipped
|
||||
if not scaled proportionally.
|
||||
|
||||
|
||||
.. list-table::
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 30 10
|
||||
:class: centertable
|
||||
|
||||
* - Code
|
||||
|
||||
|
||||
- Resulting Image
|
||||
|
||||
|
||||
* - .. code-block:: python
|
||||
:emphasize-lines: 4
|
||||
|
||||
@@ -452,15 +452,15 @@ control on which the border should appear. In order to demonstrate
|
||||
this most clearly, we'll keep the ``wx.EXPAND`` flag.
|
||||
|
||||
|
||||
.. list-table::
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 40 10
|
||||
:class: centertable
|
||||
|
||||
* - Code
|
||||
|
||||
|
||||
- Resulting Image
|
||||
|
||||
|
||||
* - .. code-block:: python
|
||||
:emphasize-lines: 4
|
||||
|
||||
@@ -470,11 +470,11 @@ this most clearly, we'll keep the ``wx.EXPAND`` flag.
|
||||
sizer.Add(wx.Button(self, -1, "Small Button"), 0, wx.EXPAND | wx.LEFT, 20)
|
||||
sizer.SetSizeHints(self)
|
||||
self.SetSizer(sizer)
|
||||
|
||||
|
||||
|
||||
|
||||
- .. figure:: _static/images/overviews/boxsizer53.png
|
||||
:align: left
|
||||
|
||||
|
||||
|
||||
* - .. code-block:: python
|
||||
:emphasize-lines: 4
|
||||
@@ -485,11 +485,11 @@ this most clearly, we'll keep the ``wx.EXPAND`` flag.
|
||||
sizer.Add(wx.Button(self, -1, "Small Button"), 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 20)
|
||||
sizer.SetSizeHints(self)
|
||||
self.SetSizer(sizer)
|
||||
|
||||
|
||||
|
||||
|
||||
- .. figure:: _static/images/overviews/boxsizer54.png
|
||||
:align: left
|
||||
|
||||
|
||||
|
||||
* - .. code-block:: python
|
||||
:emphasize-lines: 4
|
||||
@@ -500,8 +500,8 @@ this most clearly, we'll keep the ``wx.EXPAND`` flag.
|
||||
sizer.Add(wx.Button(self, -1, "Small Button"), 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 20)
|
||||
sizer.SetSizeHints(self)
|
||||
self.SetSizer(sizer)
|
||||
|
||||
|
||||
|
||||
|
||||
- .. figure:: _static/images/overviews/boxsizer55.png
|
||||
:align: left
|
||||
|
||||
@@ -514,8 +514,8 @@ this most clearly, we'll keep the ``wx.EXPAND`` flag.
|
||||
sizer.Add(wx.Button(self, -1, "Small Button"), 0, wx.EXPAND | wx.ALL, 20)
|
||||
sizer.SetSizeHints(self)
|
||||
self.SetSizer(sizer)
|
||||
|
||||
|
||||
|
||||
|
||||
- .. figure:: _static/images/overviews/boxsizer56.png
|
||||
:align: left
|
||||
|
||||
@@ -675,9 +675,9 @@ Example::
|
||||
# has a text ctrl at the top and two buttons at the bottom.
|
||||
|
||||
class MyDialog(wx.Dialog):
|
||||
|
||||
|
||||
def __init__(self, parent, id, title):
|
||||
|
||||
|
||||
wx.Dialog(parent, id, title, wx.DefaultPosition, wx.DefaultSize,
|
||||
wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
|
||||
|
||||
@@ -711,7 +711,7 @@ Example::
|
||||
self.SetSizerAndFit(topsizer) # use the sizer for layout and size window
|
||||
# accordingly and prevent it from being resized
|
||||
# to smaller size
|
||||
|
||||
|
||||
|
||||
|
||||
Note that the new way of specifying flags to :ref:`wx.Sizer` is via
|
||||
@@ -725,9 +725,9 @@ Here's how you'd do the previous example with :ref:`wx.SizerFlags`::
|
||||
# has a text ctrl at the top and two buttons at the bottom.
|
||||
|
||||
class MyDialog(wx.Dialog):
|
||||
|
||||
|
||||
def __init__(self, parent, id, title):
|
||||
|
||||
|
||||
wx.Dialog(parent, id, title, wx.DefaultPosition, wx.DefaultSize,
|
||||
wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
|
||||
|
||||
@@ -742,7 +742,7 @@ Here's how you'd do the previous example with :ref:`wx.SizerFlags`::
|
||||
button_sizer.Add(
|
||||
wx.Button(self, wx.ID_OK, "OK"),
|
||||
wx.SizerFlags(0).Align().Border(wx.ALL, 10))
|
||||
|
||||
|
||||
button_sizer.Add(
|
||||
wx.Button(self, wx.ID_CANCEL, "Cancel"),
|
||||
wx.SizerFlags(0).Align().Border(wx.ALL, 10))
|
||||
|
@@ -15,7 +15,7 @@ The style ``wx.SP_3D`` has been used to show a 3D border and 3D sash.
|
||||
|
||||
.. figure:: _static/images/overviews/overview_splitter_3d.png
|
||||
:align: center
|
||||
|
||||
|
||||
|
||||
|
||||
Example
|
||||
@@ -47,7 +47,7 @@ after creation::
|
||||
|
||||
if splitter.IsSplit():
|
||||
splitter.Unsplit()
|
||||
|
||||
|
||||
leftWindow.Show(True)
|
||||
rightWindow.Show(True)
|
||||
splitter.SplitVertically(leftWindow, rightWindow)
|
||||
@@ -57,7 +57,7 @@ after creation::
|
||||
|
||||
if splitter.IsSplit():
|
||||
splitter.Unsplit()
|
||||
|
||||
|
||||
leftWindow.Show(True)
|
||||
rightWindow.Show(True)
|
||||
splitter.SplitHorizontally(leftWindow, rightWindow)
|
||||
@@ -67,6 +67,6 @@ after creation::
|
||||
|
||||
if splitter.IsSplit():
|
||||
splitter.Unsplit()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -12,12 +12,12 @@ used in the following two situations:
|
||||
|
||||
- When creating a new window you may specify ``wx.ID_ANY`` to let
|
||||
wxPython assign an unused identifier to it automatically
|
||||
|
||||
|
||||
- When installing an event handler using :meth:`EvtHandler.Bind`, you
|
||||
may use it to indicate that you want to handle the events coming
|
||||
from any control, regardless of its identifier
|
||||
|
||||
|
||||
|
||||
|
||||
Another standard special identifier value is ``wx.ID_NONE``: this is a
|
||||
value which is not matched by any other id.
|
||||
|
||||
|
@@ -64,8 +64,8 @@ searches for translatable strings. The tips will thus get included
|
||||
into your generated .po file catalog and be translated at runtime
|
||||
along with the rest of your application's translatable strings.
|
||||
|
||||
.. note::
|
||||
|
||||
.. note::
|
||||
|
||||
Each line in the `tips.txt` file needs to strictly begin with
|
||||
exactly the 3 characters of underscore-parenthesis-doublequote, and
|
||||
end with doublequote-parenthesis, as shown above. Also, remember to
|
||||
|
@@ -68,7 +68,7 @@ remember is that the `cookie` passed to
|
||||
:meth:`wx.TreeCtrl.GetNextChild` should be the same variable (and that
|
||||
nothing should be done with it by the user code).
|
||||
|
||||
Among other features of the tree control are:
|
||||
Among other features of the tree control are:
|
||||
|
||||
* Item Sorting with :meth:`wx.TreeCtrl.SortChildren` which uses the
|
||||
user-defined comparison function `OnCompareItems` (by default the
|
||||
|
@@ -28,19 +28,19 @@ your own sub-class of :ref:`wx.Validator` (neither `TextValidator` nor
|
||||
then associated with your input field by calling::
|
||||
|
||||
myInputField.SetValidator(myValidator)
|
||||
|
||||
|
||||
|
||||
|
||||
.. note:: Your :ref:`wx.Validator` sub-class must implement the
|
||||
:meth:`wx.Validator.Clone` method.
|
||||
|
||||
|
||||
.. note::
|
||||
.. note::
|
||||
|
||||
Note that any :ref:`wx.Window` may have a validator; using the
|
||||
``WS_EX_VALIDATE_RECURSIVELY`` style (see :ref:`Window extended
|
||||
styles <window-extra-styles>`) you can also implement recursive
|
||||
validation.
|
||||
|
||||
|
||||
|
||||
|
||||
.. _anatomy of a validator:
|
||||
@@ -105,7 +105,7 @@ being shown.
|
||||
.. note:: If you are using a window or panel instead of a dialog, you
|
||||
will need to call :meth:`wx.Window.InitDialog` explicitly before
|
||||
showing the window.
|
||||
|
||||
|
||||
|
||||
When the user clicks on a button, for example the ``OK`` button, the
|
||||
application should first call :meth:`wx.Window.Validate`, which
|
||||
|
@@ -15,17 +15,17 @@ unimportant and is created automatically by calling
|
||||
:meth:`wx.Window.NewControlId` or by passing ``wx.ID_ANY`` as the ID of an
|
||||
object.
|
||||
|
||||
There are two ways to generate an ID. One way is to start at a negative number, and for each new ID, return the
|
||||
next smallest number. This is fine for systems that can use the full range of negative numbers for IDs, as
|
||||
this provides more than enough IDs and it would take a very very long time to run out and wrap around.
|
||||
There are two ways to generate an ID. One way is to start at a negative number, and for each new ID, return the
|
||||
next smallest number. This is fine for systems that can use the full range of negative numbers for IDs, as
|
||||
this provides more than enough IDs and it would take a very very long time to run out and wrap around.
|
||||
However, some systems cannot use the full range of the ID value. Windows, for example, can only use 16 bit
|
||||
IDs, and only has about 32000 possible automatic IDs that can be generated by :meth:`wx.Window.NewControlId`.
|
||||
IDs, and only has about 32000 possible automatic IDs that can be generated by :meth:`wx.Window.NewControlId`.
|
||||
If the program runs long enough, depending on the program itself, using this first method would cause the IDs
|
||||
to wrap around into the positive ID range and cause possible clashes with any directly specified ID values.
|
||||
|
||||
The other way is to keep track of the IDs returned by :meth:`wx.Window.NewControlId` and don't return them again
|
||||
until the ID is completely free and not being used by any other objects. This will make sure that the ID values
|
||||
do not clash with one another. This is accomplished by keeping a reference count for each of the IDs that can
|
||||
until the ID is completely free and not being used by any other objects. This will make sure that the ID values
|
||||
do not clash with one another. This is accomplished by keeping a reference count for each of the IDs that can
|
||||
possibly be returned by :meth:`wx.Window.NewControlId`. Other IDs are not reference counted.
|
||||
|
||||
|
||||
|
@@ -17,8 +17,8 @@ The symbols are defined in such a way that they can be combined in a
|
||||
For example::
|
||||
|
||||
style = wx.CAPTION | wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER
|
||||
|
||||
|
||||
|
||||
|
||||
For the window styles specific to each window class, please see the
|
||||
documentation for the window.
|
||||
|
||||
|
@@ -19,7 +19,7 @@ many identical, only differently encoded, packages with your application
|
||||
this mechanism you can, for example, distribute only iso8859-13 data and it
|
||||
will be handled transparently under all systems.
|
||||
|
||||
Please read the :ref:`Internationalization <internationalization>` page which
|
||||
Please read the :ref:`Internationalization <internationalization>` page which
|
||||
describes the locales concept.
|
||||
|
||||
.. todo:: to be written (do we want to write it?!?!)
|
||||
|
@@ -1,22 +1,22 @@
|
||||
========================================= ======================================== ==================================
|
||||
- ``wx.ART_ERROR`` - ``wx.ART_GOTO_LAST`` (since 2.9.2) - ``wx.ART_FILE_SAVE_AS``
|
||||
- ``wx.ART_QUESTION`` - ``wx.ART_PRINT`` - ``wx.ART_DELETE``
|
||||
- ``wx.ART_WARNING`` - ``wx.ART_HELP`` - ``wx.ART_COPY``
|
||||
- ``wx.ART_INFORMATION`` - ``wx.ART_TIP`` - ``wx.ART_CUT``
|
||||
- ``wx.ART_ADD_BOOKMARK`` - ``wx.ART_REPORT_VIEW`` - ``wx.ART_PASTE``
|
||||
- ``wx.ART_DEL_BOOKMARK`` - ``wx.ART_LIST_VIEW`` - ``wx.ART_UNDO``
|
||||
- ``wx.ART_HELP_SIDE_PANEL`` - ``wx.ART_NEW_DIR`` - ``wx.ART_REDO``
|
||||
- ``wx.ART_HELP_SETTINGS`` - ``wx.ART_FOLDER`` - ``wx.ART_PLUS`` (since 2.9.2)
|
||||
- ``wx.ART_HELP_BOOK`` - ``wx.ART_FOLDER_OPEN`` - ``wx.ART_MINUS`` (since 2.9.2)
|
||||
- ``wx.ART_HELP_FOLDER`` - ``wx.ART_GO_DIR_UP`` - ``wx.ART_CLOSE``
|
||||
- ``wx.ART_HELP_PAGE`` - ``wx.ART_EXECUTABLE_FILE`` - ``wx.ART_QUIT``
|
||||
- ``wx.ART_GO_BACK`` - ``wx.ART_NORMAL_FILE`` - ``wx.ART_FIND``
|
||||
- ``wx.ART_GO_FORWARD`` - ``wx.ART_TICK_MARK`` - ``wx.ART_FIND_AND_REPLACE``
|
||||
- ``wx.ART_GO_UP`` - ``wx.ART_CROSS_MARK`` - ``wx.ART_HARDDISK``
|
||||
- ``wx.ART_GO_DOWN`` - ``wx.ART_MISSING_IMAGE`` - ``wx.ART_FLOPPY``
|
||||
- ``wx.ART_GO_TO_PARENT`` - ``wx.ART_NEW`` - ``wx.ART_CDROM``
|
||||
- ``wx.ART_GO_HOME`` - ``wx.ART_FILE_OPEN``
|
||||
- ``wx.ART_GOTO_FIRST`` (since 2.9.2) - ``wx.ART_FILE_SAVE``
|
||||
- ``wx.ART_QUESTION`` - ``wx.ART_PRINT`` - ``wx.ART_DELETE``
|
||||
- ``wx.ART_WARNING`` - ``wx.ART_HELP`` - ``wx.ART_COPY``
|
||||
- ``wx.ART_INFORMATION`` - ``wx.ART_TIP`` - ``wx.ART_CUT``
|
||||
- ``wx.ART_ADD_BOOKMARK`` - ``wx.ART_REPORT_VIEW`` - ``wx.ART_PASTE``
|
||||
- ``wx.ART_DEL_BOOKMARK`` - ``wx.ART_LIST_VIEW`` - ``wx.ART_UNDO``
|
||||
- ``wx.ART_HELP_SIDE_PANEL`` - ``wx.ART_NEW_DIR`` - ``wx.ART_REDO``
|
||||
- ``wx.ART_HELP_SETTINGS`` - ``wx.ART_FOLDER`` - ``wx.ART_PLUS`` (since 2.9.2)
|
||||
- ``wx.ART_HELP_BOOK`` - ``wx.ART_FOLDER_OPEN`` - ``wx.ART_MINUS`` (since 2.9.2)
|
||||
- ``wx.ART_HELP_FOLDER`` - ``wx.ART_GO_DIR_UP`` - ``wx.ART_CLOSE``
|
||||
- ``wx.ART_HELP_PAGE`` - ``wx.ART_EXECUTABLE_FILE`` - ``wx.ART_QUIT``
|
||||
- ``wx.ART_GO_BACK`` - ``wx.ART_NORMAL_FILE`` - ``wx.ART_FIND``
|
||||
- ``wx.ART_GO_FORWARD`` - ``wx.ART_TICK_MARK`` - ``wx.ART_FIND_AND_REPLACE``
|
||||
- ``wx.ART_GO_UP`` - ``wx.ART_CROSS_MARK`` - ``wx.ART_HARDDISK``
|
||||
- ``wx.ART_GO_DOWN`` - ``wx.ART_MISSING_IMAGE`` - ``wx.ART_FLOPPY``
|
||||
- ``wx.ART_GO_TO_PARENT`` - ``wx.ART_NEW`` - ``wx.ART_CDROM``
|
||||
- ``wx.ART_GO_HOME`` - ``wx.ART_FILE_OPEN``
|
||||
- ``wx.ART_GOTO_FIRST`` (since 2.9.2) - ``wx.ART_FILE_SAVE``
|
||||
========================================= ======================================== ==================================
|
||||
|
||||
|
|
||||
|
@@ -1,18 +1,18 @@
|
||||
======================================= ==============================================================================================================================================================================================================================================================================
|
||||
`GetFirstVisibleLine()` Deprecated for :meth:`~wx.VarVScrollHelper.GetVisibleRowsBegin`
|
||||
`GetLastVisibleLine()` Deprecated for :meth:`~wx.VarVScrollHelper.GetVisibleRowsEnd` This function originally had a slight design flaw in that it was possible to return ``sys.maxint-1`` (ie: a large positive number) if the scroll position was 0 and the first line wasn't completely visible.
|
||||
`GetLineCount()` Deprecated for :meth:`~wx.VarVScrollHelper.GetRowCount`
|
||||
======================================= ==============================================================================================================================================================================================================================================================================
|
||||
`GetFirstVisibleLine()` Deprecated for :meth:`~wx.VarVScrollHelper.GetVisibleRowsBegin`
|
||||
`GetLastVisibleLine()` Deprecated for :meth:`~wx.VarVScrollHelper.GetVisibleRowsEnd` This function originally had a slight design flaw in that it was possible to return ``sys.maxint-1`` (ie: a large positive number) if the scroll position was 0 and the first line wasn't completely visible.
|
||||
`GetLineCount()` Deprecated for :meth:`~wx.VarVScrollHelper.GetRowCount`
|
||||
`HitTest(x, y)`
|
||||
`HitTest(pt)` Deprecated for :meth:`~wx.VarScrollHelperBase.VirtualHitTest`.
|
||||
`OnGetLineHeight(line)` Deprecated for :meth:`~wx.VarVScrollHelper.OnGetRowHeight`
|
||||
`OnGetLinesHint(lineMin, lineMax)` Deprecated for :meth:`~wx.VarVScrollHelper.OnGetRowsHeightHint`
|
||||
`RefreshLine(line)` Deprecated for :meth:`~wx.VarVScrollHelper.RefreshRow`
|
||||
`RefreshLines(from_, to_)` Deprecated for :meth:`~wx.VarVScrollHelper.RefreshRows`
|
||||
`ScrollLines(lines)` Deprecated for :meth:`~wx.VarVScrollHelper.ScrollRows`
|
||||
`ScrollPages(pages)` Deprecated for :meth:`~wx.VarVScrollHelper.ScrollRowPages`
|
||||
`ScrollToLine(line)` Deprecated for :meth:`~wx.VarVScrollHelper.ScrollToRow`
|
||||
`SetLineCount(count)` Deprecated for :meth:`~wx.VarVScrollHelper.SetRowCount`
|
||||
======================================= ==============================================================================================================================================================================================================================================================================
|
||||
`HitTest(pt)` Deprecated for :meth:`~wx.VarScrollHelperBase.VirtualHitTest`.
|
||||
`OnGetLineHeight(line)` Deprecated for :meth:`~wx.VarVScrollHelper.OnGetRowHeight`
|
||||
`OnGetLinesHint(lineMin, lineMax)` Deprecated for :meth:`~wx.VarVScrollHelper.OnGetRowsHeightHint`
|
||||
`RefreshLine(line)` Deprecated for :meth:`~wx.VarVScrollHelper.RefreshRow`
|
||||
`RefreshLines(from_, to_)` Deprecated for :meth:`~wx.VarVScrollHelper.RefreshRows`
|
||||
`ScrollLines(lines)` Deprecated for :meth:`~wx.VarVScrollHelper.ScrollRows`
|
||||
`ScrollPages(pages)` Deprecated for :meth:`~wx.VarVScrollHelper.ScrollRowPages`
|
||||
`ScrollToLine(line)` Deprecated for :meth:`~wx.VarVScrollHelper.ScrollToRow`
|
||||
`SetLineCount(count)` Deprecated for :meth:`~wx.VarVScrollHelper.SetRowCount`
|
||||
======================================= ==============================================================================================================================================================================================================================================================================
|
||||
|
||||
|
|
||||
|
||||
|
Reference in New Issue
Block a user