How do I use the TreeModelFilter to process tree/store data automatically?
The TreeModelFilter is not just useful for filtering data from a model; it can be used to synthesize completely new columns that were never in the original model. The example code below generates a filtered version of a ListStore, with 2 string columns, from an original model with only one column of Python objects. This filtered model can then be used in TreeViews and ComboBoxes in the usual fashion. This is a powerful way to abstract your application model (your business objects) from the view (the way they are displayed.) For more info on TreeModelFilter see the PyGTK tutorial (FAQ 1.9.
The TreeModelFilter is not just useful for filtering data from a model; it can be used to synthesize completely new columns that were never in the original model. The example code below generates a filtered version of a ListStore, with 2 string columns, from an original model with only one column of Python objects. This filtered model can then be used in TreeViews and ComboBoxes in the usual fashion.
Related Questions
- Can you define a persistence store from which data will be automatically uploaded to the cache when the service starts and updated back when the service shuts down?
- If I add my Business ExtrAA number to my reservation during the booking process, will it automatically store in my Reservation Preferences?
- How do I use the TreeModelFilter to process tree/store data automatically?