Changeset 2674


Ignore:
Timestamp:
Jan 30, 2017 2:25:48 PM (5 years ago)
Author:
vondreele
Message:

prevent delete if PWDR if corresponding PDF exists
use PickElements? instead of PickElement? - allows multiple selection, blacks out ones already picked & can unpick a pick
add delete spots option to masks

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r2669 r2674  
    31523152        DelItemList = []
    31533153        nItems = {'PWDR':0,'SASD':0,'IMG':0,'HKLF':0,'PDF':0}
     3154        PDFnames = []
    31543155        if self.PatternTree.GetCount():
    31553156            item, cookie = self.PatternTree.GetFirstChild(self.root)
     
    31623163                    if 'IMG' in name:  nItems['IMG'] += 1
    31633164                    if 'HKLF' in name: nItems['HKLF'] += 1
    3164                     if 'PDF' in name:  nItems['PDF'] += 1
     3165                    if 'PDF' in name:
     3166                        PDFnames.append(name)
     3167                        nItems['PDF'] += 1
    31653168                    TextList.append(name)
    31663169                item, cookie = self.PatternTree.GetNextChild(self.root, cookie)
     3170            for pdfName in PDFnames:
     3171                TextList.remove('PWDR'+pdfName[4:])
    31673172            dlg = G2G.G2MultiChoiceDialog(self, 'Which data to delete?', 'Delete data', TextList, wx.CHOICEDLG_STYLE)
    31683173            try:
  • trunk/GSASIIElemGUI.py

    r2668 r2674  
    2626class PickElement(wx.Dialog):
    2727    '''Makes periodic table widget for picking element. Modes:
    28         oneOnly if True element symbols are provided, otherwise select isotope
    29         ifNone ?
     28        oneOnly if True element symbols are provided, otherwise select valence
     29        ifNone if True show None button
    3030        ifMag if True present magnetic scatters only
    3131        multiple if True multiple elements can be selected
     
    7272    def ElButton(self, name, pos, tip, color):
    7373        'Creates an element button widget'
     74        self.color = color
    7475        if not self.ifNone and name[0] == 'None':
    7576            return
     
    105106        self.Elem = El
    106107        if self.multiple:
    107             self.elementList.append(El)
    108             event.GetEventObject().SetBackgroundColour('black') # Shows on Mac
     108            if El in self.elementList:
     109                self.elementList.remove(El)
     110                event.GetEventObject().SetBackgroundColour(self.color) # Shows on Mac
     111            else:
     112                self.elementList.append(El)
     113                event.GetEventObject().SetBackgroundColour('black') # Shows on Mac
    109114            event.GetEventObject().SetColour(
    110115                wx.Colour(*[int(i/2) for i in event.GetEventObject().GetColour()]))
  • trunk/GSASIIgrid.py

    r2660 r2674  
    9999
    100100[ wxID_MASKCOPY, wxID_MASKSAVE, wxID_MASKLOAD, wxID_NEWMASKSPOT,wxID_NEWMASKARC,wxID_NEWMASKRING,
    101     wxID_NEWMASKFRAME, wxID_NEWMASKPOLY,wxID_MASKLOADNOT,wxID_FINDSPOTS,
    102 ] = [wx.NewId() for item in range(10)]
     101    wxID_NEWMASKFRAME, wxID_NEWMASKPOLY,wxID_MASKLOADNOT,wxID_FINDSPOTS,wxID_DELETESPOTS
     102] = [wx.NewId() for item in range(11)]
    103103
    104104[ wxID_STRSTACOPY, wxID_STRSTAFIT, wxID_STRSTASAVE, wxID_STRSTALOAD,wxID_STRSTSAMPLE,
     
    21212121        self.MaskEdit.Append(help='Auto search for spot masks; NB: will clear old spot masks',
    21222122            id=wxID_FINDSPOTS, kind=wx.ITEM_NORMAL,text='Auto spot masks')
     2123        self.MaskEdit.Append(help='Delete all spot masks',
     2124            id=wxID_DELETESPOTS, kind=wx.ITEM_NORMAL,text='Delete spot masks')       
    21232125        submenu.Append(help='Create an arc mask with mouse input',
    21242126            id=wxID_NEWMASKARC, kind=wx.ITEM_NORMAL,text='Arc mask')
  • trunk/GSASIIimgGUI.py

    r2673 r2674  
    13201320                G2frame.ErrorDialog('Auto spot search error',Error)
    13211321            wx.CallAfter(UpdateMasks,G2frame,data)
    1322             wx.CallAfter(G2plt.PlotExposedImage,G2frame,event=event)               
     1322            wx.CallAfter(G2plt.PlotExposedImage,G2frame,event=event)
     1323
     1324    def OnDeleteSpotMask(event):
     1325        data['Points'] = []
     1326        wx.CallAfter(UpdateMasks,G2frame,data)
     1327        wx.CallAfter(G2plt.PlotExposedImage,G2frame,event=event)         
    13231328           
    13241329    def ToggleSpotMaskMode(event):
     
    15131518    G2frame.dataFrame.Bind(wx.EVT_MENU, OnSaveMask, id=G2gd.wxID_MASKSAVE)
    15141519    G2frame.dataFrame.Bind(wx.EVT_MENU, OnAutoSpotMask, id=G2gd.wxID_FINDSPOTS)
     1520    G2frame.dataFrame.Bind(wx.EVT_MENU, OnDeleteSpotMask, id=G2gd.wxID_DELETESPOTS)
    15151521    G2frame.dataFrame.Bind(wx.EVT_MENU, ToggleSpotMaskMode, id=G2gd.wxID_NEWMASKSPOT)
    15161522    G2frame.dataFrame.Bind(wx.EVT_MENU, OnNewArcMask, id=G2gd.wxID_NEWMASKARC)
  • trunk/GSASIIpwdGUI.py

    r2673 r2674  
    49334933    def OnAddElement(event):
    49344934        ElList = data['ElList']
    4935         PE = G2elemGUI.PickElement(G2frame,oneOnly=True,multiple=True)
     4935        choice = ElList.keys()
     4936        PE = G2elemGUI.PickElements(G2frame,choice)
    49364937        if PE.ShowModal() == wx.ID_OK:
    4937             for El in PE.elementList:
    4938                 if El not in ElList and El != 'None':
     4938            for El in PE.Elem:
     4939                if El not in ElList:
    49394940                    try:
    49404941                        data['ElList'][El] = G2elem.GetElInfo(El,inst)
     
    52515252    noRing.SetValue(data['noRing'])
    52525253    noRing.Bind(wx.EVT_CHECKBOX, OnNoRing)
    5253     sqBox.Add(noRing,0)
     5254    sqBox.Add(noRing,0,WACV)
    52545255    mainSizer.Add(sqBox,0)
    52555256
     
    53265327        Source = G2frame.PatternTree.GetItemText(G2frame.PatternId)
    53275328        if len(TextList) == 1:
    5328             G2frame.ErrorDialog('Nothing to copy controls to','There must be more than one "PDF" pattern')
     5329            G2frame.ErrorDialog('Nothing to copy PDF peaks to','There must be more than one "PDF" pattern')
    53295330            return
    53305331        dlg = G2G.G2MultiChoiceDialog(G2frame,'Copy PDF peaks','Copy peaks from '+Source+' to:',TextList)
     
    53425343       
    53435344    def OnFitPDFpeaks(event):
     5345        PatternId = G2frame.PatternId
     5346        data = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'PDF Controls'))['G(R)']
     5347        peaks = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'PDF Peaks'))
     5348        if not peaks:
     5349            G2frame.ErrorDialog('No peaks!','Nothing to fit!')
     5350            return
     5351       
    53445352        print 'fit peaks'
    53455353       
Note: See TracChangeset for help on using the changeset viewer.