forked from openlp/openlp
ServiceManager now sends data to Preview and Live Controllers
ServiceManager now selects verses to start with.
This commit is contained in:
parent
0ba52fbd66
commit
93a175a50e
@ -98,6 +98,7 @@ class MainWindow(object):
|
|||||||
self.ServiceManagerContents.renderManager = self.RenderManager
|
self.ServiceManagerContents.renderManager = self.RenderManager
|
||||||
self.ServiceManagerContents.eventManager = self.EventManager
|
self.ServiceManagerContents.eventManager = self.EventManager
|
||||||
self.ServiceManagerContents.liveController = self.LiveController
|
self.ServiceManagerContents.liveController = self.LiveController
|
||||||
|
self.ServiceManagerContents.previewController = self.PreviewController
|
||||||
self.ThemeManagerContents.serviceManager = self.ServiceManagerContents
|
self.ThemeManagerContents.serviceManager = self.ServiceManagerContents
|
||||||
self.ThemeManagerContents.loadThemes()
|
self.ThemeManagerContents.loadThemes()
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
QtGui.QWidget.__init__(self)
|
QtGui.QWidget.__init__(self)
|
||||||
self.parent=parent
|
self.parent=parent
|
||||||
|
self.serviceItems=[]
|
||||||
self.Layout = QtGui.QVBoxLayout(self)
|
self.Layout = QtGui.QVBoxLayout(self)
|
||||||
self.Layout.setSpacing(0)
|
self.Layout.setSpacing(0)
|
||||||
self.Layout.setMargin(0)
|
self.Layout.setMargin(0)
|
||||||
@ -88,10 +89,10 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
|
|
||||||
self.ServiceManagerList.addAction(self.contextMenuAction(
|
self.ServiceManagerList.addAction(self.contextMenuAction(
|
||||||
self.ServiceManagerList, ':/system/system_preview.png',
|
self.ServiceManagerList, ':/system/system_preview.png',
|
||||||
translate(u'ServiceManager',u'&Preview Verse'), self.makeLive))
|
translate(u'ServiceManager',u'&Preview Verse'), self.makePreview))
|
||||||
self.ServiceManagerList.addAction(self.contextMenuAction(
|
self.ServiceManagerList.addAction(self.contextMenuAction(
|
||||||
self.ServiceManagerList, ':/system/system_live.png',
|
self.ServiceManagerList, ':/system/system_live.png',
|
||||||
translate(u'ServiceManager',u'&Show Live'), self.makePreview))
|
translate(u'ServiceManager',u'&Show Live'), self.makeLive))
|
||||||
self.ServiceManagerList.addAction(self.contextMenuSeparator(self.ServiceManagerList))
|
self.ServiceManagerList.addAction(self.contextMenuSeparator(self.ServiceManagerList))
|
||||||
self.ServiceManagerList.addAction(self.contextMenuAction(
|
self.ServiceManagerList.addAction(self.contextMenuAction(
|
||||||
self.ServiceManagerList, ':/services/service_delete',
|
self.ServiceManagerList, ':/services/service_delete',
|
||||||
@ -144,53 +145,43 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.renderManager.default_theme = self.ThemeComboBox.currentText()
|
self.renderManager.default_theme = self.ThemeComboBox.currentText()
|
||||||
|
|
||||||
def addServiceItem(self, item):
|
def addServiceItem(self, item):
|
||||||
|
self.serviceItems.append({u'data': item, u'order': len(self.serviceItems)+1})
|
||||||
treewidgetitem = QtGui.QTreeWidgetItem(self.ServiceManagerList)
|
treewidgetitem = QtGui.QTreeWidgetItem(self.ServiceManagerList)
|
||||||
treewidgetitem.setText(0,item.title + u':' + item.shortname)
|
treewidgetitem.setText(0,item.title + u':' + item.shortname)
|
||||||
treewidgetitem.setIcon(0,item.iconic_representation)
|
treewidgetitem.setIcon(0,item.iconic_representation)
|
||||||
|
treewidgetitem.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(len(self.serviceItems)))
|
||||||
treewidgetitem.setExpanded(True)
|
treewidgetitem.setExpanded(True)
|
||||||
item.render()
|
item.render()
|
||||||
|
count = 0
|
||||||
for frame in item.frames:
|
for frame in item.frames:
|
||||||
treewidgetitem1 = QtGui.QTreeWidgetItem(treewidgetitem)
|
treewidgetitem1 = QtGui.QTreeWidgetItem(treewidgetitem)
|
||||||
text = frame[u'formatted'][0]
|
text = frame[u'formatted'][0]
|
||||||
treewidgetitem1.setText(0,text[:30])
|
treewidgetitem1.setText(0,text[:30])
|
||||||
#treewidgetitem1.setIcon(0,frame[u'image'])
|
treewidgetitem1.setData(0, QtCore.Qt.UserRole,QtCore.QVariant(count))
|
||||||
|
count = count + 1
|
||||||
|
|
||||||
def makePreview(self):
|
def makePreview(self):
|
||||||
print "make Preview"
|
item, count = self.findServiceItem()
|
||||||
|
self.previewController.addServiceManagerItem(self.serviceItems[item][u'data'], count)
|
||||||
|
|
||||||
def makeLive(self):
|
def makeLive(self):
|
||||||
print "make live"
|
item, count = self.findServiceItem()
|
||||||
self.liveController.addServiceManagerItem(None, 1)
|
self.liveController.addServiceManagerItem(self.serviceItems[item][u'data'], count)
|
||||||
# items = self.serviceManagerList.selectedItems()
|
|
||||||
# if items == []:
|
def findServiceItem(self):
|
||||||
# return
|
items = self.ServiceManagerList.selectedItems()
|
||||||
#
|
pos = 0
|
||||||
# for item in items:
|
count = 0
|
||||||
# childCount = item.childCount()
|
for item in items:
|
||||||
# print childCount, item.text(0)
|
childCount = item.childCount()
|
||||||
# if childCount >= 1: # is parent
|
if childCount >= 1: # is the parent
|
||||||
# who = item.text(0)
|
pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||||
# listwidgetitem = QListWidgetItem()
|
else:
|
||||||
# listwidgetitem.setText(who)
|
parentitem = item.parent()
|
||||||
# self.slideControllerList.insertItem(0, listwidgetitem)
|
pos = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||||
# self.slideControllerList.setCurrentRow(0)
|
count = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||||
#
|
pos = pos - 1 #adjust for zeor indexing
|
||||||
# listwidgetitem1 = QListWidgetItem()
|
return pos, count
|
||||||
# listwidgetitem1.setText(u'Children inserted here')
|
|
||||||
# self.slideControllerList.insertItem(1, listwidgetitem1)
|
|
||||||
#
|
|
||||||
# else:
|
|
||||||
# parentitem = item.parent()
|
|
||||||
# print parentitem
|
|
||||||
# who = parentitem.text(0)
|
|
||||||
# listwidgetitem = QListWidgetItem()
|
|
||||||
# listwidgetitem.setText(who)
|
|
||||||
# self.slideControllerList.insertItem(0, listwidgetitem)
|
|
||||||
#
|
|
||||||
# listwidgetitem1 = QListWidgetItem()
|
|
||||||
# listwidgetitem1.setText(u'Children inserted here')
|
|
||||||
# self.slideControllerList.insertItem(1, listwidgetitem1)
|
|
||||||
# self.slideControllerList.setCurrentRow(1)
|
|
||||||
|
|
||||||
def dragEnterEvent(self, event):
|
def dragEnterEvent(self, event):
|
||||||
"""
|
"""
|
||||||
|
@ -190,11 +190,6 @@ class SlideController(QtGui.QWidget):
|
|||||||
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
|
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
|
||||||
QtCore.QObject.connect(self.PreviewListView,
|
QtCore.QObject.connect(self.PreviewListView,
|
||||||
QtCore.SIGNAL(u'activated(QModelIndex)'), self.onSlideSelected)
|
QtCore.SIGNAL(u'activated(QModelIndex)'), self.onSlideSelected)
|
||||||
QtCore.QObject.connect(self.PreviewListView,
|
|
||||||
QtCore.SIGNAL(u'keyPressEvent(QKeyEvent)'), self.onSlideSelecteda)
|
|
||||||
|
|
||||||
def onSlideSelecteda(self, index):
|
|
||||||
print "a", index
|
|
||||||
|
|
||||||
def onSlideSelectedFirst(self):
|
def onSlideSelectedFirst(self):
|
||||||
row = self.PreviewListData.createIndex(0, 0)
|
row = self.PreviewListData.createIndex(0, 0)
|
||||||
@ -264,7 +259,8 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.onSlideSelected(row)
|
self.onSlideSelected(row)
|
||||||
|
|
||||||
def addServiceManagerItem(self, serviceitem, slideno):
|
def addServiceManagerItem(self, serviceitem, slideno):
|
||||||
print "addServiceManagerItem"
|
self.addServiceItem(serviceitem)
|
||||||
|
row = self.PreviewListData.createIndex(slideno, 0)
|
||||||
def render(self):
|
if row.isValid():
|
||||||
pass
|
self.PreviewListView.selectionModel().setCurrentIndex(row, QtGui.QItemSelectionModel.SelectCurrent)
|
||||||
|
self.onSlideSelected(row)
|
||||||
|
Loading…
Reference in New Issue
Block a user