DictionaryGrid cell-edited event should include the old row value in addition to the edited value

Bug #568761 reported by Rick Spencer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Quickly Widgets
Confirmed
Undecided
Rick Spencer

Bug Description

after a change occurs, I would like to test if I need to delete the old values. However, the old value is not included so I have to write copious code to connect to the cell-edited event for the underlying cell rendered.

Revision history for this message
Rick Spencer (rick-rickspencer3) wrote :

Here's some sample code to work around this until it is fixed. This just uses the gtk.TreeView functionality, so it should continue working even after the bug is fixed

#first, create a grid as normal
        self.views_grid = DictionaryGrid({},keys=["Design Document","View"],editable=True)
        self.views_grid.connect("selection-changed", self.view_selected)
        self.views_grid.show()

#then loop through the columns in the grid and hook up signal handler
#for the columns that you want track editing for
        for c in self.views_grid.get_columns():
            if c.key == "Design Document":
                c.renderer.connect("edited",self.design_doc_edited, c)
            elif c.key == "View":
                c.renderer.connect("edited",self.view_name_edited, c)

#Then in the signal handlers, you get the info that you need
#the new value is passed in, but the old value is still available
#Note that the DictionaryGrid will change the value for you
    def design_doc_edited(self, cell, path, new_dd, col):
        iter = self.views_grid.get_model().get_iter(path)
        old_dd = self.views_grid.get_model().get_value(iter,0)
        view_name = self.views_grid.get_model().get_value(iter,1)

Revision history for this message
Rick Spencer (rick-rickspencer3) wrote :

Scratch comment #1. In fact, it doesn't help at all. What I thought was old_value, is really new value

Changed in quidgets:
status: New → Won't Fix
Revision history for this message
Rick Spencer (rick-rickspencer3) wrote :

I don't believe that the underlying pygtk implementation has the necessary functionality to manage this. In the case where the developer needs to track the old value, they will need to store it, for example within the dictionary for the row.

Revision history for this message
Rick Spencer (rick-rickspencer3) wrote :

Ok, I can fix this. The current problem is that the GridColumn._cell_edited functions are modifying the list store before DictionaryGrid gets a chance to do something with it.

Changed in quidgets:
status: Won't Fix → Confirmed
assignee: nobody → Rick Spencer (rick-rickspencer3)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.