mirror of https://gitlab.com/openlp/openlp.git
trivial clean ups
This commit is contained in:
parent
01b2b4e5bf
commit
0fdf3b7f7c
|
@ -364,7 +364,7 @@ class Renderer(object):
|
||||||
self.web.setVisible(False)
|
self.web.setVisible(False)
|
||||||
self.web.resize(self.page_width, self.page_height)
|
self.web.resize(self.page_width, self.page_height)
|
||||||
self.web_frame = self.web.page().mainFrame()
|
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>
|
html = u"""<!DOCTYPE html><html><head><script>
|
||||||
function show_text(newtext) {
|
function show_text(newtext) {
|
||||||
var main = document.getElementById('main');
|
var main = document.getElementById('main');
|
||||||
|
|
|
@ -104,7 +104,7 @@ class SettingsManager(object):
|
||||||
u'%s count' % name, QtCore.QVariant(0)).toInt()[0]
|
u'%s count' % name, QtCore.QVariant(0)).toInt()[0]
|
||||||
new_count = len(list)
|
new_count = len(list)
|
||||||
settings.setValue(u'%s count' % name, QtCore.QVariant(new_count))
|
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(
|
settings.setValue(
|
||||||
u'%s %d' % (name, counter), QtCore.QVariant(list[counter-1]))
|
u'%s %d' % (name, counter), QtCore.QVariant(list[counter-1]))
|
||||||
if old_count > new_count:
|
if old_count > new_count:
|
||||||
|
@ -130,7 +130,7 @@ class SettingsManager(object):
|
||||||
u'%s count' % name, QtCore.QVariant(0)).toInt()[0]
|
u'%s count' % name, QtCore.QVariant(0)).toInt()[0]
|
||||||
list = []
|
list = []
|
||||||
if list_count:
|
if list_count:
|
||||||
for counter in range(0, list_count):
|
for counter in range(list_count):
|
||||||
item = unicode(
|
item = unicode(
|
||||||
settings.value(u'%s %d' % (name, counter)).toString())
|
settings.value(u'%s %d' % (name, counter)).toString())
|
||||||
if item:
|
if item:
|
||||||
|
|
|
@ -145,11 +145,10 @@ class BiblePlugin(Plugin):
|
||||||
def usesTheme(self, theme):
|
def usesTheme(self, theme):
|
||||||
"""
|
"""
|
||||||
Called to find out if the bible plugin is currently using a 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.settings_tab.bible_theme) == theme:
|
return unicode(self.settings_tab.bible_theme) == theme
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def renameTheme(self, oldTheme, newTheme):
|
def renameTheme(self, oldTheme, newTheme):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -263,50 +263,48 @@ class PresentationMediaItem(MediaManagerItem):
|
||||||
service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay)
|
service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay)
|
||||||
service_item.add_capability(ItemCapabilities.HasDetailedTitleDisplay)
|
service_item.add_capability(ItemCapabilities.HasDetailedTitleDisplay)
|
||||||
shortname = service_item.shortname
|
shortname = service_item.shortname
|
||||||
if shortname:
|
if not shortname:
|
||||||
for bitem in items:
|
return False
|
||||||
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
for bitem in items:
|
||||||
if os.path.exists(filename):
|
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||||
if shortname == self.Automatic:
|
if os.path.exists(filename):
|
||||||
service_item.shortname = \
|
if shortname == self.Automatic:
|
||||||
self.findControllerByType(filename)
|
service_item.shortname = self.findControllerByType(filename)
|
||||||
if not service_item.shortname:
|
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
|
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:
|
else:
|
||||||
# File is no longer present
|
# File is no longer present
|
||||||
critical_error_message_box(
|
if not remote:
|
||||||
translate('PresentationPlugin.MediaItem',
|
critical_error_message_box(
|
||||||
'Missing Presentation'),
|
translate('PresentationPlugin.MediaItem',
|
||||||
unicode(translate('PresentationPlugin.MediaItem',
|
'Missing Presentation'),
|
||||||
'The Presentation %s no longer exists.')) % filename)
|
unicode(translate(
|
||||||
|
'PresentationPlugin.MediaItem',
|
||||||
|
'The Presentation %s is incomplete,'
|
||||||
|
' please reload.')) % filename)
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return False
|
# File is no longer present
|
||||||
|
critical_error_message_box(
|
||||||
|
translate('PresentationPlugin.MediaItem',
|
||||||
|
'Missing Presentation'),
|
||||||
|
unicode(translate('PresentationPlugin.MediaItem',
|
||||||
|
'The Presentation %s no longer exists.')) % filename)
|
||||||
|
return False
|
||||||
|
|
||||||
def findControllerByType(self, filename):
|
def findControllerByType(self, filename):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -134,10 +134,7 @@ class PresentationPlugin(Plugin):
|
||||||
for controller_class in controller_classes:
|
for controller_class in controller_classes:
|
||||||
controller = controller_class(self)
|
controller = controller_class(self)
|
||||||
self.registerControllers(controller)
|
self.registerControllers(controller)
|
||||||
if self.controllers:
|
return bool(self.controllers)
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
def about(self):
|
def about(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue