trivial cleanups part 2

bzr-revno: 1950
This commit is contained in:
Andreas Preikschat 2012-04-22 08:32:13 +01:00 committed by Tim Bentley
commit baf758e45d
6 changed files with 44 additions and 55 deletions

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

@ -145,11 +145,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.settings_tab.bible_theme) == theme:
return True
return False
return unicode(self.settings_tab.bible_theme) == theme
def renameTheme(self, oldTheme, newTheme):
"""

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

@ -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):
"""