[Commits] (jed) Fixed Chandler window starting position

commits at osafoundation.org commits at osafoundation.org
Mon Feb 7 14:53:56 PST 2005


Commit by: jed
Modified files:
chandler/parcels/osaf/views/main/parcel.xml 1.168 1.169
chandler/application/Application.py 1.298 1.299
chandler/parcels/osaf/framework/blocks/ContainerBlocks.py 1.150 1.151
chandler/parcels/osaf/framework/blocks/DocumentTypes.py 1.5 1.6
chandler/parcels/osaf/framework/blocks/parcel.xml 1.149 1.150

Log message:
Fixed Chandler window starting position
Persist window location
Fixed Bug #2398

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/views/main/parcel.xml.diff?r1=text&tr1=1.168&r2=text&tr2=1.169
http://cvs.osafoundation.org/index.cgi/chandler/application/Application.py.diff?r1=text&tr1=1.298&r2=text&tr2=1.299
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/ContainerBlocks.py.diff?r1=text&tr1=1.150&r2=text&tr2=1.151
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/DocumentTypes.py.diff?r1=text&tr1=1.5&r2=text&tr2=1.6
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/parcel.xml.diff?r1=text&tr1=1.149&r2=text&tr2=1.150

Index: chandler/parcels/osaf/framework/blocks/ContainerBlocks.py
diff -u chandler/parcels/osaf/framework/blocks/ContainerBlocks.py:1.150 chandler/parcels/osaf/framework/blocks/ContainerBlocks.py:1.151
--- chandler/parcels/osaf/framework/blocks/ContainerBlocks.py:1.150	Sat Feb  5 13:51:33 2005
+++ chandler/parcels/osaf/framework/blocks/ContainerBlocks.py	Mon Feb  7 14:53:54 2005
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.150 $"
-__date__ = "$Date: 2005/02/05 21:51:33 $"
+__version__ = "$Revision: 1.151 $"
+__date__ = "$Date: 2005/02/07 22:53:54 $"
 __copyright__ = "Copyright (c) 2003-2005 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -372,6 +372,19 @@
             selectionIndex = selectionIndex + 1
 
 
+class wxFrameWindow (wxViewContainer):
+    pass
+
+class FrameWindow (ViewContainer):
+    """
+      @@@ For now a FrameWindow is just a ViewContainer with added position attributes,
+    but we will want to move a lot of MainFrame code from Application.py into here.
+    Right now we special case MainFrame, but we should better work that into the block
+    framework.
+    """
+    pass
+
+
 class wxTabbedContainer(DropReceiveWidget, wx.Notebook):
     def __init__(self, *arguments, **keywords):
         super (wxTabbedContainer, self).__init__ (*arguments, **keywords)

Index: chandler/parcels/osaf/views/main/parcel.xml
diff -u chandler/parcels/osaf/views/main/parcel.xml:1.168 chandler/parcels/osaf/views/main/parcel.xml:1.169
--- chandler/parcels/osaf/views/main/parcel.xml:1.168	Sun Feb  6 13:01:16 2005
+++ chandler/parcels/osaf/views/main/parcel.xml	Mon Feb  7 14:53:54 2005
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.168 $ -->
-<!-- $Date: 2005/02/06 21:01:16 $ -->
+<!-- $Revision: 1.169 $ -->
+<!-- $Date: 2005/02/07 22:53:54 $ -->
 <!-- Copyright (c) 2003-2004 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -1501,13 +1501,13 @@
   <!--
     Root of User Interface
   -->
-  <ViewContainer itsName="MainViewRoot">
+  <FrameWindow itsName="MainViewRoot">
     <blockName>MainViewRoot</blockName>
     <size>1024,720</size>
     <views itemref="doc:ChandlerMainView"/>
     <views itemref="doc:CPIATestMainView"/>
     <childrenBlocks itemref="doc:MainDetailView"/>
-  </ViewContainer>
+  </FrameWindow>
 
   <TrunkParentBlock itsName="MainDetailView">
     <blockName>MainDetailView</blockName>

Index: chandler/parcels/osaf/framework/blocks/DocumentTypes.py
diff -u chandler/parcels/osaf/framework/blocks/DocumentTypes.py:1.5 chandler/parcels/osaf/framework/blocks/DocumentTypes.py:1.6
--- chandler/parcels/osaf/framework/blocks/DocumentTypes.py:1.5	Mon Jun  7 17:23:05 2004
+++ chandler/parcels/osaf/framework/blocks/DocumentTypes.py	Mon Feb  7 14:53:54 2005
@@ -15,6 +15,19 @@
         return size
 
 
