Changeset 3170


Ignore:
Timestamp:
Dec 1, 2017 12:36:31 PM (4 years ago)
Author:
vondreele
Message:

implement saving of data & plot window sizes (along with positions)
fix issues with imageGUI displays; arrange Mask sliders to match Image Controls sliders

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r3157 r3170  
    25682568           
    25692569    def _init_ctrls(self, parent):
     2570        try:
     2571            size = GSASIIpath.GetConfigValue('Main_Size')
     2572            if type(size) is str:
     2573                size = eval(size)
     2574        except:
     2575            size = wx.Size(700,450)
    25702576        wx.Frame.__init__(self, name='GSASII', parent=parent,
    2571             size=wx.Size(700, 450),style=wx.DEFAULT_FRAME_STYLE, title='GSAS-II main window')
     2577            size=size,style=wx.DEFAULT_FRAME_STYLE, title='GSAS-II main window')
    25722578        self._init_Imports()
    25732579        #initialize Menu item objects (these contain lists of menu items that are enabled or disabled)
     
    26232629
    26242630#        self.dataWindow.SetupScrolling()
    2625                
    2626         self.plotFrame = wx.Frame(None,-1,'GSASII Plots',size=wx.Size(700,600), \
     2631
     2632        try:
     2633            size = GSASIIpath.GetConfigValue('Plot_Size')
     2634            if type(size) is str: size = eval(size)
     2635        except:
     2636            size = wx.Size(700,600)               
     2637        self.plotFrame = wx.Frame(None,-1,'GSASII Plots',size=size,
    26272638            style=wx.DEFAULT_FRAME_STYLE ^ wx.CLOSE_BOX)
    26282639        self.G2plotNB = G2plt.G2PlotNoteBook(self.plotFrame,G2frame=self)
     
    37703781        NB: not called if console window closed
    37713782        '''
    3772         FramePos = {'Main_Pos':tuple(self.GetPosition()),'Plot_Pos':tuple(self.plotFrame.GetPosition())}
    3773         GSASIIpath.SetConfigValue(FramePos)
     3783        FrameInfo = {'Main_Pos':tuple(self.GetPosition()),
     3784                     'Main_Size':tuple(self.GetSize()),
     3785                     'Plot_Pos':tuple(self.plotFrame.GetPosition()),
     3786                     'Plot_Size':tuple(self.plotFrame.GetSize())}
     3787        GSASIIpath.SetConfigValue(FrameInfo)
     3788#        FramePos = {'Main_Pos':tuple(self.GetPosition()),'Plot_Pos':tuple(self.plotFrame.GetPosition())}
     3789#        GSASIIpath.SetConfigValue(FramePos)
    37743790        config = G2G.GetConfigValsDocs()
    37753791        G2G.SaveConfigVars(config)
     
    44924508    posted a call is made to
    44934509
    4494             G2frame.dataWindow.SetDataSize()
     4510        G2frame.dataWindow.SetDataSize()
    44954511
    44964512    which repaints the window. For routines [such as GSASIIpwdGUI.UpdatePeakGrid()]
     
    44994515        G2frame.dataWindow.ClearData()
    45004516    and
    4501             G2frame.dataWindow.SetDataSize()
     4517        G2frame.dataWindow.SetDataSize()
    45024518    at the beginning and end respectively to clear and refresh. This is not
    45034519    needed for GSNoteBook repaints, which seem to be working mostly
     
    46064622
    46074623    def _initMenus(self):
    4608         'define all GSAS-II data window menus'
     4624        '''define all GSAS-II data window menus.
     4625        NB: argument order conforms to both classic & phoenix variants for wx.
     4626        Do not use argument= for these as the argument names are different for classic & phoenix
     4627        '''
    46094628       
    46104629#        G2G.Define_wxId('wxID_MCRON', 'wxID_MCRLIST', 'wxID_MCRSAVE', 'wxID_MCRPLAY',)
     
    53395358        self.PostfillDataMenu()
    53405359    # end of GSAS-II menu definitions
    5341    
    5342        
    53435360                   
    53445361################################################################################
  • trunk/GSASIIimgGUI.py

    r3161 r3170  
    15321532        #   (Imin0, Imax0) => Range[0] = data['range'][0] # lowest to highest pixel intensity
    15331533        #   [Imin, Imax] => Range[1] = data['range'][1] #   lowest to highest pixel intensity on cmap scale
    1534         scaleChoices = ("100%","99%","95%","90%","80%","?")
    1535         scaleSel = wx.Choice(G2frame.dataWindow,choices=scaleChoices,size=(-1,-1))
    1536         if (Range[1][0] == Range[0][0] and Range[1][1] == Range[0][1]):
    1537             scaleSel.SetSelection(0)
    1538         else:
    1539             scaleSel.SetSelection(len(scaleChoices)-1)
    1540         scaleSel.Bind(wx.EVT_CHOICE,OnAutoSet)
    15411534       
    15421535        maxSizer = wx.BoxSizer(wx.VERTICAL)
     
    15501543        sv1 = min(100,max(0,int(0.5+100.*sqrtDeltOne/sqrtDeltZero)))
    15511544        maxSel = wx.Slider(parent=G2frame.dataWindow,style=wx.SL_HORIZONTAL,value=sv1)
    1552         slideSizer.Add(maxSel,flag=wx.EXPAND|wx.ALL)
    1553         slideSizer.AddGrowableCol(1)
    1554         maxSel.Bind(wx.EVT_SLIDER, OnMaxSlider)
    15551545        maxVal = G2G.ValidatedTxtCtrl(G2frame.dataWindow,Range[1],1,min=Range[0][0]+1,
    15561546            max=Range[0][1],OnLeave=OnNewVal)
    15571547        slideSizer.Add(maxVal,0,WACV)
     1548        slideSizer.Add(maxSel,flag=wx.EXPAND|wx.ALL)
     1549        slideSizer.AddGrowableCol(2)
     1550        maxSel.Bind(wx.EVT_SLIDER, OnMaxSlider)
    15581551        slideSizer.Add(wx.StaticText(parent=G2frame.dataWindow,label=' Min intensity'),0,WACV)
    15591552        # minSel is a slider with 101 steps scaled from Imin0 to Imax-1 with linear scaling
     
    15621555        DeltOne  = max(1.0,Range[1][1]-max(0.0,Range[0][0])-1) # Imax-Imin0-1
    15631556        sv0 = min(100,max(0,int(0.5+100.*(Range[1][0]-Range[0][0])/DeltOne)))
     1557        minVal = G2G.ValidatedTxtCtrl(G2frame.dataWindow,Range[1],0,
     1558            max=Range[0][1],typeHint=int,OnLeave=OnNewVal)
     1559        slideSizer.Add(minVal,0,WACV)
    15641560        minSel = wx.Slider(parent=G2frame.dataWindow,style=wx.SL_HORIZONTAL,value=sv0)
    15651561        slideSizer.Add(minSel,flag=wx.EXPAND|wx.ALL)
    15661562        minSel.Bind(wx.EVT_SLIDER, OnMinSlider)
    1567         minVal = G2G.ValidatedTxtCtrl(G2frame.dataWindow,Range[1],0,
    1568             max=Range[0][1],typeHint=int,OnLeave=OnNewVal)
    1569         slideSizer.Add(minVal,0,WACV)
    15701563        maxSizer.Add(slideSizer,flag=wx.EXPAND|wx.ALL)
    15711564        autoSizer = wx.BoxSizer(wx.HORIZONTAL)
  • trunk/config_example.py

    r3095 r3170  
    132132Used in AutoIntegration
    133133'''
    134 
     134Main_Size = '(700,450)'
     135'''Main window size (width, height) - initially uses wx.DefaultSize but will updated
     136 and saved as the user changes the window
     137'''
    135138Main_Pos = '(100,100)'
    136139'''Main window location - will be updated & saved when user moves
    137140it. If position is outside screen then it will be repositioned to default
     141'''
     142Plot_Size = '(700,600)'
     143'''Plot window size (width, height) - initially uses wx.DefaultSize but will updated
     144 and saved as the user changes the window
    138145'''
    139146Plot_Pos = '(200,200)'
  • trunk/testSSymbols.py

    r3166 r3170  
    22import sys
    33import wx
     4import GSASIIpath
     5GSASIIpath.SetBinaryPath()
    46import GSASIIspc as G2spc
    5 import GSASIIdataGUI as G2gd
    67import GSASIIctrlGUI as G2G
    7 import numpy as np
    8 import copy
    98
    10 def create(parent):
    11     return testDeriv(parent)
    129   
    1310[wxID_FILEEXIT,
     
    1916    def _init_ctrls(self, parent):
    2017        wx.Frame.__init__(self, name='testSSymbols', parent=parent,
    21             size=wx.Size(300, 150),style=wx.DEFAULT_FRAME_STYLE, title='Test SS symbols')
     18            size=wx.DefaultSize,style=wx.DEFAULT_FRAME_STYLE, title='Test SS symbols')
    2219        self.testSSMenu = wx.MenuBar()
    2320        self.File = wx.Menu(title='')
     
    6259                    Text = '\n'+E
    6360                    wx.MessageBox(Text,caption=msg,style=Style)
     61                   
     62        def OnExhaustive(event):
     63            SpGrp = Data['SGData']['SGLatt']+Data['SGData']['SGLaue']
     64            SpGrp = G2spc.StandardizeSpcName(SpGrp)
     65            SSList = G2spc.ssdict.get(SpGrp,['',])
     66            for SSymbol in SSList:
     67                E,SSGData = G2spc.SSpcGroup(Data['SGData'],SSymbol)
     68                if SSGData:
     69                    text,table = G2spc.SSGPrint(Data['SGData'],SSGData)
     70                    Data['SSGData'] = SSGData
     71                    Data['SuperSg'] = SSymbol
     72                    msg = 'Superspace Group Information'
     73                    G2G.SGMessageBox(self,msg,text,table).Show()
     74                else:
     75                    msg = 'Superspace Group Error for'+SSymbol
     76                    Style = wx.ICON_EXCLAMATION
     77                    Text = '\n'+E
     78                    wx.MessageBox(Text,caption=msg,style=Style)           
    6479       
    6580        def OnSpaceGroup(event):
     
    117132       
    118133        SGData = G2spc.SpcGroup(Data['SGData']['SpGrp'])[1]
    119         SSGData = G2spc.SSpcGroup(SGData,Data['SuperSg'])[1]
    120134       
    121135        self.testSSPanel.DestroyChildren()
     
    139153        SStry.Bind(wx.EVT_BUTTON,OnTryAll)
    140154        mainSizer.Add(SStry,0,WACV)
     155        mainSizer.Add(wx.StaticText(self.testSSPanel,-1,' Exhaustive try: '),0,WACV)
     156        ESStry = wx.Button(self.testSSPanel,-1,'OK')
     157        ESStry.Bind(wx.EVT_BUTTON,OnExhaustive)
     158        mainSizer.Add(ESStry,0,WACV)
    141159        self.testSSPanel.SetSizer(mainSizer)
    142160        Size = mainSizer.Fit(self.testSSPanel)
Note: See TracChangeset for help on using the changeset viewer.