Set the svn:eol-style property to native for the newer files

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73188 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2012-12-14 08:58:31 +00:00
parent 32b174134b
commit 28dff8e00b
48 changed files with 502 additions and 502 deletions

View File

@@ -1,65 +1,65 @@
.. include:: headings.inc
.. _command overview:
=================================================
|phoenix_title| **Command Overview**
=================================================
:class:`Command` is a base class for modelling an application command, which is an action usually
performed by selecting a menu item, pressing a toolbar button or any other means provided by
the application to change the data or view.
Instead of the application functionality being scattered around if statements and functions in
a way that may be hard to read and maintain, the functionality for a command is explicitly represented
as an object which can be manipulated by a framework or application.
When a user interface event occurs, the application submits a command to a :class:`CommandProcessor`
object to execute and store.
The wxPython document/view framework handles Undo and Redo by use of :class:`Command` and :class:`CommandProcessor`
objects. You might find further uses for :class:`Command`, such as implementing a macro facility that
stores, loads and replays commands.
An application can derive a new class for every command, or, more likely, use one class parameterized
with an integer or string command identifier.
.. _commandprocessor overview:
=================================================
|phoenix_title| **CommandProcessor Overview**
=================================================
:class:`CommandProcessor` is a class that maintains a history of :class:`Command` instances, with
undo/redo functionality built-in. Derive a new class from this if you want different behaviour.
.. _filehistory overview:
=================================================
|phoenix_title| **FileHistory Overview**
=================================================
:class:`FileHistory` encapsulates functionality to record the last few files visited, and to allow
the user to quickly load these files using the list appended to the File menu. Although :class:`FileHistory`
is used by :class:`DocManager`, it can be used independently. You may wish to derive from it to allow
different behaviour, such as popping up a scrolling list of files.
By calling :meth:`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::
Please notice that currently if the history already contained filenames when UseMenu() is called (e.g. when
initializing a second MDI child frame), the menu is not automatically initialized with the existing filenames
in the history and so you need to call :meth:`FileHistory.AddFilesToMenu` after UseMenu() explicitly in order
to initialize the menu with the existing list of MRU files (otherwise an assertion failure is raised in debug builds).
The filenames are appended using menu identifiers in the range ``ID_FILE1`` to ``ID_FILE9``.
.. include:: headings.inc
.. _command overview:
=================================================
|phoenix_title| **Command Overview**
=================================================
:class:`Command` is a base class for modelling an application command, which is an action usually
performed by selecting a menu item, pressing a toolbar button or any other means provided by
the application to change the data or view.
Instead of the application functionality being scattered around if statements and functions in
a way that may be hard to read and maintain, the functionality for a command is explicitly represented
as an object which can be manipulated by a framework or application.
When a user interface event occurs, the application submits a command to a :class:`CommandProcessor`
object to execute and store.
The wxPython document/view framework handles Undo and Redo by use of :class:`Command` and :class:`CommandProcessor`
objects. You might find further uses for :class:`Command`, such as implementing a macro facility that
stores, loads and replays commands.
An application can derive a new class for every command, or, more likely, use one class parameterized
with an integer or string command identifier.
.. _commandprocessor overview:
=================================================
|phoenix_title| **CommandProcessor Overview**
=================================================
:class:`CommandProcessor` is a class that maintains a history of :class:`Command` instances, with
undo/redo functionality built-in. Derive a new class from this if you want different behaviour.
.. _filehistory overview:
=================================================
|phoenix_title| **FileHistory Overview**
=================================================
:class:`FileHistory` encapsulates functionality to record the last few files visited, and to allow
the user to quickly load these files using the list appended to the File menu. Although :class:`FileHistory`
is used by :class:`DocManager`, it can be used independently. You may wish to derive from it to allow
different behaviour, such as popping up a scrolling list of files.
By calling :meth:`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::
Please notice that currently if the history already contained filenames when UseMenu() is called (e.g. when
initializing a second MDI child frame), the menu is not automatically initialized with the existing filenames
in the history and so you need to call :meth:`FileHistory.AddFilesToMenu` after UseMenu() explicitly in order
to initialize the menu with the existing list of MRU files (otherwise an assertion failure is raised in debug builds).
The filenames are appended using menu identifiers in the range ``ID_FILE1`` to ``ID_FILE9``.

