More Cleanups

This commit is contained in:
Tim Bentley 2011-03-28 19:56:39 +01:00
parent c8a7594685
commit 2ba0d410fc
12 changed files with 30 additions and 30 deletions

View File

@ -160,7 +160,7 @@ class Plugin(QtCore.QObject):
self.log = logging.getLogger(self.name) self.log = logging.getLogger(self.name)
self.previewController = pluginHelpers[u'preview'] self.previewController = pluginHelpers[u'preview']
self.liveController = pluginHelpers[u'live'] self.liveController = pluginHelpers[u'live']
self.renderManager = pluginHelpers[u'render'] self.renderer = pluginHelpers[u'renderer']
self.serviceManager = pluginHelpers[u'service'] self.serviceManager = pluginHelpers[u'service']
self.settingsForm = pluginHelpers[u'settings form'] self.settingsForm = pluginHelpers[u'settings form']
self.mediadock = pluginHelpers[u'toolbox'] self.mediadock = pluginHelpers[u'toolbox']

View File

@ -60,7 +60,7 @@ class Renderer(object):
``screen_number`` ``screen_number``
Defaults to *0*. The index of the output/display screen. Defaults to *0*. The index of the output/display screen.
""" """
log.info(u'RenderManager Loaded') log.info(u'Renderer Loaded')
def __init__(self, theme_manager, screens): def __init__(self, theme_manager, screens):
""" """

View File

@ -83,7 +83,7 @@ class ServiceItem(object):
The plugin that this service item belongs to. The plugin that this service item belongs to.
""" """
if plugin: if plugin:
self.renderer = plugin.renderManager self.renderer = plugin.renderer
self.name = plugin.name self.name = plugin.name
self.title = u'' self.title = u''
self.shortname = u'' self.shortname = u''
@ -455,4 +455,4 @@ class ServiceItem(object):
elif not start and end: elif not start and end:
return end return end
else: else:
return u'%s : %s' % (start, end) return u'%s : %s' % (start, end)

View File

@ -588,7 +588,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.onInformationMessage) self.onInformationMessage)
# warning cyclic dependency # warning cyclic dependency
# renderer needs to call ThemeManager and # renderer needs to call ThemeManager and
# ThemeManager needs to call renderer # ThemeManager needs to call Renderer
self.renderer = Renderer( self.renderer = Renderer(
self.themeManagerContents, self.screens) self.themeManagerContents, self.screens)
# Define the media Dock Manager # Define the media Dock Manager
@ -597,7 +597,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# make the controllers available to the plugins # make the controllers available to the plugins
self.pluginHelpers[u'preview'] = self.previewController self.pluginHelpers[u'preview'] = self.previewController
self.pluginHelpers[u'live'] = self.liveController self.pluginHelpers[u'live'] = self.liveController
self.pluginHelpers[u'render'] = self.renderer self.pluginHelpers[u'renderer'] = self.renderer
self.pluginHelpers[u'service'] = self.ServiceManagerContents self.pluginHelpers[u'service'] = self.ServiceManagerContents
self.pluginHelpers[u'settings form'] = self.settingsForm self.pluginHelpers[u'settings form'] = self.settingsForm
self.pluginHelpers[u'toolbox'] = self.mediaDockManager self.pluginHelpers[u'toolbox'] = self.mediaDockManager

View File

@ -564,7 +564,7 @@ class ServiceManager(QtGui.QWidget):
for item in items: for item in items:
serviceItem = ServiceItem() serviceItem = ServiceItem()
serviceItem.from_service = True serviceItem.from_service = True
serviceItem.render_manager = self.mainwindow.renderManager serviceItem.renderer = self.mainwindow.renderer
serviceItem.set_from_service(item, self.servicePath) serviceItem.set_from_service(item, self.servicePath)
self.validateItem(serviceItem) self.validateItem(serviceItem)
self.addServiceItem(serviceItem) self.addServiceItem(serviceItem)
@ -958,7 +958,7 @@ class ServiceManager(QtGui.QWidget):
""" """
log.debug(u'onThemeComboBoxSelected') log.debug(u'onThemeComboBoxSelected')
self.service_theme = unicode(self.themeComboBox.currentText()) self.service_theme = unicode(self.themeComboBox.currentText())
self.mainwindow.renderManager.set_service_theme(self.service_theme) self.mainwindow.renderer.set_service_theme(self.service_theme)
QtCore.QSettings().setValue( QtCore.QSettings().setValue(
self.mainwindow.serviceSettingsSection + u'/service theme', self.mainwindow.serviceSettingsSection + u'/service theme',
QtCore.QVariant(self.service_theme)) QtCore.QVariant(self.service_theme))

