Changeset 1124


Ignore:
Timestamp:
Oct 25, 2013 3:19:10 PM (8 years ago)
Author:
toby
Message:

add a new mask menu command; change the dataframe status when in new mask adding modes

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIgrid.py

    r1117 r1124  
    9595
    9696[ wxID_MASKCOPY, wxID_MASKSAVE, wxID_MASKLOAD,
    97 ] = [wx.NewId() for item in range(3)]
     97  wxID_NEWMASKFRAME, wxID_NEWMASKPOLY,
     98] = [wx.NewId() for item in range(5)]
     99
    98100
    99101[ wxID_STRSTACOPY, wxID_STRSTAFIT, wxID_STRSTASAVE, wxID_STRSTALOAD,wxID_APPENDDZERO,
     
    21792181        self.MaskEdit = wx.Menu(title='')
    21802182        self.MaskMenu.Append(menu=self.MaskEdit, title='Operations')
     2183        submenu = wx.Menu()
     2184        self.MaskEdit.AppendMenu(
     2185            wx.ID_ANY,'Create new', submenu,
     2186            help=''
     2187            )
    21812188        self.MaskEdit.Append(help='Copy mask to other images',
    21822189            id=wxID_MASKCOPY, kind=wx.ITEM_NORMAL,text='Copy mask')
     
    21852192        self.MaskEdit.Append(help='Load mask from file',
    21862193            id=wxID_MASKLOAD, kind=wx.ITEM_NORMAL,text='Load mask')
     2194        submenu.Append(help='Create a Frame mask with mouse input',
     2195            id=wxID_NEWMASKFRAME, kind=wx.ITEM_NORMAL,text='Frame mask')
     2196        submenu.Append(help='Create a polygon mask with mouse input',
     2197            id=wxID_NEWMASKPOLY, kind=wx.ITEM_NORMAL,text='Polygon mask')
    21872198        self.PostfillDataMenu()
    21882199           
  • trunk/GSASIIimgGUI.py

    r1121 r1124  
    990990        finally:
    991991            dlg.Destroy()
     992    def OnNewFrameMask(event):
     993        'Start a new Frame mask'
     994        G2plt.OnStartMask(G2frame,'f')
     995    def OnNewPolyMask(event):
     996        'Start a new polygon mask'
     997        G2plt.OnStartMask(G2frame,'p')
    992998       
    993999    if G2frame.dataDisplay:
     
    9961002    G2frame.dataFrame.Bind(wx.EVT_MENU, OnCopyMask, id=G2gd.wxID_MASKCOPY)
    9971003    G2frame.dataFrame.Bind(wx.EVT_MENU, OnLoadMask, id=G2gd.wxID_MASKLOAD)
    998     G2frame.dataFrame.Bind(wx.EVT_MENU, OnSaveMask, id=G2gd.wxID_MASKSAVE)   
     1004    G2frame.dataFrame.Bind(wx.EVT_MENU, OnSaveMask, id=G2gd.wxID_MASKSAVE)
     1005    G2frame.dataFrame.Bind(wx.EVT_MENU, OnNewFrameMask, id=G2gd.wxID_NEWMASKFRAME)
     1006    G2frame.dataFrame.Bind(wx.EVT_MENU, OnNewPolyMask, id=G2gd.wxID_NEWMASKPOLY)
    9991007    if not G2frame.dataFrame.GetStatusBar():
    10001008        Status = G2frame.dataFrame.CreateStatusBar()
    1001         Status.SetStatusText("To add mask: On 2D Powder Image, key a:arc, r:ring, s:spot, p:polygon, f:frame")
     1009    if G2frame.setFrame:
     1010        G2frame.dataFrame.GetStatusBar().SetStatusText("Adding frame mask")
     1011    elif G2frame.setPoly:
     1012        G2frame.dataFrame.GetStatusBar().SetStatusText("Adding polygon mask")
     1013    else:
     1014        G2frame.dataFrame.GetStatusBar().SetStatusText("To add mask: On 2D Powder Image, key a:arc, r:ring, s:spot, p:polygon, f:frame")
    10021015    G2frame.dataDisplay = wx.Panel(G2frame.dataFrame)
    10031016    mainSizer = wx.BoxSizer(wx.VERTICAL)
  • trunk/GSASIIplot.py

    r1121 r1124  
    20832083        PlotIntegration(G2frame,newPlot,event)
    20842084
     2085def OnStartMask(G2frame,eventkey):
     2086    '''Initiate the start of a Frame or Polygon map
     2087
     2088    :param wx.Frame G2frame: The main GSAS-II tree "window"
     2089    :param str eventkey: a single letter ('f' or 'p') that
     2090      determines what type of mask is created.   
     2091    '''
     2092    Masks = G2frame.PatternTree.GetItemPyData(
     2093        G2gd.GetPatternTreeItemId(G2frame,G2frame.Image, 'Masks'))
     2094    if eventkey == 'f':
     2095        G2frame.setFrame = True
     2096        Masks['Frames'] = []
     2097        G2frame.G2plotNB.status.SetFields(['','Frame mask active - LB pick next point, RB close polygon'])
     2098    elif eventkey == 'p':
     2099        G2frame.setPoly = True
     2100        Masks['Polygons'].append([])
     2101        G2frame.G2plotNB.status.SetFields(['','Polygon mask active - LB pick next point, RB close polygon'])
     2102    G2imG.UpdateMasks(G2frame,Masks)
     2103    PlotImage(G2frame,newImage=True)
     2104
    20852105def PlotImage(G2frame,newPlot=False,event=None,newImage=True):
    20862106    '''Plot of 2D detector images as contoured plot. Also plot calibration ellipses,
     
    21592179                Masks['Arcs'].append([tth,[azm-5,azm+5],0.1])
    21602180            elif event.key == 'p':
    2161                 G2frame.setPoly = True
    2162                 Masks['Polygons'].append([])
    2163                 G2frame.G2plotNB.status.SetFields(['','Polygon mask active - LB pick next point, RB close polygon'])
     2181                OnStartMask(G2frame,event.key)
     2182                #G2frame.setPoly = True
     2183                #Masks['Polygons'].append([])
     2184                #G2frame.G2plotNB.status.SetFields(['','Polygon mask active - LB pick next point, RB close polygon'])
    21642185            elif event.key == 'f':
    2165                 G2frame.setFrame = True
    2166                 Masks['Frames'] = []
    2167                 G2frame.G2plotNB.status.SetFields(['','Frame mask active - LB pick next point, RB close polygon'])
     2186                OnStartMask(G2frame,event.key)
     2187                #G2frame.setFrame = True
     2188                #Masks['Frames'] = []
     2189                #G2frame.G2plotNB.status.SetFields(['','Frame mask active - LB pick next point, RB close polygon'])
    21682190            G2imG.UpdateMasks(G2frame,Masks)
    21692191        elif PickName == 'Image Controls':
Note: See TracChangeset for help on using the changeset viewer.