Ignore:
Timestamp:
Jul 9, 2018 5:01:20 PM (6 years ago)
Author:
krzywon
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
Children:
ac38ab4
Parents:
fc51d06
Message:

Expose NXcanSAS writer for saving 2D data.

File:
1 edited

Legend:

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

    reb6abab rb799f09  
    25672567        """ 
    25682568        default_name = fname 
    2569         wildcard = "IGOR/DAT 2D file in Q_map (*.dat)|*.DAT" 
     2569        wildcard = "IGOR/DAT 2D file in Q_map (*.dat)|*.DAT|"\ 
     2570                   "NXcanSAS files (*.h5)|*.h5|" 
    25702571        dlg = wx.FileDialog(self, "Choose a file", 
    25712572                            self._default_save_location, 
     
    25792580            if ext_num == 0: 
    25802581                ext_format = '.dat' 
     2582            elif ext_num == 1: 
     2583                ext_format = '.h5' 
    25812584            else: 
    25822585                ext_format = '' 
     
    25862589            # Instantiate a loader 
    25872590            loader = Loader() 
    2588  
    2589             ext_format = ".dat" 
    2590             if os.path.splitext(mypath)[1].lower() == ext_format: 
     2591            if os.path.splitext(mypath)[1].lower() == '.dat': 
    25912592                # Make sure the ext included in the file name 
    25922593                # especially on MAC 
    25932594                fileName = os.path.splitext(path)[0] + ext_format 
    25942595                loader.save(fileName, data, ext_format) 
     2596            elif os.path.splitext(mypath)[1].lower() == '.h5': 
     2597                # Make sure the ext included in the file name 
     2598                # especially on MAC 
     2599                fileName = os.path.splitext(path)[0] + ext_format 
     2600                nxcansaswriter = NXcanSASWriter() 
     2601                nxcansaswriter.write([data], fileName) 
    25952602            try: 
    25962603                self._default_save_location = os.path.dirname(path) 
Note: See TracChangeset for help on using the changeset viewer.