Changeset 72ecbdf2 in sasview for src/sas/qtgui/Perspectives
- Timestamp:
- May 2, 2018 8:59:34 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:
- b0ba43e
- Parents:
- 6da860a
- Location:
- src/sas/qtgui/Perspectives/Inversion
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Inversion/DMaxExplorerWidget.py
r6da860a r72ecbdf2 153 153 if plotter == "ϲ/dof": 154 154 ys = chi2 155 y_label = "\ chi^2/dof"155 y_label = "\\chi^2/dof" 156 156 y_unit = "a.u." 157 157 elif plotter == "I(Q=0)": 158 158 ys = iq0 159 159 y_label = "I(q=0)" 160 y_unit = "\ AA^{-1}"160 y_unit = "\\AA^{-1}" 161 161 elif plotter == "Rg": 162 162 ys = rg 163 163 y_label = "R_g" 164 y_unit = "\ AA"164 y_unit = "\\AA" 165 165 elif plotter == "Oscillation parameter": 166 166 ys = osc … … 170 170 ys = bck 171 171 y_label = "Bckg" 172 y_unit = "\ AA^{-1}"172 y_unit = "\\AA^{-1}" 173 173 elif plotter == "Positive Fraction": 174 174 ys = pos … … 177 177 else: 178 178 ys = pos_err 179 y_label = "P^{+}_{1\ sigma}"179 y_label = "P^{+}_{1\\sigma}" 180 180 y_unit = "a.u." 181 181 -
src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py
r6da860a r72ecbdf2 79 79 self.estimationThread = None 80 80 self.estimationThreadNT = None 81 self.isCalculating = False 81 82 82 83 # Mapping for all data items … … 167 168 self.calculateAllButton.clicked.connect(self.startThreadAll) 168 169 self.calculateThisButton.clicked.connect(self.startThread) 170 self.stopButton.clicked.connect(self.stopCalculation) 169 171 self.removeButton.clicked.connect(self.removeData) 170 172 self.helpButton.clicked.connect(self.help) … … 301 303 """ 302 304 self.calculateAllButton.setEnabled(len(self._dataList) > 1 303 and not self.isBatch) 305 and not self.isBatch 306 and not self.isCalculating) 304 307 self.calculateThisButton.setEnabled(self.logic.data_is_loaded 305 and not self.isBatch) 308 and not self.isBatch 309 and not self.isCalculating) 306 310 self.removeButton.setEnabled(self.logic.data_is_loaded) 307 311 self.explorerButton.setEnabled(self.logic.data_is_loaded) 312 self.stopButton.setVisible(self.isCalculating) 308 313 self.regConstantSuggestionButton.setEnabled( 309 314 self.logic.data_is_loaded and … … 413 418 self.batchResultsWindow.setupTable(self.batchResults) 414 419 self.batchResultsWindow.show() 420 421 def stopCalculation(self): 422 """ Stop all threads, return to the base state and update GUI """ 423 if self.calcThread: 424 self.calcThread.stop() 425 if self.estimationThread: 426 self.estimationThread.stop() 427 if self.estimationThreadNT: 428 self.estimationThreadNT.stop() 429 # Show any batch calculations that successfully completed 430 if self.isBatch and self.batchResultsWindow is not None: 431 self.showBatchOutput() 432 self.isBatch = False 433 self.isCalculating = False 434 self.updateGuiValues() 415 435 416 436 ###################################################################### … … 571 591 572 592 def startThreadAll(self): 593 self.isCalculating = True 573 594 self.isBatch = True 574 595 self.batchComplete = [] … … 592 613 else: 593 614 # If no data sets left, end batch calculation 615 self.isCalculating = False 594 616 self.batchComplete = [] 595 617 self.calculateAllButton.setText("Calculate All") … … 604 626 605 627 # Set data before running the calculations 628 self.isCalculating = True 629 self.enableButtons() 606 630 self.updateCalculator() 607 631 # Disable calculation buttons to prevent thread interference 608 self.calculateAllButton.setEnabled(False)609 self.calculateThisButton.setEnabled(False)610 632 611 633 # If a thread is already started, stop it … … 744 766 # Udpate internals and GUI 745 767 self.updateDataList(self._data) 746 self.updateGuiValues()747 768 if self.isBatch: 748 769 self.batchComplete.append(self.dataList.currentIndex()) 749 770 self.startNextBatchItem() 771 else: 772 self.isCalculating = False 773 self.updateGuiValues() 750 774 751 775 def _threadError(self, error): -
src/sas/qtgui/Perspectives/Inversion/UI/TabbedInversionUI.ui
rd744767 r72ecbdf2 317 317 <widget class="QLabel" name="label_22"> 318 318 <property name="text"> 319 <string > </string>319 <string/> 320 320 </property> 321 321 </widget> … … 754 754 </item> 755 755 <item> 756 <widget class="QPushButton" name="stopButton"> 757 <property name="text"> 758 <string>Stop P(r)</string> 759 </property> 760 </widget> 761 </item> 762 <item> 756 763 <spacer name="horizontalSpacer"> 757 764 <property name="orientation"> -
src/sas/qtgui/Perspectives/Inversion/UnitTesting/InversionPerspectiveTest.py
r6bd0d81 r72ecbdf2 58 58 self.assertEqual(self.widget.windowTitle(), "P(r) Inversion Perspective") 59 59 self.assertFalse(self.widget.isClosable()) 60 self.assertFalse(self.widget.isCalculating) 60 61 # mapper 61 62 self.assertIsInstance(self.widget.mapper, QtWidgets.QDataWidgetMapper) … … 76 77 self.assertFalse(self.widget.calculateThisButton.isEnabled()) 77 78 self.assertFalse(self.widget.removeButton.isEnabled()) 79 self.assertTrue(self.widget.stopButton.isEnabled()) 80 self.assertFalse(self.widget.stopButton.isVisible()) 78 81 self.assertFalse(self.widget.regConstantSuggestionButton.isEnabled()) 79 82 self.assertFalse(self.widget.noOfTermsSuggestionButton.isEnabled()) … … 154 157 self.twoDataSetState() 155 158 self.widget.calculateAllButton.click() 159 self.assertTrue(self.widget.isCalculating) 160 self.assertTrue(self.widget.isBatch) 161 self.assertTrue(self.widget.stopButton.isVisible()) 162 self.assertTrue(self.widget.stopButton.isEnabled()) 156 163 self.assertIsNotNone(self.widget.batchResultsWindow) 157 164 self.assertTrue(self.widget.batchResultsWindow.cmdHelp.isEnabled()) 158 165 self.assertEqual(self.widget.batchResultsWindow.tblParams.columnCount(), 9) 159 166 self.assertEqual(self.widget.batchResultsWindow.tblParams.rowCount(), 2) 160 if self.widget.isBatch: 161 self.widget.isBatch = False 167 # Test stop button 168 self.widget.stopButton.click() 169 self.assertTrue(self.widget.batchResultsWindow.isVisible()) 170 self.assertFalse(self.widget.stopButton.isVisible()) 171 self.assertTrue(self.widget.stopButton.isEnabled()) 172 self.assertFalse(self.widget.isBatch) 173 self.assertFalse(self.widget.isCalculating) 162 174 self.widget.batchResultsWindow.close() 163 175 self.assertIsNone(self.widget.batchResultsWindow) 164 176 # Last test 165 self.widget.removeData()166 177 self.removeAllData() 167 178 self.baseBatchState() … … 218 229 self.widget.noOfTermsInput.setText("") 219 230 n = self.widget.getNFunc() 220 self.assertEqual(cm.output, ['ERROR: root:Incorrect number of terms specified: '])231 self.assertEqual(cm.output, ['ERROR:sas.qtgui.Perspectives.Inversion.InversionPerspective:Incorrect number of terms specified: ']) 221 232 self.assertEqual(self.widget.getNFunc(), 10) 222 233 # string … … 224 235 self.widget.noOfTermsInput.setText("Nordvest Pizza") 225 236 n = self.widget.getNFunc() 226 self.assertEqual(cm.output, ['ERROR: root:Incorrect number of terms specified: Nordvest Pizza'])237 self.assertEqual(cm.output, ['ERROR:sas.qtgui.Perspectives.Inversion.InversionPerspective:Incorrect number of terms specified: Nordvest Pizza']) 227 238 self.assertEqual(self.widget.getNFunc(), 10) 228 239 self.removeAllData()
Note: See TracChangeset
for help on using the changeset viewer.