Changeset e90988c in sasview for src/sas/qtgui
- Timestamp:
- Dec 14, 2017 9:51:02 AM (7 years ago)
- 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
- Location:
- src/sas/qtgui
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Calculators/DataOperationUtilityPanel.py
rd6b8a1d re90988c 110 110 documentation tree (after /doc/ ....". 111 111 """ 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) 121 114 122 115 def onClose(self): -
src/sas/qtgui/Calculators/DensityPanel.py
rd4881f6a re90988c 146 146 147 147 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) 151 150 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 382 382 documentation tree (after /doc/ ....". 383 383 """ 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) 392 386 393 387 def onReset(self): -
src/sas/qtgui/Calculators/KiessigPanel.py
rfbfc488 re90988c 38 38 documentation tree (after /doc/ ....". 39 39 """ 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) 49 42 50 43 def onCompute(self): -
src/sas/qtgui/Calculators/ResolutionCalculatorPanel.py
rd6b8a1d re90988c 366 366 documentation tree (after /doc/ ....". 367 367 """ 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) 377 370 378 371 def onReset(self): -
src/sas/qtgui/Calculators/SldPanel.py
rd4881f6a re90988c 213 213 214 214 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 47 47 documentation tree (after /doc/ ....". 48 48 """ 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) 58 51 59 52 def onBrowse(self): -
src/sas/qtgui/Calculators/UnitTesting/DataOperationUtilityTest.py
r53c771e re90988c 4 4 import logging 5 5 import unittest 6 import webbrowser 7 6 8 from PyQt5 import QtGui, QtWidgets 7 9 from PyQt5 import QtCore … … 119 121 def testHelp(self): 120 122 """ Assure help file is shown """ 121 # this should not rise123 self.widget.manager.showHelp = MagicMock() 122 124 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]) 123 128 124 129 def testOnReset(self): -
src/sas/qtgui/Calculators/UnitTesting/DensityCalculatorTest.py
r53c771e re90988c 121 121 def testHelp(self): 122 122 """ Assure help file is shown """ 123 124 # this should not rise123 self.widget.manager = QtWidgets.QWidget() 124 self.widget.manager.showHelp = MagicMock() 125 125 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]) 126 129 127 130 if __name__ == "__main__": -
src/sas/qtgui/Calculators/UnitTesting/GenericScatteringCalculatorTest.py
r53c771e re90988c 104 104 def testHelpButton(self): 105 105 """ Assure help file is shown """ 106 self.widget.manager.showHelp = MagicMock() 106 107 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]) 107 111 108 112 def testValidator(self): -
src/sas/qtgui/Calculators/UnitTesting/KiessigCalculatorTest.py
r53c771e re90988c 5 5 from PyQt5.QtCore import Qt 6 6 7 # TEMP8 #import sas.qtgui.path_prepare9 7 import path_prepare 10 8 from unittest.mock import MagicMock 11 9 12 10 from sas.qtgui.Calculators.KiessigPanel import KiessigPanel … … 35 33 def testHelp(self): 36 34 """ Assure help file is shown """ 37 38 # this should not rise35 self.widget.manager = QtWidgets.QWidget() 36 self.widget.manager.showHelp = MagicMock() 39 37 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]) 40 41 41 42 def testComplexEntryNumbers(self): -
src/sas/qtgui/Calculators/UnitTesting/ResolutionCalculatorPanelTest.py
r53c771e re90988c 240 240 """ Assure help file is shown """ 241 241 # this should not rise 242 self.widget.manager = QtWidgets.QWidget() 243 self.widget.manager.showHelp = MagicMock() 242 244 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]) 243 248 244 249 def testOnReset(self): -
src/sas/qtgui/Calculators/UnitTesting/SLDCalculatorTest.py
r53c771e re90988c 142 142 def testHelp(self): 143 143 """ Assure help file is shown """ 144 145 # this should not rise144 self.widget.manager = QtWidgets.QWidget() 145 self.widget.manager.showHelp = MagicMock() 146 146 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]) 147 150 148 151 if __name__ == "__main__": -
src/sas/qtgui/Calculators/UnitTesting/SlitSizeCalculatorTest.py
r53c771e re90988c 37 37 def testHelp(self): 38 38 """ Assure help file is shown """ 39 40 # this should not rise39 self.widget._parent = QtWidgets.QWidget() 40 self.widget._parent.showHelp = MagicMock() 41 41 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]) 42 45 43 46 def testBrowseButton(self): -
src/sas/qtgui/MainWindow/DataExplorer.py
rcb4d219 re90988c 8 8 from PyQt5 import QtGui 9 9 from PyQt5 import QtWidgets 10 from PyQt5 import QtWebKitWidgets11 10 12 11 from twisted.internet import threads … … 70 69 self.cmdHelp_2.clicked.connect(self.displayHelp) 71 70 72 # Display HTML content73 self._helpView = QtWebKitWidgets.QWebView()74 75 71 # Fill in the perspectives combo 76 72 self.initPerspectives() … … 141 137 Show the "Loading data" section of help 142 138 """ 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() 139 tree_location = "/user/sasgui/guiframe/data_explorer_help.html" 140 self.parent.showHelp(tree_location) 147 141 148 142 def enableGraphCombo(self, combo_text): -
src/sas/qtgui/MainWindow/GuiManager.py
r8353d90 re90988c 87 87 self.statusBarSetup() 88 88 89 # Current help file90 self._helpView = QWebView()91 89 # Needs URL like path, so no path.join() here 92 90 self._helpLocation = GuiUtils.HELP_DIRECTORY_LOCATION + "/index.html" … … 164 162 """ 165 163 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) 166 174 167 175 def workspace(self): … … 718 726 TODO: use QNetworkAccessManager to assure _helpLocation is valid 719 727 """ 720 self._helpView.load(QUrl(self._helpLocation)) 721 self._helpView.show() 728 self.showHelp(self._helpLocation) 722 729 723 730 def actionTutorial(self): -
src/sas/qtgui/Perspectives/Corfunc/CorfuncPerspective.py
r50bfab0 re90988c 5 5 6 6 # 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 7 12 from PyQt5 import QtCore 8 13 from PyQt5 import QtGui, QtWidgets … … 17 22 from .UI.CorfuncPanel import Ui_CorfuncDialog 18 23 from .CorfuncUtils import WIDGETS as W 19 20 from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg \21 as FigureCanvas22 from matplotlib.figure import Figure23 from numpy.linalg.linalg import LinAlgError24 24 25 25 … … 136 136 self.cmdCalculateBg.clicked.connect(self.calculate_background) 137 137 self.cmdCalculateBg.setEnabled(False) 138 self.cmdHelp.clicked.connect(self.showHelp) 138 139 139 140 self.model.itemChanged.connect(self.model_changed) … … 306 307 307 308 # 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 308 317 @staticmethod 309 318 def allowBatch(): -
src/sas/qtgui/Perspectives/Fitting/FittingOptions.py
rd6b8a1d re90988c 3 3 import os 4 4 import types 5 import webbrowser 5 6 6 7 from PyQt5 import QtCore 7 8 from PyQt5 import QtGui 8 9 from PyQt5 import QtWidgets 9 from PyQt5 import QtWebKitWidgets10 10 11 11 from sas.qtgui.UI import images_rc … … 73 73 # OK has to be initialized to True, after initial validator setup 74 74 self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(True) 75 76 # Display HTML content77 self.helpView = QtWebKitWidgets.QWebView()78 75 79 76 def assignValidators(self): … … 160 157 Show the "Fitting options" section of help 161 158 """ 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/" 163 161 164 162 # Actual file anchor will depend on the combo box index … … 167 165 helpfile = "optimizer.html#fit-" + self.current_fitter_id 168 166 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)) 171 168 172 169 def widgetFromOption(self, option_id, current_fitter=None): -
src/sas/qtgui/Perspectives/Fitting/FittingPerspective.py
r7c487846 re90988c 13 13 from sas.qtgui.Perspectives.Fitting.FittingOptions import FittingOptions 14 14 from sas.qtgui.Perspectives.Fitting.GPUOptions import GPUOptions 15 #from sas.qtgui.Perspectives.Fitting import ModelUtilities16 15 17 16 class FittingWindow(QtWidgets.QTabWidget): -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r0261bc1 re90988c 8 8 from twisted.internet import threads 9 9 import numpy as np 10 import webbrowser 10 11 11 12 from PyQt5 import QtCore 12 13 from PyQt5 import QtGui 13 14 from PyQt5 import QtWidgets 14 from PyQt5 import QtWebKitWidgets15 # 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 QtWebEngineWidgets19 15 20 16 from sasmodels import product … … 127 123 128 124 # Display HTML content 129 self.helpView = QtWebKitWidgets.QWebView()125 #self.setupHelp() 130 126 131 127 # New font to display angstrom symbol … … 662 658 Show the "Fitting" section of help 663 659 """ 664 tree_location = GuiUtils.HELP_DIRECTORY_LOCATION +"/user/sasgui/perspectives/fitting/"660 tree_location = "/user/sasgui/perspectives/fitting/" 665 661 666 662 # Actual file will depend on the current tab … … 672 668 helpfile = "residuals_help.html" 673 669 elif tab_id == 2: 674 helpfile = " sm_help.html"670 helpfile = "resolution.html" 675 671 elif tab_id == 3: 676 helpfile = "pd _help.html"672 helpfile = "pd/polydispersity.html" 677 673 elif tab_id == 4: 678 helpfile = "mag _help.html"674 helpfile = "magnetism/magnetism.html" 679 675 help_location = tree_location + helpfile 680 676 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) 684 684 685 685 def onDisplayMagneticAngles(self): -
src/sas/qtgui/Perspectives/Fitting/GPUOptions.py
rc7ebb37 re90988c 8 8 9 9 import sas.qtgui.Utilities.GuiUtils as GuiUtils 10 from PyQt5 import QtGui, QtCore, QtW ebKit, QtWidgets10 from PyQt5 import QtGui, QtCore, QtWidgets 11 11 from sas.qtgui.Perspectives.Fitting.UI.GPUOptionsUI import Ui_GPUOptions 12 12 from sas.qtgui.Perspectives.Fitting.UI.GPUTestResultsUI import Ui_GPUTestResults … … 172 172 help_location += "/user/sasgui/perspectives/fitting/gpu_setup.html" 173 173 help_location += "#device-selection" 174 # Test the system browser solution174 # Display the page in default browser 175 175 webbrowser.open('file://' + os.path.realpath(help_location)) 176 176 -
src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py
r9387fe3 re90988c 8 8 from PyQt5 import QtCore 9 9 from PyQt5 import QtGui, QtWidgets 10 from PyQt5 import QtWebKit11 10 12 11 from twisted.internet import threads … … 63 62 self._model_item = QtGui.QStandardItem() 64 63 65 #self._helpView = QtWebKit.QWebView()66 64 self.detailsDialog = DetailsDialog(self) 67 65 self.detailsDialog.cmdOK.clicked.connect(self.enabling) … … 431 429 def onHelp(self): 432 430 """ 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) 436 433 437 434 def setupSlots(self): -
src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py
r50bfab0 re90988c 51 51 self._manager = parent 52 52 self._model_item = QtGui.QStandardItem() 53 #self._helpView = QtWebKit.QWebView()54 55 53 self.communicate = GuiUtils.Communicate() 56 54 … … 374 372 Open the P(r) Inversion help browser 375 373 """ 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" 378 375 379 376 # Actual file anchor will depend on the combo box index 380 377 # Note that we can be clusmy here, since bad current_fitter_id 381 378 # 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) 384 380 385 381 def toggleBgd(self): -
src/sas/qtgui/Plotting/SlicerParameters.py
rd6b8a1d re90988c 7 7 from PyQt5 import QtGui 8 8 from PyQt5 import QtWidgets 9 from PyQt5 import QtWebKitWidgets10 9 11 10 import sas.qtgui.Utilities.GuiUtils as GuiUtils … … 87 86 Display generic data averaging help 88 87 """ 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() 88 location = "/user/sasgui/guiframe/graph_help.html#d-data-averaging" 89 self.parent.showHelp(location) 94 90 95 91
Note: See TracChangeset
for help on using the changeset viewer.