Fix serviceItem expansion on repaint

Add ALL to Images file filter
Add Icon overlay to serviceItem when we have notes.

bzr-revno: 727
This commit is contained in:
Tim Bentley 2010-03-08 16:50:20 +00:00
commit 2bef008687
4 changed files with 19 additions and 9 deletions

View File

@ -430,12 +430,21 @@ class ServiceManager(QtGui.QWidget):
serviceitem = item[u'service_item'] serviceitem = item[u'service_item']
treewidgetitem = QtGui.QTreeWidgetItem(self.ServiceManagerList) treewidgetitem = QtGui.QTreeWidgetItem(self.ServiceManagerList)
if len(serviceitem.notes) > 0: if len(serviceitem.notes) > 0:
title = u'%s - %s' % (self.trUtf8('(N)'), serviceitem.title) icon = QtGui.QImage(serviceitem.icon)
icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio,
QtCore.Qt.SmoothTransformation)
overlay = QtGui.QImage(':/services/service_item_notes.png')
overlay = overlay.scaled(80, 80, QtCore.Qt.KeepAspectRatio,
QtCore.Qt.SmoothTransformation)
painter = QtGui.QPainter(icon)
painter.drawImage(0, 0, overlay)
painter.end()
treewidgetitem.setIcon(0, build_icon(icon))
else: else:
title = serviceitem.title
treewidgetitem.setText(0, title)
treewidgetitem.setToolTip(0, serviceitem.notes)
treewidgetitem.setIcon(0, serviceitem.iconic_representation) treewidgetitem.setIcon(0, serviceitem.iconic_representation)
treewidgetitem.setText(0, serviceitem.title)
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']))
treewidgetitem.setExpanded(item[u'expanded']) treewidgetitem.setExpanded(item[u'expanded'])
@ -599,12 +608,12 @@ class ServiceManager(QtGui.QWidget):
self.serviceItems = [] self.serviceItems = []
self.isNew = True self.isNew = True
for item in tempServiceItems: for item in tempServiceItems:
self.addServiceItem(item[u'service_item'], True) self.addServiceItem(item[u'service_item'], False, item[u'expanded'])
#Set to False as items may have changed rendering #Set to False as items may have changed rendering
#does not impact the saved song so True may aslo be valid #does not impact the saved song so True may aslo be valid
self.parent.serviceChanged(False, self.serviceName) self.parent.serviceChanged(False, self.serviceName)
def addServiceItem(self, item, rebuild=False): def addServiceItem(self, item, rebuild=False, expand=True):
""" """
Add a Service item to the list Add a Service item to the list
@ -624,12 +633,12 @@ class ServiceManager(QtGui.QWidget):
if sitem == -1: if sitem == -1:
self.serviceItems.append({u'service_item': item, self.serviceItems.append({u'service_item': item,
u'order': len(self.serviceItems) + 1, u'order': len(self.serviceItems) + 1,
u'expanded':True}) u'expanded':expand})
self.repaintServiceList(len(self.serviceItems) + 1, 0) self.repaintServiceList(len(self.serviceItems) + 1, 0)
else: else:
self.serviceItems.insert(sitem + 1, {u'service_item': item, self.serviceItems.insert(sitem + 1, {u'service_item': item,
u'order': len(self.serviceItems)+1, u'order': len(self.serviceItems)+1,
u'expanded':True}) u'expanded':expand})
self.repaintServiceList(sitem + 1, 0) self.repaintServiceList(sitem + 1, 0)
#if rebuilding list make sure live is fixed. #if rebuilding list make sure live is fixed.
if rebuild: if rebuild:

View File

@ -61,7 +61,7 @@ class ImageMediaItem(MediaManagerItem):
def retranslateUi(self): def retranslateUi(self):
self.OnNewPrompt = self.trUtf8('Select Image(s)') self.OnNewPrompt = self.trUtf8('Select Image(s)')
self.OnNewFileMasks = \ self.OnNewFileMasks = \
self.trUtf8('Images (*.jpg *jpeg *.gif *.png *.bmp)') self.trUtf8('Images (*.jpg *jpeg *.gif *.png *.bmp);; All files (*)')
def requiredIcons(self): def requiredIcons(self):
MediaManagerItem.requiredIcons(self) MediaManagerItem.requiredIcons(self)

View File

@ -78,6 +78,7 @@
<qresource prefix="services"> <qresource prefix="services">
<file>service_edit.png</file> <file>service_edit.png</file>
<file>service_notes.png</file> <file>service_notes.png</file>
<file>service_item_notes.png</file>
<file>service_bottom.png</file> <file>service_bottom.png</file>
<file>service_down.png</file> <file>service_down.png</file>
<file>service_top.png</file> <file>service_top.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B