Skip to content

Commit

Permalink
Add help menu option to access user manual
Browse files Browse the repository at this point in the history
  • Loading branch information
MalloyDelacroix committed Feb 9, 2017
1 parent 369f9a9 commit 9a1aa4d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion DownloaderForReddit/AboutDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self):
self.logo_label.setPixmap(pixmap)
self.logo_label.setScaledContents(True)

self.info_label.setText('Version: 1.0\nAuthor: Kyle H')
self.info_label.setText('Version: 1.0.1\nAuthor: Kyle H')
self.info_label.setScaledContents(True)

self.link_label.setText('Homepage: <a href="https://github.com/MalloyDelacroix/DownloaderForReddit">Downloader for Reddit</a>')
Expand Down
11 changes: 11 additions & 0 deletions DownloaderForReddit/Messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,17 @@ def invalid_imgur_client(self):
else:
return False

def user_manual_not_found(self):
text = 'The user manual cannot be found. This is most likely because the manual has been moved from the ' \
'expected location, or renamed to something the application is not expecting. To correct the issue ' \
'please move the user manual back to the source folder and ensure it is named ' \
'"The Downloader For Reddit - User Manual.pdf"'
reply = message.information(self, 'User Manual Not Found', text, message.Ok)
if reply == message.Ok:
return True
else:
return False


class UnfinishedDownloadsWarning(QDialog, Ui_Dialog):

Expand Down
15 changes: 5 additions & 10 deletions DownloaderForReddit/RedditDownloaderGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,25 +1064,20 @@ def display_about_dialog(self):

def open_user_manual(self):
manual = 'The Downloader For Reddit - User Manual.pdf'
try:
if os.path.isfile(os.path.join(os.getcwd(), manual)):
file = os.path.join(os.getcwd(), manual)
if sys.platform == 'win32':
os.startfile(file)
else:
opener = 'open' if sys.platform == 'darwin' else 'xdg-open'
subprocess.call([opener, file])
except:
else:
separator = '/' if not sys.platform == 'win32' else '\\'
containing_folder, current = os.getcwd().rsplit(separator, 1)
file = os.path.join(containing_folder, manual)
try:
if sys.platform == 'win32':
os.startfile(file)
else:
opener = 'open' if sys.platform == 'darwin' else 'xdg-open'
subprocess.call([opener, file])
finally:
pass

except FileNotFoundError:
Message.user_manual_not_found(self)

def refresh_user_count(self):
"""Updates the shown user count seen in the file menu"""
Expand Down

0 comments on commit 9a1aa4d

Please sign in to comment.