source: sasview/calculatorview/perspectives/calculator/calculator.py @ c1e6400

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since c1e6400 was a0ac888, checked in by Gervaise Alina <gervyh@…>, 14 years ago

make calculator plugin inheriting brom pluginbase

  • Property mode set to 100644
File size: 4.0 KB
Line 
1"""
2Calculator Module
3"""
4################################################################################
5#This software was developed by the University of Tennessee as part of the
6#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
7#project funded by the US National Science Foundation.
8#
9#See the license text in license.txt
10#
11#copyright 2010, University of Tennessee
12################################################################################
13
14
15from sans.guiframe.plugin_base import PluginBase
16import logging
17
18class Plugin(PluginBase):
19    """
20    This class defines the interface for a Plugin class
21    for calculator perspective
22    """
23    def __init__(self, standalone=True):
24        PluginBase.__init__(self, name="Calculator", standalone=standalone)
25        # Log startup
26        logging.info("Calculator plug-in started")   
27 
28    def help(self, evt):
29        """
30        Show a general help dialog.
31       
32        :TODO: replace the text with a nice image
33            provide more hint on the SLD calculator
34        """
35        from help_panel import  HelpWindow
36        frame = HelpWindow(None, -1)   
37        frame.Show(True)
38
39    def get_tools(self):
40        """
41        Returns a set of menu entries for tools
42        """
43        kiessig_help = "Approximately computes the "
44        kiessig_help += "thickness of a shell or the size of "
45        kiessig_help += "particles \n from the width of a Kiessig fringe."
46        sld_help = "Computes the Scattering Length Density."
47        slit_length_help = "Computes the slit length from the beam profile."
48        resolution_help = "Approximately estimates the "
49        resolution_help += "resolution of Q in 2D based on the SANS "
50        resolution_help += "instrumental parameter values."
51        #data_editor_help = "Meta Data Editor"
52        return [("SLD Calculator", sld_help, self.on_calculate_sld),
53                ("Slit Size Calculator", slit_length_help,
54                        self.on_calculate_slit_size),
55                ("Kiessig Thickness Calculator", 
56                        kiessig_help, self.on_calculate_kiessig),
57                          ("SANS Resolution Estimator", 
58                        resolution_help, self.on_calculate_resoltuion)]#,
59                #("Data Editor", data_editor_help, self.on_edit_data)]
60             
61    def on_edit_data(self, event):
62        """
63        Edit meta data
64        """
65        from data_editor import DataEditorWindow
66        frame = DataEditorWindow(parent=self.parent, data=[],
67                                  title="Data Editor")
68        frame.Show(True)
69        event.Skip()
70
71    def on_calculate_kiessig(self, event):
72        """
73        Compute the Kiessig thickness
74        """
75        from kiessig_calculator_panel import KiessigWindow
76        frame = KiessigWindow()
77        frame.Show(True) 
78   
79    def on_calculate_sld(self, event):
80        """
81        Compute the scattering length density of molecula
82        """
83        from sld_panel import SldWindow
84        frame = SldWindow(base=self.parent)
85        frame.Show(True) 
86       
87    def on_calculate_slit_size(self, event):
88        """
89        Compute the slit size a given data
90        """
91        from slit_length_calculator_panel import SlitLengthCalculatorWindow
92        frame = SlitLengthCalculatorWindow(parent=self.parent)   
93        frame.Show(True)
94       
95    def on_calculate_resoltuion(self, event):
96        """
97        Estimate the instrumental resolution
98        """
99        from resolution_calculator_panel import ResolutionWindow
100        frame = ResolutionWindow(parent=self.parent)
101        frame.Show(True) 
102 
103    def on_perspective(self, event):
104        """
105        Call back function for the perspective menu item.
106        We notify the parent window that the perspective
107        has changed.
108       
109        :param event: menu event
110       
111        """
112        self.parent.set_perspective(self.perspective)
113        event.Skip()
114
115   
116 
117   
Note: See TracBrowser for help on using the repository browser.