Ignore:
Timestamp:
Dec 13, 2016 9:32:03 AM (8 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 
Note: See TracChangeset for help on using the changeset viewer.