From fd8c3c219f45ec2ebe0d058de6824379471f3f87 2007-03-24 20:25:58 From: walter.doerwald Date: 2007-03-24 20:25:58 Subject: [PATCH] Using igrid with wxPyhon 2.6 and -wthread should work now. igrid.display() simply tries to create a frame without an application. Only if this fails an application is created. --- diff --git a/IPython/Extensions/igrid.py b/IPython/Extensions/igrid.py index 563a334..13550e3 100644 --- a/IPython/Extensions/igrid.py +++ b/IPython/Extensions/igrid.py @@ -575,7 +575,9 @@ class IGridGrid(wx.grid.Grid): frame = self.GetParent().GetParent().GetParent() if frame.helpdialog: frame.helpdialog.Destroy() - frame.parent.result = result + app = frame.parent + if app is not None: + app.result = result frame.Close() frame.Destroy() @@ -799,7 +801,25 @@ class igrid(ipipe.Display): This is a wx-based display object that can be used instead of ``ibrowse`` (which is curses-based) or ``idump`` (which simply does a print). """ - def display(self): - app = App(self.input) - app.MainLoop() - return app.result + if wx.VERSION < (2, 7): + def display(self): + try: + # Try to create a "standalone" from. If this works we're probably + # running with -wthread. + # Note that this sets the parent of the frame to None, but we can't + # pass a result object back to the shell anyway. + frame = IGridFrame(None, self.input) + frame.Show() + frame.Raise() + except wx.PyNoAppError: + # There's no wx application yet => create one. + app = App(self.input) + app.MainLoop() + return app.result + else: + # With wx 2.7 it gets simpler. + def display(self): + app = App(self.input) + app.MainLoop() + return app.result + diff --git a/doc/ChangeLog b/doc/ChangeLog index 47c233c..2b91ef1 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,6 +1,9 @@ 2007-03-24 Walter Doerwald - * IPython/Extensions/igrid.py: Fix picking. + * IPython/Extensions/igrid.py: Fix picking. Using + igrid with wxPyhon 2.6 and -wthread should work now. + igrid.display() simply tries to create a frame without + an application. Only if this fails an application is created. 2007-03-23 Walter Doerwald