Changeset 4faed25 in sasview


Ignore:
Timestamp:
Jun 14, 2015 1:24:55 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:
7116dffd
Parents:
56e99f9
Message:

Added help button to category manager panel

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/guiframe/CategoryManager.py

    r79492222 r4faed25  
    8080    def __init__(self, parent, win_id, title): 
    8181        """ 
    82         Category Manager Dialog class 
     82        Category Manager Dialog class.  This is the class that is used to 
     83        bring up a dialog box allowing the user to create new model categories 
     84        and to add and remove models from a given category allowing complete 
     85        user customization of categories for models.  This and Category  
     86        Installer provide the mecahnisms for creating the category dictionary 
     87        which is saved as a json file so that categories remain persistent 
     88        from session to session 
    8389        :param win_id: A new wx ID 
    8490        :param title: Title for the window 
     
    8894        self.performance_blocking = False 
    8995 
     96        # get the current status of model categorization (from the dictionary) 
    9097        self.master_category_dict = defaultdict(list) 
    9198        self.by_model_dict = defaultdict(list) 
    9299        self.model_enabled_dict = defaultdict(bool) 
    93100 
     101        #----------Initialize panels, frames, and sizers ------------ 
     102        # the whole panel is panel of hbox (a horizontal sizer and contains 
     103        # the left_pane (vbox2 sizer) which houses all the buttons and 
     104        # the right_pane (vbox sizer) which houses the current model/category  
     105        #list) 
     106        #     Comments added June 14, 2015 -PDB 
    94107        wx.Frame.__init__(self, parent, win_id, title, size=(660, 400)) 
    95108 
     
    114127        self._set_enabled()       
    115128 
     129        #----------button and button layout ----------------------- 
    116130        vbox2 = wx.BoxSizer(wx.VERTICAL) 
    117131 
     132        #Create buttons 
    118133        sel = wx.Button(left_panel, -1, 'Enable All', size=(100, -1)) 
    119134        des = wx.Button(left_panel, -1, 'Disable All', size=(100, -1)) 
     
    121136                                  size=(100, -1)) 
    122137        ok_button = wx.Button(left_panel, -1, 'OK', size=(100, -1)) 
     138        help_button = wx.Button(left_panel, -1, 'HELP', size=(100, -1)) 
    123139        cancel_button = wx.Button(left_panel, -1, 'Cancel',  
    124140                                  size=(100, -1))         
     
    126142         
    127143 
     144        #bind buttons to action method 
    128145        self.Bind(wx.EVT_BUTTON, self._on_selectall,  
    129146                  id=sel.GetId()) 
     
    134151        self.Bind(wx.EVT_BUTTON, self._on_ok,  
    135152                  id = ok_button.GetId()) 
     153        self.Bind(wx.EVT_BUTTON, self._on_help,  
     154                  id = help_button.GetId()) 
    136155        self.Bind(wx.EVT_BUTTON, self._on_cancel,  
    137156                  id = cancel_button.GetId()) 
    138157 
     158        #add buttons to sizer (vbox2) and convert to panel so displays well 
     159        #on all platforms 
    139160        vbox2.Add(modify_button, 0, wx.TOP, 10) 
    140161        vbox2.Add((-1, 20)) 
     
    143164        vbox2.Add((-1, 20)) 
    144165        vbox2.Add(ok_button) 
     166        vbox2.Add(help_button) 
    145167        vbox2.Add(cancel_button) 
    146168 
    147169        left_panel.SetSizer(vbox2) 
    148170 
     171        #--------------------- layout of current cat/model list -------- 
    149172        vbox.Add(self.cat_list, 1, wx.EXPAND | wx.TOP, 3) 
    150173        vbox.Add((-1, 10)) 
     
    153176        right_panel.SetSizer(vbox) 
    154177 
     178        #-------------- put it all together ----------------- 
    155179        hbox.Add(left_panel, 0, wx.EXPAND | wx.RIGHT, 5) 
    156180        hbox.Add(right_panel, 1, wx.EXPAND) 
     
    294318        self.Destroy() 
    295319 
     320    def _on_help(self, event): 
     321        """ 
     322        Bring up the Category Manager Panel Documentation whenever 
     323        the HELP button is clicked. 
     324 
     325        Calls DocumentationWindow with the path of the location within the 
     326        documentation tree (after /doc/ ....".  Note that when using old 
     327        versions of Wx (before 2.9) and thus not the release version of 
     328        installers, the help comes up at the top level of the file as 
     329        webbrowser does not pass anything past the # to the browser when it is 
     330        running "file:///...." 
     331 
     332    :param evt: Triggers on clicking the help button 
     333    """ 
     334 
     335        #import documentation window here to avoid circular imports 
     336        #if put at top of file with rest of imports. 
     337        from documentation_window import DocumentationWindow 
     338 
     339        _TreeLocation = "user/perspectives/fitting/fitting_help.html" 
     340        _PageAnchor = "#category-manager" 
     341        _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, _PageAnchor, 
     342                                          "Category Manager Help") 
     343 
    296344    def _on_cancel(self, event): 
    297345        """ 
Note: See TracChangeset for help on using the changeset viewer.