forked from openlp/openlp
More remote edit changes
This commit is contained in:
parent
0ffbc050de
commit
302d29ea85
@ -39,25 +39,23 @@ class ServiceManagerList(QtGui.QTreeWidget):
|
|||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
|
||||||
# def mousePressEvent(self, event):
|
# def mousePressEvent(self, event):
|
||||||
# if type(event) == QtGui.QMouseEvent:
|
# if event.button() == QtCore.Qt.RightButton:
|
||||||
# if event.button() == QtCore.Qt.RightButton:
|
# item = self.itemAt(event.pos())
|
||||||
# item = self.itemAt(event.pos())
|
# parentitem = item.parent()
|
||||||
# parentitem = item.parent()
|
# if parentitem is None:
|
||||||
# if parentitem is None:
|
# pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||||
# pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
|
||||||
# else:
|
|
||||||
# pos = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
|
|
||||||
# serviceItem = self.parent.serviceItems[pos - 1]
|
|
||||||
# if serviceItem[u'data'].editEnabled:
|
|
||||||
# self.parent.editAction.setVisible(True)
|
|
||||||
# else:
|
|
||||||
# self.parent.editAction.setVisible(False)
|
|
||||||
# event.ignore()
|
|
||||||
# else:
|
# else:
|
||||||
# event.ignore()
|
# pos = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||||
|
# serviceItem = self.parent.serviceItems[pos - 1]
|
||||||
|
# if serviceItem[u'data'].editEnabled:
|
||||||
|
# self.parent.editAction.setVisible(True)
|
||||||
|
# else:
|
||||||
|
# self.parent.editAction.setVisible(False)
|
||||||
|
# event.accept()
|
||||||
# else:
|
# else:
|
||||||
# event.ignore()
|
# event.ignore()
|
||||||
|
|
||||||
|
|
||||||
def keyPressEvent(self, event):
|
def keyPressEvent(self, event):
|
||||||
if type(event) == QtGui.QKeyEvent:
|
if type(event) == QtGui.QKeyEvent:
|
||||||
#here accept the event and do something
|
#here accept the event and do something
|
||||||
|
@ -54,7 +54,8 @@ class Ui_customEditDialog(object):
|
|||||||
self.UpButton.setIcon(icon1)
|
self.UpButton.setIcon(icon1)
|
||||||
self.UpButton.setObjectName(u'UpButton')
|
self.UpButton.setObjectName(u'UpButton')
|
||||||
self.verticalLayout.addWidget(self.UpButton)
|
self.verticalLayout.addWidget(self.UpButton)
|
||||||
spacerItem = QtGui.QSpacerItem(20, 128, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
spacerItem = QtGui.QSpacerItem(20, 128,
|
||||||
|
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||||
self.verticalLayout.addItem(spacerItem)
|
self.verticalLayout.addItem(spacerItem)
|
||||||
self.DownButton = QtGui.QPushButton(customEditDialog)
|
self.DownButton = QtGui.QPushButton(customEditDialog)
|
||||||
icon2 = buildIcon(u':/services/service_down.png')
|
icon2 = buildIcon(u':/services/service_down.png')
|
||||||
@ -94,7 +95,8 @@ class Ui_customEditDialog(object):
|
|||||||
self.ClearButton = QtGui.QPushButton(self.ButtonWidge)
|
self.ClearButton = QtGui.QPushButton(self.ButtonWidge)
|
||||||
self.ClearButton.setObjectName(u'ClearButton')
|
self.ClearButton.setObjectName(u'ClearButton')
|
||||||
self.verticalLayout_2.addWidget(self.ClearButton)
|
self.verticalLayout_2.addWidget(self.ClearButton)
|
||||||
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
spacerItem1 = QtGui.QSpacerItem(20, 40,
|
||||||
|
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||||
self.verticalLayout_2.addItem(spacerItem1)
|
self.verticalLayout_2.addItem(spacerItem1)
|
||||||
self.EditLayout_3.addWidget(self.ButtonWidge)
|
self.EditLayout_3.addWidget(self.ButtonWidge)
|
||||||
self.gridLayout.addWidget(self.EditWidget, 2, 0, 1, 1)
|
self.gridLayout.addWidget(self.EditWidget, 2, 0, 1, 1)
|
||||||
@ -117,11 +119,16 @@ class Ui_customEditDialog(object):
|
|||||||
self.horizontalLayout_2.addWidget(self.CreditEdit)
|
self.horizontalLayout_2.addWidget(self.CreditEdit)
|
||||||
self.gridLayout.addLayout(self.horizontalLayout_2, 4, 0, 1, 1)
|
self.gridLayout.addLayout(self.horizontalLayout_2, 4, 0, 1, 1)
|
||||||
self.buttonBox = QtGui.QDialogButtonBox(customEditDialog)
|
self.buttonBox = QtGui.QDialogButtonBox(customEditDialog)
|
||||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
|
self.buttonBox.setStandardButtons(
|
||||||
|
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
|
||||||
self.buttonBox.setObjectName(u'buttonBox')
|
self.buttonBox.setObjectName(u'buttonBox')
|
||||||
self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 1)
|
self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 1)
|
||||||
|
|
||||||
self.retranslateUi(customEditDialog)
|
self.retranslateUi(customEditDialog)
|
||||||
|
QtCore.QObject.connect(self.buttonBox,
|
||||||
|
QtCore.SIGNAL(u'rejected()'), customEditDialog.closePressed)
|
||||||
|
QtCore.QObject.connect(self.buttonBox,
|
||||||
|
QtCore.SIGNAL(u'accepted()'), customEditDialog.accept)
|
||||||
QtCore.QMetaObject.connectSlotsByName(customEditDialog)
|
QtCore.QMetaObject.connectSlotsByName(customEditDialog)
|
||||||
customEditDialog.setTabOrder(self.TitleEdit, self.VerseTextEdit)
|
customEditDialog.setTabOrder(self.TitleEdit, self.VerseTextEdit)
|
||||||
customEditDialog.setTabOrder(self.VerseTextEdit, self.AddButton)
|
customEditDialog.setTabOrder(self.VerseTextEdit, self.AddButton)
|
||||||
|
@ -40,10 +40,6 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
|||||||
#self.parent = parent
|
#self.parent = parent
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
# Connecting signals and slots
|
# Connecting signals and slots
|
||||||
QtCore.QObject.connect(self.buttonBox,
|
|
||||||
QtCore.SIGNAL(u'rejected()'), self.rejected)
|
|
||||||
QtCore.QObject.connect(self.buttonBox,
|
|
||||||
QtCore.SIGNAL(u'accepted()'), self.accept)
|
|
||||||
QtCore.QObject.connect(self.AddButton,
|
QtCore.QObject.connect(self.AddButton,
|
||||||
QtCore.SIGNAL(u'pressed()'), self.onAddButtonPressed)
|
QtCore.SIGNAL(u'pressed()'), self.onAddButtonPressed)
|
||||||
QtCore.QObject.connect(self.EditButton,
|
QtCore.QObject.connect(self.EditButton,
|
||||||
@ -113,6 +109,10 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
|||||||
else:
|
else:
|
||||||
self.ThemeComboBox.setCurrentIndex(0)
|
self.ThemeComboBox.setCurrentIndex(0)
|
||||||
|
|
||||||
|
def closePressed(self):
|
||||||
|
Receiver().send_message(u'remote_edit_clear')
|
||||||
|
self.close()
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
valid, message = self._validate()
|
valid, message = self._validate()
|
||||||
if not valid:
|
if not valid:
|
||||||
@ -132,9 +132,7 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
|||||||
self.customSlide.credits = unicode(self.CreditEdit.displayText())
|
self.customSlide.credits = unicode(self.CreditEdit.displayText())
|
||||||
self.customSlide.theme_name = unicode(self.ThemeComboBox.currentText())
|
self.customSlide.theme_name = unicode(self.ThemeComboBox.currentText())
|
||||||
self.custommanager.save_slide(self.customSlide)
|
self.custommanager.save_slide(self.customSlide)
|
||||||
self.close()
|
Receiver().send_message(u'load_custom_list')
|
||||||
|
|
||||||
def rejected(self):
|
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def onUpButtonPressed(self):
|
def onUpButtonPressed(self):
|
||||||
|
@ -26,7 +26,7 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, SongXMLParser, BaseListWithDnD
|
from openlp.core.lib import MediaManagerItem, SongXMLParser, BaseListWithDnD, Receiver
|
||||||
|
|
||||||
class CustomListView(BaseListWithDnD):
|
class CustomListView(BaseListWithDnD):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
@ -53,6 +53,15 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
self.servicePath = None
|
self.servicePath = None
|
||||||
MediaManagerItem.__init__(self, parent, icon, title)
|
MediaManagerItem.__init__(self, parent, icon, title)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
self.fromServiceManager = -1
|
||||||
|
|
||||||
|
def addEndHeaderBar(self):
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'%s_edit' % self.parent.name), self.onRemoteEdit)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'remote_edit_clear' ), self.onRemoteEditClear)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'load_custom_list'), self.initialise)
|
||||||
|
|
||||||
def requiredIcons(self):
|
def requiredIcons(self):
|
||||||
MediaManagerItem.requiredIcons(self)
|
MediaManagerItem.requiredIcons(self)
|
||||||
@ -68,12 +77,24 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
custom_name.setData(
|
custom_name.setData(
|
||||||
QtCore.Qt.UserRole, QtCore.QVariant(CustomSlide.id))
|
QtCore.Qt.UserRole, QtCore.QVariant(CustomSlide.id))
|
||||||
self.ListView.addItem(custom_name)
|
self.ListView.addItem(custom_name)
|
||||||
|
if CustomSlide.id == self.fromServiceManager:
|
||||||
|
self.onAddClick()
|
||||||
|
|
||||||
def onNewClick(self):
|
def onNewClick(self):
|
||||||
self.parent.edit_custom_form.loadCustom(0)
|
self.parent.edit_custom_form.loadCustom(0)
|
||||||
self.parent.edit_custom_form.exec_()
|
self.parent.edit_custom_form.exec_()
|
||||||
self.initialise()
|
self.initialise()
|
||||||
|
|
||||||
|
def onRemoteEditClear(self):
|
||||||
|
self.fromServiceManager = -1
|
||||||
|
|
||||||
|
def onRemoteEdit(self, item_id):
|
||||||
|
valid = self.parent.custommanager.get_custom(item_id)
|
||||||
|
if valid is not None:
|
||||||
|
self.fromServiceManager = item_id
|
||||||
|
self.parent.edit_custom_form.loadCustom(item_id)
|
||||||
|
self.parent.edit_custom_form.exec_()
|
||||||
|
|
||||||
def onEditClick(self):
|
def onEditClick(self):
|
||||||
item = self.ListView.currentItem()
|
item = self.ListView.currentItem()
|
||||||
if item is not None:
|
if item is not None:
|
||||||
@ -95,13 +116,19 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
raw_footer = []
|
raw_footer = []
|
||||||
slide = None
|
slide = None
|
||||||
theme = None
|
theme = None
|
||||||
item = self.ListView.currentItem()
|
if self.fromServiceManager == -1:
|
||||||
if item is None:
|
item = self.ListView.currentItem()
|
||||||
return False
|
if item is None:
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
return False
|
||||||
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
|
else:
|
||||||
|
item_id = self.fromServiceManager
|
||||||
|
self.fromServiceManager = -1
|
||||||
customSlide = self.parent.custommanager.get_custom(item_id)
|
customSlide = self.parent.custommanager.get_custom(item_id)
|
||||||
title = customSlide.title
|
title = customSlide.title
|
||||||
credit = customSlide.credits
|
credit = customSlide.credits
|
||||||
|
service_item.editEnabled = True
|
||||||
|
service_item.editId = item_id
|
||||||
theme = customSlide.theme_name
|
theme = customSlide.theme_name
|
||||||
if len(theme) is not 0 :
|
if len(theme) is not 0 :
|
||||||
service_item.theme = theme
|
service_item.theme = theme
|
||||||
|
@ -400,7 +400,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
|
|
||||||
def onPreview(self, button):
|
def onPreview(self, button):
|
||||||
log.debug(u'onPreview')
|
log.debug(u'onPreview')
|
||||||
if button.text() == self.trUtf8(u'Save & Preview') and self.saveSong():
|
if button.text() == unicode(self.trUtf8(u'Save && Preview')) \
|
||||||
|
and self.saveSong():
|
||||||
Receiver().send_message(u'preview_song')
|
Receiver().send_message(u'preview_song')
|
||||||
|
|
||||||
def closePressed(self):
|
def closePressed(self):
|
||||||
@ -410,9 +411,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
def accept(self):
|
def accept(self):
|
||||||
log.debug(u'accept')
|
log.debug(u'accept')
|
||||||
if self.saveSong():
|
if self.saveSong():
|
||||||
if self.title_change:
|
Receiver().send_message(u'load_song_list')
|
||||||
Receiver().send_message(u'load_song_list')
|
|
||||||
Receiver().send_message(u'preview_song')
|
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def saveSong(self):
|
def saveSong(self):
|
||||||
|
@ -55,7 +55,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
self.edit_song_form = EditSongForm(self.parent.songmanager, self)
|
self.edit_song_form = EditSongForm(self.parent.songmanager, self)
|
||||||
self.song_maintenance_form = SongMaintenanceForm(
|
self.song_maintenance_form = SongMaintenanceForm(
|
||||||
self.parent.songmanager, self)
|
self.parent.songmanager, self)
|
||||||
self.fromPreview = None
|
self.fromPreview = -1
|
||||||
self.fromServiceManager = -1
|
self.fromServiceManager = -1
|
||||||
|
|
||||||
def requiredIcons(self):
|
def requiredIcons(self):
|
||||||
@ -184,8 +184,9 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
|
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
|
||||||
self.ListView.addItem(song_name)
|
self.ListView.addItem(song_name)
|
||||||
if song.id == self.fromPreview:
|
if song.id == self.fromPreview:
|
||||||
self.fromPreview = 0
|
|
||||||
self.ListView.setCurrentItem(song_name)
|
self.ListView.setCurrentItem(song_name)
|
||||||
|
self.onPreviewClick()
|
||||||
|
self.fromPreview = -1
|
||||||
if song.id == self.fromServiceManager:
|
if song.id == self.fromServiceManager:
|
||||||
self.onAddClick()
|
self.onAddClick()
|
||||||
|
|
||||||
@ -247,7 +248,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
item = self.ListView.currentItem()
|
item = self.ListView.currentItem()
|
||||||
if item is not None:
|
if item is not None:
|
||||||
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
self.fromPreview = 0
|
self.fromPreview = -1
|
||||||
if preview:
|
if preview:
|
||||||
self.fromPreview = item_id
|
self.fromPreview = item_id
|
||||||
self.edit_song_form.loadSong(item_id)
|
self.edit_song_form.loadSong(item_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user