Merged HEAD from trunk and fixed a conflict.

Some more refactoring.
This commit is contained in:
Raoul Snyman 2012-04-22 21:37:11 +02:00
commit 070ed7fcb5
47 changed files with 18067 additions and 15040 deletions

View File

@ -258,7 +258,7 @@ class Plugin(QtCore.QObject):
if self.settingsTabClass:
self.settingsTab = self.settingsTabClass(parent, self.name,
self.getString(StringContent.VisibleName)[u'title'],
self.icon_path)
self.iconPath)
def addToMenu(self, menubar):
"""

View File

@ -364,7 +364,7 @@ class Renderer(object):
self.web.setVisible(False)
self.web.resize(self.page_width, self.page_height)
self.web_frame = self.web.page().mainFrame()
# Adjust width and height to account for shadow. outline done in css
# Adjust width and height to account for shadow. outline done in css.
html = u"""<!DOCTYPE html><html><head><script>
function show_text(newtext) {
var main = document.getElementById('main');

View File

@ -104,7 +104,7 @@ class SettingsManager(object):
u'%s count' % name, QtCore.QVariant(0)).toInt()[0]
new_count = len(list)
settings.setValue(u'%s count' % name, QtCore.QVariant(new_count))
for counter in range (0, new_count):
for counter in range(new_count):
settings.setValue(
u'%s %d' % (name, counter), QtCore.QVariant(list[counter-1]))
if old_count > new_count:
@ -130,7 +130,7 @@ class SettingsManager(object):
u'%s count' % name, QtCore.QVariant(0)).toInt()[0]
list = []
if list_count:
for counter in range(0, list_count):
for counter in range(list_count):
item = unicode(
settings.value(u'%s %d' % (name, counter)).toString())
if item:

View File

@ -47,7 +47,7 @@ class SettingsTab(QtGui.QWidget):
self.tabTitleVisible = visible_title
self.settingsSection = self.tabTitle.lower()
if icon_path:
self.icon_path = icon_path
self.iconPath = icon_path
self.setupUi()
self.retranslateUi()
self.initialise()

View File

@ -59,7 +59,7 @@ class AdvancedTab(SettingsTab):
'#strftime-strptime-behavior for more information.'))
self.defaultImage = u':/graphics/openlp-splash-screen.png'
self.defaultColor = u'#ffffff'
self.icon_path = u':/system/system_settings.png'
self.iconPath = u':/system/system_settings.png'
advanced_translated = translate('OpenLP.AdvancedTab', 'Advanced')
SettingsTab.__init__(self, parent, u'Advanced', advanced_translated)

View File

