forked from openlp/openlp
trivial cleanups part 2
bzr-revno: 1950
This commit is contained in:
commit
baf758e45d
@ -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):
|
||||||
"""
|
"""
|
||||||
|
@ -339,7 +339,6 @@ class ImpressDocument(PresentationDocument):
|
|||||||
Returns true if a presentation is loaded
|
Returns true if a presentation is loaded
|
||||||
"""
|
"""
|
||||||
log.debug(u'is loaded OpenOffice')
|
log.debug(u'is loaded OpenOffice')
|
||||||
#print "is_loaded "
|
|
||||||
if self.presentation is None or self.document is None:
|
if self.presentation is None or self.document is None:
|
||||||
log.debug("is_loaded: no presentation or document")
|
log.debug("is_loaded: no presentation or document")
|
||||||
return False
|
return False
|
||||||
@ -357,14 +356,9 @@ class ImpressDocument(PresentationDocument):
|
|||||||
Returns true if a presentation is active and running
|
Returns true if a presentation is active and running
|
||||||
"""
|
"""
|
||||||
log.debug(u'is active OpenOffice')
|
log.debug(u'is active OpenOffice')
|
||||||
#print "is_active "
|
|
||||||
if not self.is_loaded():
|
if not self.is_loaded():
|
||||||
#print "False "
|
|
||||||
return False
|
return False
|
||||||
#print "self.con ", self.control
|
return self.control is not None
|
||||||
if self.control is None:
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def unblank_screen(self):
|
def unblank_screen(self):
|
||||||
"""
|
"""
|
||||||
|
@ -263,50 +263,49 @@ 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
|
||||||
|
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(
|
critical_error_message_box(
|
||||||
translate('PresentationPlugin.MediaItem',
|
translate('PresentationPlugin.MediaItem',
|
||||||
'Missing Presentation'),
|
'Missing Presentation'),
|
||||||
unicode(translate('PresentationPlugin.MediaItem',
|
unicode(translate('PresentationPlugin.MediaItem',
|
||||||
'The Presentation %s no longer exists.')) % filename)
|
'The presentation %s no longer exists.')) % filename)
|
||||||
return False
|
return False
|
||||||
else:
|
|
||||||
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
Block a user