4
__version__ = "$Revision: 1.1 $"
5
__date__ = "$Date: 2005/07/27 21:49:41 $"
8
from PythonCard import dialog, font, model, registry, util
9
from PythonCard.event import ChangeListener
17
class MultiComponents(model.Background, ChangeListener):
19
def on_initialize(self, event):
20
self._parent = self.GetParent()
21
self._comp = self._parent.components
22
self._updatingComponent = 0
23
##self.components.addChangeEventListener(self)
24
self._comp.addChangeEventListener(self)
26
#self.displayComponents(self.components)
27
self.displayComponents(self._comp)
31
def on_componentSendBack_command(self, event):
32
print "no re-layering yet"
34
self._parent.on_componentSendBack_command(event)
36
def on_componentMoveBack_command(self, event):
37
print "no re-layering yet"
39
self._parent.on_componentMoveBack_command(event)
41
def on_componentMoveForward_command(self, event):
42
print "no re-layering yet"
44
self._parent.on_componentMoveForward_command(event)
46
def on_componentBringFront_command(self, event):
47
print "no re-layering yet"
49
self._parent.on_componentBringFront_command(event)
54
def addWidgetToComponentList(self, widget):
56
wClass = widget.__class__.__name__
57
self.components.wComponentList.Append(wName + " : " + wClass)
60
# need to redo the logic below to avoid asserts in hybrid
61
# versions of wxPython, but also be cleaner
62
def deleteWidgetFromComponentList(self, wName, wClass):
63
i = self.components.wComponentList.GetSelection()
64
j = self.components.wComponentList.FindString(wName + " : " + wClass)
67
self.components.wComponentList.Delete(j)
70
self.components.wComponentList.SetSelection(j - 1)
72
self.components.wComponentList.Delete(j)
73
if self.components.wComponentList.GetSelection() == -1:
74
self.setValidProps("")
76
wName, wClass = self.components.wComponentList.stringSelection.split(" : ")
77
# deselect the name from properties list
78
self.setValidProps(wClass)
79
self.displayProperties(wName, wClass)
81
def changed(self, event):
82
print "multi changed", self._parent.multipleSelected, self._parent.multipleComponents
85
def clearComponentList(self):
86
self.components.wComponentList.Clear()
87
self.statusBar.text = ''
89
def displayComponents(self, components):
90
self.components.wComponentList.Freeze()
91
self.components.wComponentList.Clear()
92
self._comp = components
93
for c in components.order:
94
#print "display", c, self._parent.isSizingHandle(c)
95
if c not in self._parent.sizingHandleNames and not self._parent.isSizingHandle(c):
96
self.addWidgetToComponentList(components[c])
97
self.components.wComponentList.Thaw()
98
self.components.wComponentList.Refresh()
99
self.components.wComponentList.Update()
101
def on_close(self, event):
103
parent = self.GetParent()
104
parent.menuBar.setChecked('menuViewPropertyEditor', 0)