Changeset 040529d in sasview


Ignore:
Timestamp:
Dec 2, 2016 8:27:17 AM (7 years ago)
Author:
trnielsen
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
Message:

Update SasView?-249 with code review from PR

Location:
src/sas/qtgui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/KiessigPanel.py

    r363fbfa r040529d  
    1717        self.thickness = KiessigThicknessCalculator() 
    1818 
     19        self.deltaq_in.setText("0.05") 
     20 
    1921        # 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) 
    2325 
    2426        # no reason to have this widget resizable 
    2527        self.setFixedSize(self.minimumSizeHint()) 
    2628 
    27     def on_help(self): 
     29    def onHelp(self): 
    2830        """ 
    2931        Bring up the Kiessig fringe calculator Documentation whenever 
     
    4244            pass 
    4345 
    44     def on_compute(self): 
     46    def onCompute(self): 
    4547        """ 
    4648        Execute the computation of thickness 
     
    4951            self.thickness.set_deltaq(dq=float(self.deltaq_in.text())) 
    5052            kiessing_result = self.thickness.compute_thickness() 
    51             float_as_str = "{:5.4f}".format(kiessing_result) 
     53            float_as_str = "{:.3f}".format(kiessing_result) 
    5254            self.lengthscale_out.setText(float_as_str) 
    5355        except (ArithmeticError, ValueError): 
    5456            self.lengthscale_out.setText("") 
    5557 
    56     def on_close(self): 
     58    def onClose(self): 
    5759        """ 
    5860        close the window containing this panel 
  • src/sas/qtgui/UI/KiessigPanel.ui

    r363fbfa r040529d  
    77    <x>0</x> 
    88    <y>0</y> 
    9     <width>416</width> 
     9    <width>354</width> 
    1010    <height>193</height> 
    1111   </rect> 
     
    1313  <property name="windowTitle"> 
    1414   <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/> 
    1522  </property> 
    1623  <layout class="QGridLayout" name="gridLayout_3"> 
     
    6269        </item> 
    6370        <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> 
    6576        </item> 
    6677        <item> 
     
    90101    </spacer> 
    91102   </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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Close this window.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> 
     107     </property> 
     108     <property name="text"> 
     109      <string>Close</string> 
     110     </property> 
     111    </widget> 
     112   </item> 
     113   <item row="3" column="2"> 
    93114    <widget class="QPushButton" name="helpButton"> 
    94115     <property name="toolTip"> 
     
    100121    </widget> 
    101122   </item> 
    102    <item row="3" column="1"> 
     123   <item row="3" column="0"> 
    103124    <widget class="QPushButton" name="computeButton"> 
    104125     <property name="toolTip"> 
     
    110131    </widget> 
    111132   </item> 
    112    <item row="3" column="2"> 
    113     <widget class="QPushButton" name="closeButton"> 
    114      <property name="toolTip"> 
    115       <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Close this window.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> 
    116      </property> 
    117      <property name="text"> 
    118       <string>Close</string> 
    119      </property> 
    120     </widget> 
    121    </item> 
    122133  </layout> 
    123134 </widget> 
    124  <resources/> 
     135 <resources> 
     136  <include location="main_resources.qrc"/> 
     137 </resources> 
    125138 <connections/> 
    126139</ui> 
  • src/sas/qtgui/UnitTesting/KiessigCalculatorTest.py

    r363fbfa r040529d  
    3535 
    3636        # this should not rise 
    37         self.widget.on_help() 
     37        self.widget.onHelp() 
    3838 
    3939    def testComplexEntryNumbers(self): 
    4040        """ User entered compound calculations and subsequent reset""" 
    4141 
    42         self.widget.deltaq_in.insert("2.0") 
    43  
     42        self.widget.deltaq_in.clear() 
     43        self.widget.deltaq_in.insert('0.05') 
     44        # 
    4445        # Push Compute with the left mouse button 
    4546        computeButton = self.widget.computeButton 
    4647        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') 
    4871 
    4972    def testComplexEntryLetters(self): 
Note: See TracChangeset for help on using the changeset viewer.