@ -43,7 +43,7 @@ class GeneralTab(SettingsTab):
Initialise the general settings tab
"""
self.screens = ScreenList.get_instance()
self.icon_path = u':/icon/openlp-logo-16x16.png'
self.iconPath = u':/icon/openlp-logo-16x16.png'
generalTranslated = translate('OpenLP.GeneralTab', 'General')
SettingsTab.__init__(self, parent, u'General', generalTranslated)

View File

@ -554,9 +554,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# (not for use by plugins)
self.uiSettingsSection = u'user interface'
self.generalSettingsSection = u'general'
self.advancedlSettingsSection = u'advanced'
self.advancedSettingsSection = u'advanced'
self.shortcutsSettingsSection = u'shortcuts'
self.servicemanagerSettingsSection = u'servicemanager'
self.serviceManagerSettingsSection = u'servicemanager'
self.songsSettingsSection = u'songs'
self.themesSettingsSection = u'themes'
self.displayTagsSection = u'displayTags'
@ -568,8 +568,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.shortcutForm = ShortcutListForm(self)
self.recentFiles = QtCore.QStringList()
# Set up the path with plugins
pluginpath = AppLocation.get_directory(AppLocation.PluginsDir)
self.pluginManager = PluginManager(pluginpath)
plugin_path = AppLocation.get_directory(AppLocation.PluginsDir)
self.pluginManager = PluginManager(plugin_path)
self.pluginHelpers = {}
self.imageManager = ImageManager()
self.mediaController = MediaController(self)
@ -661,7 +661,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.pluginHelpers[u'pluginmanager'] = self.pluginManager
self.pluginHelpers[u'formparent'] = self
self.pluginHelpers[u'mediacontroller'] = self.mediaController
self.pluginManager.find_plugins(pluginpath, self.pluginHelpers)
self.pluginManager.find_plugins(plugin_path, self.pluginHelpers)
# hook methods have to happen after find_plugins. Find plugins needs
# the controllers hence the hooks have moved from setupUI() to here
# Find and insert settings tabs
@ -944,10 +944,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
setting_sections = []
# Add main sections.
setting_sections.extend([self.generalSettingsSection])
setting_sections.extend([self.advancedlSettingsSection])
setting_sections.extend([self.advancedSettingsSection])
setting_sections.extend([self.uiSettingsSection])
setting_sections.extend([self.shortcutsSettingsSection])
setting_sections.extend([self.servicemanagerSettingsSection])
setting_sections.extend([self.serviceManagerSettingsSection])
setting_sections.extend([self.themesSettingsSection])
setting_sections.extend([self.displayTagsSection])
setting_sections.extend([self.headerSection])
@ -1027,10 +1027,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
setting_sections = []
# Add main sections.
setting_sections.extend([self.generalSettingsSection])
setting_sections.extend([self.advancedlSettingsSection])
setting_sections.extend([self.advancedSettingsSection])
setting_sections.extend([self.uiSettingsSection])
setting_sections.extend([self.shortcutsSettingsSection])
setting_sections.extend([self.servicemanagerSettingsSection])
setting_sections.extend([self.serviceManagerSettingsSection])
setting_sections.extend([self.themesSettingsSection])
setting_sections.extend([self.displayTagsSection])
# Add plugin sections.
@ -1314,10 +1314,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
u'/enable slide loop'):
if QtCore.QSettings().value(self.generalSettingsSection +
u'/enable slide loop', QtCore.QVariant(True)).toBool():
QtCore.QSettings().setValue(self.advancedlSettingsSection +
QtCore.QSettings().setValue(self.advancedSettingsSection +
u'/slide limits', QtCore.QVariant(SlideLimits.Wrap))
else:
QtCore.QSettings().setValue(self.advancedlSettingsSection +
QtCore.QSettings().setValue(self.advancedSettingsSection +
u'/slide limits', QtCore.QVariant(SlideLimits.End))
QtCore.QSettings().remove(self.generalSettingsSection +
u'/enable slide loop')

View File

@ -648,8 +648,8 @@ class SlideController(Controller):
def onSongBarHandler(self):
request = unicode(self.sender().text())
slideno = self.slideList[request]
self.__updatePreviewSelection(slideno)
slide_no = self.slideList[request]
self.__updatePreviewSelection(slide_no)
self.slideSelected()
def receiveSpinDelay(self, value):
@ -663,7 +663,7 @@ class SlideController(Controller):
Updates the Slide Limits variable from the settings.
"""
self.slide_limits = QtCore.QSettings().value(
self.parent().advancedlSettingsSection + u'/slide limits',
self.parent().advancedSettingsSection + u'/slide limits',
QtCore.QVariant(SlideLimits.End)).toInt()[0]
def enableToolBar(self, item):

View File

@ -39,7 +39,7 @@ class ThemesTab(SettingsTab):
self.mainwindow = mainwindow
generalTranslated = translate('OpenLP.ThemesTab', 'Themes')
SettingsTab.__init__(self, parent, u'Themes', generalTranslated)
self.icon_path = u':/themes/theme_new.png'
self.iconPath = u':/themes/theme_new.png'
def setupUi(self):
self.setObjectName(u'ThemesTab')

View File

@ -117,8 +117,8 @@ class AlertsPlugin(Plugin):
Plugin.__init__(self, u'alerts', plugin_helpers,
settings_tab_class=AlertsTab)
self.weight = -3
self.icon_path = u':/plugins/plugin_alerts.png'
self.icon = build_icon(self.icon_path)
self.iconPath = u':/plugins/plugin_alerts.png'
self.icon = build_icon(self.iconPath)
self.alertsmanager = AlertsManager(self)
self.manager = Manager(u'alerts', init_schema)
self.alertForm = AlertForm(self)

View File

