review changes

This commit is contained in:
rimach 2011-08-29 23:52:26 +02:00
commit 169f8a2942
12 changed files with 23 additions and 26 deletions

View File

@ -36,7 +36,6 @@ log = logging.getLogger(__name__)
# FIXME: Add html5 doctype. However, do not break theme gradients. # FIXME: Add html5 doctype. However, do not break theme gradients.
HTMLSRC = u""" HTMLSRC = u"""
<!DOCTYPE html>
<html> <html>
<head> <head>
<title>OpenLP Display</title> <title>OpenLP Display</title>
@ -283,7 +282,7 @@ def build_html(item, screen, alert, islive, background, plugins=None, \
if plugins: if plugins:
for plugin in plugins: for plugin in plugins:
css_additions += plugin.getDisplayCss() css_additions += plugin.getDisplayCss()
js_additions += plugin.getDisplayJavascript() js_additions += plugin.getDisplayJavaScript()
html_additions += plugin.getDisplayHtml() html_additions += plugin.getDisplayHtml()
html = HTMLSRC % (build_background_css(item, width, height), html = HTMLSRC % (build_background_css(item, width, height),
width, height, width, height,

View File

@ -168,7 +168,7 @@ class Plugin(QtCore.QObject):
self.mediadock = plugin_helpers[u'toolbox'] self.mediadock = plugin_helpers[u'toolbox']
self.pluginManager = plugin_helpers[u'pluginmanager'] self.pluginManager = plugin_helpers[u'pluginmanager']
self.formparent = plugin_helpers[u'formparent'] self.formparent = plugin_helpers[u'formparent']
self.mediaManager = plugin_helpers[u'mediamanager'] self.mediaManager = plugin_helpers[u'mediacontroller']
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'%s_add_service_item' % self.name), QtCore.SIGNAL(u'%s_add_service_item' % self.name),
self.processAddServiceEvent) self.processAddServiceEvent)
@ -376,7 +376,7 @@ class Plugin(QtCore.QObject):
""" """
return u'' return u''
def getDisplayJavascript(self): def getDisplayJavaScript(self):
""" """
Add javascript functions to htmlbuilder Add javascript functions to htmlbuilder
""" """

View File

@ -67,7 +67,6 @@ class Display(QtGui.QGraphicsView):
self.width(), self.height()) self.width(), self.height())
self.webView.settings().setAttribute( self.webView.settings().setAttribute(
QtWebKit.QWebSettings.PluginsEnabled, True) QtWebKit.QWebSettings.PluginsEnabled, True)
self.webView.settings().setAttribute(7, True)
self.page = self.webView.page() self.page = self.webView.page()
self.frame = self.page.mainFrame() self.frame = self.page.mainFrame()
self.frame.setScrollBarPolicy(QtCore.Qt.Vertical, self.frame.setScrollBarPolicy(QtCore.Qt.Vertical,
@ -130,7 +129,6 @@ class MainDisplay(Display):
self.screen[u'size'].width(), self.screen[u'size'].height()) self.screen[u'size'].width(), self.screen[u'size'].height())
self.webView.settings().setAttribute( \ self.webView.settings().setAttribute( \
QtWebKit.QWebSettings.PluginsEnabled, True) QtWebKit.QWebSettings.PluginsEnabled, True)
self.webView.settings().setAttribute(7, True)
self.page = self.webView.page() self.page = self.webView.page()
self.frame = self.page.mainFrame() self.frame = self.page.mainFrame()
QtCore.QObject.connect(self.webView, QtCore.QObject.connect(self.webView,
@ -209,7 +207,7 @@ class MainDisplay(Display):
""" """
log.debug(u'alert to display') log.debug(u'alert to display')
if self.height() != self.screen[u'size'].height() \ if self.height() != self.screen[u'size'].height() \
or not self.isVisible():# or self.videoWidget.isVisible(): or not self.isVisible():
shrink = True shrink = True
else: else:
shrink = False shrink = False

View File

@ -42,7 +42,7 @@ from openlp.core.lib.ui import UiStrings, base_action, checkable_action, \
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \ from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \
ThemeManager, SlideController, PluginForm, MediaDockManager, \ ThemeManager, SlideController, PluginForm, MediaDockManager, \
ShortcutListForm, FormattingTagForm ShortcutListForm, FormattingTagForm
from openlp.core.ui.media import MediaManager from openlp.core.ui.media import MediaController
from openlp.core.utils import AppLocation, add_actions, LanguageManager, \ from openlp.core.utils import AppLocation, add_actions, LanguageManager, \
get_application_version, delete_file get_application_version, delete_file
from openlp.core.utils.actions import ActionList, CategoryOrder from openlp.core.utils.actions import ActionList, CategoryOrder
@ -148,7 +148,7 @@ class Ui_MainWindow(object):
self.defaultThemeLabel = QtGui.QLabel(self.statusBar) self.defaultThemeLabel = QtGui.QLabel(self.statusBar)
self.defaultThemeLabel.setObjectName(u'defaultThemeLabel') self.defaultThemeLabel.setObjectName(u'defaultThemeLabel')
self.statusBar.addPermanentWidget(self.defaultThemeLabel) self.statusBar.addPermanentWidget(self.defaultThemeLabel)
# Create the MediaManager # Create the MediaController
self.mediaManagerDock = OpenLPDockWidget(mainWindow, self.mediaManagerDock = OpenLPDockWidget(mainWindow,
u'mediaManagerDock', u':/system/system_mediamanager.png') u'mediaManagerDock', u':/system/system_mediamanager.png')
self.mediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE) self.mediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE)
@ -557,7 +557,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.pluginManager = PluginManager(pluginpath) self.pluginManager = PluginManager(pluginpath)
self.pluginHelpers = {} self.pluginHelpers = {}
self.imageManager = ImageManager() self.imageManager = ImageManager()
self.mediaManager = MediaManager(self) self.mediaManager = MediaController(self)
# Set up the interface # Set up the interface
self.setupUi(self) self.setupUi(self)
# Load settings after setupUi so default UI sizes are overwritten # Load settings after setupUi so default UI sizes are overwritten
@ -646,7 +646,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.pluginHelpers[u'toolbox'] = self.mediaDockManager self.pluginHelpers[u'toolbox'] = self.mediaDockManager
self.pluginHelpers[u'pluginmanager'] = self.pluginManager self.pluginHelpers[u'pluginmanager'] = self.pluginManager
self.pluginHelpers[u'formparent'] = self self.pluginHelpers[u'formparent'] = self
self.pluginHelpers[u'mediamanager'] = self.mediaManager self.pluginHelpers[u'mediacontroller'] = self.mediaManager
self.pluginManager.find_plugins(pluginpath, self.pluginHelpers) self.pluginManager.find_plugins(pluginpath, self.pluginHelpers)
# hook methods have to happen after find_plugins. Find plugins needs # hook methods have to happen after find_plugins. Find plugins needs
# the controllers hence the hooks have moved from setupUI() to here # the controllers hence the hooks have moved from setupUI() to here

