Ignore:
Timestamp:
Jun 3, 2010 11:09:19 AM (15 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:
7e4a6ff
Parents:
d955bf19
Message:

working on documentation

Location:
invariantview/perspectives/invariant
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • invariantview/perspectives/invariant/help_panel.py

    r1c779b6 rd7a39e5  
    77     
    88class HelpDialog(wx.Dialog): 
     9    """ 
     10    """ 
    911    def __init__(self, parent, id): 
    10        
     12        """ 
     13        """ 
    1114        wx.Dialog.__init__(self, parent, id, size=(400, 420)) 
    1215        self.SetTitle("Invariant help")  
    1316         
    14  
    1517        vbox = wx.BoxSizer(wx.VERTICAL) 
    1618 
     
    3941 
    4042class HelpWindow(wx.Frame): 
     43    """ 
     44    """ 
    4145    def __init__(self, parent, id, title= 'HelpWindow', pageToOpen=None): 
    4246        wx.Frame.__init__(self, parent, id, title, size=(820, 450)) 
    4347        """ 
    44              contains help info 
     48        contains help info 
    4549        """ 
    4650       
     
    112116    def OnLinkClicked(self, event): 
    113117        """ 
    114             Function to diplay html page related to the hyperlinktext selected 
     118        Function to diplay html page related to the hyperlinktext selected 
    115119        """ 
    116120        self.rhelp.LoadPage(self.path) 
  • invariantview/perspectives/invariant/invariant.py

    r8f2069d5 rd7a39e5  
    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.  
    5  
    6 See the license text in license.txt 
    7  
    8 copyright 2009, University of Tennessee 
    9 """ 
     1 
     2 
     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 2009, University of Tennessee 
     12################################################################################ 
     13 
    1014import wx 
    1115 
     
    1721from sans.guicomm.events import NewPlotEvent, StatusEvent 
    1822from sans.guicomm.events import ERR_DATA 
     23 
    1924class Plugin: 
    2025    """ 
    21         This class defines the interface for invariant Plugin class 
    22         that can be used by the gui_manager. 
     26    This class defines the interface for invariant Plugin class 
     27    that can be used by the gui_manager. 
    2328          
    2429    """ 
     
    2631    def __init__(self, standalone=False): 
    2732        """ 
    28             Abstract class for gui_manager Plugins. 
     33        Abstract class for gui_manager Plugins. 
    2934        """ 
    3035        ## Plug-in name. It will appear on the application menu. 
     
    4146    def populate_menu(self, id, parent): 
    4247        """ 
    43             Create and return the list of application menu 
    44             items for the plug-in.  
    45              
    46             @param id: deprecated. Un-used. 
    47             @param parent: parent window 
    48             @return: plug-in menu 
     48        Create and return the list of application menu 
     49        items for the plug-in.  
     50         
     51        :param id: deprecated. Un-used. 
     52        :param parent: parent window 
     53         
     54        :return: plug-in menu 
     55         
    4956        """ 
    5057        return [] 
     
    5259    def help(self, evt): 
    5360        """ 
    54             Show a general help dialog.  
    55             TODO: replace the text with a nice image 
    56             provide more hint on the SLD calculator 
     61        Show a general help dialog.  
     62     
    5763        """ 
    5864        from help_panel import  HelpWindow 
     
    6268    def get_panels(self, parent): 
    6369        """ 
    64             Create and return the list of wx.Panels for your plug-in. 
    65             Define the plug-in perspective. 
    66              
    67             Panels should inherit from DefaultPanel defined below, 
    68             or should present the same interface. They must define 
    69             "window_caption" and "window_name". 
    70              
    71             @param parent: parent window 
    72             @return: list of panels 
     70        Create and return the list of wx.Panels for your plug-in. 
     71        Define the plug-in perspective. 
     72         
     73        Panels should inherit from DefaultPanel defined below, 
     74        or should present the same interface. They must define 
     75        "window_caption" and "window_name". 
     76         
     77        :param parent: parent window 
     78         
     79        :return: list of panels 
     80         
    7381        """ 
    7482        ## Save a reference to the parent 
     
    8593    def get_tools(self): 
    8694        """ 
    87             Returns a set of menu entries for tools 
     95        Returns a set of menu entries for tools 
    8896        """ 
    8997        return [] 
     
    92100    def get_context_menu(self, graph=None): 
    93101        """ 
    94             This method is optional. 
    95          
    96             When the context menu of a plot is rendered, the  
    97             get_context_menu method will be called to give you a  
    98             chance to add a menu item to the context menu. 
    99              
    100             A ref to a Graph object is passed so that you can 
    101             investigate the plot content and decide whether you 
    102             need to add items to the context menu.   
    103              
    104             This method returns a list of menu items. 
    105             Each item is itself a list defining the text to  
    106             appear in the menu, a tool-tip help text, and a 
    107             call-back method. 
    108              
    109             @param graph: the Graph object to which we attach the context menu 
    110             @return: a list of menu items with call-back function 
     102        This method is optional. 
     103     
     104        When the context menu of a plot is rendered, the  
     105        get_context_menu method will be called to give you a  
     106        chance to add a menu item to the context menu. 
     107         
     108        A ref to a Graph object is passed so that you can 
     109        investigate the plot content and decide whether you 
     110        need to add items to the context menu.   
     111         
     112        This method returns a list of menu items. 
     113        Each item is itself a list defining the text to  
     114        appear in the menu, a tool-tip help text, and a 
     115        call-back method. 
     116         
     117        :param graph: the Graph object to which we attach the context menu 
     118         
     119        :return: a list of menu items with call-back function 
     120         
    111121        """ 
    112122        self.graph = graph 
     
    127137    def get_perspective(self): 
    128138        """ 
    129             Get the list of panel names for this perspective 
     139        Get the list of panel names for this perspective 
    130140        """ 
    131141        return self.perspective 
     
    133143    def on_perspective(self, event): 
    134144        """ 
    135             Call back function for the perspective menu item. 
    136             We notify the parent window that the perspective 
    137             has changed. 
    138             @param event: menu event 
     145        Call back function for the perspective menu item. 
     146        We notify the parent window that the perspective 
     147        has changed. 
     148         
     149        :param event: menu event 
     150         
    139151        """ 
    140152        self.parent.set_perspective(self.perspective) 
     
    142154    def post_init(self): 
    143155        """ 
    144             Post initialization call back to close the loose ends 
     156        Post initialization call back to close the loose ends 
    145157        """ 
    146158        pass 
     
    148160    def set_default_perspective(self): 
    149161        """ 
    150            Call back method that True to notify the parent that the current plug-in 
    151            can be set as default  perspective. 
    152            when returning False, the plug-in is not candidate for an automatic  
    153            default perspective setting 
     162        Call back method that True to notify the parent that the current plug-in 
     163        can be set as default  perspective. 
     164        when returning False, the plug-in is not candidate for an automatic  
     165        default perspective setting 
    154166        """ 
    155167        return False 
     
    157169    def copy_data(self, item, dy=None): 
    158170        """ 
    159             receive a data 1D and the list of errors on dy 
    160             and create a new data1D data 
    161             @param return  
     171        receive a data 1D and the list of errors on dy 
     172        and create a new data1D data 
     173         
    162174        """ 
    163175        id = None 
     
    179191    def _on_data_error(self, event): 
    180192        """ 
    181             receives and event from plotting plu-gins to store the data name and  
    182             their errors of y coordinates for 1Data hide and show error 
     193        receives and event from plotting plu-gins to store the data name and  
     194        their errors of y coordinates for 1Data hide and show error 
    183195        """ 
    184196        self.err_dy = event.err_dy 
     
    186198    def _compute_invariant(self, event):     
    187199        """ 
    188             Open the invariant panel to invariant computation 
     200        Open the invariant panel to invariant computation 
    189201        """ 
    190202        self.panel = event.GetEventObject() 
     
    208220    def plot_theory(self, data=None, name=None): 
    209221        """ 
    210             Receive a data set and post a NewPlotEvent to parent. 
    211             @param data: extrapolated data to be plotted 
    212             @param name: Data's name to use for the legend 
     222        Receive a data set and post a NewPlotEvent to parent. 
     223         
     224        :param data: extrapolated data to be plotted 
     225        :param name: Data's name to use for the legend 
     226         
    213227        """ 
    214228        if data is None: 
     
    235249    def plot_data(self, scale, background): 
    236250        """ 
    237             replot the current data if the user enters a new scale or background 
     251        replot the current data if the user enters a new scale or background 
    238252        """ 
    239253        new_plot = scale * self.__data - background 
  • invariantview/perspectives/invariant/invariant_details.py

    r5dc4236 rd7a39e5  
    3131class InvariantContainer(wx.Object): 
    3232    """ 
    33         This class stores some values resulting resulting from invariant 
    34         calculations. Given the value of total invariant, this class can also  
    35         determine the percentage of invariants resulting from extrapolation. 
     33    This class stores some values resulting resulting from invariant 
     34    calculations. Given the value of total invariant, this class can also  
     35    determine the percentage of invariants resulting from extrapolation. 
    3636    """ 
    3737    def __init__(self): 
     
    6262    def compute_percentage(self): 
    6363        """ 
    64             Compute percentage of each invariant 
     64        Compute percentage of each invariant 
    6565        """ 
    6666        if self.qstar_total is None: 
     
    9999    def check_values(self): 
    100100        """ 
    101             check the validity if invariant 
     101        check the validity if invariant 
    102102        """ 
    103103        if self.qstar_total is None and self.qstar is None: 
     
    145145class InvariantDetailsPanel(wx.Dialog): 
    146146    """ 
    147         This panel describes proportion of invariants  
     147    This panel describes proportion of invariants  
    148148    """ 
    149149    def __init__(self, parent=None, id=-1, qstar_container=None,  
     
    182182    def _define_structure(self): 
    183183        """ 
    184             Define main sizers needed for this panel 
     184        Define main sizers needed for this panel 
    185185        """ 
    186186        #Box sizers must be defined first before defining buttons/textctrls (MAC). 
     
    206206    def _layout_shart(self): 
    207207        """ 
    208             Draw widgets related to chart 
     208        Draw widgets related to chart 
    209209        """ 
    210210        self.panel_chart = wx.Panel(self) 
     
    214214    def _layout_invariant(self): 
    215215        """ 
    216             Draw widgets related to invariant 
     216        Draw widgets related to invariant 
    217217        """ 
    218218        uncertainty = "+/-"  
     
    301301    def _layout_warning(self): 
    302302        """ 
    303             Draw widgets related to warning 
     303        Draw widgets related to warning 
    304304        """ 
    305305        #Warning [string] 
     
    312312    def _layout_button(self): 
    313313        """ 
    314             Draw widgets related to button 
     314        Draw widgets related to button 
    315315        """ 
    316316        #Close button 
     
    323323    def _do_layout(self): 
    324324        """ 
    325             Draw window content 
     325        Draw window content 
    326326        """ 
    327327        self._define_structure() 
     
    339339    def set_values(self): 
    340340        """ 
    341             Set value of txtcrtl 
     341        Set value of txtcrtl 
    342342        """ 
    343343        self.invariant_tcl.SetValue(format_number(self.qstar_container.qstar)) 
     
    350350    def get_scale(self, percentage, scale_name='scale'): 
    351351        """ 
    352             Check scale receive in this panel.  
     352        Check scale receive in this panel.  
    353353        """ 
    354354        scale = RECTANGLE_SCALE 
     
    366366    def set_color_bar(self): 
    367367        """ 
    368             Change the color for low and high bar when necessary 
     368        Change the color for low and high bar when necessary 
    369369        """ 
    370370        #warning to the user when the extrapolated invariant is greater than %5 
     
    376376    def on_close(self, event): 
    377377        """ 
    378             Close the current window 
     378        Close the current window 
    379379        """ 
    380380        self.Close() 
     
    382382    def on_paint(self, event): 
    383383        """ 
    384             Draw the chart 
     384        Draw the chart 
    385385        """ 
    386386        dc = wx.PaintDC(self.panel_chart) 
  • invariantview/perspectives/invariant/invariant_panel.py

    r3de66c1 rd7a39e5  
    11""" 
    2     This module provide GUI for the neutron scattering length density calculator 
    3     @author: Gervaise B. Alina 
     2This module provide GUI for the neutron scattering length density calculator 
     3 
    44""" 
    55 
     
    4747class InvariantPanel(ScrolledPanel): 
    4848    """ 
    49         Provides the Invariant GUI. 
     49    Provides the Invariant GUI. 
    5050    """ 
    5151    ## Internal nickname for the window, used by the AUI manager 
     
    8181    def err_check_on_data(self): 
    8282        """ 
    83             Check if data is valid for further computation 
     83        Check if data is valid for further computation 
    8484        """ 
    8585        flag = False 
     
    9898    def set_data(self, data): 
    9999        """ 
    100             Set the data 
     100        Set the data 
    101101        """ 
    102102        self._data = data 
     
    115115    def set_message(self): 
    116116        """ 
    117             Display warning message if available 
     117        Display warning message if available 
    118118        """ 
    119119        if self.inv_container is not None: 
     
    133133    def set_manager(self, manager): 
    134134        """ 
    135             set value for the manager 
     135        set value for the manager 
    136136        """ 
    137137        self._manager = manager  
     
    139139    def get_background(self): 
    140140        """ 
    141             @return the background textcrtl value as a float 
     141        return the background textcrtl value as a float 
    142142        """ 
    143143        background = self.background_tcl.GetValue().lstrip().rstrip() 
     
    151151    def get_scale(self): 
    152152        """ 
    153             @return the scale textcrtl value as a float 
     153        return the scale textcrtl value as a float 
    154154        """ 
    155155        scale = self.scale_tcl.GetValue().lstrip().rstrip() 
     
    167167    def get_contrast(self): 
    168168        """ 
    169             @return the contrast textcrtl value as a float 
     169        return the contrast textcrtl value as a float 
    170170        """ 
    171171        par_str = self.contrast_tcl.GetValue().strip() 
     
    189189    def get_porod_const(self): 
    190190        """ 
    191             @return the porod constant textcrtl value as a float 
     191        return the porod constant textcrtl value as a float 
    192192        """ 
    193193        par_str = self.porod_constant_tcl.GetValue().strip() 
     
    304304    def set_extrapolation_low(self, inv, low_q=False): 
    305305        """ 
    306             @return float value necessary to compute invariant a low q 
     306        return float value necessary to compute invariant a low q 
    307307        """ 
    308308        #get funtion 
     
    341341    def set_extrapolation_high(self, inv, high_q=False): 
    342342        """ 
    343             @return float value necessary to compute invariant a high q 
     343        return float value necessary to compute invariant a high q 
    344344        """ 
    345345        power_high = None 
     
    372372    def display_details(self, event): 
    373373        """ 
    374             open another panel for more details on invariant calculation 
     374        open another panel for more details on invariant calculation 
    375375        """ 
    376376        panel = InvariantDetailsPanel(parent=self,  
     
    382382    def compute_invariant(self, event=None): 
    383383        """ 
    384             compute invariant  
     384        compute invariant  
    385385        """ 
    386386        msg= "" 
     
    465465    def reset_panel(self): 
    466466        """ 
    467             set the panel at its initial state. 
     467        set the panel at its initial state. 
    468468        """ 
    469469        self.background_tcl.SetValue(str(BACKGROUND)) 
     
    491491    def _reset_output(self): 
    492492        """ 
    493             clear outputs textcrtl 
     493        clear outputs textcrtl 
    494494        """ 
    495495        self.invariant_total_tcl.Clear() 
     
    504504    def _define_structure(self): 
    505505        """ 
    506             Define main sizers needed for this panel 
     506        Define main sizers needed for this panel 
    507507        """ 
    508508        ## Box sizers must be defined first before defining buttons/textctrls (MAC). 
     
    550550    def _layout_data_name(self): 
    551551        """ 
    552             Draw widgets related to data's name 
     552        Draw widgets related to data's name 
    553553        """ 
    554554        #Sizer hint  
     
    586586    def _layout_bkg_scale(self): 
    587587        """ 
    588             Draw widgets related to background and scale 
     588        Draw widgets related to background and scale 
    589589        """ 
    590590        background_txt = wx.StaticText(self, -1, 'Background : ')   
     
    605605    def _layout_contrast_porod(self): 
    606606        """ 
    607             Draw widgets related to porod constant and contrast 
     607        Draw widgets related to porod constant and contrast 
    608608        """ 
    609609        contrast_txt = wx.StaticText(self, -1, 'Contrast : ')   
     
    627627    def _enable_fit_power_law_low(self, event=None): 
    628628        """ 
    629             Enable and disable the power value editing 
     629        Enable and disable the power value editing 
    630630        """ 
    631631        if self.fix_enable_low.IsEnabled(): 
     
    637637    def _enable_low_q_section(self, event=None): 
    638638        """ 
    639             Disable or enable some button if the user enable low q extrapolation 
     639        Disable or enable some button if the user enable low q extrapolation 
    640640        """ 
    641641        if self.enable_low_cbox.GetValue(): 
     
    658658    def _enable_power_law_low(self, event=None): 
    659659        """ 
    660             Enable editing power law section at low q range 
     660        Enable editing power law section at low q range 
    661661        """ 
    662662        if self.guinier.GetValue(): 
     
    672672    def _layout_extrapolation_low(self): 
    673673        """ 
    674             Draw widgets related to extrapolation at low q range 
     674        Draw widgets related to extrapolation at low q range 
    675675        """ 
    676676        self.enable_low_cbox = wx.CheckBox(self, -1, "Enable Extrapolate Low Q") 
     
    742742    def _enable_fit_power_law_high(self, event=None): 
    743743        """ 
    744             Enable and disable the power value editing 
     744        Enable and disable the power value editing 
    745745        """ 
    746746        if self.fix_enable_high.IsEnabled(): 
     
    752752    def _enable_high_q_section(self, event=None): 
    753753        """ 
    754             Disable or enable some button if the user enable high q extrapolation 
     754        Disable or enable some button if the user enable high q extrapolation 
    755755        """ 
    756756        if self.enable_high_cbox.GetValue(): 
     
    771771    def _layout_extrapolation_high(self): 
    772772        """ 
    773             Draw widgets related to extrapolation at high q range 
     773        Draw widgets related to extrapolation at high q range 
    774774        """ 
    775775        self.enable_high_cbox = wx.CheckBox(self, -1, "Enable Extrapolate high-Q") 
     
    833833    def _layout_extrapolation(self): 
    834834        """ 
    835             Draw widgets related to extrapolation 
     835        Draw widgets related to extrapolation 
    836836        """ 
    837837        extra_hint = "Extrapolation Maximum Q Range [1/A]: " 
     
    869869    def _layout_volume_surface_sizer(self): 
    870870        """ 
    871             Draw widgets related to volume and surface 
     871        Draw widgets related to volume and surface 
    872872        """ 
    873873        unit_volume = '' 
     
    922922    def _layout_invariant_sizer(self): 
    923923        """ 
    924             Draw widgets related to invariant 
     924        Draw widgets related to invariant 
    925925        """ 
    926926        uncertainty = "+/-"  
     
    954954    def _layout_inputs_sizer(self): 
    955955        """ 
    956             Draw widgets related to inputs 
     956        Draw widgets related to inputs 
    957957        """ 
    958958        self._layout_bkg_scale() 
     
    963963    def _layout_outputs_sizer(self): 
    964964        """ 
    965             Draw widgets related to outputs 
     965        Draw widgets related to outputs 
    966966        """ 
    967967        self._layout_volume_surface_sizer() 
     
    973973    def _layout_button(self):   
    974974        """ 
    975             Do the layout for the button widgets 
     975        Do the layout for the button widgets 
    976976        """  
    977977        #compute button 
     
    995995    def _do_layout(self): 
    996996        """ 
    997             Draw window content 
     997        Draw window content 
    998998        """ 
    999999        self._define_structure() 
     
    10161016     
    10171017class InvariantDialog(wx.Dialog): 
     1018    """ 
     1019    """ 
    10181020    def __init__(self, parent=None, id=1,graph=None, 
    10191021                 data=None, title="Invariant",base=None): 
     
    10251027         
    10261028class InvariantWindow(wx.Frame): 
     1029    """ 
     1030    """ 
    10271031    def __init__(self, parent=None, id=1,graph=None,  
    10281032                 data=None, title="Invariant",base=None): 
  • invariantview/perspectives/invariant/invariant_widgets.py

    r6546e4b rd7a39e5  
    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 
    72 
    8 copyright 2009, University of Tennessee 
    9 """ 
     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 2009, University of Tennessee 
     12################################################################################ 
     13 
     14 
    1015import wx 
    1116import os 
     
    1318class InvTextCtrl(wx.TextCtrl): 
    1419    """ 
    15         Text control for model and fit parameters. 
    16         Binds the appropriate events for user interactions. 
     20    Text control for model and fit parameters. 
     21    Binds the appropriate events for user interactions. 
    1722    """ 
    1823    def __init__(self, *args, **kwds): 
     
    3035    def _on_set_focus(self, event): 
    3136        """ 
    32             Catch when the text control is set in focus to highlight the whole 
    33             text if necessary 
    34             @param event: mouse event 
     37        Catch when the text control is set in focus to highlight the whole 
     38        text if necessary 
     39         
     40        :param event: mouse event 
     41         
    3542        """ 
    3643        event.Skip() 
     
    3946    def _highlight_text(self, event): 
    4047        """ 
    41             Highlight text of a TextCtrl only of no text has be selected 
    42             @param event: mouse event 
     48        Highlight text of a TextCtrl only of no text has be selected 
     49         
     50        :param event: mouse event 
     51         
    4352        """ 
    4453        # Make sure the mouse event is available to other listeners 
     
    5766class OutputTextCtrl(wx.TextCtrl): 
    5867    """ 
    59         Text control used to display outputs. 
    60         No editing allowed. The background is  
    61         grayed out. User can't select text. 
     68    Text control used to display outputs. 
     69    No editing allowed. The background is  
     70    grayed out. User can't select text. 
    6271    """ 
    6372    def __init__(self, *args, **kwds): 
     
    7382    def _click(self, event): 
    7483        """ 
    75             Prevent further handling of the mouse event 
    76             by not calling Skip(). 
     84        Prevent further handling of the mouse event 
     85        by not calling Skip(). 
    7786        """  
    7887        pass 
Note: See TracChangeset for help on using the changeset viewer.