Page Up / Down work on Slide Controller

Remove print statements
This commit is contained in:
Tim Bentley 2009-06-21 17:26:33 +01:00
parent a5d3daa392
commit c0df49e551
2 changed files with 37 additions and 7 deletions

View File

@ -29,6 +29,7 @@ from xml.etree.ElementTree import ElementTree, XML, dump
</song> </song>
""" """
import logging
from xml.dom.minidom import Document from xml.dom.minidom import Document
from xml.etree.ElementTree import ElementTree, XML, dump from xml.etree.ElementTree import ElementTree, XML, dump
@ -70,11 +71,20 @@ class SongXMLBuilder():
def extract_xml(self): def extract_xml(self):
# Print our newly created XML # Print our newly created XML
return self.song_xml.toxml() return self.song_xml.toxml(u'utf-8')
class SongXMLParser(): class SongXMLParser():
global log
log = logging.getLogger(u'SongXMLParser')
log.info(u'SongXMLParser Loaded')
def __init__(self, xml): def __init__(self, xml):
self.song_xml = ElementTree(element=XML(xml)) #print xml
try:
self.song_xml = ElementTree(element=XML(xml))
except:
#print "invalid xml ", xml
log.debug(u'invalid xml %s', xml)
def get_verses(self): def get_verses(self):
#return a list of verse's and attributes #return a list of verse's and attributes

View File

@ -21,14 +21,11 @@ import logging
import os import os
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, translate from openlp.core.lib import OpenLPToolbar, translate
class SlideData(QtCore.QAbstractListModel): class SlideData(QtCore.QAbstractListModel):
""" """
Tree of items for an order of Theme. List of frames to be displayed on the list and the main display.
Includes methods for reading and writing the contents to an OOS file
Root contains a list of ThemeItems
""" """
global log global log
log = logging.getLogger(u'SlideData') log = logging.getLogger(u'SlideData')
@ -98,6 +95,24 @@ class SlideData(QtCore.QAbstractListModel):
filelist = [item[3] for item in self.items]; filelist = [item[3] for item in self.items];
return filelist return filelist
class SlideList(QtGui.QListView):
def __init__(self,parent=None,name=None):
QtGui.QListView.__init__(self,parent.Controller)
self.parent = parent
def keyPressEvent(self, event):
if type(event) == QtGui.QKeyEvent:
#here accept the event and do something
if event.key() == QtCore.Qt.Key_PageUp:
self.parent.onSlideSelectedPrevious()
event.accept()
elif event.key() == QtCore.Qt.Key_PageDown:
self.parent.onSlideSelectedNext()
event.accept()
event.ignore()
else:
event.ignore()
class SlideController(QtGui.QWidget): class SlideController(QtGui.QWidget):
""" """
@ -132,7 +147,7 @@ class SlideController(QtGui.QWidget):
self.ControllerLayout.setSpacing(0) self.ControllerLayout.setSpacing(0)
self.ControllerLayout.setMargin(0) self.ControllerLayout.setMargin(0)
# Controller list view # Controller list view
self.PreviewListView = QtGui.QListView(self.Controller) self.PreviewListView = SlideList(self)
self.PreviewListView.setUniformItemSizes(True) self.PreviewListView.setUniformItemSizes(True)
self.PreviewListView.setIconSize(QtCore.QSize(250, 190)) self.PreviewListView.setIconSize(QtCore.QSize(250, 190))
self.PreviewListData = SlideData() self.PreviewListData = SlideData()
@ -210,6 +225,11 @@ class SlideController(QtGui.QWidget):
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected) QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
QtCore.QObject.connect(self.PreviewListView, QtCore.QObject.connect(self.PreviewListView,
QtCore.SIGNAL(u'activated(QModelIndex)'), self.onSlideSelected) QtCore.SIGNAL(u'activated(QModelIndex)'), self.onSlideSelected)
QtCore.QObject.connect(self.PreviewListView,
QtCore.SIGNAL(u'entered(QModelIndex)'), self.onTest)
def onTest(self , item):
print "found", item
def onSlideSelectedFirst(self): def onSlideSelectedFirst(self):
""" """