Changeset f0a9a3cc in sasview
- Timestamp:
- Jun 8, 2009 2:27:40 PM (16 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- d4ccbb1
- Parents:
- ff3f900b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/local_perspectives/plotting/Plotter1D.py
r4ac8556 rf0a9a3cc 420 420 421 421 422 def _onSaveXML(self, path):423 """424 Save 1D Data to XML file425 426 TODO: Refactor and remove this method. See TODO in _onSave.427 428 @param evt: Menu event429 """430 if not path == None:431 out = open(path, 'w')432 from DataLoader.readers import cansas_reader433 reader = cansas_reader.Reader()434 data= self.plots[self.graph.selected_plottable]435 if hasattr(data, "info"):436 datainfo= data.info437 else:438 datainfo= data439 try:440 reader.write( path, datainfo)441 except:442 msg= "couldn't save point %s"%sys.exc_value443 raise444 445 try:446 self._default_save_location = os.path.dirname(path)447 except:448 pass449 450 return451 452 453 422 def _onsaveTXT(self, path): 454 423 """ … … 499 468 @param evt: Menu event 500 469 """ 501 import os470 502 471 id = str(evt.GetId()) 503 472 if id in self.action_ids: … … 515 484 #TODO: This is bad design. The DataLoader is designed to recognize extensions. 516 485 # It should be a simple matter of calling the .save(file, data, '.xml') method 517 # of the DataLoader.loader.Loader class. 518 519 if os.path.splitext(mypath)[1].lower() ==".txt": 520 self._onsaveTXT(path) 521 if os.path.splitext(mypath)[1].lower() ==".xml": 522 self._onSaveXML(path) 523 486 # of the DataLoader.loader.Loader class. 487 from DataLoader.loader import Loader 488 #Instantiate a loader 489 loader = Loader() 490 data = self.plots[self.graph.selected_plottable] 491 format=".txt" 492 if os.path.splitext(mypath)[1].lower() == format: 493 self._onsaveTXT( path) 494 495 format= ".xml" 496 if os.path.splitext(mypath)[1].lower() ==format: 497 loader.save( path, data, format) 498 try: 499 self._default_save_location = os.path.dirname(path) 500 except: 501 pass 524 502 dlg.Destroy() 525 503 504 505 506 526 507 527 508
Note: See TracChangeset
for help on using the changeset viewer.