forked from openlp/openlp
Added Up, Down, Remove and Remove All buttons. Reworked the UI to make use of the buttons better.
This commit is contained in:
parent
409a16eb35
commit
6a60ece204
@ -28,7 +28,8 @@
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, translate
|
from openlp.core.lib import build_icon, translate
|
||||||
from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box
|
from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box, \
|
||||||
|
create_up_down_push_button_set
|
||||||
from openlp.plugins.songs.lib.ui import SongStrings
|
from openlp.plugins.songs.lib.ui import SongStrings
|
||||||
|
|
||||||
class Ui_EditSongDialog(object):
|
class Ui_EditSongDialog(object):
|
||||||
@ -249,23 +250,31 @@ class Ui_EditSongDialog(object):
|
|||||||
# audio tab
|
# audio tab
|
||||||
self.audioTab = QtGui.QWidget()
|
self.audioTab = QtGui.QWidget()
|
||||||
self.audioTab.setObjectName(u'audioTab')
|
self.audioTab.setObjectName(u'audioTab')
|
||||||
self.audioLayout = QtGui.QVBoxLayout(self.audioTab)
|
self.audioLayout = QtGui.QHBoxLayout(self.audioTab)
|
||||||
#self.audioLayout.setSpacing(8)
|
|
||||||
#self.audioLayout.setContentsMargins(8, 8, 8, 8)
|
|
||||||
self.audioLayout.setObjectName(u'audioLayout')
|
self.audioLayout.setObjectName(u'audioLayout')
|
||||||
self.audioListWidget = QtGui.QListWidget(self.audioTab)
|
self.audioListWidget = QtGui.QListWidget(self.audioTab)
|
||||||
self.audioListWidget.setObjectName(u'audioListWidget')
|
self.audioListWidget.setObjectName(u'audioListWidget')
|
||||||
self.audioLayout.addWidget(self.audioListWidget)
|
self.audioLayout.addWidget(self.audioListWidget)
|
||||||
self.audioAddLayout = QtGui.QHBoxLayout()
|
self.audioButtonsLayout = QtGui.QVBoxLayout()
|
||||||
self.audioAddLayout.addStretch(1)
|
self.audioButtonsLayout.setObjectName(u'audioButtonsLayout')
|
||||||
self.audioAddLayout.setObjectName(u'audioAddLayout')
|
|
||||||
self.audioAddFromFileButton = QtGui.QPushButton(self.audioTab)
|
self.audioAddFromFileButton = QtGui.QPushButton(self.audioTab)
|
||||||
self.audioAddFromFileButton.setObjectName(u'audioAddFromFileButton')
|
self.audioAddFromFileButton.setObjectName(u'audioAddFromFileButton')
|
||||||
self.audioAddLayout.addWidget(self.audioAddFromFileButton)
|
self.audioButtonsLayout.addWidget(self.audioAddFromFileButton)
|
||||||
self.audioAddFromMediaButton = QtGui.QPushButton(self.audioTab)
|
self.audioAddFromMediaButton = QtGui.QPushButton(self.audioTab)
|
||||||
self.audioAddFromMediaButton.setObjectName(u'audioAddFromMediaButton')
|
self.audioAddFromMediaButton.setObjectName(u'audioAddFromMediaButton')
|
||||||
self.audioAddLayout.addWidget(self.audioAddFromMediaButton)
|
self.audioButtonsLayout.addWidget(self.audioAddFromMediaButton)
|
||||||
self.audioLayout.addLayout(self.audioAddLayout)
|
self.audioRemoveButton = QtGui.QPushButton(self.audioTab)
|
||||||
|
self.audioRemoveButton.setObjectName(u'audioRemoveButton')
|
||||||
|
self.audioButtonsLayout.addWidget(self.audioRemoveButton)
|
||||||
|
self.audioRemoveAllButton = QtGui.QPushButton(self.audioTab)
|
||||||
|
self.audioRemoveAllButton.setObjectName(u'audioRemoveAllButton')
|
||||||
|
self.audioButtonsLayout.addWidget(self.audioRemoveAllButton)
|
||||||
|
self.audioButtonsLayout.addStretch(1)
|
||||||
|
self.upButton, self.downButton = \
|
||||||
|
create_up_down_push_button_set(self)
|
||||||
|
self.audioButtonsLayout.addWidget(self.upButton)
|
||||||
|
self.audioButtonsLayout.addWidget(self.downButton)
|
||||||
|
self.audioLayout.addLayout(self.audioButtonsLayout)
|
||||||
self.songTabWidget.addTab(self.audioTab, u'')
|
self.songTabWidget.addTab(self.audioTab, u'')
|
||||||
# Last few bits
|
# Last few bits
|
||||||
self.dialogLayout.addWidget(self.songTabWidget)
|
self.dialogLayout.addWidget(self.songTabWidget)
|
||||||
@ -331,9 +340,13 @@ class Ui_EditSongDialog(object):
|
|||||||
self.songTabWidget.indexOf(self.audioTab),
|
self.songTabWidget.indexOf(self.audioTab),
|
||||||
translate('SongsPlugin.EditSongForm', 'Linked Audio'))
|
translate('SongsPlugin.EditSongForm', 'Linked Audio'))
|
||||||
self.audioAddFromFileButton.setText(
|
self.audioAddFromFileButton.setText(
|
||||||
translate('SongsPlugin.EditSongForm', 'Add From &File(s)'))
|
translate('SongsPlugin.EditSongForm', 'Add &File(s)'))
|
||||||
self.audioAddFromMediaButton.setText(
|
self.audioAddFromMediaButton.setText(
|
||||||
translate('SongsPlugin.EditSongForm', 'Add From &Media'))
|
translate('SongsPlugin.EditSongForm', 'Add &Media'))
|
||||||
|
self.audioRemoveButton.setText(
|
||||||
|
translate('SongsPlugin.EditSongForm', '&Remove'))
|
||||||
|
self.audioRemoveAllButton.setText(
|
||||||
|
translate('SongsPlugin.EditSongForm', 'Remove &All'))
|
||||||
|
|
||||||
def editSongDialogComboBox(parent, name):
|
def editSongDialogComboBox(parent, name):
|
||||||
"""
|
"""
|
||||||
|
@ -93,6 +93,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.mediaitem.plugin.renderer.themeManager.onAddTheme)
|
self.mediaitem.plugin.renderer.themeManager.onAddTheme)
|
||||||
QtCore.QObject.connect(self.maintenanceButton,
|
QtCore.QObject.connect(self.maintenanceButton,
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked)
|
QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked)
|
||||||
|
QtCore.QObject.connect(self.audioAddFromFileButton,
|
||||||
|
QtCore.SIGNAL(u'clicked()'), self.onAudioAddFromFileButtonClicked)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'theme_update_list'), self.loadThemes)
|
QtCore.SIGNAL(u'theme_update_list'), self.loadThemes)
|
||||||
self.previewButton = QtGui.QPushButton()
|
self.previewButton = QtGui.QPushButton()
|
||||||
@ -303,6 +305,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
topic_name = QtGui.QListWidgetItem(unicode(topic.name))
|
topic_name = QtGui.QListWidgetItem(unicode(topic.name))
|
||||||
topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
|
topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
|
||||||
self.topicsListView.addItem(topic_name)
|
self.topicsListView.addItem(topic_name)
|
||||||
|
self.audioListWidget.clear()
|
||||||
self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
|
self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
|
||||||
# Hide or show the preview button.
|
# Hide or show the preview button.
|
||||||
self.previewButton.setVisible(preview)
|
self.previewButton.setVisible(preview)
|
||||||
@ -670,6 +673,23 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.saveSong(True)
|
self.saveSong(True)
|
||||||
Receiver.send_message(u'songs_preview')
|
Receiver.send_message(u'songs_preview')
|
||||||
|
|
||||||
|
def onAudioAddFromFileButtonClicked(self):
|
||||||
|
"""
|
||||||
|
Loads file(s) from the filesystem.
|
||||||
|
"""
|
||||||
|
filters = u'%s (*)' % UiStrings().AllFiles
|
||||||
|
filenames = QtGui.QFileDialog.getOpenFileNames(self,
|
||||||
|
translate('SongsPlugin.EditSongForm', 'Open File(s)'),
|
||||||
|
QtCore.QString(), filters)
|
||||||
|
for filename in filenames:
|
||||||
|
self.audioListWidget.addItem(filename)
|
||||||
|
|
||||||
|
def onUpButtonClicked(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def onDownButtonClicked(self):
|
||||||
|
pass
|
||||||
|
|
||||||
def clearCaches(self):
|
def clearCaches(self):
|
||||||
"""
|
"""
|
||||||
Free up autocompletion memory on dialog exit
|
Free up autocompletion memory on dialog exit
|
||||||
|
Loading…
Reference in New Issue
Block a user