[Commits] (jed) Adding John's changes plus changes needed to get
minimal 2.5 functionality.
commits at osafoundation.org
commits at osafoundation.org
Tue Mar 23 13:17:32 PST 2004
Commit by: jed
Modified files:
osaf/chandler/Chandler/parcels/OSAF/views/content/Content.py 1.5 1.5.2.1
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py 1.17 1.17.2.1
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Query.py 1.5 1.5.2.1
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml 1.54 1.54.2.1
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/NavigationBlocks.py 1.7 1.7.2.1
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/MenuBlocks.py 1.6 1.6.2.1
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ControlBlocks.py 1.14 1.14.2.1
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py 1.69 1.69.2.1
osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Block.py 1.19 1.19.2.1
osaf/chandler/Chandler/application/Application.py 1.211 1.211.2.1
osaf/chandler/Chandler/Chandler.py 1.35 1.35.2.1
Log message:
Adding John's changes plus changes needed to get minimal 2.5 functionality.
ViewCVS links:
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/views/content/Content.py.diff?r1=text&tr1=1.5&r2=text&tr2=1.5.2.1
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py.diff?r1=text&tr1=1.17&r2=text&tr2=1.17.2.1
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Query.py.diff?r1=text&tr1=1.5&r2=text&tr2=1.5.2.1
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml.diff?r1=text&tr1=1.54&r2=text&tr2=1.54.2.1
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/NavigationBlocks.py.diff?r1=text&tr1=1.7&r2=text&tr2=1.7.2.1
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/MenuBlocks.py.diff?r1=text&tr1=1.6&r2=text&tr2=1.6.2.1
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ControlBlocks.py.diff?r1=text&tr1=1.14&r2=text&tr2=1.14.2.1
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py.diff?r1=text&tr1=1.69&r2=text&tr2=1.69.2.1
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Block.py.diff?r1=text&tr1=1.19&r2=text&tr2=1.19.2.1
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/application/Application.py.diff?r1=text&tr1=1.211&r2=text&tr2=1.211.2.1
http://cvs.osafoundation.org/index.cgi/osaf/chandler/Chandler/Chandler.py.diff?r1=text&tr1=1.35&r2=text&tr2=1.35.2.1
Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Query.py
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Query.py:1.5 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Query.py:1.5.2.1
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Query.py:1.5 Wed Mar 3 15:38:25 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Query.py Tue Mar 23 13:16:59 2004
@@ -10,7 +10,7 @@
self.data = []
self.results = []
- def getResultSize(self):
+ def len(self):
if self.resultsStale:
self.refreshResults()
return len (self.results)
@@ -24,11 +24,11 @@
elif self.queryEnum == "Kind":
self.results = []
- for item in self.getResultsIterator():
+ for item in self:
self.results.append (item)
self.resultsStale = False
- def getResultsIterator (self):
+ def __iter__ (self):
if self.queryEnum == "ContainerSearch":
assert False, "This code isn't written"
@@ -41,10 +41,24 @@
elif __debug__:
assert False, "Bad QueryEnum"
- def indexResult (self, index):
+ def __getitem__ (self, index):
if self.resultsStale:
self.refreshResults()
return self.results [index]
+
+ def index (self, item):
+ if self.resultsStale:
+ self.refreshResults()
+ """
+ Apparent repository bug: comment in the following instruction and watch it fail -- DJA
+ return self.results.index (item)
+ """
+ index = 0
+ for object in self:
+ if object == item:
+ return index
+ index = index + 1
+ assert (False)
def onItemChanges(self, notification):
if self.queryEnum == "ContainerSearch":
Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml:1.54 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml:1.54.2.1
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml:1.54 Wed Mar 10 01:18:30 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/parcel.xml Tue Mar 23 13:16:59 2004
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.54 $ -->
-<!-- $Date: 2004/03/10 09:18:30 $ -->
+<!-- $Revision: 1.54.2.1 $ -->
+<!-- $Date: 2004/03/23 21:16:59 $ -->
<!-- Copyright (c) 2003 Open Source Applications Foundation -->
<!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
@@ -123,6 +123,11 @@
<Attribute itemName="data">
<type itemref="Item"/>
+ <type itemref="docSchema:Query/queryEnumType"/>
+ </Attribute>
+
+ <Attribute itemName="data">
+ <type itemref="Item"/>
<cardinality>list</cardinality>
</Attribute>
@@ -176,6 +181,9 @@
<type itemref="docSchema:BlockEvent"/>
</Attribute>
+ <Attribute itemName="selection">
+ <type itemref="SingleRef"/>
+ </Attribute>
<!--
Block Events
-->
@@ -537,10 +545,6 @@
<type itemref="String"/>
</Attribute>
- <Attribute itemName="clicked">
- <type itemref="docSchema:BlockEvent"/>
- </Attribute>
-
<Attribute itemName="rightClicked">
<type itemref="docSchema:BlockEvent"/>
</Attribute>
@@ -549,7 +553,7 @@
<attributes itemref="docSchema:Button/buttonKind"/>
<attributes itemref="docSchema:Button/icon"/>
<attributes itemref="docSchema:characterStyle"/>
- <attributes itemref="docSchema:Button/clicked"/>
+ <attributes itemref="docSchema:event"/>
<attributes itemref="docSchema:Button/rightClicked"/>
</Kind>
@@ -658,6 +662,7 @@
<attributes itemref="docSchema:columnHeadings"/>
<attributes itemref="docSchema:columnWidths"/>
<attributes itemref="docSchema:elementDelegate"/>
+ <attributes itemref="docSchema:selection"/>
</Kind>
<!--
@@ -684,10 +689,6 @@
<cardinality>dict</cardinality>
</Attribute>
- <Attribute itemName="selection">
- <type itemref="SingleRef"/>
- </Attribute>
-
<Attribute itemName="rootPath">
<type itemref="Item"/>
</Attribute>
@@ -699,7 +700,7 @@
<attributes itemref="docSchema:Tree/noLines"/>
<attributes itemref="docSchema:Tree/useButtons"/>
<attributes itemref="docSchema:Tree/openedContainers"/>
- <attributes itemref="docSchema:Tree/selection"/>
+ <attributes itemref="docSchema:selection"/>
<attributes itemref="docSchema:Tree/rootPath"/>
</Kind>
@@ -881,11 +882,7 @@
<classes key="python">OSAF.framework.blocks.ControlBlocks.ItemDetail</classes>
<superKinds itemref="docSchema:RectangularChild"/>
- <Attribute itemName="selection">
- <type itemref="UUID"/>
- </Attribute>
-
- <attributes itemref="docSchema:ItemDetail/selection"/>
+ <attributes itemref="docSchema:selection"/>
</Kind>
<!--
Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.69 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.69.2.1
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py:1.69 Wed Mar 10 01:28:20 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ContainerBlocks.py Tue Mar 23 13:16:59 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.69 $"
-__date__ = "$Date: 2004/03/10 09:28:20 $"
+__version__ = "$Revision: 1.69.2.1 $"
+__date__ = "$Date: 2004/03/23 21:16:59 $"
__copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -139,25 +139,27 @@
self.SetMinimumPaneSize(20)
def OnSplitChanged(self, event):
- counterpart = Globals.repository.find (self.counterpartUUID)
- width, height = self.GetSizeTuple()
- position = float (event.GetSashPosition())
- splitMode = self.GetSplitMode()
- if splitMode == wxSPLIT_HORIZONTAL:
- counterpart.splitPercentage = position / height
- elif splitMode == wxSPLIT_VERTICAL:
- counterpart.splitPercentage = position / width
+ if not Globals.wxApplication.insideSynchronizeFramework:
+ counterpart = Globals.repository.find (self.counterpartUUID)
+ width, height = self.GetSizeTuple()
+ position = float (event.GetSashPosition())
+ splitMode = self.GetSplitMode()
+ if splitMode == wxSPLIT_HORIZONTAL:
+ counterpart.splitPercentage = position / height
+ elif splitMode == wxSPLIT_VERTICAL:
+ counterpart.splitPercentage = position / width
def OnSize(self, event):
- """
- Calling Skip causes wxWindows to continue processing the event, which
- will cause the parent class to get a crack at the event.
- """
- event.Skip()
- counterpart = Globals.repository.find (self.counterpartUUID)
- counterpart.size.width = self.GetSize().x
- counterpart.size.height = self.GetSize().y
- counterpart.setDirty() # Temporary repository hack -- DJA
+ if not Globals.wxApplication.insideSynchronizeFramework:
+ """
+ Calling Skip causes wxWindows to continue processing the event, which
+ will cause the parent class to get a crack at the event.
+ """
+ event.Skip()
+ counterpart = Globals.repository.find (self.counterpartUUID)
+ counterpart.size.width = self.GetSize().x
+ counterpart.size.height = self.GetSize().y
+ counterpart.setDirty() # Temporary repository hack -- DJA
def __del__(self):
del Globals.association [self.counterpartUUID]
@@ -180,7 +182,7 @@
return splitWindow, splitWindow, splitWindow
def Calculate_wxStyle (self, parentWindow):
- style = wxSP_LIVE_UPDATE|wxNO_FULL_REPAINT_ON_RESIZE
+ style = wxSP_LIVE_UPDATE
parent = self.parentBlock
while isinstance (parent, EmbeddedContainer):
parent = parent.parentBlock
Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ControlBlocks.py
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ControlBlocks.py:1.14 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ControlBlocks.py:1.14.2.1
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ControlBlocks.py:1.14 Wed Mar 10 01:28:20 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/ControlBlocks.py Tue Mar 23 13:16:59 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.14 $"
-__date__ = "$Date: 2004/03/10 09:28:20 $"
+__version__ = "$Revision: 1.14.2.1 $"
+__date__ = "$Date: 2004/03/23 21:16:59 $"
__copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -18,7 +18,7 @@
class Button(RectangularChild):
def renderOneBlock(self, parent, parentWindow):
try:
- id = Block.getwxID(self.event)
+ id = Block.getwxID(self)
except AttributeError:
id = 0
@@ -158,7 +158,7 @@
"""
def ElementText (self, index, column):
counterpart = Globals.repository.find (self.counterpartUUID)
- result = counterpart.contentSpec.indexResult (item)
+ result = counterpart.contentSpec[item]
column = counterpart.columnHeadings[column]
try:
return str (result.getAttributeValue(column))
@@ -167,7 +167,7 @@
def ElementCount (self):
counterpart = Globals.repository.find (self.counterpartUUID)
- return counterpart.contentSpec.getResultSize()
+ return counterpart.contentSpec.len()
class wxListBlock(wxListCtrl):
@@ -186,65 +186,67 @@
"""
if self.scheduleUpdate:
if (time.time() - self.lastUpdateTime) > 1.0:
- self.SynchronizeFramework()
+ counterpart = Globals.repository.find (self.counterpartUUID)
+ counterpart.SynchronizeFramework()
else:
lastupdateTime = time.time()
event.Skip()
def OnSize(self, event):
- size = event.GetSize()
- widthMinusLastColumn = 0
- assert self.GetColumnCount() > 0, "We're assuming that there is at least one column"
- for column in range (self.GetColumnCount() - 1):
- widthMinusLastColumn += self.GetColumnWidth (column)
- lastColumnWidth = size.width - widthMinusLastColumn
- if lastColumnWidth > 0:
- self.SetColumnWidth (self.GetColumnCount() - 1, lastColumnWidth)
- event.Skip()
+ if not Globals.wxApplication.insideSynchronizeFramework:
+ size = event.GetSize()
+ widthMinusLastColumn = 0
+ assert self.GetColumnCount() > 0, "We're assuming that there is at least one column"
+ for column in range (self.GetColumnCount() - 1):
+ widthMinusLastColumn += self.GetColumnWidth (column)
+ lastColumnWidth = size.width - widthMinusLastColumn
+ if lastColumnWidth > 0:
+ self.SetColumnWidth (self.GetColumnCount() - 1, lastColumnWidth)
+ event.Skip()
def On_wxSelectionChanged(self, event):
- counterpart = Globals.repository.find (self.counterpartUUID)
- item = counterpart.contentSpec.indexResult (event.GetIndex())
- counterpart.Post (Globals.repository.find('//parcels/OSAF/framework/blocks/Events/SelectionChanged'),
- {'item':item})
+ if not Globals.wxApplication.insideSynchronizeFramework:
+ counterpart = Globals.repository.find (self.counterpartUUID)
+ item = counterpart.contentSpec [event.GetIndex()]
+ if counterpart.selection != item:
+ counterpart.selection = item
+ counterpart.Post (Globals.repository.find('//parcels/OSAF/framework/blocks/Events/SelectionChanged'),
+ {'item':item})
+
- def SynchronizeFramework(self):
+ def wxSynchronizeFramework(self):
counterpart = Globals.repository.find (self.counterpartUUID)
elementDelegate = counterpart.elementDelegate
if not elementDelegate:
elementDelegate = '//parcels/OSAF/framework/blocks/ControlBlocks/ListDelegate'
mixinAClass (self, elementDelegate)
+ queryItem = counterpart.contentSpec
+ queryItem.resultsStale = True
self.Freeze()
- for index in xrange (self.GetColumnCount()):
- self.DeleteColumn(0)
-
+ self.ClearAll()
for index in range (len(counterpart.columnHeadings)):
self.InsertColumn(index,
str(counterpart.columnHeadings[index]),
width = counterpart.columnWidths[index])
- self.Thaw()
- self.DeleteAllItems()
self.SetItemCount (self.ElementCount())
+ self.Thaw()
try:
subscription = self.subscriptionUUID
except AttributeError:
counterpart = Globals.repository.find (self.counterpartUUID)
- try:
- queryItem = counterpart.contentSpec
- except AttributeError:
- pass
- else:
- events = [Globals.repository.find('//parcels/OSAF/framework/item_changed'),
- Globals.repository.find('//parcels/OSAF/framework/item_added'),
- Globals.repository.find('//parcels/OSAF/framework/item_deleted')]
- self.subscriptionUUID = UUID()
- Globals.notificationManager.Subscribe (events,
- self.subscriptionUUID,
- queryItem.onItemChanges)
- queryItem.resultsStale = True
+ events = [Globals.repository.find('//parcels/OSAF/framework/item_changed'),
+ Globals.repository.find('//parcels/OSAF/framework/item_added'),
+ Globals.repository.find('//parcels/OSAF/framework/item_deleted')]
+ self.subscriptionUUID = UUID()
+ Globals.notificationManager.Subscribe (events,
+ self.subscriptionUUID,
+ queryItem.onItemChanges)
+ if counterpart.selection:
+ self.GoToItem (counterpart.selection)
+
self.scheduleUpdate = False
self.lastUpdateTime = time.time()
@@ -260,8 +262,17 @@
"""
return self.ElementText (index, column)
+ def GoToItem(self, item):
+ counterpart = Globals.repository.find (self.counterpartUUID)
+ index = counterpart.contentSpec.index (item)
+ self.Select (index)
+
class List(RectangularChild):
+ def __init__(self, *arguments, **keywords):
+ super (List, self).__init__ (*arguments, **keywords)
+ self.selection = None
+
def renderOneBlock (self, parent, parentWindow):
list = wxListBlock(parentWindow,
Block.getwxID(self),
@@ -281,6 +292,13 @@
wxWindow = Globals.association[self.getUUID()]
wxWndow.scheduleUpdate = True
+ def OnSelectionChangedEvent (self, notification):
+ """
+ Display the item in the wxWindow counterpart.
+ """
+ self.selection = notification.data['item']
+ self.GoToItem (self.selection)
+
class RadioBox(RectangularChild):
def renderOneBlock(self, parent, parentWindow):
@@ -393,25 +411,27 @@
"""
if self.scheduleUpdate:
if (time.time() - self.lastUpdateTime) > 0.5:
- self.SynchronizeFramework()
+ counterpart = Globals.repository.find (self.counterpartUUID)
+ counterpart.SynchronizeFramework()
else:
lastupdateTime = time.time()
event.Skip()
def OnSize(self, event):
- size = event.GetSize()
- if isinstance (self, wxTreeListCtrl):
- widthMinusLastColumn = 0
- assert self.GetColumnCount() > 0, "We're assuming that there is at least one column"
- for column in range (self.GetColumnCount() - 1):
- widthMinusLastColumn += self.GetColumnWidth (column)
- lastColumnWidth = size.width - widthMinusLastColumn
- if lastColumnWidth > 0:
- self.SetColumnWidth (self.GetColumnCount() - 1, lastColumnWidth)
- else:
- assert isinstance (self, wxTreeList), "We're assuming the only other choice is a wxTree"
- self.SetSize (size)
- event.Skip()
+ if not Globals.wxApplication.insideSynchronizeFramework:
+ size = event.GetSize()
+ if isinstance (self, wxTreeListCtrl):
+ widthMinusLastColumn = 0
+ assert self.GetColumnCount() > 0, "We're assuming that there is at least one column"
+ for column in range (self.GetColumnCount() - 1):
+ widthMinusLastColumn += self.GetColumnWidth (column)
+ lastColumnWidth = size.width - widthMinusLastColumn
+ if lastColumnWidth > 0:
+ self.SetColumnWidth (self.GetColumnCount() - 1, lastColumnWidth)
+ else:
+ assert isinstance (self, wxTreeCtrl), "We're assuming the only other choice is a wxTree"
+ self.SetSize (size)
+ event.Skip()
def OnExpanding(self, event):
self.LoadChildren(event.GetItem())
@@ -420,28 +440,30 @@
"""
Load the items in the tree only when they are visible.
"""
- counterpart = Globals.repository.find (self.counterpartUUID)
-
- parentUUID = self.GetPyData (parentId)
- for child in self.ElementChildren (Globals.repository [parentUUID]):
- cellValues = self.ElementCellValues (child)
- childNodeId = self.AppendItem (parentId,
- cellValues.pop(0),
- -1,
- -1,
- wxTreeItemData (child.getUUID()))
- index = 1
- for value in cellValues:
- self.SetItemText (childNodeId, value, index)
- index += 1
- self.SetItemHasChildren (childNodeId, self.ElementHasChildren (child))
-
- counterpart.openedContainers [parentUUID] = True
+ child, cookie = self.GetFirstChild (parentId)
+ if not child.IsOk():
+
+ counterpart = Globals.repository.find (self.counterpartUUID)
+
+ parentUUID = self.GetPyData (parentId)
+ for child in self.ElementChildren (Globals.repository [parentUUID]):
+ cellValues = self.ElementCellValues (child)
+ childNodeId = self.AppendItem (parentId,
+ cellValues.pop(0),
+ -1,
+ -1,
+ wxTreeItemData (child.getUUID()))
+ index = 1
+ for value in cellValues:
+ self.SetItemText (childNodeId, value, index)
+ index += 1
+ self.SetItemHasChildren (childNodeId, self.ElementHasChildren (child))
+
+ counterpart.openedContainers [parentUUID] = True
def OnCollapsing(self, event):
counterpart = Globals.repository.find (self.counterpartUUID)
id = event.GetItem()
- self.DeleteChildren (id)
"""
if the data passed in has a UUID we'll keep track of the
state of the opened tree
@@ -450,40 +472,42 @@
del counterpart.openedContainers [self.GetPyData(id)]
except AttributeError:
pass
+ self.CollapseAndReset (id)
def OnColumnDrag(self, event):
- counterpart = Globals.repository.find (self.counterpartUUID)
- columnIndex = event.GetColumn()
- try:
- counterpart.columnWidths [columnIndex] = self.GetColumnWidth (columnIndex)
- except AttributeError:
- pass
+ if not Globals.wxApplication.insideSynchronizeFramework:
+ counterpart = Globals.repository.find (self.counterpartUUID)
+ columnIndex = event.GetColumn()
+ try:
+ counterpart.columnWidths [columnIndex] = self.GetColumnWidth (columnIndex)
+ except AttributeError:
+ pass
def On_wxSelectionChanged(self, event):
- counterpart = Globals.repository.find (self.counterpartUUID)
-
- itemUUID = self.GetPyData(self.GetSelection())
- selection = Globals.repository.find (itemUUID)
- if counterpart.selection != selection:
- counterpart.selection = selection
+ if not Globals.wxApplication.insideSynchronizeFramework:
+ counterpart = Globals.repository.find (self.counterpartUUID)
- counterpart.Post (Globals.repository.find('//parcels/OSAF/framework/blocks/Events/SelectionChanged'),
- {'item':selection})
-
- def ExpandItem(self, id):
- # @@@ Needs to handle the difference in how wxTreeCtrls and wxTreeListCtrls
- # expand items.
- self.Expand (id)
+ itemUUID = self.GetPyData(self.GetSelection())
+ selection = Globals.repository.find (itemUUID)
+ if counterpart.selection != selection:
+ counterpart.selection = selection
+
+ counterpart.Post (Globals.repository.find('//parcels/OSAF/framework/blocks/Events/SelectionChanged'),
+ {'item':selection})
- def SynchronizeFramework(self):
+ def wxSynchronizeFramework(self):
def ExpandContainer (self, openedContainers, id):
try:
expand = openedContainers [self.GetPyData(id)]
except KeyError:
return
- self.ExpandItem(id)
- child, cookie = self.GetFirstChild (id, 0)
+ self.LoadChildren(id)
+
+ # @@@ 25Issue - Would like to remove this test
+ if id != self.GetRootItem():
+ self.Expand(id)
+ child, cookie = self.GetFirstChild (id)
while child.IsOk():
ExpandContainer (self, openedContainers, child)
child = self.GetNextSibling (child)
@@ -515,7 +539,8 @@
-1,
-1,
wxTreeItemData (root.getUUID()))
- self.SetItemHasChildren (rootNodeId, self.ElementHasChildren (root))
+ self.SetItemHasChildren (rootNodeId, self.ElementHasChildren (root))
+ self.LoadChildren(rootNodeId)
ExpandContainer (self, counterpart.openedContainers, self.GetRootItem ())
selection = counterpart.selection
@@ -546,9 +571,12 @@
parent = self.ElementParent (item)
if parent:
id = ExpandTreeToItem (self, parent)
- self.Expand (id)
+ self.LoadChildren(id)
+ # @@@ 25Issue - Would like to remove this test
+ if id != self.GetRootItem():
+ self.Expand (id)
itemUUID = item.getUUID()
- child, cookie = self.GetFirstChild (id, 0)
+ child, cookie = self.GetFirstChild (id)
while child.IsOk():
if self.GetPyData(child) == itemUUID:
return child
@@ -630,16 +658,19 @@
event = Globals.repository.find('//parcels/OSAF/framework/blocks/Events/SelectionChanged')
event.Post({'item':item, 'type':'Normal'})
- def SynchronizeFramework(self):
+ def wxSynchronizeFramework(self):
counterpart = Globals.repository.find (self.counterpartUUID)
- item = Globals.repository.find (counterpart.selection)
- try:
- self.SetPage(counterpart.getHTMLText(item))
- except TypeError:
- self.SetPage('<body><html><h1>Error displaying the item</h1></body></html>')
+ if counterpart.selection:
+ self.SetPage(counterpart.getHTMLText(counterpart.selection))
+ else:
+ self.SetPage('<html><body></body></html>')
class ItemDetail(RectangularChild):
+ def __init__(self, *arguments, **keywords):
+ super (ItemDetail, self).__init__ (*arguments, **keywords)
+ self.selection = None
+
def renderOneBlock (self, parent, parentWindow):
htmlWindow = wxItemDetail(parentWindow,
Block.getwxID(self),
@@ -663,7 +694,5 @@
"""
Display the item in the wxWindow counterpart.
"""
- item = notification.data['item']
- self.selection = item.getUUID()
- wxWindow = Globals.association[self.getUUID()]
- wxWindow.SynchronizeFramework ()
+ self.selection = notification.data['item']
+ self.SynchronizeFramework ()
Index: osaf/chandler/Chandler/Chandler.py
diff -u osaf/chandler/Chandler/Chandler.py:1.35 osaf/chandler/Chandler/Chandler.py:1.35.2.1
--- osaf/chandler/Chandler/Chandler.py:1.35 Mon Jan 26 11:37:49 2004
+++ osaf/chandler/Chandler/Chandler.py Tue Mar 23 13:17:02 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.35 $"
-__date__ = "$Date: 2004/01/26 19:37:49 $"
+__version__ = "$Revision: 1.35.2.1 $"
+__date__ = "$Date: 2004/03/23 21:17:02 $"
__copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -13,7 +13,7 @@
"""
import wingdbstub
import logging
-from wxPython.wx import *
+import wx
from application.Application import wxApplication
def main():
@@ -42,7 +42,8 @@
except Exception, e:
message = "Chandler encountered an unexpected problem %s" % exceptionMessage
logging.exception(message)
- dialog = wxMessageDialog(None, message, "Chandler", wxOK | wxICON_INFORMATION)
+ # @@@ 25Issue - Cannot create wxItems if the app failed to initialize
+ dialog = wx.MessageDialog(None, message, "Chandler", wx.OK | wx.ICON_INFORMATION)
dialog.ShowModal()
dialog.Destroy()
Index: osaf/chandler/Chandler/parcels/OSAF/views/content/Content.py
diff -u osaf/chandler/Chandler/parcels/OSAF/views/content/Content.py:1.5 osaf/chandler/Chandler/parcels/OSAF/views/content/Content.py:1.5.2.1
--- osaf/chandler/Chandler/parcels/OSAF/views/content/Content.py:1.5 Mon Mar 8 09:31:27 2004
+++ osaf/chandler/Chandler/parcels/OSAF/views/content/Content.py Tue Mar 23 13:16:59 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.5 $"
-__date__ = "$Date: 2004/03/08 17:31:27 $"
+__version__ = "$Revision: 1.5.2.1 $"
+__date__ = "$Date: 2004/03/23 21:16:59 $"
__copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -52,7 +52,7 @@
class CalendarListDelegate (ControlBlocks.ListDelegate):
def ElementText (self, index, column):
counterpart = Globals.repository.find (self.counterpartUUID)
- result = counterpart.contentSpec.indexResult (index)
+ result = counterpart.contentSpec [index]
if column == 0:
return result.getWho()
elif column == 1:
@@ -80,7 +80,7 @@
def ElementText (self, index, column):
counterpart = Globals.repository.find (self.counterpartUUID)
- result = counterpart.contentSpec.indexResult (index)
+ result = counterpart.contentSpec [index]
if column == 0:
return self.valOrEmpty(result, ("contactName", "firstName"))
elif column == 1:
@@ -96,7 +96,7 @@
class MixedListDelegate(ControlBlocks.ListDelegate):
def ElementText (self, index, column):
counterpart = Globals.repository.find (self.counterpartUUID)
- result = counterpart.contentSpec.indexResult (index)
+ result = counterpart.contentSpec [index]
if column == 0:
return result.getWho()
elif column == 1:
@@ -111,7 +111,7 @@
class NoteListDelegate(ControlBlocks.ListDelegate):
def ElementText (self, index, column):
counterpart = Globals.repository.find (self.counterpartUUID)
- result = counterpart.contentSpec.indexResult (index)
+ result = counterpart.contentSpec [index]
if column == 0:
return result.getAbout()
elif column == 1:
Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py:1.17 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py:1.17.2.1
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py:1.17 Wed Mar 10 01:18:30 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Views.py Tue Mar 23 13:16:59 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.17 $"
-__date__ = "$Date: 2004/03/10 09:18:30 $"
+__version__ = "$Revision: 1.17.2.1 $"
+__date__ = "$Date: 2004/03/23 21:16:59 $"
__copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -7,6 +7,7 @@
import application.Globals as Globals
from Block import *
from ContainerBlocks import *
+from MenuBlocks import MenuEntry
from OSAF.framework.notifications.Notification import Notification
from wxPython.wx import *
from wxPython.html import *
@@ -15,7 +16,6 @@
import OSAF.contentmodel.tests.GenerateItems as GenerateItems
class View(BoxContainer):
- inDispatchEvent = False
def dispatchEvent (self, notification):
def callMethod (block, methodName, notification):
@@ -23,68 +23,70 @@
Call method named methodName on block
"""
try:
- member = getattr (block, methodName)
+ member = getattr (block, methodName)
except AttributeError:
return False
-
- View.inDispatchEvent = True
+
+ """
+ Comment in this code to see which events are dispatched -- DJA
try:
- member (notification)
- finally:
- View.inDispatchEvent = False
+ updateUI = notification.data['UpdateUI']
+ except KeyError:
+ print "Calling %s" % methodName
+ """
+ member (notification)
return True
def broadcast (block, methodName, notification):
"""
Call method named methodName on every block and it's children
- who implements it
+ who implements it, except for the block that posted the event,
+ to avoid recursive calls.
"""
+ sender = notification.data['sender']
callMethod (block, methodName, notification)
for child in block.childrenBlocks:
- if child and not child.eventBoundary:
+ if child and not child.eventBoundary and child != sender:
broadcast (child, methodName, notification)
event = notification.event
"""
- There are a number of situations where either recursive, unnecessary,
- or incorrect extra events are posted as a side effect of handling an
- event. We're in the process of coming up with a new model that deals
- with these properly. However, until that work is finished, we'll ignore
- recursive postings of events which is a good temporary approximate solution.
+ Construct method name based upon the type of the event.
"""
- if View.inDispatchEvent:
- logging.warn('ignoring recursive event %s', event)
+ methodName = event.methodName
+
+ try:
+ updateUI = notification.data['UpdateUI']
+ except KeyError:
+ pass
else:
+ methodName += 'UpdateUI'
+
+ if event.dispatchEnum == 'SendToBlock':
+ callMethod (event.dispatchToBlock, methodName, notification)
+
+ elif event.dispatchEnum == 'Broadcast':
"""
- Find the block with the focus
- """
+ Find the block to dispatch to. If the sender is a menu
+ we'll dispatch to the block with the focus, otherwise we'll
+ dispatch to whoever
+ """
+ block = notification.data['sender']
+ if isinstance (block, MenuEntry):
+ block = self.getFocusBlock()
+
+ while (not block.eventBoundary and block.parentBlock):
+ block = block.parentBlock
+
+ broadcast (block, methodName, notification)
+ elif event.dispatchEnum == 'BubbleUp':
block = self.getFocusBlock()
- """
- Construct method name based upon the type of the event.
- """
- methodName = event.methodName
-
- try:
- updateUI = notification.data['UpdateUI']
- except KeyError:
- pass
- else:
- methodName += 'UpdateUI'
-
- if event.dispatchEnum == 'SendToBlock':
- callMethod (event.dispatchToBlock, methodName, notification)
- elif event.dispatchEnum == 'Broadcast':
- while (not block.eventBoundary and block.parentBlock):
- block = block.parentBlock
-
- broadcast (block, methodName, notification)
- elif event.dispatchEnum == 'BubbleUp':
- while (block):
- if callMethod (block, methodName, notification):
- break
- block = block.parentBlock
- elif __debug__:
- assert (False)
+ while (block):
+ if callMethod (block, methodName, notification):
+ break
+ block = block.parentBlock
+ elif __debug__:
+ assert (False)
def getFocusBlock (self):
focusWindow = wxWindow_FindFocus()
Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/NavigationBlocks.py
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/NavigationBlocks.py:1.7 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/NavigationBlocks.py:1.7.2.1
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/NavigationBlocks.py:1.7 Wed Mar 10 01:28:20 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/NavigationBlocks.py Tue Mar 23 13:16:59 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.7 $"
-__date__ = "$Date: 2004/03/10 09:28:20 $"
+__version__ = "$Revision: 1.7.2.1 $"
+__date__ = "$Date: 2004/03/23 21:16:59 $"
__copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -52,10 +52,10 @@
self.addBookmark(parent, sizer, child.getItemDisplayName(), child.GetPath())
def addBookmark(self, parent, sizer, title, path):
- sizer.Add(10, 0, 0, wxEXPAND)
+ sizer.Add((10, 0), 0, wxEXPAND)
bookmark = wxBookmark(parent, title, self.bookmarkPressed, path)
sizer.Add(bookmark, 0)
- sizer.Add(10, 0, 0, wxEXPAND)
+ sizer.Add((10, 0), 0, wxEXPAND)
def bookmarkPressed(self, text):
item = Node.GetItemFromPath(text, '//parcels/OSAF/views/main/URLRoot')
Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/MenuBlocks.py
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/MenuBlocks.py:1.6 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/MenuBlocks.py:1.6.2.1
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/MenuBlocks.py:1.6 Thu Feb 26 16:36:18 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/MenuBlocks.py Tue Mar 23 13:16:59 2004
@@ -128,14 +128,14 @@
Returns a list of wxMenuItems in wxMenuObject, which can
be either a menu or menubar
"""
- if isinstance (wxMenuObject, wxMenuBarPtr):
+ if isinstance (wxMenuObject, wxMenuBar):
menuList = []
for index in xrange (wxMenuObject.GetMenuCount()):
menuList.append (wxMenuObject.GetMenu (index))
else:
- if isinstance (wxMenuObject, wxMenuItemPtr):
+ if isinstance (wxMenuObject, wxMenuItem):
wxMenuObject = wxMenuObject.GetSubMenu()
- assert isinstance (wxMenuObject, wxMenuPtr)
+ assert isinstance (wxMenuObject, wxMenu)
menuList = wxMenuObject.GetMenuItems()
return menuList
@@ -147,11 +147,11 @@
be either a menu or menubar. Unfortunately, wxWindows requires
that you pass the oldItem whenever wxMenuObject is a wxMenu.
"""
- if isinstance (wxMenuObject, wxMenuPtr):
+ if isinstance (wxMenuObject, wxMenu):
wxMenuObject.DestroyItem (oldItem)
pass
else:
- assert isinstance (wxMenuObject, wxMenuBarPtr)
+ assert isinstance (wxMenuObject, wxMenuBar)
oldMenu = wxMenuObject.Remove (index)
oldMenu.Destroy()
deleteItem = classmethod (deleteItem)
@@ -165,11 +165,11 @@
"""
title = None
if item:
- if isinstance (wxMenuObject, wxMenuPtr):
+ if isinstance (wxMenuObject, wxMenu):
id = item.GetId()
title = wxMenuObject.GetLabel (id)
else:
- assert isinstance (wxMenuObject, wxMenuBarPtr)
+ assert isinstance (wxMenuObject, wxMenuBar)
title = wxMenuObject.GetLabelTop (index)
return title
getItemTitle = classmethod (getItemTitle)
@@ -181,7 +181,7 @@
you pass the oldItem whenever wxMenuObject is a wxMenu and
you're replacing the item.
"""
- if isinstance (wxMenuObject, wxMenuBarPtr):
+ if isinstance (wxMenuObject, wxMenuBar):
itemsInMenu = wxMenuObject.GetMenuCount()
assert (index <= itemsInMenu)
if index < itemsInMenu:
@@ -192,15 +192,15 @@
success = wxMenuObject.Append (newItem, self.title)
assert success
else:
- if isinstance (wxMenuObject, wxMenuItemPtr):
+ if isinstance (wxMenuObject, wxMenuItem):
wxMenuObject = wxMenuObject.GetSubMenu()
- assert isinstance (wxMenuObject, wxMenuPtr)
+ assert isinstance (wxMenuObject, wxMenu)
itemsInMenu = wxMenuObject.GetMenuItemCount()
assert (index <= itemsInMenu)
if index < itemsInMenu:
self.deleteItem (wxMenuObject, index, oldItem)
- if isinstance (newItem, wxMenuItemPtr):
+ if isinstance (newItem, wxMenuItem):
success = wxMenuObject.InsertItem (index, newItem)
assert success
else:
@@ -218,7 +218,7 @@
nor can we use wxWindows api's to distinguish them from each other.
"""
assert self.hasAttributeValue('event')
- id = Block.getwxID(self.event)
+ id = Block.getwxID(self)
if self.menuItemKind == "Normal":
kind = wxITEM_NORMAL
elif self.menuItemKind == "Check":
@@ -232,10 +232,10 @@
if len(self.accel) > 0:
title = title + "\tCtrl+" + self.accel
- if isinstance (wxMenuObject, wxMenuPtr):
+ if isinstance (wxMenuObject, wxMenu):
newItem = wxMenuItem (wxMenuObject, id, title, self.helpString, kind)
else:
- assert isinstance (wxMenuObject, wxMenuItemPtr)
+ assert isinstance (wxMenuObject, wxMenuItem)
submenu = wxMenuObject.GetSubMenu()
assert submenu
newItem = wxMenuItem (None, id, title, self.helpString, kind, submenu)
Index: osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Block.py
diff -u osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Block.py:1.19 osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Block.py:1.19.2.1
--- osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Block.py:1.19 Wed Mar 10 01:28:20 2004
+++ osaf/chandler/Chandler/parcels/OSAF/framework/blocks/Block.py Tue Mar 23 13:16:59 2004
@@ -96,6 +96,35 @@
theWindow.scheduleUpdate = True
+ def SynchronizeFramework (self):
+ """
+ synchronizeFramework's job is to make the wx counterpart match the state of
+ the data persisted in the block. There's a tricky problem that occurs: Often
+ we add a handler to the wx counterpart of a block to, for example, get called
+ when the user changes the selection, which we use to update the block's selection
+ and post a selection changed notification. It turns out that while we are in
+ synchronizeFramework, changes to the wx counterpart cause these handlers to be
+ called, and in this case we don't want to post a notification. So we wrap calls
+ to synchronizeFramework and set a flag indicating that we're inside
+ synchronizeFramework so the handler's can tell when not to post selection
+ changed events. We use this flag in other similar situations, for example,
+ during shutdown to ignore events caused by the framework tearing down wx
+ counterparts.
+ """
+ try:
+ theWindow = Globals.association[self.getUUID()]
+ method = getattr (theWindow, 'wxSynchronizeFramework')
+ except AttributeError:
+ pass
+ else:
+ oldInsideSynchronizeFramework = Globals.wxApplication.insideSynchronizeFramework
+ try:
+ Globals.wxApplication.insideSynchronizeFramework = True
+ method()
+ finally:
+ Globals.wxApplication.insideSynchronizeFramework = oldInsideSynchronizeFramework
+
+
class ContainerChild(Block):
def render (self, parent, parentWindow):
(window, parent, parentWindow) = self.renderOneBlock (parent, parentWindow)
@@ -123,10 +152,7 @@
After the blocks are wired up, give the window a chance
to synchronize itself to any persistent state.
"""
- try:
- window.SynchronizeFramework()
- except AttributeError:
- pass
+ self.SynchronizeFramework()
for child in self.childrenBlocks:
child.render (parent, parentWindow)
self.handleChildren(window)
Index: osaf/chandler/Chandler/application/Application.py
diff -u osaf/chandler/Chandler/application/Application.py:1.211 osaf/chandler/Chandler/application/Application.py:1.211.2.1
--- osaf/chandler/Chandler/application/Application.py:1.211 Mon Mar 8 18:47:40 2004
+++ osaf/chandler/Chandler/application/Application.py Tue Mar 23 13:17:00 2004
@@ -1,11 +1,11 @@
-__version__ = "$Revision: 1.211 $"
-__date__ = "$Date: 2004/03/09 02:47:40 $"
+__version__ = "$Revision: 1.211.2.1 $"
+__date__ = "$Date: 2004/03/23 21:17:00 $"
__copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
import gettext, os, sys, threading
from new import classobj
-from wxPython.wx import *
+import wx
import Globals
from repository.util.UUID import UUID
import repository.parcel.LoadParcels as LoadParcels
@@ -14,7 +14,7 @@
"""
Event used to post callbacks on the UI thread
"""
-wxEVT_MAIN_THREAD_CALLBACK = wxNewEventType()
+wxEVT_MAIN_THREAD_CALLBACK = wx.NewEventType()
def EVT_MAIN_THREAD_CALLBACK(win, func):
win.Connect(-1, -1, wxEVT_MAIN_THREAD_CALLBACK, func)
@@ -67,20 +67,20 @@
self.__class__ = theClass
-class MainThreadCallbackEvent(wxPyEvent):
+class MainThreadCallbackEvent(wx.PyEvent):
def __init__(self, target, *args):
- wxPyEvent.__init__(self)
+ wx.PyEvent.__init__(self)
self.SetEventType(wxEVT_MAIN_THREAD_CALLBACK)
self.target = target
self.args = args
self.lock = threading.Lock()
-class MainFrame(wxFrame):
+class MainFrame(wx.Frame):
def __init__(self, *arguments, **keywords):
- wxFrame.__init__ (self, *arguments, **keywords)
- self.SetBackgroundColour (wxSystemSettings_GetSystemColour(wxSYS_COLOUR_3DFACE))
- EVT_CLOSE(self, self.OnClose)
+ wx.Frame.__init__ (self, *arguments, **keywords)
+ self.SetBackgroundColour (wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DFACE))
+ wx.EVT_CLOSE(self, self.OnClose)
def OnClose(self, event):
"""
@@ -88,25 +88,32 @@
application the mainFrame windows doesn't get destroyed, so
we'll remove the handler
"""
- EVT_IDLE(Globals.wxApplication, None)
+ wx.EVT_IDLE(Globals.wxApplication, None)
+ """
+ When we quit, as each wxWidget window is torn down our handlers that
+ track changes to the selection are called, and we don't want to count
+ these changes, since they weren't caused by user actions.
+ """
+ Globals.wxApplication.insideSynchronizeFramework = True
Globals.wxApplication.mainFrame = None
self.Destroy()
def OnSize(self, event):
- event.Skip()
- counterpart = Globals.repository.find (self.counterpartUUID)
- counterpart.size.width = self.GetSize().x
- counterpart.size.height = self.GetSize().y
- """
- size is a repository type that I defined. They seem harder
- to define than necessary and they don't automatically dirty
- themselves when modified. We need to improve this feature
- of the repository -- DJA
- """
- counterpart.setDirty() # Temporary repository hack -- DJA
+ if not Globals.wxApplication.insideSynchronizeFramework:
+ event.Skip()
+ counterpart = Globals.repository.find (self.counterpartUUID)
+ counterpart.size.width = self.GetSize().x
+ counterpart.size.height = self.GetSize().y
+ """
+ size is a repository type that I defined. They seem harder
+ to define than necessary and they don't automatically dirty
+ themselves when modified. We need to improve this feature
+ of the repository -- DJA
+ """
+ counterpart.setDirty() # Temporary repository hack -- DJA
-class wxApplication (wxApp):
+class wxApplication (wx.App):
"""
PARCEL_IMPORT defines the import directory containing parcels
relative to chandlerDirectory where os separators are replaced
@@ -133,33 +140,34 @@
Globals.chandlerDirectory = os.path.dirname (os.path.abspath (sys.argv[0]))
assert Globals.wxApplication == None, "We can have only one application"
Globals.wxApplication = self
+ self.insideSynchronizeFramework = False
- wxInitAllImageHandlers()
+ wx.InitAllImageHandlers()
"""
Splash Screen
"""
splashFile = os.path.join(Globals.chandlerDirectory,
"application", "images", "splash.png")
- splashBitmap = wxImage(splashFile, wxBITMAP_TYPE_PNG).ConvertToBitmap()
- splash = wxSplashScreen(splashBitmap,
- wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
- 6000, None, -1, wxDefaultPosition, wxDefaultSize,
- wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP)
+ splashBitmap = wx.Image(splashFile, wx.BITMAP_TYPE_PNG).ConvertToBitmap()
+ splash = wx.SplashScreen(splashBitmap,
+ wx.SPLASH_CENTRE_ON_SCREEN|wx.SPLASH_TIMEOUT,
+ 6000, None, -1, wx.DefaultPosition, wx.DefaultSize,
+ wx.SIMPLE_BORDER|wx.FRAME_NO_TASKBAR|wx.STAY_ON_TOP)
splash.Show()
"""
Setup internationalization
- To experiment with a different locale, try 'fr' and wxLANGUAGE_FRENCH
+ To experiment with a different locale, try 'fr' and wx.LANGUAGE_FRENCH
"""
os.environ['LANGUAGE'] = 'en'
- self.locale = wxLocale(wxLANGUAGE_ENGLISH)
+# self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
"""
- @@@ Sets the python locale, used by wxCalendarCtrl and mxDateTime
+ @@@ Sets the python locale, used by wx.CalendarCtrl and mxDateTime
for month and weekday names. When running on Linux, 'en' is not
understood as a locale, nor is 'fr'. On Windows, you can try 'fr'.
locale.setlocale(locale.LC_ALL, 'en')
"""
- wxLocale_AddCatalogLookupPathPrefix('locale')
- self.locale.AddCatalog('Chandler.mo')
+# wx.Locale_AddCatalogLookupPathPrefix('locale')
+# self.locale.AddCatalog('Chandler.mo')
gettext.install('Chandler', os.path.join (Globals.chandlerDirectory, 'locale'))
"""
Load the parcels which are contained in the PARCEL_IMPORT directory.
@@ -234,10 +242,10 @@
Globals.agentManager = AgentManager()
Globals.agentManager.Startup()
- EVT_MENU(self, -1, self.OnCommand)
- EVT_UPDATE_UI(self, -1, self.OnCommand)
+ wx.EVT_MENU(self, -1, self.OnCommand)
+ wx.EVT_UPDATE_UI(self, -1, self.OnCommand)
self.focus = None
- EVT_IDLE(self, self.OnIdle)
+ wx.EVT_IDLE(self, self.OnIdle)
from OSAF.framework.blocks.Views import View
"""
@@ -251,11 +259,11 @@
-1,
"Chandler",
size=(mainView.size.width, mainView.size.height),
- style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
+ style=wx.DEFAULT_FRAME_STYLE)
Globals.mainView = mainView
self.menuParent = None
self.mainFrame.counterpartUUID = mainView.getUUID()
- EVT_SIZE(self.mainFrame, self.mainFrame.OnSize)
+ wx.EVT_SIZE(self.mainFrame, self.mainFrame.OnSize)
GlobalEvents = Globals.repository.find('//parcels/OSAF/framework/blocks/Events/GlobalEvents')
"""
@@ -298,15 +306,25 @@
wxID = event.GetId()
if wxID >= Block.MINIMUM_WX_ID and wxID <= Block.MAXIMUM_WX_ID:
- blockEvent = Block.wxIDToObject (wxID)
+ block = Block.wxIDToObject (wxID)
- if isinstance (blockEvent, BlockEvent):
- args = {}
- if event.GetEventType() == wxEVT_UPDATE_UI:
- args['UpdateUI'] = True
+ args = {}
+ if event.GetEventType() == wx.EVT_UPDATE_UI:
+ args['UpdateUI'] = True
- blockEvent.Post (args)
- if event.GetEventType() == wxEVT_UPDATE_UI:
+ try:
+ blockEvent = block.event
+ except AttributeError:
+ """
+ If we have an event and it's not an update event
+ then we'd better have a block event for it, otherwise
+ we can't post the event.
+ """
+ assert event.GetEventType() == wx.EVT_UPDATE_UI
+ pass
+ else:
+ block.Post (blockEvent, args)
+ if event.GetEventType() == wx.EVT_UPDATE_UI:
try:
event.Check (args ['Check'])
except KeyError:
@@ -322,7 +340,7 @@
else:
eventObject = event.GetEventObject()
event.SetText (text)
- return
+ return
event.Skip()
def OnIdle(self, event):
@@ -331,7 +349,7 @@
every change to the focus. It's difficult to preprocess every event
so we check for focus changes in OnIdle
"""
- focus = wxWindow_FindFocus()
+ focus = wx.Window_FindFocus()
if self.focus != focus:
self.focus = focus
Globals.mainView.onSetFocus()
@@ -365,13 +383,13 @@
"""
evt = MainThreadCallbackEvent(callback, *args)
evt.lock.acquire()
- wxPostEvent(self, evt)
+ wx.PostEvent(self, evt)
return evt.lock
if __debug__:
def ShowDebuggerWindow(self, event):
- from wx import py
- self.crustFrame = py.crust.CrustFrame()
+ import wx.py
+ self.crustFrame = wx.py.crust.CrustFrame()
self.crustFrame.SetSize((700,700))
self.crustFrame.Show(wx.TRUE)
self.crustFrame.shell.interp.locals['chandler'] = self
More information about the Commits
mailing list