Changeset c4ae1c2 in sasview


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

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • invariantview/src/sans/perspectives/invariant/invariant_panel.py

    rb8ff610 rc4ae1c2  
    9595        self.reset_panel() 
    9696        self._reset_state_list() 
    97          
     97        ## Default file location for save 
     98        self._default_save_location = os.getcwd()         
    9899        if self.parent is not None: 
    99100            msg = "" 
    100101            wx.PostEvent(self.parent,StatusEvent(status=msg, info="info")) 
    101              
    102         ## Default file location for save 
    103         self._default_save_location = os.getcwd() 
     102            self._default_save_location =\ 
     103                        self.parent._default_save_location 
     104         
    104105        self._set_bookmark_flag(False) 
    105106     
     
    11731174        # Ask the user the location of the file to write to. 
    11741175        path = None 
     1176        if self.parent != None: 
     1177            self._default_save_location =\ 
     1178             self.parent._default_save_location 
     1179        if self._default_save_location == None: 
     1180            self._default_save_location = os.getcwd() 
    11751181        dlg = wx.FileDialog(self, "Choose a file", 
    1176                             self._default_save_location, "", "*.inv", wx.SAVE) 
     1182                            self._default_save_location, \ 
     1183                            self.window_caption, "*.inv", wx.SAVE) 
    11771184        if dlg.ShowModal() == wx.ID_OK: 
    11781185            path = dlg.GetPath() 
    11791186            self._default_save_location = os.path.dirname(path) 
     1187            if self.parent != None: 
     1188                self.parent._default_save_location =\ 
     1189                    self._default_save_location 
    11801190        else: 
    11811191            return None 
  • inversionview/src/sans/perspectives/pr/inversion_panel.py

    rb8ff610 rc4ae1c2  
    8787        ## Default file location for save 
    8888        self._default_save_location = os.getcwd() 
     89        if self.parent is not None: 
     90            self._default_save_location =\ 
     91                        self.parent._default_save_location 
     92         
    8993        # Default width 
    9094        self._default_width = 350 
     
    265269        # Ask the user the location of the file to write to. 
    266270        path = None 
     271        if self.parent != None: 
     272            self._default_save_location =\ 
     273             self.parent._default_save_location 
    267274        dlg = wx.FileDialog(self, "Choose a file", 
    268                             self._default_save_location, "", "*.prv", wx.SAVE) 
     275                            self._default_save_location,\ 
     276                            self.window_caption, "*.prv", wx.SAVE) 
    269277        if dlg.ShowModal() == wx.ID_OK: 
    270278            path = dlg.GetPath() 
    271279            self._default_save_location = os.path.dirname(path) 
     280            if self.parent != None: 
     281                self.parent._default_save_location =\ 
     282                self._default_save_location 
    272283        else: 
    273284            return None 
  • 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.