This commit is contained in:
Andreas Preikschat 2011-01-20 17:12:07 +01:00
parent e3b3aa2e78
commit ff2ac445f0

View File

@ -801,10 +801,10 @@ class ServiceManager(QtGui.QWidget):
and when regenerating all the items due to theme changes.
``serviceItem``
The item which changed.
The item which changed. (int)
``serviceItemCount``
The number of items in the service.
The child of the ``serviceItem``, which will be selected. (int)
"""
# Correct order of items in array
count = 1
@ -837,6 +837,7 @@ class ServiceManager(QtGui.QWidget):
treewidgetitem.setToolTip(0, serviceitem.notes)
treewidgetitem.setData(0, QtCore.Qt.UserRole,
QtCore.QVariant(item[u'order']))
# Add the children to their parent treewidgetitem.
for count, frame in enumerate(serviceitem.get_frames()):
treewidgetitem1 = QtGui.QTreeWidgetItem(treewidgetitem)
text = frame[u'title'].replace(u'\n', u' ')
@ -844,9 +845,13 @@ class ServiceManager(QtGui.QWidget):
treewidgetitem1.setData(0, QtCore.Qt.UserRole,
QtCore.QVariant(count))
if serviceItem == itemcount and serviceItemCount == count:
#preserve expanding status as setCurrentItem sets it to True
# Preserve expanding status as setCurrentItem sets it to
# True.
temp = item[u'expanded']
if item[u'expanded']:
self.serviceManagerList.setCurrentItem(treewidgetitem1)
else:
self.serviceManagerList.setCurrentItem(treewidgetitem)
item[u'expanded'] = temp
treewidgetitem.setExpanded(item[u'expanded'])
@ -958,7 +963,7 @@ class ServiceManager(QtGui.QWidget):
if replace:
item.merge(self.serviceItems[sitem][u'service_item'])
self.serviceItems[sitem][u'service_item'] = item
self.repaintServiceList(sitem + 1, 0)
self.repaintServiceList(sitem, 0)
self.mainwindow.liveController.replaceServiceManagerItem(item)
else:
# nothing selected for dnd
@ -1046,7 +1051,12 @@ class ServiceManager(QtGui.QWidget):
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()
pos = 0