Changeset 3f5d75b in sasview


Ignore:
Timestamp:
Feb 28, 2015 9:12:57 PM (9 years ago)
Author:
butler
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:
f1e80df
Parents:
cfe472e
Message:

Fixed General Scattering Panel

  • Removed abandoned menu bar code
  • Removed toolbar code - It is not consistent with rest of tools.

Furthermore, it had nothing useful except help.

  • Added a Help button to bottom of panel
  • Cleaned up help code (i.e. removed all the old code and replaced with

simple call to Sphinx documentation)

  • Fixed sizing of panel (1 + ½.5 = 1.4 not 1.3 for total width)

—- still seems to be an odd vertical line to left of right hand pane
when trying to resize said pane.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/perspectives/calculator/gen_scatter_panel.py

    r7a04dbb r3f5d75b  
    3737from sas.perspectives.calculator import calculator_widgets as widget 
    3838from sas.guiframe.events import NewPlotEvent     
     39from sas.guiframe.documentation_window import DocumentationWindow 
    3940 
    4041_BOX_WIDTH = 76 
     
    8081    return False 
    8182 
     83 
     84 
    8285class CalcGen(CalcThread): 
    8386    """ 
     
    119122    ## Name to appear on the window title bar 
    120123    window_caption = "Generic SAS " 
    121     ## Flag to tell the AUI manager to put this panel in the center pane 
    122     CENTER_PANE = True 
    123124     
    124125    def __init__(self, parent, *args, **kwds): 
     
    192193        id = wx.NewId() 
    193194        self.browse_button = wx.Button(self, id, "Load") 
    194         hint_on_browse = "Click on this button to load a data in this panel." 
    195         #self.browse_button.SetToolTipString(hint_on_browse) 
     195        hint_on_browse = "Click to load data into this panel." 
     196        self.browse_button.SetToolTipString(hint_on_browse) 
    196197        self.Bind(wx.EVT_BUTTON, self.on_load_data, id=id) 
    197198        self.data_name_sizer.AddMany([(data_name_txt, 0, wx.LEFT, 15), 
     
    379380        self.bt_compute.Bind(wx.EVT_BUTTON, self.on_compute) 
    380381        self.bt_compute.SetToolTipString("Compute 2D Scattering Pattern.") 
     382        self.bt_help = wx.Button(self, wx.NewId(),'HELP') 
     383        self.bt_help.Bind(wx.EVT_BUTTON, self.on_help) 
     384        self.bt_help.SetToolTipString("Help on Scatter Calculator") 
    381385        self.button_sizer.AddMany([(self.time_text , 0, wx.LEFT, 20), 
    382                                    (self.orient_combo , 0, wx.LEFT, 40), 
    383                                    (self.bt_compute, 0, wx.LEFT, 20)]) 
     386                                   (self.orient_combo , 0, wx.LEFT, 20), 
     387                                   (self.bt_compute, 0, wx.LEFT, 20), 
     388                                   (self.bt_help, 0, wx.LEFT, 5)]) 
    384389         
    385390    def estimate_ctime(self): 
     
    883888            self.SetFocus() 
    884889 
     890    def on_help(self, event):     
     891        """ 
     892        Bring up the General scattering Calculator Documentation whenever 
     893        the HELP button is clicked.  
     894         
     895        Calls DocumentationWindow with the path of the location within the 
     896        documentation tree (after /doc/ ....".  Note that when using old  
     897        versions of Wx (before 2.9) and thus not the release version of  
     898        installers, the help comes up at the top level of the file as  
     899        webbrowser does not pass anything past the # to the browser when it is 
     900        running "file:///...." 
     901     
     902    :param evt: Triggers on clicking the help button 
     903    """ 
     904                 
     905        _TreeLocation = "user/perspectives/calculator/sas_calculator_help.html" 
     906        _doc_viewer = DocumentationWindow(self, -1, \ 
     907             _TreeLocation,"General Scattering Calculator Help") 
     908 
    885909    def _check_value(self): 
    886910        """ 
     
    11981222    ## Name to appear on the window title bar 
    11991223    window_caption = "SLD Pixel Info " 
    1200     ## Flag to tell the AUI manager to put this panel in the center pane 
    1201     CENTER_PANE = False 
    12021224     
    12031225    def __init__(self, parent, *args, **kwds): 
     
    15271549    def _do_layout(self): 
    15281550        """ 
    1529         Draw window content 
     1551        Draw omf panel content, used to define sld s. 
     1552         
    15301553        """ 
    15311554        self._define_structure() 
     
    17981821    """ 
    17991822    def __init__(self, parent=None, manager= None, title="Generic Scattering Calculator", 
    1800                 size=(PANEL_WIDTH * 1.3, PANEL_HEIGHT * 1.65), *args, **kwds): 
     1823                size=(PANEL_WIDTH * 1.4, PANEL_HEIGHT * 1.65), *args, **kwds): 
    18011824        """ 
    18021825        Init 
     
    18201843        self.Bind(wx.EVT_CLOSE, self.on_close) 
    18211844         
    1822         self._build_toolbar() 
    18231845         
    18241846        self.build_panels() 
    1825         self.SetPosition((25, 150)) 
     1847        self.SetPosition((20, 5)) 
    18261848        self.Show(True) 
    1827      
    1828     def _build_toolbar(self): 
    1829         """ 
    1830         Build toolbar 
    1831         """ 
    1832         tsize = (20, 20) 
    1833         # The legacy code doesn't work well for wx 3.0 
    1834         # but the old code produces better results with wx 2.8 
    1835         if wx.VERSION_STRING >= '3.0.0.0': 
    1836             tb = wx.ToolBar(self, style=wx.TB_HORIZONTAL | wx.TB_FLAT) 
    1837             sizer = wx.BoxSizer(wx.VERTICAL) 
    1838             sizer.Add(tb, 0, wx.EXPAND) 
    1839             self.SetSizer(sizer) 
    1840         else: 
    1841             tb = self.CreateToolBar(wx.TB_HORIZONTAL | wx.TB_FLAT) 
    1842         open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR,  
    1843                                             tsize) 
    1844         save_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE_AS, wx.ART_TOOLBAR, 
    1845                                             tsize) 
    1846         close_bmp = wx.ArtProvider.GetBitmap(wx.ART_QUIT, wx.ART_TOOLBAR,  
    1847                                             tsize) 
    1848         help_bmp = wx.ArtProvider.GetBitmap(wx.ART_HELP, wx.ART_TOOLBAR,  
    1849                                            (17, 20)) 
    1850          
    1851         id = wx.NewId() 
    1852         tb.AddLabelTool(id, "Open", open_bmp, shortHelp="Open",  
    1853                         longHelp="Open sld/omf file") 
    1854         self.Bind(wx.EVT_TOOL, self.on_open_file, id=id) 
    1855  
    1856         id = wx.NewId() 
    1857         tb.AddSimpleTool(id, save_bmp, "Save", "Save as sld file") 
    1858         self.Bind(wx.EVT_TOOL, self.on_save_file, id=id) 
    1859          
    1860         tb.AddSeparator() 
    1861         id = wx.NewId() 
    1862         tb.AddSimpleTool(id, close_bmp, "Quit", "Quit") 
    1863         self.Bind(wx.EVT_TOOL, self.on_close, id=id) 
    1864          
    1865         tb.AddSeparator() 
    1866         id = wx.NewId() 
    1867         tb.AddSimpleTool(id, help_bmp, "Help", "Help") 
    1868         self.Bind(wx.EVT_TOOL, self.on_help, id=id) 
    1869  
    1870         tb.Realize() 
    1871          
    1872     def _build_menubar(self): 
    1873         """ 
    1874         Build menubar 
    1875         """ 
    1876         tsize = (13, 13) 
    1877         open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR,  
    1878                                             tsize) 
    1879         save_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE_AS, wx.ART_TOOLBAR, 
    1880                                             tsize) 
    1881         quit_bmp = wx.ArtProvider.GetBitmap(wx.ART_QUIT, wx.ART_TOOLBAR,  
    1882                                            tsize) 
    1883         help_bmp = wx.ArtProvider.GetBitmap(wx.ART_HELP, wx.ART_TOOLBAR,  
    1884                                            (13, 15)) 
    1885          
    1886         menu_bar = wx.MenuBar() 
    1887          
    1888         menu = wx.Menu() 
    1889         id = wx.NewId() 
    1890         item = wx.MenuItem(menu, id, "&Open sld/omf file") 
    1891         item.SetBitmap(open_bmp) 
    1892         menu.AppendItem(item) 
    1893         wx.EVT_MENU(self, id, self.on_open_file) 
    1894          
    1895         id = wx.NewId() 
    1896         item = wx.MenuItem(menu, id, "&Save as sld file") 
    1897         item.SetBitmap(save_bmp) 
    1898         menu.AppendItem(item) 
    1899         wx.EVT_MENU(self, id, self.on_save_file) 
    1900          
    1901         menu.AppendSeparator() 
    1902         id = wx.NewId() 
    1903         item = wx.MenuItem(menu, id, "&Quit") 
    1904         item.SetBitmap(quit_bmp) 
    1905         menu.AppendItem(item) 
    1906  
    1907         menu_bar.Append(menu, "&File") 
    1908         wx.EVT_MENU(self, id, self.on_close) 
    1909          
    1910         menu_help = wx.Menu() 
    1911         id = wx.NewId() 
    1912         item = wx.MenuItem(menu_help, id, "&Theory and GUI") 
    1913         item.SetBitmap(help_bmp) 
    1914         menu_help.AppendItem(item) 
    1915         wx.EVT_MENU(self, id, self.on_help) 
    1916          
    1917         menu_bar.Append(menu_help, "&Help") 
    1918          
    1919         self.SetMenuBar(menu_bar) 
    19201849         
    19211850    def build_panels(self): 
     
    19241853         
    19251854        self.set_sld_data(self.sld_data) 
    1926          
    19271855        self._mgr.AddPane(self.panel, aui.AuiPaneInfo(). 
    19281856                              Name(self.panel.window_name). 
     
    21082036        self.Destroy() 
    21092037         
    2110     def on_help(self, event):     
    2111         """ 
    2112         Gen scatter angle help panel 
    2113         """ 
    2114         from sas.perspectives.calculator.help_panel import  HelpWindow 
    2115         # Get models help model_function path 
    2116         import sas.perspectives.calculator as calmedia 
    2117  
    2118         media = calmedia.get_data_path(media='media') 
    2119         path = os.path.join(media,"gen_sas_help.html")  
    2120         name = "Generic Scattering Calculator" 
    2121         frame = HelpWindow(self, -1,  
    2122                            title=' Help: GenSAS',   
    2123                            pageToOpen=path, size=(865, 450))    
    2124         try:  
    2125             frame.splitter.DetachWindow(frame.lpanel) 
    2126             # Display only the right side one 
    2127             frame.lpanel.Hide()  
    2128             frame.Show(True) 
    2129             add_icon(self.parent, frame) 
    2130         except: 
    2131             frame.Destroy()  
    2132             msg = 'Display Error\n' 
    2133             info = "Info" 
    2134             wx.MessageBox(msg, info) 
     2038#    def on_help(self, event):     
     2039#        """ 
     2040#       Gen scatter angle help panel 
     2041#        """ 
     2042#        from sas.perspectives.calculator.help_panel import  HelpWindow 
     2043#        # Get models help model_function path 
     2044#        import sas.perspectives.calculator as calmedia 
     2045# 
     2046#        media = calmedia.get_data_path(media='media') 
     2047#        path = os.path.join(media,"gen_sas_help.html")  
     2048#        name = "Generic Scattering Calculator" 
     2049#        frame = HelpWindow(self, -1,  
     2050#                           title=' Help: GenSAS',   
     2051#                           pageToOpen=path, size=(865, 450))    
     2052#        try:  
     2053#            frame.splitter.DetachWindow(frame.lpanel) 
     2054#            # Display only the right side one 
     2055#            frame.lpanel.Hide()  
     2056#            frame.Show(True) 
     2057#            add_icon(self.parent, frame) 
     2058#        except: 
     2059#            frame.Destroy()  
     2060#            msg = 'Display Error\n' 
     2061#            info = "Info" 
     2062#            wx.MessageBox(msg, info) 
    21352063            
    21362064if __name__ == "__main__":  
Note: See TracChangeset for help on using the changeset viewer.