Changeset e90988c in sasview for src/sas/qtgui/Calculators


Ignore:
Timestamp:
Dec 14, 2017 7:51:02 AM (6 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:
7fd20fc, 626c7c5
Parents:
8353d90
Message:

Show help pages in default browser. Fixed some help links and modified unit tests. SASVIEW-800

Location:
src/sas/qtgui/Calculators
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Calculators/DataOperationUtilityPanel.py

    rd6b8a1d re90988c  
    110110        documentation tree (after /doc/ ....". 
    111111        """ 
    112         try: 
    113             location = GuiUtils.HELP_DIRECTORY_LOCATION + \ 
    114                        "/user/sasgui/perspectives/calculator/data_operator_help.html" 
    115             self.manager._helpView.load(QtCore.QUrl(location)) 
    116             self.manager._helpView.show() 
    117  
    118         except AttributeError: 
    119             # No manager defined - testing and standalone runs 
    120             pass 
     112        location = "/user/sasgui/perspectives/calculator/data_operator_help.html" 
     113        self.manager.showHelp(location) 
    121114 
    122115    def onClose(self): 
  • src/sas/qtgui/Calculators/DensityPanel.py

    rd4881f6a re90988c  
    146146 
    147147    def displayHelp(self): 
    148         try: 
    149             location = HELP_DIRECTORY_LOCATION + \ 
    150                 "/user/sasgui/perspectives/calculator/density_calculator_help.html" 
     148        location =  "/user/sasgui/perspectives/calculator/density_calculator_help.html" 
     149        self.manager.showHelp(location) 
    151150 
    152             self.manager._helpView.load(QtCore.QUrl(location)) 
    153             self.manager._helpView.show() 
    154         except AttributeError: 
    155             # No manager defined - testing and standalone runs 
    156             pass 
     151 
  • src/sas/qtgui/Calculators/GenericScatteringCalculator.py

    r53c771e re90988c  
    382382        documentation tree (after /doc/ ....". 
    383383        """ 
    384         try: 
    385             location = GuiUtils.HELP_DIRECTORY_LOCATION + \ 
    386                        "/user/sasgui/perspectives/calculator/sas_calculator_help.html" 
    387             self.manager._helpView.load(QtCore.QUrl(location)) 
    388             self.manager._helpView.show() 
    389         except AttributeError: 
    390             # No manager defined - testing and standalone runs 
    391             pass 
     384        location = "/user/sasgui/perspectives/calculator/sas_calculator_help.html" 
     385        self.manager.showHelp(location) 
    392386 
    393387    def onReset(self): 
  • src/sas/qtgui/Calculators/KiessigPanel.py

    rfbfc488 re90988c  
    3838        documentation tree (after /doc/ ....". 
    3939        """ 
    40         try: 
    41             location = GuiUtils.HELP_DIRECTORY_LOCATION + \ 
    42                 "/user/sasgui/perspectives/calculator/kiessig_calculator_help.html" 
    43  
    44             self.manager._helpView.load(QtCore.QUrl(location)) 
    45             self.manager._helpView.show() 
    46         except AttributeError: 
    47             # No manager defined - testing and standalone runs 
    48             pass 
     40        location = "/user/sasgui/perspectives/calculator/kiessig_calculator_help.html" 
     41        self.manager.showHelp(location) 
    4942 
    5043    def onCompute(self): 
  • src/sas/qtgui/Calculators/ResolutionCalculatorPanel.py

    rd6b8a1d re90988c  
    366366        documentation tree (after /doc/ ....". 
    367367        """ 
    368         try: 
    369             location = GuiUtils.HELP_DIRECTORY_LOCATION + \ 
    370                        "/user/sasgui/perspectives/calculator/resolution_calculator_help.html" 
    371             self.manager._helpView.load(QtCore.QUrl(location)) 
    372             self.manager._helpView.show() 
    373  
    374         except AttributeError: 
    375             # No manager defined - testing and standalone runs 
    376             pass 
     368        location = "/user/sasgui/perspectives/calculator/resolution_calculator_help.html" 
     369        self.manager.showHelp(location) 
    377370 
    378371    def onReset(self): 
  • src/sas/qtgui/Calculators/SldPanel.py

    rd4881f6a re90988c  
    213213 
    214214    def displayHelp(self): 
    215         try: 
    216             location = GuiUtils.HELP_DIRECTORY_LOCATION + \ 
    217                 "/user/sasgui/perspectives/calculator/sld_calculator_help.html" 
    218             self.manager._helpView.load(QtCore.QUrl(location)) 
    219             self.manager._helpView.show() 
    220         except AttributeError: 
    221             # No manager defined - testing and standalone runs 
    222             pass 
    223  
     215        location = "/user/sasgui/perspectives/calculator/sld_calculator_help.html" 
     216        self.manager.showHelp(location) 
     217 
     218 
  • src/sas/qtgui/Calculators/SlitSizeCalculator.py

    r53c771e re90988c  
    4747        documentation tree (after /doc/ ....". 
    4848        """ 
    49         try: 
    50             location = GuiUtils.HELP_DIRECTORY_LOCATION + \ 
    51                 "/user/sasgui/perspectives/calculator/slit_calculator_help.html" 
    52  
    53             self._parent._helpView.load(QtCore.QUrl(location)) 
    54             self._parent._helpView.show() 
    55         except AttributeError: 
    56             # No manager defined - testing and standalone runs 
    57             pass 
     49        location = "/user/sasgui/perspectives/calculator/slit_calculator_help.html" 
     50        self._parent.showHelp(location) 
    5851 
    5952    def onBrowse(self): 
  • src/sas/qtgui/Calculators/UnitTesting/DataOperationUtilityTest.py

    r53c771e re90988c  
    44import logging 
    55import unittest 
     6import webbrowser 
     7 
    68from PyQt5 import QtGui, QtWidgets 
    79from PyQt5 import QtCore 
     
    119121    def testHelp(self): 
    120122        """ Assure help file is shown """ 
    121         # this should not rise 
     123        self.widget.manager.showHelp = MagicMock() 
    122124        self.widget.onHelp() 
     125        self.assertTrue(self.widget.manager.showHelp.called_once()) 
     126        args = self.widget.manager.showHelp.call_args 
     127        self.assertIn('data_operator_help.html', args[0][0]) 
    123128 
    124129    def testOnReset(self): 
  • src/sas/qtgui/Calculators/UnitTesting/DensityCalculatorTest.py

    r53c771e re90988c  
    121121    def testHelp(self): 
    122122        """ Assure help file is shown """ 
    123  
    124         # this should not rise 
     123        self.widget.manager = QtWidgets.QWidget() 
     124        self.widget.manager.showHelp = MagicMock() 
    125125        self.widget.displayHelp() 
     126        self.assertTrue(self.widget.manager.showHelp.called_once()) 
     127        args = self.widget.manager.showHelp.call_args 
     128        self.assertIn('density_calculator_help.html', args[0][0]) 
    126129 
    127130if __name__ == "__main__": 
  • src/sas/qtgui/Calculators/UnitTesting/GenericScatteringCalculatorTest.py

    r53c771e re90988c  
    104104    def testHelpButton(self): 
    105105        """ Assure help file is shown """ 
     106        self.widget.manager.showHelp = MagicMock() 
    106107        self.widget.onHelp() 
     108        self.assertTrue(self.widget.manager.showHelp.called_once()) 
     109        args = self.widget.manager.showHelp.call_args 
     110        self.assertIn('sas_calculator_help.html', args[0][0]) 
    107111 
    108112    def testValidator(self): 
  • src/sas/qtgui/Calculators/UnitTesting/KiessigCalculatorTest.py

    r53c771e re90988c  
    55from PyQt5.QtCore import Qt 
    66 
    7 # TEMP 
    8 #import sas.qtgui.path_prepare 
    97import path_prepare 
    10  
     8from unittest.mock import MagicMock 
    119 
    1210from sas.qtgui.Calculators.KiessigPanel import KiessigPanel 
     
    3533    def testHelp(self): 
    3634        """ Assure help file is shown """ 
    37  
    38         # this should not rise 
     35        self.widget.manager = QtWidgets.QWidget() 
     36        self.widget.manager.showHelp = MagicMock() 
    3937        self.widget.onHelp() 
     38        self.assertTrue(self.widget.manager.showHelp.called_once()) 
     39        args = self.widget.manager.showHelp.call_args 
     40        self.assertIn('kiessig_calculator_help.html', args[0][0]) 
    4041 
    4142    def testComplexEntryNumbers(self): 
  • src/sas/qtgui/Calculators/UnitTesting/ResolutionCalculatorPanelTest.py

    r53c771e re90988c  
    240240        """ Assure help file is shown """ 
    241241        # this should not rise 
     242        self.widget.manager = QtWidgets.QWidget() 
     243        self.widget.manager.showHelp = MagicMock() 
    242244        self.widget.onHelp() 
     245        self.assertTrue(self.widget.manager.showHelp.called_once()) 
     246        args = self.widget.manager.showHelp.call_args 
     247        self.assertIn('resolution_calculator_help.html', args[0][0]) 
    243248 
    244249    def testOnReset(self): 
  • src/sas/qtgui/Calculators/UnitTesting/SLDCalculatorTest.py

    r53c771e re90988c  
    142142    def testHelp(self): 
    143143        """ Assure help file is shown """ 
    144  
    145         # this should not rise 
     144        self.widget.manager = QtWidgets.QWidget() 
     145        self.widget.manager.showHelp = MagicMock() 
    146146        self.widget.displayHelp() 
     147        self.assertTrue(self.widget.manager.showHelp.called_once()) 
     148        args = self.widget.manager.showHelp.call_args 
     149        self.assertIn('sld_calculator_help.html', args[0][0]) 
    147150 
    148151if __name__ == "__main__": 
  • src/sas/qtgui/Calculators/UnitTesting/SlitSizeCalculatorTest.py

    r53c771e re90988c  
    3737    def testHelp(self): 
    3838        """ Assure help file is shown """ 
    39  
    40         # this should not rise 
     39        self.widget._parent = QtWidgets.QWidget() 
     40        self.widget._parent.showHelp = MagicMock() 
    4141        self.widget.onHelp() 
     42        self.assertTrue(self.widget._parent.showHelp.called_once()) 
     43        args = self.widget._parent.showHelp.call_args 
     44        self.assertIn('slit_calculator_help.html', args[0][0]) 
    4245 
    4346    def testBrowseButton(self): 
Note: See TracChangeset for help on using the changeset viewer.