Changeset 0532d7c1 in sasview


Ignore:
Timestamp:
Dec 13, 2016 9:32:03 AM (7 years ago)
Author:
wojciech
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:
3a0ce4f
Parents:
8696721
Message:

Unit tests added

Location:
src/sas/qtgui
Files:
1 added
3 edited

Legend:

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

    ra8ec5b1 r0532d7c1  
    141141        #self.KIESSIGCalculator = DensityPanel(self)#KiessigPanel(self) 
    142142        self.KIESSIGCalculator = KiessigPanel(self) 
    143         self.SlitSizeCalculator = SlitSizeCalculator(self._parent, self, manager=self._data_manager) 
     143        self.SlitSizeCalculator = SlitSizeCalculator(self._parent) 
    144144    def statusBarSetup(self): 
    145145        """ 
  • src/sas/qtgui/SlitSizeCalculator.py

    r253e7170 r0532d7c1  
    77from sas.sascalc.calculator.slit_length_calculator import SlitlengthCalculator 
    88 
    9 import sys 
     9import os 
    1010 
    1111class SlitSizeCalculator(QtGui.QDialog, Ui_SlitSizeCalculator): 
    12     def __init__(self, parent=None, guimanager=None, manager=None): 
     12    def __init__(self, parent=None): 
    1313        super(SlitSizeCalculator, self).__init__() 
    1414        self.setupUi(self) 
     
    1616        self.setWindowTitle("Slit Size Calculator") 
    1717        self._parent = parent 
    18         self._guimanager = guimanager 
    19         self._manager = manager 
    2018 
    2119        self.thickness = SlitlengthCalculator() 
     
    2826        # no reason to have this widget resizable 
    2927        self.setFixedSize(self.minimumSizeHint()) 
     28 
    3029 
    3130    def onHelp(self): 
     
    5655        data = loader.load(path_str) 
    5756 
    58         self.deltaq_in.setText(path_str) 
     57        self.data_file.setText(os.path.basename(path_str)) 
    5958        #We are loading data for one model only therefor index 0 
    60         self.complete_loading(data) 
    61         #Complete loading here 
     59        self.calculateSlitSize(data) 
    6260 
    6361    def chooseFile(self): 
     
    6967        # But only with Qt built-in dialog (non-platform native) 
    7068        path = QtGui.QFileDialog.getOpenFileName(self, "Choose a file", "", 
    71                 "SAS data 1D (*.txt *.TXT *.dat *.DAT)", None, 
     69                "SAXSess 1D data (*.txt *.TXT *.dat *.DAT)", None, 
    7270                QtGui.QFileDialog.DontUseNativeDialog) 
    7371        if path is None: 
     
    8583        self.close() 
    8684 
    87     def complete_loading(self, data=None): 
     85    def calculateSlitSize(self, data=None): 
    8886        """ 
    8987            Complete the loading and compute the slit size 
     
    112110             raise RuntimeError, msg 
    113111 
    114         print("Slit lenght", slit_length) 
    115         self.lengthscale_out.setText(str(slit_length)) 
     112        slit_length_str = "{:.5f}".format(slit_length) 
     113        self.slit_length_out.setText(slit_length_str) 
    116114        #Display unit 
    117         self.lineEdit.setText("[UNKNOWN]") 
     115        self.unit_out.setText("[Unknown]") 
    118116 
  • src/sas/qtgui/UI/SlitSizeCalculator.ui

    r6b9d41d r0532d7c1  
    2222  </property> 
    2323  <layout class="QGridLayout" name="gridLayout_3"> 
    24    <item row="2" column="0"> 
    25     <spacer name="verticalSpacer_2"> 
    26      <property name="orientation"> 
    27       <enum>Qt::Vertical</enum> 
    28      </property> 
    29      <property name="sizeHint" stdset="0"> 
    30       <size> 
    31        <width>20</width> 
    32        <height>40</height> 
    33       </size> 
    34      </property> 
    35     </spacer> 
    36    </item> 
    3724   <item row="0" column="0"> 
    3825    <widget class="QGroupBox" name="groupBox"> 
     
    5138        </item> 
    5239        <item> 
    53          <widget class="QLineEdit" name="deltaq_in"> 
     40         <widget class="QLineEdit" name="data_file"> 
    5441          <property name="minimumSize"> 
    5542           <size> 
    56             <width>300</width> 
     43            <width>200</width> 
    5744            <height>21</height> 
    5845           </size> 
     
    6855    </widget> 
    6956   </item> 
    70    <item row="3" column="0"> 
    71     <widget class="QPushButton" name="closeButton"> 
    72      <property name="toolTip"> 
    73       <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> 
     57   <item row="2" column="0"> 
     58    <spacer name="verticalSpacer_2"> 
     59     <property name="orientation"> 
     60      <enum>Qt::Vertical</enum> 
    7461     </property> 
    75      <property name="text"> 
    76       <string>Close</string> 
     62     <property name="sizeHint" stdset="0"> 
     63      <size> 
     64       <width>20</width> 
     65       <height>40</height> 
     66      </size> 
    7767     </property> 
    78     </widget> 
     68    </spacer> 
    7969   </item> 
    80    <item row="1" column="0" colspan="2"> 
     70   <item row="1" column="0" colspan="3"> 
    8171    <widget class="QGroupBox" name="groupBox_2"> 
    8272     <property name="title"> 
     
    9484        </item> 
    9585        <item> 
    96          <widget class="QLineEdit" name="lengthscale_out"> 
     86         <widget class="QLineEdit" name="slit_length_out"> 
    9787          <property name="minimumSize"> 
    9888           <size> 
    99             <width>125</width> 
     89            <width>110</width> 
    10090            <height>21</height> 
    10191           </size> 
     
    118108        </item> 
    119109        <item> 
    120          <widget class="QLineEdit" name="lineEdit"> 
     110         <widget class="QLineEdit" name="unit_out"> 
    121111          <property name="minimumSize"> 
    122112           <size> 
    123             <width>120</width> 
     113            <width>100</width> 
    124114            <height>21</height> 
    125115           </size> 
     116          </property> 
     117          <property name="readOnly"> 
     118           <bool>true</bool> 
    126119          </property> 
    127120         </widget> 
     
    132125    </widget> 
    133126   </item> 
    134    <item row="0" column="1"> 
     127   <item row="0" column="2"> 
    135128    <widget class="QPushButton" name="browseButton"> 
    136129     <property name="toolTip"> 
     
    142135    </widget> 
    143136   </item> 
    144    <item row="3" column="1"> 
     137   <item row="4" column="2"> 
    145138    <widget class="QPushButton" name="helpButton"> 
    146139     <property name="toolTip"> 
     
    152145    </widget> 
    153146   </item> 
     147   <item row="4" column="0"> 
     148    <spacer name="horizontalSpacer"> 
     149     <property name="orientation"> 
     150      <enum>Qt::Horizontal</enum> 
     151     </property> 
     152     <property name="sizeHint" stdset="0"> 
     153      <size> 
     154       <width>40</width> 
     155       <height>20</height> 
     156      </size> 
     157     </property> 
     158    </spacer> 
     159   </item> 
     160   <item row="4" column="1"> 
     161    <widget class="QPushButton" name="closeButton"> 
     162     <property name="toolTip"> 
     163      <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> 
     164     </property> 
     165     <property name="text"> 
     166      <string>Close</string> 
     167     </property> 
     168    </widget> 
     169   </item> 
     170   <item row="0" column="1"> 
     171    <spacer name="horizontalSpacer_2"> 
     172     <property name="orientation"> 
     173      <enum>Qt::Horizontal</enum> 
     174     </property> 
     175     <property name="sizeHint" stdset="0"> 
     176      <size> 
     177       <width>40</width> 
     178       <height>20</height> 
     179      </size> 
     180     </property> 
     181    </spacer> 
     182   </item> 
    154183  </layout> 
    155184 </widget> 
Note: See TracChangeset for help on using the changeset viewer.