Changeset 7c487846 in sasview for src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py
- Timestamp:
- Nov 14, 2017 6:04:41 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:
- fa81e94
- Parents:
- f1f3e6a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py
rf1f3e6a r7c487846 125 125 self.setupMapper() 126 126 127 # Default enablement 128 self.cmdCalculate.setEnabled(False) 129 127 130 # validator: double 128 self.txtBackgd.setValidator( QtGui.QDoubleValidator())129 self.txtContrast.setValidator( QtGui.QDoubleValidator())130 self.txtScale.setValidator( QtGui.QDoubleValidator())131 self.txtPorodCst.setValidator( QtGui.QDoubleValidator())131 self.txtBackgd.setValidator(GuiUtils.DoubleValidator()) 132 self.txtContrast.setValidator(GuiUtils.DoubleValidator()) 133 self.txtScale.setValidator(GuiUtils.DoubleValidator()) 134 self.txtPorodCst.setValidator(GuiUtils.DoubleValidator()) 132 135 133 136 # validator: integer number 134 valid_regex_int = QtCore.QRegExp('^[+]?(\d+[.][0]*)$') 135 self.txtNptsLowQ.setValidator(QtGui.QRegExpValidator(valid_regex_int, 136 self.txtNptsLowQ)) 137 self.txtNptsHighQ.setValidator(QtGui.QRegExpValidator(valid_regex_int, 138 self.txtNptsHighQ)) 139 self.txtPowerLowQ.setValidator(QtGui.QRegExpValidator(valid_regex_int, 140 self.txtPowerLowQ)) 141 self.txtPowerHighQ.setValidator(QtGui.QRegExpValidator(valid_regex_int, 142 self.txtPowerHighQ)) 137 self.txtNptsLowQ.setValidator(QtGui.QIntValidator()) 138 self.txtNptsHighQ.setValidator(QtGui.QIntValidator()) 139 self.txtPowerLowQ.setValidator(GuiUtils.DoubleValidator()) 140 self.txtPowerHighQ.setValidator(GuiUtils.DoubleValidator()) 143 141 144 142 def enabling(self): … … 159 157 # reset the closability flag 160 158 self.setClosable(value=False) 159 # Tell the MdiArea to close the container 160 self.parentWidget().close() 161 161 event.accept() 162 162 else: … … 227 227 228 228 self.model = model 229 self.mapper.toFirst()230 229 self._data = GuiUtils.dataFromItem(self._model_item) 231 230 … … 331 330 332 331 if (calculation_failed): 333 self.mapper.toFirst()334 332 logging.warning('Calculation failed: {}'.format(msg)) 335 333 return self.model … … 416 414 self.model.setItem(WIDGETS.D_HIGH_QSTAR_ERR, item) 417 415 418 self.mapper.toFirst()419 420 416 return self.model 421 417 … … 504 500 Error if it is larger than the distribution length 505 501 """ 502 try: 503 int_value = int(self.sender().text()) 504 except ValueError: 505 self.sender().setStyleSheet(BG_RED) 506 self.cmdCalculate.setEnabled(False) 507 return 508 506 509 if self._data: 507 if len(self._data.x) < int (self.sender().text()):508 self.sender().setStyleSheet( QtCore.QString(BG_RED))510 if len(self._data.x) < int_value: 511 self.sender().setStyleSheet(BG_RED) 509 512 logging.warning('The number of points must be smaller than {}'.format(len(self._data.x))) 510 513 self.cmdCalculate.setEnabled(False) 511 514 else: 512 self.sender().setStyleSheet( QtCore.QString(BG_WHITE))515 self.sender().setStyleSheet(BG_WHITE) 513 516 self.cmdCalculate.setEnabled(True) 514 517 else: … … 565 568 566 569 self.model.setItem(related_widgets[index_elt], item) 567 568 related_internal_values[index_elt] = float(self.sender().text()) 569 570 # print possible_senders[index_elt], related_internal_values[index_elt] 571 572 self.mapper.toFirst() 570 try: 571 related_internal_values[index_elt] = float(self.sender().text()) 572 self.sender().setStyleSheet(BG_WHITE) 573 self.cmdCalculate.setEnabled(True) 574 except ValueError: 575 # empty field, just skip 576 self.sender().setStyleSheet(BG_RED) 577 self.cmdCalculate.setEnabled(False) 573 578 574 579 def lowGuinierAndPowerToggle(self, toggle): … … 761 766 # Extract data on 1st child - this is the Data1D/2D component 762 767 data = GuiUtils.dataFromItem(self._model_item) 763 self.model.item(WIDGETS.W_FILENAME).setData( QtCore.QVariant(self._model_item.text()))768 self.model.item(WIDGETS.W_FILENAME).setData(self._model_item.text()) 764 769 # update GUI and model with info from loaded data 765 770 self.updateGuiFromFile(data=data)
Note: See TracChangeset
for help on using the changeset viewer.