added shortcut to jump to the search fields

This commit is contained in:
Andreas Preikschat 2013-04-28 20:06:49 +02:00
parent 7b7cbc588c
commit 989b922ab9
2 changed files with 21 additions and 14 deletions

View File

@ -244,6 +244,7 @@ class Settings(QtCore.QSettings):
u'shortcuts/printServiceItem': [QtGui.QKeySequence(u'Ctrl+P')], u'shortcuts/printServiceItem': [QtGui.QKeySequence(u'Ctrl+P')],
u'shortcuts/songExportItem': [], u'shortcuts/songExportItem': [],
u'shortcuts/songUsageStatus': [QtGui.QKeySequence(QtCore.Qt.Key_F4)], u'shortcuts/songUsageStatus': [QtGui.QKeySequence(QtCore.Qt.Key_F4)],
u'shortcuts/searchShortcut': [QtGui.QKeySequence(u'Ctrl+F')],
u'shortcuts/settingsShortcutsItem': [], u'shortcuts/settingsShortcutsItem': [],
u'shortcuts/settingsImportItem': [], u'shortcuts/settingsImportItem': [],
u'shortcuts/settingsPluginListItem': [QtGui.QKeySequence(u'Alt+F7')], u'shortcuts/settingsPluginListItem': [QtGui.QKeySequence(u'Alt+F7')],

View File

@ -310,6 +310,10 @@ class Ui_MainWindow(object):
can_shortcuts=True, can_shortcuts=True,
category=UiStrings().Help, triggers=self.on_online_help_clicked) category=UiStrings().Help, triggers=self.on_online_help_clicked)
self.web_site_item = create_action(main_window, u'webSiteItem', can_shortcuts=True, category=UiStrings().Help) self.web_site_item = create_action(main_window, u'webSiteItem', can_shortcuts=True, category=UiStrings().Help)
# Some shortcuts not connected to buttons or menu entires.
self.search_shortcut_action = create_action(main_window,
u'searchShortcut', can_shortcuts=True, category=UiStrings().File,
triggers=self.on_search_shortcut_triggered)
add_actions(self.file_import_menu, (self.settings_import_item, None, self.import_theme_item, add_actions(self.file_import_menu, (self.settings_import_item, None, self.import_theme_item,
self.import_language_item)) self.import_language_item))
add_actions(self.file_export_menu, (self.settings_export_item, None, self.export_theme_item, add_actions(self.file_export_menu, (self.settings_export_item, None, self.export_theme_item,
@ -344,6 +348,7 @@ class Ui_MainWindow(object):
add_actions(self.help_menu, (self.on_line_help_item, None, self.web_site_item, self.about_item)) add_actions(self.help_menu, (self.on_line_help_item, None, self.web_site_item, self.about_item))
add_actions(self.menuBar, (self.file_menu.menuAction(), self.view_menu.menuAction(), add_actions(self.menuBar, (self.file_menu.menuAction(), self.view_menu.menuAction(),
self.tools_menu.menuAction(), self.settings_menu.menuAction(), self.help_menu.menuAction())) self.tools_menu.menuAction(), self.settings_menu.menuAction(), self.help_menu.menuAction()))
add_actions(self, [self.search_shortcut_action])
# Initialise the translation # Initialise the translation
self.retranslateUi(main_window) self.retranslateUi(main_window)
self.media_tool_box.setCurrentIndex(0) self.media_tool_box.setCurrentIndex(0)
@ -467,8 +472,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
def __init__(self): def __init__(self):
""" """
This constructor sets up the interface, the various managers, and the This constructor sets up the interface, the various managers, and the plugins.
plugins.
""" """
QtGui.QMainWindow.__init__(self) QtGui.QMainWindow.__init__(self)
Registry().register(u'main_window', self) Registry().register(u'main_window', self)
@ -545,6 +549,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# Reset the cursor # Reset the cursor
self.application.set_normal_cursor() self.application.set_normal_cursor()
def on_search_shortcut_triggered(self):
"""
Called when the search shotcut has been pressed.
"""
widget = self.media_tool_box.currentWidget()
if widget:
widget.on_focus()
def setAutoLanguage(self, value): def setAutoLanguage(self, value):
""" """
Set the language to automatic. Set the language to automatic.
@ -966,8 +978,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
self.setViewMode(False, True, False, False, True, u'live') self.setViewMode(False, True, False, False, True, u'live')
def setViewMode(self, media=True, service=True, theme=True, preview=True, def setViewMode(self, media=True, service=True, theme=True, preview=True, live=True, mode=u''):
live=True, mode=u''):
""" """
Set OpenLP to a different view mode. Set OpenLP to a different view mode.
""" """
@ -982,8 +993,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
def screen_changed(self): def screen_changed(self):
""" """
The screen has changed so we have to update components such as the The screen has changed so we have to update components such as the renderer.
renderer.
""" """
log.debug(u'screen_changed') log.debug(u'screen_changed')
self.application.set_busy_cursor() self.application.set_busy_cursor()
@ -1089,8 +1099,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
def set_service_modified(self, modified, fileName): def set_service_modified(self, modified, fileName):
""" """
This method is called from the ServiceManager to set the title of the This method is called from the ServiceManager to set the title of the main window.
main window.
``modified`` ``modified``
Whether or not this service has been modified. Whether or not this service has been modified.
@ -1137,8 +1146,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
def set_preview_panel_visibility(self, visible): def set_preview_panel_visibility(self, visible):
""" """
Sets the visibility of the preview panel including saving the setting Sets the visibility of the preview panel including saving the setting and updating the menu.
and updating the menu.
``visible`` ``visible``
A bool giving the state to set the panel to A bool giving the state to set the panel to
@ -1175,8 +1183,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
def set_live_panel_visibility(self, visible): def set_live_panel_visibility(self, visible):
""" """
Sets the visibility of the live panel including saving the setting and Sets the visibility of the live panel including saving the setting and updating the menu.
updating the menu.
``visible`` ``visible``
A bool giving the state to set the panel to A bool giving the state to set the panel to
@ -1231,8 +1238,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
def update_recent_files_menu(self): def update_recent_files_menu(self):
""" """
Updates the recent file menu with the latest list of service files Updates the recent file menu with the latest list of service files accessed.
accessed.
""" """
recent_file_count = Settings().value(u'advanced/recent file count') recent_file_count = Settings().value(u'advanced/recent file count')
existing_recent_files = [recentFile for recentFile in self.recent_files existing_recent_files = [recentFile for recentFile in self.recent_files