/usr/share/pyshared/PythonCard/tools/experimentalResourceEditor/modules/actionBinderDialog.py is in python-pythoncard 0.8.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | """
__version__ = "$Revision: 1.2 $"
__date__ = "$Date: 2004/12/31 20:44:29 $"
"""
from PythonCard import model
class ActionBinderDialog(model.CustomDialog):
def __init__(self, parent):
model.CustomDialog.__init__(self, parent)
self.resource_editor = parent
for inst in self.resource_editor.components.keys():
if inst not in self.resource_editor.sizingHandleNames:
self.components.sourceComponent.append(inst)
self.components.destinationComponent.append(inst)
# if some special setup is necessary, do it here
# example from samples/dialogs/minimalDialog.py
# self.components.field1.text = txt
def on_sourceComponent_select(self, wx_event):
the_widget = self.resource_editor.components[wx_event.stringSelection]
self.components.sourceEvent.clear()
for evt in the_widget._spec.getEventNames():
self.components.sourceEvent.append(evt)
self.components.sourceComponent.selected = wx_event.stringSelection
def on_btnApply_mouseClick(self, wx_event):
sourceComponent = self.components.sourceComponent.stringSelection
sourceEvent = self.components.sourceEvent.stringSelection
destinationComponent = self.components.destinationComponent.stringSelection
destinationFunction = self.components.destinationFunction.text
if max(len(sourceComponent), len(sourceEvent),
len(destinationComponent), len(destinationFunction)) == 0:
return
the_widget = self.resource_editor.components[sourceComponent]
actionBindings = the_widget.actionBindings
actionBindings[sourceEvent] = (destinationComponent, destinationFunction)
self.resource_editor.documentChanged = True
def runDialog(parent):
dlg = ActionBinderDialog(parent)
result = dlg.showModal()
# stick your results into the result dictionary here
# example from samples/dialogs/minimalDialog.py
# result.text = dlg.components.field1.text
dlg.destroy()
return result
|