El 04/06/13 13:34, Ed Leafe escribió:
On Jun 4, 2013, at 11:06 AM, Ricardo Aráoz <[email protected]> wrote:

i) Looking through the mails of this list I've found two uses of super
    a) self.super()
    b) super(MyDateTextBase, self).initProperties()

    A couple of questions :
            1) What is the difference? What's the different use of both?
        self.super() was a hack that was designed to make VFP developers a 
little more comfortable in Python. The second form is the correct way to call 
superclass behavior.

            2) in b), is it really necessary to use it? I thought 
initProperties() was a user's method.
        Generally, this should be strictly user-defined code, so it isn't 
necessary. It won't hurt, though.

ii) And now the original question. I want to send a list to a panel when 
instantiating it so that the panel will create a series of radio buttons one 
for each item of the list. That is :
        mypnl = pnlMyPanel(self, myListOfRadioButtons)
        mySizer.append(mypnl)

    So now I have a panel set with the appropriate radio buttons. So how do I 
intercept the parameter (myListOfRadioButtons) and then let the rest of the 
panel's initializing stuff get along? I was thinking of an __init__(self, 
myList, *args, **kw): and then call super(pnlMyPanel, self).__init__(self, 
*args, **kw). Would that be right? Is there a better way?
        Assuming that 'pnlMyPanel' is the *class* name, and not the instance 
name, yes, that would be correct. FWIW, class names are generally TitleCased in 
Python.


I MUST be doing something wrong, here's part of my code :

class pnlPuertoSerial(dabo.ui.dPanel):
def __init__(self, *args, **kwargs):
super(pnlPuertoSerial, self).__init__(self, *args, **kwargs)
def afterInit(self):
self.puertos = ['Com1', 'Com2', 'Com3']
self.Sizer = bsBoxSizer(self, 'h', Caption=' Puerto serial ')
rlPuertos = dabo.ui.dRadioList(self,
Choices=self.puertos,
ValueMode='String')
self.Sizer.append1x(rlPuertos) ......


class pnlParametros(dabo.ui.dPanel):

def initProperties(self):

self.StatusText = "Para programar la lectora"

def afterInit(self):
self.Sizer = vs = dabo.ui.dSizer('v')
hs = dabo.ui.dSizer('h') hs.append1x(pnlPuertoSerial(self), border=2)
vs.append1x(hs)


And the error report :


Traceback (most recent call last):
File "/home/richie/Python/ProXimaxIV/ui/ProXimax.py", line 354, in <module>
app.start()
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/dApp.py", line 388, in start
self.setup()
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/dApp.py", line 340, in setup
self.initUIApp()
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/dApp.py", line 380, in initUIApp
self.uiApp.setup()
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/uiApp.py", line 432, in setup
frm = self.dApp.MainForm = mfc()
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dForm.py", line 1043, in __init__
*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dForm.py", line 40, in __init__
attProperties=attProperties, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dFormMixin.py", line 76, in __init__
attProperties=attProperties, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPemMixin.py", line 201, in __init__
self._afterInit()
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dForm.py", line 58, in _afterInit
super(BaseForm, self)._afterInit()
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dFormMixin.py", line 128, in _afterInit
super(dFormMixin, self)._afterInit()
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPemMixin.py", line 339, in _afterInit
self.afterInit()
File "/home/richie/Python/ProXimaxIV/ui/ProXimax.py", line 329, in afterInit
pgFrm.appendPage(pgParametros)
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPageFrameMixin.py", line 178, in appendPage return self.insertPage(self.GetPageCount(), pgCls, caption, imgKey, **kwargs) File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPageFrameMixin.py", line 211, in insertPage
pg = pgCls(self, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPage.py", line 17, in __init__
super(dPage, self).__init__(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPanel.py", line 305, in __init__
attProperties=attProperties, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPanel.py", line 246, in __init__
properties=properties, attProperties=attProperties, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPanel.py", line 36, in __init__
properties=properties, attProperties=attProperties, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPemMixin.py", line 201, in __init__
self._afterInit()
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPage.py", line 24, in _afterInit
super(dPage, self)._afterInit()
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPemMixin.py", line 339, in _afterInit
self.afterInit()
File "/home/richie/Python/ProXimaxIV/ui/ProXimax.py", line 293, in afterInit
pnl = self.pnl = pnlParametros(self)
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPanel.py", line 268, in __init__
attProperties=attProperties, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPanel.py", line 246, in __init__
properties=properties, attProperties=attProperties, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPanel.py", line 36, in __init__
properties=properties, attProperties=attProperties, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPemMixin.py", line 201, in __init__
self._afterInit()
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPemMixin.py", line 339, in _afterInit
self.afterInit()
File "/home/richie/Python/ProXimaxIV/ui/ProXimax.py", line 281, in afterInit
hs.append1x(pnlPuertoSerial(self), border=2)
File "/home/richie/Python/ProXimaxIV/ui/ProXimax.py", line 163, in __init__
super(pnlPuertoSerial, self).__init__(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPanel.py", line 268, in __init__
attProperties=attProperties, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPanel.py", line 246, in __init__
properties=properties, attProperties=attProperties, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/ui/uiwx/dPanel.py", line 28, in __init__
buff = self._extractKey((properties, kwargs), "Buffered", False)
File "/usr/local/lib/python2.7/dist-packages/Dabo-0.9.9-py2.7.egg/dabo/lib/propertyHelperMixin.py", line 98, in _extractKey
ret = dd[key]
TypeError: 'pnlParametros' object has no attribute '__getitem__'






--- StripMime Report -- processed MIME parts ---
multipart/alternative
 text/plain (text body -- kept)
 text/html
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to