Re: [pygtk] Does ctree.selection work?



On Mon, 27 Aug 2001, Christian Robottom Reis wrote:

On Thu, 16 Aug 2001, James Henstridge wrote:

That's weird.  ctree.selection should be calling
gtk_ctree_get_selection(), which should be treating the data members of
the list as GtkCTreeNodes.

It's quite odd, but I know the reason why it's happening. I wrote the
class as:

class CTree(gtk.GtkCTree, CList):
      pass

where CList is

class CList(gtk.GtkCList):
      pass

Because I wanted to take advantage of the features implemented in my
CList. This is broken inheritance, as I see it, since we have:

GtkCList -> GtkCTree -> CTree
     \                  /
       ----my CList----

I've been thinking of how to fix it, and the only way I see it is
providing a separate class to execute the actual extensions and call that
from my CList/CTree as a helper. Does that sound sane?

Maybe putting the common code into another class, and using it as a mixin
for both your CTree and CList.  Almost always, you should treat CList and
CTree as totally different widgets (and one just happens to be derived
from the other).  This is one of the annoying things about the widgets.


The code in GtkCTree.__getattr__ should be catching this lookup before it
recurses to GtkCList.__getattr__.

Right, but that broke when I did my inheritance foobar. Now I see why this
is complicated :)

James.

-- 
Email: james daa com au
WWW:   http://www.daa.com.au/~james/






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]