Skip to content

Commit

Permalink
Worked on issue #56
Browse files Browse the repository at this point in the history
Former-commit-id: 0523c7951be7de2f46546952798590dfea0715bf [formerly 49204de2dfcec41ba61344d419097edcf1418ec0] [formerly b4d7828c61449196c3c18ae19c123f5aa1325f45 [formerly 176f4bdeb3ac1607ffb8bf8a58f85ac4ff40cfcd]] [formerly 835d5c674621a5eaefa9c599393b95aa88794aad [formerly 54b658f76bf66f240fbece0ddeb0b450791f77a0] [formerly 176f4bdeb3ac1607ffb8bf8a58f85ac4ff40cfcd [formerly d6a5200]]]
Former-commit-id: f6e0b3f67f262c7d324fc245bc11264536f0c840 [formerly 73a90c3c26daf15ae4fb11ac061ba6a793728b56] [formerly 3ab127ca3fa492088d46e30add03bb26d76cfe3f [formerly 6a9c99b218fb58698e2f9409bcb97361c029c1da]]
Former-commit-id: cd0ead6e1169634221b35aac827ef7aff6c67228 [formerly 3ab127ca3fa492088d46e30add03bb26d76cfe3f]
Former-commit-id: df2ac14c57cd1fd240390cad09676d8066b889af
  • Loading branch information
Paul Müller committed Nov 19, 2013
1 parent 37f016a commit 294e122
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
12 changes: 12 additions & 0 deletions src/doc.py
Expand Up @@ -70,6 +70,18 @@ def description():
measurements. PyCorrFit is written in Python."""


def GetLocationOfDocumentation():
""" Returns the location of the documentation if there is any."""
# This also defines the order
locations = ["../PyCorrFit_doc.pdf", "data/PyCorrFit_doc.pdf"]
for loc in locations:
if os.path.exists(loc):
return loc
break
# if this does not work:
return None


def info(version):
""" Returns a little info about our program and what it can do.
"""
Expand Down
27 changes: 23 additions & 4 deletions src/frontend.py
Expand Up @@ -354,15 +354,17 @@ def MakeMenu(self):
menuentry = submenu.Append(model[0], model[1], model[2])
self.Bind(wx.EVT_MENU, self.add_fitting_tab, menuentry)
# help menu
menuSoftw = helpmenu.Append(wx.ID_ANY, "&Software used",
"Information about the software used")
menuAbout = helpmenu.Append(wx.ID_ABOUT, "&About",
"Information about this program")
menuDocu = helpmenu.Append(wx.ID_ANY, "&Documentation",
"PyCorrFit documentation")
menuUpdate = helpmenu.Append(wx.ID_ANY, "&Update",
"Check for new version"+
" (Web access required)")
menuShell = helpmenu.Append(wx.ID_ANY, "S&hell",
"A Python shell")
menuSoftw = helpmenu.Append(wx.ID_ANY, "&Software used",
"Information about the software used")
menuAbout = helpmenu.Append(wx.ID_ABOUT, "&About",
"Information about this program")
# Create the menubar.
self.menuBar = wx.MenuBar()
# Adding all the menus to the MenuBar
Expand Down Expand Up @@ -394,6 +396,7 @@ def MakeMenu(self):
self.Bind(wx.EVT_MENU, self.OnSoftware, menuSoftw)
self.Bind(wx.EVT_MENU, self.OnAbout, menuAbout)
self.Bind(wx.EVT_MENU, self.OnUpdate, menuUpdate)
self.Bind(wx.EVT_MENU, self.OnDocumentation, menuDocu)
self.Bind(wx.EVT_MENU, self.OnShell, menuShell)


Expand Down Expand Up @@ -554,6 +557,22 @@ def OnDeletePage(self, event=None):
self.OnFNBPageChanged()


def OnDocumentation(self, e=None):
""" Get the documentation and view it with browser"""
filename = doc.GetLocationOfDocumentation()
if filename is None:
# Now we have to tell the user that there is not documentation
pass
else:
# Open the file
if platform.system().lower() == 'windows':
os.system("start "+filename)
elif platform.system().lower() == 'linux':
os.system("xdg-open "+filename)
elif platform.system().lower() == 'darwin':
os.system("open "+filename)


def OnExit(self,e=None):
numtabs = self.notebook.GetPageCount()
# Ask, if user wants to save current session.
Expand Down

0 comments on commit 294e122

Please sign in to comment.