Changeset 1033


Ignore:
Timestamp:
Aug 14, 2013 10:04:48 PM (8 years ago)
Author:
toby
Message:

Fix Select tab menu buttons by getting unused Id values

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIgrid.py

    r1030 r1033  
    19381938        # Phase / Draw Options tab
    19391939        self.DataDrawOptions = wx.MenuBar()
    1940         self.PrefillDataMenu(self.DataDrawOptions,helpType='Draw Options', helpLbl='Phase/Draw Options',empty=True)
     1940        self.PrefillDataMenu(self.DataDrawOptions,helpType='Draw Options', helpLbl='Phase/Draw Options')
    19411941        self.DataDrawOptions.Append(menu=wx.Menu(title=''),title='Select tab')
    1942         self.PostfillDataMenu(empty=True)
     1942        self.PostfillDataMenu()
    19431943       
    19441944        # Phase / Draw Atoms tab
  • trunk/GSASIIphsGUI.py

    r1028 r1033  
    49524952
    49534953    def FillSelectPageMenu(menuBar):
     4954        '''Assign bindings to the menu buttons to switch between phase tabs;
     4955        define a dictionary with the page index for each tab
     4956        '''
     4957        def OnSelectPage(event):
     4958            'Called when an item is selected from the Select page menu'
     4959            page = Pagedict.get(event.GetId())
     4960            if page is not None: G2frame.dataDisplay.SetSelection(page)
    49544961        mid = menuBar.FindMenu('Select tab')
     4962        Pagedict = {}
    49554963        for ipage,page in enumerate(Pages):
    49564964            menu = menuBar.GetMenu(mid)
    49574965            if menu.FindItem(page) < 0:
    4958                 menu.Append(id=ipage,kind=wx.ITEM_NORMAL,text=page)
    4959                 G2frame.Bind(wx.EVT_MENU, OnSelectPage, id=ipage)
    4960 
    4961     def OnSelectPage(event):
    4962         '''This is called when an item is selected from the Select page menu
    4963         '''
    4964         page = event.GetId()
    4965         G2frame.dataDisplay.SetSelection(page)
     4966                Id = wx.NewId()
     4967                menu.Append(id=Id,kind=wx.ITEM_NORMAL,text=page)
     4968                G2frame.Bind(wx.EVT_MENU, OnSelectPage, id=Id)
     4969                Pagedict[Id] = ipage
     4970
    49664971       
    49674972    def OnPageChanged(event):
Note: See TracChangeset for help on using the changeset viewer.