Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/gui_manager.py

    r9220e89c r8ac05a5  
    4646from sas.sasgui.guiframe.CategoryManager import CategoryManager 
    4747from sas.sascalc.dataloader.loader import Loader 
    48 from sas.sascalc.file_converter.nxcansas_writer import NXcanSASWriter 
    4948from sas.sasgui.guiframe.proxy import Connection 
    5049 
     
    24202419        default_name = fname 
    24212420        wildcard = "Text files (*.txt)|*.txt|"\ 
    2422                     "CanSAS 1D files (*.xml)|*.xml|"\ 
    2423                      "NXcanSAS files (*.h5)|*.h5|" 
    2424         options = [".txt", ".xml",".h5"] 
     2421                    "CanSAS 1D files(*.xml)|*.xml" 
     2422        path = None 
    24252423        dlg = wx.FileDialog(self, "Choose a file", 
    24262424                            self._default_save_location, 
     
    24322430            # This is MAC Fix 
    24332431            ext_num = dlg.GetFilterIndex() 
    2434  
    2435             ext_format = options[ext_num] 
     2432            if ext_num == 0: 
     2433                ext_format = '.txt' 
     2434            else: 
     2435                ext_format = '.xml' 
    24362436            path = os.path.splitext(path)[0] + ext_format 
    24372437            mypath = os.path.basename(path) 
    2438             fName = os.path.splitext(path)[0] + ext_format 
    2439  
    2440             if os.path.splitext(mypath)[1].lower() == options[0]: 
     2438 
     2439            # Instantiate a loader 
     2440            loader = Loader() 
     2441            ext_format = ".txt" 
     2442            if os.path.splitext(mypath)[1].lower() == ext_format: 
    24412443                # Make sure the ext included in the file name 
    24422444                # especially on MAC 
     2445                fName = os.path.splitext(path)[0] + ext_format 
    24432446                self._onsaveTXT(data, fName) 
    2444             elif os.path.splitext(mypath)[1].lower() == options[1]: 
     2447            ext_format = ".xml" 
     2448            if os.path.splitext(mypath)[1].lower() == ext_format: 
    24452449                # Make sure the ext included in the file name 
    24462450                # especially on MAC 
    2447                 # Instantiate a loader 
    2448                 loader = Loader() 
     2451                fName = os.path.splitext(path)[0] + ext_format 
    24492452                loader.save(fName, data, ext_format) 
    2450             elif os.path.splitext(mypath)[1].lower() == options[2]: 
    2451                 nxcansaswriter = NXcanSASWriter() 
    2452                 nxcansaswriter.write([data], fName) 
    24532453            try: 
    24542454                self._default_save_location = os.path.dirname(path) 
     
    24772477            if has_errors: 
    24782478                if data.dx is not None and data.dx != []: 
    2479                     out.write("<X>\t<Y>\t<dY>\t<dX>\n") 
     2479                    out.write("<X>   <Y>   <dY>   <dX>\n") 
    24802480                else: 
    2481                     out.write("<X>\t<Y>\t<dY>\n") 
     2481                    out.write("<X>   <Y>   <dY>\n") 
    24822482            else: 
    2483                 out.write("<X>\t<Y>\n") 
     2483                out.write("<X>   <Y>\n") 
    24842484 
    24852485            for i in range(len(data.x)): 
     
    25252525            text += 'dY_min = %s:  dY_max = %s\n' % (min(data.dy), max(data.dy)) 
    25262526        text += '\nData Points:\n' 
    2527         text += "<index> \t<X> \t<Y> \t<dY> " 
    2528         text += "\t<dXl> \t<dXw>\n" if(data.dxl is not None and 
    2529                                        data.dxw is not None) else "\t<dX>\n" 
     2527        x_st = "X" 
    25302528        for index in range(len(data.x)): 
    25312529            if data.dy is not None and len(data.dy) > index: 
     
    25382536                dx_val = 0.0 
    25392537            if data.dxl is not None and len(data.dxl) > index: 
     2538                if index == 0: 
     2539                    x_st = "Xl" 
    25402540                dx_val = data.dxl[index] 
    2541                 if data.dxw is not None and len(data.dxw) > index: 
    2542                     dx_val = "%s \t%s" % (data.dxl[index], data.dxw[index]) 
    2543  
     2541            elif data.dxw is not None and len(data.dxw) > index: 
     2542                if index == 0: 
     2543                    x_st = "Xw" 
     2544                dx_val = data.dxw[index] 
     2545 
     2546            if index == 0: 
     2547                text += "<index> \t<X> \t<Y> \t<dY> \t<d%s>\n" % x_st 
    25442548            text += "%s \t%s \t%s \t%s \t%s\n" % (index, 
    25452549                                                  data.x[index], 
     
    25582562        """ 
    25592563        default_name = fname 
    2560         wildcard = "IGOR/DAT 2D file in Q_map (*.dat)|*.DAT|"\ 
    2561                    "NXcanSAS files (*.h5)|*.h5|" 
     2564        wildcard = "IGOR/DAT 2D file in Q_map (*.dat)|*.DAT" 
    25622565        dlg = wx.FileDialog(self, "Choose a file", 
    25632566                            self._default_save_location, 
     
    25712574            if ext_num == 0: 
    25722575                ext_format = '.dat' 
    2573             elif ext_num == 1: 
    2574                 ext_format = '.h5' 
    25752576            else: 
    25762577                ext_format = '' 
     
    25802581            # Instantiate a loader 
    25812582            loader = Loader() 
    2582             ext = os.path.splitext(mypath)[1].lower() 
    2583             if ext == '.dat': 
     2583 
     2584            ext_format = ".dat" 
     2585            if os.path.splitext(mypath)[1].lower() == ext_format: 
    25842586                # Make sure the ext included in the file name 
    25852587                # especially on MAC 
    25862588                fileName = os.path.splitext(path)[0] + ext_format 
    25872589                loader.save(fileName, data, ext_format) 
    2588             elif ext == '.h5': 
    2589                 # Make sure the ext included in the file name 
    2590                 # especially on MAC 
    2591                 fileName = os.path.splitext(path)[0] + ext_format 
    2592                 nxcansaswriter = NXcanSASWriter() 
    2593                 nxcansaswriter.write([data], fileName) 
    25942590            try: 
    25952591                self._default_save_location = os.path.dirname(path) 
Note: See TracChangeset for help on using the changeset viewer.