Changeset 2619


Ignore:
Timestamp:
Jan 10, 2017 10:25:29 PM (5 years ago)
Author:
toby
Message:

note when Phase window is resized and use that size

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r2618 r2619  
    24222422        self.dataDisplayPhaseText = ''
    24232423        self.lastTreeSetting = []
    2424         self.lastSize = [0,0]
    24252424       
    24262425        arg = sys.argv
  • trunk/GSASIIgrid.py

    r2616 r2619  
    25102510        self.AtomGrid = []
    25112511        self.selectedRow = 0
     2512        self.lastSize = [0,0]       
     2513        self.manualPhaseSize = None
     2514        wx.Frame.Bind(self,wx.EVT_SIZE,self.OnReSize)
     2515        self.userReSize = False
     2516           
     2517    def OnReSize(self,event):
     2518        '''Keep track of size changes for Phase windows
     2519        '''
     2520        id = self.G2frame.PatternTree.GetSelection()
     2521        parent = self.G2frame.PatternTree.GetItemParent(id)
     2522        if self.userReSize and parent and self.G2frame.PatternTree.GetItemText(parent) == "Phases":
     2523            self.manualPhaseSize = event.EventObject.GetSize()
     2524            if GSASIIpath.GetConfigValue('debug'): print 'Saving Phase size=',self.manualPhaseSize             
     2525        event.Skip()
     2526
     2527    def SendSizeEvent(self):
     2528        '''Prevent SendSizeEvent from overriding the saved size
     2529        '''
     2530        self.userReSize = False
     2531        wx.Frame.SendSizeEvent(self)
     2532        self.userReSize = True
    25122533       
    25132534    def setSizePosLeft(self,Width):
     2535        '''Place the dataFrame window so that the upper left-hand corner remains in the same place;
     2536        The size is dictated by parameter Width, unless overridden by a previous Phase window resize
     2537        '''
     2538        self.userReSize = False
    25142539        Width = list(Width)
     2540        id = self.G2frame.PatternTree.GetSelection()
     2541        pid = self.G2frame.PatternTree.GetItemParent(id)
     2542        if pid:
     2543            parent = self.G2frame.PatternTree.GetItemText(pid)
     2544            # is this a phase window and has a previous window has been resized?
     2545            if self.manualPhaseSize and parent == "Phases":
     2546                Width = list(self.manualPhaseSize)
    25152547        Pos = self.GetPosition()
    2516         lastSize = self.G2frame.lastSize
    25172548        clientSize = wx.ClientDisplayRect()     #display window size (e.g. 1304x768)
    25182549        Width[1] = min(Width[1],clientSize[2]-300)
    25192550        Width[0] = max(Width[0],300)
    25202551        self.SetSize(Width)
    2521         if lastSize[0]:
    2522             Pos[0] += lastSize[0]-Width[0]
     2552        if self.lastSize[0]:
     2553            Pos[0] += self.lastSize[0]-Width[0]
    25232554        offSet = 0
    25242555        if Pos[0] < clientSize[2]:
     
    25272558            Pos[0] -= offSet
    25282559        self.SetPosition(wx.Point(Pos[0],Pos[1]))
    2529         self.G2frame.lastSize = Width
     2560        self.lastSize = Width
     2561        self.userReSize = True
    25302562       
    25312563    def Clear(self):
     
    28032835    mainSizer.Layout()   
    28042836    G2frame.dataDisplay.SetSizer(mainSizer)
    2805     G2frame.dataDisplay.SetSize(mainSizer.Fit(G2frame.dataFrame))
     2837    #G2frame.dataDisplay.SetSize(mainSizer.Fit(G2frame.dataFrame))
    28062838    G2frame.dataFrame.setSizePosLeft(mainSizer.Fit(G2frame.dataFrame))
    28072839     
     
    39794011    G2frame.dataDisplay.AutoSizeColumns(True)
    39804012    if prevSize:
    3981         G2frame.dataDisplay.SetSize(prevSize)
     4013        #G2frame.dataDisplay.SetSize(prevSize)
     4014        G2frame.dataFrame.setSizePosLeft(prevSize)
    39824015    else:
    39834016        G2frame.dataFrame.setSizePosLeft([700,350])
  • trunk/GSASIIphsGUI.py

    r2607 r2619  
    6666acosd = lambda x: 180.*np.arccos(x)/np.pi
    6767atan2d = lambda x,y: 180.*np.arctan2(y,x)/np.pi
    68    
     68
    6969def SetPhaseWindow(mainFrame,phasePage,mainSizer,Scroll=0):
    7070    phasePage.SetSizer(mainSizer)
     
    78867886        for page in G2frame.dataDisplay.gridList: # clear out all grids, forcing edits in progress to complete
    78877887            page.ClearGrid()
    7888         wx.Frame.Unbind(G2frame.dataFrame,wx.EVT_SIZE) # ignore size events during this routine
    78897888        page = event.GetSelection()
    78907889        ChangePage(page)
     
    80918090    G2frame.dataDisplay.gridList = [] # list of all grids in notebook
    80928091    Pages = []   
    8093     wx.Frame.Unbind(G2frame.dataFrame,wx.EVT_SIZE) # ignore size events during this routine
    80948092    G2frame.dataDisplay.gridList = []
    80958093    General = wx.ScrolledWindow(G2frame.dataDisplay)
     
    81428140    if oldPage is None or oldPage == 0:
    81438141        ChangePage(0)
     8142        wx.CallAfter(G2frame.dataDisplay.SendSizeEvent)
    81448143    elif oldPage:
    81458144        SetupGeneral()    # not sure why one might need this when moving from phase to phase; but does not hurt
Note: See TracChangeset for help on using the changeset viewer.