[wxPython-users] Grid Cell Renderer

Rich Shepard rshepard at appl-ecosys.com
Wed Jan 2 15:11:06 PST 2008


On Wed, 2 Jan 2008, Mark Erbaugh wrote:

> Here's the situation. There is a database table (CATEGORY) with a list of
> categories. Each row in this table has a unique (SERIAL/AUTO-INCREMENT)
> integer column a name column.
>
> There is a second table (MATERIAL). Each row has an integer column (RSN)
> that references a row in the first table. For each row in this table,
> there needs to select a category from the CATEGORY table.

Mark,

   I must be missing something because I don't see any problem. For example,
you have a combo box with CATEGORY names displayed. When your user selects a
name, your SELECT statement would match the MATERIAL foreign key to the
CATAGORY primary key (using your dictionary) and display the appropriate
MATERIAL string. Is this not what you want? And, each row in the grid has a
different CATEGORY?

> Are you suggesting that I put the code to translate from the integer to
> the string in the GridTable?

   No. In the method bound to the combo box selection.

> That should work, but wouldn't that be putting some view logic in the
> model (assuming MVC)?

   IIRC, wxPython implements the MVC concept imperfectly. And, there are
valid situations when de-normalizing relational database tables is also
justified for speed and ease of use. What works ought to be the determining
criterion.

Rich

-- 
Richard B. Shepard, Ph.D.               |  Integrity            Credibility
Applied Ecosystem Services, Inc.        |            Innovation
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863




More information about the wxpython-users mailing list