Ignore:
Timestamp:
Oct 27, 2010 4:41:30 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:
6cda91f
Parents:
c4d6900
Message:

working with pylint

File:
1 edited

Legend:

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

    r74b1770 rb0ab6cb  
    11#!/usr/bin/python 
     2""" 
     3Help panel for calculator 
     4""" 
     5import os 
    26import wx 
    37import wx.html as html 
    48from wx.lib.splitter import MultiSplitterWindow 
    59import sans.perspectives.calculator as calculator 
    6 import os 
    7 def help(): 
    8     """ 
    9         Provide general online help text 
    10         Future work: extend this function to allow topic selection 
    11     """ 
    12     info_txt  = "The inversion approach is based on Moore, J. Appl. Cryst. (1980) 13, 168-175.\n\n" 
    13     info_txt += "P(r) is set to be equal to an expansion of base functions of the type " 
    14     info_txt += "phi_n(r) = 2*r*sin(pi*n*r/D_max). The coefficient of each base functions " 
    15     info_txt += "in the expansion is found by performing a least square fit with the " 
    16     info_txt += "following fit function:\n\n" 
    17     info_txt += "chi**2 = sum_i[ I_meas(q_i) - I_th(q_i) ]**2/error**2 + Reg_term\n\n" 
    18     info_txt += "where I_meas(q) is the measured scattering intensity and I_th(q) is " 
    19     info_txt += "the prediction from the Fourier transform of the P(r) expansion. " 
    20     info_txt += "The Reg_term term is a regularization term set to the second derivative " 
    21     info_txt += "d**2P(r)/dr**2 integrated over r. It is used to produce a smooth P(r) output.\n\n" 
    22     info_txt += "The following are user inputs:\n\n" 
    23     info_txt += "   - Number of terms: the number of base functions in the P(r) expansion.\n\n" 
    24     info_txt += "   - Regularization constant: a multiplicative constant to set the size of " 
    25     info_txt += "the regularization term.\n\n" 
    26     info_txt += "   - Maximum distance: the maximum distance between any two points in the system.\n" 
    27       
    28     return info_txt 
    29      
    30 class HelpDialog(wx.Dialog): 
    31     def __init__(self, parent, id): 
    32        
    33         wx.Dialog.__init__(self, parent, id, size=(400, 420)) 
    34         self.SetTitle("Calculator help")  
    35          
    36  
    37         vbox = wx.BoxSizer(wx.VERTICAL) 
    38  
    39         explanation = help() 
    40             
    41         label_explain = wx.StaticText(self, -1, explanation, size=(350,320)) 
    42              
    43         vbox.Add(label_explain, 0, wx.ALL|wx.EXPAND, 15) 
    4410 
    4511 
    46         static_line = wx.StaticLine(self, -1) 
    47         vbox.Add(static_line, 0, wx.EXPAND, 0) 
    48          
    49         button_OK = wx.Button(self, wx.ID_OK, "OK") 
    50  
    51         sizer_button = wx.BoxSizer(wx.HORIZONTAL) 
    52         sizer_button.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    53         sizer_button.Add(button_OK, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)        
    54         vbox.Add(sizer_button, 0, wx.EXPAND|wx.BOTTOM|wx.TOP, 10) 
    55  
    56         self.SetSizer(vbox) 
    57         self.SetAutoLayout(True) 
    58          
    59         self.Layout() 
    60         self.Centre() 
    61  
    6212class HelpWindow(wx.Frame): 
    63     def __init__(self, parent, id, title= 'HelpWindow', pageToOpen=None): 
    64         wx.Frame.__init__(self, parent, id, title, size=(700, 450)) 
     13    """ 
     14    """ 
     15    def __init__(self, parent, title='HelpWindow', pageToOpen=None): 
     16        wx.Frame.__init__(self, parent, title, size=(700, 450)) 
    6517        """ 
    6618             contains help info 
    6719        """ 
    68        
    6920        splitter = MultiSplitterWindow(self, style=wx.SP_LIVE_UPDATE) 
    7021        rpanel = wx.Panel(splitter, -1) 
    71         lpanel = wx.Panel(splitter, -1,style=wx.BORDER_SUNKEN) 
     22        lpanel = wx.Panel(splitter, -1, style=wx.BORDER_SUNKEN) 
    7223         
    7324        vbox = wx.BoxSizer(wx.VERTICAL) 
     
    8435        vbox.Add(header, 0, wx.EXPAND) 
    8536        
    86         vboxl= wx.BoxSizer(wx.VERTICAL) 
     37        vboxl = wx.BoxSizer(wx.VERTICAL) 
    8738        headerl = wx.Panel(lpanel, -1, size=(-1, 20)) 
    8839        
     
    10354        self.path = calculator.get_data_path(media='media') 
    10455        
    105         
    106         page1="""<html> 
     56        page1 = """<html> 
    10757            <body> 
    10858             <p>Select topic on Menu</p> 
     
    11060            </html>""" 
    11161        self.rhelp.SetPage(page1) 
    112         page="""<html> 
     62        page = """<html> 
    11363            <body> 
    11464            <ul> 
    115             <li><a href ="sld_calculator_help.html" target ="showframe">SLD Calculator</a><br></li> 
    116             <li><a href ="slit_calculator_help.html" target ="showframe">Slit Size Calculator</a><br></li> 
    117             <li><a href ="kiessig_calculator_help.html" target ="showframe">Kiessig Thickness Calculator</a><br></li> 
     65            <li><a href ="sld_calculator_help.html"  
     66            target ="showframe">SLD Calculator</a><br></li> 
     67            <li><a href ="slit_calculator_help.html"  
     68            target ="showframe">Slit Size Calculator</a><br></li> 
     69            <li><a href ="kiessig_calculator_help.html"  
     70            target ="showframe">Kiessig Thickness Calculator</a><br></li> 
    11871            </ul> 
    11972            </body> 
     
    12174 
    12275        self.lhelp.SetPage(page) 
    123         self.lhelp.Bind(wx.html.EVT_HTML_LINK_CLICKED,self.OnLinkClicked ) 
     76        self.lhelp.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.OnLinkClicked) 
    12477         
    125         vbox.Add(self.rhelp,1, wx.EXPAND) 
     78        vbox.Add(self.rhelp, 1, wx.EXPAND) 
    12679        vboxl.Add(self.lhelp, 1, wx.EXPAND) 
    12780        rpanel.SetSizer(vbox) 
     
    13083         
    13184        vbox1 = wx.BoxSizer(wx.HORIZONTAL) 
    132         vbox1.Add(splitter,1,wx.EXPAND) 
     85        vbox1.Add(splitter, 1, wx.EXPAND) 
    13386        splitter.AppendWindow(lpanel, 200) 
    13487        splitter.AppendWindow(rpanel) 
     
    13891        self.Show(True) 
    13992         
    140          
    14193    def OnLinkClicked(self, event): 
    14294        """ 
    14395            Function to diplay html page related to the hyperlinktext selected 
    14496        """ 
    145         
    146         link= event.GetLinkInfo().GetHref() 
    147         link = os.path.join(self.path,link) 
     97        link = event.GetLinkInfo().GetHref() 
     98        link = os.path.join(self.path, link) 
    14899        self.rhelp.LoadPage(link) 
     100         
    149101         
    150102class ViewApp(wx.App): 
     
    153105        frame.Show(True) 
    154106        self.SetTopWindow(frame) 
    155          
    156107        return True 
    157108         
    158  
    159109if __name__ == "__main__":  
    160110    app = ViewApp(0) 
Note: See TracChangeset for help on using the changeset viewer.