Changeset 2656 for trunk/GSASIIgrid.py


Ignore:
Timestamp:
Jan 22, 2017 4:27:37 PM (5 years ago)
Author:
toby
Message:

Way cleaner approach to grid pointer; handles multiple grids in a frame, too.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIgrid.py

    r2655 r2656  
    44284428    if G2frame.dataFrame:
    44294429        # save or finish processing of outstanding events
    4430         if G2frame.dataFrame.currentGrid:  # complete any open wx.Grid edits
    4431             if G2frame.dataFrame.currentGrid.IsCellEditControlEnabled(): # complete any grid edits in progress
    4432                 if GSASIIpath.GetConfigValue('debug'): print 'Completing grid edit in',G2frame.dataFrame.currentGrid
    4433                 G2frame.dataFrame.currentGrid.HideCellEditControl()
    4434                 G2frame.dataFrame.currentGrid.DisableCellEditControl()
     4430        for grid in G2frame.dataFrame.currentGrids:  # complete any open wx.Grid edits
     4431            if grid.IsCellEditControlEnabled(): # complete any grid edits in progress
     4432                if GSASIIpath.GetConfigValue('debug'): print 'Completing grid edit in',grid
     4433                grid.HideCellEditControl()
     4434                grid.DisableCellEditControl()
    44354435        if G2frame.dataFrame.GetLabel() == 'Comments': # save any recently entered comments
    44364436            try:
     
    44614461    SetDataMenuBar(G2frame)
    44624462    G2frame.dataFrame.Raise()           
    4463     G2frame.dataFrame.currentGrid = None # this will be a pointer to a grid placed in the frame
     4463    G2frame.dataFrame.currentGrids = [] # this will contain pointers to a grid placed in the frame
    44644464    G2frame.PickId = item
    44654465    G2frame.PickIdText = None
Note: See TracChangeset for help on using the changeset viewer.