Ignore:
Timestamp:
Sep 16, 2014 2:28:31 PM (7 years ago)
Author:
toby
Message:

logging more complete

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branch/logging/GSASIIgrid.py

    r1477 r1497  
    152152    wxID_PDFCOMPUTE, wxID_PDFCOMPUTEALL, wxID_PDFADDELEMENT, wxID_PDFDELELEMENT,
    153153] = [wx.NewId() for item in range(7)]
     154
     155[ wxID_MCRON,wxID_MCRLIST,wxID_MCRSAVE,wxID_MCRPLAY,
     156] = [wx.NewId() for item in range(4)]
    154157
    155158VERY_LIGHT_GREY = wx.Colour(235,235,235)
     
    26622665    where the functions to be called are defined.
    26632666    '''
    2664     def Bind(self,*args,**kwargs):
     2667    def Bind(self,eventtype,handler,*args,**kwargs):
    26652668        '''Override the Bind() function: on the Mac the binding is to
    26662669        the main window, so that menus operate with any window on top.
    2667         For other platforms, call the default wx.Frame Bind()
     2670        For other platforms, either wrap calls that will be logged
     2671        or call the default wx.Frame Bind() to bind to the menu item directly.
    26682672        '''
    26692673        if sys.platform == "darwin": # mac
    2670             self.G2frame.Bind(*args,**kwargs)
    2671         else:
    2672             wx.Frame.Bind(self,*args,**kwargs)     
     2674            self.G2frame.Bind(eventtype,handler,*args,**kwargs)
     2675            return
     2676        #print 'DataFrame Bind',eventtype,handler
     2677        if eventtype == wx.EVT_MENU and 'id' in kwargs:
     2678            menulabels = log.SaveMenuCommand(kwargs['id'],self.G2frame,handler)
     2679            if menulabels:
     2680                #print 'intercepting bind for',handler,menulabels,kwargs['id']
     2681                wx.Frame.Bind(self,eventtype,self.G2frame.MenuBinding,*args,**kwargs)
     2682                return
     2683            wx.Frame.Bind(self,eventtype,handler,*args,**kwargs)     
    26732684       
    26742685    def PrefillDataMenu(self,menu,helpType,helpLbl=None,empty=False):
     
    26782689        '''
    26792690        self.datamenu = menu
     2691        self.G2frame.dataMenuBars.append(menu)
    26802692        self.helpType = helpType
    26812693        self.helpLbl = helpLbl
     
    34153427                                    wx.aui.AUI_NB_SCROLL_BUTTONS)
    34163428        if size: self.SetSize(size)
     3429        self.parent = parent
     3430        self.PageChangeHandler = None
     3431        # Note, if needed create a Logging event to paint the window with the initial tab setting here
     3432
     3433    def PageChangeEvent(self,event):
     3434        import log
     3435        G2frame = self.parent.G2frame
     3436        page = event.GetSelection()
     3437        if self.PageChangeHandler:
     3438            if log.LogInfo['Logging']:
     3439                log.G2logList.append(log.TabLogEntry(
     3440                    G2frame.dataFrame.GetTitle(),
     3441                    G2frame.dataDisplay.GetPageText(page)
     3442                ))
     3443            self.PageChangeHandler(event)
     3444           
     3445    def Bind(self,eventtype,handler,*args,**kwargs):
     3446        '''Override the Bind() function so that page change events can be trapped
     3447        '''
     3448        if eventtype == wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED:
     3449            self.PageChangeHandler = handler
     3450            wx.aui.AuiNotebook.Bind(self,eventtype,self.PageChangeEvent)
     3451            return
     3452        wx.aui.AuiNotebook.Bind(self,eventtype,handler,*args,**kwargs)
     3453
     3454           
    34173455                                                     
    34183456    def Clear(self):       
Note: See TracChangeset for help on using the changeset viewer.