diff --git a/docs/sphinx/_downloads/i18nwxapp/app_base.py b/docs/sphinx/_downloads/i18nwxapp/app_base.py index 567b8284..b91e3c6f 100644 --- a/docs/sphinx/_downloads/i18nwxapp/app_base.py +++ b/docs/sphinx/_downloads/i18nwxapp/app_base.py @@ -1,102 +1,102 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*-# -# -# Author: Werner F. Bruhin -# Purpose: how to I18N enable an application -# -# Inspired by the I18N wxPython demo and the Internationalization page on -# the wxPython wiki. -# - -import sys -import os - -import wx - -# Install a custom displayhook to keep Python from setting the global -# _ (underscore) to the value of the last evaluated expression. If -# we don't do this, our mapping of _ to gettext can get overwritten. -# This is useful/needed in interactive debugging with PyShell. - -def _displayHook(obj): - if obj is not None: - print repr(obj) - -# add translation macro to builtin similar to what gettext does -import __builtin__ -__builtin__.__dict__['_'] = wx.GetTranslation - -import app_const as appC - -from wx.lib.mixins.inspection import InspectionMixin - -class BaseApp(wx.App, InspectionMixin): - def OnInit(self): - self.Init() # InspectionMixin - # work around for Python stealing "_" - sys.displayhook = _displayHook - - self.appName = "I18N sample application" - - self.doConfig() - - self.locale = None - wx.Locale.AddCatalogLookupPathPrefix('locale') - self.updateLanguage(self.appConfig.Read(u"Language")) - - return True - - def doConfig(self): - """Setup an application configuration file""" - # configuration folder - sp = wx.StandardPaths.Get() - self.configLoc = sp.GetUserConfigDir() - self.configLoc = os.path.join(self.configLoc, self.appName) - # win: C:\Users\userid\AppData\Roaming\appName - # nix: \home\userid\appName - - if not os.path.exists(self.configLoc): - os.mkdir(self.configLoc) - - # AppConfig stuff is here - self.appConfig = wx.FileConfig(appName=self.appName, - vendorName=u'who you wish', - localFilename=os.path.join( - self.configLoc, "AppConfig")) - - if not self.appConfig.HasEntry(u'Language'): - # on first run we default to German - self.appConfig.Write(key=u'Language', value=u'de') - - self.appConfig.Flush() - - def updateLanguage(self, lang): - """ - Update the language to the requested one. - - Make *sure* any existing locale is deleted before the new - one is created. The old C++ object needs to be deleted - before the new one is created, and if we just assign a new - instance to the old Python variable, the old C++ locale will - not be destroyed soon enough, likely causing a crash. - - :param string `lang`: one of the supported language codes - - """ - # if an unsupported language is requested default to English - if lang in appC.supLang: - selLang = appC.supLang[lang] - else: - selLang = wx.LANGUAGE_ENGLISH - - if self.locale: - assert sys.getrefcount(self.locale) <= 2 - del self.locale - - # create a locale object for this language - self.locale = wx.Locale(selLang) - if self.locale.IsOk(): - self.locale.AddCatalog(appC.langDomain) - else: - self.locale = None - +#!/usr/bin/env python +# -*- coding: utf-8 -*-# +# +# Author: Werner F. Bruhin +# Purpose: how to I18N enable an application +# +# Inspired by the I18N wxPython demo and the Internationalization page on +# the wxPython wiki. +# + +import sys +import os + +import wx + +# Install a custom displayhook to keep Python from setting the global +# _ (underscore) to the value of the last evaluated expression. If +# we don't do this, our mapping of _ to gettext can get overwritten. +# This is useful/needed in interactive debugging with PyShell. + +def _displayHook(obj): + if obj is not None: + print repr(obj) + +# add translation macro to builtin similar to what gettext does +import __builtin__ +__builtin__.__dict__['_'] = wx.GetTranslation + +import app_const as appC + +from wx.lib.mixins.inspection import InspectionMixin + +class BaseApp(wx.App, InspectionMixin): + def OnInit(self): + self.Init() # InspectionMixin + # work around for Python stealing "_" + sys.displayhook = _displayHook + + self.appName = "I18N sample application" + + self.doConfig() + + self.locale = None + wx.Locale.AddCatalogLookupPathPrefix('locale') + self.updateLanguage(self.appConfig.Read(u"Language")) + + return True + + def doConfig(self): + """Setup an application configuration file""" + # configuration folder + sp = wx.StandardPaths.Get() + self.configLoc = sp.GetUserConfigDir() + self.configLoc = os.path.join(self.configLoc, self.appName) + # win: C:\Users\userid\AppData\Roaming\appName + # nix: \home\userid\appName + + if not os.path.exists(self.configLoc): + os.mkdir(self.configLoc) + + # AppConfig stuff is here + self.appConfig = wx.FileConfig(appName=self.appName, + vendorName=u'who you wish', + localFilename=os.path.join( + self.configLoc, "AppConfig")) + + if not self.appConfig.HasEntry(u'Language'): + # on first run we default to German + self.appConfig.Write(key=u'Language', value=u'de') + + self.appConfig.Flush() + + def updateLanguage(self, lang): + """ + Update the language to the requested one. + + Make *sure* any existing locale is deleted before the new + one is created. The old C++ object needs to be deleted + before the new one is created, and if we just assign a new + instance to the old Python variable, the old C++ locale will + not be destroyed soon enough, likely causing a crash. + + :param string `lang`: one of the supported language codes + + """ + # if an unsupported language is requested default to English + if lang in appC.supLang: + selLang = appC.supLang[lang] + else: + selLang = wx.LANGUAGE_ENGLISH + + if self.locale: + assert sys.getrefcount(self.locale) <= 2 + del self.locale + + # create a locale object for this language + self.locale = wx.Locale(selLang) + if self.locale.IsOk(): + self.locale.AddCatalog(appC.langDomain) + else: + self.locale = None + diff --git a/docs/sphinx/_downloads/i18nwxapp/app_const.py b/docs/sphinx/_downloads/i18nwxapp/app_const.py index 95095afc..a9125221 100644 --- a/docs/sphinx/_downloads/i18nwxapp/app_const.py +++ b/docs/sphinx/_downloads/i18nwxapp/app_const.py @@ -1,16 +1,16 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*-# -# -# Author: Werner F. Bruhin -# Purpose: Application constants -# Created: 06/04/2012 - -import wx - -# language domain -langDomain = "I18Nwxapp" -# languages you want to support -supLang = {u"en": wx.LANGUAGE_ENGLISH, - u"fr": wx.LANGUAGE_FRENCH, - u"de": wx.LANGUAGE_GERMAN, - } +#!/usr/bin/env python +# -*- coding: utf-8 -*-# +# +# Author: Werner F. Bruhin +# Purpose: Application constants +# Created: 06/04/2012 + +import wx + +# language domain +langDomain = "I18Nwxapp" +# languages you want to support +supLang = {u"en": wx.LANGUAGE_ENGLISH, + u"fr": wx.LANGUAGE_FRENCH, + u"de": wx.LANGUAGE_GERMAN, + } diff --git a/docs/sphinx/_downloads/i18nwxapp/sampleapp.py b/docs/sphinx/_downloads/i18nwxapp/sampleapp.py index 970906d3..597530fe 100644 --- a/docs/sphinx/_downloads/i18nwxapp/sampleapp.py +++ b/docs/sphinx/_downloads/i18nwxapp/sampleapp.py @@ -1,111 +1,111 @@ -# -*- coding: utf-8 -*-# -#!/usr/bin/env python - -"""The sample I18N application""" - -import os - -import wx -import wx.lib.sized_controls as sc - -class AppI18N(sc.SizedFrame): - def __init__(self, parent, **kwds): - """ - A sample application to demonstrate how to enable I18N support - """ - super(AppI18N, self).__init__(parent, **kwds) - self.SetTitle(_(u"The I18N sample application")) - - self.createMenu() - self.createOtherCtrls() - - def createMenu(self): - menubar = wx.MenuBar() - - # file menu - fileMenu = wx.Menu() - closeMenuItem = fileMenu.Append(wx.NewId(), - _(u"Close"), - _(u"Close the application")) - self.Bind(wx.EVT_MENU, self.onClose, closeMenuItem) - menubar.Append(fileMenu, _(u"&File")) - - # edit menu - manageMenu = wx.Menu() - manageSomethingMenuItem = manageMenu.Append(wx.NewId(), - _(u"Edit something"), - _(u"Edit an entry of something")) - self.Bind(wx.EVT_MENU, self.doEditSomething, manageSomethingMenuItem) - - menubar.Append(manageMenu, _(u"&Edit")) - - # help menu - helpMenu = wx.Menu() - aboutMenuItem = helpMenu.Append(wx.NewId(), - _(u"&About"), - _(u"About the program")) - self.Bind(wx.EVT_MENU, self.doAboutBox, aboutMenuItem) - menubar.Append(helpMenu, _(u"&Help")) - - self.SetMenuBar(menubar) - - def createOtherCtrls(self): - pane = self.GetContentsPane() - - cPane = sc.SizedPanel(pane) - cPane.SetSizerType("grid", options={"cols": 2}) - st = wx.StaticText(cPane, wx.ID_ANY, - _(u"A nice label for the TextCtrl")) - st.SetSizerProps(valign='center') - tc = wx.TextCtrl(cPane, wx.ID_ANY) - - searchSt = wx.StaticText(cPane, wx.ID_ANY, - _(u"a search control")) - searchSt.SetSizerProps(valign='center') - searchC = wx.SearchCtrl(cPane, wx.ID_ANY) - - sline = wx.StaticLine(pane, wx.ID_ANY) - sline.SetSizerProps(expand=True) - bPane = sc.SizedPanel(pane) - fB = wx.Button(bPane, wx.ID_ANY, _(u"Open a file dialog")) - fB.SetSizerProps(align="center") - fB.Bind(wx.EVT_BUTTON, self.onFbButton) - - def onFbButton(self, event): - wildcard = "Python source (*.py)|*.py|" \ - "Compiled Python (*.pyc)|*.pyc|" \ - "SPAM files (*.spam)|*.spam|" \ - "Egg file (*.egg)|*.egg|" \ - "All files (*.*)|*.*" - - with wx.FileDialog( - self, message=_(u"Choose a file"), - defaultDir=os.getcwd(), - defaultFile="", - wildcard=wildcard, - style=wx.OPEN | wx.MULTIPLE | wx.CHANGE_DIR - ) as dlg: - - # Show the dialog and retrieve the user response. If it is the - # OK response, - # process the data. - if dlg.ShowModal() == wx.ID_OK: - # This returns a Python list of files that were selected. - paths = dlg.GetPaths() - - def onClose(self, event): - event.Skip() - - def doEditSomething(self, event): - event.Skip() - - def doAboutBox(self, event): - event.Skip() - -if __name__ == '__main__': - import app_base as ab - app = ab.BaseApp(redirect=False) - - frame = AppI18N(None) - frame.Show() - app.MainLoop() +# -*- coding: utf-8 -*-# +#!/usr/bin/env python + +"""The sample I18N application""" + +import os + +import wx +import wx.lib.sized_controls as sc + +class AppI18N(sc.SizedFrame): + def __init__(self, parent, **kwds): + """ + A sample application to demonstrate how to enable I18N support + """ + super(AppI18N, self).__init__(parent, **kwds) + self.SetTitle(_(u"The I18N sample application")) + + self.createMenu() + self.createOtherCtrls() + + def createMenu(self): + menubar = wx.MenuBar() + + # file menu + fileMenu = wx.Menu() + closeMenuItem = fileMenu.Append(wx.NewId(), + _(u"Close"), + _(u"Close the application")) + self.Bind(wx.EVT_MENU, self.onClose, closeMenuItem) + menubar.Append(fileMenu, _(u"&File")) + + # edit menu + manageMenu = wx.Menu() + manageSomethingMenuItem = manageMenu.Append(wx.NewId(), + _(u"Edit something"), + _(u"Edit an entry of something")) + self.Bind(wx.EVT_MENU, self.doEditSomething, manageSomethingMenuItem) + + menubar.Append(manageMenu, _(u"&Edit")) + + # help menu + helpMenu = wx.Menu() + aboutMenuItem = helpMenu.Append(wx.NewId(), + _(u"&About"), + _(u"About the program")) + self.Bind(wx.EVT_MENU, self.doAboutBox, aboutMenuItem) + menubar.Append(helpMenu, _(u"&Help")) + + self.SetMenuBar(menubar) + + def createOtherCtrls(self): + pane = self.GetContentsPane() + + cPane = sc.SizedPanel(pane) + cPane.SetSizerType("grid", options={"cols": 2}) + st = wx.StaticText(cPane, wx.ID_ANY, + _(u"A nice label for the TextCtrl")) + st.SetSizerProps(valign='center') + tc = wx.TextCtrl(cPane, wx.ID_ANY) + + searchSt = wx.StaticText(cPane, wx.ID_ANY, + _(u"a search control")) + searchSt.SetSizerProps(valign='center') + searchC = wx.SearchCtrl(cPane, wx.ID_ANY) + + sline = wx.StaticLine(pane, wx.ID_ANY) + sline.SetSizerProps(expand=True) + bPane = sc.SizedPanel(pane) + fB = wx.Button(bPane, wx.ID_ANY, _(u"Open a file dialog")) + fB.SetSizerProps(align="center") + fB.Bind(wx.EVT_BUTTON, self.onFbButton) + + def onFbButton(self, event): + wildcard = "Python source (*.py)|*.py|" \ + "Compiled Python (*.pyc)|*.pyc|" \ + "SPAM files (*.spam)|*.spam|" \ + "Egg file (*.egg)|*.egg|" \ + "All files (*.*)|*.*" + + with wx.FileDialog( + self, message=_(u"Choose a file"), + defaultDir=os.getcwd(), + defaultFile="", + wildcard=wildcard, + style=wx.OPEN | wx.MULTIPLE | wx.CHANGE_DIR + ) as dlg: + + # Show the dialog and retrieve the user response. If it is the + # OK response, + # process the data. + if dlg.ShowModal() == wx.ID_OK: + # This returns a Python list of files that were selected. + paths = dlg.GetPaths() + + def onClose(self, event): + event.Skip() + + def doEditSomething(self, event): + event.Skip() + + def doAboutBox(self, event): + event.Skip() + +if __name__ == '__main__': + import app_base as ab + app = ab.BaseApp(redirect=False) + + frame = AppI18N(None) + frame.Show() + app.MainLoop() diff --git a/docs/sphinx/_templates/indexsidebar.html b/docs/sphinx/_templates/indexsidebar.html index 5a476393..0c9a18a5 100644 --- a/docs/sphinx/_templates/indexsidebar.html +++ b/docs/sphinx/_templates/indexsidebar.html @@ -1,15 +1,15 @@ -

