Changeset 998ca90 in sasview for src/sas/sasgui/guiframe


Ignore:
Timestamp:
Oct 7, 2016 12:21:40 PM (8 years ago)
Author:
krzywon
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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
ff3f5821
Parents:
cb823f0
Message:

#189 #12 Saving and loading project now fully saves and loads a simultaneous fits. Loading a project will reset Sasview state to its base state (with a warning). One error on load to fix before calling this finished.

Location:
src/sas/sasgui/guiframe
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/data_panel.py

    re767897 r998ca90  
    890890 
    891891 
    892     def on_remove(self, event): 
     892    def on_remove(self, event, msg=""): 
    893893        """ 
    894894        Get a list of item checked and remove them from the treectrl 
    895895        Ask the parent to remove reference to this item 
    896896        """ 
    897         msg = "This operation will delete the data sets checked " 
    898         msg += "and all the dependents." 
     897        if msg == "": 
     898            msg = "This operation will delete the data sets checked " 
     899            msg += "and all the dependents." 
    899900        msg_box = wx.MessageDialog(None, msg, 'Warning', wx.OK|wx.CANCEL) 
    900901        if msg_box.ShowModal() != wx.ID_OK: 
    901             return 
     902            return True 
    902903 
    903904        data_to_remove, theory_to_remove, _ = self.set_data_helper() 
  • src/sas/sasgui/guiframe/gui_manager.py

    r3fac0df r998ca90  
    19041904        if self._default_save_location == None: 
    19051905            self._default_save_location = os.getcwd() 
    1906         wx.PostEvent(self, StatusEvent(status="Loading Project file...")) 
    1907         dlg = wx.FileDialog(self, 
     1906        msg = "This operation will set SasView to its freshly opened state " 
     1907        msg += "before loading the project. Do you wish to continue?" 
     1908        if not self._data_panel.on_remove(None, msg): 
     1909            wx.PostEvent(self, StatusEvent(status="Loading Project file...")) 
     1910            dlg = wx.FileDialog(self, 
    19081911                            "Choose a file", 
    19091912                            self._default_save_location, "", 
    19101913                            APPLICATION_WLIST) 
    1911         if dlg.ShowModal() == wx.ID_OK: 
    1912             path = dlg.GetPath() 
     1914            if dlg.ShowModal() == wx.ID_OK: 
     1915                path = dlg.GetPath() 
    19131916            if path is not None: 
    19141917                self._default_save_location = os.path.dirname(path) 
    1915         dlg.Destroy() 
    1916  
    1917         self.load_state(path=path, is_project=True) 
     1918                dlg.Destroy() 
     1919 
     1920            # Reset to a base state 
     1921            self._on_reset_state() 
     1922 
     1923            # Load the project file 
     1924            self.load_state(path=path, is_project=True) 
     1925 
     1926    def _on_reset_state(self): 
     1927        """ 
     1928        Resets SasView to its freshly opened state. 
     1929        :return: None 
     1930        """ 
     1931        # Reset all plugins to their base state 
     1932        for plugin in self.plugins: 
     1933            plugin.clear_panel() 
     1934        # Reset plot number to 0 
     1935        self.graph_num = 0 
     1936        # Remove all loaded data 
     1937        self._data_panel.selection_cbox.SetValue('Select all Data') 
     1938        self._data_panel._on_selection_type(None) 
    19181939 
    19191940    def _on_save_application(self, event): 
     
    20632084            except: 
    20642085                logging.info("Failed to connect to www.sasview.org") 
    2065         self._process_version(version_info, standalone=event == None)     
    2066  
    2067          
    2068          
    2069 #          
    2070 #         try: 
    2071 #             req = urllib2.Request(config.__update_URL__) 
    2072 #             res = urllib2.urlopen(req) 
    2073 #             content = res.read().strip() 
    2074 #             logging.info("Connected to www.sasview.org. Latest version: %s" 
    2075 #                          % (content)) 
    2076 #             version_info = json.loads(content) 
    2077 #         except: 
    2078 #             logging.info("Failed to connect to www.sasview.org") 
    2079 #             version_info = {"version": "0.0.0"} 
    2080 #         self._process_version(version_info, standalone=event == None) 
     2086        self._process_version(version_info, standalone=event == None) 
    20812087 
    20822088    def _process_version(self, version_info, standalone=True): 
Note: See TracChangeset for help on using the changeset viewer.