View File

@@ -1,49 +1,49 @@
.. include:: headings.inc
.. _dataobject overview:
=================================================
|phoenix_title| **DataObject Overview**
=================================================
This overview discusses data transfer through clipboard or drag and drop. In wxPython, these two ways to transfer
data (either between different applications or inside one and the same) are very similar which allows to implement
both of them using almost the same code - or, in other words, if you implement drag and drop support for your
application, you get clipboard support for free and vice versa.
At the heart of both clipboard and drag and drop operations lies the :class:`DataObject` class. The objects of this
class (or, to be precise, classes derived from it) represent the data which is being carried by the mouse during
drag and drop operation or copied to or pasted from the clipboard. :class:`DataObject` is a "smart" piece of data
because it knows which formats it supports (see `GetFormatCount` and `GetAllFormats`) and knows how to render itself
in any of them (see `GetDataHere`). It can also receive its value from the outside in a format it supports if it
implements the `SetData` method. Please see the documentation of this class for more details.
Both clipboard and drag and drop operations have two sides: the source and target, the data provider and the data
receiver. These which may be in the same application and even the same window when, for example, you drag some text
from one position to another in a word processor. Let us describe what each of them should do.
The data provider (source) duties
---------------------------------
The data provider is responsible for creating a :class:`DataObject` containing the data to be transferred. Then it
should either pass it to the clipboard using :meth:`Clipboard.SetData` function or to :class:`DropSource` and call
:meth:`DropSource.DoDragDrop` function.
A small difference is that in the case of clipboard operation, the application usually knows in advance whether it
copies or cuts (i.e. copies and deletes) data - in fact, this usually depends on which menu item the user chose.
But for drag and drop it can only know it after :meth:`DropSource.DoDragDrop` returns (from its return value).
The data receiver (target) duties
---------------------------------
To receive (paste in usual terminology) data from the clipboard, you should create a :class:`DataObject` derived
class which supports the data formats you need and pass it as argument to :meth:`Clipboard.GetData`. If it returns
``False``, no data in (any of) the supported format(s) is available. If it returns ``True``, the data has been
successfully transferred to :class:`DataObject`.
For drag and drop case, the :meth:`DropTarget.OnData` virtual function will be called when a data object is dropped,
from which the data itself may be requested by calling :meth:`DropTarget.GetData` method which fills the data object.
.. include:: headings.inc
.. _dataobject overview:
=================================================
|phoenix_title| **DataObject Overview**
=================================================
This overview discusses data transfer through clipboard or drag and drop. In wxPython, these two ways to transfer
data (either between different applications or inside one and the same) are very similar which allows to implement
both of them using almost the same code - or, in other words, if you implement drag and drop support for your
application, you get clipboard support for free and vice versa.
At the heart of both clipboard and drag and drop operations lies the :class:`DataObject` class. The objects of this
class (or, to be precise, classes derived from it) represent the data which is being carried by the mouse during
drag and drop operation or copied to or pasted from the clipboard. :class:`DataObject` is a "smart" piece of data
because it knows which formats it supports (see `GetFormatCount` and `GetAllFormats`) and knows how to render itself
in any of them (see `GetDataHere`). It can also receive its value from the outside in a format it supports if it
implements the `SetData` method. Please see the documentation of this class for more details.
Both clipboard and drag and drop operations have two sides: the source and target, the data provider and the data
receiver. These which may be in the same application and even the same window when, for example, you drag some text
from one position to another in a word processor. Let us describe what each of them should do.
The data provider (source) duties
---------------------------------
The data provider is responsible for creating a :class:`DataObject` containing the data to be transferred. Then it
should either pass it to the clipboard using :meth:`Clipboard.SetData` function or to :class:`DropSource` and call
:meth:`DropSource.DoDragDrop` function.
A small difference is that in the case of clipboard operation, the application usually knows in advance whether it
copies or cuts (i.e. copies and deletes) data - in fact, this usually depends on which menu item the user chose.
But for drag and drop it can only know it after :meth:`DropSource.DoDragDrop` returns (from its return value).
The data receiver (target) duties
---------------------------------
To receive (paste in usual terminology) data from the clipboard, you should create a :class:`DataObject` derived
class which supports the data formats you need and pass it as argument to :meth:`Clipboard.GetData`. If it returns
``False``, no data in (any of) the supported format(s) is available. If it returns ``True``, the data has been
successfully transferred to :class:`DataObject`.
For drag and drop case, the :meth:`DropTarget.OnData` virtual function will be called when a data object is dropped,
from which the data itself may be requested by calling :meth:`DropTarget.GetData` method which fills the data object.

