forked from openlp/openlp
commit
8a26a6ef65
@ -808,17 +808,17 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.repaintServiceList(0, 0)
|
self.repaintServiceList(0, 0)
|
||||||
self.setModified(True)
|
self.setModified(True)
|
||||||
|
|
||||||
def repaintServiceList(self, serviceItem, serviceItemCount):
|
def repaintServiceList(self, serviceItem, serviceItemChild):
|
||||||
"""
|
"""
|
||||||
Clear the existing service list and prepaint all the items. This is
|
Clear the existing service list and prepaint all the items. This is
|
||||||
used when moving items as the move takes place in a supporting list,
|
used when moving items as the move takes place in a supporting list,
|
||||||
and when regenerating all the items due to theme changes.
|
and when regenerating all the items due to theme changes.
|
||||||
|
|
||||||
``serviceItem``
|
``serviceItem``
|
||||||
The item which changed.
|
The item which changed. (int)
|
||||||
|
|
||||||
``serviceItemCount``
|
``serviceItemChild``
|
||||||
The number of items in the service.
|
The child of the ``serviceItem``, which will be selected. (int)
|
||||||
"""
|
"""
|
||||||
# Correct order of items in array
|
# Correct order of items in array
|
||||||
count = 1
|
count = 1
|
||||||
@ -851,17 +851,17 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
treewidgetitem.setToolTip(0, serviceitem.notes)
|
treewidgetitem.setToolTip(0, serviceitem.notes)
|
||||||
treewidgetitem.setData(0, QtCore.Qt.UserRole,
|
treewidgetitem.setData(0, QtCore.Qt.UserRole,
|
||||||
QtCore.QVariant(item[u'order']))
|
QtCore.QVariant(item[u'order']))
|
||||||
|
# Add the children to their parent treewidgetitem.
|
||||||
for count, frame in enumerate(serviceitem.get_frames()):
|
for count, frame in enumerate(serviceitem.get_frames()):
|
||||||
treewidgetitem1 = QtGui.QTreeWidgetItem(treewidgetitem)
|
child = QtGui.QTreeWidgetItem(treewidgetitem)
|
||||||
text = frame[u'title'].replace(u'\n', u' ')
|
text = frame[u'title'].replace(u'\n', u' ')
|
||||||
treewidgetitem1.setText(0, text[:40])
|
child.setText(0, text[:40])
|
||||||
treewidgetitem1.setData(0, QtCore.Qt.UserRole,
|
child.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(count))
|
||||||
QtCore.QVariant(count))
|
if serviceItem == itemcount:
|
||||||
if serviceItem == itemcount and serviceItemCount == count:
|
if item[u'expanded'] and serviceItemChild == count:
|
||||||
#preserve expanding status as setCurrentItem sets it to True
|
self.serviceManagerList.setCurrentItem(child)
|
||||||
temp = item[u'expanded']
|
elif serviceItemChild == -1:
|
||||||
self.serviceManagerList.setCurrentItem(treewidgetitem1)
|
self.serviceManagerList.setCurrentItem(treewidgetitem)
|
||||||
item[u'expanded'] = temp
|
|
||||||
treewidgetitem.setExpanded(item[u'expanded'])
|
treewidgetitem.setExpanded(item[u'expanded'])
|
||||||
|
|
||||||
def validateItem(self, serviceItem):
|
def validateItem(self, serviceItem):
|
||||||
@ -972,7 +972,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
if replace:
|
if replace:
|
||||||
item.merge(self.serviceItems[sitem][u'service_item'])
|
item.merge(self.serviceItems[sitem][u'service_item'])
|
||||||
self.serviceItems[sitem][u'service_item'] = item
|
self.serviceItems[sitem][u'service_item'] = item
|
||||||
self.repaintServiceList(sitem + 1, 0)
|
self.repaintServiceList(sitem, 0)
|
||||||
self.mainwindow.liveController.replaceServiceManagerItem(item)
|
self.mainwindow.liveController.replaceServiceManagerItem(item)
|
||||||
else:
|
else:
|
||||||
# nothing selected for dnd
|
# nothing selected for dnd
|
||||||
@ -1060,11 +1060,16 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
|
|
||||||
def findServiceItem(self):
|
def findServiceItem(self):
|
||||||
"""
|
"""
|
||||||
Finds a ServiceItem in the list
|
Finds a ServiceItem in the list and returns the position of the
|
||||||
|
serviceitem and its selected child item. For example, if the third child
|
||||||
|
item (in the Slidecontroller known as slide) in the second service item
|
||||||
|
is selected this will return::
|
||||||
|
|
||||||
|
(1, 2)
|
||||||
"""
|
"""
|
||||||
items = self.serviceManagerList.selectedItems()
|
items = self.serviceManagerList.selectedItems()
|
||||||
pos = 0
|
pos = 0
|
||||||
count = 0
|
count = -1
|
||||||
for item in items:
|
for item in items:
|
||||||
parentitem = item.parent()
|
parentitem = item.parent()
|
||||||
if parentitem is None:
|
if parentitem is None:
|
||||||
|
@ -576,6 +576,9 @@ class SlideController(QtGui.QWidget):
|
|||||||
Called by ServiceManager
|
Called by ServiceManager
|
||||||
"""
|
"""
|
||||||
log.debug(u'addServiceManagerItem live = %s' % self.isLive)
|
log.debug(u'addServiceManagerItem live = %s' % self.isLive)
|
||||||
|
# If no valid slide number is specified we take the first one.
|
||||||
|
if slideno == -1:
|
||||||
|
slideno = 0
|
||||||
# If service item is the same as the current on only change slide
|
# If service item is the same as the current on only change slide
|
||||||
if item.__eq__(self.serviceItem):
|
if item.__eq__(self.serviceItem):
|
||||||
if slideno + 1 < self.PreviewListWidget.rowCount():
|
if slideno + 1 < self.PreviewListWidget.rowCount():
|
||||||
|
Loading…
Reference in New Issue
Block a user