Fix bug in bibles with invalid method name

Add Image Tab to get loop delay
Fix loss of Bible Icons
Add Loop delay to ImageController
Get Controllers to swap correctly
This commit is contained in:
Tim Bentley 2009-07-03 21:32:33 +01:00
parent f586d9bf5e
commit 1110713529
7 changed files with 35 additions and 12 deletions

View File

@ -144,8 +144,10 @@ class SlideController(QtGui.QWidget):
self.toolbarList[handle.lower()] = controller
def retrieveToolbar(self, handle):
print handle
print self.toolbarList
"""
Find the toolbar and return master if none present
Add extra information back into toolbar class
"""
try:
toolbar = self.toolbarList[handle.lower()]
except:
@ -153,7 +155,6 @@ class SlideController(QtGui.QWidget):
toolbar.PreviewListWidget = self.PreviewListWidget
toolbar.SlidePreview = self.SlidePreview
toolbar.mainDisplay = self.parent.mainDisplay
print toolbar
return toolbar
def addServiceItem(self, item):
@ -162,6 +163,8 @@ class SlideController(QtGui.QWidget):
"""
self.BaseToolbar = self.retrieveToolbar(item.shortname)
self.ControllerLayout.removeWidget(self.Toolbar)
#remove the old toolbar
self.Toolbar.clear()
self.Toolbar = self.BaseToolbar.getToolbar()
self.ControllerLayout.addWidget(self.Toolbar)
self.BaseToolbar.addServiceItem(item)
@ -170,6 +173,12 @@ class SlideController(QtGui.QWidget):
"""
helper method to pass item to correct toolbar
"""
self.BaseToolbar = self.retrieveToolbar(item.shortname)
self.ControllerLayout.removeWidget(self.Toolbar)
#remove the old toolbar
self.Toolbar.clear()
self.Toolbar = self.BaseToolbar.getToolbar()
self.ControllerLayout.addWidget(self.Toolbar)
self.BaseToolbar.addServiceManagerItem(item, slideno)
class MasterToolbar(QtCore.QObject):
@ -181,9 +190,11 @@ class MasterToolbar(QtCore.QObject):
QtCore.QObject.__init__(self)
self.PreviewListWidget = QtGui.QListWidget()
self.isLive = isLive
self.defineToolbar()
def getToolbar(self):
#define toolbar here as it needs to be redefined each time
#as the clear destroys it.
self.defineToolbar()
return self.Toolbar
def defineToolbar(self):

View File

@ -37,7 +37,7 @@ class BiblePlugin(Plugin):
self.weight = -9
# Create the plugin icon
self.icon = QtGui.QIcon()
self.icon.addPixmap(QtGui.QPixmap(u':/media/media_verse.png'),
self.icon.addPixmap(QtGui.QPixmap(u':/media/media_bible.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
#Register the bible Manager
self.biblemanager = BibleManager(self.config)

View File

@ -245,7 +245,7 @@ class BibleManager():
log.debug(u'get_verse_text : new book')
for chapter in range(schapter, echapter+1):
search_results = self.bible_http_cache [bible].get_bible_chapter(bible, 0, bookname, chapter)
if search_results.has_verse_list() :
if search_results.has_verselist() :
## We have found a book of the bible lets check to see if it was there.
## By reusing the returned book name we get a correct book.
## For example it is possible to request ac and get Acts back.

View File

@ -22,7 +22,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, Event, EventType
from openlp.plugins.images.lib import ImageMediaItem
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
class ImagePlugin(Plugin):
global log
@ -40,6 +40,10 @@ class ImagePlugin(Plugin):
# passed with drag and drop messages
self.dnd_id = u'Image'
def get_settings_tab(self):
self.ImageTab = ImageTab()
return self.ImageTab
def get_media_manager_item(self):
# Create the MediaManagerItem object
self.media_item = ImageMediaItem(self, self.icon, u'Images')

View File

@ -19,3 +19,4 @@ Place, Suite 330, Boston, MA 02111-1307 USA
"""
from mediaitem import ImageMediaItem
from imageslidecontroller import ImageToolbar
from imagetab import ImageTab

View File

@ -26,8 +26,9 @@ from openlp.core.ui.slidecontroller import MasterToolbar
class ImageToolbar(MasterToolbar):
def __init__(self, isLive):
def __init__(self, parent, isLive):
MasterToolbar.__init__(self, isLive)
self.parent = parent
self.Toolbar = None
self.isLive = isLive
self.defineToolbar()
@ -71,7 +72,7 @@ class ImageToolbar(MasterToolbar):
self.onStartLoop)
self.Toolbar.addToolbarButton(u'Stop Loop',
u':/media/media_stop.png',
translate(u'SlideController', u'Start continuous loop'),
translate(u'SlideController', u'Stop continuous loop'),
self.onStopLoop)
self.Toolbar.setSizePolicy(sizeToolbarPolicy)
@ -79,10 +80,16 @@ class ImageToolbar(MasterToolbar):
"""
Go to the last slide.
"""
print "onStartLoop"
delay = self.parent.parent.ImageTab.loop_delay
self.timer_id = self.startTimer(delay * 1000)
def onStopLoop(self):
"""
Go to the last slide.
"""
print "onStopLoop"
self.killTimer(self.timer_id)
def timerEvent(self, event):
if event.timerId() == self.timer_id:
self.onSlideSelectedNext()

View File

@ -55,7 +55,7 @@ class ImageMediaItem(MediaManagerItem):
self.ListViewWithDnD_class = ImageListView
MediaManagerItem.__init__(self, parent, icon, title)
#create and install our own slide controller toolbar
imageToolbar = ImageToolbar(True)
imageToolbar = ImageToolbar(self, True)
parent.live_controller.registerToolbar(self.ConfigSection, imageToolbar)
def initialise(self):