Re: [Boa Constr] StaticBoxSizers again
Status: Beta
Brought to you by:
riaan
From: Riaan B. <riaan@e.co.za> - 2006-11-03 11:51:25
|
Hi Olivier, Sorry I didn't pick this up, I never use wx.StaticBoxSizer. Ok, I've tracked down the problem, but don't know how to fix it yet. The issue is that while working with sizers in the Designer, Boa recreates all the sizers often, but the behaviour of StaticBoxSizers seems to have changed between 2.6 and 2.7. Under 2.6 when a StaticBoxSizer is deleted, it left the StaticBox alone, but under 2.7 when the sizer is deleted, it also deletes the StaticBox, which is very nasty. I'll be looking at how to handle this, but I'm not very optimistic :( Cheers, Riaan. Olivier Thiery wrote: > Hi, > > I'm sorry I have another bug with StaticBoxes and StaticBoxSizers. > > When I try to edit the attached source in the designer I first get an > error about the StaticBitmap relative path (scrsht_1.png). This is not > my point here, and anyway this has never been a real problem to me. > > The interesting part begins when I try to drop a StaticBox to my Dialog. > Once I release the mouse button, I get an error (log.txt). > > The only thing I can do then is to drop a StaticBoxSizer, but then I get > PyDeadObject errors each time I try to click on the dialog. > > In the end I can only cancel the design session. > > I hope this will fix the new sizers features. > > Olivier > > > ------------------------------------------------------------------------ > > #Boa:Dialog:TransfertLotDialog > > import wx > import wx.lib.buttons > import data.CustomTreeCtrl as ctc > from data.CustomTreeCtrl import CustomTreeCtrl > > def create(parent): > return TransfertLotDialog(parent) > > [wxID_TRANSFERTLOTDIALOG, wxID_TRANSFERTLOTDIALOGGENBTNEWLOT, > wxID_TRANSFERTLOTDIALOGSTBXNOUVEAULOT, wxID_TRANSFERTLOTDIALOGTREELOTS, > wxID_TRANSFERTLOTDIALOGTXTNOMLOT, > ] = [wx.NewId() for _init_ctrls in range(5)] > > class TransfertLotDialog(wx.Dialog): > _custom_classes = {'wx.TreeCtrl':['CustomTreeCtrl']} > def _init_coll_Main_Items(self, parent): > # generated method, don't edit > > parent.AddWindow(self.treeLots, 1, border=5, flag=wx.ALL | wx.EXPAND) > parent.AddSizer(self.sb_lot, 0, border=5, flag=wx.ALL | wx.EXPAND) > > def _init_coll_sb_lot_Items(self, parent): > # generated method, don't edit > > parent.AddWindow(self.txtNomLot, 1, border=0, flag=0) > parent.AddWindow(self.genBtNewLot, 0, border=5, > flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT) > > def _init_sizers(self): > # generated method, don't edit > self.Main = wx.BoxSizer(orient=wx.VERTICAL) > > self.sb_lot = wx.StaticBoxSizer(box=self.stbxNouveauLot, > orient=wx.HORIZONTAL) > > self._init_coll_Main_Items(self.Main) > self._init_coll_sb_lot_Items(self.sb_lot) > > self.SetSizer(self.Main) > > def _init_ctrls(self, prnt): > # generated method, don't edit > wx.Dialog.__init__(self, id=wxID_TRANSFERTLOTDIALOG, > name=u'TransfertLotDialog', parent=prnt, pos=wx.Point(587, 355), > size=wx.Size(318, 368), style=wx.DEFAULT_DIALOG_STYLE, > title=u'Transfert de PMC') > self.SetClientSize(wx.Size(310, 334)) > > self.treeLots = wx.TreeCtrl(id=wxID_TRANSFERTLOTDIALOGTREELOTS, > name=u'treeLots', parent=self, pos=wx.Point(5, 5), > size=wx.Size(300, 271)) > > self.stbxNouveauLot = wx.StaticBox(id=wxID_TRANSFERTLOTDIALOGSTBXNOUVEAULOT, > label=u'Nouveau Lot', name=u'stbxNouveauLot', parent=self, > pos=wx.Point(5, 286), size=wx.Size(300, 43), style=0) > > self.txtNomLot = wx.TextCtrl(id=wxID_TRANSFERTLOTDIALOGTXTNOMLOT, > name=u'txtNomLot', parent=self, pos=wx.Point(10, 303), > size=wx.Size(262, 21), style=0, value=u'') > > self.genBtNewLot = wx.lib.buttons.GenBitmapButton(id=wxID_TRANSFERTLOTDIALOGGENBTNEWLOT, > bitmap=wx.Bitmap(u'img/16/edit_add.png', > wx.BITMAP_TYPE_PNG), name=u'genBtNewLot', parent=self, > pos=wx.Point(277, 305), size=wx.Size(23, 16), style=0) > self.genBtNewLot.Bind(wx.EVT_BUTTON, self.OnGenBtNewLotButton, > id=wxID_TRANSFERTLOTDIALOGGENBTNEWLOT) > > self._init_sizers() > > def __init__(self, parent): > #, ctstyle=ctc.TR_AUTO_CHECK_CHILD | ctc.TR_HIDE_ROOT | ctc.TR_HAS_BUTTONS > self._init_ctrls(parent) > self.init_data() > > def init_data(self): > ds = wxData.getDataSet(wxData.getQuery('pmc.commission', 'pmc.select.lots')) > ds.setParam('id_modalite',self.id) > ds.read() > cur_ref_id = None > cur_root = None > root = self.treeKeys.AddRoot('Lots disponibles') > while ds.hasMore(): > r = ds.nextRow() > if r['id_referentiel'] != cur_ref_id: > if cur_root != None: > self.treeKeys.Expand(cur_root) > cur_ref_id = r['id_referentiel'] > cur_root = self.treeKeys.AppendItem(root, r['libelle_referentiel'], 1, image=0) > self.__roots.append(cur_root) > self.treeKeys.SetItemImage(cur_root, 1, wx.TreeItemIcon_Expanded) > item = self.treeKeys.AppendItem(cur_root, r['libelle_modalite'], 1, image=2) > self.data[item] = r['id_modalite_referentiel'] > if cur_root != None: > self.treeKeys.Expand(cur_root) > > def OnGenBtNewLotButton(self, event): > event.Skip() > > > ------------------------------------------------------------------------ > > > ------------------------------------------------------------------------ > > 11:03:44: wx._core.PyDeadObjectError: The C++ part of the StaticBox object has been deleted, attribute access no longer allowed.Traceback (most recent call last): > 11:03:44: wx._core.PyDeadObjectError: The C++ part of the StaticBox object has been deleted, attribute access no longer allowed. File "C:\Python24\Lib\site-packages\boa-constructor\Views\Designer.py", line 1585, in OnControlSelect > 11:03:44: dsgn.selectControlByPos(ctrl, pos, event.ShiftDown()) > 11:03:44: File "C:\Python24\Lib\site-packages\boa-constructor\Views\Designer.py", line 1002, in selectControlByPos > 11:03:44: ci = collEditView.companion.appendItem( > 11:03:44: File "C:\Python24\Lib\site-packages\boa-constructor\Companions\SizerCompanions.py", line 194, in appendItem > 11:03:44: self.recreateSizers() > 11:03:44: File "C:\Python24\Lib\site-packages\boa-constructor\Companions\SizerCompanions.py", line 323, in recreateSizers > 11:03:44: self.designer.recreateSizers() > 11:03:44: File "C:\Python24\Lib\site-packages\boa-constructor\Views\SizersView.py", line 71, in recreateSizers > 11:03:44: self.objects[sizerName][0].recreateSizer() > 11:03:44: File "C:\Python24\Lib\site-packages\boa-constructor\Companions\SizerCompanions.py", line 87, in recreateSizer > 11:03:44: self.control = self.designTimeObject(args) > 11:03:44: File "C:\Python24\Lib\site-packages\boa-constructor\Companions\SizerCompanions.py", line 507, in designTimeObject > 11:03:44: self.control = self.objClass(**args) > 11:03:44: File "C:\Python24\lib\site-packages\wx-2.7.1-msw-unicode\wx\_core.py", line 12245, in __init__ > 11:03:44: _core_.StaticBoxSizer_swiginit(self,_core_.new_StaticBoxSizer(*args, **kwargs)) > 11:03:44: TypeError: in method 'new_StaticBoxSizer', expected argument 1 of type 'wxStaticBox *' > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > ------------------------------------------------------------------------ > > _______________________________________________ > Boa-constructor-users mailing list > Boa...@li... > https://lists.sourceforge.net/lists/listinfo/boa-constructor-users |