View File

@@ -1,55 +1,55 @@
.. include:: headings.inc
.. _tipprovider overview:
==========================================
|phoenix_title| **TipProvider Overview**
==========================================
Many "modern" Windows programs have a feature (some would say annoyance) of presenting the user tips at program startup.
While this is probably useless to the advanced users of the program, the experience shows that the tips may be
quite helpful for the novices and so more and more programs now do this. For a wxPython programmer, implementing this
feature is extremely easy. To show a tip, it is enough to just call :func:`ShowTip` function like this::
if showTipsAtStartup:
tipProvider = wx.CreateFileTipProvider("tips.txt", 0)
wx.ShowTip(windowParent, tipProvider)
del tipProvider
Of course, you need to get the text of the tips from somewhere - in the example above, the text is supposed to be in the
file `tips.txt` from where it is read by the tip provider. The tip provider is just an object of a class deriving from :class:`~adv.TipProvider`.
It has to implement one pure virtual function of the base class, `GetTip`. In the case of the tip provider created by
:func:`CreateFileTipProvider`, the tips are just the lines of the text file.
If you want to implement your own tip provider (for example, if you wish to hardcode the tips inside your program), you
just have to derive another class from :class:`~adv.TipProvider` and pass a pointer to the object of this class to func:`ShowTip` - then
you don't need :func:`CreateFileTipProvider` at all.
You will probably want to save somewhere the index of the tip last shown - so that the program doesn't always show the same
tip on startup. As you also need to remember whether to show tips or not (you shouldn't do it if the user unchecked
"Show tips on startup" checkbox in the dialog), you will probably want to store both the index of the last shown tip
(as returned by :meth:`~adv.TipProvider.GetCurrentTip` and the flag telling whether to show the tips at startup at all.
In a `tips.txt` file, lines that begin with a ``#`` character are considered comments and are automatically skipped. Blank
lines and lines only having spaces are also skipped.
You can easily add runtime-translation capacity by placing each line of the `tips.txt` file inside the usual translation
function. For example, your `tips.txt` file would look like this::
_("This is my first tip")
_("This is my second tip")
Now add your `tips.txt` file into the list of files that gettext 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::
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 escape any doublequote characters within the tip
string with a backslash-doublequote.
.. include:: headings.inc
.. _tipprovider overview:
==========================================
|phoenix_title| **TipProvider Overview**
==========================================
Many "modern" Windows programs have a feature (some would say annoyance) of presenting the user tips at program startup.
While this is probably useless to the advanced users of the program, the experience shows that the tips may be
quite helpful for the novices and so more and more programs now do this. For a wxPython programmer, implementing this
feature is extremely easy. To show a tip, it is enough to just call :func:`ShowTip` function like this::
if showTipsAtStartup:
tipProvider = wx.CreateFileTipProvider("tips.txt", 0)
wx.ShowTip(windowParent, tipProvider)
del tipProvider
Of course, you need to get the text of the tips from somewhere - in the example above, the text is supposed to be in the
file `tips.txt` from where it is read by the tip provider. The tip provider is just an object of a class deriving from :class:`~adv.TipProvider`.
It has to implement one pure virtual function of the base class, `GetTip`. In the case of the tip provider created by
:func:`CreateFileTipProvider`, the tips are just the lines of the text file.
If you want to implement your own tip provider (for example, if you wish to hardcode the tips inside your program), you
just have to derive another class from :class:`~adv.TipProvider` and pass a pointer to the object of this class to func:`ShowTip` - then
you don't need :func:`CreateFileTipProvider` at all.
You will probably want to save somewhere the index of the tip last shown - so that the program doesn't always show the same
tip on startup. As you also need to remember whether to show tips or not (you shouldn't do it if the user unchecked
"Show tips on startup" checkbox in the dialog), you will probably want to store both the index of the last shown tip
(as returned by :meth:`~adv.TipProvider.GetCurrentTip` and the flag telling whether to show the tips at startup at all.
In a `tips.txt` file, lines that begin with a ``#`` character are considered comments and are automatically skipped. Blank
lines and lines only having spaces are also skipped.
You can easily add runtime-translation capacity by placing each line of the `tips.txt` file inside the usual translation
function. For example, your `tips.txt` file would look like this::
_("This is my first tip")
_("This is my second tip")
Now add your `tips.txt` file into the list of files that gettext 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::
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 escape any doublequote characters within the tip
string with a backslash-doublequote.

View File

@@ -1,2 +1,2 @@
setlocale(LC_ALL, "")
setlocale(LC_ALL, "")

View File

@@ -1,2 +1,2 @@
wx.Image.AddHandler(wx.PNGHandler)
wx.Image.AddHandler(wx.PNGHandler)

View File

@@ -1,9 +1,9 @@
# Create a control for post code entry.
postcode = wx.TextCtrl(self, -1, "")
# And set its initial and minimal size to be big enough for
# entering 5 digits.
postcode.SetInitialSize(
postcode.GetSizeFromTextSize(
postcode.GetTextExtent("99999")))
# Create a control for post code entry.
postcode = wx.TextCtrl(self, -1, "")
# And set its initial and minimal size to be big enough for
# entering 5 digits.
postcode.SetInitialSize(
postcode.GetSizeFromTextSize(
postcode.GetTextExtent("99999")))

View File

@@ -1,9 +1,9 @@
# Create a control for post code entry.
postcode = wx.TextCtrl(self, -1, "")
# And set its initial and minimal size to be big enough for
# entering 5 digits.
postcode.SetInitialSize(
postcode.GetSizeFromTextSize(
postcode.GetTextExtent("99999")))
# Create a control for post code entry.
postcode = wx.TextCtrl(self, -1, "")
# And set its initial and minimal size to be big enough for
# entering 5 digits.
postcode.SetInitialSize(
postcode.GetSizeFromTextSize(
postcode.GetTextExtent("99999")))

View File

@@ -1,13 +1,13 @@
def ColumnItems(self):
menu = wx.Menu()
menu.Append(100, "Some custom command")
menu.AppendSeparator()
self.AddColumnsItems(menu, 200)
rc = self.GetPopupMenuSelectionFromUser(menu, pt)
if rc >= 200:
# ... toggle visibility of the column rc-200 ...
ToggleVisibility()
def ColumnItems(self):
menu = wx.Menu()
menu.Append(100, "Some custom command")
menu.AppendSeparator()
self.AddColumnsItems(menu, 200)
rc = self.GetPopupMenuSelectionFromUser(menu, pt)
if rc >= 200:
# ... toggle visibility of the column rc-200 ...
ToggleVisibility()

View File

@@ -1,2 +1,2 @@
wx.HD_DEFAULT_STYLE & ~wx.HD_ALLOW_REORDER
wx.HD_DEFAULT_STYLE & ~wx.HD_ALLOW_REORDER

View File

@@ -1,40 +1,40 @@
class MyHeaderColumn(wx.HeaderColumn):
def __init__(self):
wx.HeaderColumn.__init__(self)
def SetWidth(self, width):
self.width = width
def GetWidth(self):
return self.width
class MyHeaderCtrl(wx.HeaderCtrl):
def __init__(self, parent):
wx.HeaderCtrl.__init__(self, parent)
self.cols = []
def GetColumn(idx):
return self.cols[idx]
def UpdateColumnWidthToFit(self, idx, widthTitle):
# ... compute minimal width for column idx ...
widthContents = self.CalculateMinWidth(idx)
self.cols[idx].SetWidth(max(widthContents, widthTitle))
return True
class MyHeaderColumn(wx.HeaderColumn):
def __init__(self):
wx.HeaderColumn.__init__(self)
def SetWidth(self, width):
self.width = width
def GetWidth(self):
return self.width
class MyHeaderCtrl(wx.HeaderCtrl):
def __init__(self, parent):
wx.HeaderCtrl.__init__(self, parent)
self.cols = []
def GetColumn(idx):
return self.cols[idx]
def UpdateColumnWidthToFit(self, idx, widthTitle):
# ... compute minimal width for column idx ...
widthContents = self.CalculateMinWidth(idx)
self.cols[idx].SetWidth(max(widthContents, widthTitle))
return True

View File

@@ -1,2 +1,2 @@
self.ShowColumn(idx, False)
self.ShowColumn(idx, False)

View File

@@ -1,19 +1,19 @@
items = ["meat", "fish", "fruits", "beer"]
order = [3, 0, 1, 2]
dlg = wx.RearrangeDialog(None,
"You can also uncheck the items you don't like "
"at all.",
"Sort the items in order of preference",
order, items)
if dlg.ShowModal() == wx.ID_OK:
order = dlg.GetOrder()
for n in order:
if n >= 0:
wx.LogMessage("Your most preferred item is \"%s\""%n)
break
items = ["meat", "fish", "fruits", "beer"]
order = [3, 0, 1, 2]
dlg = wx.RearrangeDialog(None,
"You can also uncheck the items you don't like "
"at all.",
"Sort the items in order of preference",
order, items)
if dlg.ShowModal() == wx.ID_OK:
order = dlg.GetOrder()
for n in order:
if n >= 0:
wx.LogMessage("Your most preferred item is \"%s\""%n)
break

View File

@@ -1,19 +1,19 @@
class MyRearrangeDialog(wx.RearrangeDialog):
def __init__(self, parent):
wx.RearrangeDialog.__init__(self, parent)
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(wx.StaticText(panel, wx.ID_ANY,
"Column width in pixels:"))
sizer.Add(wx.TextCtrl(panel, wx.ID_ANY, ""))
panel.SetSizer(sizer)
self.AddExtraControls(panel)
# ... code to update the text control with the currently selected
# item width and to react to its changes omitted ...
class MyRearrangeDialog(wx.RearrangeDialog):
def __init__(self, parent):
wx.RearrangeDialog.__init__(self, parent)
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(wx.StaticText(panel, wx.ID_ANY,
"Column width in pixels:"))
sizer.Add(wx.TextCtrl(panel, wx.ID_ANY, ""))
panel.SetSizer(sizer)
self.AddExtraControls(panel)
# ... code to update the text control with the currently selected
# item width and to react to its changes omitted ...

View File

@@ -1,2 +1,2 @@
order = [0] # checked item #0
order = [0] # checked item #0

View File

@@ -1,13 +1,13 @@
def ShowDialog(self):
if dont_show:
return
dlg = wx.RichMessageDialog(self, "Welcome to my wonderful program!")
dlg.ShowCheckBox("Don't show welcome dialog again")
dlg.ShowModal() # return value ignored as we have "Ok" only anyhow
if dlg.IsCheckBoxChecked():
# ... make sure we won't show it again the next time ...
dont_show = True
def ShowDialog(self):
if dont_show:
return
dlg = wx.RichMessageDialog(self, "Welcome to my wonderful program!")
dlg.ShowCheckBox("Don't show welcome dialog again")
dlg.ShowModal() # return value ignored as we have "Ok" only anyhow
if dlg.IsCheckBoxChecked():
# ... make sure we won't show it again the next time ...
dont_show = True

View File

@@ -1,6 +1,6 @@
# Some integer...
l = value
return wx.SpinCtrl(parent, wx.ID_ANY, "",
labelRect.GetTopLeft(), labelRect.GetSize(), 0, 0, 100, l)
# Some integer...
l = value
return wx.SpinCtrl(parent, wx.ID_ANY, "",
labelRect.GetTopLeft(), labelRect.GetSize(), 0, 0, 100, l)

View File

@@ -1,6 +1,6 @@
# sc is a wx.SpinCtrl
l = sc.GetValue()
value = l
return True
# sc is a wx.SpinCtrl
l = sc.GetValue()
value = l
return True

View File

@@ -1,11 +1,11 @@
listctrl = wx.dataview.DataViewListCtrl(parent, wx.ID_ANY)
listctrl.AppendToggleColumn("Toggle")
listctrl.AppendTextColumn("Text")
data = [True, "row 1"]
listctrl.AppendItem(data)
data = [False, "row 3"]
listctrl.AppendItem(data)
listctrl = wx.dataview.DataViewListCtrl(parent, wx.ID_ANY)
listctrl.AppendToggleColumn("Toggle")
listctrl.AppendTextColumn("Text")
data = [True, "row 1"]
listctrl.AppendItem(data)
data = [False, "row 3"]
listctrl.AppendItem(data)

View File

@@ -1,4 +1,4 @@
ret_value, kp = container.AdjustPagebreak(p, kp, ph)
while ret_value:
ret_value, kp = container.AdjustPagebreak(p, kp, ph)
ret_value, kp = container.AdjustPagebreak(p, kp, ph)
while ret_value:
ret_value, kp = container.AdjustPagebreak(p, kp, ph)

View File

@@ -1,3 +1,3 @@
dc.DrawText("hello", x + cell.PosX, y + cell.PosY)
dc.DrawText("hello", x + cell.PosX, y + cell.PosY)

View File

@@ -1,3 +1,3 @@
dc.DrawText("hello", x + cell.PosX, y + cell.PosY)
dc.DrawText("hello", x + cell.PosX, y + cell.PosY)

View File

@@ -1,2 +1,2 @@
SetWidthFloat(-50, wx.html.HTML_UNITS_PIXELS)
SetWidthFloat(-50, wx.html.HTML_UNITS_PIXELS)

View File

@@ -1,2 +1,2 @@
SetWidthFloat(-50, wx.html.HTML_UNITS_PIXELS)
SetWidthFloat(-50, wx.html.HTML_UNITS_PIXELS)

View File

@@ -1,7 +1,7 @@
def CanRead(file):
# file is a wx.FSFile in this case...
return (file.GetMimeType() == "application/x-ugh")
def CanRead(file):
# file is a wx.FSFile in this case...
return (file.GetMimeType() == "application/x-ugh")

View File

@@ -1,6 +1,6 @@
def ReadFile(file):
# file is a wx.FSFile in this case...
return "<html><body><img src=\"" + file.GetLocation() + \
"\"></body></html>"
def ReadFile(file):
# file is a wx.FSFile in this case...
return "<html><body><img src=\"" + file.GetLocation() + \
"\"></body></html>"

View File

@@ -1,2 +1,2 @@
AddBook("help.zip")
AddBook("help.zip")

View File

@@ -1,2 +1,2 @@
AddBook("help.zip")
AddBook("help.zip")

View File

@@ -1,12 +1,12 @@
def EmbedHTML(self):
# self.embeddedHelpWindow is a wx.html.HtmlHelpWindow
# self.embeddedHtmlHelp is a wx.html.HtmlHelpController
# Create embedded HTML Help window
self.embeddedHelpWindow = wx.html.HtmlHelpWindow
self.embeddedHtmlHelp.UseConfig(config, rootPath) # Set your own config object here
self.embeddedHtmlHelp.SetHelpWindow(self.embeddedHelpWindow)
self.embeddedHelpWindow.Create(self, wx.ID_ANY, wx.DefaultPosition, self.GetClientSize(),
wx.TAB_TRAVERSAL | wx.BORDER_NONE, wx.html.HF_DEFAULT_STYLE)
self.embeddedHtmlHelp.AddBook("doc.zip")
def EmbedHTML(self):
# self.embeddedHelpWindow is a wx.html.HtmlHelpWindow
# self.embeddedHtmlHelp is a wx.html.HtmlHelpController
# Create embedded HTML Help window
self.embeddedHelpWindow = wx.html.HtmlHelpWindow
self.embeddedHtmlHelp.UseConfig(config, rootPath) # Set your own config object here
self.embeddedHtmlHelp.SetHelpWindow(self.embeddedHelpWindow)
self.embeddedHelpWindow.Create(self, wx.ID_ANY, wx.DefaultPosition, self.GetClientSize(),
wx.TAB_TRAVERSAL | wx.BORDER_NONE, wx.html.HF_DEFAULT_STYLE)
self.embeddedHtmlHelp.AddBook("doc.zip")

View File

@@ -1,4 +1,4 @@
# The help can be browsed during the lifetime of self object when the
# user quits the help, program execution will continue.
help = wx.html.HtmlModalHelp(parent, "help", "My topic")
# The help can be browsed during the lifetime of self object when the
# user quits the help, program execution will continue.
help = wx.html.HtmlModalHelp(parent, "help", "My topic")

View File

@@ -1,2 +1,2 @@
f = self.Parser.GetFS().OpenFile("image.jpg")
f = self.Parser.GetFS().OpenFile("image.jpg")

View File

@@ -1,10 +1,10 @@
# .. code-block:: xml
<myitems>
<param name="one" value="1">
<param name="two" value="2">
</myitems>
<execute>
<param program="text.exe">
</execute>
# .. code-block:: xml
<myitems>
<param name="one" value="1">
<param name="two" value="2">
</myitems>
<execute>
<param program="text.exe">
</execute>

View File

@@ -1,4 +1,4 @@
# .. code-block:: text
bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
# .. code-block:: text
bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
|

View File

@@ -1,4 +1,4 @@
# .. code-block:: text
bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
# .. code-block:: text
bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
|

View File

@@ -1,4 +1,4 @@
# .. code-block:: text
bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
# .. code-block:: text
bla bla bla <MYTAG> bla bla internal text</MYTAG> bla bla
|

View File

@@ -1,11 +1,11 @@
# ... Some code here...
# you have wx.HtmlTag variable tag which is equal to the
# HTML tag <FONT SIZE=+2 COLOR="#0000FF">
dummy = tag.GetParam("SIZE")
# dummy == "+2"
dummy = tag.GetParam("COLOR")
# dummy == "#0000FF"
dummy = tag.GetParam("COLOR", true)
# dummy == "\"#0000FF\"" -- see the difference!!
# ... Some code here...
# you have wx.HtmlTag variable tag which is equal to the
# HTML tag <FONT SIZE=+2 COLOR="#0000FF">
dummy = tag.GetParam("SIZE")
# dummy == "+2"
dummy = tag.GetParam("COLOR")
# dummy == "#0000FF"
dummy = tag.GetParam("COLOR", true)
# dummy == "\"#0000FF\"" -- see the difference!!

View File

@@ -1,8 +1,8 @@
# .. code-block:: html
<html><body>
Hello<p>
How are you?
<p align=center>This is centered...</p>
Oops<br>Oooops!
</body></html>
# .. code-block:: html
<html><body>
Hello<p>
How are you?
<p align=center>This is centered...</p>
Oops<br>Oooops!
</body></html>

View File

@@ -1,7 +1,7 @@
def HandleTag(self, tag):
# change state of parser (e.g. set bold face)
self.ParseInner(tag)
# ...
# restore original state of parser
def HandleTag(self, tag):
# change state of parser (e.g. set bold face)
self.ParseInner(tag)
# ...
# restore original state of parser

View File

@@ -1,3 +1,3 @@
# .. code-block:: html
<A HREF="x.htm">Hello, world!</A>
# .. code-block:: html
<A HREF="x.htm">Hello, world!</A>

View File

@@ -1,2 +1,2 @@
self.WParser.GetContainer().InsertCell(html_cell)
self.WParser.GetContainer().InsertCell(html_cell)

View File

@@ -1,2 +1,2 @@
htmlwin.SetPage("<html><body>Hello, world!</body></html>")
htmlwin.SetPage("<html><body>Hello, world!</body></html>")

View File

@@ -1,9 +1,9 @@
def GetCurrentChar(self, text_ctrl):
pos = text_ctrl.GetInsertionPoint()
if pos == text_ctrl.GetLastPosition():
return ''
return text_ctrl.GetRange(pos, pos + 1)
def GetCurrentChar(self, text_ctrl):
pos = text_ctrl.GetInsertionPoint()
if pos == text_ctrl.GetLastPosition():
return ''
return text_ctrl.GetRange(pos, pos + 1)

View File

@@ -1,44 +1,44 @@
def ScanDocument():
doc = wx.xml.XmlDocument()
if not doc.Load("myfile.xml"):
return False
# start processing the XML file
if doc.GetRoot().GetName() != "myroot-node":
return False
# examine prologue
prolog = doc.GetDocumentNode().GetChildren()
while prolog:
if prolog.GetType() == wx.xml.XML_PI_NODE and prolog.GetName() == "target":
# process Process Instruction contents
pi = prolog.GetContent()
# Other code here...
child = doc.GetRoot().GetChildren()
while child:
if child.GetName() == "tag1":
# process text enclosed by tag1/tag1
content = child.GetNodeContent()
# Other code here...
# process attributes of tag1
attrvalue1 = child.GetAttribute("attr1", "default-value")
attrvalue2 = child.GetAttribute("attr2", "default-value")
elif child.GetName() == "tag2":
# process tag2 ...
attrvalue3 = child.GetAttribute("attr3", "default-value")
child = child.GetNext()
def ScanDocument():
doc = wx.xml.XmlDocument()
if not doc.Load("myfile.xml"):
return False
# start processing the XML file
if doc.GetRoot().GetName() != "myroot-node":
return False
# examine prologue
prolog = doc.GetDocumentNode().GetChildren()
while prolog:
if prolog.GetType() == wx.xml.XML_PI_NODE and prolog.GetName() == "target":
# process Process Instruction contents
pi = prolog.GetContent()
# Other code here...
child = doc.GetRoot().GetChildren()
while child:
if child.GetName() == "tag1":
# process text enclosed by tag1/tag1
content = child.GetNodeContent()
# Other code here...
# process attributes of tag1
attrvalue1 = child.GetAttribute("attr1", "default-value")
attrvalue2 = child.GetAttribute("attr2", "default-value")
elif child.GetName() == "tag2":
# process tag2 ...
attrvalue3 = child.GetAttribute("attr3", "default-value")
child = child.GetNext()

View File

@@ -1,6 +1,6 @@
doc = wx.xml.XmlDocument()
doc.Load("myfile.xml", "UTF-8", wx.xml.XMLDOC_KEEP_WHITESPACE_NODES)
# myfile2.xml will be identical to myfile.xml saving it self way:
doc.Save("myfile2.xml", wx.xml.XML_NO_INDENTATION)
doc = wx.xml.XmlDocument()
doc.Load("myfile.xml", "UTF-8", wx.xml.XMLDOC_KEEP_WHITESPACE_NODES)
# myfile2.xml will be identical to myfile.xml saving it self way:
doc.Save("myfile2.xml", wx.xml.XML_NO_INDENTATION)

View File

@@ -1,4 +1,4 @@
doc = wx.xml.XmlDocument()
doc.Load("myfile.xml")
doc.Save("myfile2.xml") # myfile2.xml != myfile.xml
doc = wx.xml.XmlDocument()
doc.Load("myfile.xml")
doc.Save("myfile2.xml") # myfile2.xml != myfile.xml

View File

@@ -1,4 +1,4 @@
# .. code-block:: text
XML_ELEMENT_NODE name="tagname", content=""
|-- XML_TEXT_NODE name="", content="tagcontent"
# .. code-block:: text
XML_ELEMENT_NODE name="tagname", content=""
|-- XML_TEXT_NODE name="", content="tagcontent"

View File

@@ -1,4 +1,4 @@
# .. code-block:: text
XML_ELEMENT_NODE name="tagname", content=""
|-- XML_CDATA_SECTION_NODE name="", content="tagcontent"
# .. code-block:: text
XML_ELEMENT_NODE name="tagname", content=""
|-- XML_CDATA_SECTION_NODE name="", content="tagcontent"

View File

@@ -1,3 +1,3 @@
if not wx.xml.XmlResource.Get().Load("rc/*.xrc"):
wx.LogError("Couldn't load resources!")
if not wx.xml.XmlResource.Get().Load("rc/*.xrc"):
wx.LogError("Couldn't load resources!")

View File

@@ -1,3 +1,3 @@
dlg = wx.xml.XmlResource.Get().LoadDialog(mainFrame, "my_dialog")
dlg.ShowModal()
dlg = wx.xml.XmlResource.Get().LoadDialog(mainFrame, "my_dialog")
dlg.ShowModal()