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.
HTMLSRC = u"""
<!DOCTYPE html>
<html>
<head>
<title>OpenLP Display</title>
@ -283,7 +282,7 @@ def build_html(item, screen, alert, islive, background, plugins=None, \
if plugins:
for plugin in plugins:
css_additions += plugin.getDisplayCss()
js_additions += plugin.getDisplayJavascript()
js_additions += plugin.getDisplayJavaScript()
html_additions += plugin.getDisplayHtml()
html = HTMLSRC % (build_background_css(item, width, height),
width, height,

View File

@ -168,7 +168,7 @@ class Plugin(QtCore.QObject):
self.mediadock = plugin_helpers[u'toolbox']
self.pluginManager = plugin_helpers[u'pluginmanager']
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.SIGNAL(u'%s_add_service_item' % self.name),
self.processAddServiceEvent)
@ -376,7 +376,7 @@ class Plugin(QtCore.QObject):
"""
return u''
def getDisplayJavascript(self):
def getDisplayJavaScript(self):
"""
Add javascript functions to htmlbuilder
"""

View File

@ -67,7 +67,6 @@ class Display(QtGui.QGraphicsView):
self.width(), self.height())
self.webView.settings().setAttribute(
QtWebKit.QWebSettings.PluginsEnabled, True)
self.webView.settings().setAttribute(7, True)
self.page = self.webView.page()
self.frame = self.page.mainFrame()
self.frame.setScrollBarPolicy(QtCore.Qt.Vertical,
@ -130,7 +129,6 @@ class MainDisplay(Display):
self.screen[u'size'].width(), self.screen[u'size'].height())
self.webView.settings().setAttribute( \
QtWebKit.QWebSettings.PluginsEnabled, True)
self.webView.settings().setAttribute(7, True)
self.page = self.webView.page()
self.frame = self.page.mainFrame()
QtCore.QObject.connect(self.webView,
@ -209,7 +207,7 @@ class MainDisplay(Display):
"""
log.debug(u'alert to display')
if self.height() != self.screen[u'size'].height() \
or not self.isVisible():# or self.videoWidget.isVisible():
or not self.isVisible():
shrink = True
else:
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, \
ThemeManager, SlideController, PluginForm, MediaDockManager, \
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, \
get_application_version, delete_file
from openlp.core.utils.actions import ActionList, CategoryOrder
@ -148,7 +148,7 @@ class Ui_MainWindow(object):
self.defaultThemeLabel = QtGui.QLabel(self.statusBar)
self.defaultThemeLabel.setObjectName(u'defaultThemeLabel')
self.statusBar.addPermanentWidget(self.defaultThemeLabel)
# Create the MediaManager
# Create the MediaController
self.mediaManagerDock = OpenLPDockWidget(mainWindow,
u'mediaManagerDock', u':/system/system_mediamanager.png')
self.mediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE)
@ -557,7 +557,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.pluginManager = PluginManager(pluginpath)
self.pluginHelpers = {}
self.imageManager = ImageManager()
self.mediaManager = MediaManager(self)
self.mediaManager = MediaController(self)
# Set up the interface
self.setupUi(self)
# 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'pluginmanager'] = self.pluginManager
self.pluginHelpers[u'formparent'] = self
self.pluginHelpers[u'mediamanager'] = self.mediaManager
self.pluginHelpers[u'mediacontroller'] = self.mediaManager
self.pluginManager.find_plugins(pluginpath, self.pluginHelpers)
# hook methods have to happen after find_plugins. Find plugins needs
# the controllers hence the hooks have moved from setupUI() to here

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -67,7 +67,7 @@ class Controller(QtGui.QWidget):
created from within other plugins
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
Receiver.send_message('%s' % sender, [controller, args])

View File

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

View File

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