Make slide controller buttons width aware

bzr-revno: 2163
This commit is contained in:
Dmitriy Marmyshev 2013-01-31 19:06:53 +00:00 committed by Tim Bentley
commit 235d1c8b79

View File

@ -92,6 +92,14 @@ class SlideController(DisplayController):
u'audioPauseItem',
u'audioTimeLabel'
]
self.wideMenu = [
u'blankScreenButton',
u'themeScreenButton',
u'desktopScreenButton'
]
self.hideMenuList = [
u'hideMenu'
]
self.timer_id = 0
self.songEdit = False
self.selectedRow = 0
@ -193,6 +201,19 @@ class SlideController(DisplayController):
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)
@ -344,6 +365,7 @@ class SlideController(DisplayController):
QtCore.QObject.connect(Receiver.get_receiver(),
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)'), self.onGoLiveClick)
@ -562,7 +584,20 @@ class SlideController(DisplayController):
width = self.parent().controlSplitter.sizes()[self.split]
for framenumber in range(len(self.serviceItem.get_frames())):
self.previewListWidget.setRowHeight(framenumber, width / self.ratio)
self.onControllerSizeChanged(self.controller.width(), self.controller.height())
def onControllerSizeChanged(self, width, height):
"""
Change layout of display control buttons on controller size change
"""
if self.isLive:
if width > 300 and self.hideMenu.isVisible():
self.toolbar.setWidgetVisible(self.hideMenuList, False)
self.toolbar.setWidgetVisible(self.wideMenu)
elif width < 300 and not self.hideMenu.isVisible():
self.toolbar.setWidgetVisible(self.wideMenu, False)
self.toolbar.setWidgetVisible(self.hideMenuList)
def onSongBarHandler(self):
request = self.sender().text()
slide_no = self.slideList[request]