Changeset 2611


Ignore:
Timestamp:
Jan 4, 2017 10:46:36 PM (5 years ago)
Author:
toby
Message:

Change PDF defaults; option for multiple element addition (added to PDF); replace old single-spot mask option with new; stop overwriting image limits on Copy Controls

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r2607 r2611  
    35203520                            'Geometry':'Cylinder','Diam':1.0,'Pack':0.50,'Form Vol':10.0,
    35213521                            'DetType':'Image plate','ObliqCoeff':0.2,'Ruland':0.025,'QScaleLim':Qlimits[i],
    3522                             'Lorch':True,'BackRatio':0.0,'Rmax':100.,'noRing':True,'IofQmin':1.0}
     3522                            'Lorch':False,'BackRatio':0.0,'Rmax':100.,'noRing':False,'IofQmin':1.0}
    35233523                        self.PatternTree.SetItemPyData(self.PatternTree.AppendItem(Id,text='PDF Controls'),Data)
    35243524                        self.PatternTree.SetItemPyData(self.PatternTree.AppendItem(Id,text='I(Q)'+PWDRname),[])       
  • trunk/GSASIIElemGUI.py

    r2546 r2611  
    2424import wx.lib.colourselect as wscs
    2525class PickElement(wx.Dialog):
    26     "Makes periodic table widget for picking element - caller maintains element list"
     26    '''Makes periodic table widget for picking element. Modes:
     27        oneOnly if True element symbols are provided, otherwise select isotope
     28        ifNone ?
     29        ifMag if True present magnetic scatters only
     30        multiple if True multiple elements can be selected
     31    '''
    2732    Elem=None
    2833    def _init_ctrls(self,prnt,ifMag=False):
     
    5055               tip=E[3],color=color)
    5156            i+=1
    52 
    53     def __init__(self, parent,oneOnly=False,ifNone=False,ifMag=False):
     57        if self.multiple:
     58            b = wx.Button(self,wx.ID_CLOSE,
     59                          pos=wx.Point(16.5*self.butWid+25,7.75*24+24),
     60                          label="Done")
     61            b.Bind(wx.EVT_BUTTON, self.OnClose)
     62
     63    def __init__(self, parent,oneOnly=False,ifNone=False,ifMag=False,multiple=False):
    5464        'Needs a doc string'
    5565        self.oneOnly = oneOnly
    5666        self.ifNone = ifNone
     67        self.multiple = multiple
    5768        self._init_ctrls(parent,ifMag=ifMag)
     69        self.elementList = []
    5870       
    5971    def ElButton(self, name, pos, tip, color):
     
    90102            El = event.GetEventObject().GetValue()
    91103        self.Elem = El
    92         self.EndModal(wx.ID_OK)       
    93        
     104        if self.multiple:
     105            self.elementList.append(El)
     106            event.GetEventObject().SetBackgroundColour('black') # Shows on Mac
     107            event.GetEventObject().SetColour(
     108                wx.Colour(*[int(i/2) for i in event.GetEventObject().GetColour()]))
     109        else:
     110            self.EndModal(wx.ID_OK)
     111
     112    def OnClose(self,event):
     113        self.EndModal(wx.ID_OK)
     114               
    94115class PickElements(wx.Dialog):
    95116    """Makes periodic table widget for picking elements - caller maintains element list"""
  • trunk/GSASIIgrid.py

    r2607 r2611  
    9999
    100100[ wxID_MASKCOPY, wxID_MASKSAVE, wxID_MASKLOAD, wxID_NEWMASKSPOT,wxID_NEWMASKARC,wxID_NEWMASKRING,
    101     wxID_NEWMASKFRAME, wxID_NEWMASKPOLY,wxID_MASKLOADNOT,wxID_FINDSPOTS,wxID_MULTISPOTMASK,
    102 ] = [wx.NewId() for item in range(11)]
     101    wxID_NEWMASKFRAME, wxID_NEWMASKPOLY,wxID_MASKLOADNOT,wxID_FINDSPOTS,
     102] = [wx.NewId() for item in range(10)]
    103103
    104104[ wxID_STRSTACOPY, wxID_STRSTAFIT, wxID_STRSTASAVE, wxID_STRSTALOAD,wxID_STRSTSAMPLE,
     
    21292129        submenu.Append(help='Create a ring mask with mouse input',
    21302130            id=wxID_NEWMASKRING, kind=wx.ITEM_NORMAL,text='Ring mask')
    2131         submenu.Append(help='Create a spot mask with mouse input',
     2131        submenu.Append(help='Create spot masks with mouse clicks',
    21322132            id=wxID_NEWMASKSPOT, kind=wx.ITEM_NORMAL,text='Spot mask')
    2133         submenu.Append(help='Turn on/off multiple spot mask creation mode',
    2134             id=wxID_MULTISPOTMASK, kind=wx.ITEM_NORMAL,text='Multiple spot masks')
    21352133        self.PostfillDataMenu()
    21362134           
     
    21652163        self.PDFEdit = wx.Menu(title='')
    21662164        self.PDFMenu.Append(menu=self.PDFEdit, title='PDF Controls')
    2167         self.PDFEdit.Append(help='Add element to sample composition',id=wxID_PDFADDELEMENT, kind=wx.ITEM_NORMAL,
    2168             text='Add element')
     2165        self.PDFEdit.Append(help='Add one or more elements to sample composition',id=wxID_PDFADDELEMENT, kind=wx.ITEM_NORMAL,
     2166            text='Add elements')
    21692167        self.PDFEdit.Append(help='Delete element from sample composition',id=wxID_PDFDELELEMENT, kind=wx.ITEM_NORMAL,
    21702168            text='Delete element')
  • trunk/GSASIIimgGUI.py

    r2610 r2611  
    288288                    oldData = copy.deepcopy(G2frame.PatternTree.GetItemPyData(CId))
    289289                    Data = copy.deepcopy(data)
     290                    Data['range'][0] = oldData['range'][0]
    290291                    Data['size'] = oldData['size']
    291292                    Data['GonioAngles'] = oldData.get('GonioAngles', [0.,0.,0.])
     
    297298                    if name == Data['background image'][0]:
    298299                        Data['background image'] = ['',-1.]
    299                     G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id, 'Image Controls'),copy.deepcopy(Data))
     300                    G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id, 'Image Controls'),Data)
    300301        finally:
    301302            dlg.Destroy()
     
    13131314        G2plt.ToggleMultiSpotMask(G2frame)
    13141315       
    1315     def OnNewSpotMask(event):
    1316         'Start a new spot mask'
    1317         G2frame.MaskKey = 's'
    1318         G2plt.OnStartMask(G2frame)
    1319        
    13201316    def OnNewArcMask(event):
    13211317        'Start a new arc mask'
     
    15061502    G2frame.dataFrame.Bind(wx.EVT_MENU, OnSaveMask, id=G2gd.wxID_MASKSAVE)
    15071503    G2frame.dataFrame.Bind(wx.EVT_MENU, OnAutoSpotMask, id=G2gd.wxID_FINDSPOTS)
    1508     G2frame.dataFrame.Bind(wx.EVT_MENU, OnNewSpotMask, id=G2gd.wxID_NEWMASKSPOT)
    1509     G2frame.dataFrame.Bind(wx.EVT_MENU, ToggleSpotMaskMode, id=G2gd.wxID_MULTISPOTMASK)
     1504    G2frame.dataFrame.Bind(wx.EVT_MENU, ToggleSpotMaskMode, id=G2gd.wxID_NEWMASKSPOT)
    15101505    G2frame.dataFrame.Bind(wx.EVT_MENU, OnNewArcMask, id=G2gd.wxID_NEWMASKARC)
    15111506    G2frame.dataFrame.Bind(wx.EVT_MENU, OnNewRingMask, id=G2gd.wxID_NEWMASKRING)
     
    15181513    elif G2frame.MaskKey == 'p':
    15191514        G2frame.dataFrame.GetStatusBar().SetStatusText('Polygon mask active - LB pick next point, RB close polygon')
    1520     elif G2frame.MaskKey == 's':
    1521         G2frame.dataFrame.GetStatusBar().SetStatusText('Spot mask active - LB pick spot location')
    15221515    elif G2frame.MaskKey == 'a':
    15231516        G2frame.dataFrame.GetStatusBar().SetStatusText('Arc mask active - LB pick arc location')
  • trunk/GSASIIplot.py

    r2607 r2611  
    41244124        Page.figure.suptitle('Defining Polygon mask (use right-mouse to end)',color='r',fontweight='bold')
    41254125        Page.canvas.draw()
    4126     elif G2frame.MaskKey == 's':
    4127         new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab('2D Powder Image','mpl',newImage=False)
    4128         Page.figure.suptitle('Left-click to create a spot mask',color='r',fontweight='bold')
    4129         Page.canvas.draw()
    41304126    elif G2frame.MaskKey == 'a':
    41314127        new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab('2D Powder Image','mpl',newImage=False)
     
    41554151    '''
    41564152    new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab('2D Powder Image','mpl',newImage=False)
    4157     if G2frame.MaskKey == 'm':
     4153    if G2frame.MaskKey == 's':
    41584154        G2frame.MaskKey = ''
    4159         Page.Choice[-1] = 'm: start multiple spot mask mode'
     4155        Page.Choice[-1] = 's: start multiple spot mask mode'
    41604156        wx.CallAfter(PlotImage,G2frame,newImage=True)
    41614157    else:
    4162         G2frame.MaskKey = 'm'
     4158        G2frame.MaskKey = 's'
    41634159        (x0,y0),(x1,y1) = Plot.get_position().get_points()
    4164         Page.figure.suptitle('Multiple spot mode on, press m or right-click to end',color='r',fontweight='bold')
    4165         Page.Choice[-1] = 'm: stop multiple spot mask mode'
     4160        Page.figure.suptitle('Multiple spot mode on, press s or right-click to end',color='r',fontweight='bold')
     4161        Page.Choice[-1] = 's: stop multiple spot mask mode'
    41664162        Page.canvas.draw()
    41674163
     
    42804276            return
    42814277        if treeItem == 'Masks':
    4282             if event.key == 'm': # implement multiple spot mode
     4278            if event.key == 's': # implement multiple spot mode
    42834279                ToggleMultiSpotMask(G2frame)
    42844280                return
     
    43024298                Page.canvas.draw()
    43034299                return
    4304             elif event.key in ['l','p','f','s','a','r']:
     4300            elif event.key in ['l','p','f','a','r']:
    43054301                G2frame.MaskKey = event.key
    43064302                OnStartMask(G2frame)
     
    46344630            if not Xpos or not Ypos or Page.toolbar._active:  #got point out of frame or zoom/pan selected
    46354631                return
    4636             if G2frame.MaskKey == 'm':
     4632            if G2frame.MaskKey == 's':
    46374633                if event.button == 3:
    46384634                    ToggleMultiSpotMask(G2frame)
     
    48254821            Page.keyPress = OnImPlotKeyPress
    48264822        elif G2frame.PatternTree.GetItemText(G2frame.PickId) in ['Masks',]:
    4827             Page.Choice = [' key press','l: log(I) on','s: spot mask','a: arc mask','r: ring mask',
     4823            Page.Choice = [' key press','l: log(I) on','a: arc mask','r: ring mask',
    48284824                'p: polygon mask','f: frame mask',
    48294825                't: add spot mask at mouse position']
    4830             Page.Choice.append('m: start multiple spot mask mode') # this must be the last choice
     4826            Page.Choice.append('s: start multiple spot mask mode') # this must be the last choice
    48314827            if G2frame.logPlot:
    48324828                Page.Choice[1] = 'l: log(I) off'
  • trunk/GSASIIpwdGUI.py

    r2610 r2611  
    47804780        OnComputePDF(event)               
    47814781        wx.CallAfter(UpdatePDFGrid,G2frame,data)
    4782         #UpdatePDFGrid(G2frame,data)
    47834782       
    47844783    def OnAddElement(event):
    47854784        ElList = data['ElList']
    4786         PE = G2elemGUI.PickElement(G2frame,oneOnly=True)
     4785        PE = G2elemGUI.PickElement(G2frame,oneOnly=True,multiple=True)
    47874786        if PE.ShowModal() == wx.ID_OK:
    4788             El = PE.Elem
    4789             if El not in ElList and El != 'None':
    4790                 data['ElList'][El] = G2elem.GetElInfo(El,inst)
     4787            for El in PE.elementList:
     4788                if El not in ElList and El != 'None':
     4789                    try:
     4790                        data['ElList'][El] = G2elem.GetElInfo(El,inst)
     4791                        data['ElList'][El]['FormulaNo'] = 1.0
     4792                    except IndexError: # happens with element Q
     4793                        pass
    47914794            data['Form Vol'] = max(10.0,SumElementVolumes())
    47924795        PE.Destroy()
    47934796        wx.CallAfter(UpdatePDFGrid,G2frame,data)
    4794         #UpdatePDFGrid(G2frame,data)
    47954797       
    47964798    def OnDeleteElement(event):
     
    50205022    sqBox = wx.BoxSizer(wx.HORIZONTAL)
    50215023    sqBox.Add(wx.StaticText(G2frame.dataDisplay,label=' Scaling q-range: '),0,WACV)
    5022     SQmin = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data['QScaleLim'],0,nDig=(10,3),min=qLimits[0],max=.95*data['QScaleLim'][1],
    5023         typeHint=float,OnLeave=AfterChangeNoRefresh)
     5024    SQmin = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data['QScaleLim'],0,nDig=(10,3),
     5025                                 min=qLimits[0],max=.95*data['QScaleLim'][1],
     5026                                 typeHint=float,OnLeave=AfterChangeNoRefresh)
    50245027    sqBox.Add(SQmin,0,WACV)
    50255028    sqBox.Add(wx.StaticText(G2frame.dataDisplay,label=' to Qmax '),0,WACV)
    5026     SQmax = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data['QScaleLim'],1,nDig=(10,3),min=qLimits[0],max=qLimits[1],
    5027         typeHint=float,OnLeave=NewQmax)
     5029    SQmax = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,data['QScaleLim'],1,nDig=(10,3),
     5030                                 min=qLimits[0],max=qLimits[1],
     5031                                 typeHint=float,OnLeave=NewQmax)
    50285032    sqBox.Add(SQmax,0,WACV)
    50295033    resetQ = wx.CheckBox(parent=G2frame.dataDisplay,label='Reset?')
  • trunk/help/gsasII.html

    r2609 r2611  
    57715771<P style='margin-left:.25in'><B>Create Spot masks</B> after a menu command by clicking on
    57725772  the location on the image that should be masked. There are also
    5773   three ways to create spot masks with the keyboard:
     5773  two ways to create spot masks with the keyboard:
    57745774 <UL>
    5775 <LI style='margin-left:.2in'>Press the 's' key and then left-click on the mask location.   
    5776 (<a href="#Mac_rightclick">Right-click*</a> to cancel.)
    5777 <LI style='margin-left:.2in'>Press the 'm' key and
     5775<LI style='margin-left:.2in'>Press the 's' key and
    57785776   then left-click successively on multiple locations for spot
    5779    masks. Press the 'm' key again or <a href="#Mac_rightclick">right-click*</a>
     5777   masks. Press the 's' key again or <a href="#Mac_rightclick">right-click*</a>
    57805778   to stop adding spot masks.
    57815779<LI style='margin-left:.2in'>Move the mouse to the position for a
     
    72027200<hr size=2 width="100%" align=center>
    72037201
    7204 <!-- hhmts start -->Last modified: Tue Jan  3 12:18:13 CST 2017 <!-- hhmts end -->
     7202<!-- hhmts start -->Last modified: Wed Jan  4 16:40:54 CST 2017 <!-- hhmts end -->
    72057203
    72067204</div>
Note: See TracChangeset for help on using the changeset viewer.