Changes in / [570e091:a3c94b54] in sasview


Ignore:
Files:
2 deleted
33 edited

Legend:

Unmodified
Added
Removed
  • docs/sphinx-docs/build_sphinx.py

    re90988c rdf72475  
    220220    print("=== Build HTML Docs from ReST Files ===") 
    221221    subprocess.call(["sphinx-build", 
    222                      "-b", "qthelp", # Builder name. TODO: accept as arg to setup.py. 
     222                     "-b", "html", # Builder name. TODO: accept as arg to setup.py. 
    223223                     "-d", joinpath(SPHINX_BUILD, "doctrees"), 
    224224                     SPHINX_SOURCE, 
  • src/sas/qtgui/Calculators/DataOperationUtilityPanel.py

    re90988c rd6b8a1d  
    110110        documentation tree (after /doc/ ....". 
    111111        """ 
    112         location = "/user/sasgui/perspectives/calculator/data_operator_help.html" 
    113         self.manager.showHelp(location) 
     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 
    114121 
    115122    def onClose(self): 
  • src/sas/qtgui/Calculators/DensityPanel.py

    re90988c rd4881f6a  
    146146 
    147147    def displayHelp(self): 
    148         location =  "/user/sasgui/perspectives/calculator/density_calculator_help.html" 
    149         self.manager.showHelp(location) 
     148        try: 
     149            location = HELP_DIRECTORY_LOCATION + \ 
     150                "/user/sasgui/perspectives/calculator/density_calculator_help.html" 
    150151 
    151  
     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 
  • src/sas/qtgui/Calculators/GenericScatteringCalculator.py

    re90988c r53c771e  
    382382        documentation tree (after /doc/ ....". 
    383383        """ 
    384         location = "/user/sasgui/perspectives/calculator/sas_calculator_help.html" 
    385         self.manager.showHelp(location) 
     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 
    386392 
    387393    def onReset(self): 
  • src/sas/qtgui/Calculators/KiessigPanel.py

    re90988c rfbfc488  
    3838        documentation tree (after /doc/ ....". 
    3939        """ 
    40         location = "/user/sasgui/perspectives/calculator/kiessig_calculator_help.html" 
    41         self.manager.showHelp(location) 
     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 
    4249 
    4350    def onCompute(self): 
  • src/sas/qtgui/Calculators/ResolutionCalculatorPanel.py

    re90988c rd6b8a1d  
    366366        documentation tree (after /doc/ ....". 
    367367        """ 
    368         location = "/user/sasgui/perspectives/calculator/resolution_calculator_help.html" 
    369         self.manager.showHelp(location) 
     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 
    370377 
    371378    def onReset(self): 
  • src/sas/qtgui/Calculators/SldPanel.py

    re90988c rd4881f6a  
    213213 
    214214    def displayHelp(self): 
    215         location = "/user/sasgui/perspectives/calculator/sld_calculator_help.html" 
    216         self.manager.showHelp(location) 
    217  
    218  
     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 
  • src/sas/qtgui/Calculators/SlitSizeCalculator.py

    re90988c r53c771e  
    4747        documentation tree (after /doc/ ....". 
    4848        """ 
    49         location = "/user/sasgui/perspectives/calculator/slit_calculator_help.html" 
    50         self._parent.showHelp(location) 
     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 
    5158 
    5259    def onBrowse(self): 
  • src/sas/qtgui/Calculators/UnitTesting/DataOperationUtilityTest.py

    re90988c r53c771e  
    44import logging 
    55import unittest 
    6 import webbrowser 
    7  
    86from PyQt5 import QtGui, QtWidgets 
    97from PyQt5 import QtCore 
     
    121119    def testHelp(self): 
    122120        """ Assure help file is shown """ 
    123         self.widget.manager.showHelp = MagicMock() 
     121        # this should not rise 
    124122        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]) 
    128123 
    129124    def testOnReset(self): 
  • src/sas/qtgui/Calculators/UnitTesting/DensityCalculatorTest.py

    re90988c r53c771e  
    121121    def testHelp(self): 
    122122        """ Assure help file is shown """ 
    123         self.widget.manager = QtWidgets.QWidget() 
    124         self.widget.manager.showHelp = MagicMock() 
     123 
     124        # this should not rise 
    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]) 
    129126 
    130127if __name__ == "__main__": 
  • src/sas/qtgui/Calculators/UnitTesting/GenericScatteringCalculatorTest.py

    re90988c r53c771e  
    104104    def testHelpButton(self): 
    105105        """ Assure help file is shown """ 
    106         self.widget.manager.showHelp = MagicMock() 
    107106        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]) 
    111107 
    112108    def testValidator(self): 
  • src/sas/qtgui/Calculators/UnitTesting/KiessigCalculatorTest.py

    re90988c r53c771e  
    55from PyQt5.QtCore import Qt 
    66 
     7# TEMP 
     8#import sas.qtgui.path_prepare 
    79import path_prepare 
    8 from unittest.mock import MagicMock 
     10 
    911 
    1012from sas.qtgui.Calculators.KiessigPanel import KiessigPanel 
     
    3335    def testHelp(self): 
    3436        """ Assure help file is shown """ 
    35         self.widget.manager = QtWidgets.QWidget() 
    36         self.widget.manager.showHelp = MagicMock() 
     37 
     38        # this should not rise 
    3739        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]) 
    4140 
    4241    def testComplexEntryNumbers(self): 
  • src/sas/qtgui/Calculators/UnitTesting/ResolutionCalculatorPanelTest.py

    re90988c r53c771e  
    240240        """ Assure help file is shown """ 
    241241        # this should not rise 
    242         self.widget.manager = QtWidgets.QWidget() 
    243         self.widget.manager.showHelp = MagicMock() 
    244242        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]) 
    248243 
    249244    def testOnReset(self): 
  • src/sas/qtgui/Calculators/UnitTesting/SLDCalculatorTest.py

    re90988c r53c771e  
    142142    def testHelp(self): 
    143143        """ Assure help file is shown """ 
    144         self.widget.manager = QtWidgets.QWidget() 
    145         self.widget.manager.showHelp = MagicMock() 
     144 
     145        # this should not rise 
    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]) 
    150147 
    151148if __name__ == "__main__": 
  • src/sas/qtgui/Calculators/UnitTesting/SlitSizeCalculatorTest.py

    re90988c r53c771e  
    3737    def testHelp(self): 
    3838        """ Assure help file is shown """ 
    39         self.widget._parent = QtWidgets.QWidget() 
    40         self.widget._parent.showHelp = MagicMock() 
     39 
     40        # this should not rise 
    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]) 
    4542 
    4643    def testBrowseButton(self): 
  • src/sas/qtgui/GUITests.py

    r0595bb7 r6b0c2f6  
    6161from Perspectives.Invariant.UnitTesting import InvariantPerspectiveTest 
    6262 
     63 
    6364def suite(): 
    6465    suites = ( 
     
    116117        unittest.makeSuite(InvariantPerspectiveTest.InvariantPerspectiveTest,  'test'), 
    117118        unittest.makeSuite(InvariantDetailsTest.InvariantDetailsTest,     'test'), 
    118         #  Inversion 
    119         unittest.makeSuite(InversionPerspectiveTest.InversionTest,  'test'), 
    120119     ) 
    121120    return unittest.TestSuite(suites) 
  • src/sas/qtgui/MainWindow/DataExplorer.py

    re90988c rcb4d219  
    88from PyQt5 import QtGui 
    99from PyQt5 import QtWidgets 
     10from PyQt5 import QtWebKitWidgets 
    1011 
    1112from twisted.internet import threads 
     
    6970        self.cmdHelp_2.clicked.connect(self.displayHelp) 
    7071 
     72        # Display HTML content 
     73        self._helpView = QtWebKitWidgets.QWebView() 
     74 
    7175        # Fill in the perspectives combo 
    7276        self.initPerspectives() 
     
    137141        Show the "Loading data" section of help 
    138142        """ 
    139         tree_location = "/user/sasgui/guiframe/data_explorer_help.html" 
    140         self.parent.showHelp(tree_location) 
     143        tree_location = GuiUtils.HELP_DIRECTORY_LOCATION +\ 
     144            "/user/sasgui/guiframe/data_explorer_help.html" 
     145        self._helpView.load(QtCore.QUrl(tree_location)) 
     146        self._helpView.show() 
    141147 
    142148    def enableGraphCombo(self, combo_text): 
  • src/sas/qtgui/MainWindow/GuiManager.py

    re90988c rd1955d67  
    8686        # Set up the status bar 
    8787        self.statusBarSetup() 
    88  
     88        # Show the Welcome panel 
     89        self.welcomePanel = WelcomePanel() 
     90        self._workspace.workspace.addSubWindow(self.welcomePanel) 
     91 
     92        # Current help file 
     93        self._helpView = QWebView() 
    8994        # Needs URL like path, so no path.join() here 
    9095        self._helpLocation = GuiUtils.HELP_DIRECTORY_LOCATION + "/index.html" 
     
    9499                                              "_downloads", 
    95100                                              "Tutorial.pdf")) 
    96  
    97101    def addWidgets(self): 
    98102        """ 
     
    127131        self.ackWidget = Acknowledgements() 
    128132        self.aboutWidget = AboutBox() 
    129         self.welcomePanel = WelcomePanel() 
    130133 
    131134        # Add calculators - floating for usability 
     
    162165        """ 
    163166        pass 
    164  
    165     def showHelp(self, url): 
    166         """ 
    167         Open a local url in the default browser 
    168         """ 
    169         location = GuiUtils.HELP_DIRECTORY_LOCATION + url 
    170         try: 
    171             webbrowser.open('file://' + os.path.realpath(location)) 
    172         except webbrowser.Error as ex: 
    173             logging.warning("Cannot display help. %s" % ex) 
    174167 
    175168    def workspace(self): 
     
    341334            msg += " Please try again later." 
    342335            self.communicate.statusBarUpdateSignal.emit(msg) 
    343  
    344     def showWelcomeMessage(self): 
    345         """ Show the Welcome panel """ 
    346         self._workspace.workspace.addSubWindow(self.welcomePanel) 
    347         self.welcomePanel.show() 
    348336 
    349337    def addCallbacks(self): 
     
    726714        TODO: use QNetworkAccessManager to assure _helpLocation is valid 
    727715        """ 
    728         self.showHelp(self._helpLocation) 
     716        self._helpView.load(QUrl(self._helpLocation)) 
     717        self._helpView.show() 
    729718 
    730719    def actionTutorial(self): 
  • src/sas/qtgui/MainWindow/MainWindow.py

    r8353d90 r53c771e  
    11# UNLESS EXEPTIONALLY REQUIRED TRY TO AVOID IMPORTING ANY MODULES HERE 
    22# ESPECIALLY ANYTHING IN SAS, SASMODELS NAMESPACE 
    3 from PyQt5.QtWidgets import QMainWindow 
    4 from PyQt5.QtWidgets import QMdiArea 
    5 from PyQt5.QtWidgets import QSplashScreen 
    6 from PyQt5.QtWidgets import QApplication 
    7 from PyQt5.QtGui import QPixmap 
     3#from PyQt4 import QtGui 
     4from PyQt5.QtWidgets import * 
     5from PyQt5.QtGui import * 
    86 
    97# Local UI 
     
    7371    # Show the main SV window 
    7472    mainwindow = MainSasViewWindow() 
    75     mainwindow.showMaximized() 
     73    mainwindow.show() 
    7674 
    7775    # no more splash screen 
    7876    splash.finish(mainwindow) 
    79  
    80     # Time for the welcome window 
    81     mainwindow.guiManager.showWelcomeMessage() 
    8277 
    8378    # No need to .exec_ - the reactor takes care of it. 
  • src/sas/qtgui/MainWindow/UnitTesting/GuiManagerTest.py

    • Property mode changed from 100644 to 100755
    r8353d90 r53c771e  
    1919from sas.qtgui.MainWindow.AboutBox import AboutBox 
    2020from sas.qtgui.MainWindow.WelcomePanel import WelcomePanel 
    21 from sas.qtgui.Utilities.IPythonWidget import IPythonWidget 
     21#from sas.qtgui.Utilities.IPythonWidget import IPythonWidget 
    2222 
    2323from sas.qtgui.MainWindow.GuiManager import Acknowledgements, GuiManager 
  • src/sas/qtgui/MainWindow/UnitTesting/MainWindowTest.py

    r8353d90 r53c771e  
    1515from sas.qtgui.MainWindow.MainWindow import SplashScreen 
    1616from sas.qtgui.MainWindow.GuiManager import GuiManager 
    17 from sas.qtgui.Perspectives.Fitting import FittingPerspective 
    1817 
    1918if not QtWidgets.QApplication.instance(): 
     
    4140        self.assertIsInstance(splash, QtWidgets.QSplashScreen) 
    4241 
    43     def testWidgets(self): 
    44         """ Test enablement/disablement of widgets """ 
    45         # Open the main window 
    46         tmp_main = MainSasViewWindow(None) 
    47         tmp_main.showMaximized() 
    48         # See that only one subwindow is up 
    49         self.assertEqual(len(tmp_main.workspace.subWindowList()), 1) 
    50         # and that the subwindow is the fitting perspective 
    51         self.assertIsInstance(tmp_main.workspace.subWindowList()[0].widget(), 
    52                               FittingPerspective.FittingWindow) 
    53         # Show the message widget 
    54         tmp_main.guiManager.showWelcomeMessage() 
    55         # Assure it is visible and a part of the MdiArea 
    56         self.assertTrue(tmp_main.guiManager.welcomePanel.isVisible()) 
    57         self.assertEqual(len(tmp_main.workspace.subWindowList()), 2) 
    58  
    59         tmp_main.close() 
    60  
    6142    def testExit(self): 
    6243        """ 
  • src/sas/qtgui/Perspectives/Corfunc/CorfuncPerspective.py

    re90988c rcb4d219  
    55 
    66# global 
    7 from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg \ 
    8     as FigureCanvas 
    9 from matplotlib.figure import Figure 
    10 from numpy.linalg.linalg import LinAlgError 
    11  
    127from PyQt5 import QtCore 
    138from PyQt5 import QtGui, QtWidgets 
     
    2217from .UI.CorfuncPanel import Ui_CorfuncDialog 
    2318from .CorfuncUtils import WIDGETS as W 
     19 
     20from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg \ 
     21    as FigureCanvas 
     22from matplotlib.figure import Figure 
     23from 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) 
    139138 
    140139        self.model.itemChanged.connect(self.model_changed) 
     
    307306 
    308307    # 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  
    317308    @staticmethod 
    318309    def allowBatch(): 
     
    377368            self.setClosable(value=False) 
    378369            # Tell the MdiArea to close the container 
    379             if self.parent: 
    380                 self.parentWidget().close() 
     370            self.parentWidget().close() 
    381371            event.accept() 
    382372        else: 
  • src/sas/qtgui/Perspectives/Fitting/FittingOptions.py

    re90988c rd6b8a1d  
    33import os 
    44import types 
    5 import webbrowser 
    65 
    76from PyQt5 import QtCore 
    87from PyQt5 import QtGui 
    98from PyQt5 import QtWidgets 
     9from 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() 
    7578 
    7679    def assignValidators(self): 
     
    157160        Show the "Fitting options" section of help 
    158161        """ 
    159         tree_location = GuiUtils.HELP_DIRECTORY_LOCATION 
    160         tree_location += "/user/sasgui/perspectives/fitting/" 
     162        tree_location = GuiUtils.HELP_DIRECTORY_LOCATION + "/user/sasgui/perspectives/fitting/" 
    161163 
    162164        # Actual file anchor will depend on the combo box index 
     
    165167        helpfile = "optimizer.html#fit-" + self.current_fitter_id  
    166168        help_location = tree_location + helpfile 
    167         webbrowser.open('file://' + os.path.realpath(help_location)) 
     169        self.helpView.load(QtCore.QUrl(help_location)) 
     170        self.helpView.show() 
    168171 
    169172    def widgetFromOption(self, option_id, current_fitter=None): 
  • src/sas/qtgui/Perspectives/Fitting/FittingPerspective.py

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

    rd3c0b95 ra3c94b54  
    88from twisted.internet import threads 
    99import numpy as np 
    10 import webbrowser 
    1110 
    1211from PyQt5 import QtCore 
    1312from PyQt5 import QtGui 
    1413from PyQt5 import QtWidgets 
     14from 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 
    1519 
    1620from sasmodels import product 
     
    126130 
    127131        # Display HTML content 
    128         #self.setupHelp() 
     132        self.helpView = QtWebKitWidgets.QWebView() 
    129133 
    130134        # New font to display angstrom symbol 
     
    941945        Show the "Fitting" section of help 
    942946        """ 
    943         tree_location = "/user/sasgui/perspectives/fitting/" 
     947        tree_location = GuiUtils.HELP_DIRECTORY_LOCATION + "/user/sasgui/perspectives/fitting/" 
    944948 
    945949        # Actual file will depend on the current tab 
     
    951955            helpfile = "residuals_help.html" 
    952956        elif tab_id == 2: 
    953             helpfile = "resolution.html" 
     957            helpfile = "sm_help.html" 
    954958        elif tab_id == 3: 
    955             helpfile = "pd/polydispersity.html" 
     959            helpfile = "pd_help.html" 
    956960        elif tab_id == 4: 
    957             helpfile = "magnetism/magnetism.html" 
     961            helpfile = "mag_help.html" 
    958962        help_location = tree_location + helpfile 
    959963 
    960         self.showHelp(help_location) 
    961  
    962     def showHelp(self, url): 
    963         """ 
    964         Calls parent's method for opening an HTML page 
    965         """ 
    966         self.parent.showHelp(url) 
     964        content = QtCore.QUrl(help_location) 
     965        self.helpView.load(QtCore.QUrl(help_location)) 
     966        self.helpView.show() 
    967967 
    968968    def onDisplayMagneticAngles(self): 
  • src/sas/qtgui/Perspectives/Fitting/GPUOptions.py

    re90988c rc7ebb37  
    88 
    99import sas.qtgui.Utilities.GuiUtils as GuiUtils 
    10 from PyQt5 import QtGui, QtCore, QtWidgets 
     10from PyQt5 import QtGui, QtCore, QtWebKit, 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         # Display the page in default browser 
     174        # Test the system browser solution 
    175175        webbrowser.open('file://' + os.path.realpath(help_location)) 
    176176 
  • src/sas/qtgui/Perspectives/Fitting/MultiConstraint.py

    re147ce2 ra3c94b54  
    22Widget for parameter constraints. 
    33""" 
    4 import os 
    54from numpy import * 
    65 
     
    87from PyQt5 import QtGui 
    98from PyQt5 import QtWidgets 
    10 import webbrowser 
    119 
    1210import sas.qtgui.Utilities.GuiUtils as GuiUtils 
     
    130128        """ 
    131129        try: 
    132             help_location = GuiUtils.HELP_DIRECTORY_LOCATION + \ 
     130            location = GuiUtils.HELP_DIRECTORY_LOCATION + \ 
    133131            "/user/sasgui/perspectives/fitting/fitting_help.html#simultaneous-fits-with-constraints" 
    134             webbrowser.open('file://' + os.path.realpath(help_location)) 
     132 
     133            self.manager._helpView.load(QtCore.QUrl(location)) 
     134            self.manager._helpView.show() 
    135135        except AttributeError: 
    136136            # No manager defined - testing and standalone runs 
  • src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py

    re90988c rd1955d67  
    88from PyQt5 import QtCore 
    99from PyQt5 import QtGui, QtWidgets 
     10from PyQt5 import QtWebKit 
    1011 
    1112from twisted.internet import threads 
     
    6263        self._model_item = QtGui.QStandardItem() 
    6364 
     65        #self._helpView = QtWebKit.QWebView() 
    6466        self.detailsDialog = DetailsDialog(self) 
    6567        self.detailsDialog.cmdOK.clicked.connect(self.enabling) 
     
    8082        # no reason to have this widget resizable 
    8183        self.resize(self.minimumSizeHint()) 
     84        #self.setFixedSize(self.sizeHint()) 
    8285 
    8386        self.communicate = self._manager.communicator() 
     
    225228 
    226229        self.model = model 
    227         self.mapper.toFirst() 
    228230        self._data = GuiUtils.dataFromItem(self._model_item) 
    229231 
    230232        # Send the modified model item to DE for keeping in the model 
    231233        # Currently -unused 
    232         # self.communicate.updateModelFromPerspectiveSignal.emit(self._model_item) 
     234        #self.communicate.updateModelFromPerspectiveSignal.emit(self._model_item) 
    233235 
    234236        plot_data = GuiUtils.plotsFromCheckedItems(self._manager.filesWidget.model) 
     
    363365            if self._high_extrapolate: 
    364366                # for presentation in InvariantDetails 
    365                 qmax_plot = Q_MAXIMUM_PLOT * max(temp_data.x) 
     367                qmax_plot = Q_MAXIMUM_PLOT * max(temp_data.x) # self._data.x) 
    366368 
    367369                if qmax_plot > Q_MAXIMUM: 
     
    429431    def onHelp(self): 
    430432        """ Display help when clicking on Help button """ 
    431         treeLocation = "/user/sasgui/perspectives/invariant/invariant_help.html" 
    432         self.parent.showHelp(treeLocation) 
     433        treeLocation = GuiUtils.HELP_DIRECTORY_LOCATION + \ 
     434            "/user/sasgui/perspectives/invariant/invariant_help.html" 
     435        webbrowser.open('file://' + treeLocation) 
    433436 
    434437    def setupSlots(self): 
  • src/sas/qtgui/Perspectives/Invariant/UI/TabbedInvariantUI.ui

    r9387fe3 rd1955d67  
    142142                <widget class="QLineEdit" name="txtTotalQMin"> 
    143143                 <property name="enabled"> 
    144                   <bool>true</bool> 
     144                  <bool>false</bool> 
    145145                 </property> 
    146146                </widget> 
     
    156156                <widget class="QLineEdit" name="txtTotalQMax"> 
    157157                 <property name="enabled"> 
    158                   <bool>true</bool> 
     158                  <bool>false</bool> 
    159159                 </property> 
    160160                </widget> 
     
    192192           <widget class="QLineEdit" name="txtVolFract"> 
    193193            <property name="enabled"> 
    194              <bool>true</bool> 
     194             <bool>false</bool> 
    195195            </property> 
    196196            <property name="autoFillBackground"> 
     
    221221           <widget class="QLineEdit" name="txtVolFractErr"> 
    222222            <property name="enabled"> 
    223              <bool>true</bool> 
     223             <bool>false</bool> 
    224224            </property> 
    225225            <property name="frame"> 
     
    244244           <widget class="QLineEdit" name="txtSpecSurf"> 
    245245            <property name="enabled"> 
    246              <bool>true</bool> 
     246             <bool>false</bool> 
    247247            </property> 
    248248            <property name="frame"> 
     
    267267           <widget class="QLineEdit" name="txtSpecSurfErr"> 
    268268            <property name="enabled"> 
    269              <bool>true</bool> 
     269             <bool>false</bool> 
    270270            </property> 
    271271            <property name="frame"> 
     
    305305           <widget class="QLineEdit" name="txtInvariantTot"> 
    306306            <property name="enabled"> 
    307              <bool>true</bool> 
     307             <bool>false</bool> 
    308308            </property> 
    309309            <property name="toolTip"> 
     
    331331           <widget class="QLineEdit" name="txtInvariantTotErr"> 
    332332            <property name="enabled"> 
    333              <bool>true</bool> 
     333             <bool>false</bool> 
    334334            </property> 
    335335            <property name="frame"> 
     
    467467             <widget class="QLineEdit" name="txtExtrapolQMin"> 
    468468              <property name="enabled"> 
    469                <bool>true</bool> 
     469               <bool>false</bool> 
    470470              </property> 
    471471              <property name="toolTip"> 
    472472               <string>The minimum extrapolated q value.</string> 
    473               </property> 
    474               <property name="readOnly"> 
    475                <bool>true</bool> 
    476473              </property> 
    477474             </widget> 
     
    487484             <widget class="QLineEdit" name="txtExtrapolQMax"> 
    488485              <property name="enabled"> 
    489                <bool>true</bool> 
    490               </property> 
    491               <property name="readOnly"> 
    492                <bool>true</bool> 
     486               <bool>false</bool> 
    493487              </property> 
    494488             </widget> 
  • src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py

    re90988c r19fce84  
    2525        return 0.0 
    2626 
    27 NUMBER_OF_TERMS = 10 
    28 REGULARIZATION = 0.0001 
    29 BACKGROUND_INPUT = 0.0 
    30 MAX_DIST = 140.0 
    3127 
    3228# TODO: Modify plot references, don't just send new 
     
    5147        self._manager = parent 
    5248        self._model_item = QtGui.QStandardItem() 
     49        #self._helpView = QtWebKit.QWebView() 
     50 
    5351        self.communicate = GuiUtils.Communicate() 
    5452 
     
    229227        item = QtGui.QStandardItem("") 
    230228        self.model.setItem(WIDGETS.W_FILENAME, item) 
    231         item = QtGui.QStandardItem(str(BACKGROUND_INPUT)) 
     229        item = QtGui.QStandardItem('0.0') 
    232230        self.model.setItem(WIDGETS.W_BACKGROUND_INPUT, item) 
    233231        item = QtGui.QStandardItem("") 
     
    239237        item = QtGui.QStandardItem("") 
    240238        self.model.setItem(WIDGETS.W_SLIT_HEIGHT, item) 
    241         item = QtGui.QStandardItem(str(NUMBER_OF_TERMS)) 
     239        item = QtGui.QStandardItem("10") 
    242240        self.model.setItem(WIDGETS.W_NO_TERMS, item) 
    243         item = QtGui.QStandardItem(str(REGULARIZATION)) 
     241        item = QtGui.QStandardItem("0.0001") 
    244242        self.model.setItem(WIDGETS.W_REGULARIZATION, item) 
    245         item = QtGui.QStandardItem(str(MAX_DIST)) 
     243        item = QtGui.QStandardItem("140.0") 
    246244        self.model.setItem(WIDGETS.W_MAX_DIST, item) 
    247245        item = QtGui.QStandardItem("") 
     
    372370        Open the P(r) Inversion help browser 
    373371        """ 
    374         tree_location = "/user/sasgui/perspectives/pr/pr_help.html" 
     372        tree_location = (GuiUtils.HELP_DIRECTORY_LOCATION + 
     373                         "user/sasgui/perspectives/pr/pr_help.html") 
    375374 
    376375        # Actual file anchor will depend on the combo box index 
    377376        # Note that we can be clusmy here, since bad current_fitter_id 
    378377        # will just make the page displayed from the top 
    379         self._manager.showHelp(tree_location) 
     378        #self._helpView.load(QtCore.QUrl(tree_location)) 
     379        #self._helpView.show() 
    380380 
    381381    def toggleBgd(self): 
     
    439439    def getNFunc(self): 
    440440        """Get the n_func value from the GUI object""" 
    441         try: 
    442             nfunc = int(self.noOfTermsInput.text()) 
    443         except ValueError: 
    444             logging.error("Incorrect number of terms specified: %s" %self.noOfTermsInput.text()) 
    445             self.noOfTermsInput.setText(str(NUMBER_OF_TERMS)) 
    446             nfunc = NUMBER_OF_TERMS 
    447         return nfunc 
     441        return int(self.noOfTermsInput.text()) 
    448442 
    449443    def setCurrentData(self, data_ref): 
  • src/sas/qtgui/Plotting/SlicerParameters.py

    re90988c rd6b8a1d  
    77from PyQt5 import QtGui 
    88from PyQt5 import QtWidgets 
     9from PyQt5 import QtWebKitWidgets 
    910 
    1011import sas.qtgui.Utilities.GuiUtils as GuiUtils 
     
    8687        Display generic data averaging help 
    8788        """ 
    88         location = "/user/sasgui/guiframe/graph_help.html#d-data-averaging" 
    89         self.parent.showHelp(location) 
     89        location = "docs/sphinx-docs/build/html" + \ 
     90            "/user/sasgui/guiframe/graph_help.html#d-data-averaging" 
     91        self.helpView = QtWebKitWidgets.QWebView() 
     92        self.helpView.load(QtCore.QUrl(location)) 
     93        self.helpView.show() 
    9094 
    9195 
  • src/sas/qtgui/Utilities/GuiUtils.py

    r6cb305a rcb4d219  
    5858    # clean all these module variables and put them into a config class 
    5959    # that can be passed by sasview.py. 
    60     # logging.info(sys.executable) 
    61     # logging.info(str(sys.argv)) 
     60    #logging.info(sys.executable) 
     61    #logging.info(str(sys.argv)) 
    6262    from sas import sasview as sasview 
    6363    app_path = os.path.dirname(sasview.__file__) 
    64     # logging.info("Using application path: %s", app_path) 
     64    #logging.info("Using application path: %s", app_path) 
    6565    return app_path 
    6666 
     
    249249        if plot_item.isCheckable(): 
    250250            plot_data = plot_item.child(0).data() 
    251             if plot_data.id is not None and \ 
    252                    (plot_data.name == update_data.name or plot_data.id == update_data.id): 
    253             # if plot_data.id is not None and plot_data.id == update_data.id: 
     251            if plot_data.id is not None and plot_data.id == update_data.id: 
    254252                # replace data section in item 
    255253                plot_item.child(0).setData(update_data) 
     
    345343    for index in range(model_item.rowCount()): 
    346344        item = model_item.item(index) 
    347         if item.text() == filename and item.isCheckable() \ 
    348                 and item.checkState() == QtCore.Qt.Checked: 
     345        if item.text() == filename and item.isCheckable() and item.checkState() == QtCore.Qt.Checked: 
    349346            # Going 1 level deeper only 
    350347            for index_2 in range(item.rowCount()): 
     
    363360 
    364361    # Iterate over model looking for named items 
    365     item = list([i for i in [model_item.item(index) 
    366                              for index in range(model_item.rowCount())] 
    367                  if str(i.text()) == filename]) 
     362    item = list([i for i in [model_item.item(index) for index in range(model_item.rowCount())] if str(i.text()) == filename]) 
    368363    return item[0] if len(item)>0 else None 
    369364 
     
    401396    for index in range(model_item.rowCount()): 
    402397        item = model_item.item(index) 
    403  
     398        if item.isCheckable() and item.checkState() == QtCore.Qt.Checked: 
     399            # TODO: assure item type is correct (either data1/2D or Plotter) 
     400            plot_data.append((item, item.child(0).data())) 
    404401        # Going 1 level deeper only 
    405402        for index_2 in range(item.rowCount()): 
     
    408405                # TODO: assure item type is correct (either data1/2D or Plotter) 
    409406                plot_data.append((item_2, item_2.child(0).data())) 
    410  
    411         if item.isCheckable() and item.checkState() == QtCore.Qt.Checked: 
    412             # TODO: assure item type is correct (either data1/2D or Plotter) 
    413             plot_data.append((item, item.child(0).data())) 
    414407 
    415408    return plot_data 
  • src/sas/qtgui/Utilities/UnitTesting/GuiUtilsTest.py

    r6cb305a r0261bc1  
    100100        Test the QModelItem checkbox update method 
    101101        """ 
    102         # test_item = QtGui.QStandardItem() 
    103         # test_list = ['aa','11'] 
    104         # update_data = test_list 
    105         # name = "Black Sabbath" 
    106  
    107         # # update the item 
    108         # updateModelItemWithPlot(test_item, update_data, name) 
    109  
    110102        test_item = QtGui.QStandardItem() 
    111         update_data = Data1D(x=[1.0, 2.0, 3.0], y=[10.0, 11.0, 12.0]) 
     103        test_list = ['aa','11'] 
     104        update_data = test_list 
    112105        name = "Black Sabbath" 
    113         update_data.id = '[0]data0' 
    114         update_data.name = 'data0' 
     106 
    115107        # update the item 
    116108        updateModelItemWithPlot(test_item, update_data, name) 
    117  
     109         
    118110        # Make sure test_item got all data added 
    119111        self.assertEqual(test_item.child(0).text(), name) 
    120112        self.assertTrue(test_item.child(0).isCheckable()) 
    121         data_from_item = test_item.child(0).child(0).data() 
    122         self.assertIsInstance(data_from_item, Data1D) 
    123         self.assertSequenceEqual(list(data_from_item.x), [1.0, 2.0, 3.0]) 
    124         self.assertSequenceEqual(list(data_from_item.y), [10.0, 11.0, 12.0]) 
    125         self.assertEqual(test_item.rowCount(), 1) 
    126  
    127         # add another dataset (different from the first one) 
    128         update_data1 = Data1D(x=[1.1, 2.1, 3.1], y=[10.1, 11.1, 12.1]) 
    129         update_data1.id = '[0]data1' 
    130         update_data1.name = 'data1' 
    131         name1 = "Black Sabbath1" 
    132         # update the item and check number of rows 
    133         updateModelItemWithPlot(test_item, update_data1, name1) 
    134  
    135         self.assertEqual(test_item.rowCount(), 2) 
    136  
    137         # add another dataset (with the same name as the first one) 
    138         # check that number of rows was not changed but data have been updated 
    139         update_data2 = Data1D(x=[4.0, 5.0, 6.0], y=[13.0, 14.0, 15.0]) 
    140         update_data2.id = '[1]data0' 
    141         update_data2.name = 'data0' 
    142         name2 = "Black Sabbath2" 
    143         updateModelItemWithPlot(test_item, update_data2, name2) 
    144         self.assertEqual(test_item.rowCount(), 2) 
    145  
    146         data_from_item = test_item.child(0).child(0).data() 
    147         self.assertSequenceEqual(list(data_from_item.x), [4.0, 5.0, 6.0]) 
    148         self.assertSequenceEqual(list(data_from_item.y), [13.0, 14.0, 15.0]) 
     113        list_from_item = test_item.child(0).child(0).data() 
     114        self.assertIsInstance(list_from_item, list) 
     115        self.assertEqual(str(list_from_item[0]), test_list[0]) 
     116        self.assertEqual(str(list_from_item[1]), test_list[1]) 
    149117 
    150118 
     
    194162        # Make sure only the checked data is present 
    195163        # FRIDAY IN 
    196         self.assertIn(test_list0, plot_list[1]) 
     164        self.assertIn(test_list0, plot_list[0]) 
    197165        # SATURDAY IN 
    198         self.assertIn(test_list1, plot_list[0]) 
     166        self.assertIn(test_list1, plot_list[1]) 
    199167        # MONDAY NOT IN 
    200168        self.assertNotIn(test_list2, plot_list[0]) 
Note: See TracChangeset for help on using the changeset viewer.