Ignore:
Timestamp:
Aug 9, 2017 9:37:03 AM (5 years ago)
Author:
toby
Message:

fix Linux bug, binding triggers on widget delete, minor fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branch/2frame/GSASIIddataGUI.py

    r2931 r2976  
    769769       
    770770    def OnSelect(event):
    771         G2frame.hist = G2frame.dataWindow.HistsInPhase[select.GetSelection()]
     771        G2frame.hist = G2frame.dataWindow.HistsInPhase[DData.select.GetSelection()]
    772772        oldFocus = wx.Window.FindFocus()
    773773        G2plt.PlotSizeStrainPO(G2frame,data,G2frame.hist)
    774774        wx.CallLater(100,RepaintHistogramInfo)
    775         wx.CallAfter(oldFocus.SetFocus)
     775        if oldFocus: wx.CallAfter(oldFocus.SetFocus)
    776776       
    777777    def RepaintHistogramInfo(Scroll=0):
     
    983983   
    984984    if DData.GetSizer():
     985        DData.select.Unbind(wx.EVT_LISTBOX)  # remove binding to avoid event on Linux
    985986        DData.GetSizer().Clear(True)
    986987    mainSizer = wx.BoxSizer(wx.VERTICAL)
     
    988989    if G2frame.hist:
    989990        topSizer = wx.FlexGridSizer(1,2,5,5)
    990         select = wx.ListBox(DData,choices=G2frame.dataWindow.HistsInPhase,
     991        DData.select = wx.ListBox(DData,choices=G2frame.dataWindow.HistsInPhase,
    991992                            style=wx.LB_SINGLE,size=(-1,120))
    992         select.SetSelection(G2frame.dataWindow.HistsInPhase.index(G2frame.hist))
    993         select.SetFirstItem(G2frame.dataWindow.HistsInPhase.index(G2frame.hist))
    994         select.Bind(wx.EVT_LISTBOX,OnSelect)
    995         topSizer.Add(select,0,WACV|wx.LEFT,5)
     993        DData.select.SetSelection(G2frame.dataWindow.HistsInPhase.index(G2frame.hist))
     994        DData.select.SetFirstItem(G2frame.dataWindow.HistsInPhase.index(G2frame.hist))
     995        DData.select.Bind(wx.EVT_LISTBOX,OnSelect)
     996        topSizer.Add(DData.select,0,WACV|wx.LEFT,5)
    996997        if any(['PWDR' in item for item in keyList]):
    997998            topSizer.Add(PlotSizer())
Note: See TracChangeset for help on using the changeset viewer.