name change

This commit is contained in:
Andreas Preikschat 2011-01-22 08:31:32 +01:00
parent 7e57fa2f95
commit 4263182290

View File

@ -794,7 +794,7 @@ 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,
@ -803,7 +803,7 @@ class ServiceManager(QtGui.QWidget):
``serviceItem`` ``serviceItem``
The item which changed. (int) The item which changed. (int)
``serviceItemCount`` ``serviceItemChild``
The child of the ``serviceItem``, which will be selected. (int) The child of the ``serviceItem``, which will be selected. (int)
""" """
# Correct order of items in array # Correct order of items in array
@ -839,20 +839,15 @@ class ServiceManager(QtGui.QWidget):
QtCore.QVariant(item[u'order'])) QtCore.QVariant(item[u'order']))
# Add the children to their parent treewidgetitem. # 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:
# Preserve expanding status as setCurrentItem sets it to if item[u'expanded'] and serviceItemChild == count:
# True. self.serviceManagerList.setCurrentItem(child)
temp = item[u'expanded'] elif serviceItemChild == -1:
if item[u'expanded'] and serviceItemCount == count:
self.serviceManagerList.setCurrentItem(treewidgetitem1)
elif serviceItemCount == -1:
self.serviceManagerList.setCurrentItem(treewidgetitem) 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):