Changeset 2509


Ignore:
Timestamp:
Oct 31, 2016 6:18:14 PM (5 years ago)
Author:
toby
Message:

fixes to help

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r2502 r2509  
    22142214        self.Bind(wx.EVT_MENU, self.OnExportPDF, id=item.GetId())
    22152215
    2216     def FillMainMenu(self,menubar):
     2216    def FillMainMenu(self,menubar,addhelp=True):
    22172217        '''Define contents of the main GSAS-II menu for the (main) data tree window.
    22182218        For the mac, this is also called for the data item windows as well so that
     
    22792279            menubar.Append(menu=self.MacroMenu, title='Macro')
    22802280            self._init_Macro()
    2281         HelpMenu=G2G.MyHelp(self,helpType='Data tree',
    2282             morehelpitems=[('&Tutorials','Tutorials'),])
    2283         menubar.Append(menu=HelpMenu,title='&Help')
     2281        if addhelp:
     2282            HelpMenu=G2G.MyHelp(self,includeTree=True,
     2283                morehelpitems=[('&Tutorials','Tutorials'),])
     2284            menubar.Append(menu=HelpMenu,title='&Help')
    22842285           
    22852286    def _init_ctrls(self, parent):
  • trunk/GSASIIIO.py

    r2491 r2509  
    781781                    if 'dict' in str(type(datum[1]['PythonVersions'])):  #patch
    782782                        for p in sorted(datum[1]['PythonVersions'],key=lambda s: s.lower()):
    783                             print("{:>14s}: {:s}".format(p[0],p[1]))
     783                            print("  {:>14s}: {:s}".format(p[0],p[1]))
    784784                    else:
    785785                        for p in datum[1]['PythonVersions']:
    786                             print("{:<12s} {:s}".format(p[0]+':',p[1]))
     786                            print("  {:>12s} {:s}".format(p[0]+':',p[1]))
    787787            for datus in data[1:]:
    788788                sub = G2frame.PatternTree.AppendItem(Id,datus[0])
  • trunk/GSASIIctrls.py

    r2498 r2509  
    30203020
    30213021    '''
    3022     def __init__(self,frame,helpType=None,helpLbl=None,morehelpitems=[],title=''):
    3023         wx.Menu.__init__(self,title)
     3022    def __init__(self,frame,helpType=None,helpLbl=None,includeTree=False,morehelpitems=[]):
     3023        wx.Menu.__init__(self,'')
    30243024        self.HelpById = {}
    30253025        self.frame = frame
     
    30413041            frame.Bind(wx.EVT_MENU, self.OnHelpById, helpobj)
    30423042            self.HelpById[helpobj.GetId()] = indx
    3043         # add a help item only when helpType is specified
     3043        # add help lookup(s) in gsasii.html
     3044        if helpType is not None or includeTree:
     3045            self.AppendSeparator()
     3046        if includeTree:
     3047            if helpLbl is None: helpLbl = helpType
     3048            helpobj = self.Append(text='Help on Data tree',
     3049                                  id=wx.ID_ANY, kind=wx.ITEM_NORMAL)
     3050            frame.Bind(wx.EVT_MENU, self.OnHelpById, id=helpobj.GetId())
     3051            self.HelpById[helpobj.GetId()] = 'Data tree'
    30443052        if helpType is not None:
    3045             self.AppendSeparator()
    30463053            if helpLbl is None: helpLbl = helpType
    30473054            helpobj = self.Append(text='Help on '+helpLbl,
    30483055                                  id=wx.ID_ANY, kind=wx.ITEM_NORMAL)
    3049             frame.Bind(wx.EVT_MENU, self.OnHelpById, helpobj)
     3056            frame.Bind(wx.EVT_MENU, self.OnHelpById, id=helpobj.GetId())
    30503057            self.HelpById[helpobj.GetId()] = helpType
    30513058       
     
    30863093
    30873094Please cite as:
    3088 B.H. Toby & R.B. Von Dreele, J. Appl. Cryst. 46, 544-549 (2013)
     3095  B.H. Toby & R.B. Von Dreele, J. Appl. Cryst. 46, 544-549 (2013)
    30893096For small angle use cite:
    3090 R.B. Von Dreele, J. Appl. Cryst. 47, 1748-9 (2014)
     3097  R.B. Von Dreele, J. Appl. Cryst. 47, 1748-9 (2014)
    30913098For DIFFaX use cite:
    3092 M.M.J. Treacy, J.M. Newsam & M.W. Deem,
    3093        Proc. Roy. Soc. Lond. A 433, 499-520 (1991)
     3099  M.M.J. Treacy, J.M. Newsam & M.W. Deem,
     3100  Proc. Roy. Soc. Lond. A 433, 499-520 (1991)
    30943101'''
    3095 
    30963102        info.WebSite = ("https://subversion.xray.aps.anl.gov/trac/pyGSAS","GSAS-II home page")
    30973103        wx.AboutBox(info)
     
    32473253
    32483254################################################################################
    3249 class AddHelp(wx.Menu):
    3250     '''For the Mac: creates an entry to the help menu of type
    3251     'Help on <helpType>': where helpType is a reference to an HTML page to
    3252     be opened.
    3253 
    3254     NOTE: when appending this menu (menu.Append) be sure to set the title to
    3255     '&Help' so that wx handles it correctly.
    3256     '''
    3257     def __init__(self,frame,helpType,helpLbl=None,title=''):
    3258         wx.Menu.__init__(self,title)
    3259         self.frame = frame
    3260         if helpLbl is None: helpLbl = helpType
    3261         # add a help item only when helpType is specified
    3262         helpobj = self.Append(text='Help on '+helpLbl,
    3263                               id=wx.ID_ANY, kind=wx.ITEM_NORMAL)
    3264         frame.Bind(wx.EVT_MENU, self.OnHelpById, helpobj)
    3265         self.HelpById = helpType
    3266        
    3267     def OnHelpById(self,event):
    3268         '''Called when Help on... is pressed in a menu. Brings up
    3269         a web page for documentation.
    3270         '''
    3271         ShowHelp(self.HelpById,self.frame)
    3272 
    3273 ################################################################################
    32743255class HelpButton(wx.Button):
    32753256    '''Create a help button that displays help information.
     
    37753756htmlFrame = None
    37763757htmlFirstUse = True
    3777 helpLocDict = {}
     3758#helpLocDict = {}  # to be implemented if we ever split gsasii.html over multiple files
    37783759path2GSAS2 = os.path.dirname(os.path.realpath(__file__)) # save location of this file
    37793760def ShowHelp(helpType,frame):
     
    37813762    global htmlFirstUse
    37823763    # look up a definition for help info from dict
    3783     helplink = helpLocDict.get(helpType)
    3784     if helplink is None:
     3764    #helplink = helpLocDict.get(helpType)
     3765    #if helplink is None:
     3766    if True:
    37853767        # no defined link to use, create a default based on key
    37863768        helplink = 'gsasII.html#'+helpType.replace(' ','_')
    3787     helplink = os.path.join(path2GSAS2,'help',helplink)
    37883769    # determine if a web browser or the internal viewer should be used for help info
    37893770    if GSASIIpath.GetConfigValue('Help_mode'):
     
    37923773        helpMode = 'browser'
    37933774    if helpMode == 'internal':
     3775        helplink = os.path.join(path2GSAS2,'help',helplink)
    37943776        try:
    37953777            htmlPanel.LoadFile(helplink)
     
    38023784            htmlPanel.LoadFile(helplink)
    38033785    else:
     3786        if sys.platform == "darwin": # for Mac, force use of safari to preserve anchors on file URLs
     3787            wb = webbrowser.MacOSXOSAScript('safari')
     3788        else:
     3789            wb = webbrowser
     3790        helplink = os.path.join(path2GSAS2,'help',helplink)
    38043791        pfx = "file://"
    38053792        if sys.platform.lower().startswith('win'):
    38063793            pfx = ''
     3794        #if GSASIIpath.GetConfigValue('debug'): print 'Help link=',pfx+helplink
    38073795        if htmlFirstUse:
    3808             webbrowser.open_new(pfx+helplink)
     3796            wb.open_new(pfx+helplink)
    38093797            htmlFirstUse = False
    38103798        else:
    3811             webbrowser.open(pfx+helplink, new=0, autoraise=True)
     3799            wb.open(pfx+helplink, new=0, autoraise=True)
    38123800
    38133801def ShowWebPage(URL,frame):
  • trunk/GSASIIgrid.py

    r2504 r2509  
    15211521        self.helpLbl = helpLbl
    15221522        if sys.platform == "darwin": # mac                         
    1523             self.G2frame.FillMainMenu(menu) # add the data tree menu items
     1523            self.G2frame.FillMainMenu(menu,addhelp=False) # add the data tree menu items
    15241524            if not empty:
    15251525                menu.Append(wx.Menu(title=''),title='|') # add a separator
    15261526       
    15271527    def PostfillDataMenu(self,empty=False):
    1528         '''Create the "standard" part of data frame menus. Note that on Linux and
    1529         Windows, this is the standard help Menu. On Mac, this menu duplicates the
    1530         tree menu, but adds an extra help command for the data item and a separator.
     1528        '''Add the help menu to the data frame menus. Note that on Linux and
     1529        Windows, this is the standard help Menu but without the update commands but adds an extra help
     1530        command for the data item.
     1531        On Mac, this is the entire help menu including the update commands, a separator and the
     1532        extra help command for the data item.
    15311533        '''
    15321534        menu = self.datamenu
     
    15361538            if not empty:
    15371539                menu.Append(wx.Menu(title=''),title='|') # add another separator
    1538             menu.Append(G2G.AddHelp(self.G2frame,helpType=helpType, helpLbl=helpLbl),
    1539                         title='&Help')
     1540            HelpMenu=G2G.MyHelp(self,helpType=helpType,includeTree=True,
     1541                morehelpitems=[('&Tutorials','Tutorials'),])
     1542            menu.Append(menu=HelpMenu,title='&Help')
    15401543        else: # other
    15411544            menu.Append(menu=G2G.MyHelp(self,helpType=helpType, helpLbl=helpLbl),
  • trunk/GSASIIlog.py

    r2133 r2509  
    391391            break
    392392    else:
    393         print '****** getmenuinfo failed for id=',id,'binding to=',handler
     393        #print '****** getmenuinfo failed for id=',id,'binding to=',handler
    394394        #raise Exception('debug: getmenuinfo failed')
    395395        return
  • trunk/help/gsasII.html

    r2362 r2509  
    23272327for off-line use) are downloaded.
    23282328
    2329 <!--<li><strong><a href="https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/">
    2330 <span style='font-weight:normal'>
    2331 </span></a></strong>
    2332 (Link to <a href="https://subversion.xray.aps.anl.gov/pyGSAS/Exercises/">exercise files</a>)</li>
    2333 --!>
    2334 
    23352329<p><i>Getting started</i><UL>
    23362330<LI><strong><a href="https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/StartingGSASII/Starting GSAS.htm"><span style='font-weight:normal'>Starting GSAS-II
     
    63956389style='mso-bookmark:Pawley'><o:p>&nbsp;</o:p></span></p>
    63966390
    6397 <p class=MsoNormal><span style='mso-bookmark:Pawley'><!-- hhmts start -->Last modified: Mon Jul  4 09:03:37 EDT 2016 <!-- hhmts end -->
     6391<p class=MsoNormal><span style='mso-bookmark:Pawley'><!-- hhmts start -->Last modified: Mon Oct 31 17:35:19 CDT 2016 <!-- hhmts end -->
    63986392</body>
    63996393
Note: See TracChangeset for help on using the changeset viewer.