On Oct 3, 2009, at 12:04 AM, Ricardo Aráoz wrote:

> Right, so I have the following in my dDialog (funny was that there  
> is no
> builtin property .PrimaryBizobj)  :

        It's not funny; it's deliberate. Forms are designed for data editing;  
dialogs are supposed to be for brief notifications to the user. It's  
consistent with the philosophy that modal states are to be avoided,  
not encouraged.

        Originally we had planned on allowing for modal forms, but it turned  
out that wxPython didn't really support that. (It's funnier that forms  
have a showModal() method that only raises an error).


> -----------------------------------------------------------------------
> def afterInit(self):
>   self.Aceptar = 'No aceptado'
>   self.conn = dabo.db.connect(dbType="sqlite", Database=":memory:")
>   self.crsr = conn.cursor()
>   self.crsr.execute("""create table Filtro
>                                       ('PKId' INTEGER PRIMARY KEY
> AUTOINCREMENT NOT NULL
>                                       ,'campo' TEXT
>                                       , operador TEXT
>                                       , valor TEXT)""")
>   #self.crsr.execute("insert into test (field1, field2) values
> ('test', 1)")
>
>   self.PrimaryBizobj = dabo.biz.dBizobj(self.conn)
>   self.PrimaryBizobj.Datasource = 'Filtro'
>   self.PrimaryBizobj.KeyField = 'PKId'
>   self.PrimaryBizobj.AutoPopulatePK = True
>   self.PrimaryBizobj.DataStructure = (('PKId', 'I', True,
> 'Filtro','PKId', None)
>                                                                   ,
> ('campo', 'C', False, 'Filtro', 'campo', None)
>                                                                   ,
> ('operador', 'C', False, 'Filtro', 'operador', None)
>                                                                   ,
> ('valor', 'C', False, 'Filtro', 'valor', None))
>
> ----------------------------------------------------------------------------------------------------
> Now what do I put in dGrid.DataSource? My form (dDialog) has no
> "matching DataSource" that I know of (I have the feeling I'm doing
> something really wrong here). Should it be just dGrid.DataSource =
> 'Filtro' ?

        First, you should always be aware of the following: when it feels as  
though you're fighting the framework, or re-implementing a big chunk  
of it to get around something, that's a sign that you are  
misunderstanding or misusing the framework.

        Why do you need a bizobj? I thought that this data was display-only,  
and not going to be persisted. If that's the case, then why bother  
with sqlite, bizobjs, cursors, etc., and just create the data as you  
mentioned in your original post? Then you'll have a dataset, and can  
set the grid's DataSouce to that dataset. In fact, you could do  
something like this:

ds = ({...}, {...})
grid = dabo.ui.dGrid(self, ...)
grid.buildFromDataSet(ds)

        Check out the code in the dabo.ui.ui.uiwx.__init__.py.browse() method.


-- Ed Leafe





_______________________________________________
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/[email protected]

Reply via email to