Changeset 449


Ignore:
Timestamp:
Jan 4, 2012 1:16:50 PM (10 years ago)
Author:
toby
Message:

Help updates: refactor help routine; use internal browser on Windows; add help to more (all?) windows; add text to avoid blank data windows;remove some unused code

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r443 r449  
    15931593            dlg.Destroy()
    15941594
    1595     def OnHelpHelp(self, event):
    1596         event.Skip()
    1597                
    15981595class GSASIImain(wx.App):
    15991596    def OnInit(self):
  • trunk/GSASIIgrid.py

    r446 r449  
    1111import time
    1212import cPickle
     13import sys
    1314import numpy as np
    1415import os.path
     
    2930htmlPanel = None
    3031htmlFrame = None
    31 helpMode = 'internal'    # need a global control to set this
    32 helpMode = 'browser'    # need a global control to set this
     32if sys.platform.lower().startswith('win'):
     33    helpMode = 'internal'    # need a global control to set this
     34else:
     35    helpMode = 'browser'    # need a global control to set this
    3336htmlFirstUse = True
    3437
     
    9497
    9598VERY_LIGHT_GREY = wx.Colour(235,235,235)
     99
     100def ShowHelp(helpType,frame):
     101    '''Called to bring up a web page for documentation.'''
     102    global helpLocDict
     103    global helpMode
     104    # look up a definition for help info from dict
     105    helplink = helpLocDict.get(helpType)
     106    if helplink is None:
     107        # no defined link to use, create a default based on key
     108        helplink = 'gsasII.html#'+helpType.replace(' ','_')
     109        print helplink
     110    helplink = os.path.join(path2GSAS2,'help',helplink)
     111    if helpMode == 'internal':
     112        global htmlPanel, htmlFrame
     113        try:
     114            htmlPanel.LoadFile(helplink)
     115            htmlFrame.Raise()
     116        except:
     117            htmlFrame = wx.Frame(frame, -1, size=(610, 380))
     118            htmlFrame.Show(True)
     119            htmlFrame.SetTitle("HTML Window") # N.B. reset later in LoadFile
     120            htmlPanel = MyHtmlPanel(htmlFrame,-1)
     121            htmlPanel.LoadFile(helplink)
     122    else:
     123        global htmlFirstUse
     124        #import webbrowser
     125        if htmlFirstUse:
     126            webbrowser.open_new("file://"+helplink)
     127            htmlFirstUse = False
     128        else:
     129            webbrowser.open("file://"+helplink, new=0, autoraise=True)
    96130
    97131class MyHelp(wx.Menu):
     
    122156        a web page for documentation.
    123157        '''
    124         global helpLocDict
    125         global helpMode
    126         # look up a definition for help info from dict
    127         helplink = helpLocDict.get(self.helpType)
    128         if helplink is None:
    129             # no defined link to use, create a default based on key
    130             helplink = 'gsasII.html#'+self.helpType.replace(' ','_')
    131             print helplink
    132         helplink = os.path.join(path2GSAS2,'help',helplink)
    133         if helpMode == 'internal':
    134             global htmlPanel, htmlFrame
    135             try:
    136                 htmlPanel.LoadFile(helplink)
    137             except:
    138                 htmlFrame = wx.Frame(self.frame, -1, size=(610, 380))
    139                 htmlFrame.Show(True)
    140                 htmlFrame.SetTitle("HTML Window") # N.B. reset later in LoadFile
    141                 htmlPanel = MyHtmlPanel(htmlFrame,-1)
    142                 htmlPanel.LoadFile(helplink)
    143         else:
    144             global htmlFirstUse
    145             #import webbrowser
    146             if htmlFirstUse:
    147                 webbrowser.open_new("file://"+helplink)
    148                 htmlFirstUse = False
    149             else:
    150                 webbrowser.open("file://"+helplink, new=0, autoraise=True)
     158        ShowHelp(self.helpType,self.frame)
    151159
    152160    def OnHelpAbout(self, event):
     
    216224
    217225class DataFrame(wx.Frame):
    218     def _init_coll_BlankMenu(self,parent):
    219         parent.Append(menu=self.Blank,title='')
     226    #def _init_coll_BlankMenu(self,parent):
     227    #    parent.Append(menu=self.Blank,title='')
    220228               
    221229    def _init_coll_ConstraintMenu(self,parent):
     
    493501        # refactored Menu creation
    494502        ############################################################
     503        # menu for Data Editing Window / Controls
     504        self.ControlsMenu = wx.MenuBar()
     505        self.ControlsMenu.Append(menu=MyHelp(self,helpType='Controls'),title='&Help')
     506        # menu for Data Editing Window / Notebook
     507        self.DataNotebookMenu = wx.MenuBar()
     508        self.DataNotebookMenu.Append(menu=MyHelp(self,helpType='Notebook'),title='&Help')
     509        # menu for Data Editing Window / Comments
     510        self.DataCommentsMenu = wx.MenuBar()
     511        self.DataCommentsMenu.Append(menu=MyHelp(self,helpType='Comments'),title='&Help')
     512        # menu for Data Editing Window / Controls
     513        self.ControlsMenu = wx.MenuBar()
     514        self.ControlsMenu.Append(menu=MyHelp(self,helpType='Controls'),title='&Help')
    495515        # menu for Data Editing Window / Phase / Atoms tab
    496516        self.AtomsMenu = wx.MenuBar()
    497517        self.AtomEdit = wx.Menu(title='')
    498518        self.AtomsMenu.Append(menu=self.AtomEdit, title='Edit')
    499         self.AtomsMenu.Append(menu=MyHelp(self,helpType='Atoms'),title='&Help')
    500519        self.AtomsMenu.Append(menu=MyHelp(self,helpType='Atoms'),title='&Help')
    501520        self.AtomEdit.Append(id=wxID_ATOMSEDITADD, kind=wx.ITEM_NORMAL,text='Append atom',
     
    821840    self.dataFrame.SetLabel('Controls')
    822841    self.dataDisplay = wx.Panel(self.dataFrame)
    823     self.dataFrame.SetMenuBar(self.dataFrame.BlankMenu)
     842    self.dataFrame.SetMenuBar(self.dataFrame.ControlsMenu)
    824843    mainSizer = wx.BoxSizer(wx.VERTICAL)
    825844    mainSizer.Add((5,5),0)
     
    15091528            Id = GetPatternTreeItemId(self,self.root, 'Comments')
    15101529            if Id: self.PatternTree.SetItemPyData(Id,data)
    1511         if self.dataFrame.GetLabel() == 'Notebook':
     1530        elif self.dataFrame.GetLabel() == 'Notebook':
    15121531            data = [self.dataDisplay.GetValue()]
    15131532            self.dataDisplay.Clear()
    15141533            Id = GetPatternTreeItemId(self,self.root, 'Notebook')
    15151534            if Id: self.PatternTree.SetItemPyData(Id,data)
    1516         if 'Phase Data for' in self.dataFrame.GetLabel():
     1535        elif 'Phase Data for' in self.dataFrame.GetLabel():
    15171536            if self.dataDisplay:
    15181537                oldPage = self.dataDisplay.GetSelection()
     
    15331552        self.PickId = item
    15341553        if self.PatternTree.GetItemText(item) == 'Notebook':
     1554            self.dataFrame.SetMenuBar(self.dataFrame.DataNotebookMenu)
    15351555            self.PatternId = 0
    15361556            self.ExportPattern.Enable(False)
     
    15591579        elif self.PatternTree.GetItemText(item) == 'Covariance':
    15601580            data = self.PatternTree.GetItemPyData(item)
     1581            wx.TextCtrl(parent=self.dataFrame,size=self.dataFrame.GetClientSize(),
     1582                        value='See plot window for covariance display')
    15611583            G2plt.PlotCovariance(self)
    15621584        elif self.PatternTree.GetItemText(item) == 'Constraints':
     
    15731595        elif 'PWDR' in self.PatternTree.GetItemText(item):
    15741596            self.ExportPattern.Enable(True)
     1597            wx.TextCtrl(parent=self.dataFrame,size=self.dataFrame.GetClientSize(),
     1598                        style=wx.TE_MULTILINE,
     1599                        value='See plot window for powder data display\nor select a data item in histogram')
    15751600            G2plt.PlotPatterns(self,newPlot=True)
    15761601        elif 'HKLF' in self.PatternTree.GetItemText(item):
     
    15811606            self.ExportPDF.Enable(True)
    15821607            G2plt.PlotISFG(self,type='S(Q)')
     1608        elif self.PatternTree.GetItemText(item) == 'Phases':
     1609            wx.TextCtrl(parent=self.dataFrame,size=self.dataFrame.GetClientSize(),
     1610                        value='Select one phase to see its parameters')
    15831611           
    15841612    elif 'I(Q)' in self.PatternTree.GetItemText(item):
     
    16031631        G2phG.UpdatePhaseData(self,item,data,oldPage)
    16041632    elif self.PatternTree.GetItemText(item) == 'Comments':
     1633        self.dataFrame.SetMenuBar(self.dataFrame.DataCommentsMenu)
    16051634        self.PatternId = self.PatternTree.GetItemParent(item)
    16061635        self.PickId = item
     
    17111740        G2pdG.UpdateReflectionGrid(self,data)
    17121741        G2plt.PlotPatterns(self)
    1713      
    1714 #def OnHelp(event):
    1715 #    Obj = event.GetEventObject()
    1716 #    line = 'Help on '+Obj.GetTitle()
    1717 #    for child in Obj.GetChildren():
    1718 #        if 'NoteBook' in str(type(child)):
    1719 #            notebook = child.GetCurrentPage().GetParent()
    1720 #            line = 'Help on '+notebook.GetPageText(notebook.GetSelection())
    1721 #    print line
    1722 #    print 'Real help will come here as HTML pages'
  • trunk/GSASIIplot.py

    r440 r449  
    170170        Page = self.GetParent().GetParent()
    171171        pageNo = Page.GetSelection()
    172        
    173172        print 'Matplotlib help on '+Page.GetPageText(pageNo)
    174        
     173        G2gd.ShowHelp(Page.GetPageText(pageNo),self.TopLevelParent)
     174           
    175175def PlotSngl(self,newPlot=False):
    176176    '''Single crystal structure factor plotting package - displays zone of reflections as rings proportional
  • trunk/help/gsasII.html

    r445 r449  
    1010<meta name=Generator content="Microsoft Word 12">
    1111<meta name=Originator content="Microsoft Word 12">
     12<link href="gsasIIfav.png" rel="SHORTCUT ICON" />
    1213<link rel=File-List href="gsasII_files/filelist.xml">
    1314<link rel=Edit-Time-Data href="gsasII_files/editdata.mso">
     
    17741775
    17751776<p class=MsoNormal><span style='mso-fareast-font-family:"Times New Roman"'>These
    1776 are Home, Back, Forward, Pan, Zoom, Save and Help, respectively. The Pan option
    1777 allows you to control panning across the plot (press left mouse button) and
    1778 zooming (press right mouse button), the Zoom option allows you to select a
     1777are Home, Back, Forward, Pan, Zoom, Save and Help, respectively.
     1778<UL>
     1779  <LI>Home: returns the plot to the initial scaling
     1780  <LI>Back: returns the plot to the previous scaling
     1781  <LI>Forward: reverses the action in the previous press(es)
     1782  of the Back button
     1783  <LI>Pan: allows you to control panning across the plot (press left mouse button) and
     1784zooming (press right mouse button),
     1785  <LI>Zoom: allows you to select a
    17791786portion of the plot (press right mouse button &amp; drag for zoom box) for the
    1780 next plot. The Save allows you to save the currently displayed plot in one of
     1787next plot.
     1788  <LI>Save: allows you to save the currently displayed plot in one of
    17811789several graphical formats suitable for printing or insertion in a document. The
    1782 Help icon is for access to this GSASII help.<o:p></o:p></span></p>
     1790  <LI>Help: accesses GSASII help on the specific plot type.
     1791</UL>
     1792  <o:p></o:p></span></p>
    17831793
    17841794<p class=MsoNormal><span style='mso-fareast-font-family:"Times New Roman"'>Below
     
    18021812which is displayed and on which item in the GSAS-II data tree you have
    18031813selected.<o:p></o:p></span></p>
     1814<h5><span style='mso-fareast-font-family:"Times New Roman"'>What can I do here?<o:p></o:p></span></h5>
    18041815
    18051816<h4><a name=Covariance><span style='mso-fareast-font-family:"Times New Roman"'>Covariance</span></a><span
     
    18301841color scheme will be plotted. The default is &#8216;<span class=SpellE>RdYlGn</span>&#8217;.</p>
    18311842
     1843<h4><a name="Structure_Factors">
     1844<span style='mso-fareast-font-family:"Times New Roman"'>
     1845Structure Factors
     1846</span></a></h4>
     1847This plot shows...
     1848<h5><span style='mso-fareast-font-family:"Times New Roman"'>What can I do here?<o:p></o:p></span></h5>
     1849
     1850<h4><a name="Powder_Lines">
     1851<span style='mso-fareast-font-family:"Times New Roman"'>
     1852Powder Lines
     1853</span></a></h4>
     1854This plot shows...
     1855<h5><span style='mso-fareast-font-family:"Times New Roman"'>What can I do here?<o:p></o:p></span></h5>
     1856
     1857
     1858<h4><a name="Peak_Widths">
     1859<span style='mso-fareast-font-family:"Times New Roman"'>
     1860Peak Widths
     1861</span></a></h4>
     1862This plot shows...
     1863<h5><span style='mso-fareast-font-family:"Times New Roman"'>What can I do here?<o:p></o:p></span></h5>
     1864
     1865
     1866<h4><a name="Texture">
     1867<span style='mso-fareast-font-family:"Times New Roman"'>
     1868Texture
     1869</span></a></h4>
     1870This plot shows...
     1871<h5><span style='mso-fareast-font-family:"Times New Roman"'>What can I do here?<o:p></o:p></span></h5>
     1872
     1873
     1874<h4><a name="Sequential_refinement">
     1875<span style='mso-fareast-font-family:"Times New Roman"'>
     1876Sequential refinement
     1877</span></a></h4>
     1878This plot shows...
     1879<h5><span style='mso-fareast-font-family:"Times New Roman"'>What can I do here?<o:p></o:p></span></h5>
     1880
     1881
     1882<h4><a name="2D_Powder_Image">
     1883<span style='mso-fareast-font-family:"Times New Roman"'>
     18842D Powder Image
     1885</span></a></h4>
     1886This plot shows...
     1887<h5><span style='mso-fareast-font-family:"Times New Roman"'>What can I do here?<o:p></o:p></span></h5>
     1888
     1889
     1890<h4><a name="2D_Integration">
     1891<span style='mso-fareast-font-family:"Times New Roman"'>
     18922D Integration
     1893</span></a></h4>
     1894This plot shows...
     1895<h5><span style='mso-fareast-font-family:"Times New Roman"'>What can I do here?<o:p></o:p></span></h5>
     1896
     1897
     1898<h4><a name="2D_Transformed_Powder_Image">
     1899<span style='mso-fareast-font-family:"Times New Roman"'>
     19002D Transformed Powder Image
     1901</span></a></h4>
     1902This plot shows...
     1903<h5><span style='mso-fareast-font-family:"Times New Roman"'>What can I do here?<o:p></o:p></span></h5>
     1904
     1905
     1906<h4><a name="Mustrain">
     1907<span style='mso-fareast-font-family:"Times New Roman"'>
     1908Mustrain
     1909</span></a></h4>
     1910This plot shows...
     1911<h5><span style='mso-fareast-font-family:"Times New Roman"'>What can I do here?<o:p></o:p></span></h5>
     1912
     1913
     1914<h4><a name="Size">
     1915<span style='mso-fareast-font-family:"Times New Roman"'>
     1916Size
     1917</span></a></h4>
     1918This plot shows...
     1919<h5><span style='mso-fareast-font-family:"Times New Roman"'>What can I do here?<o:p></o:p></span></h5>
     1920
     1921<h4><a name="Preferred_orientation">
     1922<span style='mso-fareast-font-family:"Times New Roman"'>
     1923Preferred Orientation
     1924</span></a></h4>
     1925This plot shows...
     1926<h5><span style='mso-fareast-font-family:"Times New Roman"'>What can I do here?<o:p></o:p></span></h5>
     1927
     1928
     1929
    18321930<p class=MsoNormal><span style='mso-fareast-font-family:"Times New Roman"'><o:p>&nbsp;</o:p></span></p>
    18331931
Note: See TracChangeset for help on using the changeset viewer.