Changeset 473


Ignore:
Timestamp:
Feb 7, 2012 12:54:11 PM (12 years ago)
Author:
vondreele
Message:

Add FileDlgFixExt? to fix linux problem in FileDialog? where the extension is not taken from the wildcard choice.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r470 r473  
    9090] = [wx.NewId() for _init_coll_Export_Items in range(7)]
    9191
     92def FileDlgFixExt(dlg,file):            #this is needed to fix a problem in linux wx.FileDialog
     93    ext = dlg.GetWildcard().split('|')[2*dlg.GetFilterIndex()+1].strip('*')
     94    if ext not in file:
     95        file += ext
     96    return file
     97   
    9298class GSASII(wx.Frame):
    9399   
     
    10401046                        if dlg.ShowModal() == wx.ID_OK:
    10411047                            newimagefile = dlg.GetPath()
     1048                            newimagefile = FileDlgFixExt(dlg,newimagefile)
    10421049                            G2IO.PutG2Image(newimagefile,Comments,Data,Npix,newImage)
    10431050                            Imax = np.amax(newImage)
     
    12521259                if dlg.ShowModal() == wx.ID_OK:
    12531260                    self.GSASprojectfile = dlg.GetPath()
     1261                    self.GSASprojectfile = FileDlgFixExt(dlg,self.GSASprojectfile)
    12541262                    self.dirname = dlg.GetDirectory()
    12551263                    G2IO.ProjFileOpen(self)
     
    13081316            if dlg.ShowModal() == wx.ID_OK:
    13091317                self.GSASprojectfile = dlg.GetPath()
     1318                self.GSASprojectfile = FileDlgFixExt(dlg,self.GSASprojectfile)
    13101319                self.PatternTree.SetItemText(self.root,'Loaded Data: '+self.GSASprojectfile)
    13111320                G2IO.ProjFileSave(self)
     
    15421551                if dlg.ShowModal() == wx.ID_OK:
    15431552                    powderfile = dlg.GetPath()
     1553                    powderfile = FileDlgFixExt(dlg,powderfile)
    15441554                    if 'fxye' in powderfile:
    15451555                        G2IO.powderFxyeSave(self,exports,powderfile)
     
    15551565            if dlg.ShowModal() == wx.ID_OK:
    15561566                self.peaklistfile = dlg.GetPath()
     1567                self.peaklistfile = FileDlgFixExt(dlg,self.peaklistfile)
    15571568                file = open(self.peaklistfile,'w')               
    15581569                item, cookie = self.PatternTree.GetFirstChild(self.root)
  • trunk/GSASIIIO.py

    r469 r473  
    11311131    outfile.close()
    11321132    print 'GPX file save successful'
    1133    
    1134                    
     1133                       
    11351134def GetPWDRdata(GPXfile,PWDRname):
    11361135    ''' Returns powder data from GSASII gpx file
  • trunk/scanCCD.py

    r451 r473  
    2727] = [wx.NewId() for _init_coll_File_Items in range(4)]
    2828
     29def FileDlgFixExt(dlg,file):            #this is needed to fix a problem in linux wx.FileDialog
     30    ext = dlg.GetWildcard().split('|')[2*dlg.GetFilterIndex()+1].strip('*')
     31    if ext not in file:
     32        file += ext
     33    return file
     34   
    2935class scanCCD(wx.Frame):
    3036
     
    265271        try:
    266272            if dlg.ShowModal() == wx.ID_OK:
     273                print dlg.GetFilename()
    267274                powderfile = dlg.GetPath()
    268275                if 'fxye' in powderfile:
Note: See TracChangeset for help on using the changeset viewer.