Changeset c00a28ff in sasview for src/sas/qtgui/Perspectives
- Timestamp:
- Oct 29, 2017 12:04:00 PM (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:
- 570a2f73
- Parents:
- dfd8233
- Location:
- src/sas/qtgui/Perspectives/Inversion
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py
rdfd8233 rc00a28ff 83 83 # Set up the Widget Map 84 84 self.setupMapper() 85 # Set base window state 86 self.setupWindow() 85 87 86 88 ###################################################################### … … 118 120 def setupLinks(self): 119 121 """Connect the use controls to their appropriate methods""" 120 self.enableButtons()121 122 self.dataList.currentIndexChanged.connect(self.displayChange) 122 self.calculateButton.clicked.connect(self.startThread) 123 self.calculateAllButton.clicked.connect(self.startThreadAll) 124 self.calculateThisButton.clicked.connect(self.startThread) 123 125 self.helpButton.clicked.connect(self.help) 124 126 self.estimateBgd.toggled.connect(self.toggleBgd) … … 149 151 str(self.slitHeightInput.text())))) 150 152 self.model.itemChanged.connect(self.model_changed) 151 self.estimateBgd.setChecked(True)152 153 153 154 def setupMapper(self): … … 194 195 195 196 # Main Buttons 196 self.mapper.addMapping(self.calculateButton, WIDGETS.W_CALCULATE) 197 self.mapper.addMapping(self.calculateAllButton, WIDGETS.W_CALCULATE_ALL) 198 self.mapper.addMapping(self.calculateThisButton, 199 WIDGETS.W_CALCULATE_VISIBLE) 197 200 self.mapper.addMapping(self.helpButton, WIDGETS.W_HELP) 198 201 … … 238 241 self.model.setItem(WIDGETS.W_SIGMA_POS_FRACTION, item) 239 242 243 def setupWindow(self): 244 """Initialize base window state on init""" 245 self.setTabPosition(0) 246 self.enableButtons() 247 self.estimateBgd.setChecked(True) 248 240 249 ###################################################################### 241 250 # Methods for updating GUI … … 245 254 Enable buttons when data is present, else disable them 246 255 """ 247 if self.logic.data_is_loaded: 248 self.explorerButton.setEnabled(True) 249 self.calculateButton.setEnabled(True) 250 else: 251 self.calculateButton.setEnabled(False) 252 self.explorerButton.setEnabled(False) 256 self.explorerButton.setEnabled(self.logic.data_is_loaded) 257 self.calculateAllButton.setEnabled(self.logic.data_is_loaded) 258 self.calculateThisButton.setEnabled(self.logic.data_is_loaded) 253 259 254 260 def populateDataComboBox(self, filename, data_ref): … … 287 293 """Update the values when user makes changes""" 288 294 if not self.mapper: 295 msg = "Unable to update P{r}. The connection between the main GUI " 296 msg += "and P(r) was severed. Attempting to restart P(r)." 297 logging.warning(msg) 298 self.setClosable(True) 299 self.close() 300 InversionWindow.__init__(self.parent(), self._data_list.keys()) 289 301 return 290 302 if self.pr_plot is not None: … … 314 326 """ 315 327 Toggle the background between manual and estimated 316 :param item: gui item that was triggered317 328 """ 318 329 sender = self.sender() … … 326 337 Open the Explorer window to see correlations between params and results 327 338 """ 328 # TODO: This depends on SVCC-45339 # TODO: Look at PR from AW - Is there anything else I need to do? 329 340 pass 330 341 … … 334 345 def setData(self, data_item=None, is_batch=False): 335 346 """ 336 Assign new data set or setsto the P(r) perspective337 Obtain a QStandardItem object and dissectit to get Data1D/2D347 Assign new data set(s) to the P(r) perspective 348 Obtain a QStandardItem object and parse it to get Data1D/2D 338 349 Pass it over to the calculator 339 350 """ … … 350 361 351 362 def setCurrentData(self, data_ref): 352 """Set an individual data set tothe current data"""363 """Set the selected data set to be the current data""" 353 364 354 365 if not isinstance(data_ref, QtGui.QStandardItem): … … 377 388 # Thread Creators 378 389 379 def startThread(self): 380 """ 381 Start a calculation thread 382 """ 383 from Thread import CalcPr 384 390 # TODO: Move to individual class(?) 391 392 def startThreadAll(self): 385 393 for data_ref, pr in self._data_list.items(): 386 394 self._data_set = GuiUtils.dataFromItem(data_ref) 387 395 self._calculator = pr 388 # Set data before running the calculations 389 self.update_calculator() 390 391 # If a thread is already started, stop it 392 if self.calc_thread is not None and self.calc_thread.isrunning(): 393 self.calc_thread.stop() 394 pr = self._calculator.clone() 395 nfunc = int(UI.TabbedInversionUI._fromUtf8( 396 self.noOfTermsInput.text())) 397 self.calc_thread = CalcPr(pr, nfunc, 398 error_func=self._threadError, 399 completefn=self._completed, updatefn=None) 400 self.calc_thread.queue() 401 self.calc_thread.ready(2.5) 396 self.startThread() 397 398 def startThread(self): 399 """ 400 Start a calculation thread 401 """ 402 from Thread import CalcPr 403 404 # Set data before running the calculations 405 self.update_calculator() 406 407 # If a thread is already started, stop it 408 if self.calc_thread is not None and self.calc_thread.isrunning(): 409 self.calc_thread.stop() 410 pr = self._calculator.clone() 411 nfunc = int(UI.TabbedInversionUI._fromUtf8( 412 self.noOfTermsInput.text())) 413 self.calc_thread = CalcPr(pr, nfunc, 414 error_func=self._threadError, 415 completefn=self._completed, updatefn=None) 416 self.calc_thread.queue() 417 self.calc_thread.ready(2.5) 402 418 403 419 def performEstimateNT(self): … … 534 550 self._data_list[self._data] = self._calculator.clone() 535 551 552 # FIXME: Update plots if exist 553 # TODO: Keep plot references so they can be updated. 554 # TODO: On data change, update current reference to this->plot 555 536 556 if self.pr_plot is None: 537 557 self.pr_plot = self.logic.newPRPlot(out, self._calculator, cov) -
src/sas/qtgui/Perspectives/Inversion/InversionUtils.py
re7651ff rc00a28ff 27 27 'W_SIGMA_POS_FRACTION', 28 28 # bottom buttons 29 'W_CALCULATE', 29 'W_CALCULATE_ALL', 30 'W_CALCULATE_VISIBLE', 30 31 'W_HELP' 31 32 ) -
src/sas/qtgui/Perspectives/Inversion/UI/TabbedInversionUI.ui
r57ad773 rc00a28ff 39 39 </property> 40 40 <item> 41 <widget class="QPushButton" name="calculateButton"> 41 <widget class="QPushButton" name="calculateThisButton"> 42 <property name="text"> 43 <string>Calculate</string> 44 </property> 45 </widget> 46 </item> 47 <item> 48 <widget class="QPushButton" name="calculateAllButton"> 42 49 <property name="sizePolicy"> 43 50 <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> … … 47 54 </property> 48 55 <property name="text"> 49 <string>Calculate </string>56 <string>Calculate All</string> 50 57 </property> 51 58 </widget>
Note: See TracChangeset
for help on using the changeset viewer.