Dear all

At present only the positions of the main and plot windows of GSASII are
restored to their previous values between sessions. This patch also
restores the size of the two windows between calls to GSASII. It
introduces two new configuration variables ("Main_SIze" and
"Plot_Size"), initially set to the default of provided by wx-windows.

regards
-- 
Dr. Ivo Alxneit
Catalysis for Energy Group
Bioenergy and Catalysis Laboratory        phone: +41 56 310 4092
Paul Scherrer Institute                     fax: +41 56 310 2688
CH-5232 Villigen                      gnupg key: 0x515E30C7
Switzerland
https://www.psi.ch/ceg/
--- /fast_home/alxneit/GSAS-II_orig/GSASIIdataGUI.py
+++ /fast_home/alxneit/GSAS-II/GSASIIdataGUI.py
@@ -2567,8 +2567,13 @@
             menubar.Append(menu=HelpMenu,title='&Help')
 
     def _init_ctrls(self, parent):
+        try:
+            size = GSASIIpath.GetConfigValue('Main_Size')
+            if type(size) is str: size = eval(size)
+        except:
+            size=wx.DefaultSize
         wx.Frame.__init__(self, name='GSASII', parent=parent,
-            size=wx.Size(700, 450),style=wx.DEFAULT_FRAME_STYLE, title='GSAS-II main window')
+            size=size,style=wx.DEFAULT_FRAME_STYLE, title='GSAS-II main window')
         self._init_Imports()
         #initialize Menu item objects (these contain lists of menu items that are enabled or disabled)
         self.MakePDF = []
@@ -2623,7 +2628,12 @@
 
 #        self.dataWindow.SetupScrolling()
 
-        self.plotFrame = wx.Frame(None,-1,'GSASII Plots',size=wx.Size(700,600), \
+        try:
+            size = GSASIIpath.GetConfigValue('Plot_Size')
+            if type(size) is str: size = eval(size)
+        except:
+            size=wx.DefaultSize
+        self.plotFrame = wx.Frame(None,-1,'GSASII Plots',size=size, \
             style=wx.DEFAULT_FRAME_STYLE ^ wx.CLOSE_BOX)
         self.G2plotNB = G2plt.G2PlotNoteBook(self.plotFrame,G2frame=self)
         self.plotFrame.Show()
@@ -3735,8 +3745,11 @@
         rescord last position of data & plot windows; saved to config.py file
         NB: not called if console window closed
         '''
-        FramePos = {'Main_Pos':tuple(self.GetPosition()),'Plot_Pos':tuple(self.plotFrame.GetPosition())}
-        GSASIIpath.SetConfigValue(FramePos)
+        FrameInfo = {'Main_Pos':tuple(self.GetPosition()),
+                     'Main_Size':tuple(self.GetSize()),
+                     'Plot_Pos':tuple(self.plotFrame.GetPosition()),
+                     'Plot_Size':tuple(self.plotFrame.GetSize())}
+        GSASIIpath.SetConfigValue(FrameInfo)
         config = G2G.GetConfigValsDocs()
         G2G.SaveConfigVars(config)
         if self.G2plotNB:
@@ -4457,14 +4470,14 @@
     which deletes the contents of the master sizer. After the contents are
     posted a call is made to
 
-        G2frame.dataWindow.SetDataSize()
+	    G2frame.dataWindow.SetDataSize()
 
     which repaints the window. For routines [such as GSASIIpwdGUI.UpdatePeakGrid()]
     that are called repeatedly to update the entire contents of dataWindow
     themselves, it is important to add calls to
         G2frame.dataWindow.ClearData()
     and
-        G2frame.dataWindow.SetDataSize()
+	    G2frame.dataWindow.SetDataSize()
     at the beginning and end respectively to clear and refresh. This is not
     needed for GSNoteBook repaints, which seem to be working mostly
     automatically. If there is a problem, a call like
--- /fast_home/alxneit/GSAS-II_orig/config_example.py
+++ /fast_home/alxneit/GSAS-II/config_example.py
@@ -136,9 +136,20 @@
 '''Main window location - will be updated & saved when user moves
 it. If position is outside screen then it will be repositioned to default
 '''
+
+Main_Size = '(-1,-1)'
+'''Main window size (width,height) - initially uses wx.DefaultSize but will be
+updated and saved as the user changes the window
+'''
+
 Plot_Pos = '(200,200)'
 '''Plot window location - will be updated & saved when user moves it
 these widows. If position is outside screen then it will be repositioned to default
+'''
+
+Plot_Size = '(-1,-1)'
+'''Plot window size (width,height) - initially uses wx.DefaultSize but will be
+updated and saved as the user changes the window
 '''
 
 Tick_length = 8.0

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
GSAS-II mailing list
GSAS-II@mailman.aps.anl.gov
https://mailman.aps.anl.gov/mailman/listinfo/gsas-ii

Reply via email to