Changeset eb6abab in sasview
- Timestamp:
- Jul 6, 2018 2:08:48 PM (6 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
- Children:
- cf820f5
- Parents:
- 8f882fe
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/gui_manager.py
rb963b20 reb6abab 46 46 from sas.sasgui.guiframe.CategoryManager import CategoryManager 47 47 from sas.sascalc.dataloader.loader import Loader 48 from sas.sascalc.file_converter.nxcansas_writer import NXcanSASWriter 48 49 from sas.sasgui.guiframe.proxy import Connection 49 50 … … 2422 2423 default_name = fname 2423 2424 wildcard = "Text files (*.txt)|*.txt|"\ 2424 "CanSAS 1D files(*.xml)|*.xml" 2425 path = None 2425 "CanSAS 1D files (*.xml)|*.xml|"\ 2426 "NXcanSAS files (*.h5)|*.h5|" 2427 options = {0: ".txt", 2428 1: ".xml", 2429 2: ".h5"} 2426 2430 dlg = wx.FileDialog(self, "Choose a file", 2427 2431 self._default_save_location, … … 2433 2437 # This is MAC Fix 2434 2438 ext_num = dlg.GetFilterIndex() 2435 if ext_num == 0: 2436 ext_format = '.txt' 2437 else: 2438 ext_format = '.xml' 2439 2440 ext_format = options[ext_num] 2439 2441 path = os.path.splitext(path)[0] + ext_format 2440 2442 mypath = os.path.basename(path) 2441 2442 # Instantiate a loader 2443 loader = Loader() 2444 ext_format = ".txt" 2445 if os.path.splitext(mypath)[1].lower() == ext_format: 2443 fName = os.path.splitext(path)[0] + ext_format 2444 2445 if os.path.splitext(mypath)[1].lower() == options[0]: 2446 2446 # Make sure the ext included in the file name 2447 2447 # especially on MAC 2448 fName = os.path.splitext(path)[0] + ext_format2449 2448 self._onsaveTXT(data, fName) 2450 ext_format = ".xml" 2451 if os.path.splitext(mypath)[1].lower() == ext_format: 2449 elif os.path.splitext(mypath)[1].lower() == options[1]: 2452 2450 # Make sure the ext included in the file name 2453 2451 # especially on MAC 2454 fName = os.path.splitext(path)[0] + ext_format 2452 # Instantiate a loader 2453 loader = Loader() 2455 2454 loader.save(fName, data, ext_format) 2455 elif os.path.splitext(mypath)[1].lower() == options[2]: 2456 nxcansaswriter = NXcanSASWriter() 2457 nxcansaswriter.write([data], fName) 2456 2458 try: 2457 2459 self._default_save_location = os.path.dirname(path)
Note: See TracChangeset
for help on using the changeset viewer.