[hafqa] [hafqa] [Bug 1099] New: Column reordering in gtk treeviews is broken
From: bugzilla-daemon at maemo.org bugzilla-daemon at maemo.orgDate: Mon Feb 26 06:42:23 EET 2007
- Previous message: [hafqa] [Bug 1027] maemo-launcher does not install headers
- Next message: [hafqa] [Bug 1089] control-panel zooming incorrectly resizes the items
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
https://maemo.org/bugzilla/show_bug.cgi?id=1099 Summary: Column reordering in gtk treeviews is broken 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 I posted the following python code below to the pymaemo buglist, with the following statement: "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!" Osvaldo Santana responded by stating that this appears to be nasty gtk bugs and not pymaemo/pygtk bugs. They're pretty bad. Sean 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 model """ 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.
- Previous message: [hafqa] [Bug 1027] maemo-launcher does not install headers
- Next message: [hafqa] [Bug 1089] control-panel zooming incorrectly resizes the items
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]