Changeset 676f137 in sasview
- Timestamp:
- Jan 11, 2018 8:04:58 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:
- be8f4b0
- Parents:
- 570e091
- Location:
- src/sas/qtgui
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/GUITests.py
r570e091 r676f137 57 57 from Perspectives.Fitting.UnitTesting import FittingOptionsTest 58 58 from Perspectives.Fitting.UnitTesting import MultiConstraintTest 59 from Perspectives.Fitting.UnitTesting import ConstraintWidgetTest 59 60 60 61 # Invariant 61 62 from Perspectives.Invariant.UnitTesting import InvariantPerspectiveTest 63 64 # Inversion 65 from Perspectives.Inversion.UnitTesting import InversionPerspectiveTest 62 66 63 67 def suite(): … … 113 117 unittest.makeSuite(FittingOptionsTest.FittingOptionsTest, 'test'), 114 118 unittest.makeSuite(MultiConstraintTest.MultiConstraintTest, 'test'), 119 unittest.makeSuite(ConstraintWidgetTest.ConstraintWidgetTest, 'test'), 120 115 121 # Invariant 116 122 unittest.makeSuite(InvariantPerspectiveTest.InvariantPerspectiveTest, 'test'), 117 unittest.makeSuite(InvariantDetailsTest.InvariantDetailsTest, 'test'),118 123 # Inversion 119 124 unittest.makeSuite(InversionPerspectiveTest.InversionTest, 'test'), 120 )125 ) 121 126 return unittest.TestSuite(suites) 122 127 -
src/sas/qtgui/MainWindow/GuiManager.py
re90988c r676f137 185 185 186 186 # Save users from themselves... 187 if isinstance(self._current_perspective, Perspectives.PERSPECTIVES[str(perspective_name)]):188 189 return187 #if isinstance(self._current_perspective, Perspectives.PERSPECTIVES[str(perspective_name)]): 188 self.setupPerspectiveMenubarOptions(self._current_perspective) 189 # return 190 190 191 191 # Close the previous perspective … … 623 623 def actionConstrained_Fit(self): 624 624 """ 625 """ 626 print("actionConstrained_Fit TRIGGERED") 627 pass 625 Add a new Constrained and Simult. Fit page in the fitting perspective. 626 """ 627 per = self.perspective() 628 if not isinstance(per, FittingWindow): 629 return 630 per.addConstraintTab() 628 631 629 632 def actionCombine_Batch_Fit(self): -
src/sas/qtgui/Perspectives/Fitting/FittingPerspective.py
re90988c r676f137 11 11 12 12 from sas.qtgui.Perspectives.Fitting.FittingWidget import FittingWidget 13 from sas.qtgui.Perspectives.Fitting.ConstraintWidget import ConstraintWidget 13 14 from sas.qtgui.Perspectives.Fitting.FittingOptions import FittingOptions 14 15 from sas.qtgui.Perspectives.Fitting.GPUOptions import GPUOptions … … 30 31 # Max index for adding new, non-clashing tab names 31 32 self.maxIndex = 0 33 self.maxCSIndex = 0 32 34 33 35 # Index of the current tab … … 108 110 tab.is_batch_fitting = is_batch 109 111 # Add this tab to the object library so it can be retrieved by scripting/jupyter 110 tab_name = self. tabName(is_batch=is_batch)112 tab_name = self.getTabName(is_batch=is_batch) 111 113 ObjectLibrary.addObject(tab_name, tab) 112 114 self.tabs.append(tab) … … 116 118 self.addTab(tab, tab_name) 117 119 120 def addConstraintTab(self): 121 """ 122 Add a new C&S fitting tab 123 """ 124 tab = ConstraintWidget(parent=self.parent) 125 # Add this tab to the object library so it can be retrieved by scripting/jupyter 126 tab_name = self.getCSTabName() # TODO update the tab name scheme 127 ObjectLibrary.addObject(tab_name, tab) 128 self.tabs.append(tab) 129 self.maxCSIndex += 1 130 self.addTab(tab, tab_name) 131 118 132 def updateFitDict(self, item_key, tab_name): 119 133 """ … … 126 140 self.dataToFitTab[item_key_str] = [tab_name] 127 141 128 #print "CURRENT dict: ", self.dataToFitTab 129 130 def tabName(self, is_batch=False): 142 def getTabName(self, is_batch=False): 131 143 """ 132 144 Get the new tab name, based on the number of fitting tabs so far … … 134 146 page_name = "BatchPage" if is_batch else "FitPage" 135 147 page_name = page_name + str(self.maxIndex) 148 return page_name 149 150 def getCSTabName(self): 151 """ 152 Get the new tab name, based on the number of fitting tabs so far 153 """ 154 page_name = "Const. & Simul. Fit" 155 page_name = page_name + str(self.maxCSIndex) 136 156 return page_name 137 157 -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
rd3c0b95 r676f137 552 552 """ 553 553 selected_rows = self.lstParams.selectionModel().selectedRows() 554 assert(len(selected_rows) ,2)554 assert(len(selected_rows)==2) 555 555 556 556 params_list = [s.data() for s in selected_rows] -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingPerspectiveTest.py
r53c771e r676f137 44 44 self.assertEqual(len(self.widget.tabs), 1) 45 45 self.assertEqual(self.widget.maxIndex, 1) 46 self.assertEqual(self.widget.tabName(), "FitPage1") 46 self.assertEqual(self.widget.maxCSIndex, 0) 47 self.assertEqual(self.widget.getTabName(), "FitPage1") 47 48 48 49 def testAddTab(self): … … 52 53 self.widget.addFit(None) 53 54 self.assertEqual(len(self.widget.tabs), 2) 54 self.assertEqual(self.widget. tabName(), "FitPage2")55 self.assertEqual(self.widget.getTabName(), "FitPage2") 55 56 self.assertEqual(self.widget.maxIndex, 2) 56 57 # Add an empty batch tab 57 58 self.widget.addFit(None, is_batch=True) 58 59 self.assertEqual(len(self.widget.tabs), 3) 59 self.assertEqual(self.widget. tabName(2), "BatchPage3")60 self.assertEqual(self.widget.getTabName(2), "BatchPage3") 60 61 self.assertEqual(self.widget.maxIndex, 3) 62 63 def testAddCSTab(self): 64 ''' Add a constraint/simult tab''' 65 self.widget.addConstraintTab() 66 self.assertEqual(len(self.widget.tabs), 2) 67 self.assertEqual(self.widget.getCSTabName(), "Const. & Simul. Fit1") 68 self.assertEqual(self.widget.maxCSIndex, 1) 61 69 62 70 def testResetTab(self): 63 71 ''' Remove data from last tab''' 64 72 self.assertEqual(len(self.widget.tabs), 1) 65 self.assertEqual(self.widget. tabName(), "FitPage1")73 self.assertEqual(self.widget.getTabName(), "FitPage1") 66 74 self.assertEqual(self.widget.maxIndex, 1) 67 75 … … 71 79 # see that the tab didn't disappear, just changed the name/id 72 80 self.assertEqual(len(self.widget.tabs), 1) 73 self.assertEqual(self.widget. tabName(), "FitPage2")81 self.assertEqual(self.widget.getTabName(), "FitPage2") 74 82 self.assertEqual(self.widget.maxIndex, 2) 75 83 … … 95 103 self.assertEqual(len(self.widget.tabs), 1) 96 104 self.assertEqual(self.widget.maxIndex, 2) 97 self.assertEqual(self.widget. tabName(), "FitPage2")105 self.assertEqual(self.widget.getTabName(), "FitPage2") 98 106 99 107 # Attemtp to remove the last tab … … 102 110 self.assertEqual(len(self.widget.tabs), 1) 103 111 self.assertEqual(self.widget.maxIndex, 3) 104 self.assertEqual(self.widget. tabName(), "FitPage3")112 self.assertEqual(self.widget.getTabName(), "FitPage3") 105 113 106 114 def testAllowBatch(self): -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py
- Property mode changed from 100755 to 100644
r53c771e r676f137 112 112 fittingWindow = self.widget 113 113 114 self.assertIsInstance(fittingWindow.lstMagnetic.itemDelegate(), Qt Gui.QStyledItemDelegate)114 self.assertIsInstance(fittingWindow.lstMagnetic.itemDelegate(), QtWidgets.QStyledItemDelegate) 115 115 #Test loading from json categories 116 116 fittingWindow.SASModelToQModel("cylinder") 117 117 mag_index = fittingWindow.lstMagnetic.model().index(0,0) 118 self.assertEqual( str(mag_index.data().toString()), "up:frac_i")118 self.assertEqual(mag_index.data(), "up:frac_i") 119 119 mag_index = fittingWindow.lstMagnetic.model().index(1,0) 120 self.assertEqual( str(mag_index.data().toString()), "up:frac_f")120 self.assertEqual(mag_index.data(), "up:frac_f") 121 121 mag_index = fittingWindow.lstMagnetic.model().index(2,0) 122 self.assertEqual( str(mag_index.data().toString()), "up:angle")122 self.assertEqual(mag_index.data(), "up:angle") 123 123 mag_index = fittingWindow.lstMagnetic.model().index(3,0) 124 self.assertEqual( str(mag_index.data().toString()), "M0:sld")124 self.assertEqual(mag_index.data(), "M0:sld") 125 125 mag_index = fittingWindow.lstMagnetic.model().index(4,0) 126 self.assertEqual( str(mag_index.data().toString()), "mtheta:sld")126 self.assertEqual(mag_index.data(), "mtheta:sld") 127 127 mag_index = fittingWindow.lstMagnetic.model().index(5,0) 128 self.assertEqual( str(mag_index.data().toString()), "mphi:sld")128 self.assertEqual(mag_index.data(), "mphi:sld") 129 129 mag_index = fittingWindow.lstMagnetic.model().index(6,0) 130 self.assertEqual( str(mag_index.data().toString()), "M0:sld_solvent")130 self.assertEqual(mag_index.data(), "M0:sld_solvent") 131 131 mag_index = fittingWindow.lstMagnetic.model().index(7,0) 132 self.assertEqual( str(mag_index.data().toString()), "mtheta:sld_solvent")132 self.assertEqual(mag_index.data(), "mtheta:sld_solvent") 133 133 mag_index = fittingWindow.lstMagnetic.model().index(8,0) 134 self.assertEqual( str(mag_index.data().toString()), "mphi:sld_solvent")134 self.assertEqual(mag_index.data(), "mphi:sld_solvent") 135 135 136 136 # test the delegate a bit 137 137 delegate = fittingWindow.lstMagnetic.itemDelegate() 138 138 self.assertEqual(delegate.editableParameters(), [1, 2, 3]) 139 self.assertIsInstance(delegate.combo_updated, QtCore.pyqtBoundSignal)140 139 141 140 def testSelectStructureFactor(self):
Note: See TracChangeset
for help on using the changeset viewer.