Changeset 2586


Ignore:
Timestamp:
Dec 15, 2016 10:46:47 PM (5 years ago)
Author:
toby
Message:

Add blank hist. for PDF; fix spinbox to step w/.01 on mac; trap unicode in imported file headers

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r2582 r2586  
    327327        'confirm we have the right file'
    328328        rdmsg = 'File '+ filename +' begins:\n\n'
    329         rdmsg += fp.read(80)
    330         rdmsg += '\n\nDo you want to read this file?'
    331         if not all([ord(c) < 128 and ord(c) != 0 for c in rdmsg]): # show only if ASCII
     329        try:
     330            rdmsg += fp.read(80)
     331            rdmsg += '\n\nDo you want to read this file?'
     332        except UnicodeDecodeError:
     333            rdmsg = None
     334        if rdmsg is None or not all([ord(c) < 128 and ord(c) != 0 for c in rdmsg]): # show only if ASCII
    332335            rdmsg = 'File '+ filename +' is a binary file. Do you want to read this file?'
    333336        # it would be better to use something that
  • trunk/GSASIIpwdGUI.py

    r2582 r2586  
    46154615            Obj.SetValue(fmt%(value))
    46164616            data[fileKey][itemKey] = value
    4617             UpdatePDFGrid(G2frame,data)
     4617            wx.CallAfter(UpdatePDFGrid,G2frame,data)
    46184618           
    46194619        def OnMoveMult(event):
    4620             data[key]['Mult'] += multSpin.GetValue()*0.01
     4620            data[key]['Mult'] = multSpin.GetValue()*0.01
    46214621            mult.SetValue(data[key]['Mult'])
    46224622            wx.CallAfter(OnComputePDF,None)
     
    46244624        def AfterChange(invalid,value,tc):
    46254625            if invalid: return
     4626            multSpin.SetValue(int(0.5 + data[key]['Mult']*100))
    46264627            wx.CallAfter(OnComputePDF,None)
    46274628       
    46284629        item = data[key]
    4629         fileList = GetFileList('PWDR')
     4630        fileList = [''] + GetFileList('PWDR')
    46304631        fileSizer.Add(wx.StaticText(parent=G2frame.dataDisplay,label=' '+key+' file:'),0,WACV)
    46314632        fileName = wx.ComboBox(G2frame.dataDisplay,value=item['Name'],choices=fileList,
     
    46404641        mulBox.Add(mult,0,)
    46414642        multSpin = wx.SpinButton(G2frame.dataDisplay,style=wx.SP_VERTICAL,size=wx.Size(20,20))
    4642         multSpin.SetValue(0)
    4643         multSpin.SetRange(-1,1)
     4643        multSpin.SetRange(-100,100)
     4644        multSpin.SetValue(int(data[key]['Mult']*100))
    46444645        multSpin.Bind(wx.EVT_SPIN, OnMoveMult)
    46454646        mulBox.Add(multSpin,0,WACV)
     
    46774678    def OnGeometry(event):
    46784679        data['Geometry'] = geometry.GetValue()
    4679         UpdatePDFGrid(G2frame,data)
     4680        wx.CallAfter(UpdatePDFGrid,G2frame,data)
     4681        #UpdatePDFGrid(G2frame,data)
    46804682        wx.CallAfter(OnComputePDF,None)
    46814683       
    46824684    def OnDetType(event):
    46834685        data['DetType'] = detType.GetValue()
    4684         UpdatePDFGrid(G2frame,data)
     4686        wx.CallAfter(UpdatePDFGrid,G2frame,data)
     4687        #UpdatePDFGrid(G2frame,data)
    46854688        wx.CallAfter(OnComputePDF,None)
    46864689       
     
    48024805            dlg.Destroy()
    48034806        OnComputePDF(event)               
    4804         UpdatePDFGrid(G2frame,data)
     4807        wx.CallAfter(UpdatePDFGrid,G2frame,data)
     4808        #UpdatePDFGrid(G2frame,data)
    48054809       
    48064810    def OnAddElement(event):
     
    48134817            data['Form Vol'] = max(10.0,SumElementVolumes())
    48144818        PE.Destroy()
    4815         UpdatePDFGrid(G2frame,data)
     4819        wx.CallAfter(UpdatePDFGrid,G2frame,data)
     4820        #UpdatePDFGrid(G2frame,data)
    48164821       
    48174822    def OnDeleteElement(event):
     
    48224827            del ElList[dlg.GetDeleteElement()]
    48234828        dlg.Destroy()
    4824         UpdatePDFGrid(G2frame,data)
     4829        wx.CallAfter(UpdatePDFGrid,G2frame,data)
     4830        #UpdatePDFGrid(G2frame,data)
    48254831               
    48264832    def ComputePDF(Data):
Note: See TracChangeset for help on using the changeset viewer.