On Friday 28 September 2007 11:52, Ed Leafe wrote: > On Sep 28, 2007, at 1:58 PM, <lalong1 .at. bellsouth .D.OT net> > > <lalong1@bellsouth.net> wrote: > > How do I access dGridDataTable? > > > > I tried the code below (and various other iterations) with no luck... > > > > from dGrid import dGridDataTable > > > > class distGrid(dabo.ui.dGrid): > > def afterInit(self): > > self._Table=distGridDataTable > > > > class distGridDataTable(dGridDataTable): > > Well, it's a wxPython-specific implementation detail, so we did not > expose it to the dabo.ui namespace. But for cases like this, I've > added a classmethod to dGrid that will return a reference to this > table class. So now you can use syntax such as: > > class distGridDataTable(dabo.ui.dGrid.getTableClass()): > > -- Ed Leafe We sort of worked around the issue. Your thoughts?
from dabo.ui.uiwx.dGrid import dGridDataTable
class distGrid(dabo.ui.dGrid): def afterInit(self): #tbl = distGridDataTable(self) #self.SetTable(tbl, False) self._Table=distGridDataTable(self) class distGridDataTable(dGridDataTable): def GetValue(self, row, col): if self.grid.Columns[col].DataField: val= self.grid._dataSet[row][self.grid.Columns[col].DataField] if self.grid.Columns[col].DataField=="nqtyonhand": try: val=self.nqtyonhandFormat(val) except: pass else: val=None return(val) def nqtyonhandFormat(self,val): if app.Application.WtDisplayMode==0: grams=val*1000 lbs=int(grams/453.5924) val2=grams-(lbs*453.5924) oz=int(val2/28.3495231) val=str(lbs).strip()+' lbs '+str(oz).strip()+' oz' else: if val<1: val=str(val*1000).strip()+' g' else: val=str(val).strip()+' Kg' return(val)
-- John Fabiani
©2007 johnf |