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


Ignore:
Timestamp:
Dec 14, 2017 9:51:02 AM (7 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/Perspectives
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Corfunc/CorfuncPerspective.py

    r50bfab0 re90988c  
    55 
    66# global 
     7from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg \ 
     8    as FigureCanvas 
     9from matplotlib.figure import Figure 
     10from numpy.linalg.linalg import LinAlgError 
     11 
    712from PyQt5 import QtCore 
    813from PyQt5 import QtGui, QtWidgets 
     
    1722from .UI.CorfuncPanel import Ui_CorfuncDialog 
    1823from .CorfuncUtils import WIDGETS as W 
    19  
    20 from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg \ 
    21     as FigureCanvas 
    22 from matplotlib.figure import Figure 
    23 from numpy.linalg.linalg import LinAlgError 
    2424 
    2525 
     
    136136        self.cmdCalculateBg.clicked.connect(self.calculate_background) 
    137137        self.cmdCalculateBg.setEnabled(False) 
     138        self.cmdHelp.clicked.connect(self.showHelp) 
    138139 
    139140        self.model.itemChanged.connect(self.model_changed) 
     
    306307 
    307308    # pylint: disable=invalid-name 
     309    def showHelp(self): 
     310        """ 
     311        Opens a webpage with help on the perspective 
     312        """ 
     313        """ Display help when clicking on Help button """ 
     314        treeLocation = "/user/sasgui/perspectives/corfunc/corfunc_help.html" 
     315        self.parent.showHelp(treeLocation) 
     316 
    308317    @staticmethod 
    309318    def allowBatch(): 
  • src/sas/qtgui/Perspectives/Fitting/FittingOptions.py

    rd6b8a1d re90988c  
    33import os 
    44import types 
     5import webbrowser 
    56 
    67from PyQt5 import QtCore 
    78from PyQt5 import QtGui 
    89from PyQt5 import QtWidgets 
    9 from PyQt5 import QtWebKitWidgets 
    1010 
    1111from sas.qtgui.UI import images_rc 
     
    7373        # OK has to be initialized to True, after initial validator setup 
    7474        self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(True) 
    75  
    76         # Display HTML content 
    77         self.helpView = QtWebKitWidgets.QWebView() 
    7875 
    7976    def assignValidators(self): 
     
    160157        Show the "Fitting options" section of help 
    161158        """ 
    162         tree_location = GuiUtils.HELP_DIRECTORY_LOCATION + "/user/sasgui/perspectives/fitting/" 
     159        tree_location = GuiUtils.HELP_DIRECTORY_LOCATION 
     160        tree_location += "/user/sasgui/perspectives/fitting/" 
    163161 
    164162        # Actual file anchor will depend on the combo box index 
     
    167165        helpfile = "optimizer.html#fit-" + self.current_fitter_id  
    168166        help_location = tree_location + helpfile 
    169         self.helpView.load(QtCore.QUrl(help_location)) 
    170         self.helpView.show() 
     167        webbrowser.open('file://' + os.path.realpath(help_location)) 
    171168 
    172169    def widgetFromOption(self, option_id, current_fitter=None): 
  • src/sas/qtgui/Perspectives/Fitting/FittingPerspective.py

    r7c487846 re90988c  
    1313from sas.qtgui.Perspectives.Fitting.FittingOptions import FittingOptions 
    1414from sas.qtgui.Perspectives.Fitting.GPUOptions import GPUOptions 
    15 #from sas.qtgui.Perspectives.Fitting import ModelUtilities 
    1615 
    1716class FittingWindow(QtWidgets.QTabWidget): 
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    r0261bc1 re90988c  
    88from twisted.internet import threads 
    99import numpy as np 
     10import webbrowser 
    1011 
    1112from PyQt5 import QtCore 
    1213from PyQt5 import QtGui 
    1314from PyQt5 import QtWidgets 
    14 from PyQt5 import QtWebKitWidgets 
    15 # Officially QtWebEngineWidgets are the way to display HTML in Qt5, 
    16 # but this module isn't ported to PyQt5 yet... 
    17 # let's wait. In the meantime no Help. 
    18 #from PyQt5 import QtWebEngineWidgets 
    1915 
    2016from sasmodels import product 
     
    127123 
    128124        # Display HTML content 
    129         self.helpView = QtWebKitWidgets.QWebView() 
     125        #self.setupHelp() 
    130126 
    131127        # New font to display angstrom symbol 
     
    662658        Show the "Fitting" section of help 
    663659        """ 
    664         tree_location = GuiUtils.HELP_DIRECTORY_LOCATION + "/user/sasgui/perspectives/fitting/" 
     660        tree_location = "/user/sasgui/perspectives/fitting/" 
    665661 
    666662        # Actual file will depend on the current tab 
     
    672668            helpfile = "residuals_help.html" 
    673669        elif tab_id == 2: 
    674             helpfile = "sm_help.html" 
     670            helpfile = "resolution.html" 
    675671        elif tab_id == 3: 
    676             helpfile = "pd_help.html" 
     672            helpfile = "pd/polydispersity.html" 
    677673        elif tab_id == 4: 
    678             helpfile = "mag_help.html" 
     674            helpfile = "magnetism/magnetism.html" 
    679675        help_location = tree_location + helpfile 
    680676 
    681         content = QtCore.QUrl(help_location) 
    682         self.helpView.load(QtCore.QUrl(help_location)) 
    683         self.helpView.show() 
     677        self.showHelp(help_location) 
     678 
     679    def showHelp(self, url): 
     680        """ 
     681        Calls parent's method for opening an HTML page 
     682        """ 
     683        self.parent.showHelp(url) 
    684684 
    685685    def onDisplayMagneticAngles(self): 
  • src/sas/qtgui/Perspectives/Fitting/GPUOptions.py

    rc7ebb37 re90988c  
    88 
    99import sas.qtgui.Utilities.GuiUtils as GuiUtils 
    10 from PyQt5 import QtGui, QtCore, QtWebKit, QtWidgets 
     10from PyQt5 import QtGui, QtCore, QtWidgets 
    1111from sas.qtgui.Perspectives.Fitting.UI.GPUOptionsUI import Ui_GPUOptions 
    1212from sas.qtgui.Perspectives.Fitting.UI.GPUTestResultsUI import Ui_GPUTestResults 
     
    172172        help_location += "/user/sasgui/perspectives/fitting/gpu_setup.html" 
    173173        help_location += "#device-selection" 
    174         # Test the system browser solution 
     174        # Display the page in default browser 
    175175        webbrowser.open('file://' + os.path.realpath(help_location)) 
    176176 
  • src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py

    r9387fe3 re90988c  
    88from PyQt5 import QtCore 
    99from PyQt5 import QtGui, QtWidgets 
    10 from PyQt5 import QtWebKit 
    1110 
    1211from twisted.internet import threads 
     
    6362        self._model_item = QtGui.QStandardItem() 
    6463 
    65         #self._helpView = QtWebKit.QWebView() 
    6664        self.detailsDialog = DetailsDialog(self) 
    6765        self.detailsDialog.cmdOK.clicked.connect(self.enabling) 
     
    431429    def onHelp(self): 
    432430        """ Display help when clicking on Help button """ 
    433         treeLocation = GuiUtils.HELP_DIRECTORY_LOCATION + \ 
    434             "/user/sasgui/perspectives/invariant/invariant_help.html" 
    435         webbrowser.open('file://' + treeLocation) 
     431        treeLocation = "/user/sasgui/perspectives/invariant/invariant_help.html" 
     432        self.parent.showHelp(treeLocation) 
    436433 
    437434    def setupSlots(self): 
  • src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py

    r50bfab0 re90988c  
    5151        self._manager = parent 
    5252        self._model_item = QtGui.QStandardItem() 
    53         #self._helpView = QtWebKit.QWebView() 
    54  
    5553        self.communicate = GuiUtils.Communicate() 
    5654 
     
    374372        Open the P(r) Inversion help browser 
    375373        """ 
    376         tree_location = (GuiUtils.HELP_DIRECTORY_LOCATION + 
    377                          "user/sasgui/perspectives/pr/pr_help.html") 
     374        tree_location = "/user/sasgui/perspectives/pr/pr_help.html" 
    378375 
    379376        # Actual file anchor will depend on the combo box index 
    380377        # Note that we can be clusmy here, since bad current_fitter_id 
    381378        # will just make the page displayed from the top 
    382         #self._helpView.load(QtCore.QUrl(tree_location)) 
    383         #self._helpView.show() 
     379        self._manager.showHelp(tree_location) 
    384380 
    385381    def toggleBgd(self): 
Note: See TracChangeset for help on using the changeset viewer.