+class PositionType(object):
+    __slots__ = 'x', 'y'
+    
+class PositionStruct(CoreTypes.Struct):
+
+    def makeValue(Struct, data):
+        (x, y) = data.split(",")
+        position = PositionType()
+        setattr (position, 'x', float(x))
+        setattr (position, 'y', float(y))
+        return position
+
+
 class RectType(object):
     __slots__ = 'top', 'left', 'bottom', 'right'
 

Index: chandler/application/Application.py
diff -u chandler/application/Application.py:1.298 chandler/application/Application.py:1.299
--- chandler/application/Application.py:1.298	Sun Feb  6 11:38:21 2005
+++ chandler/application/Application.py	Mon Feb  7 14:53:54 2005
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.298 $"
-__date__ = "$Date: 2005/02/06 19:38:21 $"
+__version__ = "$Revision: 1.299 $"
+__date__ = "$Date: 2005/02/07 22:53:54 $"
 __copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -73,6 +73,7 @@
         self.SetBackgroundColour (wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DFACE))
         self.Bind(wx.EVT_CLOSE, self.OnClose)
         self.Bind(wx.EVT_SIZE, self.OnSize)
+        self.Bind(wx.EVT_MOVE, self.OnMove)
 
     def OnClose(self, event):
         """
@@ -102,6 +103,18 @@
             Globals.mainViewRoot.setDirty(Globals.mainViewRoot.VDIRTY, 'size', Globals.mainViewRoot._values)   # Temporary repository hack -- DJA
         event.Skip()
 
+    def OnMove(self, event):
+        """
+          Calling Skip causes wxWindows to continue processing the event, 
+        which will cause the parent class to get a crack at the event.
+        """
+        if not wx.GetApp().ignoreSynchronizeWidget:
+            Globals.mainViewRoot.position.x = self.GetPosition().x
+            Globals.mainViewRoot.position.y = self.GetPosition().y
+            Globals.mainViewRoot.setDirty(Globals.mainViewRoot.VDIRTY, 'position', Globals.mainViewRoot._values)   # Temporary repository hack -- DJA
+        event.Skip()
+
+
 class wxApplication (wx.App):
     """
       PARCEL_IMPORT defines the import directory containing parcels
@@ -245,9 +258,14 @@
         self.__twistedReactorManager.startReactor()
 
         mainViewRoot = self.LoadMainViewRoot(delete=Globals.options.refreshui)
+        if (mainViewRoot.position.x == -1 and mainViewRoot.position.y == -1):
+            position = wx.DefaultPosition
+        else:
+            position = (mainViewRoot.position.x, mainViewRoot.position.y)
         self.mainFrame = MainFrame(None,
                                    -1,
                                    "Chandler",
+                                   pos=position,
                                    size=(mainViewRoot.size.width, mainViewRoot.size.height),
                                    style=wx.DEFAULT_FRAME_STYLE)
         mainViewRoot.frame = self.mainFrame

Index: chandler/parcels/osaf/framework/blocks/parcel.xml
diff -u chandler/parcels/osaf/framework/blocks/parcel.xml:1.149 chandler/parcels/osaf/framework/blocks/parcel.xml:1.150
--- chandler/parcels/osaf/framework/blocks/parcel.xml:1.149	Sun Feb  6 11:38:21 2005
+++ chandler/parcels/osaf/framework/blocks/parcel.xml	Mon Feb  7 14:53:54 2005
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.149 $ -->
-<!-- $Date: 2005/02/06 19:38:21 $ -->
+<!-- $Revision: 1.150 $ -->
+<!-- $Date: 2005/02/07 22:53:54 $ -->
 <!-- Copyright (c) 2003-2005 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -61,6 +61,12 @@
     <implementationTypes key="python">osaf.framework.blocks.DocumentTypes.SizeType</implementationTypes>
   </Struct>
  
+  <Struct itsName="PositionType" itemClass="osaf.framework.blocks.DocumentTypes.PositionStruct">
+    <fields key="x"></fields>
+    <fields key="y"></fields>
+    <implementationTypes key="python">osaf.framework.blocks.DocumentTypes.PositionType</implementationTypes>
+  </Struct>
+
   <Struct itsName="RectType" itemClass="osaf.framework.blocks.DocumentTypes.RectStruct">
     <fields key="top"></fields>
     <fields key="left"></fields>
@@ -1085,6 +1091,19 @@
   </Kind>  
   
   <!--
+    FrameWindow
+  -->
+  <Kind itsName="FrameWindow">
+    <classes key="python">osaf.framework.blocks.ContainerBlocks.FrameWindow</classes>
+    <superKinds itemref="docSchema:ViewContainer"/>
+
+    <Attribute itsName="position">
+      <type itemref="docSchema:PositionType"/>
+      <initialValue type="docSchema:PositionType">-1,-1</initialValue>
+    </Attribute>
+  </Kind>  
+
+  <!--
     TabbedContainer
   -->
   <Kind itsName="TabbedContainer">



More information about the Commits mailing list