Re: Agide and wxPython 2.5.2.7

Bram Moolenaar <[email protected]> Fri, 27 Aug 2004 20:33:03 +0200
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
Christoph Herzog wrote:

> >>until an exception in 
> >>GUItop. py line 529,in wxProxyPanel: raise 'Unhandled type for Win'. 
> >>When testing the unhandled type by 'print type(Win)' it turned out that 
> >>it is TypeType. I fail to understand the problem until now. Is someone 
> >>working on this?
> > 
> > I'm using wxPython 2.4.1.2 and that works.  It's possible that wxPython
> > 2.5.2.7 does a few things differently that breaks Agide.
> 
> It is exactly the workaround for wxGtk that does not work any more under 
> 2.5.27, i.e. def wxProxyPanel in GUITop.py.
> The type of its second argument Win is types.TypeType, i.e. the type of 
> NavTree, no idea why. But it seems to be expected either
> types.InstanceType or types.ClassType.
> However, inserting in the if chain of  wxProxyPanel the additional lines:
> 
> elif type(Win) is types.TypeType:
>          win = apply(Win, (panel,) + args, kwargs)
> 
> brings up the treecontrol apparently without problems.

The patch below should work then.

> BTW, it seems that the whole startup routine of Agide can be made easier 
> in 2.5.2.7 as it now waits with calling the gui-toolkit
> "until the wx.App object is created (but before wx.App.OnInit is 
> called.) ", i.e. importing wx should cause no harm anymore.

I'm trying to make Agide work with many versions of wxPython.  I suppose
it's OK to keep it unchanged for now.


Here is the suggested diff:

--- GUItop.py	9 Jun 2004 11:05:19 -0000	1.15
+++ GUItop.py	27 Aug 2004 18:31:00 -0000
@@ -11,6 +11,8 @@
 from wxPython.wx import *
 import os
 import string
+import sys
+import types
 
 import ActyListView
 import ToolListView
@@ -518,7 +520,7 @@
     """
     panel = wxPanel(parent, -1, style=wxTAB_TRAVERSAL | wxCLIP_CHILDREN)
 
-    if type(Win) is types.ClassType:
+    if type(Win) is types.ClassType or type(Win) is types.TypeType:
         win = apply(Win, (panel,) + args, kwargs)
     elif type(Win) is types.InstanceType:
         win = Win

-- 
hundred-and-one symptoms of being an internet addict:
179. You wonder why your household garbage can doesn't have an
     "empty recycle bin" button.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click