[hafqa] [hafqa] [Bug 1154] New: SEVEN GTK TreeView bugs

From: bugzilla-daemon at maemo.org bugzilla-daemon at maemo.org
Date: Tue Mar 20 01:53:15 EET 2007
https://maemo.org/bugzilla/show_bug.cgi?id=1154

           Summary: SEVEN GTK TreeView bugs
           Product: haf
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gtk
        AssignedTo: tommi.komulainen at nokia.com
        ReportedBy: sean at cs.gmu.edu
         QAContact: hafqa at maemo.org


Some bugs reported on pymaemo which are actually underlying gtk bugs in hildon:

BUG GROUP 1.
Reported as:  https://garage.maemo.org/tracker/?group_id=40&atid=229&func=detail&aid=519
-------------

See the following code:   http://www.pygtk.org/pygtk2tutorial/sec-CellRenderers.html#cellrendererfig

1. GTK documentation and examples show column headers on by default; but they're off by default in 
maemo.

2. You cannot select multiple checkboxes -- if you select one the others are deselected.


BUG GROUP 2
Reported as:    https://garage.maemo.org/tracker/?group_id=40&atid=229&func=detail&aid=521
-------------

See the code at the end of this message.


1. The gtk.TreeView property "show-expanders" is listed in the documentation, but pymaemo's version 
doesn't recognize it.  How am I to turn on display of the expander triangles?

2. Reordering columns is hillarious to watch.  When you press down on a column header, it shifts to the 
row BENEATH it.  You must then drag that shifted header BELOW where you want it to go, with lots of 
weird screen artifacts, then let up and hope for the best.  Theoretically usable, but some major display 
bugs there!



BUG GROUP 3
Reported as:  https://garage.maemo.org/tracker/?group_id=40&atid=229&func=detail&aid=522
-------------

See the code at the end of this message.

1.  If you edit any TreeView row, you can change the text with the keyboard, but not with the large 
thumb-board.  The text appears to be modified, but when the thumb-board goes away, the text 
remains the same.

2. It's possible to resize a column out to the right such that you can't reach it any more. 

3. The minimum size for a CellRendererToggle is smaller than the toggle button itself, by one pixel.  
This minimum size should be set to at least 10 pixels wider.


ATTACHED CODE (for BUG GROUPS 2 and 3)

import pygtk
pygtk.require("2.0")
import gtk, gobject

tasks =  {
    "Buy groceries": "Go to Asda after work",
    "Do some programming": "Remember to update your software",
    "Power up systems": "Turn on the client but leave the server",
    "Watch some tv": "Remember to catch ER"
    } 

class GUI_Controller:
    """ The GUI class is the controller for our application """
    def __init__(self):
        # setup the main window
        self.root = gtk.Window(type=gtk.WINDOW_TOPLEVEL)
        self.root.set_title("CellRenderer Example")
        self.root.connect("destroy", self.destroy_cb)
        # Get the model and attach it to the view
        self.mdl = Store.get_model()
        self.view = Display.make_view( self.mdl )
        # Add our view into the main window
        self.root.add(self.view)
        self.root.show_all()
        return
    def destroy_cb(self, *kw):
        """ Destroy callback to shutdown the app """
        gtk.main_quit()
        return
    def run(self):
        """ run is called to set off the GTK mainloop """
        gtk.main()

class InfoModel:
    """ The model class holds the information we want to display """
    def __init__(self):
        """ Sets up and populates our gtk.TreeStore """
        self.tree_store = gtk.TreeStore( gobject.TYPE_STRING,
                                         gobject.TYPE_BOOLEAN )
        # places the global people data into the list
        # we form a simple tree.
        for item in tasks.keys():
            parent = self.tree_store.append( None, (item, None) )
            self.tree_store.append( parent, (tasks[item],None) )
        return
    def get_model(self):
        """ Returns the mo
del """
        if self.tree_store:
            return self.tree_store 
        else:
            return None

class DisplayModel:
    """ Displays the Info_Model model in a view """
    def make_view( self, model ):
        """ Form a view for the Tree Model """
        self.view = gtk.TreeView( model )
        self.view.set_headers_visible(True)
        self.view.set_fixed_height_mode(False)
        ######### COMMENT OUT THE FOLLOWING LINE, IT INCORRECTLY FAILS ###########
        self.view.set_property("show-expanders", True)
        # setup the text cell renderer and allows these
        # cells to be edited.
        self.renderer = gtk.CellRendererText()
        self.renderer.set_property( 'editable', True )
        self.renderer.connect( 'edited', self.col0_edited_cb, model )
        # The toggle cellrenderer is setup and we allow it to be
        # changed (toggled) by the user.
        self.renderer1 = gtk.CellRendererToggle()
        self.renderer1.set_property('activatable', True)
        self.renderer1.connect( 'toggled', self.col1_toggled_cb, model )
        
        # Connect column0 of the display with column 0 in our list model
        # The renderer will then display whatever is in column 0 of
        # our model .
        self.column0 = gtk.TreeViewColumn("Name", self.renderer, text=0)
        self.column0.set_reorderable(True)
        self.column0.set_resizable(gtk.TREE_VIEW_COLUMN_FIXED)
        
        # The columns active state is attached to the second column
        # in the model.  So when the model says True then the button
        # will show as active e.g on.
        self.column1 = gtk.TreeViewColumn("Complete", self.renderer1 )
        self.column1.add_attribute( self.renderer1, "active", 1)
        self.column1.set_reorderable(True)
        self.column1.set_resizable(gtk.TREE_VIEW_COLUMN_FIXED)
        self.view.append_column( self.column0 )
        self.view.append_column( self.column1 )
        return self.view
    def col0_edited_cb( self, cell, path, new_text, model ):
        """
        Called when a text cell is edited.  It puts the new text
        in the model so that it is displayed properly.
        """
        print "Change '%s' to '%s'" % (model[path][0], new_text)
        model[path][0] = new_text
        return
    def col1_toggled_cb( self, cell, path, model ):
        """
        Sets the toggled state on the toggle button to true or false.
        """
        model[path][1] = not model[path][1]
        print "Toggle '%s' to: %s" % (model[path][0], model[path][1],)
        return

if __name__ == '__main__':
    Store = InfoModel()	
    Display = DisplayModel()
    myGUI = GUI_Controller()
    myGUI.run()

-- 
Configure bugmail: https://maemo.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.

More information about the hafqa mailing list