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

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 de66e41 was 99503cb, checked in by Jae Cho <jhjcho@…>, 13 years ago

fixed minor bug

  • Property mode set to 100644
File size: 4.1 KB
RevLine 
[b0ab6cb]1"""
2Calculator Module
3"""
[6137b150]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################################################################################
[427fa87]13
[a0ac888]14
15from sans.guiframe.plugin_base import PluginBase
[427fa87]16import logging
17
[a0ac888]18class Plugin(PluginBase):
[427fa87]19    """
[6137b150]20    This class defines the interface for a Plugin class
21    for calculator perspective
[427fa87]22    """
23    def __init__(self, standalone=True):
[a0ac888]24        PluginBase.__init__(self, name="Calculator", standalone=standalone)
[427fa87]25        # Log startup
26        logging.info("Calculator plug-in started")   
[a0ac888]27 
[427fa87]28    def help(self, evt):
29        """
[6137b150]30        Show a general help dialog.
31       
32        :TODO: replace the text with a nice image
[427fa87]33            provide more hint on the SLD calculator
34        """
35        from help_panel import  HelpWindow
[fb0d7a20]36        frame = HelpWindow(None, -1)   
[427fa87]37        frame.Show(True)
[a0ac888]38
[fb0d7a20]39    def get_tools(self):
40        """
[6137b150]41        Returns a set of menu entries for tools
[fb0d7a20]42        """
[5cc393b8]43        kiessig_help = "Approximately computes the "
[74b1770]44        kiessig_help += "thickness of a shell or the size of "
45        kiessig_help += "particles \n from the width of a Kiessig fringe."
[5cc393b8]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."
[b0ab6cb]51        #data_editor_help = "Meta Data Editor"
[378d2eb]52        return [("SLD Calculator", sld_help, self.on_calculate_sld),
[b500652]53                ("Slit Size Calculator", slit_length_help,
[74b1770]54                        self.on_calculate_slit_size),
55                ("Kiessig Thickness Calculator", 
[3be3a80]56                        kiessig_help, self.on_calculate_kiessig),
57                          ("SANS Resolution Estimator", 
[5cc393b8]58                        resolution_help, self.on_calculate_resoltuion)]#,
[6137b150]59                #("Data Editor", data_editor_help, self.on_edit_data)]
[fb0d7a20]60             
[91f151a]61    def on_edit_data(self, event):
62        """
[6137b150]63        Edit meta data
[91f151a]64        """
65        from data_editor import DataEditorWindow
[b0ab6cb]66        frame = DataEditorWindow(parent=self.parent, data=[],
67                                  title="Data Editor")
[91f151a]68        frame.Show(True)
[b0ab6cb]69        event.Skip()
[74b1770]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) 
[44148f0]78   
[fb0d7a20]79    def on_calculate_sld(self, event):
80        """
[6137b150]81        Compute the scattering length density of molecula
[fb0d7a20]82        """
83        from sld_panel import SldWindow
84        frame = SldWindow(base=self.parent)
85        frame.Show(True) 
[44148f0]86       
[378d2eb]87    def on_calculate_slit_size(self, event):
88        """
[6137b150]89        Compute the slit size a given data
[378d2eb]90        """
91        from slit_length_calculator_panel import SlitLengthCalculatorWindow
92        frame = SlitLengthCalculatorWindow(parent=self.parent)   
93        frame.Show(True)
[3be3a80]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 
[99503cb]103        #def on_perspective(self, event):
[427fa87]104        """
[6137b150]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       
[427fa87]111        """
[99503cb]112        #self.parent.set_perspective(self.perspective)
113        #if event != None:
114        #    event.Skip()
[a0ac888]115
[fb0d7a20]116   
117 
118   
Note: See TracBrowser for help on using the repository browser.