source: sasview/src/sas/qtgui/Calculators/KiessigPanel.py @ 7969b9c

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalc
Last change on this file since 7969b9c was 4992ff2, checked in by Piotr Rozyczko <rozyczko@…>, 7 years ago

Initial, in-progress version. Not really working atm. SASVIEW-787

  • Property mode set to 100644
File size: 2.1 KB
RevLine 
[4992ff2]1from PyQt5 import QtCore
2from PyQt5 import QtGui
3from PyQt5 import QtWidgets
[cd2cc745]4
5from sas.qtgui.UI import main_resources_rc
[b3e8629]6from .UI.KiessigPanel import Ui_KiessigPanel
[b0c5e8c]7import sas.qtgui.Utilities.GuiUtils as GuiUtils
[363fbfa]8
9# sas-global
10from sas.sascalc.calculator.kiessig_calculator import KiessigThicknessCalculator
11
12
[4992ff2]13class KiessigPanel(QtWidgets.QDialog, Ui_KiessigPanel):
[363fbfa]14    def __init__(self, parent=None):
15        super(KiessigPanel, self).__init__()
16        self.setupUi(self)
17
18        self.setWindowTitle("Kiessig Thickness Calculator")
19
20        self.manager = parent
21        self.thickness = KiessigThicknessCalculator()
22
[040529d]23        self.deltaq_in.setText("0.05")
24
[363fbfa]25        # signals
[040529d]26        self.helpButton.clicked.connect(self.onHelp)
27        self.computeButton.clicked.connect(self.onCompute)
28        self.closeButton.clicked.connect(self.onClose)
[363fbfa]29
30        # no reason to have this widget resizable
31        self.setFixedSize(self.minimumSizeHint())
32
[040529d]33    def onHelp(self):
[363fbfa]34        """
35        Bring up the Kiessig fringe calculator Documentation whenever
36        the HELP button is clicked.
37        Calls DocumentationWindow with the path of the location within the
38        documentation tree (after /doc/ ....".
39        """
40        try:
[b0c5e8c]41            location = GuiUtils.HELP_DIRECTORY_LOCATION + \
[363fbfa]42                "/user/sasgui/perspectives/calculator/kiessig_calculator_help.html"
43
44            self.manager._helpView.load(QtCore.QUrl(location))
45            self.manager._helpView.show()
46        except AttributeError:
47            # No manager defined - testing and standalone runs
48            pass
49
[040529d]50    def onCompute(self):
[363fbfa]51        """
52        Execute the computation of thickness
53        """
54        try:
55            self.thickness.set_deltaq(dq=float(self.deltaq_in.text()))
56            kiessing_result = self.thickness.compute_thickness()
[040529d]57            float_as_str = "{:.3f}".format(kiessing_result)
[363fbfa]58            self.lengthscale_out.setText(float_as_str)
59        except (ArithmeticError, ValueError):
60            self.lengthscale_out.setText("")
61
[040529d]62    def onClose(self):
[363fbfa]63        """
64        close the window containing this panel
65        """
66        self.close()
Note: See TracBrowser for help on using the repository browser.