← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/lock-toolbar into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/lock-toolbar into lp:openlp.

Requested reviews:
  Raoul Snyman (raoul-snyman)
  Andreas Preikschat (googol)

For more details, see:
https://code.launchpad.net/~trb143/openlp/lock-toolbar/+merge/66013

Simple change for the next cycle.
Add the ability to lock the UI so accidental keyboard hits and mouse swipes do not destroy the UI in the middle of a service.
-- 
https://code.launchpad.net/~trb143/openlp/lock-toolbar/+merge/66013
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py	2011-06-12 16:02:52 +0000
+++ openlp/core/lib/ui.py	2011-06-27 15:58:39 +0000
@@ -323,8 +323,9 @@
     if checked is not None:
         action.setCheckable(True)
         action.setChecked(checked)
-    action.setShortcuts(shortcuts)
-    action.setShortcutContext(context)
+    if shortcuts:
+        action.setShortcuts(shortcuts)
+        action.setShortcutContext(context)
     action_list = ActionList.get_instance()
     action_list.add_action(action, category)
     QtCore.QObject.connect(action, QtCore.SIGNAL(u'triggered(bool)'), function)

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2011-06-26 05:58:29 +0000
+++ openlp/core/ui/mainwindow.py	2011-06-27 15:58:39 +0000
@@ -93,6 +93,8 @@
         self.previewController.panel.setVisible(previewVisible)
         liveVisible = QtCore.QSettings().value(u'user interface/live panel',
             QtCore.QVariant(True)).toBool()
+        panelLocked = QtCore.QSettings().value(u'user interface/lock panel',
+            QtCore.QVariant(False)).toBool()
         self.liveController.panel.setVisible(liveVisible)
         # Create menu
         self.menuBar = QtGui.QMenuBar(mainWindow)
@@ -213,7 +215,11 @@
         self.viewLivePanel = shortcut_action(mainWindow, u'viewLivePanel',
             [QtGui.QKeySequence(u'F12')], self.setLivePanelVisibility,
             checked=liveVisible, category=UiStrings().View)
-        action_list.add_category(UiStrings().ViewMode, CategoryOrder.standardMenu)
+        self.lockPanel = shortcut_action(mainWindow, u'lockPanel',
+            None, self.setLockPanel,
+            checked=panelLocked, category=None)
+        action_list.add_category(UiStrings().ViewMode,
+            CategoryOrder.standardMenu)
         self.modeDefaultItem = checkable_action(
             mainWindow, u'modeDefaultItem', category=UiStrings().ViewMode)
         self.modeSetupItem = checkable_action(
@@ -233,7 +239,8 @@
             category=UiStrings().Tools)
         self.updateThemeImages = base_action(mainWindow,
             u'updateThemeImages', category=UiStrings().Tools)
-        action_list.add_category(UiStrings().Settings, CategoryOrder.standardMenu)
+        action_list.add_category(UiStrings().Settings,
+            CategoryOrder.standardMenu)
         self.settingsPluginListItem = shortcut_action(mainWindow,
             u'settingsPluginListItem', [QtGui.QKeySequence(u'Alt+F7')],
             self.onPluginItemClicked, u':/system/settings_plugin_list.png',
@@ -288,7 +295,7 @@
         add_actions(self.viewMenu, (self.viewModeMenu.menuAction(),
             None, self.viewMediaManagerItem, self.viewServiceManagerItem,
             self.viewThemeManagerItem, None, self.viewPreviewPanel,
-            self.viewLivePanel))
+            self.viewLivePanel, None, self.lockPanel))
         # i18n add Language Actions
         add_actions(self.settingsLanguageMenu, (self.autoLanguageItem, None))
         add_actions(self.settingsLanguageMenu, self.languageGroup.actions())
@@ -325,6 +332,7 @@
         self.importLanguageItem.setVisible(False)
         self.exportLanguageItem.setVisible(False)
         self.helpDocumentationItem.setVisible(False)
+        self.setLockPanel(panelLocked)
 
     def retranslateUi(self, mainWindow):
         """
@@ -414,6 +422,10 @@
             translate('OpenLP.MainWindow', '&Live Panel'))
         self.viewLivePanel.setToolTip(
             translate('OpenLP.MainWindow', 'Toggle Live Panel'))
+        self.lockPanel.setText(
+            translate('OpenLP.MainWindow', 'L&ock Panels'))
+        self.lockPanel.setStatusTip(
+            translate('OpenLP.MainWindow', 'Prevent the panels being moved.'))
         self.viewLivePanel.setStatusTip(translate('OpenLP.MainWindow',
             'Toggle the visibility of the live panel.'))
         self.settingsPluginListItem.setText(translate('OpenLP.MainWindow',
@@ -653,7 +665,7 @@
             QtCore.QVariant(False)).toBool():
             self.serviceManagerContents.loadLastFile()
         view_mode = QtCore.QSettings().value(u'%s/view mode' % \
-            self.generalSettingsSection, u'default')
+            self.generalSettingsSection, u'default').toString()
         if view_mode == u'default':
             self.modeDefaultItem.setChecked(True)
         elif view_mode == u'setup':
@@ -936,7 +948,8 @@
         self.mediaManagerDock.setVisible(not self.mediaManagerDock.isVisible())
 
     def toggleServiceManager(self):
-        self.serviceManagerDock.setVisible(not self.serviceManagerDock.isVisible())
+        self.serviceManagerDock.setVisible(
+            not self.serviceManagerDock.isVisible())
 
     def toggleThemeManager(self):
         self.themeManagerDock.setVisible(not self.themeManagerDock.isVisible())
@@ -956,6 +969,37 @@
             QtCore.QVariant(visible))
         self.viewPreviewPanel.setChecked(visible)
 
+    def setLockPanel(self, lock):
+        """
+        Sets the ability to stop the toolbars being changed.
+        """
+        if lock:
+            self.themeManagerDock.setFeatures(
+                QtGui.QDockWidget.NoDockWidgetFeatures)
+            self.serviceManagerDock.setFeatures(
+                QtGui.QDockWidget.NoDockWidgetFeatures)
+            self.mediaManagerDock.setFeatures(
+                QtGui.QDockWidget.NoDockWidgetFeatures)
+            self.viewMediaManagerItem.setEnabled(False)
+            self.viewServiceManagerItem.setEnabled(False)
+            self.viewThemeManagerItem.setEnabled(False)
+            self.viewPreviewPanel.setEnabled(False)
+            self.viewLivePanel.setEnabled(False)
+        else:
+            self.themeManagerDock.setFeatures(
+                QtGui.QDockWidget.AllDockWidgetFeatures)
+            self.serviceManagerDock.setFeatures(
+                QtGui.QDockWidget.AllDockWidgetFeatures)
+            self.mediaManagerDock.setFeatures(
+                QtGui.QDockWidget.AllDockWidgetFeatures)
+            self.viewMediaManagerItem.setEnabled(True)
+            self.viewServiceManagerItem.setEnabled(True)
+            self.viewThemeManagerItem.setEnabled(True)
+            self.viewPreviewPanel.setEnabled(True)
+            self.viewLivePanel.setEnabled(True)
+        QtCore.QSettings().setValue(u'user interface/lock panel',
+            QtCore.QVariant(lock))
+
     def setLivePanelVisibility(self, visible):
         """
         Sets the visibility of the live panel including saving the setting and


Follow ups