From 49dbda7476683fc99bec60cebb5aaba2efe5686d Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Sun, 25 Mar 2012 19:37:22 +0700 Subject: [PATCH 01/20] themeform.py line 426 at function setPositionPageValues(self): added main and footer page width and height based on the screen size --- openlp/core/ui/themeform.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index face5938f..63df0ab8d 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -427,25 +427,28 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): """ Handle the display and state of the Position page. """ + # Get the QRect of a screen + screen = QtGui.QDesktopWidget().availableGeometry() # Main Area self.mainPositionCheckBox.setChecked(not self.theme.font_main_override) self.setField(u'mainPositionX', QtCore.QVariant(self.theme.font_main_x)) self.setField(u'mainPositionY', QtCore.QVariant(self.theme.font_main_y)) self.setField(u'mainPositionHeight', - QtCore.QVariant(self.theme.font_main_height)) + QtCore.QVariant(screen.height() - 110)) self.setField(u'mainPositionWidth', - QtCore.QVariant(self.theme.font_main_width)) + QtCore.QVariant(screen.width() - 20)) # Footer self.footerPositionCheckBox.setChecked( not self.theme.font_footer_override) self.setField(u'footerPositionX', QtCore.QVariant(self.theme.font_footer_x)) self.setField(u'footerPositionY', - QtCore.QVariant(self.theme.font_footer_y)) + QtCore.QVariant(screen.height() - 100)) self.setField(u'footerPositionHeight', - QtCore.QVariant(self.theme.font_footer_height)) + QtCore.QVariant(120)) + self.setField(u'footerPositionWidth', - QtCore.QVariant(self.theme.font_footer_width)) + QtCore.QVariant(screen.width() - 20)) def setAlignmentPageValues(self): """ From a251522ef37a0fb13991b6eafa7b80e90c7dcc30 Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Wed, 16 May 2012 20:14:32 +0700 Subject: [PATCH 02/20] #902492 resolved --- openlp/core/lib/theme.py | 11 +++++++++++ openlp/core/ui/themeform.py | 13 +++++-------- openlp/core/ui/thememanager.py | 7 ++++++- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 486f89b18..16ee1be37 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -444,6 +444,17 @@ class ThemeXML(object): element.appendChild(child) return child + def set_default_header_footer(self, main_width, main_height, footer_width, + footer_height): + """ + Set the header and footer size into the current primary screen + """ + self.font_main_width = main_width + self.font_main_height = main_height + self.font_footer_width = footer_width + self.font_footer_y = main_height+20 + self.font_footer_height = footer_height + def dump_xml(self): """ Dump the XML to file used for debugging diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 63df0ab8d..face5938f 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -427,28 +427,25 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): """ Handle the display and state of the Position page. """ - # Get the QRect of a screen - screen = QtGui.QDesktopWidget().availableGeometry() # Main Area self.mainPositionCheckBox.setChecked(not self.theme.font_main_override) self.setField(u'mainPositionX', QtCore.QVariant(self.theme.font_main_x)) self.setField(u'mainPositionY', QtCore.QVariant(self.theme.font_main_y)) self.setField(u'mainPositionHeight', - QtCore.QVariant(screen.height() - 110)) + QtCore.QVariant(self.theme.font_main_height)) self.setField(u'mainPositionWidth', - QtCore.QVariant(screen.width() - 20)) + QtCore.QVariant(self.theme.font_main_width)) # Footer self.footerPositionCheckBox.setChecked( not self.theme.font_footer_override) self.setField(u'footerPositionX', QtCore.QVariant(self.theme.font_footer_x)) self.setField(u'footerPositionY', - QtCore.QVariant(screen.height() - 100)) + QtCore.QVariant(self.theme.font_footer_y)) self.setField(u'footerPositionHeight', - QtCore.QVariant(120)) - + QtCore.QVariant(self.theme.font_footer_height)) self.setField(u'footerPositionWidth', - QtCore.QVariant(screen.width() - 20)) + QtCore.QVariant(self.theme.font_footer_width)) def setAlignmentPageValues(self): """ diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 72a8b7e3b..4766e0693 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -43,7 +43,7 @@ from openlp.core.lib.theme import ThemeXML, BackgroundType, VerticalType, \ from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ create_widget_action from openlp.core.theme import Theme -from openlp.core.ui import FileRenameForm, ThemeForm +from openlp.core.ui import FileRenameForm, ThemeForm, ScreenList from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding log = logging.getLogger(__name__) @@ -255,6 +255,11 @@ class ThemeManager(QtGui.QWidget): editing form for the user to make their customisations. """ theme = ThemeXML() + screens = ScreenList.get_instance() + primary_screen = screens.current + theme.set_default_header_footer(primary_screen[u'size'].width()-20, + primary_screen[u'size'].height() - 100, + primary_screen[u'size'].width()-20, 70) self.themeForm.theme = theme self.themeForm.exec_() From 81f0ff3870b64bef4ddfc9fcc7264fbea94153ea Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Fri, 18 May 2012 17:38:05 +0700 Subject: [PATCH 03/20] #902492 resolved. All the working code is a placed at theme.py. --- openlp/core/lib/theme.py | 13 ++++++------- openlp/core/ui/thememanager.py | 5 +---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 16ee1be37..afc217e79 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -444,16 +444,15 @@ class ThemeXML(object): element.appendChild(child) return child - def set_default_header_footer(self, main_width, main_height, footer_width, - footer_height): + def set_default_header_footer(self, current_screen): """ Set the header and footer size into the current primary screen """ - self.font_main_width = main_width - self.font_main_height = main_height - self.font_footer_width = footer_width - self.font_footer_y = main_height+20 - self.font_footer_height = footer_height + self.font_main_width = current_screen[u'size'].width()-20 + self.font_main_height = current_screen[u'size'].height()-100 + self.font_footer_width = current_screen[u'size'].width()-20 + self.font_footer_y = current_screen[u'size'].height()-80 + self.font_footer_height = 70 def dump_xml(self): """ diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 4766e0693..38d568883 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -256,10 +256,7 @@ class ThemeManager(QtGui.QWidget): """ theme = ThemeXML() screens = ScreenList.get_instance() - primary_screen = screens.current - theme.set_default_header_footer(primary_screen[u'size'].width()-20, - primary_screen[u'size'].height() - 100, - primary_screen[u'size'].width()-20, 70) + theme.set_default_header_footer(screens.current) self.themeForm.theme = theme self.themeForm.exec_() From 3fdb3b2991f8faf3298274c5c21d87cf0c354fdd Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Fri, 18 May 2012 17:44:28 +0700 Subject: [PATCH 04/20] I've resolved the bug #902492 I got the primary screen resolution from the ScreenList class. --- openlp/core/ui/thememanager.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 38d568883..18547042b 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -255,8 +255,7 @@ class ThemeManager(QtGui.QWidget): editing form for the user to make their customisations. """ theme = ThemeXML() - screens = ScreenList.get_instance() - theme.set_default_header_footer(screens.current) + theme.set_default_header_footer(ScreenList.get_instance().current) self.themeForm.theme = theme self.themeForm.exec_() From b9aaaf05f69bb2538ccdd7b70269d5d74541cfe5 Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Sat, 19 May 2012 15:46:22 +0700 Subject: [PATCH 05/20] Using the renderer.py calculation --- openlp/core/lib/theme.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index afc217e79..61e7cdcaf 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -448,11 +448,12 @@ class ThemeXML(object): """ Set the header and footer size into the current primary screen """ - self.font_main_width = current_screen[u'size'].width()-20 - self.font_main_height = current_screen[u'size'].height()-100 - self.font_footer_width = current_screen[u'size'].width()-20 - self.font_footer_y = current_screen[u'size'].height()-80 - self.font_footer_height = 70 + self.font_main_y = 0; + self.font_main_width = current_screen[u'size'].width() - 20 + self.font_main_height = current_screen[u'size'].height() * 9 / 10 + self.font_footer_width = current_screen[u'size'].width() - 20 + self.font_footer_y = current_screen[u'size'].height() * 9 / 10 + self.font_footer_height = current_screen[u'size'].height() / 10 def dump_xml(self): """ From 41d1ea359037c9f5cf62247b834919a5c00e40a3 Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Sat, 19 May 2012 23:50:45 +0700 Subject: [PATCH 06/20] added comment --- openlp/core/lib/theme.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 61e7cdcaf..8b701443a 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -448,6 +448,7 @@ class ThemeXML(object): """ Set the header and footer size into the current primary screen """ + #10 px border set round display self.font_main_y = 0; self.font_main_width = current_screen[u'size'].width() - 20 self.font_main_height = current_screen[u'size'].height() * 9 / 10 From fb8519694ef6a17244dd3d6fc8462d5dd920f290 Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Sun, 20 May 2012 21:05:06 +0700 Subject: [PATCH 07/20] updated the set_default_header_footer method on lib/theme.py all the works and the import is inside the method. --- openlp/core/lib/theme.py | 7 +++++-- openlp/core/ui/thememanager.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 8b701443a..dc701f6ad 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -36,6 +36,7 @@ from lxml import etree, objectify from openlp.core.lib import str_to_bool + log = logging.getLogger(__name__) BLANK_THEME_XML = \ @@ -444,12 +445,14 @@ class ThemeXML(object): element.appendChild(child) return child - def set_default_header_footer(self, current_screen): + def set_default_header_footer(self): """ Set the header and footer size into the current primary screen """ #10 px border set round display - self.font_main_y = 0; + from openlp.core.ui import ScreenList + current_screen = ScreenList.get_instance().current + self.font_main_y = 0 self.font_main_width = current_screen[u'size'].width() - 20 self.font_main_height = current_screen[u'size'].height() * 9 / 10 self.font_footer_width = current_screen[u'size'].width() - 20 diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 18547042b..f2d313fd7 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -43,7 +43,7 @@ from openlp.core.lib.theme import ThemeXML, BackgroundType, VerticalType, \ from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ create_widget_action from openlp.core.theme import Theme -from openlp.core.ui import FileRenameForm, ThemeForm, ScreenList +from openlp.core.ui import FileRenameForm, ThemeForm from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding log = logging.getLogger(__name__) @@ -255,7 +255,7 @@ class ThemeManager(QtGui.QWidget): editing form for the user to make their customisations. """ theme = ThemeXML() - theme.set_default_header_footer(ScreenList.get_instance().current) + theme.set_default_header_footer() self.themeForm.theme = theme self.themeForm.exec_() From 51d69a28cee7848fc0032907e4a2c1b0f65e753b Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 26 May 2012 19:51:27 +0200 Subject: [PATCH 08/20] stop imageManager thread on shutdown --- openlp/core/lib/imagemanager.py | 13 +++++----- openlp/core/ui/mainwindow.py | 43 ++++++++++++++++++++------------- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 47a7ed3f6..be870f0d9 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -167,8 +167,9 @@ class ImageManager(QtCore.QObject): self.width = current_screen[u'size'].width() self.height = current_screen[u'size'].height() self._cache = {} - self._imageThread = ImageThread(self) + self.imageThread = ImageThread(self) self._conversion_queue = PriorityQueue() + self.stop_manager = False QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.process_updates) @@ -219,8 +220,8 @@ class ImageManager(QtCore.QObject): Flush the queue to updated any data to update """ # We want only one thread. - if not self._imageThread.isRunning(): - self._imageThread.start() + if not self.imageThread.isRunning(): + self.imageThread.start() def get_image(self, name): """ @@ -282,15 +283,15 @@ class ImageManager(QtCore.QObject): else: log.debug(u'Image in cache %s:%s' % (name, path)) # We want only one thread. - if not self._imageThread.isRunning(): - self._imageThread.start() + if not self.imageThread.isRunning(): + self.imageThread.start() def _process(self): """ Controls the processing called from a ``QtCore.QThread``. """ log.debug(u'_process - started') - while not self._conversion_queue.empty(): + while not self._conversion_queue.empty() and not self.stop_manager: self._process_cache() log.debug(u'_process - ended') diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index bff9203db..5ae97f7f6 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -30,6 +30,7 @@ import os import sys import shutil from tempfile import gettempdir +import time from datetime import datetime from PyQt4 import QtCore, QtGui @@ -1134,6 +1135,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): """ # If we just did a settings import, close without saving changes. if self.settingsImported: + self.cleanUp(False) event.accept() if self.serviceManagerContents.isModified(): ret = self.serviceManagerContents.saveModifiedService() @@ -1156,8 +1158,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): translate('OpenLP.MainWindow', 'Are you sure you want to close OpenLP?'), QtGui.QMessageBox.StandardButtons( - QtGui.QMessageBox.Yes | - QtGui.QMessageBox.No), + QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), QtGui.QMessageBox.Yes) if ret == QtGui.QMessageBox.Yes: self.cleanUp() @@ -1168,23 +1169,31 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.cleanUp() event.accept() - def cleanUp(self): + + def cleanUp(self, save_settings=True): """ - Runs all the cleanup code before OpenLP shuts down + Runs all the cleanup code before OpenLP shuts down. + + ``save_settings`` + Switch to prevent saving settings. Defaults to **True**. """ - # Clean temporary files used by services - self.serviceManagerContents.cleanUp() - if QtCore.QSettings().value(u'advanced/save current plugin', - QtCore.QVariant(False)).toBool(): - QtCore.QSettings().setValue(u'advanced/current media plugin', - QtCore.QVariant(self.mediaToolBox.currentIndex())) - # Call the cleanup method to shutdown plugins. - log.info(u'cleanup plugins') - self.pluginManager.finalise_plugins() - # Save settings - self.saveSettings() - # Close down the display - self.liveController.display.close() + self.imageManager.stop_manager = True + while self.imageManager.imageThread.isRunning(): + time.sleep(0.1) + if save_settings: + # Clean temporary files used by services + self.serviceManagerContents.cleanUp() + if QtCore.QSettings().value(u'advanced/save current plugin', + QtCore.QVariant(False)).toBool(): + QtCore.QSettings().setValue(u'advanced/current media plugin', + QtCore.QVariant(self.mediaToolBox.currentIndex())) + # Call the cleanup method to shutdown plugins. + log.info(u'cleanup plugins') + self.pluginManager.finalise_plugins() + # Save settings + self.saveSettings() + # Close down the display + self.liveController.display.close() def serviceChanged(self, reset=False, serviceName=None): """ From cf59d89afada4ea463c3efc067b81e30a616e920 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 26 May 2012 21:56:12 +0200 Subject: [PATCH 09/20] fixed ticket 502 --- openlp/plugins/songs/forms/editsongform.py | 2 +- .../plugins/songs/forms/songmaintenanceform.py | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 195dda729..989f0bc85 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -707,7 +707,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): text = unicode(self.songBookComboBox.currentText()) if item == 0 and text: temp_song_book = text - self.mediaitem.songMaintenanceForm.exec_() + self.mediaitem.songMaintenanceForm.exec_(True) self.loadAuthors() self.loadBooks() self.loadTopics() diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index 7ba49a102..565413854 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -87,7 +87,15 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): QtCore.SIGNAL(u'currentRowChanged(int)'), self.onBooksListRowChanged) - def exec_(self): + def exec_(self, from_song_edit=False): + """ + Show the dialog. + + ``from_song_edit`` + Indicates if the maintenance dialog has been opened from song edit + or from the media manager. Defaults to **False**. + """ + self.from_song_edit = from_song_edit self.typeListWidget.setCurrentRow(0) self.resetAuthors() self.resetTopics() @@ -275,7 +283,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): if self.checkAuthor(author, True): if self.manager.save_object(author): self.resetAuthors() - Receiver.send_message(u'songs_load_list') + if not self.from_song_edit: + Receiver.send_message(u'songs_load_list') else: critical_error_message_box( message=translate('SongsPlugin.SongMaintenanceForm', @@ -373,7 +382,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): Receiver.send_message(u'cursor_busy') merge(dbObject) reset() - Receiver.send_message(u'songs_load_list') + if not self.from_song_edit: + Receiver.send_message(u'songs_load_list') Receiver.send_message(u'cursor_normal') def mergeAuthors(self, old_author): From 8241808d6525e33e031f62cb415df257b058e0d5 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 26 May 2012 22:06:19 +0200 Subject: [PATCH 10/20] fixed traceback when deleting an author/topic which has just been added to an unsaved song --- openlp/plugins/songs/forms/editsongform.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 989f0bc85..61043f805 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -865,12 +865,16 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): for row in xrange(self.authorsListView.count()): item = self.authorsListView.item(row) authorId = (item.data(QtCore.Qt.UserRole)).toInt()[0] - self.song.authors.append(self.manager.get_object(Author, authorId)) + author = self.manager.get_object(Author, authorId) + if author is not None: + self.song.authors.append(author) self.song.topics = [] for row in xrange(self.topicsListView.count()): item = self.topicsListView.item(row) topicId = (item.data(QtCore.Qt.UserRole)).toInt()[0] - self.song.topics.append(self.manager.get_object(Topic, topicId)) + topic = self.manager.get_object(Topic, topicId) + if topic is not None: + self.song.topics.append(topic) # Save the song here because we need a valid id for the audio files. clean_song(self.manager, self.song) self.manager.save_object(self.song) From 577e39bdeefca069c5eeb5642269868ec5e932eb Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 27 May 2012 06:46:08 +0100 Subject: [PATCH 11/20] Fix typing --- openlp/plugins/remotes/html/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/remotes/html/index.html b/openlp/plugins/remotes/html/index.html index c2aa38b05..fc8b37441 100644 --- a/openlp/plugins/remotes/html/index.html +++ b/openlp/plugins/remotes/html/index.html @@ -164,7 +164,7 @@ ${search} -
    +
      From 3bc0fc7de55da695546be77f9622951554782195 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 27 May 2012 07:06:18 +0100 Subject: [PATCH 12/20] cache images sooner --- openlp/core/lib/renderer.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index aa39e779b..62aa3c9c5 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -109,6 +109,8 @@ class Renderer(object): self.global_theme_data = \ self.themeManager.getThemeData(self.global_theme) self.theme_data = None + self._cache_background_image(self.global_theme_data) + def set_service_theme(self, service_theme): """ @@ -119,6 +121,23 @@ class Renderer(object): """ self.service_theme = service_theme self.theme_data = None + self._cache_background_image(self.themeManager.getThemeData + (service_theme)) + + + def _cache_background_image(self,temp_theme): + """ + Adds a background image to the image cache if necessary. + + ``temp_theme`` + The theme object containing the theme data. + """ + # if No file do not update cache + if temp_theme.background_filename: + self.imageManager.add_image(temp_theme.theme_name, + temp_theme.background_filename, u'theme', + QtGui.QColor(temp_theme.background_border_color)) + def set_override_theme(self, override_theme, override_levels=False): """ @@ -163,11 +182,7 @@ class Renderer(object): self.theme_data = self.themeManager.getThemeData(theme) self._calculate_default() self._build_text_rectangle(self.theme_data) - # if No file do not update cache - if self.theme_data.background_filename: - self.imageManager.add_image(self.theme_data.theme_name, - self.theme_data.background_filename, u'theme', - QtGui.QColor(self.theme_data.background_border_color)) + self._cache_background_image(self.theme_data) return self._rect, self._rect_footer def generate_preview(self, theme_data, force_page=False): From 32ee1ec343ebeaace481b945f084d599c5658a3a Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Sun, 27 May 2012 16:41:53 +0700 Subject: [PATCH 13/20] refactor code --- openlp/core/lib/theme.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index dc701f6ad..18c01ee42 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -36,7 +36,6 @@ from lxml import etree, objectify from openlp.core.lib import str_to_bool - log = logging.getLogger(__name__) BLANK_THEME_XML = \ From d5f1c54669f491d44414dd7744ea3ace940e5716 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 27 May 2012 12:58:10 +0200 Subject: [PATCH 14/20] do some of the clean ups even when we just imported settings --- openlp/core/ui/mainwindow.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index c36138941..85c5d6838 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -1185,22 +1185,23 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.imageManager.stop_manager = True while self.imageManager.imageThread.isRunning(): time.sleep(0.1) + # Clean temporary files used by services + self.serviceManagerContents.cleanUp() if save_settings: - # Clean temporary files used by services - self.serviceManagerContents.cleanUp() if QtCore.QSettings().value(u'advanced/save current plugin', QtCore.QVariant(False)).toBool(): QtCore.QSettings().setValue(u'advanced/current media plugin', QtCore.QVariant(self.mediaToolBox.currentIndex())) - # Call the cleanup method to shutdown plugins. - log.info(u'cleanup plugins') - self.pluginManager.finalise_plugins() + # Call the cleanup method to shutdown plugins. + log.info(u'cleanup plugins') + self.pluginManager.finalise_plugins() + if save_settings: # Save settings self.saveSettings() - # Close down the display - if self.liveController.display: - self.liveController.display.close() - self.liveController.display = None + # Close down the display + if self.liveController.display: + self.liveController.display.close() + self.liveController.display = None def serviceChanged(self, reset=False, serviceName=None): """ From faebbc1f5d5ecb3c45c1353f49a03555c8260646 Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Mon, 28 May 2012 09:43:00 +0700 Subject: [PATCH 15/20] comment reformatting --- openlp/core/lib/theme.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 99c51689d..686de4c6c 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -446,9 +446,9 @@ class ThemeXML(object): def set_default_header_footer(self): """ - #Set the header and footer size into the current primary screen + Set the header and footer size into the current primary screen. + 10 px on each side is removed to allow for a border. """ - #10 px border set round display from openlp.core.ui import ScreenList current_screen = ScreenList().current self.font_main_y = 0 From 14bdc5ca7a471ce34471d8f424359e7a8ca3b73a Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 29 May 2012 20:13:02 +0100 Subject: [PATCH 16/20] Remove blank lines --- openlp/core/lib/renderer.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 62aa3c9c5..4e5746faa 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -111,7 +111,6 @@ class Renderer(object): self.theme_data = None self._cache_background_image(self.global_theme_data) - def set_service_theme(self, service_theme): """ Set the service-level theme. @@ -124,7 +123,6 @@ class Renderer(object): self._cache_background_image(self.themeManager.getThemeData (service_theme)) - def _cache_background_image(self,temp_theme): """ Adds a background image to the image cache if necessary. @@ -138,7 +136,6 @@ class Renderer(object): temp_theme.background_filename, u'theme', QtGui.QColor(temp_theme.background_border_color)) - def set_override_theme(self, override_theme, override_levels=False): """ Set the appropriate theme depending on the theme level. From cdb6859edf284dcd6ec3461b04dde8b768c43fc8 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 30 May 2012 20:50:24 +0100 Subject: [PATCH 17/20] Add space --- openlp/core/lib/renderer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 4e5746faa..9705e13df 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -123,7 +123,7 @@ class Renderer(object): self._cache_background_image(self.themeManager.getThemeData (service_theme)) - def _cache_background_image(self,temp_theme): + def _cache_background_image(self, temp_theme): """ Adds a background image to the image cache if necessary. From 770d24553438b4bc54bf6cd85ec9375cab8d8ef2 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 4 Jun 2012 11:57:45 +0200 Subject: [PATCH 18/20] fixed non camelCase attributes --- openlp/plugins/songs/forms/songmaintenanceform.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index 565413854..cfbb8a3da 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -87,15 +87,15 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): QtCore.SIGNAL(u'currentRowChanged(int)'), self.onBooksListRowChanged) - def exec_(self, from_song_edit=False): + def exec_(self, fromSongEdit=False): """ Show the dialog. - ``from_song_edit`` + ``fromSongEdit`` Indicates if the maintenance dialog has been opened from song edit or from the media manager. Defaults to **False**. """ - self.from_song_edit = from_song_edit + self.fromSongEdit = fromSongEdit self.typeListWidget.setCurrentRow(0) self.resetAuthors() self.resetTopics() @@ -283,7 +283,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): if self.checkAuthor(author, True): if self.manager.save_object(author): self.resetAuthors() - if not self.from_song_edit: + if not self.fromSongEdit: Receiver.send_message(u'songs_load_list') else: critical_error_message_box( @@ -382,7 +382,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): Receiver.send_message(u'cursor_busy') merge(dbObject) reset() - if not self.from_song_edit: + if not self.fromSongEdit: Receiver.send_message(u'songs_load_list') Receiver.send_message(u'cursor_normal') From c4e89353924495b57da14988db53a50b5bf50c3b Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 4 Jun 2012 12:05:55 +0200 Subject: [PATCH 19/20] fixed other variable names --- .../songs/forms/songmaintenanceform.py | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index cfbb8a3da..22210f552 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -111,20 +111,20 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): else: return -1 - def _deleteItem(self, item_class, list_widget, reset_func, dlg_title, + def _deleteItem(self, itemClass, listWidget, resetFunc, dlgTitle, del_text, err_text): - item_id = self._getCurrentItemId(list_widget) + item_id = self._getCurrentItemId(listWidget) if item_id != -1: - item = self.manager.get_object(item_class, item_id) + item = self.manager.get_object(itemClass, item_id) if item and not item.songs: - if critical_error_message_box(dlg_title, del_text, self, + if critical_error_message_box(dlgTitle, del_text, self, True) == QtGui.QMessageBox.Yes: - self.manager.delete_object(item_class, item.id) - reset_func() + self.manager.delete_object(itemClass, item.id) + resetFunc() else: - critical_error_message_box(dlg_title, err_text) + critical_error_message_box(dlgTitle, err_text) else: - critical_error_message_box(dlg_title, UiStrings().NISs) + critical_error_message_box(dlgTitle, UiStrings().NISs) def resetAuthors(self): """ @@ -165,34 +165,34 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): book_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(book.id)) self.booksListWidget.addItem(book_name) - def checkAuthor(self, new_author, edit=False): + def checkAuthor(self, newAuthor, edit=False): """ Returns *False* if the given Author already exists, otherwise *True*. """ authors = self.manager.get_all_objects(Author, - and_(Author.first_name == new_author.first_name, - Author.last_name == new_author.last_name, - Author.display_name == new_author.display_name)) - return self.__checkObject(authors, new_author, edit) + and_(Author.first_name == newAuthor.first_name, + Author.last_name == newAuthor.last_name, + Author.display_name == newAuthor.display_name)) + return self.__checkObject(authors, newAuthor, edit) - def checkTopic(self, new_topic, edit=False): + def checkTopic(self, newTopic, edit=False): """ Returns *False* if the given Topic already exists, otherwise *True*. """ topics = self.manager.get_all_objects(Topic, - Topic.name == new_topic.name) - return self.__checkObject(topics, new_topic, edit) + Topic.name == newTopic.name) + return self.__checkObject(topics, newTopic, edit) - def checkBook(self, new_book, edit=False): + def checkBook(self, newBook, edit=False): """ Returns *False* if the given Topic already exists, otherwise *True*. """ books = self.manager.get_all_objects(Book, - and_(Book.name == new_book.name, - Book.publisher == new_book.publisher)) - return self.__checkObject(books, new_book, edit) + and_(Book.name == newBook.name, + Book.publisher == newBook.publisher)) + return self.__checkObject(books, newBook, edit) - def __checkObject(self, objects, new_object, edit): + def __checkObject(self, objects, newObject, edit): """ Utility method to check for an existing object. @@ -204,7 +204,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): # not return False when nothing has changed. if edit: for object in objects: - if object.id != new_object.id: + if object.id != newObject.id: return False return True else: @@ -386,72 +386,72 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): Receiver.send_message(u'songs_load_list') Receiver.send_message(u'cursor_normal') - def mergeAuthors(self, old_author): + def mergeAuthors(self, oldAuthor): """ Merges two authors into one author. - ``old_author`` + ``oldAuthor`` The object, which was edited, that will be deleted """ # Find the duplicate. existing_author = self.manager.get_object_filtered(Author, - and_(Author.first_name == old_author.first_name, - Author.last_name == old_author.last_name, - Author.display_name == old_author.display_name, - Author.id != old_author.id)) - # Find the songs, which have the old_author as author. + and_(Author.first_name == oldAuthor.first_name, + Author.last_name == oldAuthor.last_name, + Author.display_name == oldAuthor.display_name, + Author.id != oldAuthor.id)) + # Find the songs, which have the oldAuthor as author. songs = self.manager.get_all_objects(Song, - Song.authors.contains(old_author)) + Song.authors.contains(oldAuthor)) for song in songs: # We check if the song has already existing_author as author. If # that is not the case we add it. if existing_author not in song.authors: song.authors.append(existing_author) - song.authors.remove(old_author) + song.authors.remove(oldAuthor) self.manager.save_object(song) - self.manager.delete_object(Author, old_author.id) + self.manager.delete_object(Author, oldAuthor.id) - def mergeTopics(self, old_topic): + def mergeTopics(self, oldTopic): """ Merges two topics into one topic. - ``old_topic`` + ``oldTopic`` The object, which was edited, that will be deleted """ # Find the duplicate. existing_topic = self.manager.get_object_filtered(Topic, - and_(Topic.name == old_topic.name, Topic.id != old_topic.id)) - # Find the songs, which have the old_topic as topic. + and_(Topic.name == oldTopic.name, Topic.id != oldTopic.id)) + # Find the songs, which have the oldTopic as topic. songs = self.manager.get_all_objects(Song, - Song.topics.contains(old_topic)) + Song.topics.contains(oldTopic)) for song in songs: # We check if the song has already existing_topic as topic. If that # is not the case we add it. if existing_topic not in song.topics: song.topics.append(existing_topic) - song.topics.remove(old_topic) + song.topics.remove(oldTopic) self.manager.save_object(song) - self.manager.delete_object(Topic, old_topic.id) + self.manager.delete_object(Topic, oldTopic.id) - def mergeBooks(self, old_book): + def mergeBooks(self, oldBook): """ Merges two books into one book. - ``old_book`` + ``oldBook`` The object, which was edited, that will be deleted """ # Find the duplicate. existing_book = self.manager.get_object_filtered(Book, - and_(Book.name == old_book.name, - Book.publisher == old_book.publisher, - Book.id != old_book.id)) - # Find the songs, which have the old_book as book. + and_(Book.name == oldBook.name, + Book.publisher == oldBook.publisher, + Book.id != oldBook.id)) + # Find the songs, which have the oldBook as book. songs = self.manager.get_all_objects(Song, - Song.song_book_id == old_book.id) + Song.song_book_id == oldBook.id) for song in songs: song.song_book_id = existing_book.id self.manager.save_object(song) - self.manager.delete_object(Book, old_book.id) + self.manager.delete_object(Book, oldBook.id) def onAuthorDeleteButtonClicked(self): """ From 81b4d84c1f67fab45afbc9a9a509bb458ade486e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 4 Jun 2012 12:22:47 +0200 Subject: [PATCH 20/20] changed attributes and arguments to camelCase --- openlp/core/lib/imagemanager.py | 94 ++++++++++++++-------------- openlp/core/lib/renderer.py | 4 +- openlp/core/lib/serviceitem.py | 2 +- openlp/core/ui/maindisplay.py | 10 +-- openlp/core/ui/mainwindow.py | 4 +- openlp/core/ui/slidecontroller.py | 4 +- openlp/core/ui/thememanager.py | 4 +- openlp/plugins/images/imageplugin.py | 2 +- 8 files changed, 62 insertions(+), 62 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index be870f0d9..1e2a3a698 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -163,59 +163,59 @@ class ImageManager(QtCore.QObject): def __init__(self): QtCore.QObject.__init__(self) - current_screen = ScreenList().current - self.width = current_screen[u'size'].width() - self.height = current_screen[u'size'].height() + currentScreen = ScreenList().current + self.width = currentScreen[u'size'].width() + self.height = currentScreen[u'size'].height() self._cache = {} self.imageThread = ImageThread(self) - self._conversion_queue = PriorityQueue() - self.stop_manager = False + self._conversionQueue = PriorityQueue() + self.stopManager = False QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'config_updated'), self.process_updates) + QtCore.SIGNAL(u'config_updated'), self.processUpdates) - def update_display(self): + def updateDisplay(self): """ Screen has changed size so rebuild the cache to new size. """ - log.debug(u'update_display') - current_screen = ScreenList().current - self.width = current_screen[u'size'].width() - self.height = current_screen[u'size'].height() + log.debug(u'updateDisplay') + currentScreen = ScreenList().current + self.width = currentScreen[u'size'].width() + self.height = currentScreen[u'size'].height() # Mark the images as dirty for a rebuild by setting the image and byte # stream to None. for image in self._cache.values(): - self._reset_image(image) + self._resetImage(image) - def update_images(self, image_type, background): + def updateImages(self, imageType, background): """ Border has changed so update all the images affected. """ - log.debug(u'update_images') + log.debug(u'updateImages') # Mark the images as dirty for a rebuild by setting the image and byte # stream to None. for image in self._cache.values(): - if image.source == image_type: + if image.source == imageType: image.background = background - self._reset_image(image) + self._resetImage(image) - def update_image(self, name, image_type, background): + def updateImage(self, name, imageType, background): """ Border has changed so update the image affected. """ - log.debug(u'update_images') + log.debug(u'updateImage') # Mark the images as dirty for a rebuild by setting the image and byte # stream to None. for image in self._cache.values(): - if image.source == image_type and image.name == name: + if image.source == imageType and image.name == name: image.background = background - self._reset_image(image) + self._resetImage(image) - def _reset_image(self, image): + def _resetImage(self, image): image.image = None image.image_bytes = None - self._conversion_queue.modify_priority(image, Priority.Normal) + self._conversionQueue.modify_priority(image, Priority.Normal) - def process_updates(self): + def processUpdates(self): """ Flush the queue to updated any data to update """ @@ -223,62 +223,62 @@ class ImageManager(QtCore.QObject): if not self.imageThread.isRunning(): self.imageThread.start() - def get_image(self, name): + def getImage(self, name): """ Return the ``QImage`` from the cache. If not present wait for the background thread to process it. """ - log.debug(u'get_image %s' % name) + log.debug(u'getImage %s' % name) image = self._cache[name] if image.image is None: - self._conversion_queue.modify_priority(image, Priority.High) + self._conversionQueue.modify_priority(image, Priority.High) # make sure we are running and if not give it a kick - self.process_updates() + self.processUpdates() while image.image is None: - log.debug(u'get_image - waiting') + log.debug(u'getImage - waiting') time.sleep(0.1) elif image.image_bytes is None: # Set the priority to Low, because the image was requested but the # byte stream was not generated yet. However, we only need to do # this, when the image was generated before it was requested # (otherwise this is already taken care of). - self._conversion_queue.modify_priority(image, Priority.Low) + self._conversionQueue.modify_priority(image, Priority.Low) return image.image - def get_image_bytes(self, name): + def getImageBytes(self, name): """ Returns the byte string for an image. If not present wait for the background thread to process it. """ - log.debug(u'get_image_bytes %s' % name) + log.debug(u'getImageBytes %s' % name) image = self._cache[name] if image.image_bytes is None: - self._conversion_queue.modify_priority(image, Priority.Urgent) + self._conversionQueue.modify_priority(image, Priority.Urgent) # make sure we are running and if not give it a kick - self.process_updates() + self.processUpdates() while image.image_bytes is None: - log.debug(u'get_image_bytes - waiting') + log.debug(u'getImageBytes - waiting') time.sleep(0.1) return image.image_bytes - def del_image(self, name): + def deleteImage(self, name): """ Delete the Image from the cache. """ - log.debug(u'del_image %s' % name) + log.debug(u'deleteImage %s' % name) if name in self._cache: - self._conversion_queue.remove(self._cache[name]) + self._conversionQueue.remove(self._cache[name]) del self._cache[name] - def add_image(self, name, path, source, background): + def addImage(self, name, path, source, background): """ Add image to cache if it is not already there. """ - log.debug(u'add_image %s:%s' % (name, path)) + log.debug(u'addImage %s:%s' % (name, path)) if not name in self._cache: image = Image(name, path, source, background) self._cache[name] = image - self._conversion_queue.put( + self._conversionQueue.put( (image.priority, image.secondary_priority, image)) else: log.debug(u'Image in cache %s:%s' % (name, path)) @@ -291,16 +291,16 @@ class ImageManager(QtCore.QObject): Controls the processing called from a ``QtCore.QThread``. """ log.debug(u'_process - started') - while not self._conversion_queue.empty() and not self.stop_manager: - self._process_cache() + while not self._conversionQueue.empty() and not self.stopManager: + self._processCache() log.debug(u'_process - ended') - def _process_cache(self): + def _processCache(self): """ Actually does the work. """ - log.debug(u'_process_cache') - image = self._conversion_queue.get()[2] + log.debug(u'_processCache') + image = self._conversionQueue.get()[2] # Generate the QImage for the image. if image.image is None: image.image = resize_image(image.path, self.width, self.height, @@ -308,14 +308,14 @@ class ImageManager(QtCore.QObject): # Set the priority to Lowest and stop here as we need to process # more important images first. if image.priority == Priority.Normal: - self._conversion_queue.modify_priority(image, Priority.Lowest) + self._conversionQueue.modify_priority(image, Priority.Lowest) return # For image with high priority we set the priority to Low, as the # byte stream might be needed earlier the byte stream of image with # Normal priority. We stop here as we need to process more important # images first. elif image.priority == Priority.High: - self._conversion_queue.modify_priority(image, Priority.Low) + self._conversionQueue.modify_priority(image, Priority.Low) return # Generate the byte stream for the image. if image.image_bytes is None: diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 9705e13df..e782585d0 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -132,7 +132,7 @@ class Renderer(object): """ # if No file do not update cache if temp_theme.background_filename: - self.imageManager.add_image(temp_theme.theme_name, + self.imageManager.addImage(temp_theme.theme_name, temp_theme.background_filename, u'theme', QtGui.QColor(temp_theme.background_border_color)) @@ -204,7 +204,7 @@ class Renderer(object): # make big page for theme edit dialog to get line count serviceItem.add_from_text(u'', VERSE_FOR_LINE_COUNT) else: - self.imageManager.del_image(theme_data.theme_name) + self.imageManager.deleteImage(theme_data.theme_name) serviceItem.add_from_text(u'', VERSE) serviceItem.renderer = self serviceItem.raw_footer = FOOTER diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 36314ac7f..0cf5626ff 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -211,7 +211,7 @@ class ServiceItem(object): self.image_border = background self.service_item_type = ServiceItemType.Image self._raw_frames.append({u'title': title, u'path': path}) - self.renderer.imageManager.add_image(title, path, u'image', + self.renderer.imageManager.addImage(title, path, u'image', self.image_border) self._new_item() diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index a04203387..b642240a3 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -277,7 +277,7 @@ class MainDisplay(Display): """ API for replacement backgrounds so Images are added directly to cache. """ - self.imageManager.add_image(name, path, u'image', background) + self.imageManager.addImage(name, path, u'image', background) if hasattr(self, u'serviceItem'): self.override[u'image'] = name self.override[u'theme'] = self.serviceItem.themedata.theme_name @@ -297,7 +297,7 @@ class MainDisplay(Display): The name of the image to be displayed. """ log.debug(u'image to display') - image = self.imageManager.get_image_bytes(name) + image = self.imageManager.getImageBytes(name) self.controller.mediaController.video_reset(self.controller) self.displayImage(image) @@ -382,14 +382,14 @@ class MainDisplay(Display): else: # replace the background background = self.imageManager. \ - get_image_bytes(self.override[u'image']) + getImageBytes(self.override[u'image']) self.setTransparency(self.serviceItem.themedata.background_type == BackgroundType.to_string(BackgroundType.Transparent)) if self.serviceItem.themedata.background_filename: self.serviceItem.bg_image_bytes = self.imageManager. \ - get_image_bytes(self.serviceItem.themedata.theme_name) + getImageBytes(self.serviceItem.themedata.theme_name) if image: - image_bytes = self.imageManager.get_image_bytes(image) + image_bytes = self.imageManager.getImageBytes(image) else: image_bytes = None html = build_html(self.serviceItem, self.screen, self.isLive, diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 85c5d6838..3923cad26 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -1122,7 +1122,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): """ log.debug(u'screenChanged') Receiver.send_message(u'cursor_busy') - self.imageManager.update_display() + self.imageManager.updateDisplay() self.renderer.update_display() self.previewController.screenSizeChanged() self.liveController.screenSizeChanged() @@ -1182,7 +1182,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): ``save_settings`` Switch to prevent saving settings. Defaults to **True**. """ - self.imageManager.stop_manager = True + self.imageManager.stopManager = True while self.imageManager.imageThread.isRunning(): time.sleep(0.1) # Clean temporary files used by services diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 4224222ca..f9e5656c5 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -859,8 +859,8 @@ class SlideController(Controller): # If current slide set background to image if framenumber == slideno: self.serviceItem.bg_image_bytes = \ - self.imageManager.get_image_bytes(frame[u'title']) - image = self.imageManager.get_image(frame[u'title']) + self.imageManager.getImageBytes(frame[u'title']) + image = self.imageManager.getImage(frame[u'title']) label.setPixmap(QtGui.QPixmap.fromImage(image)) self.previewListWidget.setCellWidget(framenumber, 0, label) slideHeight = width * self.parent().renderer.screen_ratio diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index ea18379e2..09b54fc07 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -664,9 +664,9 @@ class ThemeManager(QtGui.QWidget): self._writeTheme(theme, image_from, image_to) if theme.background_type == \ BackgroundType.to_string(BackgroundType.Image): - self.mainwindow.imageManager.update_image(theme.theme_name, + self.mainwindow.imageManager.updateImage(theme.theme_name, u'theme', QtGui.QColor(theme.background_border_color)) - self.mainwindow.imageManager.process_updates() + self.mainwindow.imageManager.processUpdates() self.loadThemes() def _writeTheme(self, theme, image_from, image_to): diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index 53f825916..a72eab1af 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -96,4 +96,4 @@ class ImagePlugin(Plugin): """ background = QtGui.QColor(QtCore.QSettings().value(self.settingsSection + u'/background color', QtCore.QVariant(u'#000000'))) - self.liveController.imageManager.update_images(u'image', background) + self.liveController.imageManager.updateImages(u'image', background)