Ignore:
Timestamp:
Nov 7, 2018 6:47:25 AM (5 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
ebcdb02
Parents:
490e230
Message:

More batchpage related functionality for Analysis save/load

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/MainWindow/DataExplorer.py

    r490e230 rbe74751  
    266266        filename = QtWidgets.QFileDialog.getOpenFileName(**kwargs)[0] 
    267267        if filename: 
    268             self.readAnalysis(filename) 
     268            self.readProject(filename) 
    269269 
    270270    def saveProject(self): 
     
    414414        if 'svs' in ext.lower(): 
    415415            # backward compatibility mode. 
    416             datasets = GuiUtils.readProjectFromSVS(filename) 
    417             #[[item_1, state_1], [item_2, state_2],...] 
    418  
     416            try: 
     417                datasets = GuiUtils.readProjectFromSVS(filename) 
     418            except Exception as ex: 
     419                # disregard malformed SVS and try to recover whatever 
     420                # is available 
     421                msg = "Error while reading the project file: "+str(ex) 
     422                logging.error(msg) 
     423                pass 
    419424            # Convert fitpage properties and update the dict 
    420425            try: 
     
    422427            except Exception as ex: 
    423428                # disregard malformed SVS and try to recover regardless 
    424                 msg = "Error while reading the project file: "+str(ex) 
     429                msg = "Error while converting the project file: "+str(ex) 
    425430                logging.error(msg) 
    426431                pass 
    427432        else: 
    428433            with open(filename, 'r') as infile: 
    429                 all_data = GuiUtils.readDataFromFile(infile) 
    430  
     434                try: 
     435                    all_data = GuiUtils.readDataFromFile(infile) 
     436                except Exception as ex: 
     437                    logging.error("Project load failed with " + str(ex)) 
     438                    return 
    431439        for key, value in all_data.items(): 
    432440            if key=='is_batch': 
     
    489497                self._perspective().updateFromParameters(page) 
    490498        pass # debugger 
    491  
    492     def readAnalysis(self, filename): 
    493         """ 
    494         Read out a single dataset and fitpage from file 
    495         """ 
    496         with open(filename, 'r') as infile: 
    497             all_data = GuiUtils.readDataFromFile(infile) 
    498  
    499             # send newly created items to the perspective 
    500             self.updatePerspectiveWithProperties(1, all_data) 
    501499 
    502500    def updateModelFromData(self, data): 
Note: See TracChangeset for help on using the changeset viewer.