- Coded a combined help button, which opens the Local Help if using Mac or Win and Online help if using other OS's.

(still need to change the help menu items)
This commit is contained in:
Olli Suutari 2016-08-11 23:54:56 +03:00
parent 9794d26e95
commit f590294b4a
3 changed files with 15 additions and 16 deletions

View File

@ -254,7 +254,7 @@ class Settings(QtCore.QSettings):
QtCore.QSettings.__init__(self, *args)
# Add shortcuts here so QKeySequence has a QApplication instance to use.
Settings.__default_settings__.update({
'shortcuts/aboutItem': [QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_F1)],
'shortcuts/aboutItem': [QtGui.QKeySequence(QtCore.Qt.SHIFT + QtCore.Qt.Key_F1)],
'shortcuts/addToService': [],
'shortcuts/audioPauseItem': [],
'shortcuts/displayTagItem': [],
@ -334,8 +334,8 @@ class Settings(QtCore.QSettings):
QtGui.QKeySequence(QtCore.Qt.Key_PageDown)],
'shortcuts/nextService': [QtGui.QKeySequence(QtCore.Qt.Key_Right)],
'shortcuts/newService': [],
'shortcuts/offlineHelpItem': [QtGui.QKeySequence(QtGui.QKeySequence.HelpContents)],
'shortcuts/onlineHelpItem': [QtGui.QKeySequence(QtGui.QKeySequence.HelpContents)],
'shortcuts/offlineHelpItem': [QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_F1)],
'shortcuts/onlineHelpItem': [QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_F1)],
'shortcuts/openService': [],
'shortcuts/saveService': [],
'shortcuts/previousItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Up),

View File

@ -312,18 +312,18 @@ class Ui_MainWindow(object):
self.offline_help_item = create_action(main_window, 'offlineHelpItem',
icon=':/system/system_help_contents.png',
can_shortcuts=True,
category=UiStrings().Help, triggers=self.on_offline_help_clicked)
category=UiStrings().Help, triggers=self.on_help_button_clicked)
elif is_macosx():
self.local_help_file = os.path.join(AppLocation.get_directory(AppLocation.AppDir),
'..', 'Resources', 'OpenLP.help')
self.offline_help_item = create_action(main_window, 'offlineHelpItem',
icon=':/system/system_help_contents.png',
can_shortcuts=True,
category=UiStrings().Help, triggers=self.on_offline_help_clicked)
category=UiStrings().Help, triggers=self.on_help_button_clicked)
self.on_line_help_item = create_action(main_window, 'onlineHelpItem',
icon=':/system/system_online_help.png',
can_shortcuts=True,
category=UiStrings().Help, triggers=self.on_online_help_clicked)
category=UiStrings().Help, triggers=self.on_help_button_clicked)
self.web_site_item = create_action(main_window, 'webSiteItem', can_shortcuts=True, category=UiStrings().Help)
# Shortcuts not connected to buttons or menu entries.
self.search_shortcut_action = create_action(main_window,
@ -778,18 +778,16 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties):
import webbrowser
webbrowser.open_new('http://openlp.org/')
def on_offline_help_clicked(self):
def on_help_button_clicked(self):
"""
Load the local OpenLP help file
If is_macosx or is_win, open the local OpenLP help file.
Use the Online manual in other cases. (Linux)
"""
QtGui.QDesktopServices.openUrl(QtCore.QUrl("file:///" + self.local_help_file))
def on_online_help_clicked(self):
"""
Load the online OpenLP manual
"""
import webbrowser
webbrowser.open_new('http://manual.openlp.org/')
if is_macosx() or is_win():
QtGui.QDesktopServices.openUrl(QtCore.QUrl("file:///" + self.local_help_file))
else:
import webbrowser
webbrowser.open_new('http://manual.openlp.org/')
def on_about_item_clicked(self):
"""

View File

@ -234,6 +234,7 @@ class SlideController(DisplayController, RegistryProperties):
self.hide_menu.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)
self.hide_menu.setMenu(QtWidgets.QMenu(translate('OpenLP.SlideController', 'Hide'), self.toolbar))
self.toolbar.add_toolbar_widget(self.hide_menu)
# The order of the blank to modes in Shortcuts list comes from here.
self.desktop_screen = create_action(self, 'desktopScreen',
text=translate('OpenLP.SlideController', 'Show Desktop'),
icon=':/slides/slide_desktop.png',