Changeset c4ae1c2 in sasview for sansguiframe/src/sans


Ignore:
Timestamp:
Sep 9, 2011 2:15:01 PM (13 years ago)
Author:
Jae Cho <jhjcho@…>
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:
2f81957
Parents:
baf1ef3
Message:

correction: default folder for inv and pr

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansguiframe/src/sans/guiframe/gui_manager.py

    rc553b18 rc4ae1c2  
    16711671        """ 
    16721672        if self.cpanel_on_focus is not None: 
    1673             self.cpanel_on_focus.on_save(event) 
     1673            try: 
     1674                self.cpanel_on_focus.on_save(event) 
     1675            except: 
     1676                msg = "Error occurred while saving: " 
     1677                msg += "To save, the application panel should have a data set.." 
     1678                wx.PostEvent(self, StatusEvent(status=msg))   
    16741679             
    16751680    def _on_save_project(self, event): 
     
    16771682        save the state of the SansView as *.svs 
    16781683        """ 
    1679         ## Default file location for save 
    1680         #self._default_save_location = os.getcwd() 
    16811684        if self._current_perspective is  None: 
    16821685            return 
     
    16851688        extension = '*' + APPLICATION_STATE_EXTENSION 
    16861689        dlg = wx.FileDialog(self, "Save Project file", 
    1687                             self._default_save_location, "", 
     1690                            self._default_save_location, "sansview_proj", 
    16881691                             extension,  
    16891692                             wx.SAVE) 
     
    16941697            return None 
    16951698        dlg.Destroy() 
    1696         if path is None: 
    1697             return 
    1698         # default cansas xml doc 
    1699         doc = None 
    1700         for panel in self.panels.values(): 
    1701             temp = panel.save_project(doc) 
    1702             if temp is not None: 
    1703                 doc = temp 
    1704            
    1705         # Write the XML document 
    1706         extens = APPLICATION_STATE_EXTENSION 
    1707         fName = os.path.splitext(path)[0] + extens 
    1708         if doc != None: 
    1709             fd = open(fName, 'w') 
    1710             fd.write(doc.toprettyxml()) 
    1711             fd.close() 
    1712         else: 
    1713             msg = "%s cannot read %s\n" % (str(APPLICATION_NAME), str(path)) 
    1714             logging.error(msg) 
     1699        try: 
     1700            if path is None: 
     1701                return 
     1702            # default cansas xml doc 
     1703            doc = None 
     1704            for panel in self.panels.values(): 
     1705                temp = panel.save_project(doc) 
     1706                if temp is not None: 
     1707                    doc = temp 
     1708               
     1709            # Write the XML document 
     1710            extens = APPLICATION_STATE_EXTENSION 
     1711            fName = os.path.splitext(path)[0] + extens 
     1712            if doc != None: 
     1713                fd = open(fName, 'w') 
     1714                fd.write(doc.toprettyxml()) 
     1715                fd.close() 
     1716            else: 
     1717                msg = "%s cannot read %s\n" % (str(APPLICATION_NAME), str(path)) 
     1718                logging.error(msg) 
     1719        except: 
     1720           msg = "Error occurred while saving: " 
     1721           msg += "To save, at leat one application panel " 
     1722           msg += "should have a data set.." 
     1723           wx.PostEvent(self, StatusEvent(status=msg))     
    17151724                     
    17161725    def on_save_helper(self, doc, reader, panel, path): 
Note: See TracChangeset for help on using the changeset viewer.