View File

@ -618,19 +618,19 @@ class SlideController(QtGui.QWidget):
label.setScaledContents(True) label.setScaledContents(True)
if self.serviceItem.is_command(): if self.serviceItem.is_command():
image = resize_image(frame[u'image'], image = resize_image(frame[u'image'],
self.parent.renderManager.width, self.parent.renderer.width,
self.parent.renderManager.height) self.parent.renderer.height)
else: else:
# If current slide set background to image # If current slide set background to image
if framenumber == slideno: if framenumber == slideno:
self.serviceItem.bg_image_bytes = \ self.serviceItem.bg_image_bytes = \
self.parent.renderManager.image_manager. \ self.parent.renderer.image_manager. \
get_image_bytes(frame[u'title']) get_image_bytes(frame[u'title'])
image = self.parent.renderManager.image_manager. \ image = self.parent.renderer.image_manager. \
get_image(frame[u'title']) get_image(frame[u'title'])
label.setPixmap(QtGui.QPixmap.fromImage(image)) label.setPixmap(QtGui.QPixmap.fromImage(image))
self.previewListWidget.setCellWidget(framenumber, 0, label) self.previewListWidget.setCellWidget(framenumber, 0, label)
slideHeight = width * self.parent.renderManager.screen_ratio slideHeight = width * self.parent.renderer.screen_ratio
row += 1 row += 1
text.append(unicode(row)) text.append(unicode(row))
self.previewListWidget.setItem(framenumber, 0, item) self.previewListWidget.setItem(framenumber, 0, item)
@ -1111,4 +1111,4 @@ class SlideController(QtGui.QWidget):
blank.setChecked(False) blank.setChecked(False)
self.hideMenu.setDefaultAction(blank) self.hideMenu.setDefaultAction(blank)
QtCore.QSettings().remove( QtCore.QSettings().remove(
self.parent.generalSettingsSection + u'/screen blank') self.parent.generalSettingsSection + u'/screen blank')

View File

@ -656,7 +656,7 @@ class ThemeManager(QtGui.QWidget):
def generateImage(self, themeData, forcePage=False): def generateImage(self, themeData, forcePage=False):
""" """
Call the RenderManager to build a Sample Image Call the renderer to build a Sample Image
``themeData`` ``themeData``
The theme to generated a preview for. The theme to generated a preview for.
@ -665,7 +665,7 @@ class ThemeManager(QtGui.QWidget):
Flag to tell message lines per page need to be generated. Flag to tell message lines per page need to be generated.
""" """
log.debug(u'generateImage \n%s ', themeData) log.debug(u'generateImage \n%s ', themeData)
return self.mainwindow.renderManager.generate_preview( return self.mainwindow.renderer.generate_preview(
themeData, forcePage) themeData, forcePage)
def getPreviewImage(self, theme): def getPreviewImage(self, theme):
@ -802,4 +802,4 @@ class ThemeManager(QtGui.QWidget):
vAlignCorrection = VerticalType.Bottom vAlignCorrection = VerticalType.Bottom
newtheme.display_horizontal_align = theme.HorizontalAlign newtheme.display_horizontal_align = theme.HorizontalAlign
newtheme.display_vertical_align = vAlignCorrection newtheme.display_vertical_align = vAlignCorrection
return newtheme.extract_xml() return newtheme.extract_xml()

View File

@ -147,7 +147,7 @@ class ThemesTab(SettingsTab):
settings.setValue(u'global theme', settings.setValue(u'global theme',
QtCore.QVariant(self.global_theme)) QtCore.QVariant(self.global_theme))
settings.endGroup() settings.endGroup()
self.parent.renderManager.set_global_theme( self.parent.renderer.set_global_theme(
self.global_theme, self.theme_level) self.global_theme, self.theme_level)
Receiver.send_message(u'theme_update_global', self.global_theme) Receiver.send_message(u'theme_update_global', self.global_theme)
@ -165,7 +165,7 @@ class ThemesTab(SettingsTab):
def onDefaultComboBoxChanged(self, value): def onDefaultComboBoxChanged(self, value):
self.global_theme = unicode(self.DefaultComboBox.currentText()) self.global_theme = unicode(self.DefaultComboBox.currentText())
self.parent.renderManager.set_global_theme( self.parent.renderer.set_global_theme(
self.global_theme, self.theme_level) self.global_theme, self.theme_level)
self.__previewGlobalTheme() self.__previewGlobalTheme()
@ -206,4 +206,4 @@ class ThemesTab(SettingsTab):
if not preview.isNull(): if not preview.isNull():
preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio,
QtCore.Qt.SmoothTransformation) QtCore.Qt.SmoothTransformation)
self.DefaultListView.setPixmap(preview) self.DefaultListView.setPixmap(preview)