View File

@ -42,8 +42,8 @@ class MediaType(object):
Unused = 0 Unused = 0
Audio = 1 Audio = 1
Video = 2 Video = 2
Cd = 3 CD = 3
Dvd = 4 DVD = 4
Folder = 5 Folder = 5
class MediaInfo(object): class MediaInfo(object):
@ -59,5 +59,5 @@ class MediaInfo(object):
end_time = 0 end_time = 0
media_type = MediaType() media_type = MediaType()
from mediaapi import MediaAPI from media_api import MediaAPI
from mediamanager import MediaManager from mediacontroller import MediaController

View File

@ -29,9 +29,10 @@ from openlp.core.ui.media import MediaState
class MediaAPI(object): class MediaAPI(object):
""" """
Specialiced Media API class A generic media API class to provide OpenLP
to reflect Features of the related API with a pluggable media display framework.
""" """
def __init__(self, parent, name=u'MediaApi'): def __init__(self, parent, name=u'MediaApi'):
self.parent = parent self.parent = parent
self.name = name self.name = name

View File

@ -37,7 +37,7 @@ from openlp.core.utils import AppLocation
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class MediaManager(object): class MediaController(object):
""" """
The implementation of a Media Manager The implementation of a Media Manager
The idea is to separate the media related implementation The idea is to separate the media related implementation
@ -105,7 +105,7 @@ class MediaManager(object):
u'core', u'ui', u'media') u'core', u'ui', u'media')
for filename in os.listdir(controller_dir): for filename in os.listdir(controller_dir):
if filename.endswith(u'api.py') and \ if filename.endswith(u'api.py') and \
not filename == 'mediaapi.py': not filename == 'media_api.py':
path = os.path.join(controller_dir, filename) path = os.path.join(controller_dir, filename)
if os.path.isfile(path): if os.path.isfile(path):
modulename = u'openlp.core.ui.media.' + \ modulename = u'openlp.core.ui.media.' + \

View File

@ -39,8 +39,8 @@ log = logging.getLogger(__name__)
class PhononAPI(MediaAPI): class PhononAPI(MediaAPI):
""" """
Specialiced MediaAPI class A specialised version of the MediaAPI class,
to reflect Features of the Phonon API which provides a Phonon display.
""" """
def __init__(self, parent): def __init__(self, parent):

View File

@ -36,8 +36,8 @@ log = logging.getLogger(__name__)
class WebkitAPI(MediaAPI): class WebkitAPI(MediaAPI):
""" """
Specialiced MediaAPI class A specialised version of the MediaAPI class,
to reflect Features of the QtWebkit API which provides a QtWebKit display.
""" """
def __init__(self, parent): def __init__(self, parent):

View File

@ -67,7 +67,7 @@ class Controller(QtGui.QWidget):
created from within other plugins created from within other plugins
This function is needed to catch the current controller This function is needed to catch the current controller
""" """
sender = self.sender().objectName() or self.sender().text() sender = self.sender().objectName() if self.sender().objectName() else self.sender().text()
controller = self controller = self
Receiver.send_message('%s' % sender, [controller, args]) Receiver.send_message('%s' % sender, [controller, args])

View File

@ -126,7 +126,6 @@ class MediaMediaItem(MediaManagerItem):
item = self.listView.currentItem() item = self.listView.currentItem()
filename = unicode(item.data(QtCore.Qt.UserRole).toString()) filename = unicode(item.data(QtCore.Qt.UserRole).toString())
if os.path.exists(filename): if os.path.exists(filename):
#(path, name) = os.path.split(filename)
if self.plugin.liveController.mediaManager.video( \ if self.plugin.liveController.mediaManager.video( \
self.plugin.liveController, filename, True, True): self.plugin.liveController, filename, True, True):
self.resetAction.setVisible(True) self.resetAction.setVisible(True)

View File

@ -107,7 +107,7 @@ class MediaPlugin(Plugin):
""" """
return self.mediaManager.get_media_display_css() return self.mediaManager.get_media_display_css()
def getDisplayJavascript(self): def getDisplayJavaScript(self):
""" """
Add javascript functions to htmlbuilder Add javascript functions to htmlbuilder
""" """