Changeset 70080a0 in sasview


Ignore:
Timestamp:
Jun 8, 2017 5:10:49 AM (8 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
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
Children:
919d47c
Parents:
06b0138
Message:

Added tab-dependent help display in fiting

Location:
src/sas/qtgui/Perspectives/Fitting
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    r06b0138 r70080a0  
    544544        Show the "Fitting" section of help 
    545545        """ 
    546         tree_location = self.parent.HELP_DIRECTORY_LOCATION +\ 
    547             "/user/sasgui/perspectives/fitting/fitting_help.html" 
    548         self.helpView.load(QtCore.QUrl(tree_location)) 
     546        tree_location = self.parent.HELP_DIRECTORY_LOCATION + "/user/sasgui/perspectives/fitting/" 
     547 
     548        # Actual file will depend on the current tab 
     549        tab_id = self.tabFitting.currentIndex() 
     550        helpfile = "fitting.html" 
     551        if tab_id == 0: 
     552            helpfile = "fitting_help.html" 
     553        elif tab_id == 1: 
     554            helpfile = "residuals_help.html" 
     555        elif tab_id == 2: 
     556            helpfile = "sm_help.html" 
     557        elif tab_id == 3: 
     558            helpfile = "pd_help.html" 
     559        elif tab_id == 4: 
     560            helpfile = "mag_help.html" 
     561        help_location = tree_location + helpfile 
     562        self.helpView.load(QtCore.QUrl(help_location)) 
    549563        self.helpView.show() 
    550564 
  • src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py

    r06b0138 r70080a0  
    2323 
    2424class dummy_manager(object): 
     25    HELP_DIRECTORY_LOCATION = "html" 
    2526    communicate = Communicate() 
    2627 
     
    677678            self.assertEqual(update_spy.count(), 1) 
    678679 
     680    def testOnHelp(self): 
     681        """ 
     682        Test various help pages shown in this widget 
     683        """ 
     684        #Mock the QWebView method 
     685        QtWebKit.QWebView.show = MagicMock() 
     686        QtWebKit.QWebView.load = MagicMock() 
     687 
     688        # Invoke the action on default tab 
     689        self.widget.onHelp() 
     690        # Check if show() got called 
     691        self.assertTrue(QtWebKit.QWebView.show.called) 
     692        # Assure the filename is correct 
     693        self.assertIn("fitting_help.html", QtWebKit.QWebView.load.call_args[0][0].toString()) 
     694 
     695        # Change the tab to options 
     696        self.widget.tabFitting.setCurrentIndex(1) 
     697        self.widget.onHelp() 
     698        # Check if show() got called 
     699        self.assertEqual(QtWebKit.QWebView.show.call_count, 2) 
     700        # Assure the filename is correct 
     701        self.assertIn("residuals_help.html", QtWebKit.QWebView.load.call_args[0][0].toString()) 
     702 
     703        # Change the tab to smearing 
     704        self.widget.tabFitting.setCurrentIndex(2) 
     705        self.widget.onHelp() 
     706        # Check if show() got called 
     707        self.assertEqual(QtWebKit.QWebView.show.call_count, 3) 
     708        # Assure the filename is correct 
     709        self.assertIn("sm_help.html", QtWebKit.QWebView.load.call_args[0][0].toString()) 
     710 
     711        # Change the tab to poly 
     712        self.widget.tabFitting.setCurrentIndex(3) 
     713        self.widget.onHelp() 
     714        # Check if show() got called 
     715        self.assertEqual(QtWebKit.QWebView.show.call_count, 4) 
     716        # Assure the filename is correct 
     717        self.assertIn("pd_help.html", QtWebKit.QWebView.load.call_args[0][0].toString()) 
     718 
     719        # Change the tab to magnetism 
     720        self.widget.tabFitting.setCurrentIndex(4) 
     721        self.widget.onHelp() 
     722        # Check if show() got called 
     723        self.assertEqual(QtWebKit.QWebView.show.call_count, 5) 
     724        # Assure the filename is correct 
     725        self.assertIn("mag_help.html", QtWebKit.QWebView.load.call_args[0][0].toString()) 
     726 
    679727    def testReadFitPage(self): 
    680728        """ 
Note: See TracChangeset for help on using the changeset viewer.