Changeset 99ea1b0 in sasview for src/sas/qtgui/Calculators/ResolutionCalculatorPanel.py
- Timestamp:
- Oct 27, 2017 8:49:35 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:
- 0849aec
- Parents:
- 895e7359
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Calculators/ResolutionCalculatorPanel.py
- Property mode changed from 100755 to 100644
rb0b09b9 r99ea1b0 111 111 # call compute to calculate with default values 112 112 self.createTemplate2DPlot() 113 self.onCompute()113 #self.onCompute() 114 114 115 115 # ################################# … … 123 123 text_edit = self.txtWavelength # self.sender() 124 124 if text_edit.isModified(): 125 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))125 text_edit.setStyleSheet(BG_WHITE) 126 126 input_string = str(text_edit.text()) 127 127 if self.cbWaveColor.currentText() != 'TOF': 128 128 input_wavelength = re.match('\d+\.?\d*', input_string) 129 129 if input_wavelength is None: 130 text_edit.setStyleSheet( QtCore.QString(BG_RED))130 text_edit.setStyleSheet(BG_RED) 131 131 self.cmdCompute.setEnabled(False) 132 132 logging.info('Wavelength has to be a number.') 133 133 else: 134 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))134 text_edit.setStyleSheet(BG_WHITE) 135 135 self.cmdCompute.setEnabled(True) 136 136 else: … … 139 139 140 140 if interval_wavelength is None: 141 text_edit.setStyleSheet( QtCore.QString(BG_RED))141 text_edit.setStyleSheet(BG_RED) 142 142 self.cmdCompute.setEnabled(False) 143 143 logging.info("Wavelength's input has to be an interval: " … … 149 149 150 150 if float(wavelength_min) >= float(wavelength_max): 151 text_edit.setStyleSheet( QtCore.QString(BG_RED))151 text_edit.setStyleSheet(BG_RED) 152 152 self.cmdCompute.setEnabled(False) 153 153 logging.info("Wavelength: min must be smaller than max.") 154 154 155 155 else: 156 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))156 text_edit.setStyleSheet(BG_WHITE) 157 157 self.cmdCompute.setEnabled(True) 158 158 … … 163 163 164 164 if text_edit.isModified(): 165 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))165 text_edit.setStyleSheet(BG_WHITE) 166 166 if self.cbWaveColor.currentText() != 'TOF': 167 167 pattern = '^\d+\.?\d*(|;\s*\d+)$' … … 170 170 171 171 if wavelength_spread_input is None: 172 text_edit.setStyleSheet( QtCore.QString(BG_RED))172 text_edit.setStyleSheet(BG_RED) 173 173 self.cmdCompute.setEnabled(False) 174 174 logging.info('Wavelength spread has to be specified: ' … … 178 178 split_input = wavelength_spread_input.group().split(';') 179 179 self.num_wave = split_input[1] if len(split_input) > 1 else 10 180 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))180 text_edit.setStyleSheet(BG_WHITE) 181 181 self.cmdCompute.setEnabled(True) 182 182 else: … … 186 186 187 187 if wavelength_spread_input is None: 188 text_edit.setStyleSheet( QtCore.QString(BG_RED))188 text_edit.setStyleSheet(BG_RED) 189 189 self.cmdCompute.setEnabled(False) 190 190 logging.info("Wavelength spread has to be specified: " … … 197 197 self.num_wave = split_input[1] if len( 198 198 split_input) > 1 else 10 199 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))199 text_edit.setStyleSheet(BG_WHITE) 200 200 self.cmdCompute.setEnabled(True) 201 201 … … 205 205 206 206 if text_edit.isModified(): 207 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))207 text_edit.setStyleSheet(BG_WHITE) 208 208 pattern = '^\d+\.?\d*,\s*\d+\.?\d*$' 209 209 input_string = str(text_edit.text()) … … 211 211 212 212 if pixels_input is None: 213 text_edit.setStyleSheet( QtCore.QString(BG_RED))213 text_edit.setStyleSheet(BG_RED) 214 214 self.cmdCompute.setEnabled(False) 215 215 logging.info('The input for the detector should contain 2 ' … … 217 217 218 218 else: 219 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))219 text_edit.setStyleSheet(BG_WHITE) 220 220 self.cmdCompute.setEnabled(True) 221 221 … … 229 229 q_input = re.match(pattern, input_string) 230 230 if q_input is None: 231 text_edit.setStyleSheet( QtCore.QString(BG_RED))231 text_edit.setStyleSheet(BG_RED) 232 232 self.cmdCompute.setEnabled(False) 233 233 logging.info('Qx and Qy should contain one or more comma-separated numbers.') 234 234 else: 235 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))235 text_edit.setStyleSheet(BG_WHITE) 236 236 self.cmdCompute.setEnabled(True) 237 237 qx = str(self.txtQx.text()).split(',') … … 247 247 248 248 elif len(qx) != len(qy): 249 text_edit.setStyleSheet( QtCore.QString(BG_RED))249 text_edit.setStyleSheet(BG_RED) 250 250 self.cmdCompute.setEnabled(False) 251 251 logging.info( … … 253 253 254 254 else: 255 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))255 text_edit.setStyleSheet(BG_WHITE) 256 256 self.cmdCompute.setEnabled(True) 257 257 … … 261 261 262 262 if text_edit.isModified(): 263 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))263 text_edit.setStyleSheet(BG_WHITE) 264 264 input_string = str(text_edit.text()) 265 265 pattern = '^\d+\.?\d*(|,\s*\d+)$' … … 267 267 268 268 if aperture_input is None: 269 text_edit.setStyleSheet( QtCore.QString(BG_RED))269 text_edit.setStyleSheet(BG_RED) 270 270 self.cmdCompute.setEnabled(False) 271 271 logging.info('A circular aperture is defined by a single ' … … 274 274 275 275 else: 276 text_edit.setStyleSheet( QtCore.QString(BG_WHITE))276 text_edit.setStyleSheet(BG_WHITE) 277 277 self.cmdCompute.setEnabled(True) 278 278 … … 524 524 525 525 cal_res.addCallback(self.complete) 526 cal_res.addErrback(self.calculateFailed) 526 527 527 528 # logging.info("Computation is in progress...") … … 531 532 raise 532 533 534 def calculateFailed(self, reason): 535 print("calculateFailed Failed with:\n", reason) 536 pass 537 533 538 def complete(self, image): 534 539 """ … … 562 567 : return: image (numpy array) 563 568 """ 569 # This fails in py3 with 570 # [Failure instance: Traceback: <class 'TypeError'>: 'map' object is not subscriptable 571 # INVESTIGATE 564 572 image = map(func, qx, qy, 565 573 qx_min, qx_max,
Note: See TracChangeset
for help on using the changeset viewer.