diff --git a/demo/Main.py b/demo/Main.py index 1373eaaa..a22a1903 100644 --- a/demo/Main.py +++ b/demo/Main.py @@ -2459,13 +2459,10 @@ class wxPythonDemo(wx.Frame): def OnOpenWidgetInspector(self, evt): - # Activate the widget inspection tool + # Activate the widget inspection tool, giving it a widget to preselect + # in the tree. Use either the one under the cursor, if any, or this + # frame. from wx.lib.inspection import InspectionTool - if not InspectionTool().initialized: - InspectionTool().Init() - - # Find a widget to be selected in the tree. Use either the - # one under the cursor, if any, or this frame. wnd = wx.FindWindowAtPointer() if not wnd: wnd = self diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.AppConsole.SetCLocale.2.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.AppConsole.SetCLocale.2.py new file mode 100644 index 00000000..e69de29b diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Bitmap.NewFromPNGData.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Bitmap.NewFromPNGData.1.py new file mode 100644 index 00000000..e69de29b diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.DateTime.SetTimeT.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.DateTime.SetTimeT.1.py new file mode 100644 index 00000000..5e3af31b --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.DateTime.SetTimeT.1.py @@ -0,0 +1,2 @@ + + -1 diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.EvtHandler.TryAfter.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.EvtHandler.TryAfter.1.py new file mode 100644 index 00000000..675de7bc --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.EvtHandler.TryAfter.1.py @@ -0,0 +1,10 @@ + + class MyClass(public BaseClass): # something inheriting from wx.EvtHandler + + ... + def TryAfter(self, event): + if (BaseClass.TryAfter(self, event)) + return True + + return self.MyPostProcess(event) + diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.EvtHandler.TryBefore.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.EvtHandler.TryBefore.1.py new file mode 100644 index 00000000..9d12ac3c --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.EvtHandler.TryBefore.1.py @@ -0,0 +1,10 @@ + + class MyClass(BaseClass): # something inheriting from wx.EvtHandler + + ... + def TryBefore(self, event): + if (self.MyPreProcess(event)): + return True + + return BaseClass.TryBefore(self, event) + diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.html.HtmlParser.PushTagHandler.2.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.html.HtmlParser.PushTagHandler.2.py new file mode 100644 index 00000000..e10a6161 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.html.HtmlParser.PushTagHandler.2.py @@ -0,0 +1,9 @@ + + + # some code in HandleTag for "MYITEMS"... + + self.Parser.PushTagHandler(self, "PARAM") + self.ParseInner(tag) + self.Parser.PopTagHandler() + + # back to working on "MYITEMS"... diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.html2.WebView.GetNativeBackend.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.html2.WebView.GetNativeBackend.1.py new file mode 100644 index 00000000..ebba70b5 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.html2.WebView.GetNativeBackend.1.py @@ -0,0 +1,9 @@ + + # In Python the value returned will be a sip wrapper around a void* type, + # and it can be converted to the address being pointed to with int(). + webview_ptr = self.webview.GetNativeBackend() + + # Assuming you are able to get a ctypes, cffi or similar access to the + # webview library, you can use that pointer value to give it access to the + # WebView backend to operate upon. + theWebViewLib.doSomething(int(webview_ptr)) diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.media.MediaCtrl.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.media.MediaCtrl.1.py new file mode 100644 index 00000000..b86fb912 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.media.MediaCtrl.1.py @@ -0,0 +1,10 @@ + + # connect to the media event + self.Bind(wx.media.EVT_MEDIA_STOP, self.OnMediaStop, self.mediactrl) + + # ... + def OnMediaStop(self, evt): + if self.userWantsToSeek: + self.mediactrl.SetPosition(someOtherPosition) + evt.Veto() + diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.msw.Metafile.SetClipboard.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.msw.Metafile.SetClipboard.1.py new file mode 100644 index 00000000..da609372 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.msw.Metafile.SetClipboard.1.py @@ -0,0 +1,9 @@ + + dc = wx.MetafileDC() + if dc.IsOk(): + self.DoDrawing(dc) + metafile = dc.Close() + if metafile: + success = metafile.SetClipboard(dc.MaxX() + 10, dc.MaxY() + 10) + + diff --git a/etg/gbsizer.py b/etg/gbsizer.py index 6f71fa88..ef0bd7cc 100644 --- a/etg/gbsizer.py +++ b/etg/gbsizer.py @@ -150,6 +150,14 @@ def run(): if func.findItem('item'): func.find('item').transfer = True + c.addCppMethod('wxSizerItem*', 'Add', + '(const wxSize& size, const wxGBPosition& pos, ' + 'const wxGBSpan& span = wxDefaultSpan, int flag = 0, ' + 'int border = 0, wxObject* userData /Transfer/ = NULL)', + doc="Add a spacer using a :class:`Size` object.", + body="return self->Add(size->x, size->y, *pos, *span, flag, border, userData);") + + c.addPyCode( "GridBagSizer.CheckForIntersectionPos = wx.deprecated(GridBagSizer.CheckForIntersection, 'Use CheckForIntersection instead.')") diff --git a/etg/ribbon_bar.py b/etg/ribbon_bar.py index 511cee4f..c2073deb 100644 --- a/etg/ribbon_bar.py +++ b/etg/ribbon_bar.py @@ -38,6 +38,7 @@ def run(): c = module.find('wxRibbonBar') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c) + c.find('SetArtProvider.art').transfer = True c = module.find('wxRibbonBarEvent') diff --git a/samples/ribbon/ribbonbar_demo.py b/samples/ribbon/ribbonbar_demo.py index b7d33f78..ee553ddb 100644 --- a/samples/ribbon/ribbonbar_demo.py +++ b/samples/ribbon/ribbonbar_demo.py @@ -1,7 +1,12 @@ #!/usr/bin/env python -import os -import sys +""" +This module implements a demo application that shows many of the features of +the RibbonBar and related classes found in the wx.ribbon module. It is very +similar to the pure-python implementation found in the wx.lib.agw.ribbon +package. In fact, this demo was ported from the AGW version of the demo with +just a few relatively minor edits. +""" import wx import wx.ribbon as RB @@ -9,7 +14,6 @@ import wx.ribbon as RB import images - # --------------------------------------------------- # # Some constants for ribbon buttons @@ -335,7 +339,6 @@ class RibbonFrame(wx.Frame): if event.GetGalleryItem() != None: if provider == self._ribbon.GetArtProvider(): - provider = provider.Clone() gallery.SetArtProvider(provider) provider.SetColour(RB.RIBBON_ART_GALLERY_HOVER_BACKGROUND_COLOUR, @@ -616,7 +619,7 @@ class RibbonFrame(wx.Frame): gallery.SetSelection(item) # Send an event to respond to the selection change - dummy = RB.RibbonGalleryEvent(RB.wxEVT_COMMAND_RIBBONGALLERY_SELECTED, + dummy = RB.RibbonGalleryEvent(RB.wxEVT_RIBBONGALLERY_SELECTED, gallery.GetId()) dummy.SetEventObject(gallery) dummy.SetGallery(gallery) diff --git a/sphinxtools/utilities.py b/sphinxtools/utilities.py index 18a40164..1b5c8feb 100644 --- a/sphinxtools/utilities.py +++ b/sphinxtools/utilities.py @@ -182,6 +182,8 @@ def replaceCppItems(line): item = 'string' elif 'wxCoord' == item: item = 'int' + elif 'time_t' == item: + item = 'int' elif item == 'char': item = 'int' elif item == 'double': diff --git a/unittests/test_dcbuffer.py b/unittests/test_dcbuffer.py index 16ff7a69..7ee69558 100644 --- a/unittests/test_dcbuffer.py +++ b/unittests/test_dcbuffer.py @@ -67,7 +67,7 @@ class BufferedDCTests(wtc.WidgetTestCase): self.frame.SendSizeEvent() panel.Refresh() self.myUpdate(panel) - self.myYield() + self.waitFor(200) self.assertTrue(panel.onPaintCalled == True) @@ -88,7 +88,7 @@ class BufferedDCTests(wtc.WidgetTestCase): self.frame.SendSizeEvent() panel.Refresh() self.myUpdate(panel) - self.myYield() + self.waitFor(200) self.assertTrue(panel.onPaintCalled == True) diff --git a/unittests/test_dcclient.py b/unittests/test_dcclient.py index 9b4b1785..f97bbaa5 100644 --- a/unittests/test_dcclient.py +++ b/unittests/test_dcclient.py @@ -33,7 +33,7 @@ class ClientDCTests(wtc.WidgetTestCase): self.frame.SendSizeEvent() panel.Refresh() self.myUpdate(panel) - self.myYield() + self.waitFor(200) self.assertTrue(panel.onPaintCalled == True) diff --git a/unittests/test_lib_agw_flatmenu.py b/unittests/test_lib_agw_flatmenu.py index 7eef8dcf..7ae7d956 100644 --- a/unittests/test_lib_agw_flatmenu.py +++ b/unittests/test_lib_agw_flatmenu.py @@ -62,6 +62,7 @@ class lib_agw_flatmenu_Tests(wtc.WidgetTestCase): fPt = self.frame.GetPosition() popMenu.Popup(wx.Point(fPt.x, fPt.y), self.frame) + popMenu.Dismiss(True, True) # Clear the capture since the test won't do a normal shudown of the flatmenu cap = wx.Window.GetCapture() diff --git a/unittests/test_lib_agw_pyprogress.py b/unittests/test_lib_agw_pyprogress.py index adedc369..0b4819cd 100644 --- a/unittests/test_lib_agw_pyprogress.py +++ b/unittests/test_lib_agw_pyprogress.py @@ -12,6 +12,7 @@ class lib_agw_pyprogress_Tests(wtc.WidgetTestCase): dlg = PP.PyProgress(self.frame, -1, 'PyProgress Example', 'An Informative Message', agwStyle=wx.PD_APP_MODAL|wx.PD_ELAPSED_TIME) + dlg.Destroy() def test_lib_agw_pyprogressMethods(self): dlg = PP.PyProgress(self.frame, -1, 'PyProgress Example', @@ -29,6 +30,7 @@ class lib_agw_pyprogress_Tests(wtc.WidgetTestCase): self.assertEqual(dlg.GetFirstGradientColour(), wx.Colour('white')) self.assertEqual(dlg.GetSecondGradientColour(), wx.Colour('blue')) self.assertTrue(dlg.GetAGWWindowStyleFlag() & wx.PD_REMAINING_TIME == 0) + dlg.Destroy() def test_lib_agw_pyprogressConstantsExists(self): PP.LAYOUT_MARGIN diff --git a/unittests/test_lib_pubsub_except.py b/unittests/test_lib_pubsub_except.py index 901af2ba..df482758 100644 --- a/unittests/test_lib_pubsub_except.py +++ b/unittests/test_lib_pubsub_except.py @@ -25,7 +25,7 @@ class lib_pubsub_Except(wtc.PubsubTestCase): self.pub.setListenerExcHandler(excPublisher) # create a listener that raises an exception: - from lib_pubsub_except_raisinglistener import getRaisingListener + from .lib_pubsub_except_raisinglistener import getRaisingListener raisingListener = getRaisingListener() self.pub.setNotificationFlags(all=False) @@ -42,7 +42,7 @@ class lib_pubsub_Except(wtc.PubsubTestCase): def testHandleExcept1b(self): # create a listener that raises an exception: - from lib_pubsub_except_raisinglistener import getRaisingListener + from .lib_pubsub_except_raisinglistener import getRaisingListener raisingListener = getRaisingListener() self.pub.subscribe(raisingListener, 'testHandleExcept1b') @@ -66,7 +66,7 @@ class lib_pubsub_Except(wtc.PubsubTestCase): # finally the string for formatted traceback: msg = excTraceback.getFormattedString() assert msg.startswith(' File') - assert msg.endswith("global name 'RuntimeError2' is not defined\n") + assert msg.endswith("name 'RuntimeError2' is not defined\n") from wx.lib.pubsub.utils.exchandling import ExcPublisher topic = self.pub.getDefaultTopicMgr().getTopic(ExcPublisher.topicUncaughtExc) diff --git a/unittests/test_lib_pubsub_listener.py b/unittests/test_lib_pubsub_listener.py index 7aff325d..2f71fe7c 100644 --- a/unittests/test_lib_pubsub_listener.py +++ b/unittests/test_lib_pubsub_listener.py @@ -5,6 +5,7 @@ """ +import six import unittest from unittests import wtc @@ -194,7 +195,9 @@ class lib_pubsub_ArgsInfo(wtc.PubsubTestCase): def tmpFn(self): pass Listener( DOA.tmpFn, ArgsInfoMock() ) - self.assertRaises(ValueError, getListener1) + # Py3 doesn't have unbound methods so this won't throw a ValueError + if not six.PY3: + self.assertRaises(ValueError, getListener1) # test DOA of tmp callable: def getListener2(): diff --git a/unittests/test_lib_pubsub_provider.py b/unittests/test_lib_pubsub_provider.py index ab49a667..3830d5eb 100644 --- a/unittests/test_lib_pubsub_provider.py +++ b/unittests/test_lib_pubsub_provider.py @@ -227,8 +227,11 @@ class lib_pubsub_Except(wtc.PubsubTestCase): assert diffs == ['- ', '+ '] # now for module: + import sys + sys.path.append(os.path.dirname(__file__)) provider = self.pub.addTopicDefnProvider('lib_pubsub_provider_expect', self.pub.TOPIC_TREE_FROM_MODULE) + sys.path.remove(os.path.dirname(__file__)) self.pub.instantiateAllDefinedTopics(provider) modDoc = provider.getTreeDoc() assert modDoc.startswith('\nTree docs, can be anything you') @@ -248,7 +251,7 @@ class lib_pubsub_Except(wtc.PubsubTestCase): assert self.pub.getDefaultTopicMgr().getTopic('root_topic1', True) is None assert self.pub.getDefaultTopicMgr().getTopic('root_topic2.sub_topic21', True) is None - import lib_pubsub_provider_my_import_topics + from . import lib_pubsub_provider_my_import_topics provider = self.pub.addTopicDefnProvider(lib_pubsub_provider_my_import_topics, self.pub.TOPIC_TREE_FROM_CLASS) self.pub.instantiateAllDefinedTopics(provider) diff --git a/unittests/test_msgdlg.py b/unittests/test_msgdlg.py index ad48c025..23ebec6b 100644 --- a/unittests/test_msgdlg.py +++ b/unittests/test_msgdlg.py @@ -54,10 +54,14 @@ class msgdlg_Tests(wtc.WidgetTestCase): def test_gmsgdlg1(self): dlg = wx.GenericMessageDialog(None, 'Message', 'Caption') + wx.CallLater(250, dlg.EndModal, wx.ID_OK) + dlg.ShowModal() dlg.Destroy() def test_gmsgdlg2(self): dlg = wx.GenericMessageDialog(self.frame, 'Message', 'Caption') + wx.CallLater(250, dlg.EndModal, wx.ID_OK) + dlg.ShowModal() dlg.Destroy() def test_gmsgdlg3(self): @@ -69,6 +73,8 @@ class msgdlg_Tests(wtc.WidgetTestCase): self.assertEqual(dlg.GetMessage(), 'message') self.assertEqual(dlg.GetOKLabel(), 'okidoky') self.assertEqual(dlg.GetCancelLabel(), 'bye-bye') + wx.CallLater(250, dlg.EndModal, wx.ID_OK) + dlg.ShowModal() dlg.Destroy() #--------------------------------------------------------------------------- diff --git a/unittests/test_pi_import.py b/unittests/test_pi_import.py index e5bb02db..765bf396 100644 --- a/unittests/test_pi_import.py +++ b/unittests/test_pi_import.py @@ -1,5 +1,6 @@ import unittest import sys, os, subprocess +import wx #--------------------------------------------------------------------------- @@ -16,7 +17,7 @@ class PIImportTest(unittest.TestCase): def runPI(self, filename): cwd = os.getcwd() - dirname = os.path.join(os.path.dirname(__file__), '../wx') + dirname = os.path.dirname(wx.__file__) os.chdir(dirname) sp = subprocess.Popen('%s %s' % (sys.executable, filename), @@ -66,4 +67,4 @@ class PIImportTest(unittest.TestCase): if __name__ == '__main__': unittest.main() - \ No newline at end of file + diff --git a/unittests/test_radiobut.py b/unittests/test_radiobut.py index b3635184..1101938a 100644 --- a/unittests/test_radiobut.py +++ b/unittests/test_radiobut.py @@ -15,11 +15,14 @@ class radiobut_Tests(wtc.WidgetTestCase): b.Create(self.frame, label="radiobutton") def test_radiobutValue(self): - b = wx.RadioButton(self.frame, label='radiobutton') + b = wx.RadioButton(self.frame, label='radiobutton', style=wx.RB_GROUP) + b1 = wx.RadioButton(self.frame, label='radiobutton1') + b1.Value = True + self.assertTrue(b.GetValue() == False) + self.assertTrue(b1.GetValue() == True) b.Value = True self.assertTrue(b.GetValue() == True) - b.Value = False - self.assertTrue(b.GetValue() == False) + self.assertTrue(b1.GetValue() == False) #--------------------------------------------------------------------------- diff --git a/unittests/test_richmsgdlg.py b/unittests/test_richmsgdlg.py index 30e503b4..1cf80c8a 100644 --- a/unittests/test_richmsgdlg.py +++ b/unittests/test_richmsgdlg.py @@ -8,10 +8,14 @@ class richmsgdlg_Tests(wtc.WidgetTestCase): def test_richmsgdlg1(self): dlg = wx.RichMessageDialog(None, 'Message', 'Caption') + wx.CallLater(250, dlg.EndModal, wx.ID_OK) + dlg.ShowModal() dlg.Destroy() def test_richmsgdlg2(self): dlg = wx.RichMessageDialog(self.frame, 'Message', 'Caption') + wx.CallLater(250, dlg.EndModal, wx.ID_OK) + dlg.ShowModal() dlg.Destroy() def test_richmsgdlg3(self): @@ -31,6 +35,8 @@ class richmsgdlg_Tests(wtc.WidgetTestCase): self.assertEqual(dlg.CheckBoxText, "Checkbox") self.assertEqual(dlg.DetailedText, "Detailed Text") + wx.CallLater(250, dlg.EndModal, wx.ID_OK) + dlg.ShowModal() dlg.Destroy() #--------------------------------------------------------------------------- diff --git a/unittests/test_scrolwin.py b/unittests/test_scrolwin.py index 688f11c9..29136535 100644 --- a/unittests/test_scrolwin.py +++ b/unittests/test_scrolwin.py @@ -61,7 +61,7 @@ class scrolwin_Tests(wtc.WidgetTestCase): self.commonBits(w) w.Refresh() self.myUpdate(w) - self.myYield() + self.waitFor(100) self.assertTrue(w.flag) # True if OnDraw was called #--------------------------------------------------------------------------- diff --git a/wx/lib/agw/aui/dockart.py b/wx/lib/agw/aui/dockart.py index db3d84f2..f8135d8c 100644 --- a/wx/lib/agw/aui/dockart.py +++ b/wx/lib/agw/aui/dockart.py @@ -952,8 +952,8 @@ class ModernDockArt(AuiDefaultDockArt): self.hTheme1 = winxptheme.OpenThemeData(hwnd, "Window") self.usingTheme = True - if not self.hTheme1: - self.usingTheme = False + if not self.hTheme1: + self.usingTheme = False self._button_size = 13 diff --git a/wx/lib/agw/ultimatelistctrl.py b/wx/lib/agw/ultimatelistctrl.py index 558876fd..acb6559e 100644 --- a/wx/lib/agw/ultimatelistctrl.py +++ b/wx/lib/agw/ultimatelistctrl.py @@ -8019,46 +8019,6 @@ class UltimateListMainWindow(wx.ScrolledWindow): self.MoveToFocus() - def SetEventAttrs(self, oldEvent, newEvent): - """ - Copies (almost) all of the ``m_*`` attributes from the original :class:`KeyEvent` event - to the copy (`newEvent`). Successfully passes the key codes to the application - as expected. - - :param `oldEvent`: the original :class:`KeyEvent` event to be processed; - :param `newEvent`: the new :class:`KeyEvent` event to be processed. - - .. todo:: - - Find out why getting `m_rawFlags` returns a Python ``long`` but the setter - expects to receive an ``unsigned int``. - - - .. versionadded:: 0.9.5 - """ - - if _VERSION_STRING < '2.9': - - attributes = ['m_altDown', 'm_controlDown', 'm_keyCode', - 'm_metaDown', 'm_rawCode', 'm_scanCode', - 'm_shiftDown', 'm_x', 'm_y'] - - for attr in attributes: - setattr(newEvent, attr, getattr(oldEvent, attr)) - - else: - # 2.9.something - methods = ['AltDown', 'ControlDown', 'MetaDown', 'ShiftDown'] - - for meth in methods: - eval('newEvent.Set%s(oldEvent.%s())'%(meth, meth)) - - attributes = ['m_keyCode', 'm_rawCode', 'm_x', 'm_y'] - - for attr in attributes: - setattr(newEvent, attr, getattr(oldEvent, attr)) - - def OnKeyDown(self, event): """ Handles the ``wx.EVT_KEY_DOWN`` event for :class:`UltimateListMainWindow`. @@ -8069,8 +8029,7 @@ class UltimateListMainWindow(wx.ScrolledWindow): parent = self.GetParent() # we propagate the key event upwards - ke = wx.KeyEvent(event.GetEventType()) - self.SetEventAttrs(event, ke) + ke = event.Clone() ke.SetEventObject(parent) if parent.GetEventHandler().ProcessEvent(ke): @@ -8090,8 +8049,7 @@ class UltimateListMainWindow(wx.ScrolledWindow): parent = self.GetParent() # we propagate the key event upwards - ke = wx.KeyEvent(event.GetEventType()) - self.SetEventAttrs(event, ke) + ke = event.Clone() ke.SetEventObject(parent) if parent.GetEventHandler().ProcessEvent(ke): @@ -8127,8 +8085,7 @@ class UltimateListMainWindow(wx.ScrolledWindow): wx.WXK_PAGEUP, wx.WXK_PAGEDOWN, wx.WXK_END, wx.WXK_HOME]: # propagate the char event upwards - ke = wx.KeyEvent(event.GetEventType()) - self.SetEventAttrs(event, ke) + ke = event.Clone() ke.SetEventObject(parent) if parent.GetEventHandler().ProcessEvent(ke): return diff --git a/wx/lib/inspection.py b/wx/lib/inspection.py index b7d2e846..c560e801 100644 --- a/wx/lib/inspection.py +++ b/wx/lib/inspection.py @@ -18,8 +18,8 @@ # to provide Hot-Key access to the inspection tool. """ -This modules provides the :class:`~lib.inspection.InspectionTool` and everything else needed to -provide the Widget Inspection Tool (WIT). +This modules provides the :class:`~wx.lib.inspection.InspectionTool` and +everything else needed to provide the Widget Inspection Tool (WIT). """ @@ -45,12 +45,18 @@ class InspectionTool: # instances of this class are actually using the same set of # instance data. See # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531 - __shared_state = {} + __shared_state = None + def __init__(self): - self.__dict__ = self.__shared_state + if not InspectionTool.__shared_state: + InspectionTool.__shared_state = self.__dict__ + else: + self.__dict__ = InspectionTool.__shared_state + if not hasattr(self, 'initialized'): self.initialized = False + def Init(self, pos=wx.DefaultPosition, size=wx.Size(850,700), config=None, locals=None, app=None): """ diff --git a/wx/lib/pubsub/core/topictreetraverser.py b/wx/lib/pubsub/core/topictreetraverser.py index e31732f0..fac6d69c 100644 --- a/wx/lib/pubsub/core/topictreetraverser.py +++ b/wx/lib/pubsub/core/topictreetraverser.py @@ -55,6 +55,8 @@ class TopicTreeTraverser: def extendQueue(subtopics): topics.append(visitor._startChildren) + # put subtopics in list in alphabetical order + subtopics.sort(key=topicObj.__class__.getName) topics.extend(subtopics) topics.append(visitor._endChildren)