diff --git a/buildtools/config.py b/buildtools/config.py index f2b32a1f..850c0552 100644 --- a/buildtools/config.py +++ b/buildtools/config.py @@ -18,12 +18,15 @@ import fnmatch import tempfile import commands import shutil +import codecs from distutils.file_util import copy_file from distutils.dir_util import mkpath from distutils.dep_util import newer from distutils.spawn import spawn +reload(sys) +sys.setdefaultencoding('utf-8') runSilently = False @@ -626,11 +629,15 @@ def writeIfChanged(filename, text): the content is different (therefore preserving the timestamp if there is no update.) """ - text = str(text) + if os.path.exists(filename): - current = open(filename, 'rt').read() + fid = codecs.open(filename, 'r', 'utf-8') + current = fid.read() + fid.close() + if current == text: return - f = open(filename, 'wt') - f.write(text) + + f = codecs.open(filename, 'w', 'utf-8') + f.write(text.encode('utf-8')) f.close() diff --git a/docs/MigrationGuide.txt b/docs/MigrationGuide.txt index 66167efd..5a7f865c 100644 --- a/docs/MigrationGuide.txt +++ b/docs/MigrationGuide.txt @@ -232,7 +232,7 @@ your application when you use py2exe or other executable builder. wx.ListCtrl ----------- -* In wx.ListItem and wx.ListEvent the "m_" properties are no longer +* In wx.ListItem and wx.ListEvent the ``"m_"`` properties are no longer public. Instead use the associated getter/setter methods or the auto-generated properties that are using them. diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxgtk/listctrl.png b/docs/sphinx/_static/images/widgets/fullsize/wxgtk/listctrl.png new file mode 100644 index 00000000..f0a0bd63 Binary files /dev/null and b/docs/sphinx/_static/images/widgets/fullsize/wxgtk/listctrl.png differ diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxgtk/listview.png b/docs/sphinx/_static/images/widgets/fullsize/wxgtk/listview.png new file mode 100644 index 00000000..b42c6f2b Binary files /dev/null and b/docs/sphinx/_static/images/widgets/fullsize/wxgtk/listview.png differ diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxmac/listctrl.png b/docs/sphinx/_static/images/widgets/fullsize/wxmac/listctrl.png new file mode 100644 index 00000000..aa312389 Binary files /dev/null and b/docs/sphinx/_static/images/widgets/fullsize/wxmac/listctrl.png differ diff --git a/docs/sphinx/_static/images/widgets/fullsize/wxmsw/listctrl.png b/docs/sphinx/_static/images/widgets/fullsize/wxmsw/listctrl.png new file mode 100644 index 00000000..77cc6eb0 Binary files /dev/null and b/docs/sphinx/_static/images/widgets/fullsize/wxmsw/listctrl.png differ diff --git a/docs/sphinx/_static/javascript/sidebar.js b/docs/sphinx/_static/javascript/sidebar.js new file mode 100644 index 00000000..057f741f --- /dev/null +++ b/docs/sphinx/_static/javascript/sidebar.js @@ -0,0 +1,213 @@ +/* + * sidebar.js + * ~~~~~~~~~~ + * + * This script makes the Sphinx sidebar collapsible and moveable. + * + * .sphinxsidebar contains .sphinxsidebarwrapper. The script adds + * in .sphixsidebar, after .sphinxsidebarwrapper, the #sidebarbutton + * used to collapse, expand and move the sidebar. + * + * The script saves per-browser/per-session cookies used to remember + * the collapsed state and position of the sidebar among the pages. + * Once the browser is closed the cookies are deleted and the position + * reset to the default set in the style sheed. + * + * Modifications and improvements made 2010 by Christoph Zwerschke. + * + * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +$(function() { + var body = $('div.document'); + var body_width = body.width(); + var footer = $('div.footer'); + var sidebar = $('div.sphinxsidebar'); + var sidebarwrapper = $('div.sphinxsidebarwrapper'); + var sidebarbutton = $('
'); + var sbw_width = sidebar.width(); + var sbb_width = 9; + var dark_color = $('div.related').css('background-color'); + var light_color = sidebarwrapper.css('color'); + var opacity_factor = $.browser.msie ? 1 : 0.75; + var collapsed = sidebarwrapper.is(':not(:visible)'); + var rightside = sidebar.css('right') == '0px'; + var dragging = null; + + function set_sidebar() { + var width = collapsed ? 0 : sbw_width; + if (rightside) { + sidebar.css({ + 'width': width, + 'left': 'auto', + 'right': 0 + }); + sidebarbutton.css({ + 'right': collapsed ? 0 : width, + 'left': 'auto' + }); + body.add(footer).css({ + 'margin-right': width + sbb_width, + 'margin-left': 0 + }); + } else { + sidebar.css({ + 'width': width, + 'right': 'auto', + 'left': '0' + }); + sidebarbutton.css({ + 'left': collapsed ? 0 : width, + 'right': 'auto' + }); + body.add(footer).css({ + 'margin-left': width + sbb_width, + 'margin-right': 0 + }); + } + sidebarbutton.find('div').text(rightside == collapsed ? '«' : '»'); + } + + function toggle_sidebar() { + collapsed ? expand_sidebar() : collapse_sidebar(); + } + + function collapse_sidebar() { + collapsed = true; + sidebarwrapper.hide(); + set_sidebar(); + sidebarbutton.attr('title', _('Expand sidebar')); + document.cookie = 'sidebar_collapsed=1'; + } + + function expand_sidebar() { + collapsed = false; + sidebarwrapper.show(); + set_sidebar(); + sidebarbutton.attr('title', _('Collapse sidebar')); + document.cookie = 'sidebar_collapsed=0'; + } + + function add_sidebar_button() { + sidebar.css('width', (collapsed ? 0 : sbw_width) + sbb_width); + sidebarbutton.attr('title', _('Collapse sidebar')); + sidebarbutton.css({ + 'color': light_color, + 'font-size': 14, + 'text-align': 'center', + 'border-left': '1px solid ' + dark_color, + 'border-right': '1px solid ' + dark_color, + 'padding': '1px 0', + 'margin': '0', + 'width': sbb_width - 2, + 'cursor': 'pointer', + 'position': 'fixed', + 'left': collapsed ? 0 : sbw_width, + 'top': sidebar.css('top'), + 'bottom': 0 + }); + sidebarbutton.find('div').css({ + 'position': 'relative', + 'top': '50%', + 'margin-top': -8 + }); + set_sidebar(); + sidebarbutton.hover( + function() { + sidebarbutton.css('background-color', dark_color); + }, + function() { + sidebarbutton.css('background-color', light_color); + } + ); + sidebarbutton.mousedown( + function(e) { + if (dragging != null || e.which != 1) return; + dragging = { + 'dragged': false, + 'pageX': e.pageX + }; + sidebarbutton.css('cursor', 'move'); + } + ); + sidebar.add(body).mouseup( + function(e) { + if (dragging == null) + return; + e.preventDefault(); + if (dragging.dragged) { + var left = sidebar.offset().left; + if (rightside) + left = body_width - left; + if (left < 0 && !collapsed) + collapse_sidebar(); + else if (left < body_width / 2 && + left < sbw_width + 2 * sbw_width && collapsed) + expand_sidebar(); + else { + if (left > body_width / 2) + rightside = !rightside; + set_sidebar(); + } + if (opacity_factor != 1) + sidebar.css('opacity', dragging.opacity); + document.cookie = 'sidebar_rightside=' + (rightside ? '1' : '0'); + } else + toggle_sidebar(); + sidebarbutton.css('cursor', 'pointer'); + dragging = null; + e.stopPropagation(); + } + ); + sidebar.add(body).mousemove( + function(e) { + if (dragging == null) + return; + e.preventDefault(); + var pageX = e.pageX; + side = 'left'; + sidebarbutton.css('left', pageX); + if (rightside) + pageX += sbb_width; + else + pageX -= sbw_width; + sidebar.css('left', pageX); + if (!dragging.dragged) { + dragging.dragged = true; + if (collapsed) { + sidebar.css('width', sbw_width); + sidebarwrapper.show(); + } + if (opacity_factor != 1) { + dragging.opacity = sidebar.css('opacity'); + sidebar.css('opacity', opacity_factor * dragging.opacity); + } + } + e.stopPropagation(); + } + ); + sidebar.append(sidebarbutton); + light_color = sidebarbutton.css('background-color'); + } + + function set_position_from_cookie() { + if (!document.cookie) + return; + var items = document.cookie.split(';'); + for (var k = 0; k < items.length; k++) { + var key_val = items[k].split('='); + var key = $.trim(key_val[0]); + var val = $.trim(key_val[1]); + if (key == 'sidebar_collapsed') + collapsed = val == '1'; + else if (key == 'sidebar_rightside') + rightside = val == '1'; + } + } + + set_position_from_cookie(); + if (sidebar.length) + add_sidebar_button(); +}); diff --git a/docs/sphinx/rest_substitutions/overviews/internationalization.rst b/docs/sphinx/rest_substitutions/overviews/internationalization.rst new file mode 100644 index 00000000..0e8d9f76 --- /dev/null +++ b/docs/sphinx/rest_substitutions/overviews/internationalization.rst @@ -0,0 +1,14 @@ +.. include:: headings.inc + + +.. _internationalization: + +================================================== +|phoenix_title| **Internationalization Overview** +================================================== + +.. todo:: Write this section. + + + + diff --git a/docs/sphinx/rest_substitutions/overviews/listctrl_overview.rst b/docs/sphinx/rest_substitutions/overviews/listctrl_overview.rst new file mode 100644 index 00000000..5afac1b9 --- /dev/null +++ b/docs/sphinx/rest_substitutions/overviews/listctrl_overview.rst @@ -0,0 +1,14 @@ +.. include:: headings.inc + + +.. _listctrl overview: + +=============================================== +|phoenix_title| **ListCtrl Overview** +=============================================== + +.. todo:: Write this section. + + + + diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/AboutDialogInfo.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/AboutDialogInfo.1.py new file mode 100644 index 00000000..861b5428 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/AboutDialogInfo.1.py @@ -0,0 +1,13 @@ + + def OnAbout(self, event): + + aboutInfo = wx.AboutDialogInfo() + aboutInfo.SetName("MyApp") + aboutInfo.SetVersion(MY_APP_VERSION_STRING) + aboutInfo.SetDescription(_("My wxPython-based application!")) + aboutInfo.SetCopyright("(C) 1992-2012") + aboutInfo.SetWebSite("http:#myapp.org") + aboutInfo.AddDeveloper("My Self") + + wx.AboutBox(aboutInfo) + diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/InfoBar.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/InfoBar.1.py new file mode 100644 index 00000000..b356f5c7 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/InfoBar.1.py @@ -0,0 +1,20 @@ + + class MyFrame(wx.Frame): + + def __init__(self, parent): + + wx.Frame.__init__(self, parent, title='InfoBar!') + + self.infoBar = wx.InfoBar(self) + + sizer = wx.BoxSizer(wx.VERTICAL) + sizer.Add(self.infoBar, wx.SizerFlags().Expand()) + + # ... add other frame controls to the sizer ... + self.SetSizer(sizer) + + + def SomeMethod(self): + + self.infoBar.ShowMessage("Something happened", wx.ICON_INFORMATION) + diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/ListCtrl.GetNextItem.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/ListCtrl.GetNextItem.1.py new file mode 100644 index 00000000..33de5e80 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/ListCtrl.GetNextItem.1.py @@ -0,0 +1,13 @@ + + item = -1 + + while 1: + item = listctrl.GetNextItem(item, + wx.LIST_NEXT_ALL, + wx.LIST_STATE_SELECTED) + if item == -1: + break + + # This item is selected - do whatever is needed with it + wx.LogMessage("Item %ld is selected"%item) + diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/ListCtrl.SetColumnsOrder.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/ListCtrl.SetColumnsOrder.1.py new file mode 100644 index 00000000..beae944c --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/ListCtrl.SetColumnsOrder.1.py @@ -0,0 +1,13 @@ + + listCtrl = wx.ListCtrl(parent, style=wx.LC_REPORT) + + for i in range(3): + listCtrl.InsertColumn(i, "Column %d"%i) + + order = [2, 0, 1] + listCtrl.SetColumnsOrder(order) + + # now listCtrl.GetColumnsOrder() will return order and + # listCtrl.GetColumnIndexFromOrder(n) will return order[n] and + # listCtrl.GetColumnOrder() will return 1, 2 and 0 for the column 0, + # 1 and 2 respectively diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/ListCtrl.SetItemState.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/ListCtrl.SetItemState.1.py new file mode 100644 index 00000000..51ae6cc7 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/ListCtrl.SetItemState.1.py @@ -0,0 +1,2 @@ + + listCtrl.SetItemState(item, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED) diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/ListCtrl.SetItemState.2.py b/docs/sphinx/rest_substitutions/snippets/python/converted/ListCtrl.SetItemState.2.py new file mode 100644 index 00000000..70b4ae4c --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/ListCtrl.SetItemState.2.py @@ -0,0 +1,2 @@ + + listCtrl.SetItemState(item, 0, wx.LIST_STATE_SELECTED) diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/ListCtrl.SortItems.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/ListCtrl.SortItems.1.py new file mode 100644 index 00000000..56cf8486 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/ListCtrl.SortItems.1.py @@ -0,0 +1,6 @@ + + def ListCompareFunction(self, item1, item2): + + pass + + diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/functions.AboutBox.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/functions.AboutBox.1.py new file mode 100644 index 00000000..ed610767 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/functions.AboutBox.1.py @@ -0,0 +1,11 @@ + + def ShowSimpleAboutDialog(self, event): + + info = wx.AboutDialogInfo() + info.SetName(_("My Program")) + info.SetVersion(_("1.2.3 Beta")) + info.SetDescription(_("This program does something great.")) + info.SetCopyright(wx.T("(C) 2007 Me ")) + + wx.AboutBox(info) + diff --git a/sphinxtools/constants.py b/sphinxtools/constants.py index eb4e279e..9adea49e 100644 --- a/sphinxtools/constants.py +++ b/sphinxtools/constants.py @@ -68,7 +68,8 @@ REMOVED_LINKS = ['Library:', 'Category:', 'Predefined objects/pointers:'] # This needs to be kept up to date when other stuff comes in (i.e., wx.grid, # wx.html and so on) MODULENAME_REPLACE = {'_core' : '', - '_dataview': 'dataview.' + '_dataview': 'dataview.', + '_adv' : '', } # Other C++ specific things to strip away @@ -143,7 +144,7 @@ HTML_REPLACE = ['module', 'function', 'method', 'class', 'classmethod', 'staticm # The SVN revision of wxWidgets/Phoenix used to build the Sphinx docs. # There must be a more intelligent way to get this information automatically. -SVN_REVISION = '70741' +SVN_REVISION = '71022' # Today's date representation for the Sphinx HTML docs TODAY = datetime.date.today().strftime('%d %B %Y') diff --git a/sphinxtools/postprocess.py b/sphinxtools/postprocess.py index 388cf882..ed1442c5 100644 --- a/sphinxtools/postprocess.py +++ b/sphinxtools/postprocess.py @@ -144,6 +144,7 @@ def BuildEnumsAndMethods(sphinxDir): text = text.replace(',,', ',').replace(', ,', ',') text = text.replace(':note:', '.. note::') text = text.replace(':see:', '.. seealso::') + text = text.replace('`String`&', 'string') if text != orig_text: fid = open(input, 'wt')