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 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
|
||||
|
||||
class Ui_EditSongDialog(object):
|
||||
@ -249,23 +250,31 @@ class Ui_EditSongDialog(object):
|
||||
# audio tab
|
||||
self.audioTab = QtGui.QWidget()
|
||||
self.audioTab.setObjectName(u'audioTab')
|
||||
self.audioLayout = QtGui.QVBoxLayout(self.audioTab)
|
||||
#self.audioLayout.setSpacing(8)
|
||||
#self.audioLayout.setContentsMargins(8, 8, 8, 8)
|
||||
self.audioLayout = QtGui.QHBoxLayout(self.audioTab)
|
||||
self.audioLayout.setObjectName(u'audioLayout')
|
||||
self.audioListWidget = QtGui.QListWidget(self.audioTab)
|
||||
self.audioListWidget.setObjectName(u'audioListWidget')
|
||||
self.audioLayout.addWidget(self.audioListWidget)
|
||||
self.audioAddLayout = QtGui.QHBoxLayout()
|
||||
self.audioAddLayout.addStretch(1)
|
||||
self.audioAddLayout.setObjectName(u'audioAddLayout')
|
||||
self.audioButtonsLayout = QtGui.QVBoxLayout()
|
||||
self.audioButtonsLayout.setObjectName(u'audioButtonsLayout')
|
||||
self.audioAddFromFileButton = QtGui.QPushButton(self.audioTab)
|
||||
self.audioAddFromFileButton.setObjectName(u'audioAddFromFileButton')
|
||||
self.audioAddLayout.addWidget(self.audioAddFromFileButton)
|
||||
self.audioButtonsLayout.addWidget(self.audioAddFromFileButton)
|
||||
self.audioAddFromMediaButton = QtGui.QPushButton(self.audioTab)
|
||||
self.audioAddFromMediaButton.setObjectName(u'audioAddFromMediaButton')
|
||||
self.audioAddLayout.addWidget(self.audioAddFromMediaButton)
|
||||
self.audioLayout.addLayout(self.audioAddLayout)
|
||||
self.audioButtonsLayout.addWidget(self.audioAddFromMediaButton)
|
||||
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'')
|
||||
# Last few bits
|
||||
self.dialogLayout.addWidget(self.songTabWidget)
|
||||
@ -331,9 +340,13 @@ class Ui_EditSongDialog(object):
|
||||
self.songTabWidget.indexOf(self.audioTab),
|
||||
translate('SongsPlugin.EditSongForm', 'Linked Audio'))
|
||||
self.audioAddFromFileButton.setText(
|
||||
translate('SongsPlugin.EditSongForm', 'Add From &File(s)'))
|
||||
translate('SongsPlugin.EditSongForm', 'Add &File(s)'))
|
||||
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):
|
||||
"""
|
||||
|
@ -93,6 +93,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
self.mediaitem.plugin.renderer.themeManager.onAddTheme)
|
||||
QtCore.QObject.connect(self.maintenanceButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked)
|
||||
QtCore.QObject.connect(self.audioAddFromFileButton,
|
||||
QtCore.SIGNAL(u'clicked()'), self.onAudioAddFromFileButtonClicked)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'theme_update_list'), self.loadThemes)
|
||||
self.previewButton = QtGui.QPushButton()
|
||||
@ -303,6 +305,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
topic_name = QtGui.QListWidgetItem(unicode(topic.name))
|
||||
topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
|
||||
self.topicsListView.addItem(topic_name)
|
||||
self.audioListWidget.clear()
|
||||
self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
|
||||
# Hide or show the preview button.
|
||||
self.previewButton.setVisible(preview)
|
||||
@ -670,6 +673,23 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
self.saveSong(True)
|
||||
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):
|
||||
"""
|
||||
Free up autocompletion memory on dialog exit
|
||||
|
Loading…
Reference in New Issue
Block a user