Changes in src/sas/qtgui/Utilities/GuiUtils.py [10786bc2:4333edf] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Utilities/GuiUtils.py
r10786bc2 r4333edf 12 12 import urllib.parse 13 13 import json 14 import types 14 15 from io import BytesIO 15 16 … … 44 45 45 46 from sas.sascalc.dataloader.loader import Loader 47 from sas.sascalc.file_converter.nxcansas_writer import NXcanSASWriter 48 46 49 from sas.qtgui.Utilities import CustomDir 47 50 … … 793 796 794 797 wildcard = "Text files (*.txt);;"\ 795 "CanSAS 1D files(*.xml)" 798 "CanSAS 1D files(*.xml);;"\ 799 "NXcanSAS files (*.h5)" 796 800 kwargs = { 797 801 'caption' : 'Save As', … … 812 816 if os.path.splitext(filename)[1].lower() == ".txt": 813 817 onTXTSave(data, filename) 814 if os.path.splitext(filename)[1].lower() == ".xml":818 elif os.path.splitext(filename)[1].lower() == ".xml": 815 819 loader.save(filename, data, ".xml") 820 elif os.path.splitext(filename)[1].lower() == ".h5": 821 nxcansaswriter = NXcanSASWriter() 822 nxcansaswriter.write([data], filename) 816 823 817 824 def saveData2D(data): … … 824 831 default_name += "_out" + ext_format 825 832 826 wildcard = "IGOR/DAT 2D file in Q_map (*.dat)" 833 wildcard = "IGOR/DAT 2D file in Q_map (*.dat);;"\ 834 "NXcanSAS files (*.h5)" 827 835 kwargs = { 828 836 'caption' : 'Save As', … … 844 852 if os.path.splitext(filename)[1].lower() == ext_format: 845 853 loader.save(filename, data, ext_format) 854 elif os.path.splitext(filename)[1].lower() == ".h5": 855 nxcansaswriter = NXcanSASWriter() 856 nxcansaswriter.write([data], filename) 857 846 858 847 859 class FormulaValidator(QtGui.QValidator): … … 1211 1223 return add_type(content, type(o)) 1212 1224 1225 if isinstance(o, types.FunctionType): 1226 # we have a pure function 1227 content = o.__dict__.copy() 1228 return add_type(content, type(o)) 1229 1213 1230 # not supported 1214 1231 logging.info("data cannot be serialized to json: %s" % type(o)) … … 1223 1240 ''' 1224 1241 supported = [ 1225 tuple, set, 1242 tuple, set, types.FunctionType, 1226 1243 Sample, Source, Vector, 1227 1244 Plottable, Data1D, Data2D, PlottableTheory1D, PlottableFit1D, Text, Chisq, View, … … 1278 1295 buffer.seek(0) 1279 1296 return np.load(buffer) 1297 1298 # function 1299 if cls == types.FunctionType: 1300 return cls 1280 1301 1281 1302 logging.info('not implemented: %s, %s' % (type, cls))
Note: See TracChangeset
for help on using the changeset viewer.