Kiwi CList and CTree widget questions
smcclure at racemi.com
Thu Aug 21 07:59:05 BRST 2003
On Wed, 2003-08-20 at 18:27, Christian Reis wrote:
> On Wed, Aug 20, 2003 at 06:10:42PM -0400, Steve McClure wrote:
> > 1) I have a GladeView that has a GtkCList in it. When I instantiate the
> > view the GtkCList widget defined in the glade file has been magically
> > transformed into a Kiwi.List.CList. I don't see the same thing happing
> > to different GladeView that has a GtkCTree in it. What triggers this
> > behavior.
> This behaviour is defined by the _widget_map in Views.py. As you can
> see, all the widgets that are magically converted are listed there. You
> can do two different things to fix this for you:
> a) Add the CTree to _widget_map,
> b) Call Views.register_widget(CTree)
Thanks, I'll try that.
> There is a third option, but unfortunately it is only available in CVS
> HEAD. I need to get 0.6.0 out (it's practically ready and done) but I
> need to update the documentation, and time has been scarce so far.
> > 2) In the the GladeView that has the Kiwi.List.CList object in it, after
> > calling Views.GladeView.__init__ I attempt to call
> > set_column_visibility(0, 0) on the CList object and I get this
> > traceback:
> > File
> > "/opt/race/share/sw/os/Linux_2.4_i686/python/lib/python2.1/site-packages/Kiwi/List.py", line 721, in set_column_visibility
> > self.column_visibility[column] = visible
> > File
> > "/opt/race/share/sw/os/Linux_2.4_i686/python/lib/python2.1/site-packages/gtk-1.2/gtk.py", line 1224, in __getattr__
> > return GtkContainer.__getattr__(self, attr)
> > File
> > "/opt/race/share/sw/os/Linux_2.4_i686/python/lib/python2.1/site-packages/gtk-1.2/gtk.py", line 77, in __getattr__
> > raise AttributeError, attr
> > AttributeError: column_visibility
> > It looks like I need to call enable_column_select first although my
> > intent was to use the GtkCList.set_column_visibility method directly. I
> > doesn't seem like this should be necessary.
> Hmmm. This is an interesting point. Let me think for a bit.
> Okay, here resides the problem: enable_column_select does evil things to
> the headers, and *also* initializes the column_visibility attribute.
> This should really be done in _initialize(), and I've changed this in
> CVS HEAD now.
> To work around this, if you can't patch Kiwi (it's trivial -- just add
> an initializing statement to _initialize), you can call
> gtk.GtkCList.set_column_visibility() directly. It won't play very nicely
> with selection after that, but I assume it's not a problem.
I found that call and added that to my code.
> > 3) Gtk.GtkCTree inherits from Gtk.GtkCList but the same is not true of
> > the Kiwi versions. I would like to allow the user to choose to display
> > some columns of a CTree as they wish and record those selections for the
> > next time they start the app, obviously that cannot be done.
> > Could/should Kiwi.List.CTree inherit from Kiwi.List.CList?
> If you see Kiwi/__init__.py, in my TODO list there is an entry:
> Make CList and CTree share some functions through a common base.
> (I really wish that GTK+ followed this idiom too, but it doesn't.) This
> means that (at least theoretically) yes, it should be possible (and I
> would like) to move stuff from CList upwards into a ListBase class. It's
> not hard work, I think, but I'm just overloaded at the moment. If you
> want to hack a patch, I'd be happy to accept it.
I might do that, I just added a bunch of columns and it would be nice if
the user could display them individually. I'm kind of in the same boat
time wise, but it always seems that way.
> Take care,
> Christian Reis, Senior Engineer, Async Open Source, Brazil.
> http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
Thanks for the help Christian.
Steve McClure <smcclure at racemi.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://www.async.com.br/pipermail/kiwi/attachments/20030821/74a1cc23/attachment.bin
More information about the Kiwi