forked from openlp/openlp
Fix DND for service items
This commit is contained in:
parent
3b59525e98
commit
df8ffa53b2
@ -100,6 +100,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.serviceItems = []
|
self.serviceItems = []
|
||||||
self.serviceName = u''
|
self.serviceName = u''
|
||||||
|
self.droppos = 0
|
||||||
#is a new service and has not been saved
|
#is a new service and has not been saved
|
||||||
self.isNew = True
|
self.isNew = True
|
||||||
#Indicates if remoteTriggering is active. If it is the next addServiceItem call
|
#Indicates if remoteTriggering is active. If it is the next addServiceItem call
|
||||||
@ -639,19 +640,21 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.repaintServiceList(sitem + 1, 0)
|
self.repaintServiceList(sitem + 1, 0)
|
||||||
self.parent.LiveController.replaceServiceManagerItem(item)
|
self.parent.LiveController.replaceServiceManagerItem(item)
|
||||||
else:
|
else:
|
||||||
if sitem == -1:
|
#nothing selected or dnd
|
||||||
|
if self.droppos == 0:
|
||||||
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':expand})
|
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(self.droppos, {u'service_item': item,
|
||||||
u'order': len(self.serviceItems)+1,
|
u'order': self.droppos,
|
||||||
u'expanded':expand})
|
u'expanded':expand})
|
||||||
self.repaintServiceList(sitem + 1, 0)
|
self.repaintServiceList(self.droppos, 0)
|
||||||
#if rebuilding list make sure live is fixed.
|
#if rebuilding list make sure live is fixed.
|
||||||
if rebuild:
|
if rebuild:
|
||||||
self.parent.LiveController.replaceServiceManagerItem(item)
|
self.parent.LiveController.replaceServiceManagerItem(item)
|
||||||
|
self.droppos = 0
|
||||||
self.parent.serviceChanged(False, self.serviceName)
|
self.parent.serviceChanged(False, self.serviceName)
|
||||||
|
|
||||||
def makePreview(self):
|
def makePreview(self):
|
||||||
@ -732,9 +735,9 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
link = event.mimeData()
|
link = event.mimeData()
|
||||||
if link.hasText():
|
if link.hasText():
|
||||||
plugin = event.mimeData().text()
|
plugin = event.mimeData().text()
|
||||||
|
item = self.ServiceManagerList.itemAt(event.pos())
|
||||||
if plugin == u'ServiceManager':
|
if plugin == u'ServiceManager':
|
||||||
startpos, startCount = self.findServiceItem()
|
startpos, startCount = self.findServiceItem()
|
||||||
item = self.ServiceManagerList.itemAt(event.pos())
|
|
||||||
if item is None:
|
if item is None:
|
||||||
endpos = len(self.serviceItems)
|
endpos = len(self.serviceItems)
|
||||||
else:
|
else:
|
||||||
@ -753,6 +756,14 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.serviceItems.insert(newpos, serviceItem)
|
self.serviceItems.insert(newpos, serviceItem)
|
||||||
self.repaintServiceList(endpos, startCount)
|
self.repaintServiceList(endpos, startCount)
|
||||||
else:
|
else:
|
||||||
|
if item == None:
|
||||||
|
self.droppos = len(self.serviceItems)
|
||||||
|
else:
|
||||||
|
parentitem = item.parent()
|
||||||
|
if parentitem is None:
|
||||||
|
self.droppos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||||
|
else:
|
||||||
|
self.droppos = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
|
||||||
Receiver.send_message(u'%s_add_service_item' % plugin)
|
Receiver.send_message(u'%s_add_service_item' % plugin)
|
||||||
|
|
||||||
def updateThemeList(self, theme_list):
|
def updateThemeList(self, theme_list):
|
||||||
|
Loading…
Reference in New Issue
Block a user