Revision 855 org.gvsig.scripting/trunk/org.gvsig.scripting/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/scripting/lib/gvsig/libs/formpanel.py
formpanel.py | ||
---|---|---|
61 | 61 |
else: |
62 | 62 |
threading.Thread(target=self.function, name=self.componentName, args=args).start() |
63 | 63 |
|
64 |
class ActionListenerAdapter(ListenerAdapter, java.awt.event.ActionListener): |
|
64 |
#---------------- |
|
65 |
# Falla invocar a ListenerAdapter.__init__(self,function,componentName) |
|
66 |
# por que dice que self no es un ListenerAdapter. |
|
67 |
# De momento duplico el codigo de ListenerAdapter incrustandolo en esta clase. |
|
68 |
class ActionListenerAdapter_Upss(ListenerAdapter, java.awt.event.ActionListener): |
|
65 | 69 |
def __init__(self,function,componentName=None): |
66 | 70 |
ListenerAdapter.__init__(self,function,componentName) |
67 | 71 |
def actionPerformed(self,*args): |
68 | 72 |
#print "ActionListenerAdapter %s %s" % (self.componentName, args[0]) |
69 | 73 |
self(*args) |
70 | 74 |
|
75 |
class ActionListenerAdapter(java.awt.event.ActionListener): |
|
76 |
def __init__(self,function,componentName=None): |
|
77 |
self.function = function |
|
78 |
self.synchronous = True |
|
79 |
if componentName == None: |
|
80 |
self.componentName = self.function.__name__ |
|
81 |
else: |
|
82 |
self.componentName = componentName |
|
83 |
x = getattr(function,"im_func",function) |
|
84 |
x.setSynchronous = self.setSynchronous |
|
85 |
def setSynchronous(self, value): |
|
86 |
self.synchronous = value |
|
87 |
def __call__(self, *args): |
|
88 |
if self.synchronous: |
|
89 |
self.function(*args) |
|
90 |
else: |
|
91 |
threading.Thread(target=self.function, name=self.componentName, args=args).start() |
|
92 |
|
|
93 |
def actionPerformed(self,*args): |
|
94 |
#print "ActionListenerAdapter %s %s" % (self.componentName, args[0]) |
|
95 |
self(*args) |
|
96 |
|
|
97 |
|
|
71 | 98 |
class ChangeListenerAdapter(ListenerAdapter, javax.swing.event.ChangeListener): |
72 | 99 |
def __init__(self,function, componentName=None): |
73 | 100 |
ListenerAdapter.__init__(self,function,componentName) |
Also available in: Unified diff