Changeset ff3f5821 in sasview for src/sas/sasgui/guiframe


Ignore:
Timestamp:
Oct 7, 2016 12:31:19 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:
e6de6b8
Parents:
998ca90 (diff), dd72190 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into wx_save_simfit

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

Legend:

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

    rd85c194 r9b6d62d  
    363363        _str = "%s\n" % LoadData2D.__str__(self) 
    364364        return _str  
    365      
    366     def _validity_check(self, other): 
    367         """ 
    368         Checks that the data lengths are compatible. 
    369         Checks that the x vectors are compatible. 
    370         Returns errors vectors equal to original 
    371         errors vectors if they were present or vectors 
    372         of zeros when none was found. 
    373          
    374         :param other: other data set for operation 
    375          
    376         :return: dy for self, dy for other [numpy arrays] 
    377          
    378         :raise ValueError: when lengths are not compatible 
    379          
    380         """ 
    381         err_other = None 
    382         if isinstance(other, Data2D): 
    383             # Check that data lengths are the same 
    384             if len(self.data) != len(other.data) or \ 
    385                 len(self.qx_data) != len(other.qx_data) or \ 
    386                 len(self.qy_data) != len(other.qy_data): 
    387                 msg = "Unable to perform operation: data length are not equal" 
    388                 raise ValueError, msg 
    389             #if len(self.data) < 1: 
    390             #    msg = "Incompatible data sets: I-values do not match" 
    391             #    raise ValueError, msg  
    392             for ind in range(len(self.data)): 
    393                 if self.qx_data[ind] != other.qx_data[ind]: 
    394                     msg = "Incompatible data sets: qx-values do not match" 
    395                     raise ValueError, msg 
    396                 if self.qy_data[ind] != other.qy_data[ind]: 
    397                     msg = "Incompatible data sets: qy-values do not match" 
    398                     raise ValueError, msg 
    399                     
    400             # Check that the scales match 
    401             err_other = other.err_data 
    402             if other.err_data == None or \ 
    403                 (len(other.err_data) != len(other.data)): 
    404                 err_other = numpy.zeros(len(other.data)) 
    405              
    406         # Check that we have errors, otherwise create zero vector 
    407         err = self.err_data 
    408         if self.err_data == None or \ 
    409             (len(self.err_data) != len(self.data)): 
    410             err = numpy.zeros(len(other.data)) 
    411              
    412         return err, err_other 
    413  
    414     def _validity_check_union(self, other): 
    415         """ 
    416         Checks that the data lengths are compatible. 
    417         Checks that the x vectors are compatible. 
    418         Returns errors vectors equal to original 
    419         errors vectors if they were present or vectors 
    420         of zeros when none was found. 
    421          
    422         :param other: other data set for operation 
    423          
    424         :return: bool 
    425          
    426         :raise ValueError: when data types are not compatible 
    427          
    428         """ 
    429         if not isinstance(other, Data2D): 
    430             msg = "Unable to perform operation: different types of data set" 
    431             raise ValueError, msg    
    432         return True 
    433      
     365 
    434366    def _perform_operation(self, other, operation): 
    435367        """ 
  • 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.