Ed Leafe wrote:
> dabo Commit
> Revision 3081
> Date: 2007-04-24 11:33:44 -0700 (Tue, 24 Apr 2007)
> Author: Ed
> Trac: http://svn.dabodev.com/trac/dabo/changeset/3081
> 
> Changed:
> U   trunk/dabo/ui/dDataControlMixinBase.py
> 
> Log:
> Removed the requirement that objects used as DataSources have to inherit from 
> dObject.

Apparently that also removed the requirement that they only work with 
properties, not attributes.

I see the "This may result in unsupported problems" but I would think the 
flexibility is something you would want to support, now that is seems to be 
working.

# db3.py
# data binding demo ver3

class myClass(object):

    def __init__(self):
      self.myAttrib1 = 'a'
      self.myAttrib2 = 'b'

    def swap(self):
      self.myAttrib1, self.myAttrib2 = self.myAttrib2, self.myAttrib1

    def test(self):
      print self.myAttrib1, self.myAttrib2
      self.swap()
      print self.myAttrib1, self.myAttrib2


import dabo
dabo.ui.loadUI("wx")

class MyForm(dabo.ui.dForm):
  def initProperties(self):
   self.Caption = "Bind to BO Demo"
   self.Top = 273
   self.Height = 118
   self.Width = 295
   self.Left = 61

  def afterInit(self):
   pan = dabo.ui.dPanel(self)

   dabo.ui.dTextBox(pan, Height=41, DataSource=myObj,
     DataField="myAttrib1", RegID="txt1" )

   dabo.ui.dButton(pan, RegID="butSwap", Caption="Swap")

   dabo.ui.dTextBox(pan, Height=41, DataSource=myObj,
     DataField="myAttrib2", RegID="txt2" )

   hs = pan.Sizer = dabo.ui.dSizer("h")
   hs.append(self.txt1, "expand")
   hs.append(self.butSwap, alignment="Middle")
   hs.append(self.txt2, "expand")

   self.Sizer.append1x(pan)
   self.update()

  def onHit_butSwap(self, evt):
   myObj.swap()
   self.update()

if __name__ == "__main__":

  myObj=myClass()
  myObj.test()

  app = dabo.dApp(MainFormClass=None)
  app.setup()
  frm = MyForm()
  frm.show()
  app.start()



_______________________________________________
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/dabo-dev/[EMAIL PROTECTED]

Reply via email to