Changeset 6137b150 in sasview for calculatorview/perspectives


Ignore:
Timestamp:
Jun 9, 2010 4:45:37 PM (14 years ago)
Author:
Gervaise Alina <gervyh@…>
Branches:
master, 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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
1b43306
Parents:
16f60cb
Message:

disable data editor

Location:
calculatorview/perspectives/calculator
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • calculatorview/perspectives/calculator/aperture_editor.py

    rad6f597 r6137b150  
    2121    def __init__(self, parent=None, manager=None,aperture=None, *args, **kwds): 
    2222        """ 
    23             Dialog allows to enter values for aperture 
     23        Dialog allows to enter values for aperture 
    2424        """ 
    2525        kwds['size'] =(PANEL_WIDTH, PANEL_HEIGHT) 
     
    3737    def _define_structure(self): 
    3838        """ 
    39             define initial sizer  
     39        define initial sizer  
    4040        """ 
    4141        self.main_sizer = wx.BoxSizer(wx.VERTICAL) 
     
    5252    def _layout_name(self): 
    5353        """ 
    54             Do the layout for aperture name related widgets 
     54        Do the layout for aperture name related widgets 
    5555        """ 
    5656        #Aperture name [string] 
     
    6161    def _layout_type(self): 
    6262        """ 
    63             Do the  layout for aperture type  related widgets 
     63        Do the  layout for aperture type  related widgets 
    6464        """ 
    6565        #Aperture type [string] 
     
    7171    def _layout_distance(self): 
    7272        """ 
    73             Do the  layout for aperture distance related widgets 
     73        Do the  layout for aperture distance related widgets 
    7474        """ 
    7575        #Aperture distance [float] 
     
    8484    def _layout_size_name(self): 
    8585        """ 
    86             Do the  layout for size name related widgets 
     86        Do the  layout for size name related widgets 
    8787        """ 
    8888        # Size name [string] 
     
    9494    def _layout_size(self): 
    9595        """ 
    96             Do the  layout for aperture size related widgets 
     96        Do the  layout for aperture size related widgets 
    9797        """ 
    9898        #Aperture size [Vector] 
     
    118118    def _layout_button(self):   
    119119        """ 
    120             Do the layout for the button widgets 
     120        Do the layout for the button widgets 
    121121        """  
    122122        self.bt_apply = wx.Button(self, -1,'Apply') 
     
    134134    def _do_layout(self, data=None): 
    135135        """ 
    136             Draw the current panel 
     136        Draw the current panel 
    137137        """ 
    138138        self._define_structure() 
     
    161161    def set_manager(self, manager): 
    162162        """     
    163             Set manager of this window 
     163        Set manager of this window 
    164164        """ 
    165165        self.manager = manager 
     
    167167    def reset_aperture(self): 
    168168        """ 
    169             put the default value of the detector back to the current aperture 
     169        put the default value of the detector back to the current aperture 
    170170        """ 
    171171        self._aperture.name = self._reset_aperture.name 
     
    181181    def set_values(self): 
    182182        """ 
    183             take the aperture values of the current data and display them 
    184             through the panel 
     183        take the aperture values of the current data and display them 
     184        through the panel 
    185185        """ 
    186186        aperture = self._aperture 
     
    204204    def get_aperture(self): 
    205205        """ 
    206             return the current aperture 
     206        return the current aperture 
    207207        """ 
    208208        return self._aperture 
     
    210210    def get_notes(self): 
    211211        """ 
    212             return notes 
     212        return notes 
    213213        """ 
    214214        return self._notes 
     
    216216    def on_change_name(self): 
    217217        """ 
    218             Change name 
     218        Change name 
    219219        """ 
    220220        #Change the name of the aperture 
     
    229229    def on_change_type(self): 
    230230        """ 
    231             Change aperture type 
     231        Change aperture type 
    232232        """ 
    233233        #Change type  
     
    239239    def on_change_distance(self): 
    240240        """ 
    241             Change distance of the aperture 
     241        Change distance of the aperture 
    242242        """ 
    243243        #Change distance 
     
    264264    def on_change_size_name(self): 
    265265        """ 
    266             Change the size's name 
     266        Change the size's name 
    267267        """ 
    268268        #Change size name 
     
    274274    def on_change_size(self): 
    275275        """ 
    276             Change aperture size 
     276        Change aperture size 
    277277        """ 
    278278        #Change x coordinate 
     
    330330    def on_click_apply(self, event): 
    331331        """ 
    332             Apply user values to the aperture 
     332        Apply user values to the aperture 
    333333        """ 
    334334        self.on_change_name() 
     
    343343    def on_click_cancel(self, event): 
    344344        """ 
    345             reset the current aperture to its initial values 
     345        reset the current aperture to its initial values 
    346346        """ 
    347347        self.reset_aperture() 
  • calculatorview/perspectives/calculator/calculator.py

    r91f151a r6137b150  
    1 """ 
    2 This software was developed by the University of Tennessee as part of the 
    3 Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 
    4 project funded by the US National Science Foundation.  
    51 
    6 See the license text in license.txt 
    7  
    8 copyright 2010, University of Tennessee 
    9 """ 
     2################################################################################ 
     3#This software was developed by the University of Tennessee as part of the 
     4#Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 
     5#project funded by the US National Science Foundation.  
     6# 
     7#See the license text in license.txt 
     8# 
     9#copyright 2010, University of Tennessee 
     10################################################################################ 
    1011 
    1112import wx 
     
    1415class Plugin: 
    1516    """ 
    16         This class defines the interface for a Plugin class 
    17         for calculator perspective 
     17    This class defines the interface for a Plugin class 
     18    for calculator perspective 
    1819    """ 
    1920     
    2021    def __init__(self, standalone=True): 
    2122        """ 
    22             Abstract class for gui_manager Plugins. 
     23        Abstract class for gui_manager Plugins. 
    2324        """ 
    2425        ## Plug-in name. It will appear on the application menu. 
     
    3637    def populate_menu(self, id, owner): 
    3738        """ 
    38             Create and return the list of application menu 
    39             items for the plug-in.  
    40              
    41             @param id: deprecated. Un-used. 
    42             @param parent: parent window 
    43             @return: plug-in menu 
     39        Create and return the list of application menu 
     40        items for the plug-in.  
     41         
     42        :param id: deprecated. Un-used. 
     43        :param parent: parent window 
     44         
     45        :return: plug-in menu 
     46         
    4447        """ 
    4548        return [] 
     
    4750    def get_panels(self, parent): 
    4851        """ 
    49             Create and return the list of wx.Panels for your plug-in. 
    50             Define the plug-in perspective. 
    51              
    52             Panels should inherit from DefaultPanel defined below, 
    53             or should present the same interface. They must define 
    54             "window_caption" and "window_name". 
    55              
    56             @param parent: parent window 
    57             @return: list of panels 
     52        Create and return the list of wx.Panels for your plug-in. 
     53        Define the plug-in perspective. 
     54         
     55        Panels should inherit from DefaultPanel defined below, 
     56        or should present the same interface. They must define 
     57        "window_caption" and "window_name". 
     58         
     59        :param parent: parent window 
     60         
     61        :return: list of panels 
     62         
    5863        """ 
    5964        ## Save a reference to the parent 
     
    6570    def help(self, evt): 
    6671        """ 
    67             Show a general help dialog.  
    68             TODO: replace the text with a nice image 
     72        Show a general help dialog.  
     73         
     74        :TODO: replace the text with a nice image 
    6975            provide more hint on the SLD calculator 
    7076        """ 
     
    7581    def get_context_menu(self, graph=None): 
    7682        """ 
    77             This method is optional. 
     83        This method is optional. 
     84     
     85        When the context menu of a plot is rendered, the  
     86        get_context_menu method will be called to give you a  
     87        chance to add a menu item to the context menu. 
    7888         
    79             When the context menu of a plot is rendered, the  
    80             get_context_menu method will be called to give you a  
    81             chance to add a menu item to the context menu. 
    82              
    83             A ref to a Graph object is passed so that you can 
    84             investigate the plot content and decide whether you 
    85             need to add items to the context menu.   
    86              
    87             This method returns a list of menu items. 
    88             Each item is itself a list defining the text to  
    89             appear in the menu, a tool-tip help text, and a 
    90             call-back method. 
     89        A ref to a Graph object is passed so that you can 
     90        investigate the plot content and decide whether you 
     91        need to add items to the context menu.   
     92         
     93        This method returns a list of menu items. 
     94        Each item is itself a list defining the text to  
     95        appear in the menu, a tool-tip help text, and a 
     96        call-back method. 
    9197             
    9298            @param graph: the Graph object to which we attach the context menu 
     
    97103    def get_perspective(self): 
    98104        """ 
    99             Get the list of panel names for this perspective 
     105        Get the list of panel names for this perspective 
    100106        """ 
    101107        return self.perspective 
     
    104110    def get_tools(self): 
    105111        """ 
    106             Returns a set of menu entries for tools 
     112        Returns a set of menu entries for tools 
    107113        """ 
    108114        sld_help = "Provides computation related to Scattering Length Density" 
     
    111117        return [("SLD Calculator", sld_help, self.on_calculate_sld), 
    112118                ("Slit Size Calculator", slit_length_help, 
    113                                 self.on_calculate_slit_size), 
    114                 ("Data Editor", data_editor_help, 
    115                      self.on_edit_data)] 
     119                                self.on_calculate_slit_size)]#, 
     120                #("Data Editor", data_editor_help, self.on_edit_data)] 
    116121               
    117122    def on_edit_data(self, event): 
    118123        """ 
    119             Edit meta data  
     124        Edit meta data  
    120125        """ 
    121126        from data_editor import DataEditorWindow 
     
    125130    def on_calculate_sld(self, event): 
    126131        """ 
    127             Compute the scattering length density of molecula 
     132        Compute the scattering length density of molecula 
    128133        """ 
    129134        from sld_panel import SldWindow 
     
    133138    def on_calculate_slit_size(self, event): 
    134139        """ 
    135             Compute the slit size a given data 
     140        Compute the slit size a given data 
    136141        """ 
    137142        from slit_length_calculator_panel import SlitLengthCalculatorWindow 
     
    141146    def on_perspective(self, event): 
    142147        """ 
    143             Call back function for the perspective menu item. 
    144             We notify the parent window that the perspective 
    145             has changed. 
    146             @param event: menu event 
     148        Call back function for the perspective menu item. 
     149        We notify the parent window that the perspective 
     150        has changed. 
     151         
     152        :param event: menu event 
     153         
    147154        """ 
    148155        self.parent.set_perspective(self.perspective) 
     
    151158    def post_init(self): 
    152159        """ 
    153             Post initialization call back to close the loose ends 
     160        Post initialization call back to close the loose ends 
    154161        """ 
    155162        pass 
  • calculatorview/perspectives/calculator/collimation_editor.py

    rc5dca87 r6137b150  
    2222     
    2323class CollimationDialog(wx.Dialog): 
     24    """ 
     25    """ 
    2426    def __init__(self, parent=None, manager=None, 
    2527                 collimation=[], *args, **kwds): 
     
    4042    def _define_structure(self): 
    4143        """ 
    42             define initial sizer  
     44        define initial sizer  
    4345        """ 
    4446        self.main_sizer = wx.BoxSizer(wx.VERTICAL) 
     
    6365    def _layout_collimation(self): 
    6466        """ 
    65             Do the layout for collimation related widgets 
     67        Do the layout for collimation related widgets 
    6668        """ 
    6769        collimation_name_txt = wx.StaticText(self, -1, "Collimation:")  
     
    9799    def _layout_name(self): 
    98100        """ 
    99             Do the layout for collimation name related widgets 
     101        Do the layout for collimation name related widgets 
    100102        """ 
    101103        #Collimation name [string] 
     
    107109    def _layout_length(self): 
    108110        """ 
    109             Do the  layout for length related widgets 
     111        Do the  layout for length related widgets 
    110112        """ 
    111113        #Collimation length 
     
    121123    def _layout_button(self):   
    122124        """ 
    123             Do the layout for the button widgets 
     125        Do the layout for the button widgets 
    124126        """  
    125127        self.bt_apply = wx.Button(self, -1,'Apply') 
     
    136138    def _layout_aperture(self): 
    137139        """ 
    138             Do the layout for aperture related widgets 
     140        Do the layout for aperture related widgets 
    139141        """ 
    140142        aperture_name_txt = wx.StaticText(self, -1, "Aperture:")  
     
    170172    def _do_layout(self, data=None): 
    171173        """ 
    172             Draw the current panel 
     174        Draw the current panel 
    173175        """ 
    174176        self._define_structure() 
     
    206208    def fill_collimation_combox(self): 
    207209        """ 
    208             fill the current combobox with the available collimation 
     210        fill the current combobox with the available collimation 
    209211        """ 
    210212        if self._collimation is None or self._collimation == []: 
     
    218220    def add_collimation(self, event): 
    219221        """ 
    220             Append empty collimation to data's list of collimation 
     222        Append empty collimation to data's list of collimation 
    221223        """ 
    222224         
     
    236238    def remove_collimation(self, event): 
    237239        """ 
    238             Remove collimation to data's list of collimation 
     240        Remove collimation to data's list of collimation 
    239241        """ 
    240242        if self.collimation_cbox.IsEnabled(): 
     
    263265    def on_select_collimation(self, event): 
    264266        """ 
    265            fill the control on the panel according to the current  selected collimation  
     267        fill the control on the panel according to the current  selected collimation  
    266268        """ 
    267269        self.set_values() 
     
    271273    def enable_collimation(self): 
    272274        """ 
    273             Enable /disable widgets related to collimation 
     275        Enable /disable widgets related to collimation 
    274276        """ 
    275277        if self._collimation is not None and self.collimation_cbox.GetCount() > 0: 
     
    291293    def reset_collimation_combobox(self, edited_collimation): 
    292294        """ 
    293             take all edited editor and reset clientdata of collimation combo box 
     295        take all edited editor and reset clientdata of collimation combo box 
    294296        """ 
    295297        for position in range(self.collimation_cbox.GetCount()): 
     
    303305    def add_aperture(self, event): 
    304306        """ 
    305             Append empty aperture to data's list of aperture 
     307        Append empty aperture to data's list of aperture 
    306308        """ 
    307309        collimation, _, _ = self.get_current_collimation() 
     
    317319    def edit_aperture(self, event): 
    318320        """ 
    319             Edit the selected aperture 
     321        Edit the selected aperture 
    320322        """ 
    321323        if self._collimation is None or not self.aperture_cbox.IsEnabled(): 
     
    331333    def remove_aperture(self, event): 
    332334        """ 
    333             Remove aperture to data's list of aperture 
     335        Remove aperture to data's list of aperture 
    334336        """ 
    335337        if self._collimation is None or not self._collimation: 
     
    354356    def set_aperture(self, aperture): 
    355357        """ 
    356             set aperture for data 
     358        set aperture for data 
    357359        """ 
    358360        if self._collimation is None or not self._collimation: 
     
    368370    def enable_aperture(self): 
    369371        """ 
    370             Enable /disable widgets crelated to aperture 
     372        Enable /disable widgets crelated to aperture 
    371373        """ 
    372374        collimation, _, _ = self.get_current_collimation() 
     
    390392    def reset_aperture_combobox(self, edited_aperture): 
    391393        """ 
    392             take all edited editor and reset clientdata of aperture combo box 
     394        take all edited editor and reset clientdata of aperture combo box 
    393395        """ 
    394396        for position in range(self.aperture_cbox.GetCount()): 
     
    402404    def fill_aperture_combox(self): 
    403405        """ 
    404             fill the current combobox with the available aperture 
     406        fill the current combobox with the available aperture 
    405407        """ 
    406408        self.aperture_cbox.Clear() 
     
    416418    def set_manager(self, manager): 
    417419        """     
    418             Set manager of this window 
     420        Set manager of this window 
    419421        """ 
    420422        self.manager = manager 
     
    422424    def set_values(self): 
    423425        """ 
    424             take the collimation values of the current data and display them 
    425             through the panel 
     426        take the collimation values of the current data and display them 
     427        through the panel 
    426428        """ 
    427429        collimation, _, _ = self.get_current_collimation() 
     
    441443    def get_collimation(self): 
    442444        """ 
    443             return the current collimation 
     445        return the current collimation 
    444446        """ 
    445447        return self._collimation 
     
    447449    def get_notes(self): 
    448450        """ 
    449             return notes 
     451        return notes 
    450452        """ 
    451453        return self._notes 
     
    453455    def on_change_name(self): 
    454456        """ 
    455             Change name 
     457        Change name 
    456458        """ 
    457459        collimation, collimation_name, position = self.get_current_collimation() 
     
    472474    def on_change_length(self): 
    473475        """ 
    474             Change the length 
     476        Change the length 
    475477        """ 
    476478        collimation, collimation_name, position = self.get_current_collimation() 
     
    501503    def on_click_apply(self, event): 
    502504        """ 
    503             Apply user values to the collimation 
     505        Apply user values to the collimation 
    504506        """ 
    505507        self.on_change_name() 
     
    511513    def on_click_cancel(self, event): 
    512514        """ 
    513             leave the collimation as it is and close 
     515        leave the collimation as it is and close 
    514516        """ 
    515517        self._collimation = deepcopy(self._reset_collimation) 
Note: See TracChangeset for help on using the changeset viewer.