Re: [pygtk] TreeView and CellRendererCombo - MS Access-like form behaviour

2008-04-21 Thread John Finlay

Stéphane Brunet wrote:

John Finlay a écrit :

Stéphane Brunet wrote:

Hi,

btw, thank you John Finlay for the answer on my last question.

In my quest of a GUI interfacing my small database application (I 
did try OpenOffice Base and went mad after one hour :S ) I would 
like to copy some behaviour of MS Access in my forms.


Say I have two (SQL) tables with two fields and one relation between 
the two:


  
|Table1|  |Table2|
  
| Field1 (int) |<>| Field1 (int) |
| Field2 (str) |  | Field2 (str) |
  

Now in my PyGTK form of Table1 (a TreeView), when I display the 
Field1 in the first column, I would like to have a ComboBox which 
displays the text associated to the integer value of Table2 (i.e. 
Table2.Field2) rather than the value directly. However, I still want 
it stored as an integer in Table1.Field1.


How would you do this in an elegant manner ? Do I have to create my 
own CellRenderer more generic than a CellRendererCombo ?
How do you want the db info displayed in the treeview? 
I think of actually displaying the content of Table1 with Field1 in 
the first column and Field2 in a second column. However, Field1 
wouldn't be displayed as an integer but as a string coming from 
Table2. In order to modify the content of Field1, I would like the 
user to select a string (of Table2.Field2) in a CellRendererCombo 
rather than an integer.



Are you planning on inserting the
table info into a liststore or generating it on the fly?

I thought of using two separate ListStore to store the content of each 
table. I don't know if it is the best way but I want to alter the 
information in the DB only when the user has finished his 
modifications in the GUI.


To set the value displayed in the first column you could use 
set_cell_data_func and then set the text in the associated function 
using the table1 field1 value to select the table2 field2 value.


John
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] TreeView and CellRendererCombo - MS Access-like form behaviour

2008-04-20 Thread Stéphane Brunet

John Finlay a écrit :

Stéphane Brunet wrote:

Hi,

btw, thank you John Finlay for the answer on my last question.

In my quest of a GUI interfacing my small database application (I did 
try OpenOffice Base and went mad after one hour :S ) I would like to 
copy some behaviour of MS Access in my forms.


Say I have two (SQL) tables with two fields and one relation between 
the two:


  
|Table1|  |Table2|
  
| Field1 (int) |<>| Field1 (int) |
| Field2 (str) |  | Field2 (str) |
  

Now in my PyGTK form of Table1 (a TreeView), when I display the 
Field1 in the first column, I would like to have a ComboBox which 
displays the text associated to the integer value of Table2 (i.e. 
Table2.Field2) rather than the value directly. However, I still want 
it stored as an integer in Table1.Field1.


How would you do this in an elegant manner ? Do I have to create my 
own CellRenderer more generic than a CellRendererCombo ?
How do you want the db info displayed in the treeview? 
I think of actually displaying the content of Table1 with Field1 in the 
first column and Field2 in a second column. However, Field1 wouldn't be 
displayed as an integer but as a string coming from Table2. In order to 
modify the content of Field1, I would like the user to select a string 
(of Table2.Field2) in a CellRendererCombo rather than an integer.



Are you planning on inserting the
table info into a liststore or generating it on the fly?

I thought of using two separate ListStore to store the content of each 
table. I don't know if it is the best way but I want to alter the 
information in the DB only when the user has finished his modifications 
in the GUI.


Stéphane
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] TreeView and CellRendererCombo - MS Access-like form behaviour

2008-04-20 Thread John Finlay

Stéphane Brunet wrote:

Hi,

btw, thank you John Finlay for the answer on my last question.

In my quest of a GUI interfacing my small database application (I did 
try OpenOffice Base and went mad after one hour :S ) I would like to 
copy some behaviour of MS Access in my forms.


Say I have two (SQL) tables with two fields and one relation between 
the two:


  
|Table1|  |Table2|
  
| Field1 (int) |<>| Field1 (int) |
| Field2 (str) |  | Field2 (str) |
  

Now in my PyGTK form of Table1 (a TreeView), when I display the Field1 
in the first column, I would like to have a ComboBox which displays 
the text associated to the integer value of Table2 (i.e. 
Table2.Field2) rather than the value directly. However, I still want 
it stored as an integer in Table1.Field1.


How would you do this in an elegant manner ? Do I have to create my 
own CellRenderer more generic than a CellRendererCombo ?
How do you want the db info displayed in the treeview? Are you planning 
on inserting the

table info into a liststore or generating it on the fly?

John
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] TreeView and CellRendererCombo - MS Access-like form behaviour

2008-04-19 Thread Stéphane Brunet

Hi,

btw, thank you John Finlay for the answer on my last question.

In my quest of a GUI interfacing my small database application (I did 
try OpenOffice Base and went mad after one hour :S ) I would like to 
copy some behaviour of MS Access in my forms.


Say I have two (SQL) tables with two fields and one relation between the 
two:


  
|Table1|  |Table2|
  
| Field1 (int) |<>| Field1 (int) |
| Field2 (str) |  | Field2 (str) |
  

Now in my PyGTK form of Table1 (a TreeView), when I display the Field1 
in the first column, I would like to have a ComboBox which displays the 
text associated to the integer value of Table2 (i.e. Table2.Field2) 
rather than the value directly. However, I still want it stored as an 
integer in Table1.Field1.


How would you do this in an elegant manner ? Do I have to create my own 
CellRenderer more generic than a CellRendererCombo ?


Thanks again,

Stéphane

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/