← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol/openlp/bug-718797-2.0 into lp:openlp/2.0

 

Andreas Preikschat has proposed merging lp:~googol/openlp/bug-718797-2.0 into lp:openlp/2.0.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #718797 in OpenLP: "RFE Separate blank buttons"
  https://bugs.launchpad.net/openlp/+bug/718797

For more details, see:
https://code.launchpad.net/~googol/openlp/bug-718797-2.0/+merge/185670

Hello,

- separate blank buttons again (#718797)

I backported this, because we were asked often to do this. This can be a little "surprise feature".

Is it alright for you to merge this eventhough it is a new feature?
-- 
https://code.launchpad.net/~googol/openlp/bug-718797-2.0/+merge/185670
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/bug-718797-2.0 into lp:openlp/2.0.
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2013-02-10 12:21:59 +0000
+++ openlp/core/ui/slidecontroller.py	2013-09-15 13:23:21 +0000
@@ -44,6 +44,10 @@
 
 log = logging.getLogger(__name__)
 
+
+HIDE_MENU_THRESHOLD = 40
+
+
 class SlideList(QtGui.QTableWidget):
     """
     Customised version of QTableWidget which can respond to keyboard
@@ -104,6 +108,14 @@
             u'audioPauseItem',
             u'audioTimeLabel'
         ]
+        self.wideMenu = [
+            u'blankScreenButton',
+            u'themeScreenButton',
+            u'desktopScreenButton'
+        ]
+        self.narrowMenu = [
+            u'hideMenu'
+        ]
         self.timer_id = 0
         self.songEdit = False
         self.selectedRow = 0
@@ -220,6 +232,19 @@
             self.hideMenu.menu().addAction(self.blankScreen)
             self.hideMenu.menu().addAction(self.themeScreen)
             self.hideMenu.menu().addAction(self.desktopScreen)
+            # Wide menu of display control buttons.
+            self.blankScreenButton = QtGui.QToolButton(self.toolbar)
+            self.blankScreenButton.setObjectName(u'blankScreenButton')
+            self.toolbar.addToolbarWidget(self.blankScreenButton)
+            self.blankScreenButton.setDefaultAction(self.blankScreen)
+            self.themeScreenButton = QtGui.QToolButton(self.toolbar)
+            self.themeScreenButton.setObjectName(u'themeScreenButton')
+            self.toolbar.addToolbarWidget(self.themeScreenButton)
+            self.themeScreenButton.setDefaultAction(self.themeScreen)
+            self.desktopScreenButton = QtGui.QToolButton(self.toolbar)
+            self.desktopScreenButton.setObjectName(u'desktopScreenButton')
+            self.toolbar.addToolbarWidget(self.desktopScreenButton)
+            self.desktopScreenButton.setDefaultAction(self.desktopScreen)
             self.toolbar.addToolbarAction(u'loopSeparator', separator=True)
             # Play Slides Menu
             self.playSlidesMenu = QtGui.QToolButton(self.toolbar)
@@ -399,6 +424,7 @@
                 QtCore.SIGNAL(u'slidecontroller_toggle_display'),
                 self.toggleDisplay)
             self.toolbar.setWidgetVisible(self.loopList, False)
+            self.toolbar.setWidgetVisible(self.wideMenu, False)
         else:
             QtCore.QObject.connect(self.previewListWidget,
                 QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
@@ -649,6 +675,24 @@
                 for framenumber in range(len(self.serviceItem.get_frames())):
                     self.previewListWidget.setRowHeight(
                         framenumber, width / self.ratio)
+        self.onControllerSizeChanged()
+
+    def onControllerSizeChanged(self):
+        """
+        Change layout of display control buttons on controller size change
+        """
+        if self.isLive:
+            # Space used by the toolbar.
+            used_space = self.toolbar.size().width() + self.hideMenu.size().width()
+            width = self.controller.width()
+            # Add the threshold to prevent flickering.
+            if width > used_space + HIDE_MENU_THRESHOLD and self.hideMenu.isVisible():
+                self.toolbar.setWidgetVisible(self.narrowMenu, False)
+                self.toolbar.setWidgetVisible(self.wideMenu)
+            # Take away a threshold to prevent flickering.
+            elif width < used_space - HIDE_MENU_THRESHOLD and not self.hideMenu.isVisible():
+                self.toolbar.setWidgetVisible(self.wideMenu, False)
+                self.toolbar.setWidgetVisible(self.narrowMenu)
 
     def onSongBarHandler(self):
         request = unicode(self.sender().text())


Follow ups