Field

Ticket #62 (closed)

Opened 5 months ago

Last modified 5 months ago

DynamicExtensionPoint use syntax reveals Jython integration bug

Reported by: marc Assigned to:
Priority: Milestone:
Component: Version:
Keywords: Cc:

Description

The following code should work, but doesnt:

from java.awt.event import MouseListener
from field.core.plugins.python import DynamicExtensionPoint

_self.onCanvas_ = DynamicExtensionPoint(MouseListener)
_self.enclosingFrame.getCanvas().addMouseListener(_self.onCanvas_.getProxy())

@_self.onCanvas_.mousePressed
def pressed(event):
       print event

While this code does work

from java.awt.event import MouseListener
from field.core.plugins.python import DynamicExtensionPoint

_self.onCanvas_ = DynamicExtensionPoint(MouseListener)
_self.enclosingFrame.getCanvas().addMouseListener(_self.onCanvas_.getProxy())

m = _self.onCanvas_.mousePressed
@m
def pressed(event):
       print event

It looks like _self.onCanvas_.mousePressed goes though the correct __findattr__ mechanism while _self.onCanvas_.mousePressed() somehow shorts it.

Change History

07/25/2008 10:34:33 AM changed by marc

  • status changed from new to assigned.

It's independant of it's use as an decorator _self.onCanvas_.mousePressed() doesn't work and it should (and does if you assign it to a temporary variable)

07/25/2008 10:41:53 AM changed by marc

  • status changed from assigned to closed.

07/25/2008 11:32:38 AM changed by marc

Ok, I've found a protected method of PyJavaInstance? that I can override that seems to be a fast path for finding functions from object (as opposed to finding attributes !? this is definately new in Jython 2.5)

changeset:108

By rights PyCallableJavaInstance? should have the same fix, but I'm going to wait a little until the ramifications of this "fix" are clearer.