I am trying to create a list of item that the user can select 1 row. I would like
to allow the user to sort list based on any of the columns. If I uncomment the line
in the follow code then the user to sort on any one column. When I do this the focus
on the column heading. I want the focus to start on list.

Also is there any easy why to get the height of the column heading. I have the list in
a scrolling window and would like to create the window of the correct size make a 
number
of visible in the scroll window. The call to cell_get_size get me the size of a row in
the tree. The header is not the same size and I hate  putting constant which is not a
good thing to do to make the size correct.

                scroll = gtk.ScrolledWindow()
                scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)

                for title in self.config['column']:
                        if 'type' in title:
                                type_list.append(title['type'])
                        else:
                                type_list.append(gobject.TYPE_STRING)

                self.store = gtk.ListStore(*type_list)
                list = gtk.TreeView(self.store)
                self.treeView = list
                list.connect('row_activated', self.row_activated_event)
                list.set_rules_hint(gtk.TRUE)
                list.set_headers_clickable(gtk.TRUE)
                selection = list.get_selection()
                selection.set_mode(gtk.SELECTION_BROWSE)

                count = 0
                for title in self.config['column']:
                        if 'hidden' in title:
                                if title['hidden'] != 'no':
                                        count += 1
                                        continue

                        renderer = gtk.CellRendererText()
                        column = gtk.TreeViewColumn(title['label'], renderer,
                                text=count)
                        self.column.append({})


self.column[count]['viewColumn'] = column self.column[count]['columnID'] = count for key in title: self.column[count][key] = title[key] column.set_resizable(gtk.TRUE) column.set_sizing(gtk.TREE_VIEW_COLUMN_GROW_ONLY) # column.set_clickable(gtk.TRUE) # column.set_sort_column_id(count) # column.set_reorderable(gtk.TRUE) list.append_column(column)

                        if cell_height == None:
                                (rectangle, cell_x, cell_y, cell_width, cell_height) = 
column.cell_get_size

count += 1


scroll.set_size_request(-1, cell_height * row_count + 4)


self.treeView.show_all()



_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to