@ -44,8 +44,8 @@ class BiblePlugin(Plugin):
Plugin.__init__(self, u'bibles', plugin_helpers,
BibleMediaItem, BiblesTab)
self.weight = -9
self.icon_path = u':/plugins/plugin_bibles.png'
self.icon = build_icon(self.icon_path)
self.iconPath = u':/plugins/plugin_bibles.png'
self.icon = build_icon(self.iconPath)
self.manager = None
def initialise(self):
@ -152,11 +152,10 @@ class BiblePlugin(Plugin):
def usesTheme(self, theme):
"""
Called to find out if the bible plugin is currently using a theme.
Returns True if the theme is being used, otherwise returns False.
Returns ``True`` if the theme is being used, otherwise returns
``False``.
"""
if unicode(self.settingsTab.bible_theme) == theme:
return True
return False
return unicode(self.settingsTab.bible_theme) == theme
def renameTheme(self, oldTheme, newTheme):
"""

View File

@ -50,8 +50,8 @@ class CustomPlugin(Plugin):
CustomMediaItem, CustomTab)
self.weight = -5
self.manager = Manager(u'custom', init_schema)
self.icon_path = u':/plugins/plugin_custom.png'
self.icon = build_icon(self.icon_path)
self.iconPath = u':/plugins/plugin_custom.png'
self.icon = build_icon(self.iconPath)
def about(self):
about_text = translate('CustomPlugin', '<strong>Custom Slide Plugin'

View File

@ -42,8 +42,8 @@ class ImagePlugin(Plugin):
Plugin.__init__(self, u'images', plugin_helpers, ImageMediaItem,
ImageTab)
self.weight = -7
self.icon_path = u':/plugins/plugin_images.png'
self.icon = build_icon(self.icon_path)
self.iconPath = u':/plugins/plugin_images.png'
self.icon = build_icon(self.iconPath)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'image_updated'), self.image_updated)

View File

@ -41,8 +41,8 @@ class MediaPlugin(Plugin):
Plugin.__init__(self, u'media', plugin_helpers,
MediaMediaItem)
self.weight = -6
self.icon_path = u':/plugins/plugin_media.png'
self.icon = build_icon(self.icon_path)
self.iconPath = u':/plugins/plugin_media.png'
self.icon = build_icon(self.iconPath)
# passed with drag and drop messages
self.dnd_id = u'Media'
self.audio_extensions_list = \
@ -60,7 +60,7 @@ class MediaPlugin(Plugin):
"""
visible_name = self.getString(StringContent.VisibleName)
self.settingsTab = MediaTab(parent, self.name, visible_name[u'title'],
self.mediaController.mediaPlayers, self.icon_path)
self.mediaController.mediaPlayers, self.iconPath)
def about(self):
about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>'

View File

@ -339,7 +339,6 @@ class ImpressDocument(PresentationDocument):
Returns true if a presentation is loaded
"""
log.debug(u'is loaded OpenOffice')
#print "is_loaded "
if self.presentation is None or self.document is None:
log.debug("is_loaded: no presentation or document")
return False
@ -357,14 +356,9 @@ class ImpressDocument(PresentationDocument):
Returns true if a presentation is active and running
"""
log.debug(u'is active OpenOffice')
#print "is_active "
if not self.is_loaded():
#print "False "
return False
#print "self.con ", self.control
if self.control is None:
return False
return True
return self.control is not None
def unblank_screen(self):
"""

View File

@ -263,50 +263,49 @@ class PresentationMediaItem(MediaManagerItem):
service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay)
service_item.add_capability(ItemCapabilities.HasDetailedTitleDisplay)
shortname = service_item.shortname
if shortname:
for bitem in items:
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
if os.path.exists(filename):
if shortname == self.Automatic:
service_item.shortname = \
self.findControllerByType(filename)
if not service_item.shortname:
return False
controller = self.controllers[service_item.shortname]
(path, name) = os.path.split(filename)
doc = controller.add_document(filename)
if doc.get_thumbnail_path(1, True) is None:
doc.load_presentation()
i = 1
img = doc.get_thumbnail_path(i, True)
if img:
while img:
service_item.add_from_command(path, name, img)
i = i + 1
img = doc.get_thumbnail_path(i, True)
doc.close_presentation()
return True
else:
# File is no longer present
if not remote:
critical_error_message_box(
translate('PresentationPlugin.MediaItem',
'Missing Presentation'),
unicode(translate(
'PresentationPlugin.MediaItem',
'The Presentation %s is incomplete,'
' please reload.')) % filename)
if not shortname:
return False
for bitem in items:
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
if os.path.exists(filename):
if shortname == self.Automatic:
service_item.shortname = self.findControllerByType(filename)
if not service_item.shortname:
return False
controller = self.controllers[service_item.shortname]
(path, name) = os.path.split(filename)
doc = controller.add_document(filename)
if doc.get_thumbnail_path(1, True) is None:
doc.load_presentation()
i = 1
img = doc.get_thumbnail_path(i, True)
if img:
while img:
service_item.add_from_command(path, name, img)
i = i + 1
img = doc.get_thumbnail_path(i, True)
doc.close_presentation()
return True
else:
# File is no longer present
if not remote:
critical_error_message_box(
translate('PresentationPlugin.MediaItem',
'Missing Presentation'),
unicode(translate(
'PresentationPlugin.MediaItem',
'The presentation %s is incomplete,'
' please reload.')) % filename)
return False
else:
# File is no longer present
if not remote:
critical_error_message_box(
translate('PresentationPlugin.MediaItem',
'Missing Presentation'),
unicode(translate('PresentationPlugin.MediaItem',
'The Presentation %s no longer exists.')) % filename)
return False
else:
return False
'The presentation %s no longer exists.')) % filename)
return False
def findControllerByType(self, filename):
"""

