Re: [Boa Constr] Boa - difficulties with custom classes - think I have found a bug
Status: Beta
Brought to you by:
riaan
From: Werner F. B. <wer...@fr...> - 2007-11-30 09:10:48
|
Hi Tim, Tim Burgess wrote: > Hi, > I have been following the page http://wiki.wxpython.org/BoaFAQ. > > I seem to have upset Boa and I cant see what I have done. Can anyone > offer a clue? > > The application I am working on runs in my development environment > (WingIDE) as intended, but BOA says that the items defined in the custom > classes statement are not defined on the palette. > I only mention it working under WingIDE so that you know there are no > syntax errors and nothing missing from what I am doing. > > If I hand change the calls to the custom classes and replace with the > base class, boa will permit editing AND setting of the class via the > constr class field just like the BoaFAQ page seems to be saying. > > However if you then save your work and re use the design tool, Boa says > that the custom classes are not defined on the palette. Argggggh! If you make the following changes it should work. Riaan, I don't know if it would be possible to change Boa so it support namespaces (is this the right term?) in the custom classes. Werner > > I start with this code: > > ------------------------------------------------------ > > #Boa:Frame:Frame1 > > import FramePanelPage1 # exists and works from FramePanelPage1 import * > import FramePanelPage2 # exists and works from FramePanelPage2 import * > import wx > > def create(parent): > return Frame1(parent) > > [wxID_FRAME1, wxID_FRAME1NOTEBOOK1, wxID_FRAME1PANEL1, wxID_FRAME1PANEL2, > ] = [wx.NewId() for _init_ctrls in range(4)] > > > class Frame1(wx.Frame): > _custom_classes = {'wx.Panel': ['FramePanelPage1.FramePanelPage1', > 'FramePanelPage2.FramePanelPage2']} _custom_classes = {'wx.Panel': ['FramePanelPage1',FramePanelPage2']} > > def _init_coll_notebook1_Pages(self, parent): > # generated method, don't edit > > parent.AddPage(imageId=-1, page=self.panel1, select=True, > text='Pages0') > parent.AddPage(imageId=-1, page=self.panel2, select=False, > text='Pages1') > > def _init_ctrls(self, prnt): > # generated method, don't edit > wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt, > pos=wx.Point(524, 155), size=wx.Size(835, 708), > style=wx.DEFAULT_FRAME_STYLE, title='Frame1') > self.SetClientSize(wx.Size(827, 674)) > > self.notebook1 = wx.Notebook(id=wxID_FRAME1NOTEBOOK1, > name='notebook1', > parent=self, pos=wx.Point(0, 0), size=wx.Size(827, 674), > style=0) > > self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1, name='panel1', > parent=self, pos=wx.Point(0, 0), size=wx.Size(819, 648), > style=wx.TAB_TRAVERSAL) > > self.panel2 = wx.Panel(id=wxID_FRAME1PANEL2, name='panel2', > parent=self, pos=wx.Point(0, 0), size=wx.Size(819, 648), > style=wx.TAB_TRAVERSAL) > > self._init_coll_notebook1_Pages(self.notebook1) > > def __init__(self, parent): > self._init_ctrls(parent) > > ----------------------------------------- > > I edit in BOA - not by hand and get this > > ------------------------------------------ > #Boa:Frame:Frame1 > > import FramePanelPage1 > import FramePanelPage2 > import wx > > def create(parent): > return Frame1(parent) > > [wxID_FRAME1, wxID_FRAME1NOTEBOOK1, wxID_FRAME1PANEL1, wxID_FRAME1PANEL2, > ] = [wx.NewId() for _init_ctrls in range(4)] > > > class Frame1(wx.Frame): > _custom_classes = {'wx.Panel': ['FramePanelPage1.FramePanelPage1', > 'FramePanelPage2.FramePanelPage2']} > > def _init_coll_notebook1_Pages(self, parent): > # generated method, don't edit > > parent.AddPage(imageId=-1, page=self.panel1, select=False, > text='Pages0') > parent.AddPage(imageId=-1, page=self.panel2, select=True, > text='Pages1') > > def _init_ctrls(self, prnt): > # generated method, don't edit > wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt, > pos=wx.Point(524, 155), size=wx.Size(835, 708), > style=wx.DEFAULT_FRAME_STYLE, title='Frame1') > self.SetClientSize(wx.Size(827, 674)) > > self.notebook1 = wx.Notebook(id=wxID_FRAME1NOTEBOOK1, > name='notebook1', > parent=self, pos=wx.Point(0, 0), size=wx.Size(827, 674), > style=0) > > self.panel1 = FramePanelPage1.FramePanelPage1(id=wxID_FRAME1PANEL1, > name='panel1', parent=self, pos=wx.Point(0, 0), > size=wx.Size(819, 648), style=wx.TAB_TRAVERSAL) > > self.panel2 = FramePanelPage2.FramePanelPage2(id=wxID_FRAME1PANEL2, > name='panel2', parent=self, pos=wx.Point(0, 0), > size=wx.Size(819, 648), style=wx.TAB_TRAVERSAL) > > self._init_coll_notebook1_Pages(self.notebook1) > > def __init__(self, parent): > self._init_ctrls(parent) > > ----------------------------------- > > You can see that Boa has made the custom class substitution > > Now I ask Boa to edit again > > DesignerError: FramPanelPage1.FramePanelPage1 is not defined on > the Palette. > > Surely if this were true then Boa wouldn't have let me select the > classes in the first place! > > What's happening? > How do I get Boa to let me edit the code, other than my me hand > removing the custom classes? > > Thanks for any help > |