Changeset a90c9c5 in sasview for src/sas/qtgui
- Timestamp:
- Feb 5, 2018 5:33: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:
- 725d9c06
- Parents:
- 14ec91c5
- Location:
- src/sas/qtgui/Perspectives/Fitting
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/ConstraintWidget.py
r14ec91c5 ra90c9c5 94 94 95 95 # External signals 96 self.parent.tabsModifiedSignal.connect(self. onModifiedTabs)96 self.parent.tabsModifiedSignal.connect(self.initializeFitList) 97 97 98 98 def updateSignalsFromTab(self, tab=None): … … 283 283 self.current_cell = self.tblTabList.item(row, column).data(0) 284 284 285 def onModifiedTabs(self):286 """287 Respond to tabs being deleted by deleting involved constraints288 289 This should probably be done in FittingWidget as it is the owner of290 all the fitting data, but I want to keep the FW oblivious about291 dependence on other FW tabs, so enforcing the constraint deletion here.292 """293 # Get the list of all constraints from querying the table294 #constraints = getConstraintsForModel()295 296 # Get the current list of tabs297 #tabs = ObjectLibrary.listObjects()298 299 # Check if any of the constraint dependencies got deleted300 # Check the list of constraints301 self.initializeFitList()302 pass303 304 285 def onFitComplete(self, result): 305 286 """ … … 677 658 # Update the tab 678 659 constrained_tab.addConstraintToRow(constraint, constrained_row) 679 pass -
src/sas/qtgui/Perspectives/Fitting/UI/ComplexConstraintUI.ui
r14ec91c5 ra90c9c5 166 166 </property> 167 167 <property name="default"> 168 <bool> true</bool>168 <bool>false</bool> 169 169 </property> 170 170 </widget> -
src/sas/qtgui/Perspectives/Fitting/UI/MultiConstraintUI.ui
r14ec91c5 ra90c9c5 152 152 </property> 153 153 <property name="default"> 154 <bool> true</bool>154 <bool>false</bool> 155 155 </property> 156 156 </widget> -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/ComplexConstraintTest.py
rda9a0722 ra90c9c5 18 18 from sas.qtgui.Perspectives.Fitting.ComplexConstraint import ComplexConstraint 19 19 20 #if not QtWidgets.QApplication.instance(): 21 # app = QtWidgets.QApplication(sys.argv) 22 app = QtWidgets.QApplication(sys.argv) 20 if not QtWidgets.QApplication.instance(): 21 app = QtWidgets.QApplication(sys.argv) 23 22 24 23 class dummy_manager(object): -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/ConstraintWidgetTest.py
r14ec91c5 ra90c9c5 7 7 from PyQt5 import QtGui, QtCore, QtWidgets 8 8 from PyQt5 import QtWebKit 9 from PyQt5.QtTest import QTest 9 10 10 11 # set up import paths … … 12 13 13 14 import sas.qtgui.Utilities.ObjectLibrary as ObjectLibrary 15 import sas.qtgui.Utilities.GuiUtils as GuiUtils 16 from sas.qtgui.Plotting.PlotterData import Data1D 14 17 15 18 # Local 16 19 from sas.qtgui.Perspectives.Fitting.ConstraintWidget import ConstraintWidget 17 20 from sas.qtgui.Perspectives.Fitting.Constraint import Constraint 21 from sas.qtgui.Perspectives.Fitting.FittingPerspective import FittingWindow 18 22 19 23 if not QtWidgets.QApplication.instance(): 20 24 app = QtWidgets.QApplication(sys.argv) 25 #app = QtWidgets.QApplication(sys.argv) 21 26 22 27 class ConstraintWidgetTest(unittest.TestCase): … … 24 29 def setUp(self): 25 30 '''Create ConstraintWidget dialog''' 26 class dummy_ perspective(QtWidgets.QTabWidget):27 tabsModifiedSignal = QtCore.pyqtSignal()28 def __init__(self):29 super(dummy_perspective, self).__init__()30 pass31 class dummy_manager(object): 32 def communicator(self): 33 return GuiUtils.Communicate() 34 def communicate(self): 35 return GuiUtils.Communicate() 31 36 32 self.widget = ConstraintWidget(parent=dummy_perspective()) 37 '''Create the perspective''' 38 self.perspective = FittingWindow(dummy_manager()) 39 40 self.widget = ConstraintWidget(parent=self.perspective) 33 41 34 42 # Example constraint object … … 52 60 self.assertEqual(self.widget.tblTabList.columnCount(), 4) 53 61 self.assertEqual(self.widget.tblConstraints.columnCount(), 1) 62 # Data accept 63 self.assertFalse(self.widget.acceptsData()) 64 # By default, the constraint table is disabled 65 self.assertFalse(self.widget.tblConstraints.isEnabled()) 54 66 55 def testLabels(self): 56 ''' various labels on the widget ''' 57 # params related setup 58 pass 67 def testOnFitTypeChange(self): 68 ''' test the single/batch fit switch ''' 69 self.widget.initializeFitList = MagicMock() 70 # Assure current type is Single 71 self.assertEqual(self.widget.currentType, "FitPage") 72 # click on "batch" 73 QTest.mouseClick(self.widget.btnBatch, QtCore.Qt.LeftButton) 74 app.processEvents() 75 # See what the current type is now 76 self.assertEqual(self.widget.currentType, "BatchPage") 77 # See if the list is getting initialized 78 self.assertTrue(self.widget.initializeFitList.called) 79 # Go back to single fit 80 QTest.mouseClick(self.widget.btnSingle, QtCore.Qt.LeftButton) 81 app.processEvents() 82 # See what the current type is now 83 self.assertEqual(self.widget.currentType, "FitPage") 59 84 60 def testTooltip(self): 61 ''' test the tooltip''' 85 def testGetTabsForFit(self): 86 ''' Test the fitting tab list ''' 87 self.assertEqual(self.widget.getTabsForFit(),[]) 88 # Add some tabs 62 89 pass 63 90 … … 69 96 70 97 self.assertFalse(self.widget.isTabImportable(None)) 71 self.assertTrue(self.widget.isTabImportable("FitTab333333")) 72 self.assertFalse(self.widget.isTabImportable("BatchTab")) 98 self.assertFalse(self.widget.isTabImportable("BatchTab1")) 73 99 self.assertFalse(self.widget.isTabImportable("BatchTab")) 74 100 75 pass 101 def testOnTabCellEdit(self): 102 ''' test what happens on monicker edit ''' 103 # Mock the datafromitem() call from FittingWidget 104 data = Data1D(x=[1,2], y=[1,2]) 105 GuiUtils.dataFromItem = MagicMock(return_value=data) 106 item = QtGui.QStandardItem("test") 107 self.perspective.addFit([item]) 76 108 77 109 def testUpdateFitLine(self):
Note: See TracChangeset
for help on using the changeset viewer.