View File

@ -54,8 +54,8 @@ class PresentationPlugin(Plugin):
self.controllers = {}
Plugin.__init__(self, u'presentations', plugin_helpers)
self.weight = -8
self.icon_path = u':/plugins/plugin_presentations.png'
self.icon = build_icon(self.icon_path)
self.iconPath = u':/plugins/plugin_presentations.png'
self.icon = build_icon(self.iconPath)
def createSettingsTab(self, parent):
"""
@ -63,7 +63,7 @@ class PresentationPlugin(Plugin):
"""
visible_name = self.getString(StringContent.VisibleName)
self.settingsTab = PresentationTab(parent, self.name,
visible_name[u'title'], self.controllers, self.icon_path)
visible_name[u'title'], self.controllers, self.iconPath)
def initialise(self):
"""
@ -134,10 +134,7 @@ class PresentationPlugin(Plugin):
for controller_class in controller_classes:
controller = controller_class(self)
self.registerControllers(controller)
if self.controllers:
return True
else:
return False
return bool(self.controllers)
def about(self):
"""

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -31,6 +31,7 @@
<title>${app_title}</title>
<link rel="stylesheet" href="/files/jquery.mobile.css" />
<link rel="stylesheet" href="/files/openlp.css" />
<link rel="shortcut icon" type="image/x-icon" href="/files/images/favicon.ico">
<script type="text/javascript" src="/files/jquery.js"></script>
<script type="text/javascript" src="/files/openlp.js"></script>
<script type="text/javascript" src="/files/jquery.mobile.js"></script>

View File

@ -29,6 +29,7 @@
<meta charset="utf-8" />
<title>${stage_title}</title>
<link rel="stylesheet" href="/files/stage.css" />
<link rel="shortcut icon" type="image/x-icon" href="/files/images/favicon.ico">
<script type="text/javascript" src="/files/jquery.js"></script>
<script type="text/javascript" src="/files/stage.js"></script>
</head>

View File

@ -41,8 +41,8 @@ class RemotesPlugin(Plugin):
"""
Plugin.__init__(self, u'remotes', plugin_helpers,
settings_tab_class=RemoteTab)
self.icon_path = u':/plugins/plugin_remote.png'
self.icon = build_icon(self.icon_path)
self.iconPath = u':/plugins/plugin_remote.png'
self.icon = build_icon(self.iconPath)
self.weight = -1
self.server = None

View File

@ -61,8 +61,8 @@ class SongsPlugin(Plugin):
Plugin.__init__(self, u'songs', plugin_helpers, SongMediaItem, SongsTab)
self.manager = Manager(u'songs', init_schema, upgrade_mod=upgrade)
self.weight = -10
self.icon_path = u':/plugins/plugin_songs.png'
self.icon = build_icon(self.icon_path)
self.iconPath = u':/plugins/plugin_songs.png'
self.icon = build_icon(self.iconPath)
def checkPreConditions(self):
return self.manager.session is not None

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff