Changeset 040529d in sasview
- Timestamp:
- Dec 2, 2016 8:27:17 AM (8 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:
- fca1f50
- Parents:
- 363fbfa
- Location:
- src/sas/qtgui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/KiessigPanel.py
r363fbfa r040529d 17 17 self.thickness = KiessigThicknessCalculator() 18 18 19 self.deltaq_in.setText("0.05") 20 19 21 # signals 20 self.helpButton.clicked.connect(self.on _help)21 self.computeButton.clicked.connect(self.on _compute)22 self.closeButton.clicked.connect(self.on _close)22 self.helpButton.clicked.connect(self.onHelp) 23 self.computeButton.clicked.connect(self.onCompute) 24 self.closeButton.clicked.connect(self.onClose) 23 25 24 26 # no reason to have this widget resizable 25 27 self.setFixedSize(self.minimumSizeHint()) 26 28 27 def on _help(self):29 def onHelp(self): 28 30 """ 29 31 Bring up the Kiessig fringe calculator Documentation whenever … … 42 44 pass 43 45 44 def on _compute(self):46 def onCompute(self): 45 47 """ 46 48 Execute the computation of thickness … … 49 51 self.thickness.set_deltaq(dq=float(self.deltaq_in.text())) 50 52 kiessing_result = self.thickness.compute_thickness() 51 float_as_str = "{: 5.4f}".format(kiessing_result)53 float_as_str = "{:.3f}".format(kiessing_result) 52 54 self.lengthscale_out.setText(float_as_str) 53 55 except (ArithmeticError, ValueError): 54 56 self.lengthscale_out.setText("") 55 57 56 def on _close(self):58 def onClose(self): 57 59 """ 58 60 close the window containing this panel -
src/sas/qtgui/UI/KiessigPanel.ui
r363fbfa r040529d 7 7 <x>0</x> 8 8 <y>0</y> 9 <width> 416</width>9 <width>354</width> 10 10 <height>193</height> 11 11 </rect> … … 13 13 <property name="windowTitle"> 14 14 <string>Dialog</string> 15 </property> 16 <property name="windowIcon"> 17 <iconset resource="main_resources.qrc"> 18 <normaloff>:/res/ball.ico</normaloff>:/res/ball.ico</iconset> 19 </property> 20 <property name="toolTip"> 21 <string/> 15 22 </property> 16 23 <layout class="QGridLayout" name="gridLayout_3"> … … 62 69 </item> 63 70 <item> 64 <widget class="QLineEdit" name="lengthscale_out"/> 71 <widget class="QLineEdit" name="lengthscale_out"> 72 <property name="readOnly"> 73 <bool>true</bool> 74 </property> 75 </widget> 65 76 </item> 66 77 <item> … … 90 101 </spacer> 91 102 </item> 92 <item row="3" column="0"> 103 <item row="3" column="1"> 104 <widget class="QPushButton" name="closeButton"> 105 <property name="toolTip"> 106 <string><html><head/><body><p>Close this window.</p></body></html></string> 107 </property> 108 <property name="text"> 109 <string>Close</string> 110 </property> 111 </widget> 112 </item> 113 <item row="3" column="2"> 93 114 <widget class="QPushButton" name="helpButton"> 94 115 <property name="toolTip"> … … 100 121 </widget> 101 122 </item> 102 <item row="3" column=" 1">123 <item row="3" column="0"> 103 124 <widget class="QPushButton" name="computeButton"> 104 125 <property name="toolTip"> … … 110 131 </widget> 111 132 </item> 112 <item row="3" column="2">113 <widget class="QPushButton" name="closeButton">114 <property name="toolTip">115 <string><html><head/><body><p>Close this window.</p></body></html></string>116 </property>117 <property name="text">118 <string>Close</string>119 </property>120 </widget>121 </item>122 133 </layout> 123 134 </widget> 124 <resources/> 135 <resources> 136 <include location="main_resources.qrc"/> 137 </resources> 125 138 <connections/> 126 139 </ui> -
src/sas/qtgui/UnitTesting/KiessigCalculatorTest.py
r363fbfa r040529d 35 35 36 36 # this should not rise 37 self.widget.on _help()37 self.widget.onHelp() 38 38 39 39 def testComplexEntryNumbers(self): 40 40 """ User entered compound calculations and subsequent reset""" 41 41 42 self.widget.deltaq_in.insert("2.0") 43 42 self.widget.deltaq_in.clear() 43 self.widget.deltaq_in.insert('0.05') 44 # 44 45 # Push Compute with the left mouse button 45 46 computeButton = self.widget.computeButton 46 47 QTest.mouseClick(computeButton, Qt.LeftButton) 47 self.assertEqual(self.widget.lengthscale_out.text(), '3.1416') 48 self.assertEqual(self.widget.lengthscale_out.text(), '125.664') 49 50 def testComplexEntryNumbers2(self): 51 """ User entered compound calculations and subsequent reset""" 52 53 self.widget.deltaq_in.clear() 54 self.widget.deltaq_in.insert('1.0') 55 # 56 # Push Compute with the left mouse button 57 computeButton = self.widget.computeButton 58 QTest.mouseClick(computeButton, Qt.LeftButton) 59 self.assertEqual(self.widget.lengthscale_out.text(), '6.283') 60 61 def testComplexEntryNumbers3(self): 62 """ User entered compound calculations and subsequent reset""" 63 64 self.widget.deltaq_in.clear() 65 self.widget.deltaq_in.insert('2.0') 66 # 67 # Push Compute with the left mouse button 68 computeButton = self.widget.computeButton 69 QTest.mouseClick(computeButton, Qt.LeftButton) 70 self.assertEqual(self.widget.lengthscale_out.text(), '3.142') 48 71 49 72 def testComplexEntryLetters(self):
Note: See TracChangeset
for help on using the changeset viewer.