View File

@ -244,7 +244,7 @@ class ImpressDocument(PresentationDocument):
return False return False
self.presentation = self.document.getPresentation() self.presentation = self.document.getPresentation()
self.presentation.Display = \ self.presentation.Display = \
self.controller.plugin.renderManager.screens.current_display + 1 self.controller.plugin.renderer.screens.current_display + 1
self.control = None self.control = None
self.create_thumbnails() self.create_thumbnails()
return True return True
@ -463,4 +463,4 @@ class ImpressDocument(PresentationDocument):
shape = page.getByIndex(idx) shape = page.getByIndex(idx)
if shape.supportsService("com.sun.star.drawing.Text"): if shape.supportsService("com.sun.star.drawing.Text"):
text += shape.getString() + '\n' text += shape.getString() + '\n'
return text return text

View File

@ -253,8 +253,8 @@ class PowerpointDocument(PresentationDocument):
dpi = 96 dpi = 96
self.presentation.SlideShowSettings.Run() self.presentation.SlideShowSettings.Run()
self.presentation.SlideShowWindow.View.GotoSlide(1) self.presentation.SlideShowWindow.View.GotoSlide(1)
rendermanager = self.controller.plugin.renderManager renderer = self.controller.plugin.renderer
rect = rendermanager.screens.current[u'size'] rect = renderer.screens.current[u'size']
self.presentation.SlideShowWindow.Top = rect.y() * 72 / dpi self.presentation.SlideShowWindow.Top = rect.y() * 72 / dpi
self.presentation.SlideShowWindow.Height = rect.height() * 72 / dpi self.presentation.SlideShowWindow.Height = rect.height() * 72 / dpi
self.presentation.SlideShowWindow.Left = rect.x() * 72 / dpi self.presentation.SlideShowWindow.Left = rect.x() * 72 / dpi
@ -326,4 +326,4 @@ def _get_text_from_shapes(shapes):
shape = shapes(idx + 1) shape = shapes(idx + 1)
if shape.HasTextFrame: if shape.HasTextFrame:
text += shape.TextFrame.TextRange.Text + '\n' text += shape.TextFrame.TextRange.Text + '\n'
return text return text

View File

@ -121,8 +121,8 @@ class PptviewDocument(PresentationDocument):
The file name of the presentations to run. The file name of the presentations to run.
""" """
log.debug(u'LoadPresentation') log.debug(u'LoadPresentation')
rendermanager = self.controller.plugin.renderManager renderer = self.controller.plugin.renderer
rect = rendermanager.screens.current[u'size'] rect = renderer.screens.current[u'size']
rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom()) rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom())
filepath = str(self.filepath.replace(u'/', u'\\')) filepath = str(self.filepath.replace(u'/', u'\\'))
if not os.path.isdir(self.get_temp_folder()): if not os.path.isdir(self.get_temp_folder()):
@ -244,4 +244,4 @@ class PptviewDocument(PresentationDocument):
""" """
Triggers the previous slide on the running presentation Triggers the previous slide on the running presentation
""" """
self.controller.process.PrevStep(self.pptid) self.controller.process.PrevStep(self.pptid)

View File

@ -89,7 +89,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.onVerseListViewPressed) self.onVerseListViewPressed)
QtCore.QObject.connect(self.themeAddButton, QtCore.QObject.connect(self.themeAddButton,
QtCore.SIGNAL(u'clicked()'), QtCore.SIGNAL(u'clicked()'),
self.parent.parent.renderManager.theme_manager.onAddTheme) self.parent.parent.renderer.theme_manager.onAddTheme)
QtCore.QObject.connect(self.maintenanceButton, QtCore.QObject.connect(self.maintenanceButton,
QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
@ -788,4 +788,4 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.song.verse_order) self.song.verse_order)
except: except:
log.exception(u'Problem processing song Lyrics \n%s', log.exception(u'Problem processing song Lyrics \n%s',
sxml.dump_xml()) sxml.dump_xml())