Event clean ups and fixes

This commit is contained in:
Tim Bentley 2010-03-04 22:03:43 +00:00
parent 9ada2f00b0
commit 181c7c9946
2 changed files with 39 additions and 30 deletions

View File

@ -60,7 +60,6 @@ QToolBar
padding: 0;
}
"""
log = logging.getLogger(__name__)
class OpenLP(QtGui.QApplication):
"""

View File

@ -42,15 +42,15 @@ class ServiceManagerList(QtGui.QTreeWidget):
def __init__(self, parent=None, name=None):
QtGui.QTreeWidget.__init__(self,parent)
self.parent = parent
def mouseDoubleClickEvent(self, event):
self.parent.makeLive()
event.ignore()
self.setExpandsOnDoubleClick(False)
def mousePressEvent(self, event):
if event.button() == QtCore.Qt.RightButton:
#Implement item selection
item = self.itemAt(event.pos())
if item is not None:
self.setCurrentItem(item)
parentitem = item.parent()
if event.button() == QtCore.Qt.RightButton:
self.parent.noteAction.setVisible(False)
if parentitem is None:
pos = item.data(0, QtCore.Qt.UserRole).toInt()[0]
@ -58,7 +58,6 @@ class ServiceManagerList(QtGui.QTreeWidget):
else:
pos = parentitem.data(0, QtCore.Qt.UserRole).toInt()[0]
serviceItem = self.parent.serviceItems[pos - 1]
self.parent.menuServiceItem = serviceItem
if serviceItem[u'service_item'].is_text():
self.parent.themeMenu.menuAction().setVisible(True)
else:
@ -68,11 +67,22 @@ class ServiceManagerList(QtGui.QTreeWidget):
else:
self.parent.editAction.setVisible(False)
event.accept()
elif event.button() == QtCore.Qt.LeftButton:
if parentitem is None:
if self.isItemExpanded(item):
self.collapseItem(item)
else:
event.ignore()
self.expandItem(item)
else:
event.accept()
else:
event.accept()
def mouseDoubleClickEvent(self, event):
self.parent.makeLive()
event.accept()
def keyPressEvent(self, event):
print event.isAutoRepeat()
if type(event) == QtGui.QKeyEvent:
#here accept the event and do something
if event.key() == QtCore.Qt.Key_Enter:
@ -256,10 +266,11 @@ class ServiceManager(QtGui.QWidget):
self.presentation_types = presentation_types
def onServiceItemNoteForm(self):
item, count = self.findServiceItem()
self.serviceItemNoteForm.textEdit.setPlainText(
self.menuServiceItem[u'service_item'].notes)
self.serviceItems[item][u'service_item'].notes)
if self.serviceItemNoteForm.exec_():
self.menuServiceItem[u'service_item'].notes = \
self.serviceItems[item][u'service_item'].notes = \
self.serviceItemNoteForm.textEdit.toPlainText()
def nextItem(self):
@ -650,7 +661,6 @@ class ServiceManager(QtGui.QWidget):
"""
Send the current item to the Live slide controller
"""
print "ml"
item, count = self.findServiceItem()
self.parent.LiveController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], count)