Changes in / [a3c94b54:570e091] in sasview
- Files:
-
- 2 added
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
docs/sphinx-docs/build_sphinx.py
rdf72475 re90988c 220 220 print("=== Build HTML Docs from ReST Files ===") 221 221 subprocess.call(["sphinx-build", 222 "-b", " html", # Builder name. TODO: accept as arg to setup.py.222 "-b", "qthelp", # Builder name. TODO: accept as arg to setup.py. 223 223 "-d", joinpath(SPHINX_BUILD, "doctrees"), 224 224 SPHINX_SOURCE, -
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/GUITests.py
r6b0c2f6 r0595bb7 61 61 from Perspectives.Invariant.UnitTesting import InvariantPerspectiveTest 62 62 63 64 63 def suite(): 65 64 suites = ( … … 117 116 unittest.makeSuite(InvariantPerspectiveTest.InvariantPerspectiveTest, 'test'), 118 117 unittest.makeSuite(InvariantDetailsTest.InvariantDetailsTest, 'test'), 118 # Inversion 119 unittest.makeSuite(InversionPerspectiveTest.InversionTest, 'test'), 119 120 ) 120 121 return unittest.TestSuite(suites) -
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
rd1955d67 re90988c 86 86 # Set up the status bar 87 87 self.statusBarSetup() 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() 88 94 89 # Needs URL like path, so no path.join() here 95 90 self._helpLocation = GuiUtils.HELP_DIRECTORY_LOCATION + "/index.html" … … 99 94 "_downloads", 100 95 "Tutorial.pdf")) 96 101 97 def addWidgets(self): 102 98 """ … … 131 127 self.ackWidget = Acknowledgements() 132 128 self.aboutWidget = AboutBox() 129 self.welcomePanel = WelcomePanel() 133 130 134 131 # Add calculators - floating for usability … … 165 162 """ 166 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) 167 174 168 175 def workspace(self): … … 334 341 msg += " Please try again later." 335 342 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() 336 348 337 349 def addCallbacks(self): … … 714 726 TODO: use QNetworkAccessManager to assure _helpLocation is valid 715 727 """ 716 self._helpView.load(QUrl(self._helpLocation)) 717 self._helpView.show() 728 self.showHelp(self._helpLocation) 718 729 719 730 def actionTutorial(self): -
src/sas/qtgui/MainWindow/MainWindow.py
r53c771e r8353d90 1 1 # UNLESS EXEPTIONALLY REQUIRED TRY TO AVOID IMPORTING ANY MODULES HERE 2 2 # ESPECIALLY ANYTHING IN SAS, SASMODELS NAMESPACE 3 #from PyQt4 import QtGui 4 from PyQt5.QtWidgets import * 5 from PyQt5.QtGui import * 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 6 8 7 9 # Local UI … … 71 73 # Show the main SV window 72 74 mainwindow = MainSasViewWindow() 73 mainwindow.show ()75 mainwindow.showMaximized() 74 76 75 77 # no more splash screen 76 78 splash.finish(mainwindow) 79 80 # Time for the welcome window 81 mainwindow.guiManager.showWelcomeMessage() 77 82 78 83 # No need to .exec_ - the reactor takes care of it. -
src/sas/qtgui/MainWindow/UnitTesting/GuiManagerTest.py
- Property mode changed from 100755 to 100644
r53c771e r8353d90 19 19 from sas.qtgui.MainWindow.AboutBox import AboutBox 20 20 from sas.qtgui.MainWindow.WelcomePanel import WelcomePanel 21 #from sas.qtgui.Utilities.IPythonWidget import IPythonWidget21 from sas.qtgui.Utilities.IPythonWidget import IPythonWidget 22 22 23 23 from sas.qtgui.MainWindow.GuiManager import Acknowledgements, GuiManager -
src/sas/qtgui/MainWindow/UnitTesting/MainWindowTest.py
r53c771e r8353d90 15 15 from sas.qtgui.MainWindow.MainWindow import SplashScreen 16 16 from sas.qtgui.MainWindow.GuiManager import GuiManager 17 from sas.qtgui.Perspectives.Fitting import FittingPerspective 17 18 18 19 if not QtWidgets.QApplication.instance(): … … 40 41 self.assertIsInstance(splash, QtWidgets.QSplashScreen) 41 42 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 42 61 def testExit(self): 43 62 """ -
src/sas/qtgui/Perspectives/Corfunc/CorfuncPerspective.py
rcb4d219 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(): … … 368 377 self.setClosable(value=False) 369 378 # Tell the MdiArea to close the container 370 self.parentWidget().close() 379 if self.parent: 380 self.parentWidget().close() 371 381 event.accept() 372 382 else: -
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
ra3c94b54 rd3c0b95 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 … … 130 126 131 127 # Display HTML content 132 self.helpView = QtWebKitWidgets.QWebView()128 #self.setupHelp() 133 129 134 130 # New font to display angstrom symbol … … 945 941 Show the "Fitting" section of help 946 942 """ 947 tree_location = GuiUtils.HELP_DIRECTORY_LOCATION +"/user/sasgui/perspectives/fitting/"943 tree_location = "/user/sasgui/perspectives/fitting/" 948 944 949 945 # Actual file will depend on the current tab … … 955 951 helpfile = "residuals_help.html" 956 952 elif tab_id == 2: 957 helpfile = " sm_help.html"953 helpfile = "resolution.html" 958 954 elif tab_id == 3: 959 helpfile = "pd _help.html"955 helpfile = "pd/polydispersity.html" 960 956 elif tab_id == 4: 961 helpfile = "mag _help.html"957 helpfile = "magnetism/magnetism.html" 962 958 help_location = tree_location + helpfile 963 959 964 content = QtCore.QUrl(help_location) 965 self.helpView.load(QtCore.QUrl(help_location)) 966 self.helpView.show() 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) 967 967 968 968 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/Fitting/MultiConstraint.py
ra3c94b54 re147ce2 2 2 Widget for parameter constraints. 3 3 """ 4 import os 4 5 from numpy import * 5 6 … … 7 8 from PyQt5 import QtGui 8 9 from PyQt5 import QtWidgets 10 import webbrowser 9 11 10 12 import sas.qtgui.Utilities.GuiUtils as GuiUtils … … 128 130 """ 129 131 try: 130 location = GuiUtils.HELP_DIRECTORY_LOCATION + \132 help_location = GuiUtils.HELP_DIRECTORY_LOCATION + \ 131 133 "/user/sasgui/perspectives/fitting/fitting_help.html#simultaneous-fits-with-constraints" 132 133 self.manager._helpView.load(QtCore.QUrl(location)) 134 self.manager._helpView.show() 134 webbrowser.open('file://' + os.path.realpath(help_location)) 135 135 except AttributeError: 136 136 # No manager defined - testing and standalone runs -
src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py
rd1955d67 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) … … 82 80 # no reason to have this widget resizable 83 81 self.resize(self.minimumSizeHint()) 84 #self.setFixedSize(self.sizeHint())85 82 86 83 self.communicate = self._manager.communicator() … … 228 225 229 226 self.model = model 227 self.mapper.toFirst() 230 228 self._data = GuiUtils.dataFromItem(self._model_item) 231 229 232 230 # Send the modified model item to DE for keeping in the model 233 231 # Currently -unused 234 # self.communicate.updateModelFromPerspectiveSignal.emit(self._model_item)232 # self.communicate.updateModelFromPerspectiveSignal.emit(self._model_item) 235 233 236 234 plot_data = GuiUtils.plotsFromCheckedItems(self._manager.filesWidget.model) … … 365 363 if self._high_extrapolate: 366 364 # for presentation in InvariantDetails 367 qmax_plot = Q_MAXIMUM_PLOT * max(temp_data.x) # self._data.x)365 qmax_plot = Q_MAXIMUM_PLOT * max(temp_data.x) 368 366 369 367 if qmax_plot > Q_MAXIMUM: … … 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/Invariant/UI/TabbedInvariantUI.ui
rd1955d67 r9387fe3 142 142 <widget class="QLineEdit" name="txtTotalQMin"> 143 143 <property name="enabled"> 144 <bool> false</bool>144 <bool>true</bool> 145 145 </property> 146 146 </widget> … … 156 156 <widget class="QLineEdit" name="txtTotalQMax"> 157 157 <property name="enabled"> 158 <bool> false</bool>158 <bool>true</bool> 159 159 </property> 160 160 </widget> … … 192 192 <widget class="QLineEdit" name="txtVolFract"> 193 193 <property name="enabled"> 194 <bool> false</bool>194 <bool>true</bool> 195 195 </property> 196 196 <property name="autoFillBackground"> … … 221 221 <widget class="QLineEdit" name="txtVolFractErr"> 222 222 <property name="enabled"> 223 <bool> false</bool>223 <bool>true</bool> 224 224 </property> 225 225 <property name="frame"> … … 244 244 <widget class="QLineEdit" name="txtSpecSurf"> 245 245 <property name="enabled"> 246 <bool> false</bool>246 <bool>true</bool> 247 247 </property> 248 248 <property name="frame"> … … 267 267 <widget class="QLineEdit" name="txtSpecSurfErr"> 268 268 <property name="enabled"> 269 <bool> false</bool>269 <bool>true</bool> 270 270 </property> 271 271 <property name="frame"> … … 305 305 <widget class="QLineEdit" name="txtInvariantTot"> 306 306 <property name="enabled"> 307 <bool> false</bool>307 <bool>true</bool> 308 308 </property> 309 309 <property name="toolTip"> … … 331 331 <widget class="QLineEdit" name="txtInvariantTotErr"> 332 332 <property name="enabled"> 333 <bool> false</bool>333 <bool>true</bool> 334 334 </property> 335 335 <property name="frame"> … … 467 467 <widget class="QLineEdit" name="txtExtrapolQMin"> 468 468 <property name="enabled"> 469 <bool> false</bool>469 <bool>true</bool> 470 470 </property> 471 471 <property name="toolTip"> 472 472 <string>The minimum extrapolated q value.</string> 473 </property> 474 <property name="readOnly"> 475 <bool>true</bool> 473 476 </property> 474 477 </widget> … … 484 487 <widget class="QLineEdit" name="txtExtrapolQMax"> 485 488 <property name="enabled"> 486 <bool>false</bool> 489 <bool>true</bool> 490 </property> 491 <property name="readOnly"> 492 <bool>true</bool> 487 493 </property> 488 494 </widget> -
src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py
r19fce84 re90988c 25 25 return 0.0 26 26 27 NUMBER_OF_TERMS = 10 28 REGULARIZATION = 0.0001 29 BACKGROUND_INPUT = 0.0 30 MAX_DIST = 140.0 27 31 28 32 # TODO: Modify plot references, don't just send new … … 47 51 self._manager = parent 48 52 self._model_item = QtGui.QStandardItem() 49 #self._helpView = QtWebKit.QWebView()50 51 53 self.communicate = GuiUtils.Communicate() 52 54 … … 227 229 item = QtGui.QStandardItem("") 228 230 self.model.setItem(WIDGETS.W_FILENAME, item) 229 item = QtGui.QStandardItem( '0.0')231 item = QtGui.QStandardItem(str(BACKGROUND_INPUT)) 230 232 self.model.setItem(WIDGETS.W_BACKGROUND_INPUT, item) 231 233 item = QtGui.QStandardItem("") … … 237 239 item = QtGui.QStandardItem("") 238 240 self.model.setItem(WIDGETS.W_SLIT_HEIGHT, item) 239 item = QtGui.QStandardItem( "10")241 item = QtGui.QStandardItem(str(NUMBER_OF_TERMS)) 240 242 self.model.setItem(WIDGETS.W_NO_TERMS, item) 241 item = QtGui.QStandardItem( "0.0001")243 item = QtGui.QStandardItem(str(REGULARIZATION)) 242 244 self.model.setItem(WIDGETS.W_REGULARIZATION, item) 243 item = QtGui.QStandardItem( "140.0")245 item = QtGui.QStandardItem(str(MAX_DIST)) 244 246 self.model.setItem(WIDGETS.W_MAX_DIST, item) 245 247 item = QtGui.QStandardItem("") … … 370 372 Open the P(r) Inversion help browser 371 373 """ 372 tree_location = (GuiUtils.HELP_DIRECTORY_LOCATION + 373 "user/sasgui/perspectives/pr/pr_help.html") 374 tree_location = "/user/sasgui/perspectives/pr/pr_help.html" 374 375 375 376 # Actual file anchor will depend on the combo box index 376 377 # Note that we can be clusmy here, since bad current_fitter_id 377 378 # will just make the page displayed from the top 378 #self._helpView.load(QtCore.QUrl(tree_location)) 379 #self._helpView.show() 379 self._manager.showHelp(tree_location) 380 380 381 381 def toggleBgd(self): … … 439 439 def getNFunc(self): 440 440 """Get the n_func value from the GUI object""" 441 return int(self.noOfTermsInput.text()) 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 442 448 443 449 def setCurrentData(self, data_ref): -
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 -
src/sas/qtgui/Utilities/GuiUtils.py
rcb4d219 r6cb305a 58 58 # clean all these module variables and put them into a config class 59 59 # 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)) 62 62 from sas import sasview as sasview 63 63 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) 65 65 return app_path 66 66 … … 249 249 if plot_item.isCheckable(): 250 250 plot_data = plot_item.child(0).data() 251 if plot_data.id is not None and plot_data.id == update_data.id: 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: 252 254 # replace data section in item 253 255 plot_item.child(0).setData(update_data) … … 343 345 for index in range(model_item.rowCount()): 344 346 item = model_item.item(index) 345 if item.text() == filename and item.isCheckable() and item.checkState() == QtCore.Qt.Checked: 347 if item.text() == filename and item.isCheckable() \ 348 and item.checkState() == QtCore.Qt.Checked: 346 349 # Going 1 level deeper only 347 350 for index_2 in range(item.rowCount()): … … 360 363 361 364 # Iterate over model looking for named items 362 item = list([i for i in [model_item.item(index) for index in range(model_item.rowCount())] if str(i.text()) == filename]) 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]) 363 368 return item[0] if len(item)>0 else None 364 369 … … 396 401 for index in range(model_item.rowCount()): 397 402 item = model_item.item(index) 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())) 403 401 404 # Going 1 level deeper only 402 405 for index_2 in range(item.rowCount()): … … 405 408 # TODO: assure item type is correct (either data1/2D or Plotter) 406 409 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())) 407 414 408 415 return plot_data -
src/sas/qtgui/Utilities/UnitTesting/GuiUtilsTest.py
r0261bc1 r6cb305a 100 100 Test the QModelItem checkbox update method 101 101 """ 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 102 110 test_item = QtGui.QStandardItem() 103 test_list = ['aa','11'] 104 update_data = test_list 111 update_data = Data1D(x=[1.0, 2.0, 3.0], y=[10.0, 11.0, 12.0]) 105 112 name = "Black Sabbath" 106 113 update_data.id = '[0]data0' 114 update_data.name = 'data0' 107 115 # update the item 108 116 updateModelItemWithPlot(test_item, update_data, name) 109 117 110 118 # Make sure test_item got all data added 111 119 self.assertEqual(test_item.child(0).text(), name) 112 120 self.assertTrue(test_item.child(0).isCheckable()) 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]) 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]) 117 149 118 150 … … 162 194 # Make sure only the checked data is present 163 195 # FRIDAY IN 164 self.assertIn(test_list0, plot_list[ 0])196 self.assertIn(test_list0, plot_list[1]) 165 197 # SATURDAY IN 166 self.assertIn(test_list1, plot_list[ 1])198 self.assertIn(test_list1, plot_list[0]) 167 199 # MONDAY NOT IN 168 200 self.assertNotIn(test_list2, plot_list[0])
Note: See TracChangeset
for help on using the changeset viewer.