[wxpython-dev] Possible to derive from GC?
Nitro
nitro at dr-code.org
Thu May 29 16:07:14 PDT 2008
Hello,
I've send this message yesterday, but it seems it did not get through,
trying to sending it again.
1) Is it possible to derive my own class from wx.GraphicsContext or should
I rather create a GC by itself and then delegate to it?
2) wx.lib.pubsub seems to have a bug. If I change the code at line 860
class Foo2: to class Foo2(object): then the test breaks, because
_paramMinCount does not work anymore. Is there any reason to use if tests
in the _paramMinCount function? This is the code:
if type(callableObject) is InstanceType:
min, d = _paramMinCountFunc(callableObject.__call__.im_func)
return min-1, d
elif ismethod(callableObject):
min, d = _paramMinCountFunc(callableObject.im_func)
return min-1, d
elif isfunction(callableObject):
return _paramMinCountFunc(callableObject)
else:
raise 'Cannot determine type of callable: '+repr(callableObject)
I've rewritten it to the following code which passes the tests, also with
new-style classes.
try:
func = callableObject.__call__.im_func
except AttributeError:
try:
func = callableObject.im_func
except AttributeError:
try:
return _paramMinCountFunc(callableObject)
except exc:
raise 'Cannot determine type of callable: %s' %
repr(callableObject)
else:
min, d = _paramMinCountFunc(func)
return min-1, d
else:
min, d = _paramMinCountFunc(func)
return min-1, d
This code looks a bit clumsier than the original one. I don't see a much
better way right now though.
3) The pubsub question leads me to another question: How to you want to
handle SVN access? Should I create a branch which will be merged at the
end of the project?
And how should I deal with patches/fixes which are not related to
FloatCanvas (like the one to pubsub above)? Send in a patch on this
mailing list and somebody reviews and accepts it?
-Matthias
More information about the wxpython-dev
mailing list