Dabo

  I been working on taking the the HowTo Create a OpenOffice SpreadSheet
using the Class Designer using three different methods which are:

I   - Entering all the code within the Class Designer.
II  - Entering the spreadsheet code into the customerBizobj that is
      in the biz dir and calling the onHit from within the Class
      Designer.
III - Last is placing the spreadsheet code in a module in the current 
      project dir and again calling the onHit code within the Class
      Designer.

  What I am trying to do is learn how to using the Bizobjs within the CD
to allow special interfacing.  I have been working with Johnf in
learning on how to uses Dabo and later If Ed wants me to include this
into HowTo to Create a OpenOffice SpreadSheet using the Class Designer.

  The problem I am having is in Method II and Method III in the onHit
event for my button "Create Spread Sheet" using the Class Designer. I am
trying to pass the DataSet from my customerBizobj into my
spreadSheetInXXXXX().


def onHit(self, evt):
# Method-2- Takes this code and uses it the bizObj under CustomerBizobj 
#           in biz dir
    customerBizobj = self.CustomerBizobj.getBizobj()
    customerBizobj.spreadSheetinBizObj()

In the Class Designer when I sellect run the error I get is:
---------------------------------------------------------------------
Traceback (most recent call last):
  File
"/usr/lib/python2.5/site-packages/dabo/ui/uiwx/dControlMixin.py", 
    line 27, in _onWxHit
    self.raiseEvent(dEvents.Hit, evt, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/dabo/ui/uiwx/dPemMixin.py", 
    line 925, in raiseEvent
    super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args, 
    **kwargs)
  File "/usr/lib/python2.5/site-packages/dabo/lib/eventMixin.py", line 
    92, in raiseEvent
    bindingFunction(event)
  File "/tmp/tmpffgg6A.py", line 202, in onHit
    customerBizobj = self.CustomerBizobj.getBizobj()
AttributeError: 'dButton_8999737196751547571' object has no attribute
'CustomerBizobj'

------------------------------------------------------------------------
The code for my customerBizobj() is:

def spreadSheetinBizObj(self):
  # Method-1- spreadSheet defined in Class Designer
  # Method-2- Takes this code and places it in a module to be called 
  #           calcLib in the root project folder and def as
  #           spreadSheetInLib
  # * Method-3 ** Takes this code and uses it the bizObj under 
  #           CustomerBizobj in biz

        doc = ooolib.Calc()
        localDataSet = self.PrimaryBizobj.getDataSet()
        row_num=1
        for row in localDataSet:
                col_num=1
                for cols in row.keys():
                        if type(row[cols]) is bool:
                                columntype='bool'
                        elif type(row[cols]) is int:
                                columntype='float'
                        elif type(row[cols]) is unicode:
                                columntype='string'
                        # OK let's write out the data to spreadsheet
                        doc.set_cell_value(col_num, row_num, 
columntype,row[cols])
                        col_num=col_num+1
                row_num=row_num+1
                # Save the document to the file you want to create.
                # You need to change the path to match your environment
                doc.save("dabo-example01.ods")
                os.popen2('/usr/bin/oocalc dabo-example01.ods')

Method I works with out a problem but Method II and III by trying to
access the dataSet is giving me problems.  Any Ideas and how to fix it?

Bob






_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/1229102503.12172.43.ca...@sysero-rkm-laptop

Reply via email to