Download

-

Current version: 2.9.3.74

-

Get the latest wxPython library from the wxPython website -, or view the latest modifications using Viewvc. - -

Questions? Suggestions?

- -

Send your questions to the wxPython mailing list:

-
- - -
-

You can also open an issue at the +

Download

+

Current version: 2.9.3.74

+

Get the latest wxPython library from the wxPython website +, or view the latest modifications using Viewvc. + +

Questions? Suggestions?

+ +

Send your questions to the wxPython mailing list:

+
+ + +
+

You can also open an issue at the tracker.

\ No newline at end of file diff --git a/docs/sphinx/_templates/layout.html b/docs/sphinx/_templates/layout.html index ff3e4e0d..90d155ca 100644 --- a/docs/sphinx/_templates/layout.html +++ b/docs/sphinx/_templates/layout.html @@ -1,71 +1,71 @@ -{% extends "!layout.html" %} - -{%- block relbaritems %} -
  • {{ title }}
  • -{% endblock %} - -{%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) - and (sidebars != []) and (pagename != 'index') %} - -{% macro phoenixsidebar() %} - {%- if render_sidebar %}{{ sidebar() }}{%- endif %} -{% endmacro %} - -{% macro sidebarcss() %} - {%- if not render_sidebar %} - - {%- endif %} -{% endmacro %} - -{% block extrahead %}{{ sidebarcss() }}{% endblock %} - -{% block sidebar1 %}{{ phoenixsidebar() }}{% endblock %} -{% block sidebar2 %}{% endblock %} - -{% block relbar2 %}{% endblock %} - -{% block rootrellink %} - -
  • -
  • Home
  • -
  • Search
  • -
  • Gallery
  • -
  • Documentation »
  • - -{%- if pagename != 'search' %} - - -{%- endif %} -{% endblock %} - -{% block document %} -
    -
    - {% block body %} {% endblock %} - {%- if theme_disqus_comments|tobool %} -
    - - - {%- endif %} -
    -
    -{%- endblock %} - -{% block header %} -
    -Phoenix Logo -
    -{% endblock %} - -set script_files = script_files + ['_static/sidebar.js'] -set script_files = script_files + ['_static/header.js'] +{% extends "!layout.html" %} + +{%- block relbaritems %} +
  • {{ title }}
  • +{% endblock %} + +{%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) + and (sidebars != []) and (pagename != 'index') %} + +{% macro phoenixsidebar() %} + {%- if render_sidebar %}{{ sidebar() }}{%- endif %} +{% endmacro %} + +{% macro sidebarcss() %} + {%- if not render_sidebar %} + + {%- endif %} +{% endmacro %} + +{% block extrahead %}{{ sidebarcss() }}{% endblock %} + +{% block sidebar1 %}{{ phoenixsidebar() }}{% endblock %} +{% block sidebar2 %}{% endblock %} + +{% block relbar2 %}{% endblock %} + +{% block rootrellink %} + +
  • +
  • Home
  • +
  • Search
  • +
  • Gallery
  • +
  • Documentation »
  • + +{%- if pagename != 'search' %} + + +{%- endif %} +{% endblock %} + +{% block document %} +
    +
    + {% block body %} {% endblock %} + {%- if theme_disqus_comments|tobool %} +
    + + + {%- endif %} +
    +
    +{%- endblock %} + +{% block header %} +
    +Phoenix Logo +
    +{% endblock %} + +set script_files = script_files + ['_static/sidebar.js'] +set script_files = script_files + ['_static/header.js'] diff --git a/docs/sphinx/_templates/main.html b/docs/sphinx/_templates/main.html index 44192003..edb87e81 100644 --- a/docs/sphinx/_templates/main.html +++ b/docs/sphinx/_templates/main.html @@ -1,105 +1,105 @@ -{% extends "layout.html" %} -{% set title = 'Documentation' %} -{% block body %} -

    Welcome to wxPython (Phoenix)'s documentation!

    - -
    -

    SVN Revisions

    -

    “Built with wxWidgets & wxPython SVN revision |SVN|

    -
    - -

    - Welcome! This is the documentation for wxPython {{ release }}, last updated |TODAY|. -

    - -

    - This is the first, very-alpha release of this set of documentation. Documentation TODOs: - -

    -

    -

    -
    - Phoenix is the code name of for the new version of wxPython. Robin Dunn called this the Phoenix project - because in the process of doing this project wxPython's implementation will be utterly destroyed and then reborn - in a new and marvelous way, much like the mythical Phoenix rising from the ashes of its former self. -

    - -

    - For wxPython many things about how the wrapper/bindings code is produced will be changing, and we'll also be - eliminating some other crud along the way. -

    - -

    - Some interesting documents about the current status or the Phoenix project and its development: -

    - - -
    - -
    -

    Note

    - - If you wish to help in the documentation effort, the main docstrings guidelines are outlined in - this document. -
    - -
    - -

    - The Phoenix documentation has been built automatically starting from XML files representing the - wxWidgets C++ documentation (generated using Doxygen). -

    - -

    - I developed a set of Python routines to translate this XML hell into - reStructuredText. Then, Sphinx - has been used to generate the final set of documentation for Phoenix. -

    -
    - -

    Documentation

    - - - - - -
    - - -
    - -
    - -

    -

    - - - - -
    - - +{% extends "layout.html" %} +{% set title = 'Documentation' %} +{% block body %} +

    Welcome to wxPython (Phoenix)'s documentation!

    + +
    +

    SVN Revisions

    +

    “Built with wxWidgets & wxPython SVN revision |SVN|

    +
    + +

    + Welcome! This is the documentation for wxPython {{ release }}, last updated |TODAY|. +

    + +

    + This is the first, very-alpha release of this set of documentation. Documentation TODOs: + +

    +

    +

    +
    + Phoenix is the code name of for the new version of wxPython. Robin Dunn called this the Phoenix project + because in the process of doing this project wxPython's implementation will be utterly destroyed and then reborn + in a new and marvelous way, much like the mythical Phoenix rising from the ashes of its former self. +

    + +

    + For wxPython many things about how the wrapper/bindings code is produced will be changing, and we'll also be + eliminating some other crud along the way. +

    + +

    + Some interesting documents about the current status or the Phoenix project and its development: +

    + + +
    + +
    +

    Note

    + + If you wish to help in the documentation effort, the main docstrings guidelines are outlined in + this document. +
    + +
    + +

    + The Phoenix documentation has been built automatically starting from XML files representing the + wxWidgets C++ documentation (generated using Doxygen). +

    + +

    + I developed a set of Python routines to translate this XML hell into + reStructuredText. Then, Sphinx + has been used to generate the final set of documentation for Phoenix. +

    +
    + +

    Documentation

    + + + + + +
    + + +
    + +
    + +

    +

    + + + + +
    + + {% endblock %} \ No newline at end of file diff --git a/docs/sphinx/availability.py b/docs/sphinx/availability.py index ecdb54b9..266d55cc 100644 --- a/docs/sphinx/availability.py +++ b/docs/sphinx/availability.py @@ -1,202 +1,202 @@ -# -*- coding: utf-8 -*- - -""" -Allow "availability" admonitions to be inserted into your documentation. -Inclusion of availabilities can be switched of by a configuration variable. -The availabilitylist directive collects all availabilities of your project -and lists them along with a backlink to the original location. -""" - -from docutils import nodes - -from sphinx.locale import _ -from sphinx.environment import NoUri -from sphinx.util.nodes import set_source_info -from sphinx.util.compat import Directive, make_admonition - -# ----------------------------------------------------------------------- # -class availability_node(nodes.Admonition, nodes.Element): pass - -# ----------------------------------------------------------------------- # -class availabilitylist(nodes.General, nodes.Element): pass - -# ----------------------------------------------------------------------- # - - -class Availability(Directive): - """ - An "availability" entry, displayed (if configured) in the form of an admonition. - """ - - has_content = True - required_arguments = 0 - optional_arguments = 0 - final_argument_whitespace = False - option_spec = {} - - - # ----------------------------------------------------------------------- # - - def run(self): - env = self.state.document.settings.env - targetid = 'index-%s' % env.new_serialno('index') - targetnode = nodes.target('', '', ids=[targetid]) - - ad = make_admonition(availability_node, self.name, [_('Availability')], self.options, - self.content, self.lineno, self.content_offset, - self.block_text, self.state, self.state_machine) - set_source_info(self, ad[0]) - return [targetnode] + ad - - - -# ----------------------------------------------------------------------- # - -def process_availabilities(app, doctree): - # collect all availabilities in the environment - # this is not done in the directive itself because it some transformations - # must have already been run, e.g. substitutions - env = app.builder.env - if not hasattr(env, 'availability_all_availabilities'): - env.availability_all_availabilities = [] - for node in doctree.traverse(availability_node): - try: - targetnode = node.parent[node.parent.index(node) - 1] - if not isinstance(targetnode, nodes.target): - raise IndexError - except IndexError: - targetnode = None - env.availability_all_availabilities.append({ - 'docname': env.docname, - 'source': node.source or env.doc2path(env.docname), - 'lineno': node.line, - 'availability': node.deepcopy(), - 'target': targetnode, - }) - - -# ----------------------------------------------------------------------- # - -class AvailabilityList(Directive): - """ - A list of all availability entries. - """ - - has_content = False - required_arguments = 0 - optional_arguments = 0 - final_argument_whitespace = False - option_spec = {} - - - # ----------------------------------------------------------------------- # - - def run(self): - # Simply insert an empty availabilitylist node which will be replaced later - # when process_availability_nodes is called - return [availabilitylist('')] - - -# ----------------------------------------------------------------------- # - -def process_availability_nodes(app, doctree, fromdocname): - if not app.config['availability_include_availabilities']: - for node in doctree.traverse(availability_node): - node.parent.remove(node) - - # Replace all availabilitylist nodes with a list of the collected availabilities. - # Augment each availability with a backlink to the original location. - env = app.builder.env - - if not hasattr(env, 'availability_all_availabilities'): - env.availability_all_availabilities = [] - - for node in doctree.traverse(availabilitylist): - if not app.config['availability_include_availabilities']: - node.replace_self([]) - continue - - content = [] - - for availability_info in env.availability_all_availabilities: - para = nodes.paragraph(classes=['availability-source']) - description = _('(The <> is located in ' - ' %s, line %d.)') % \ - (availability_info['source'], availability_info['lineno']) - desc1 = description[:description.find('<<')] - desc2 = description[description.find('>>')+2:] - para += nodes.Text(desc1, desc1) - - # Create a reference - newnode = nodes.reference('', '', internal=True) - innernode = nodes.emphasis(_('original entry'), _('original entry')) - try: - newnode['refuri'] = app.builder.get_relative_uri( - fromdocname, availability_info['docname']) - newnode['refuri'] += '#' + availability_info['target']['refid'] - except NoUri: - # ignore if no URI can be determined, e.g. for LaTeX output - pass - newnode.append(innernode) - para += newnode - para += nodes.Text(desc2, desc2) - - # (Recursively) resolve references in the availability content - availability_entry = availability_info['availability'] - env.resolve_references(availability_entry, availability_info['docname'], - app.builder) - - # Insert into the availabilitylist - content.append(availability_entry) - content.append(para) - - node.replace_self(content) - - -# ----------------------------------------------------------------------- # - -def purge_availabilities(app, env, docname): - if not hasattr(env, 'availability_all_availabilities'): - return - env.availability_all_availabilities = [availability for availability in env.availability_all_availabilities - if availability['docname'] != docname] - - -# ----------------------------------------------------------------------- # - -def visit_availability_node(self, node): - self.visit_admonition(node) - - -# ----------------------------------------------------------------------- # - -def depart_availability_node(self, node): - self.depart_admonition(node) - - -# ----------------------------------------------------------------------- # - -def setup(app): - app.add_javascript('javascript/header.js') - app.add_javascript('javascript/sidebar.js') - app.add_javascript('javascript/jquery.collapse.js') - app.add_javascript('javascript/jquery.cookie.js') - - app.add_config_value('availability_include_availabilities', False, False) - - app.add_node(availabilitylist) - app.add_node(availability_node, - html=(visit_availability_node, depart_availability_node), - latex=(visit_availability_node, depart_availability_node), - text=(visit_availability_node, depart_availability_node), - man=(visit_availability_node, depart_availability_node), - texinfo=(visit_availability_node, depart_availability_node)) - - app.add_directive('availability', Availability) - app.add_directive('availabilitylist', AvailabilityList) - app.connect('doctree-read', process_availabilities) - app.connect('doctree-resolved', process_availability_nodes) - app.connect('env-purge-doc', purge_availabilities) - - -# ----------------------------------------------------------------------- # +# -*- coding: utf-8 -*- + +""" +Allow "availability" admonitions to be inserted into your documentation. +Inclusion of availabilities can be switched of by a configuration variable. +The availabilitylist directive collects all availabilities of your project +and lists them along with a backlink to the original location. +""" + +from docutils import nodes + +from sphinx.locale import _ +from sphinx.environment import NoUri +from sphinx.util.nodes import set_source_info +from sphinx.util.compat import Directive, make_admonition + +# ----------------------------------------------------------------------- # +class availability_node(nodes.Admonition, nodes.Element): pass + +# ----------------------------------------------------------------------- # +class availabilitylist(nodes.General, nodes.Element): pass + +# ----------------------------------------------------------------------- # + + +class Availability(Directive): + """ + An "availability" entry, displayed (if configured) in the form of an admonition. + """ + + has_content = True + required_arguments = 0 + optional_arguments = 0 + final_argument_whitespace = False + option_spec = {} + + + # ----------------------------------------------------------------------- # + + def run(self): + env = self.state.document.settings.env + targetid = 'index-%s' % env.new_serialno('index') + targetnode = nodes.target('', '', ids=[targetid]) + + ad = make_admonition(availability_node, self.name, [_('Availability')], self.options, + self.content, self.lineno, self.content_offset, + self.block_text, self.state, self.state_machine) + set_source_info(self, ad[0]) + return [targetnode] + ad + + + +# ----------------------------------------------------------------------- # + +def process_availabilities(app, doctree): + # collect all availabilities in the environment + # this is not done in the directive itself because it some transformations + # must have already been run, e.g. substitutions + env = app.builder.env + if not hasattr(env, 'availability_all_availabilities'): + env.availability_all_availabilities = [] + for node in doctree.traverse(availability_node): + try: + targetnode = node.parent[node.parent.index(node) - 1] + if not isinstance(targetnode, nodes.target): + raise IndexError + except IndexError: + targetnode = None + env.availability_all_availabilities.append({ + 'docname': env.docname, + 'source': node.source or env.doc2path(env.docname), + 'lineno': node.line, + 'availability': node.deepcopy(), + 'target': targetnode, + }) + + +# ----------------------------------------------------------------------- # + +class AvailabilityList(Directive): + """ + A list of all availability entries. + """ + + has_content = False + required_arguments = 0 + optional_arguments = 0 + final_argument_whitespace = False + option_spec = {} + + + # ----------------------------------------------------------------------- # + + def run(self): + # Simply insert an empty availabilitylist node which will be replaced later + # when process_availability_nodes is called + return [availabilitylist('')] + + +# ----------------------------------------------------------------------- # + +def process_availability_nodes(app, doctree, fromdocname): + if not app.config['availability_include_availabilities']: + for node in doctree.traverse(availability_node): + node.parent.remove(node) + + # Replace all availabilitylist nodes with a list of the collected availabilities. + # Augment each availability with a backlink to the original location. + env = app.builder.env + + if not hasattr(env, 'availability_all_availabilities'): + env.availability_all_availabilities = [] + + for node in doctree.traverse(availabilitylist): + if not app.config['availability_include_availabilities']: + node.replace_self([]) + continue + + content = [] + + for availability_info in env.availability_all_availabilities: + para = nodes.paragraph(classes=['availability-source']) + description = _('(The <> is located in ' + ' %s, line %d.)') % \ + (availability_info['source'], availability_info['lineno']) + desc1 = description[:description.find('<<')] + desc2 = description[description.find('>>')+2:] + para += nodes.Text(desc1, desc1) + + # Create a reference + newnode = nodes.reference('', '', internal=True) + innernode = nodes.emphasis(_('original entry'), _('original entry')) + try: + newnode['refuri'] = app.builder.get_relative_uri( + fromdocname, availability_info['docname']) + newnode['refuri'] += '#' + availability_info['target']['refid'] + except NoUri: + # ignore if no URI can be determined, e.g. for LaTeX output + pass + newnode.append(innernode) + para += newnode + para += nodes.Text(desc2, desc2) + + # (Recursively) resolve references in the availability content + availability_entry = availability_info['availability'] + env.resolve_references(availability_entry, availability_info['docname'], + app.builder) + + # Insert into the availabilitylist + content.append(availability_entry) + content.append(para) + + node.replace_self(content) + + +# ----------------------------------------------------------------------- # + +def purge_availabilities(app, env, docname): + if not hasattr(env, 'availability_all_availabilities'): + return + env.availability_all_availabilities = [availability for availability in env.availability_all_availabilities + if availability['docname'] != docname] + + +# ----------------------------------------------------------------------- # + +def visit_availability_node(self, node): + self.visit_admonition(node) + + +# ----------------------------------------------------------------------- # + +def depart_availability_node(self, node): + self.depart_admonition(node) + + +# ----------------------------------------------------------------------- # + +def setup(app): + app.add_javascript('javascript/header.js') + app.add_javascript('javascript/sidebar.js') + app.add_javascript('javascript/jquery.collapse.js') + app.add_javascript('javascript/jquery.cookie.js') + + app.add_config_value('availability_include_availabilities', False, False) + + app.add_node(availabilitylist) + app.add_node(availability_node, + html=(visit_availability_node, depart_availability_node), + latex=(visit_availability_node, depart_availability_node), + text=(visit_availability_node, depart_availability_node), + man=(visit_availability_node, depart_availability_node), + texinfo=(visit_availability_node, depart_availability_node)) + + app.add_directive('availability', Availability) + app.add_directive('availabilitylist', AvailabilityList) + app.connect('doctree-read', process_availabilities) + app.connect('doctree-resolved', process_availability_nodes) + app.connect('env-purge-doc', purge_availabilities) + + +# ----------------------------------------------------------------------- # diff --git a/docs/sphinx/conf.py b/docs/sphinx/conf.py index 2342b746..a3bd6109 100644 --- a/docs/sphinx/conf.py +++ b/docs/sphinx/conf.py @@ -1,263 +1,263 @@ -# -*- coding: utf-8 -*- -# -# Phoenix documentation build configuration file, created by -# sphinx-quickstart on Mon Jun 22 09:32:57 2009. -# -# This file is execfile()d with the current directory set to its containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import sys, os - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.append(os.path.abspath('.')) -sys.path.append('..') - -# -- General configuration ----------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be extensions -# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.todo', 'sphinx.ext.autodoc', - 'sphinx.ext.autosummary', 'sphinx.ext.coverage', - 'availability'] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix of source filenames. -source_suffix = '.txt' - -todo_include_todos = True -todo_all_todos = True - -availability_include_availabilities = True -availability_all_availabilities = True - -# The encoding of source files. -#source_encoding = 'utf-8-sig' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = u'wxPython (Phoenix)' -copyright = u'2012, Andrea Gavana' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = '2.9' -# The full version, including alpha/beta/rc tags. -release = '2.9.4.80 (Phoenix)' - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -#language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -#today = '' -# Else, today_fmt is used as the format for a strftime call. -today_fmt = '%d %B %Y' - -# List of documents that shouldn't be included in the build. -#unused_docs = [] - -# List of directories, relative to source directory, that shouldn't be searched -# for source files. -exclude_trees = ['_build'] - -# The reST default role (used for this markup: `text`) to use for all documents. -default_role = 'autolink' - -# If true, '()' will be appended to :func: etc. cross-reference text. -add_function_parentheses = False - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -add_module_names = False - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -show_authors = True - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] - - -# -- Options for HTML output --------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. Major themes that come with -# Sphinx are currently 'default' and 'sphinxdoc'. -html_theme = 'phoenix_theme' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -html_theme_options = dict() - -# Add any paths that contain custom themes here, relative to this directory. -html_theme_path = ['.'] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -#html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -html_short_title = 'Phoenix Docs' - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -html_logo = '_static/images/sphinxdocs/phoenix_main.png' - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -html_favicon = '_static/images/sphinxdocs/phoenix_small.ico' - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - -html_style = 'css/phoenix.css' - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -#html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -html_sidebars = {'index': 'indexsidebar.html'} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -html_additional_pages = {'gallery': 'gallery.html', 'main': 'main.html'} - -# If false, no module index is generated. -html_use_modindex = True - -# If false, no index is generated. -html_use_index = True - -# If true, the index is split into individual pages for each letter. -html_split_index = True - -# If true, links to the reST sources are added to the pages. -html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -#html_use_opensearch = '' - -# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = '' - -# Output file base name for HTML help builder. -htmlhelp_basename = 'PhoenixDocs' - -# -- Options for LaTeX output -------------------------------------------------- - -# The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' - -# The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass [howto/manual]). -latex_documents = [ - ('index', 'PhoenixDocs.tex', u'wxPython (Phoenix) Documentation', - u'Andrea Gavana', 'manual'), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -#latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -#latex_use_parts = False - -# Additional stuff for the LaTeX preamble. -#latex_preamble = '' - -# Documents to append as an appendix to all manuals. -#latex_appendices = [] - -# If false, no module index is generated. -#latex_use_modindex = True - -# -- Options for PDF output -------------------------------------------------- -# Grouping the document tree into PDF files. List of tuples -# (source start file, target name, title, author, options). -# -# If there is more than one author, separate them with \\. -# For example: r'Guido van Rossum\\Fred L. Drake, Jr., editor' -# -# The options element is a dictionary that lets you override -# this config per-document. -# For example, -# ('index', u'MyProject', u'My Project', u'Author Name', -# dict(pdf_compressed = True)) -# would mean that specific document would be compressed -# regardless of the global pdf_compressed setting. -pdf_documents = [('index', u'PhoenixDocs', u'wxPython (Phoenix) Documentation', u'Andrea Gavana'),] - -# A comma-separated list of custom stylesheets. Example: -# pdf_stylesheets = ['sphinx', 'kerning', 'a4', "C:\\AGW\\agw\\fonts\\sphinx.json"] -# Create a compressed PDF -# Use True/False or 1/0 -# Example: compressed=True -#pdf_compressed = False -# A colon-separated list of folders to search for fonts. Example: -#pdf_font_path = ['E:\\AGW\\agw\\fonts', 'C:\\Windows\\Fonts'] -# Language to be used for hyphenation support -#pdf_language = "en_US" -# Mode for literal blocks wider than the frame. Can be -# overflow, shrink or truncate -#pdf_fit_mode = "shrink" -# Section level that forces a break page. -# For example: 1 means top-level sections start in a new page -# 0 means disabled -#pdf_break_level = 0 -# When a section starts in a new page, force it to be 'even', 'odd', -# or just use 'any' -#pdf_breakside = 'any' -# Insert footnotes where they are defined instead of -# at the end. -#pdf_inline_footnotes = True -# verbosity level. 0 1 or 2 -pdf_verbosity = 2 -# If false, no index is generated. -#pdf_use_index = True -# If false, no modindex is generated. -#pdf_use_modindex = True -# If false, no coverpage is generated. -#pdf_use_coverpage = True -# Documents to append as an appendix to all manuals. -#pdf_appendices = [] -# Enable experimental feature to split table cells. Use it -# if you get "DelayedTable too big" errors -pdf_splittables = True +# -*- coding: utf-8 -*- +# +# Phoenix documentation build configuration file, created by +# sphinx-quickstart on Mon Jun 22 09:32:57 2009. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys, os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +sys.path.append(os.path.abspath('.')) +sys.path.append('..') + +# -- General configuration ----------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = ['sphinx.ext.todo', 'sphinx.ext.autodoc', + 'sphinx.ext.autosummary', 'sphinx.ext.coverage', + 'availability'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.txt' + +todo_include_todos = True +todo_all_todos = True + +availability_include_availabilities = True +availability_all_availabilities = True + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'wxPython (Phoenix)' +copyright = u'2012, Andrea Gavana' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '2.9' +# The full version, including alpha/beta/rc tags. +release = '2.9.4.80 (Phoenix)' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +today_fmt = '%d %B %Y' + +# List of documents that shouldn't be included in the build. +#unused_docs = [] + +# List of directories, relative to source directory, that shouldn't be searched +# for source files. +exclude_trees = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all documents. +default_role = 'autolink' + +# If true, '()' will be appended to :func: etc. cross-reference text. +add_function_parentheses = False + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +add_module_names = False + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +show_authors = True + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. Major themes that come with +# Sphinx are currently 'default' and 'sphinxdoc'. +html_theme = 'phoenix_theme' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +html_theme_options = dict() + +# Add any paths that contain custom themes here, relative to this directory. +html_theme_path = ['.'] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +html_short_title = 'Phoenix Docs' + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +html_logo = '_static/images/sphinxdocs/phoenix_main.png' + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +html_favicon = '_static/images/sphinxdocs/phoenix_small.ico' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +html_style = 'css/phoenix.css' + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +html_sidebars = {'index': 'indexsidebar.html'} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +html_additional_pages = {'gallery': 'gallery.html', 'main': 'main.html'} + +# If false, no module index is generated. +html_use_modindex = True + +# If false, no index is generated. +html_use_index = True + +# If true, the index is split into individual pages for each letter. +html_split_index = True + +# If true, links to the reST sources are added to the pages. +html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = '' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'PhoenixDocs' + +# -- Options for LaTeX output -------------------------------------------------- + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + ('index', 'PhoenixDocs.tex', u'wxPython (Phoenix) Documentation', + u'Andrea Gavana', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_use_modindex = True + +# -- Options for PDF output -------------------------------------------------- +# Grouping the document tree into PDF files. List of tuples +# (source start file, target name, title, author, options). +# +# If there is more than one author, separate them with \\. +# For example: r'Guido van Rossum\\Fred L. Drake, Jr., editor' +# +# The options element is a dictionary that lets you override +# this config per-document. +# For example, +# ('index', u'MyProject', u'My Project', u'Author Name', +# dict(pdf_compressed = True)) +# would mean that specific document would be compressed +# regardless of the global pdf_compressed setting. +pdf_documents = [('index', u'PhoenixDocs', u'wxPython (Phoenix) Documentation', u'Andrea Gavana'),] + +# A comma-separated list of custom stylesheets. Example: +# pdf_stylesheets = ['sphinx', 'kerning', 'a4', "C:\\AGW\\agw\\fonts\\sphinx.json"] +# Create a compressed PDF +# Use True/False or 1/0 +# Example: compressed=True +#pdf_compressed = False +# A colon-separated list of folders to search for fonts. Example: +#pdf_font_path = ['E:\\AGW\\agw\\fonts', 'C:\\Windows\\Fonts'] +# Language to be used for hyphenation support +#pdf_language = "en_US" +# Mode for literal blocks wider than the frame. Can be +# overflow, shrink or truncate +#pdf_fit_mode = "shrink" +# Section level that forces a break page. +# For example: 1 means top-level sections start in a new page +# 0 means disabled +#pdf_break_level = 0 +# When a section starts in a new page, force it to be 'even', 'odd', +# or just use 'any' +#pdf_breakside = 'any' +# Insert footnotes where they are defined instead of +# at the end. +#pdf_inline_footnotes = True +# verbosity level. 0 1 or 2 +pdf_verbosity = 2 +# If false, no index is generated. +#pdf_use_index = True +# If false, no modindex is generated. +#pdf_use_modindex = True +# If false, no coverpage is generated. +#pdf_use_coverpage = True +# Documents to append as an appendix to all manuals. +#pdf_appendices = [] +# Enable experimental feature to split table cells. Use it +# if you get "DelayedTable too big" errors +pdf_splittables = True diff --git a/docs/sphinx/rest_substitutions/overviews/DocstringsGuidelines.rst b/docs/sphinx/rest_substitutions/overviews/DocstringsGuidelines.rst index 57661b86..8c6ff7a5 100644 --- a/docs/sphinx/rest_substitutions/overviews/DocstringsGuidelines.rst +++ b/docs/sphinx/rest_substitutions/overviews/DocstringsGuidelines.rst @@ -1,271 +1,271 @@ -.. include:: headings.inc - -.. highlight:: rst - - -.. _docstrings guidelines: - -================================================== -|phoenix_title| **Phoenix Docstrings Guidelines** -================================================== - -This document gives a brief introduction about the current docstrings standards -in the Phoenix project. Most of the documentation in the Phoenix core is automatically -generated by parsing the wxWidgets XML docs; however, Phoenix has its own pure-Python -functions and classes in at least two places: - -* **Core Library**: examples include :ref:`CallLater` and :func:`date2pydate`, which require - manual input of the documentation strings. This is achieved by editing the source Python files - located in the ``etg`` folder in the Phoenix directory tree; -* **wx.lib**: the whole of ``wx.lib`` (and its sub-folders) is made up of pure-Python modules, - ofter representing owner-drawn widgets which are not available as wrapped modules. Again, - this requires manual editing of the source Python files. - -This document is a starting point in setting some reasonable standards on how the pure-Python -docstrings may be edited and improved to make the overall appearance of the Phoenix documentation -consistent and pleasant. - - -.. _info field lists: - -Info Field Lists ----------------- - -`Info Field Lists` refer to the various options available while documenting a method or a function, -and in particular its parameters, keywords, return type and possibly raised Python `Exceptions`. - -Inside Python object description directives, reST field lists with 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. -* ``rtype``: Return type. - - -The field names must consist of one of these keywords and an argument (except -for ``returns`` and ``rtype``, which do not need an argument). This is best -explained by an example:: - - .. method:: Set3StateValue(self, state): - - Sets the checkbox item to the given `state`. - - :param `state`: can be one of: ``wx.CHK_UNCHECKED`` (check is off), ``wx.CHK_CHECKED`` - (check is on) or ``wx.CHK_UNDETERMINED`` (check is mixed). - :type `state`: integer - - :returns: ``True`` if the value was successfully set, ``False`` otherwise. - :rtype: bool - - :raise: `Exception` when the item is not a 3-state checkbox item. - -| - -This will render like this: - - .. method:: Set3StateValue(self, state): - :noindex: - - Sets the checkbox item to the given `state`. - - :param `state`: can be one of: ``wx.CHK_UNCHECKED`` (check is off), ``wx.CHK_CHECKED`` - (check is on) or ``wx.CHK_UNDETERMINED`` (check is mixed). - :type `state`: integer - - :returns: ``True`` if the value was successfully set, ``False`` otherwise. - :rtype: bool - - :raise: `Exception` when the item is not a 3-state checkbox item. - - -| - -It is also possible to combine parameter type and description, if the type is a -single word, like this:: - - :param integer `state`: can be one of: ``wx.CHK_UNCHECKED`` (check is off), ``wx.CHK_CHECKED`` - (check is on) or ``wx.CHK_UNDETERMINED`` (check is mixed). - - -In general, the standards for the ``:param`` field are the following: - -1. Do not use the ``@param`` construct, as I am not sure Sphinx and docutils understand it; -2. Always try and define the parameter type: if the parameter is another Phoenix class, you can simply - write this:: - - :param Point `pt`: the mouse pointer location. - - Or, alternatively:: - - :param `pt`: the mouse pointer location. - :type `pt`: `Point` - - -Similarly, for the ``:return:`` and ``:rtype:`` field, you may consider doing the following: - -1. Try and put double-backticks on words like ``True``, ``False``, ``None`` and the various - Phoenix constants (i.e., ``wx.TR_DEFAULT_STYLE``); -2. If you can't guess what a method function returns, just leave the ``:returns:`` and ``:rtype:`` - fields blank. - - -.. seealso:: `Sphinx Info Field List `_ - - -.. _admonitions: - -Admonitions ------------ - -Admonitions are specially marked "topics" that can appear anywhere an ordinary body element can. -They contain arbitrary body elements. Typically, an admonition is rendered as an offset block -in a document, sometimes outlined or shaded, with a title matching the admonition type. For example:: - - .. warning:: I am a warning. - - -Will render as: - -.. warning:: I am a warning. - -| - -Currently, the `sphinx_generator` tool recognizes the following admonitions: - -1. ``.. note::`` or ``:note:`` : simple annotations to make a particular comment/sentence - stand out against the rest of the documentation strings for a particular class, method or function; -2. ``.. warning::`` : this admonition normally indicates a problem or 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. - -You can put pretty much anything inside an admonition section, as long as it is properly indented. The -recommendation is to implement it like this:: - - .. note:: - - The class :ref:`TreeCtrl` can be used to display a tree, with these notes: - - - The note contains all indented body elements - following. - - It includes this bullet list. - - -| - -Which will render as follows: - -.. note:: - - The class :ref:`TreeCtrl` can be used to display a tree, with these notes: - - - The note contains all indented body elements - following. - - It includes this bullet list. - - - -In addition to the aforementioned admonitions, you can also use the default Sphinx directives -like ``.. versionadded::`` and ``.. versionchanged::``, to highlight the fact that some method, -function or class has been added/modified starting with a particular Phoenix version. - - -.. seealso:: `Sphinx Paragraph-level markup `_ - - -.. _contributing samples: - -Contributing Samples --------------------- - -.. highlight:: python - -If you wish to contribute a (short) sample to be included in the documentation, please follow -these conventions: - -1. Name the snippet of code like ``classname.methodname.INTEGER.py``, i.e. if you wish to contribute 2 - snippets about the :meth:`CheckBox.SetValue` method, please name your snippet files like this: - - * `CheckBox.SetValue.1.py` - * `CheckBox.SetValue.2.py` - - -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): - - self.AdjustMySize() - - - -.. highlight:: rst - -This snippet will end up in the snippets `contrib` folder, to differentiate it from the snippets -automatically generated when parsing the wxWidgets C++ XML documentation. - -Please keep the snippets as short as possible: they don't need to be fully-runnable and self contained -applications, they are simply meant to show a particular/clever/unusual way of using a method, a class -or a function. - -Please do send your sample snippets to me at `this `_ e-mail address or, if -you have commit rights in the current Phoenix SVN area, feel free to upload them yourself under the -following folder: - -``/trunk/docs/sphinx/rest_substitutions/snippets/python/contrib`` - - -.. _contributing screenshots: - -Contributing Screenshots ------------------------- - -Currently Phoenix is relatively short of widgets screenshots, 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, just use the - class name in lower case (i.e., `wx.Frame` ==> `frame.png`); -- If it belongs to a sub-namespace (i.e., `wx.dataview`, `wx.aui`, `wx.html` - and so on), it should be named this way (examples): - - 1) `wx.dataview.DataViewCtrl` ==> `dataview.dataviewctrl.png` - 2) `wx.aui.AuiManager` ==> `aui.auimanager.png` - - -Please do send your screenshots to me at `this `_ e-mail address or, if -you have commit rights in the current Phoenix SVN area, feel free to upload them yourself under the -following folder: - -``/trunk/docs/sphinx/_static/images/widgets/fullsize`` - -Please make sure to upload your images in the appropriate sub-folder, depending on the platform you -chose to take the screenshots on. - +.. include:: headings.inc + +.. highlight:: rst + + +.. _docstrings guidelines: + +================================================== +|phoenix_title| **Phoenix Docstrings Guidelines** +================================================== + +This document gives a brief introduction about the current docstrings standards +in the Phoenix project. Most of the documentation in the Phoenix core is automatically +generated by parsing the wxWidgets XML docs; however, Phoenix has its own pure-Python +functions and classes in at least two places: + +* **Core Library**: examples include :ref:`CallLater` and :func:`date2pydate`, which require + manual input of the documentation strings. This is achieved by editing the source Python files + located in the ``etg`` folder in the Phoenix directory tree; +* **wx.lib**: the whole of ``wx.lib`` (and its sub-folders) is made up of pure-Python modules, + ofter representing owner-drawn widgets which are not available as wrapped modules. Again, + this requires manual editing of the source Python files. + +This document is a starting point in setting some reasonable standards on how the pure-Python +docstrings may be edited and improved to make the overall appearance of the Phoenix documentation +consistent and pleasant. + + +.. _info field lists: + +Info Field Lists +---------------- + +`Info Field Lists` refer to the various options available while documenting a method or a function, +and in particular its parameters, keywords, return type and possibly raised Python `Exceptions`. + +Inside Python object description directives, reST field lists with 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. +* ``rtype``: Return type. + + +The field names must consist of one of these keywords and an argument (except +for ``returns`` and ``rtype``, which do not need an argument). This is best +explained by an example:: + + .. method:: Set3StateValue(self, state): + + Sets the checkbox item to the given `state`. + + :param `state`: can be one of: ``wx.CHK_UNCHECKED`` (check is off), ``wx.CHK_CHECKED`` + (check is on) or ``wx.CHK_UNDETERMINED`` (check is mixed). + :type `state`: integer + + :returns: ``True`` if the value was successfully set, ``False`` otherwise. + :rtype: bool + + :raise: `Exception` when the item is not a 3-state checkbox item. + +| + +This will render like this: + + .. method:: Set3StateValue(self, state): + :noindex: + + Sets the checkbox item to the given `state`. + + :param `state`: can be one of: ``wx.CHK_UNCHECKED`` (check is off), ``wx.CHK_CHECKED`` + (check is on) or ``wx.CHK_UNDETERMINED`` (check is mixed). + :type `state`: integer + + :returns: ``True`` if the value was successfully set, ``False`` otherwise. + :rtype: bool + + :raise: `Exception` when the item is not a 3-state checkbox item. + + +| + +It is also possible to combine parameter type and description, if the type is a +single word, like this:: + + :param integer `state`: can be one of: ``wx.CHK_UNCHECKED`` (check is off), ``wx.CHK_CHECKED`` + (check is on) or ``wx.CHK_UNDETERMINED`` (check is mixed). + + +In general, the standards for the ``:param`` field are the following: + +1. Do not use the ``@param`` construct, as I am not sure Sphinx and docutils understand it; +2. Always try and define the parameter type: if the parameter is another Phoenix class, you can simply + write this:: + + :param Point `pt`: the mouse pointer location. + + Or, alternatively:: + + :param `pt`: the mouse pointer location. + :type `pt`: `Point` + + +Similarly, for the ``:return:`` and ``:rtype:`` field, you may consider doing the following: + +1. Try and put double-backticks on words like ``True``, ``False``, ``None`` and the various + Phoenix constants (i.e., ``wx.TR_DEFAULT_STYLE``); +2. If you can't guess what a method function returns, just leave the ``:returns:`` and ``:rtype:`` + fields blank. + + +.. seealso:: `Sphinx Info Field List `_ + + +.. _admonitions: + +Admonitions +----------- + +Admonitions are specially marked "topics" that can appear anywhere an ordinary body element can. +They contain arbitrary body elements. Typically, an admonition is rendered as an offset block +in a document, sometimes outlined or shaded, with a title matching the admonition type. For example:: + + .. warning:: I am a warning. + + +Will render as: + +.. warning:: I am a warning. + +| + +Currently, the `sphinx_generator` tool recognizes the following admonitions: + +1. ``.. note::`` or ``:note:`` : simple annotations to make a particular comment/sentence + stand out against the rest of the documentation strings for a particular class, method or function; +2. ``.. warning::`` : this admonition normally indicates a problem or 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. + +You can put pretty much anything inside an admonition section, as long as it is properly indented. The +recommendation is to implement it like this:: + + .. note:: + + The class :ref:`TreeCtrl` can be used to display a tree, with these notes: + + - The note contains all indented body elements + following. + - It includes this bullet list. + + +| + +Which will render as follows: + +.. note:: + + The class :ref:`TreeCtrl` can be used to display a tree, with these notes: + + - The note contains all indented body elements + following. + - It includes this bullet list. + + + +In addition to the aforementioned admonitions, you can also use the default Sphinx directives +like ``.. versionadded::`` and ``.. versionchanged::``, to highlight the fact that some method, +function or class has been added/modified starting with a particular Phoenix version. + + +.. seealso:: `Sphinx Paragraph-level markup `_ + + +.. _contributing samples: + +Contributing Samples +-------------------- + +.. highlight:: python + +If you wish to contribute a (short) sample to be included in the documentation, please follow +these conventions: + +1. Name the snippet of code like ``classname.methodname.INTEGER.py``, i.e. if you wish to contribute 2 + snippets about the :meth:`CheckBox.SetValue` method, please name your snippet files like this: + + * `CheckBox.SetValue.1.py` + * `CheckBox.SetValue.2.py` + + +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): + + self.AdjustMySize() + + + +.. highlight:: rst + +This snippet will end up in the snippets `contrib` folder, to differentiate it from the snippets +automatically generated when parsing the wxWidgets C++ XML documentation. + +Please keep the snippets as short as possible: they don't need to be fully-runnable and self contained +applications, they are simply meant to show a particular/clever/unusual way of using a method, a class +or a function. + +Please do send your sample snippets to me at `this `_ e-mail address or, if +you have commit rights in the current Phoenix SVN area, feel free to upload them yourself under the +following folder: + +``/trunk/docs/sphinx/rest_substitutions/snippets/python/contrib`` + + +.. _contributing screenshots: + +Contributing Screenshots +------------------------ + +Currently Phoenix is relatively short of widgets screenshots, 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, just use the + class name in lower case (i.e., `wx.Frame` ==> `frame.png`); +- If it belongs to a sub-namespace (i.e., `wx.dataview`, `wx.aui`, `wx.html` + and so on), it should be named this way (examples): + + 1) `wx.dataview.DataViewCtrl` ==> `dataview.dataviewctrl.png` + 2) `wx.aui.AuiManager` ==> `aui.auimanager.png` + + +Please do send your screenshots to me at `this `_ e-mail address or, if +you have commit rights in the current Phoenix SVN area, feel free to upload them yourself under the +following folder: + +``/trunk/docs/sphinx/_static/images/widgets/fullsize`` + +Please make sure to upload your images in the appropriate sub-folder, depending on the platform you +chose to take the screenshots on. + diff --git a/docs/sphinx/rest_substitutions/overviews/app_overview.rst b/docs/sphinx/rest_substitutions/overviews/app_overview.rst index 5555a4ae..ef269b70 100644 --- a/docs/sphinx/rest_substitutions/overviews/app_overview.rst +++ b/docs/sphinx/rest_substitutions/overviews/app_overview.rst @@ -1,58 +1,58 @@ -.. include:: headings.inc - - -.. _app overview: - -================================= -|phoenix_title| **App Overview** -================================= - - -Introduction ------------- - -A wxPython application does not have a main procedure; the equivalent is the :meth:`AppConsole.OnInit` member defined for a class derived from :ref:`App`. - -`OnInit` will usually create a top window as a bare minimum. Unlike in earlier versions of wxPython, `OnInit` does not return a frame. -Instead it returns a boolean value which indicates whether processing should continue (``True``) or not (``False``). - -An application closes by destroying all windows. Because all frames must be destroyed for the application to exit, it is advisable to use -parent frames wherever possible when creating new frames, so that deleting the top level frame will automatically delete child frames. -The alternative is to explicitly delete child frames in the top-level frame's :ref:`CloseEvent` handler. - -In emergencies the :func:`Exit` function can be called to kill the application however normally the application shuts down automatically, -see :ref:`Application Shutdown `. - -An example of defining an application follows:: - - - class DerivedApp(wx.App): - - def OnInit(self): - - the_frame = wx.Frame(None, -1) - - # Other initialization code... - - the_frame.Show(True) - - return True - - - -.. _application shutdown: - -Application Shutdown --------------------- - -The application normally shuts down when the last of its top level windows is closed. This is normally the expected behaviour and means -that it is enough to call :meth:`Window.Close` () in response to the "Exit" menu command if your program has a single top level window. -If this behaviour is not desirable :meth:`PyApp.SetExitOnFrameDelete` can be called to change it. - -.. note:: Note that such logic doesn't apply for the windows shown before the program enters the main loop: in other words, you can - safely show a dialog from :meth:`AppConsole.OnInit` and not be afraid that your application terminates when this dialog -- which is the last - top level window for the moment -- is closed. - - -Another aspect of the application shutdown is :meth:`AppConsole.OnExit` which is called when the application exits but before wxPython cleans up -its internal structures. +.. include:: headings.inc + + +.. _app overview: + +================================= +|phoenix_title| **App Overview** +================================= + + +Introduction +------------ + +A wxPython application does not have a main procedure; the equivalent is the :meth:`AppConsole.OnInit` member defined for a class derived from :ref:`App`. + +`OnInit` will usually create a top window as a bare minimum. Unlike in earlier versions of wxPython, `OnInit` does not return a frame. +Instead it returns a boolean value which indicates whether processing should continue (``True``) or not (``False``). + +An application closes by destroying all windows. Because all frames must be destroyed for the application to exit, it is advisable to use +parent frames wherever possible when creating new frames, so that deleting the top level frame will automatically delete child frames. +The alternative is to explicitly delete child frames in the top-level frame's :ref:`CloseEvent` handler. + +In emergencies the :func:`Exit` function can be called to kill the application however normally the application shuts down automatically, +see :ref:`Application Shutdown `. + +An example of defining an application follows:: + + + class DerivedApp(wx.App): + + def OnInit(self): + + the_frame = wx.Frame(None, -1) + + # Other initialization code... + + the_frame.Show(True) + + return True + + + +.. _application shutdown: + +Application Shutdown +-------------------- + +The application normally shuts down when the last of its top level windows is closed. This is normally the expected behaviour and means +that it is enough to call :meth:`Window.Close` () in response to the "Exit" menu command if your program has a single top level window. +If this behaviour is not desirable :meth:`PyApp.SetExitOnFrameDelete` can be called to change it. + +.. note:: Note that such logic doesn't apply for the windows shown before the program enters the main loop: in other words, you can + safely show a dialog from :meth:`AppConsole.OnInit` and not be afraid that your application terminates when this dialog -- which is the last + top level window for the moment -- is closed. + + +Another aspect of the application shutdown is :meth:`AppConsole.OnExit` which is called when the application exits but before wxPython cleans up +its internal structures. diff --git a/docs/sphinx/rest_substitutions/overviews/bitmap_overview.rst b/docs/sphinx/rest_substitutions/overviews/bitmap_overview.rst index 6c27991b..e47a23af 100644 --- a/docs/sphinx/rest_substitutions/overviews/bitmap_overview.rst +++ b/docs/sphinx/rest_substitutions/overviews/bitmap_overview.rst @@ -1,103 +1,103 @@ -.. include:: headings.inc - - -.. _bitmaps and icons: - -=============================================== -|phoenix_title| **Bitmaps and Icons** -=============================================== - - -The :ref:`Bitmap` class encapsulates the concept of a platform-dependent bitmap, either monochrome or colour. -Platform-specific methods for creating a :ref:`Bitmap` object from an existing file are catered for. - -A bitmap created dynamically or loaded from a file can be selected into a memory device context (instance of -:ref:`MemoryDC`). This enables the bitmap to be copied to a window or memory device context using :meth:`DC.Blit` (), -or to be used as a drawing surface. - -.. seealso:: :ref:`MemoryDC` for an example of drawing onto a bitmap. - - -All wxPython platforms support XPMs for small bitmaps and icons. - - - -.. _supported bitmap file formats: - -Supported Bitmap File Formats ------------------------------ - -The following lists the formats handled on different platforms. Note that missing or partially-implemented -formats are automatically supplemented by using :ref:`Image` to load the data, and then converting it to :ref:`Bitmap` -form. Note that using :ref:`Image` is the preferred way to load images in wxPython, with the exception of resources -(XPM-files or native Windows resources). - - -Bitmap -^^^^^^ - -Under Windows, :ref:`Bitmap` may load the following formats: - -- Windows bitmap resource (``BITMAP_TYPE_BMP_RESOURCE``) -- Windows bitmap file (``BITMAP_TYPE_BMP``) -- XPM data and file (``BITMAP_TYPE_XPM``) -- All formats that are supported by the :ref:`Image` class. - - -Under wxGTK, :ref:`Bitmap` may load the following formats: - -- XPM data and file (``BITMAP_TYPE_XPM``) -- All formats that are supported by the :ref:`Image` class. - - -Under wxMotif and wxX11, :ref:`Bitmap` may load the following formats: - -- XBM data and file (``BITMAP_TYPE_XBM``) -- XPM data and file (``BITMAP_TYPE_XPM``) -- All formats that are supported by the :ref:`Image` class. - - -Icon -^^^^ - -Under Windows, :ref:`Icon` may load the following formats: - -- Windows icon resource (``BITMAP_TYPE_ICO_RESOURCE``) -- Windows icon file (``BITMAP_TYPE_ICO``) -- XPM data and file (``BITMAP_TYPE_XPM``) - - -Under wxGTK, :ref:`Icon` may load the following formats: - -- XPM data and file (``BITMAP_TYPE_XPM``) -- All formats that are supported by the :ref:`Image` class. - - -Under wxMotif and wxX11, :ref:`Icon` may load the following formats: - -- XBM data and file (``BITMAP_TYPE_XBM``) -- XPM data and file (``BITMAP_TYPE_XPM``) -- All formats that are supported by the :ref:`Image` class. - - -Cursor -^^^^^^ - -Under Windows, :ref:`Cursor` may load the following formats: - -- Windows cursor resource (``BITMAP_TYPE_CUR_RESOURCE``) -- Windows cursor file (``BITMAP_TYPE_CUR``) -- Windows icon file (``BITMAP_TYPE_ICO``) -- Windows bitmap file (``BITMAP_TYPE_BMP``) - - -Under wxGTK, :ref:`Cursor` may load the following formats (in addition to stock cursors): - -- None (stock cursors only). - - -Under wxMotif and wxX11, :ref:`Cursor` may load the following formats: - -- XBM data and file (``BITMAP_TYPE_XBM``) - - +.. include:: headings.inc + + +.. _bitmaps and icons: + +=============================================== +|phoenix_title| **Bitmaps and Icons** +=============================================== + + +The :ref:`Bitmap` class encapsulates the concept of a platform-dependent bitmap, either monochrome or colour. +Platform-specific methods for creating a :ref:`Bitmap` object from an existing file are catered for. + +A bitmap created dynamically or loaded from a file can be selected into a memory device context (instance of +:ref:`MemoryDC`). This enables the bitmap to be copied to a window or memory device context using :meth:`DC.Blit` (), +or to be used as a drawing surface. + +.. seealso:: :ref:`MemoryDC` for an example of drawing onto a bitmap. + + +All wxPython platforms support XPMs for small bitmaps and icons. + + + +.. _supported bitmap file formats: + +Supported Bitmap File Formats +----------------------------- + +The following lists the formats handled on different platforms. Note that missing or partially-implemented +formats are automatically supplemented by using :ref:`Image` to load the data, and then converting it to :ref:`Bitmap` +form. Note that using :ref:`Image` is the preferred way to load images in wxPython, with the exception of resources +(XPM-files or native Windows resources). + + +Bitmap +^^^^^^ + +Under Windows, :ref:`Bitmap` may load the following formats: + +- Windows bitmap resource (``BITMAP_TYPE_BMP_RESOURCE``) +- Windows bitmap file (``BITMAP_TYPE_BMP``) +- XPM data and file (``BITMAP_TYPE_XPM``) +- All formats that are supported by the :ref:`Image` class. + + +Under wxGTK, :ref:`Bitmap` may load the following formats: + +- XPM data and file (``BITMAP_TYPE_XPM``) +- All formats that are supported by the :ref:`Image` class. + + +Under wxMotif and wxX11, :ref:`Bitmap` may load the following formats: + +- XBM data and file (``BITMAP_TYPE_XBM``) +- XPM data and file (``BITMAP_TYPE_XPM``) +- All formats that are supported by the :ref:`Image` class. + + +Icon +^^^^ + +Under Windows, :ref:`Icon` may load the following formats: + +- Windows icon resource (``BITMAP_TYPE_ICO_RESOURCE``) +- Windows icon file (``BITMAP_TYPE_ICO``) +- XPM data and file (``BITMAP_TYPE_XPM``) + + +Under wxGTK, :ref:`Icon` may load the following formats: + +- XPM data and file (``BITMAP_TYPE_XPM``) +- All formats that are supported by the :ref:`Image` class. + + +Under wxMotif and wxX11, :ref:`Icon` may load the following formats: + +- XBM data and file (``BITMAP_TYPE_XBM``) +- XPM data and file (``BITMAP_TYPE_XPM``) +- All formats that are supported by the :ref:`Image` class. + + +Cursor +^^^^^^ + +Under Windows, :ref:`Cursor` may load the following formats: + +- Windows cursor resource (``BITMAP_TYPE_CUR_RESOURCE``) +- Windows cursor file (``BITMAP_TYPE_CUR``) +- Windows icon file (``BITMAP_TYPE_ICO``) +- Windows bitmap file (``BITMAP_TYPE_BMP``) + + +Under wxGTK, :ref:`Cursor` may load the following formats (in addition to stock cursors): + +- None (stock cursors only). + + +Under wxMotif and wxX11, :ref:`Cursor` may load the following formats: + +- XBM data and file (``BITMAP_TYPE_XBM``) + + diff --git a/docs/sphinx/rest_substitutions/overviews/bookctrl_overview.rst b/docs/sphinx/rest_substitutions/overviews/bookctrl_overview.rst index b8de5b28..5fe55248 100644 --- a/docs/sphinx/rest_substitutions/overviews/bookctrl_overview.rst +++ b/docs/sphinx/rest_substitutions/overviews/bookctrl_overview.rst @@ -1,48 +1,48 @@ -.. include:: headings.inc - - -.. _bookctrl overview: - -=============================================== -|phoenix_title| **BookCtrl Overview** -=============================================== - - -Introduction ------------- - -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:`Choicebook`: controlled by a :ref:`Choice` -- :ref:`Listbook`: controlled by a :ref:`ListCtrl` -- :ref:`Notebook`: uses a row of tabs -- :ref:`Treebook`: controlled by a :ref:`TreeCtrl` -- :ref:`Toolbook`: controlled by a :ref:`ToolBar` - - - -Best Book ---------- - -:ref:`BookCtrl` is mapped to the class best suited for a given platform. Currently it provides :ref:`Choicebook` -for smartphones equipped with WinCE, and :ref:`Notebook` for all other platforms. The mapping consists of: - -=============================================== ================================================== -`BookCtrl` `Choicebook` or `Notebook` -=============================================== ================================================== -``wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED`` ``wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED`` or ``wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED`` -``wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING`` ``wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING`` or ``wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING`` -EVT_BOOKCTRL_PAGE_CHANGED EVT_CHOICEBOOK_PAGE_CHANGED or EVT_NOTEBOOK_PAGE_CHANGED -EVT_BOOKCTRL_PAGE_CHANGING EVT_CHOICEBOOK_PAGE_CHANGING or EVT_NOTEBOOK_PAGE_CHANGING -=============================================== ================================================== - - -For orientation of the book controller, use following flags in style: - -- ``BK_TOP``: controller above pages -- ``BK_BOTTOM``: controller below pages -- ``BK_LEFT``: controller on the left -- ``BK_RIGHT``: controller on the right -- ``BK_DEFAULT``: native controller placement - +.. include:: headings.inc + + +.. _bookctrl overview: + +=============================================== +|phoenix_title| **BookCtrl Overview** +=============================================== + + +Introduction +------------ + +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:`Choicebook`: controlled by a :ref:`Choice` +- :ref:`Listbook`: controlled by a :ref:`ListCtrl` +- :ref:`Notebook`: uses a row of tabs +- :ref:`Treebook`: controlled by a :ref:`TreeCtrl` +- :ref:`Toolbook`: controlled by a :ref:`ToolBar` + + + +Best Book +--------- + +:ref:`BookCtrl` is mapped to the class best suited for a given platform. Currently it provides :ref:`Choicebook` +for smartphones equipped with WinCE, and :ref:`Notebook` for all other platforms. The mapping consists of: + +=============================================== ================================================== +`BookCtrl` `Choicebook` or `Notebook` +=============================================== ================================================== +``wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED`` ``wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED`` or ``wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED`` +``wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING`` ``wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING`` or ``wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING`` +EVT_BOOKCTRL_PAGE_CHANGED EVT_CHOICEBOOK_PAGE_CHANGED or EVT_NOTEBOOK_PAGE_CHANGED +EVT_BOOKCTRL_PAGE_CHANGING EVT_CHOICEBOOK_PAGE_CHANGING or EVT_NOTEBOOK_PAGE_CHANGING +=============================================== ================================================== + + +For orientation of the book controller, use following flags in style: + +- ``BK_TOP``: controller above pages +- ``BK_BOTTOM``: controller below pages +- ``BK_LEFT``: controller on the left +- ``BK_RIGHT``: controller on the right +- ``BK_DEFAULT``: native controller placement + diff --git a/docs/sphinx/rest_substitutions/overviews/common_dialogs_overview.rst b/docs/sphinx/rest_substitutions/overviews/common_dialogs_overview.rst index 09a33c72..bacdd2ff 100644 --- a/docs/sphinx/rest_substitutions/overviews/common_dialogs_overview.rst +++ b/docs/sphinx/rest_substitutions/overviews/common_dialogs_overview.rst @@ -1,226 +1,226 @@ -.. include:: headings.inc - - -.. _common dialogs: - -=============================================== -|phoenix_title| **Common Dialogs** -=============================================== - - -Common dialog classes and functions encapsulate commonly-needed dialog box requirements. They are all 'modal', -grabbing the flow of control until the user dismisses the dialog, to make them easy to use within an application. - -Some dialogs have both platform-dependent and platform-independent implementations, so that if underlying windowing -systems do not provide the required functionality, the generic classes and functions can stand in. For example, -under MS Windows, :ref:`ColourDialog` uses the standard colour selector. There is also an equivalent called -`GenericColourDialog` for other platforms, and a macro defines :ref:`ColourDialog` to be the same as -`GenericColourDialog` on non-MS Windows platforms. However, under MS Windows, the generic dialog can also be used, -for testing or other purposes. - - - -.. _colourdialog overview: - -ColourDialog Overview ---------------------- - -The :ref:`ColourDialog` presents a colour selector to the user, and returns with colour information. - - -The MS Windows Colour Selector -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Under Windows, the native colour selector common dialog is used. This presents a dialog box with three main regions: -at the top left, a palette of 48 commonly-used colours is shown. Under this, there is a palette of 16 'custom colours' -which can be set by the application if desired. Additionally, the user may open up the dialog box to show a right-hand -panel containing controls to select a precise colour, and add it to the custom colour palette. - - -The Generic Colour Selector -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Under non-MS Windows platforms, the colour selector is a simulation of most of the features of the MS Windows selector. -Two palettes of 48 standard and 16 custom colours are presented, with the right-hand area containing three sliders for -the user to select a colour from red, green and blue components. This colour may be added to the custom colour palette, -and will replace either the currently selected custom colour, or the first one in the palette if none is selected. -The RGB colour sliders are not optional in the generic colour selector. The generic colour selector is also available -under MS Windows; use the name `GenericColourDialog`. - - -Example -^^^^^^^ - -Here is an example of using :ref:`ColourDialog`, which sets various parameters of a :ref:`ColourData` object, including -a grey scale for the custom colours. If the user did not cancel the dialog, the application retrieves the selected colour -and uses it to set the 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) - - - dialog = wx.ColourDialog(self, data) - - if dialog.ShowModal() == wx.ID_OK: - - retData = dialog.GetColourData() - col = retData.GetColour() - brush = wx.Brush(col, wx.SOLID) - myWindow.SetBackground(brush) - myWindow.Clear() - myWindow.Refresh() - - - - -.. _fontdialog overview: - -FontDialog Overview -------------------- - - -The :ref:`FontDialog` presents a font selector to the user, and returns with font and colour information. - - -The MS Windows Font Selector -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Under Windows, the native font selector common dialog is used. This presents a dialog box with controls for font name, -point size, style, weight, underlining, strikeout and text foreground colour. A sample of the font is shown on a white -area of the dialog box. Note that in the translation from full MS Windows fonts to wxPython font conventions, strikeout -is ignored and a font family (such as Swiss or Modern) is deduced from the actual font name (such as Arial or Courier). - - -The Generic Font Selector -^^^^^^^^^^^^^^^^^^^^^^^^^ - -Under non-MS Windows platforms, the font selector is simpler. Controls for font family, point size, style, weight, -underlining and text foreground colour are provided, and a sample is shown upon a white background. The generic font -selector is also available under MS Windows; use the name `GenericFontDialog`. - - -Example -^^^^^^^ - -Here is an example of using :ref:`FontDialog`. The application uses the returned font and colour for drawing text on a canvas:: - - data = wx.FontData() - data.SetInitialFont(canvasFont) - data.SetColour(canvasTextColour) - - dialog = wx.FontDialog(self, data) - - if dialog.ShowModal() == wx.ID_OK: - - retData = dialog.GetFontData() - canvasFont = retData.GetChosenFont() - canvasTextColour = retData.GetColour() - myWindow.Refresh() - - - - -.. _printdialog overview: - -PrintDialog Overview --------------------- - - -This class represents the print and print setup common dialogs. You may obtain a :ref:`PrinterDC` device context from a -successfully dismissed print dialog. - -.. seealso:: :ref:`Printing Framework Overview ` for an example. - - - -.. _filedialog overview: - -FileDialog Overview -------------------- - - -Pops up a file selector box. On Windows and GTK 2.4+, this is the common file selector dialog. In X, this is a file -selector box with somewhat less functionality. The path and filename are distinct elements of a full file pathname. - -If path is "", the current directory will be used. If filename is "", no default filename will be supplied. -The wildcard determines what files are displayed in the file selector, and file extension supplies a type extension -for the required filename. Flags may be a combination of ``FD_OPEN``, ``FD_SAVE``, ``FD_OVERWRITE_PROMPT``, -``FD_HIDE_READONLY``, ``FD_FILE_MUST_EXIST``, ``FD_MULTIPLE``, ``FD_CHANGE_DIR`` or 0. - -Both the X and Windows versions implement a wildcard filter. Typing a filename containing wildcards ``(*, ?)`` in the -filename text item, and clicking on Ok, will result in only those files matching the pattern being displayed. In the -X version, supplying no default name will result in the wildcard filter being inserted in the filename text item; -the filter is ignored if a default name is supplied. - -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. - - - -.. _textentrydialog overview: - -TextEntryDialog Overview ------------------------- - - -This is a dialog with a text entry field. The value that the user entered is obtained using :meth:`TextEntryDialog.GetValue` (). - - - -.. _passwordentrydialog overview: - -PasswordEntryDialog Overview ----------------------------- - - -This is a dialog with a password entry field. The value that the user entered is obtained using :meth:`TextEntryDialog.GetValue` (). - - - -.. _messagedialog overview: - -MessageDialog Overview ----------------------- - - -This dialog shows a message, plus buttons that can be chosen from ``OK``, ``Cancel``, ``Yes``, and ``No``. Under Windows, an -optional icon can be shown, such as an exclamation mark or question mark. - -The return value of :meth:`MessageDialog.ShowModal` () indicates which button the user pressed. - - - -.. _singlechoicedialog overview: - -SingleChoiceDialog Overview ---------------------------- - - -This dialog shows a list of choices, plus ``OK`` and (optionally) ``Cancel``. The user can select one of them. The selection -can be obtained from the dialog as an index, a string or client data. - - - -.. _multichoicedialog overview: - -MultiChoiceDialog Overview ---------------------------- - - -This dialog shows a list of choices, plus ``OK`` and (optionally) ``Cancel``. The user can select one or more of them. - +.. include:: headings.inc + + +.. _common dialogs: + +=============================================== +|phoenix_title| **Common Dialogs** +=============================================== + + +Common dialog classes and functions encapsulate commonly-needed dialog box requirements. They are all 'modal', +grabbing the flow of control until the user dismisses the dialog, to make them easy to use within an application. + +Some dialogs have both platform-dependent and platform-independent implementations, so that if underlying windowing +systems do not provide the required functionality, the generic classes and functions can stand in. For example, +under MS Windows, :ref:`ColourDialog` uses the standard colour selector. There is also an equivalent called +`GenericColourDialog` for other platforms, and a macro defines :ref:`ColourDialog` to be the same as +`GenericColourDialog` on non-MS Windows platforms. However, under MS Windows, the generic dialog can also be used, +for testing or other purposes. + + + +.. _colourdialog overview: + +ColourDialog Overview +--------------------- + +The :ref:`ColourDialog` presents a colour selector to the user, and returns with colour information. + + +The MS Windows Colour Selector +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Under Windows, the native colour selector common dialog is used. This presents a dialog box with three main regions: +at the top left, a palette of 48 commonly-used colours is shown. Under this, there is a palette of 16 'custom colours' +which can be set by the application if desired. Additionally, the user may open up the dialog box to show a right-hand +panel containing controls to select a precise colour, and add it to the custom colour palette. + + +The Generic Colour Selector +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Under non-MS Windows platforms, the colour selector is a simulation of most of the features of the MS Windows selector. +Two palettes of 48 standard and 16 custom colours are presented, with the right-hand area containing three sliders for +the user to select a colour from red, green and blue components. This colour may be added to the custom colour palette, +and will replace either the currently selected custom colour, or the first one in the palette if none is selected. +The RGB colour sliders are not optional in the generic colour selector. The generic colour selector is also available +under MS Windows; use the name `GenericColourDialog`. + + +Example +^^^^^^^ + +Here is an example of using :ref:`ColourDialog`, which sets various parameters of a :ref:`ColourData` object, including +a grey scale for the custom colours. If the user did not cancel the dialog, the application retrieves the selected colour +and uses it to set the 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) + + + dialog = wx.ColourDialog(self, data) + + if dialog.ShowModal() == wx.ID_OK: + + retData = dialog.GetColourData() + col = retData.GetColour() + brush = wx.Brush(col, wx.SOLID) + myWindow.SetBackground(brush) + myWindow.Clear() + myWindow.Refresh() + + + + +.. _fontdialog overview: + +FontDialog Overview +------------------- + + +The :ref:`FontDialog` presents a font selector to the user, and returns with font and colour information. + + +The MS Windows Font Selector +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Under Windows, the native font selector common dialog is used. This presents a dialog box with controls for font name, +point size, style, weight, underlining, strikeout and text foreground colour. A sample of the font is shown on a white +area of the dialog box. Note that in the translation from full MS Windows fonts to wxPython font conventions, strikeout +is ignored and a font family (such as Swiss or Modern) is deduced from the actual font name (such as Arial or Courier). + + +The Generic Font Selector +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Under non-MS Windows platforms, the font selector is simpler. Controls for font family, point size, style, weight, +underlining and text foreground colour are provided, and a sample is shown upon a white background. The generic font +selector is also available under MS Windows; use the name `GenericFontDialog`. + + +Example +^^^^^^^ + +Here is an example of using :ref:`FontDialog`. The application uses the returned font and colour for drawing text on a canvas:: + + data = wx.FontData() + data.SetInitialFont(canvasFont) + data.SetColour(canvasTextColour) + + dialog = wx.FontDialog(self, data) + + if dialog.ShowModal() == wx.ID_OK: + + retData = dialog.GetFontData() + canvasFont = retData.GetChosenFont() + canvasTextColour = retData.GetColour() + myWindow.Refresh() + + + + +.. _printdialog overview: + +PrintDialog Overview +-------------------- + + +This class represents the print and print setup common dialogs. You may obtain a :ref:`PrinterDC` device context from a +successfully dismissed print dialog. + +.. seealso:: :ref:`Printing Framework Overview ` for an example. + + + +.. _filedialog overview: + +FileDialog Overview +------------------- + + +Pops up a file selector box. On Windows and GTK 2.4+, this is the common file selector dialog. In X, this is a file +selector box with somewhat less functionality. The path and filename are distinct elements of a full file pathname. + +If path is "", the current directory will be used. If filename is "", no default filename will be supplied. +The wildcard determines what files are displayed in the file selector, and file extension supplies a type extension +for the required filename. Flags may be a combination of ``FD_OPEN``, ``FD_SAVE``, ``FD_OVERWRITE_PROMPT``, +``FD_HIDE_READONLY``, ``FD_FILE_MUST_EXIST``, ``FD_MULTIPLE``, ``FD_CHANGE_DIR`` or 0. + +Both the X and Windows versions implement a wildcard filter. Typing a filename containing wildcards ``(*, ?)`` in the +filename text item, and clicking on Ok, will result in only those files matching the pattern being displayed. In the +X version, supplying no default name will result in the wildcard filter being inserted in the filename text item; +the filter is ignored if a default name is supplied. + +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. + + + +.. _textentrydialog overview: + +TextEntryDialog Overview +------------------------ + + +This is a dialog with a text entry field. The value that the user entered is obtained using :meth:`TextEntryDialog.GetValue` (). + + + +.. _passwordentrydialog overview: + +PasswordEntryDialog Overview +---------------------------- + + +This is a dialog with a password entry field. The value that the user entered is obtained using :meth:`TextEntryDialog.GetValue` (). + + + +.. _messagedialog overview: + +MessageDialog Overview +---------------------- + + +This dialog shows a message, plus buttons that can be chosen from ``OK``, ``Cancel``, ``Yes``, and ``No``. Under Windows, an +optional icon can be shown, such as an exclamation mark or question mark. + +The return value of :meth:`MessageDialog.ShowModal` () indicates which button the user pressed. + + + +.. _singlechoicedialog overview: + +SingleChoiceDialog Overview +--------------------------- + + +This dialog shows a list of choices, plus ``OK`` and (optionally) ``Cancel``. The user can select one of them. The selection +can be obtained from the dialog as an index, a string or client data. + + + +.. _multichoicedialog overview: + +MultiChoiceDialog Overview +--------------------------- + + +This dialog shows a list of choices, plus ``OK`` and (optionally) ``Cancel``. The user can select one or more of them. + diff --git a/docs/sphinx/rest_substitutions/overviews/config_overview.rst b/docs/sphinx/rest_substitutions/overviews/config_overview.rst index 8eaf07a9..0833b4eb 100644 --- a/docs/sphinx/rest_substitutions/overviews/config_overview.rst +++ b/docs/sphinx/rest_substitutions/overviews/config_overview.rst @@ -1,44 +1,44 @@ -.. include:: headings.inc - - -.. _config overview: - -================================================= -|phoenix_title| **Config Overview** -================================================= - - -This overview briefly describes what the config classes are and what they are for. All the details about -how to use them may be found in the description of the :ref:`ConfigBase` class and the documentation of -the file, registry and INI file based implementations mentions all the features/limitations specific to -each one of these versions. - -The config classes provide a way to store some application configuration information. They were especially -designed for this usage and, although may probably be used for many other things as well, should be limited -to it. It means that this information should be: - -- Typed, i.e. strings or numbers for the moment. You cannot store binary data, for example. -- Small. For instance, it is not recommended to use the Windows registry for amounts of data more than a couple of kilobytes. -- Not performance critical, neither from speed nor from a memory consumption point of view. - - -On the other hand, the features provided make them very useful for storing all kinds of small to medium volumes -of hierarchically-organized, heterogeneous data. In short, this is a place where you can conveniently stuff -all your data (numbers and strings) organizing it in a tree where you use the filesystem-like paths to -specify the location of a piece of data. In particular, these classes were designed to be as easy to use as possible. - -From another point of view, they provide an interface which hides the differences between the Windows registry -and the standard Unix text format configuration files. Other (future) implementations of :ref:`ConfigBase` might -also understand GTK resource files or their analogues on the KDE side. - -In any case, each implementation of :ref:`ConfigBase` does its best to make the data look the same way everywhere. -Due to limitations of the underlying physical storage, it may not implement 100% of the base class functionality. - -There are groups of entries and the entries themselves. Each entry contains either a string or a number (or a -boolean value; support for other types of data such as dates or timestamps is planned) and is identified by -the full path to it: something like ``/MyApp/UserPreferences/Colors/Foreground``. - -The previous elements in the path are the group names, and each name may contain an arbitrary number of entries and subgroups. - -The path components are always separated with a slash, even though some implementations use the backslash internally. -Further details (including how to read/write these entries) may be found in the documentation for :ref:`ConfigBase`. +.. include:: headings.inc + + +.. _config overview: + +================================================= +|phoenix_title| **Config Overview** +================================================= + + +This overview briefly describes what the config classes are and what they are for. All the details about +how to use them may be found in the description of the :ref:`ConfigBase` class and the documentation of +the file, registry and INI file based implementations mentions all the features/limitations specific to +each one of these versions. + +The config classes provide a way to store some application configuration information. They were especially +designed for this usage and, although may probably be used for many other things as well, should be limited +to it. It means that this information should be: + +- Typed, i.e. strings or numbers for the moment. You cannot store binary data, for example. +- Small. For instance, it is not recommended to use the Windows registry for amounts of data more than a couple of kilobytes. +- Not performance critical, neither from speed nor from a memory consumption point of view. + + +On the other hand, the features provided make them very useful for storing all kinds of small to medium volumes +of hierarchically-organized, heterogeneous data. In short, this is a place where you can conveniently stuff +all your data (numbers and strings) organizing it in a tree where you use the filesystem-like paths to +specify the location of a piece of data. In particular, these classes were designed to be as easy to use as possible. + +From another point of view, they provide an interface which hides the differences between the Windows registry +and the standard Unix text format configuration files. Other (future) implementations of :ref:`ConfigBase` might +also understand GTK resource files or their analogues on the KDE side. + +In any case, each implementation of :ref:`ConfigBase` does its best to make the data look the same way everywhere. +Due to limitations of the underlying physical storage, it may not implement 100% of the base class functionality. + +There are groups of entries and the entries themselves. Each entry contains either a string or a number (or a +boolean value; support for other types of data such as dates or timestamps is planned) and is identified by +the full path to it: something like ``/MyApp/UserPreferences/Colors/Foreground``. + +The previous elements in the path are the group names, and each name may contain an arbitrary number of entries and subgroups. + +The path components are always separated with a slash, even though some implementations use the backslash internally. +Further details (including how to read/write these entries) may be found in the documentation for :ref:`ConfigBase`. diff --git a/docs/sphinx/rest_substitutions/overviews/datetime_overview.rst b/docs/sphinx/rest_substitutions/overviews/datetime_overview.rst index 2c3d3908..13675878 100644 --- a/docs/sphinx/rest_substitutions/overviews/datetime_overview.rst +++ b/docs/sphinx/rest_substitutions/overviews/datetime_overview.rst @@ -1,166 +1,166 @@ -.. include:: headings.inc - - -.. _date and time: - -=========================================== -|phoenix_title| **Date and Time Overview** -=========================================== - -Introduction ------------- - -wxPython provides a set of powerful classes to work with dates and times. Some of the supported features of :ref:`DateTime` class are: - -* Wide range: the range of supported dates goes from about 4714 B.C. to some 480 million years in the future. -* Precision: not using floating point calculations anywhere ensures that the date calculations don't suffer from rounding errors. -* Many features: not only all usual calculations with dates are supported, but also more exotic week and year day calculations, - work day testing, standard astronomical functions, conversion to and from strings in either strict or free format. -* Efficiency: objects of :ref:`DateTime` are small (8 bytes) and working with them is fast. - - - -All date/time classes at a glance ---------------------------------- - -There are 3 main classes related to date and time: except :ref:`DateTime` itself which represents an absolute moment in time, -there are also two classes - :ref:`TimeSpan` and :ref:`DateSpan` - which represent the intervals of time. - - - -DateTime characteristics ------------------------- - -:ref:`DateTime` stores the time as a signed number of milliseconds since the Epoch which is fixed, by convention, to Jan 1, 1970 - however -this is not visible to the class users (in particular, dates prior to the Epoch are handled just as well (or as bad) as the dates after it). -But it does mean that the best resolution which can be achieved with this class is 1 millisecond. - -The size of :ref:`DateTime` object is 8 bytes because it is represented as a 64 bit integer. The resulting range of supported dates is -thus approximatively 580 million years, but due to the current limitations in the Gregorian calendar support, only dates from Nov 24, 4714BC -are supported (this is subject to change if there is sufficient interest in doing it). - -Finally, the internal representation is time zone independent (always in GMT) and the time zones only come into play when a date is broken -into year/month/day components. See more about timezones below (see :ref:`Time zone considerations