← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol-hush/openlp/tweaks into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol-hush/openlp/tweaks into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #771966 in OpenLP: "Add Start/Stop Loop shortcuts and make them configurable"
  https://bugs.launchpad.net/openlp/+bug/771966

For more details, see:
https://code.launchpad.net/~googol-hush/openlp/tweaks/+merge/59401

Hello,

- added Start Loop and Stop Loop to the list of available shorcut actions
- added a new (hidden) action to toggle the loop (also available on the shortcut dialog)
Bug #771966

Default shortcut for "toogle loop" is "L".
New string: "Start/Stop continuous loop".
-- 
https://code.launchpad.net/~googol-hush/openlp/tweaks/+merge/59401
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/tweaks into lp:openlp.
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2011-04-28 06:36:04 +0000
+++ openlp/core/ui/slidecontroller.py	2011-04-28 16:45:37 +0000
@@ -180,16 +180,25 @@
             self.hideMenu.menu().addAction(self.themeScreen)
             self.hideMenu.menu().addAction(self.desktopScreen)
             self.toolbar.addToolbarSeparator(u'Loop Separator')
-            self.toolbar.addToolbarButton(
+            startLoop = self.toolbar.addToolbarButton(
                 # Does not need translating - control string.
                 u'Start Loop', u':/media/media_time.png',
                 translate('OpenLP.SlideController', 'Start continuous loop'),
                 self.onStartLoop)
-            self.toolbar.addToolbarButton(
+            action_list = ActionList.get_instance()
+            action_list.add_action(startLoop, UiStrings().LiveToolbar)
+            stopLoop = self.toolbar.addToolbarButton(
                 # Does not need translating - control string.
                 u'Stop Loop', u':/media/media_stop.png',
                 translate('OpenLP.SlideController', 'Stop continuous loop'),
                 self.onStopLoop)
+            action_list.add_action(stopLoop, UiStrings().LiveToolbar)
+            self.toogleLoop = shortcut_action(self, u'toogleLoop',
+                [QtGui.QKeySequence(u'L')], self.onToggleLoop,
+                category=UiStrings().LiveToolbar)
+            self.toogleLoop.setText(translate('OpenLP.SlideController',
+                'Start/Stop continuous loop'))
+            self.addAction(self.toogleLoop)
             self.delaySpinBox = QtGui.QSpinBox()
             self.delaySpinBox.setMinimum(1)
             self.delaySpinBox.setMaximum(180)
@@ -494,6 +503,9 @@
         self.mediabar.setVisible(False)
         self.toolbar.makeWidgetsInvisible([u'Song Menu'])
         self.toolbar.makeWidgetsInvisible(self.loopList)
+        self.toogleLoop.setEnabled(False)
+        self.toolbar.actions[u'Start Loop'].setEnabled(False)
+        self.toolbar.actions[u'Stop Loop'].setEnabled(False)
         self.toolbar.actions[u'Stop Loop'].setVisible(False)
         if item.is_text():
             if QtCore.QSettings().value(
@@ -503,6 +515,9 @@
         if item.is_capable(ItemCapabilities.AllowsLoop) and \
             len(item.get_frames()) > 1:
             self.toolbar.makeWidgetsVisible(self.loopList)
+            self.toogleLoop.setEnabled(True)
+            self.toolbar.actions[u'Start Loop'].setEnabled(True)
+            self.toolbar.actions[u'Stop Loop'].setEnabled(True)
         if item.is_media():
             self.toolbar.setVisible(False)
             self.mediabar.setVisible(True)
@@ -995,6 +1010,15 @@
                         self.previewListWidget.rowCount() - 1)
             self.slideSelected()
 
+    def onToggleLoop(self, toggled):
+        """
+        Toggles the loop state.
+        """
+        if self.toolbar.actions[u'Start Loop'].isVisible():
+            self.onStartLoop()
+        else:
+            self.onStopLoop()
+
     def onStartLoop(self):
         """
         Start the timer loop running and store the timer id


Follow ups