- Timestamp:
- Sep 5, 2018 3:31:45 AM (6 years ago)
- Branches:
- ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- f4aa7a8, 5c0e717
- Parents:
- 287d356
- Location:
- src/sas/qtgui/Calculators
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Calculators/SldPanel.py
raed0532 rd738feb 134 134 135 135 # signals 136 self.ui.buttonBox.button(QtWidgets.QDialogButtonBox.Reset).clicked.connect(self.modelReset) 137 self.ui.buttonBox.button(QtWidgets.QDialogButtonBox.Help).clicked.connect(self.displayHelp) 136 self.ui.helpButton.clicked.connect(self.displayHelp) 137 self.ui.closeButton.clicked.connect(self.closePanel) 138 self.ui.recalculateButton.clicked.connect(self.calculateSLD) 139 140 def calculateSLD(self): 141 self.recalculateSLD() 138 142 139 143 def setupModel(self): … … 169 173 update = True 170 174 171 # calcu altion175 # calculation 172 176 if update: 173 formula = self.model.item(MODEL.MOLECULAR_FORMULA).text() 174 density = self.model.item(MODEL.MASS_DENSITY).text() 175 wavelength = self.model.item(MODEL.WAVELENGTH).text() 176 if len(formula) > 0 and len(density) > 0 and len(wavelength) > 0: 177 try: 178 results = sldAlgorithm(str(formula), float(density), float(wavelength)) 179 180 def format(value): 181 return ("%-5.3g" % value).strip() 182 183 self.model.item(MODEL.NEUTRON_SLD_REAL).setText(format(results.neutron_sld_real)) 184 self.model.item(MODEL.NEUTRON_SLD_IMAG).setText(format(results.neutron_sld_imag)) 185 186 self.model.item(MODEL.CU_KA_SLD_REAL).setText(format(results.cu_ka_sld_real)) 187 self.model.item(MODEL.CU_KA_SLD_IMAG).setText(format(results.cu_ka_sld_imag)) 188 189 self.model.item(MODEL.MO_KA_SLD_REAL).setText(format(results.mo_ka_sld_real)) 190 self.model.item(MODEL.MO_KA_SLD_IMAG).setText(format(results.mo_ka_sld_imag)) 191 192 self.model.item(MODEL.NEUTRON_INC_XS).setText(format(results.neutron_inc_xs)) 193 self.model.item(MODEL.NEUTRON_ABS_XS).setText(format(results.neutron_abs_xs)) 194 self.model.item(MODEL.NEUTRON_LENGTH).setText(format(results.neutron_length)) 195 196 return 197 198 except Exception as e: 199 pass 200 201 for key in list(self._getOutputs().keys()): 202 self.model.item(key).setText("") 177 self.recalculateSLD() 178 179 def recalculateSLD(self): 180 formula = self.model.item(MODEL.MOLECULAR_FORMULA).text() 181 density = self.model.item(MODEL.MASS_DENSITY).text() 182 wavelength = self.model.item(MODEL.WAVELENGTH).text() 183 if len(formula) > 0 and len(density) > 0 and len(wavelength) > 0: 184 try: 185 results = sldAlgorithm(str(formula), float(density), float(wavelength)) 186 187 def format(value): 188 return ("%-5.3g" % value).strip() 189 190 self.model.item(MODEL.NEUTRON_SLD_REAL).setText(format(results.neutron_sld_real)) 191 self.model.item(MODEL.NEUTRON_SLD_IMAG).setText(format(results.neutron_sld_imag)) 192 193 self.model.item(MODEL.CU_KA_SLD_REAL).setText(format(results.cu_ka_sld_real)) 194 self.model.item(MODEL.CU_KA_SLD_IMAG).setText(format(results.cu_ka_sld_imag)) 195 196 self.model.item(MODEL.MO_KA_SLD_REAL).setText(format(results.mo_ka_sld_real)) 197 self.model.item(MODEL.MO_KA_SLD_IMAG).setText(format(results.mo_ka_sld_imag)) 198 199 self.model.item(MODEL.NEUTRON_INC_XS).setText(format(results.neutron_inc_xs)) 200 self.model.item(MODEL.NEUTRON_ABS_XS).setText(format(results.neutron_abs_xs)) 201 self.model.item(MODEL.NEUTRON_LENGTH).setText(format(results.neutron_length)) 202 203 return 204 205 except Exception as e: 206 pass 207 208 for key in list(self._getOutputs().keys()): 209 self.model.item(key).setText("") 203 210 204 211 def modelReset(self): … … 217 224 218 225 226 def closePanel(self): 227 """ 228 close the window containing this panel 229 """ 230 self.close() 231 -
src/sas/qtgui/Calculators/UI/SldPanel.ui
rcd2cc745 rd738feb 7 7 <x>0</x> 8 8 <y>0</y> 9 <width>4 47</width>10 <height>4 03</height>9 <width>487</width> 10 <height>488</height> 11 11 </rect> 12 12 </property> … … 25 25 </property> 26 26 <layout class="QGridLayout" name="gridLayout_2"> 27 <item row="3" column="0"> 28 <spacer name="verticalSpacer"> 29 <property name="orientation"> 30 <enum>Qt::Vertical</enum> 31 </property> 32 <property name="sizeHint" stdset="0"> 33 <size> 34 <width>20</width> 35 <height>40</height> 36 </size> 37 </property> 38 </spacer> 39 </item> 40 <item row="4" column="0"> 41 <widget class="QWidget" name="widget" native="true"> 42 <property name="minimumSize"> 43 <size> 44 <width>466</width> 45 <height>32</height> 46 </size> 47 </property> 48 <widget class="QPushButton" name="recalculateButton"> 49 <property name="geometry"> 50 <rect> 51 <x>0</x> 52 <y>0</y> 53 <width>114</width> 54 <height>32</height> 55 </rect> 56 </property> 57 <property name="text"> 58 <string>Recalculate</string> 59 </property> 60 </widget> 61 <widget class="QPushButton" name="helpButton"> 62 <property name="geometry"> 63 <rect> 64 <x>176</x> 65 <y>0</y> 66 <width>114</width> 67 <height>32</height> 68 </rect> 69 </property> 70 <property name="text"> 71 <string>Help</string> 72 </property> 73 </widget> 74 <widget class="QPushButton" name="closeButton"> 75 <property name="geometry"> 76 <rect> 77 <x>352</x> 78 <y>0</y> 79 <width>114</width> 80 <height>32</height> 81 </rect> 82 </property> 83 <property name="text"> 84 <string>Close</string> 85 </property> 86 </widget> 87 </widget> 88 </item> 27 89 <item row="0" column="0"> 28 90 <widget class="QGroupBox" name="groupBoxInput"> … … 296 358 </item> 297 359 </layout> 298 </widget>299 </item>300 <item row="2" column="0">301 <spacer name="verticalSpacer">302 <property name="orientation">303 <enum>Qt::Vertical</enum>304 </property>305 <property name="sizeHint" stdset="0">306 <size>307 <width>20</width>308 <height>40</height>309 </size>310 </property>311 </spacer>312 </item>313 <item row="3" column="0">314 <widget class="QDialogButtonBox" name="buttonBox">315 <property name="orientation">316 <enum>Qt::Horizontal</enum>317 </property>318 <property name="standardButtons">319 <set>QDialogButtonBox::Close|QDialogButtonBox::Help|QDialogButtonBox::Reset</set>320 </property>321 <property name="centerButtons">322 <bool>true</bool>323 </property>324 360 </widget> 325 361 </item> … … 339 375 <tabstop>editNeutronAbsXs</tabstop> 340 376 <tabstop>editNeutronLength</tabstop> 341 <tabstop>buttonBox</tabstop>342 377 </tabstops> 343 378 <resources/> 344 <connections> 345 <connection> 346 <sender>buttonBox</sender> 347 <signal>accepted()</signal> 348 <receiver>SldPanel</receiver> 349 <slot>accept()</slot> 350 <hints> 351 <hint type="sourcelabel"> 352 <x>248</x> 353 <y>254</y> 354 </hint> 355 <hint type="destinationlabel"> 356 <x>157</x> 357 <y>274</y> 358 </hint> 359 </hints> 360 </connection> 361 <connection> 362 <sender>buttonBox</sender> 363 <signal>rejected()</signal> 364 <receiver>SldPanel</receiver> 365 <slot>reject()</slot> 366 <hints> 367 <hint type="sourcelabel"> 368 <x>316</x> 369 <y>260</y> 370 </hint> 371 <hint type="destinationlabel"> 372 <x>286</x> 373 <y>274</y> 374 </hint> 375 </hints> 376 </connection> 377 </connections> 379 <connections/> 378 380 </ui>
Note: See TracChangeset
for help on using the changeset viewer.