#1202: Bug in ClassDesigner with
---------------------+------------------------------------------------------
  Reporter:  fabix   |       Owner:  ed      
      Type:  defect  |      Status:  assigned
  Priority:  major   |   Milestone:  0.9.2   
 Component:  ui      |     Version:  0.9.1   
Resolution:          |    Keywords:          
---------------------+------------------------------------------------------
Comment (by rgammans):

 I've hit this.

 Putting a breakpoint in at the faulint line and looking at szit shows:-
 (/var/lib/python-support/python2.5/dabo/ui/uiwx/dGridSizer.py:304):
 getGridPos
 304                     row, col = szit.GetPos()
 (Pydb) where
 -> 0 getGridPos(self=<ClassDesignerComponents.LayoutGridSizer (baseclass
 dabo.ui.dGridSizer, id:189223852)>, obj=<w...) called from file '/var/lib
 /python-support/python2.5/dabo/ui/uiwx/dGridSizer.py' at line 304
 ## 1 getChildrenPropDict(self=<ClassDesignerComponents.LayoutGridSizer
 (baseclass dabo.ui.dGridSizer, id:189223852)>, clsChi...) called from file
 '/work/roger/dabo/ide/ClassDesignerComponents.py' at line 1648
 ## 2 getDesignerDict(self=<ClassDesignerComponents.LayoutGridSizer
 (baseclass dabo.ui.dGridSizer, id:189223852)>, itemNu...) called from file
 '/work/roger/dabo/ide/ClassDesignerComponents.py' at line 257
 ## 3 getChildrenPropDict(self=<ClassDesignerComponents.LayoutSizer
 (baseclass dabo.ui.dSizer, id:190828268)>, clsChildren=No...) called from
 file '/work/roger/dabo/ide/ClassDesignerComponents.py' at line 1076
 ## 4 getDesignerDict(self=<ClassDesignerComponents.LayoutSizer (baseclass
 dabo.ui.dSizer, id:190828268)>, itemNum=0, all...) called from file
 '/work/roger/dabo/ide/ClassDesignerComponents.py' at line 257
 ## 5 getChildrenPropDict(self=<dPanel (baseclass dabo.ui.dPanel,
 id:-465)>, clsChildren=None) called from file
 '/work/roger/dabo/ide/ClassDesignerComponents.py' at line 463
 ## 6 getDesignerDict(self=<dPanel (baseclass dabo.ui.dPanel, id:-465)>,
 itemNum=0, allProps=False, classID=None, classDi...) called from file
 '/work/roger/dabo/ide/ClassDesignerComponents.py' at line 257
 ## 7 getChildrenPropDict(self=<ClassDesignerComponents.LayoutSizer
 (baseclass dabo.ui.dSizer, id:190825964)>, clsChildren=No...) called from
 file '/work/roger/dabo/ide/ClassDesignerComponents.py' at line 1061
 ## 8 getDesignerDict(self=<ClassDesignerComponents.LayoutSizer (baseclass
 dabo.ui.dSizer, id:190825964)>, itemNum=0, all...) called from file
 '/work/roger/dabo/ide/ClassDesignerComponents.py' at line 257
 ## 9 getChildrenPropDict(self=<DesForm (baseclass dabo.ui.dForm,
 id:-216)>, clsChildren=None) called from file
 '/work/roger/dabo/ide/ClassDesignerComponents.py' at line 463
 ## 10 getDesignerDict(self=<DesForm (baseclass dabo.ui.dForm, id:-216)>,
 itemNum=0, allProps=False, classID=None, classDi...) called from file
 '/work/roger/dabo/ide/ClassDesignerComponents.py' at line 257
 ## 11 onSaveDesign(self=<DesForm (baseclass dabo.ui.dForm, id:-216)>,
 evt=<dabo.dEvents.Hit object at 0xb3dd14c>, useT...) called from file
 '/work/roger/dabo/ide/ClassDesignerFormMixin.py' at line 477
 ## 12 wrapSave(self=<__main__.ClassDesigner (baseclass
 __main__.ClassDesigner, id:183106284)>, func=<bound method ...) called
 from file '/home/roger/work/dabo/ide/ClassDesigner.py' at line 1822
 ## 13 onSaveDesign(self=<__main__.ClassDesigner (baseclass
 __main__.ClassDesigner, id:183106284)>, evt=<dabo.dEvents.H...) called
 from file '/home/roger/work/dabo/ide/ClassDesigner.py' at line 1668
 ## 14 raiseEvent(self=<dabo.ui.uiwx.dMenuItem.dMenuItem (baseclass
 dabo.ui.dMenuItem, id:170)>, eventClass=<class 'd...) called from file
 '/var/lib/python-support/python2.5/dabo/lib/eventMixin.py' at line 93
 ## 15 raiseEvent(self=<dabo.ui.uiwx.dMenuItem.dMenuItem (baseclass
 dabo.ui.dMenuItem, id:170)>, eventClass=<class 'd...) called from file
 '/var/lib/python-support/python2.5/dabo/ui/uiwx/dPemMixin.py' at line 949
 ## 16 __onWxHit(self=<dabo.ui.uiwx.dMenuItem.dMenuItem (baseclass
 dabo.ui.dMenuItem, id:170)>, evt=<wx._core.Comman...) called from file
 '/var/lib/python-support/python2.5/dabo/ui/uiwx/dMenuItem.py' at line 57
 ## 17 MainLoop(*args=(<uiApp (baseclass dabo.ui.uiApp, id:183889868)>,),
 **kwargs={}) called from file '/usr/lib/python2.5/site-
 packages/wx-2.8-gtk2-unicode/wx/_core.py' at line 7226
 ## 18 MainLoop(self=<uiApp (baseclass dabo.ui.uiApp, id:183889868)>)
 called from file '/usr/lib/python2.5/site-
 packages/wx-2.8-gtk2-unicode/wx/_core.py' at line 7865
 ## 19 start(self=<uiApp (baseclass dabo.ui.uiApp, id:183889868)>,
 dApp=<__main__.ClassDesigner (baseclass __mai...) called from file
 '/var/lib/python-support/python2.5/dabo/ui/uiwx/uiApp.py' at line 441
 ## 20 start(self=<__main__.ClassDesigner (baseclass
 __main__.ClassDesigner, id:183106284)>) called from file '/var/lib/python-
 support/python2.5/dabo/dApp.py' at line 385
 ## 21 __init__(self=<__main__.ClassDesigner (baseclass
 __main__.ClassDesigner, id:183106284)>, clsFile=None) called from file
 '/home/roger/work/dabo/ide/ClassDesigner.py' at line 228
 ## 22 <module>() called from file
 '/home/roger/work/dabo/ide/ClassDesigner.py' at line 4200
 ## 23 <module>() called from file '<string>' at line 1
 ## 24 run(self=<__main__.Pdb instance at 0x9daf52c>, cmd='execfile(
 "/home/roger/work/dabo/ide/ClassDesigner....) called from file '/usr/share
 /python-support/pydb/pydb/pydbbdb.py' at line 342
 (Pydb) examine szit
 szit = <wx._core.SizerItem; proxy of <Swig Object of type 'wxSizerItem *'
 at 0xbbba508> >
 type = <class 'wx._core.SizerItem'>
 object variables:
   'this':       _08a5bb0b_p_wxSizerItem

 class variables:
   'Border':     <property object at 0xa2e3f54>
   'CalcMin':    <function CalcMin at 0xa2e7a74>
   'DeleteWindows':      <function DeleteWindows at 0xa2e79cc>
   'DetachSizer':        <function DetachSizer at 0xa2e7a04>
   'Flag':       <property object at 0xa2e3f7c>
   'GetBorder':  <function GetBorder at 0xa2e7ed4>
   'GetFlag':    <function GetFlag at 0xa2e7e64>
   'GetMinSize': <function GetMinSize at 0xa2e7ae4>
   'GetMinSizeWithBorder':       <function GetMinSizeWithBorder at
 0xa2e7b1c>
   'GetOption':  <function deprecatedWrapper at 0xa2e7df4>
   'GetPosition':        <function GetPosition at 0xa2e910c>
   'GetProportion':      <function GetProportion at 0xa2e7d84>
   'GetRatio':   <function GetRatio at 0xa2e7c34>
   'GetRect':    <function GetRect at 0xa2e7c6c>
   'GetSize':    <function GetSize at 0xa2e7a3c>
   'GetSizer':   <function GetSizer at 0xa2e7f7c>
   'GetSpacer':  <function GetSpacer at 0xa2e902c>
   'GetUserData':        <function GetUserData at 0xa2e9144>
   'GetWindow':  <function GetWindow at 0xa2e7f0c>
   'IsShown':    <function IsShown at 0xa2e90d4>
   'IsSizer':    <function IsSizer at 0xa2e7cdc>
   'IsSpacer':   <function IsSpacer at 0xa2e7d14>
   'IsWindow':   <function IsWindow at 0xa2e7ca4>
   'MinSize':    <property object at 0xa2e3fa4>
   'MinSizeWithBorder':  <property object at 0xa2e3fcc>
   'Position':   <property object at 0xa2ea02c>
   'Proportion': <property object at 0xa2ea054>
   'Ratio':      <property object at 0xa2ea07c>
   'Rect':       <property object at 0xa2ea0a4>
   'SetBorder':  <function SetBorder at 0xa2e7e9c>
   'SetDimension':       <function SetDimension at 0xa2e7aac>
   'SetFlag':    <function SetFlag at 0xa2e7e2c>
   'SetInitSize':        <function SetInitSize at 0xa2e7b54>
   'SetOption':  <function deprecatedWrapper at 0xa2e7dbc>
   'SetProportion':      <function SetProportion at 0xa2e7d4c>
   'SetRatio':   <function SetRatio at 0xa2e7bfc>
   'SetRatioSize':       <function SetRatioSize at 0xa2e7bc4>
   'SetRatioWH': <function SetRatioWH at 0xa2e7b8c>
   'SetSizer':   <function SetSizer at 0xa2e7fb4>
   'SetSpacer':  <function SetSpacer at 0xa2e9064>
   'SetUserData':        <function SetUserData at 0xa2e917c>
   'SetWindow':  <function SetWindow at 0xa2e7f44>
   'Show':       <function Show at 0xa2e909c>
   'Size':       <property object at 0xa2ea0cc>
   'Sizer':      <property object at 0xa2ea0f4>
   'Spacer':     <property object at 0xa2ea11c>
   'UserData':   <property object at 0xa2ea144>
   'Window':     <property object at 0xa2ea16c>
   '__del__':    <function <lambda> at 0xa2e7994>
   '__doc__':
     The wx.SizerItem class is used to track the position, size and other
     attributes of each item managed by a `wx.Sizer`. It is not usually
     necessary to use this class because the sizer elements can also be
     identified by their positions or window or sizer references but
     sometimes it may be more convenient to use wx.SizerItem directly.
     Also, custom classes derived from `wx.PySizer` will probably need to
     use the collection of wx.SizerItems held by wx.Sizer when calculating
     layout.

     :see: `wx.Sizer`, `wx.GBSizerItem`

   '__init__':   <function __init__ at 0xa2e795c>
   '__module__': wx._core
   '__repr__':   <function _swig_repr at 0xa010844>
   '__swig_destroy__':   <built-in function delete_SizerItem>
   'thisown':    <property object at 0xa2e3f2c>

 (pydb)q


 I'm not entirekly sure what is going on at that point as kids is a
 SizerItem list it look like the python <-> C++ is opnly retrun a base
 class of the item.

 Oddly though ClassDesignerComponents.py:1639 gets though to the the
 GetGridPos() call ok.

 Based on that I''m tested the following patch here which at firts sight
 seems to fix it for me.

 --- /tmp/ClassDesignerComponents.py     2009-06-17 13:51:12.000000000
 +0100
 +++ ide/ClassDesignerComponents.py      2009-06-17 13:43:32.000000000
 +0100
 @@ -1645,7 +1645,7 @@
                                         "cdata" : kidItem.Spacing,
                                         "children" : [] }
                         # Save the position
 -                       kidDict["attributes"]["rowColPos"] =
 self.getGridPos(kid)
 +                       kidDict["attributes"]["rowColPos"] =
 self.getGridPos(kidItem.ControllingSizerItem)
                         # Add the sizer item info to the item contents
                         if not kidDict["attributes"].get("sizerInfo"):
                                 kidDict["attributes"]["sizerInfo"] =
 itmDiffDict

-- 
Ticket URL: <http://trac.dabodev.com/ticket/1202#comment:3>
Dabo Trac <http://trac.dabodev.com>
Trac Page for Dabo

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to