forked from openlp/openlp
Media player configuration changes:
Change the layout of the up/down buttons Fix issue: if choose down button without selecting any item before the settings dialog were broken bzr-revno: 1895
This commit is contained in:
commit
69d961666c
File diff suppressed because it is too large
Load Diff
@ -28,7 +28,7 @@
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import SettingsTab, translate, Receiver
|
from openlp.core.lib import SettingsTab, translate, Receiver
|
||||||
from openlp.core.lib.ui import UiStrings
|
from openlp.core.lib.ui import UiStrings, create_up_down_push_button_set
|
||||||
|
|
||||||
class MediaTab(SettingsTab):
|
class MediaTab(SettingsTab):
|
||||||
"""
|
"""
|
||||||
@ -57,7 +57,7 @@ class MediaTab(SettingsTab):
|
|||||||
self.leftLayout.addWidget(self.mediaPlayerGroupBox)
|
self.leftLayout.addWidget(self.mediaPlayerGroupBox)
|
||||||
self.playerOrderGroupBox = QtGui.QGroupBox(self.leftColumn)
|
self.playerOrderGroupBox = QtGui.QGroupBox(self.leftColumn)
|
||||||
self.playerOrderGroupBox.setObjectName(u'playerOrderGroupBox')
|
self.playerOrderGroupBox.setObjectName(u'playerOrderGroupBox')
|
||||||
self.playerOrderLayout = QtGui.QVBoxLayout(self.playerOrderGroupBox)
|
self.playerOrderLayout = QtGui.QHBoxLayout(self.playerOrderGroupBox)
|
||||||
self.playerOrderLayout.setObjectName(u'playerOrderLayout')
|
self.playerOrderLayout.setObjectName(u'playerOrderLayout')
|
||||||
self.playerOrderlistWidget = QtGui.QListWidget( \
|
self.playerOrderlistWidget = QtGui.QListWidget( \
|
||||||
self.playerOrderGroupBox)
|
self.playerOrderGroupBox)
|
||||||
@ -76,18 +76,15 @@ class MediaTab(SettingsTab):
|
|||||||
QtGui.QAbstractItemView.NoEditTriggers)
|
QtGui.QAbstractItemView.NoEditTriggers)
|
||||||
self.playerOrderlistWidget.setObjectName(u'playerOrderlistWidget')
|
self.playerOrderlistWidget.setObjectName(u'playerOrderlistWidget')
|
||||||
self.playerOrderLayout.addWidget(self.playerOrderlistWidget)
|
self.playerOrderLayout.addWidget(self.playerOrderlistWidget)
|
||||||
self.orderingButtonsWidget = QtGui.QWidget(self.playerOrderGroupBox)
|
self.orderingButtonLayout = QtGui.QVBoxLayout()
|
||||||
self.orderingButtonsWidget.setObjectName(u'orderingButtonsWidget')
|
|
||||||
self.orderingButtonLayout = QtGui.QHBoxLayout( \
|
|
||||||
self.orderingButtonsWidget)
|
|
||||||
self.orderingButtonLayout.setObjectName(u'orderingButtonLayout')
|
self.orderingButtonLayout.setObjectName(u'orderingButtonLayout')
|
||||||
self.orderingDownButton = QtGui.QPushButton(self.orderingButtonsWidget)
|
self.orderingButtonLayout.addStretch(1)
|
||||||
self.orderingDownButton.setObjectName(u'orderingDownButton')
|
self.orderingUpButton, self.orderingDownButton = \
|
||||||
self.orderingButtonLayout.addWidget(self.orderingDownButton)
|
create_up_down_push_button_set(self)
|
||||||
self.orderingUpButton = QtGui.QPushButton(self.playerOrderGroupBox)
|
|
||||||
self.orderingUpButton.setObjectName(u'orderingUpButton')
|
|
||||||
self.orderingButtonLayout.addWidget(self.orderingUpButton)
|
self.orderingButtonLayout.addWidget(self.orderingUpButton)
|
||||||
self.playerOrderLayout.addWidget(self.orderingButtonsWidget)
|
self.orderingButtonLayout.addWidget(self.orderingDownButton)
|
||||||
|
self.orderingButtonLayout.addStretch(1)
|
||||||
|
self.playerOrderLayout.addLayout(self.orderingButtonLayout)
|
||||||
self.leftLayout.addWidget(self.playerOrderGroupBox)
|
self.leftLayout.addWidget(self.playerOrderGroupBox)
|
||||||
self.advancedGroupBox = QtGui.QGroupBox(self.leftColumn)
|
self.advancedGroupBox = QtGui.QGroupBox(self.leftColumn)
|
||||||
self.advancedGroupBox.setObjectName(u'advancedGroupBox')
|
self.advancedGroupBox.setObjectName(u'advancedGroupBox')
|
||||||
@ -105,10 +102,6 @@ class MediaTab(SettingsTab):
|
|||||||
QtCore.QObject.connect(checkbox,
|
QtCore.QObject.connect(checkbox,
|
||||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||||
self.onPlayerCheckBoxChanged)
|
self.onPlayerCheckBoxChanged)
|
||||||
QtCore.QObject.connect(self.orderingUpButton,
|
|
||||||
QtCore.SIGNAL(u'pressed()'), self.onOrderingUpButtonPressed)
|
|
||||||
QtCore.QObject.connect(self.orderingDownButton,
|
|
||||||
QtCore.SIGNAL(u'pressed()'), self.onOrderingDownButtonPressed)
|
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.mediaPlayerGroupBox.setTitle(
|
self.mediaPlayerGroupBox.setTitle(
|
||||||
@ -124,10 +117,6 @@ class MediaTab(SettingsTab):
|
|||||||
'%s (unavailable)')) % player.name)
|
'%s (unavailable)')) % player.name)
|
||||||
self.playerOrderGroupBox.setTitle(
|
self.playerOrderGroupBox.setTitle(
|
||||||
translate('MediaPlugin.MediaTab', 'Player Order'))
|
translate('MediaPlugin.MediaTab', 'Player Order'))
|
||||||
self.orderingDownButton.setText(
|
|
||||||
translate('MediaPlugin.MediaTab', 'Down'))
|
|
||||||
self.orderingUpButton.setText(
|
|
||||||
translate('MediaPlugin.MediaTab', 'Up'))
|
|
||||||
self.advancedGroupBox.setTitle(UiStrings().Advanced)
|
self.advancedGroupBox.setTitle(UiStrings().Advanced)
|
||||||
self.overridePlayerCheckBox.setText(
|
self.overridePlayerCheckBox.setText(
|
||||||
translate('MediaPlugin.MediaTab',
|
translate('MediaPlugin.MediaTab',
|
||||||
@ -154,21 +143,23 @@ class MediaTab(SettingsTab):
|
|||||||
self.playerCheckBoxes[u'%s' % player].setEnabled(True)
|
self.playerCheckBoxes[u'%s' % player].setEnabled(True)
|
||||||
self.playerOrderlistWidget.addItem(player)
|
self.playerOrderlistWidget.addItem(player)
|
||||||
|
|
||||||
def onOrderingUpButtonPressed(self):
|
def onUpButtonClicked(self):
|
||||||
currentRow = self.playerOrderlistWidget.currentRow()
|
row = self.playerOrderlistWidget.currentRow()
|
||||||
if currentRow > 0:
|
if row <= 0:
|
||||||
item = self.playerOrderlistWidget.takeItem(currentRow)
|
return
|
||||||
self.playerOrderlistWidget.insertItem(currentRow - 1, item)
|
item = self.playerOrderlistWidget.takeItem(row)
|
||||||
self.playerOrderlistWidget.setCurrentRow(currentRow - 1)
|
self.playerOrderlistWidget.insertItem(row - 1, item)
|
||||||
self.usedPlayers.move(currentRow, currentRow - 1)
|
self.playerOrderlistWidget.setCurrentRow(row - 1)
|
||||||
|
self.usedPlayers.move(row, row - 1)
|
||||||
|
|
||||||
def onOrderingDownButtonPressed(self):
|
def onDownButtonClicked(self):
|
||||||
currentRow = self.playerOrderlistWidget.currentRow()
|
row = self.playerOrderlistWidget.currentRow()
|
||||||
if currentRow < self.playerOrderlistWidget.count() - 1:
|
if row == -1 or row > self.playerOrderlistWidget.count() - 1:
|
||||||
item = self.playerOrderlistWidget.takeItem(currentRow)
|
return
|
||||||
self.playerOrderlistWidget.insertItem(currentRow + 1, item)
|
item = self.playerOrderlistWidget.takeItem(row)
|
||||||
self.playerOrderlistWidget.setCurrentRow(currentRow + 1)
|
self.playerOrderlistWidget.insertItem(row + 1, item)
|
||||||
self.usedPlayers.move(currentRow, currentRow + 1)
|
self.playerOrderlistWidget.setCurrentRow(row + 1)
|
||||||
|
self.usedPlayers.move(row, row + 1)
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
if self.savedUsedPlayers:
|
if self.savedUsedPlayers:
|
||||||
|
Loading…
Reference in New Issue
Block a user