From 17d74a8d9ab04484966aa19a969f61312a0fb019 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 28 Apr 2011 19:13:19 +0100 Subject: [PATCH 1/7] Add Load service Progress Bar --- openlp/core/ui/mainwindow.py | 58 ++++++++++++++++++++++++++------ openlp/core/ui/servicemanager.py | 3 ++ openlp/core/utils/__init__.py | 13 +++++++ 3 files changed, 64 insertions(+), 10 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index cb01e37a1..0ea847248 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -38,7 +38,7 @@ from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \ ThemeManager, SlideController, PluginForm, MediaDockManager, \ ShortcutListForm, DisplayTagForm from openlp.core.utils import AppLocation, add_actions, LanguageManager, \ - get_application_version + get_application_version, LoadSleepThread from openlp.core.utils.actions import ActionList, CategoryOrder log = logging.getLogger(__name__) @@ -122,12 +122,17 @@ class Ui_MainWindow(object): self.HelpMenu = QtGui.QMenu(self.MenuBar) self.HelpMenu.setObjectName(u'HelpMenu') mainWindow.setMenuBar(self.MenuBar) - self.StatusBar = QtGui.QStatusBar(mainWindow) - self.StatusBar.setObjectName(u'StatusBar') - mainWindow.setStatusBar(self.StatusBar) - self.DefaultThemeLabel = QtGui.QLabel(self.StatusBar) - self.DefaultThemeLabel.setObjectName(u'DefaultThemeLabel') - self.StatusBar.addPermanentWidget(self.DefaultThemeLabel) + self.statusBar = QtGui.QStatusBar(mainWindow) + self.statusBar.setObjectName(u'statusBar') + mainWindow.setStatusBar(self.statusBar) + self.loadProgressBar = QtGui.QProgressBar(self.statusBar) + self.loadProgressBar.setObjectName(u'loadProgressBar') + self.statusBar.addPermanentWidget(self.loadProgressBar) + self.statusBar.removeWidget(self.loadProgressBar) + self.loadProgressBar.setValue(0) + self.defaultThemeLabel = QtGui.QLabel(self.statusBar) + self.defaultThemeLabel.setObjectName(u'defaultThemeLabel') + self.statusBar.addPermanentWidget(self.defaultThemeLabel) # Create the MediaManager self.mediaManagerDock = OpenLPDockWidget(mainWindow, u'mediaManagerDock', u':/system/system_mediamanager.png') @@ -544,6 +549,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_information_message'), self.onInformationMessage) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'mainwindow_remove_progress'), + self.removeProgressBar) # warning cyclic dependency # RenderManager needs to call ThemeManager and # ThemeManager needs to call RenderManager @@ -880,10 +888,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.setWindowTitle(title) def showStatusMessage(self, message): - self.StatusBar.showMessage(message) + self.statusBar.showMessage(message) def defaultThemeChanged(self, theme): - self.DefaultThemeLabel.setText( + self.defaultThemeLabel.setText( unicode(translate('OpenLP.MainWindow', 'Default Theme: %s')) % theme) @@ -979,7 +987,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): for fileId, filename in enumerate(recentFilesToDisplay): log.debug('Recent file name: %s', filename) action = base_action(self, u'') - action.setText(u'&%d %s' % + action.setText(u'&%d %s' % (fileId + 1, QtCore.QFileInfo(filename).fileName())) action.setData(QtCore.QVariant(filename)) self.connect(action, QtCore.SIGNAL(u'triggered()'), @@ -1008,3 +1016,33 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): while self.recentFiles.count() > maxRecentFiles: # Don't care what API says takeLast works, removeLast doesn't! self.recentFiles.takeLast() + + def displayProgressBar(self, size): + """ + Make Progress bar visible and set size + """ + self.statusBar.addWidget(self.loadProgressBar) + self.loadProgressBar.show() + self.loadProgressBar.setMaximum(size) + self.loadProgressBar.setValue(0) + Receiver.send_message(u'openlp_process_events') + + def incrementProgressBar(self): + """ + Increase the Progress Bar Value by 1 + """ + self.loadProgressBar.setValue(self.loadProgressBar.value() + 1) + Receiver.send_message(u'openlp_process_events') + + def finishedProgressBar(self): + """ + Trigger it's removal after 1 second + """ + LoadSleepThread(self).start() + + def removeProgressBar(self): + """ + Remove the Progress bar from view. + """ + self.statusBar.removeWidget(self.loadProgressBar) + Receiver.send_message(u'openlp_process_events') diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index a2260cce9..dbeaf870d 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -576,7 +576,9 @@ class ServiceManager(QtGui.QWidget): items = cPickle.load(fileTo) fileTo.close() self.newFile() + self.mainwindow.displayProgressBar(len(items)) for item in items: + self.mainwindow.incrementProgressBar() serviceItem = ServiceItem() serviceItem.from_service = True serviceItem.render_manager = self.mainwindow.renderManager @@ -592,6 +594,7 @@ class ServiceManager(QtGui.QWidget): self.setModified(False) QtCore.QSettings().setValue( 'service/last file', QtCore.QVariant(fileName)) + self.mainwindow.finishedProgressBar() Receiver.send_message(u'cursor_normal') else: critical_error_message_box( diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 1bc7037ae..fa1ebf68a 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -100,6 +100,19 @@ class VersionThread(QtCore.QThread): remote_version[u'revision'] > local_version[u'revision']: Receiver.send_message(u'openlp_version_check', u'%s' % version) +class LoadSleepThread(QtCore.QThread): + """ + A special Qt thread class sleep then remove the load progress bar + """ + def __init__(self, parent): + QtCore.QThread.__init__(self, parent) + + def run(self): + """ + Run the thread. + """ + time.sleep(1) + Receiver.send_message(u'mainwindow_remove_progress') class AppLocation(object): """ From 188431ce37b092f0382248ec665a71c6deb29f81 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 29 Apr 2011 07:21:31 +0100 Subject: [PATCH 2/7] Fix up Service Save --- openlp/core/ui/servicemanager.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index fe5e57db3..24cf5c936 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -460,7 +460,11 @@ class ServiceManager(QtGui.QWidget): service = [] write_list = [] total_size = 0 + Receiver.send_message(u'cursor_busy') + # Number if items + 1 to zip it + self.mainwindow.displayProgressBar(len(self.serviceItems) + 1) for item in self.serviceItems: + self.mainwindow.incrementProgressBar() service.append({u'serviceitem': item[u'service_item'].get_service_repr()}) if not item[u'service_item'].uses_file(): @@ -501,6 +505,7 @@ class ServiceManager(QtGui.QWidget): log.debug(u'ServiceManager.saveFile - allowZip64 is %s' % allow_zip_64) zip = None success = True + self.mainwindow.incrementProgressBar() try: zip = zipfile.ZipFile(path_file_name, 'w', zipfile.ZIP_STORED, allow_zip_64) @@ -516,6 +521,8 @@ class ServiceManager(QtGui.QWidget): finally: if zip: zip.close() + self.mainwindow.finishedProgressBar() + Receiver.send_message(u'cursor_normal') if success: self.mainwindow.addRecentFile(path_file_name) self.setModified(False) From 34838aba06226fce103cd07801467ccfb7b4ce2e Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 29 Apr 2011 08:10:22 +0100 Subject: [PATCH 3/7] Fix up Presentation and Image Imports --- openlp/plugins/images/lib/mediaitem.py | 7 ++++++- openlp/plugins/presentations/lib/mediaitem.py | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 298e701e3..a2dd292d5 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -108,7 +108,10 @@ class ImageMediaItem(MediaManagerItem): self.settingsSection, self.getFileList()) def loadList(self, list): + Receiver.send_message(u'cursor_busy') + self.parent.formparent.displayProgressBar(len(list)) for imageFile in list: + self.parent.formparent.incrementProgressBar() filename = os.path.split(unicode(imageFile))[1] thumb = os.path.join(self.servicePath, filename) if os.path.exists(thumb): @@ -122,6 +125,8 @@ class ImageMediaItem(MediaManagerItem): item_name.setIcon(icon) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(imageFile)) self.listView.addItem(item_name) + Receiver.send_message(u'cursor_normal') + self.parent.formparent.finishedProgressBar() def generateSlideData(self, service_item, item=None, xmlVersion=False): items = self.listView.selectedIndexes() @@ -201,4 +206,4 @@ class ImageMediaItem(MediaManagerItem): critical_error_message_box(UiStrings().LiveBGError, unicode(translate('ImagePlugin.MediaItem', 'There was a problem replacing your background, ' - 'the image file "%s" no longer exists.')) % filename) \ No newline at end of file + 'the image file "%s" no longer exists.')) % filename) diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index 74ff3fea8..45b8b81c4 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -158,7 +158,10 @@ class PresentationMediaItem(MediaManagerItem): titles = [] for file in currlist: titles.append(os.path.split(file)[1]) + Receiver.send_message(u'cursor_busy') + self.parent.formparent.displayProgressBar(len(list)) for file in list: + self.parent.formparent.incrementProgressBar() if currlist.count(file) > 0: continue filename = os.path.split(unicode(file))[1] @@ -198,6 +201,8 @@ class PresentationMediaItem(MediaManagerItem): item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(file)) item_name.setIcon(icon) self.listView.addItem(item_name) + Receiver.send_message(u'cursor_normal') + self.parent.formparent.finishedProgressBar() def onDeleteClick(self): """ @@ -296,4 +301,4 @@ class PresentationMediaItem(MediaManagerItem): if self.controllers[controller].enabled(): if filetype in self.controllers[controller].alsosupports: return controller - return None \ No newline at end of file + return None From f83d52621ad0bd2b77574e6159982af722cf6db8 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 29 Apr 2011 08:40:19 +0100 Subject: [PATCH 4/7] Fixes --- openlp/core/ui/mainwindow.py | 24 ++++++++++++------------ openlp/core/ui/servicemanager.py | 2 +- openlp/core/utils/__init__.py | 13 ------------- 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 672fa9c44..311aa7ec0 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -38,7 +38,7 @@ from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \ ThemeManager, SlideController, PluginForm, MediaDockManager, \ ShortcutListForm, DisplayTagForm from openlp.core.utils import AppLocation, add_actions, LanguageManager, \ - get_application_version, LoadSleepThread + get_application_version from openlp.core.utils.actions import ActionList, CategoryOrder log = logging.getLogger(__name__) @@ -128,7 +128,7 @@ class Ui_MainWindow(object): self.loadProgressBar = QtGui.QProgressBar(self.statusBar) self.loadProgressBar.setObjectName(u'loadProgressBar') self.statusBar.addPermanentWidget(self.loadProgressBar) - self.statusBar.removeWidget(self.loadProgressBar) + self.loadProgressBar.hide() self.loadProgressBar.setValue(0) self.defaultThemeLabel = QtGui.QLabel(self.statusBar) self.defaultThemeLabel.setObjectName(u'defaultThemeLabel') @@ -549,9 +549,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_information_message'), self.onInformationMessage) - QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'mainwindow_remove_progress'), - self.removeProgressBar) +# QtCore.QObject.connect(Receiver.get_receiver(), +# QtCore.SIGNAL(u'mainwindow_remove_progress'), +# self.removeProgressBar) # warning cyclic dependency # renderer needs to call ThemeManager and # ThemeManager needs to call Renderer @@ -1021,7 +1021,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): """ Make Progress bar visible and set size """ - self.statusBar.addWidget(self.loadProgressBar) self.loadProgressBar.show() self.loadProgressBar.setMaximum(size) self.loadProgressBar.setValue(0) @@ -1029,20 +1028,21 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): def incrementProgressBar(self): """ - Increase the Progress Bar Value by 1 + Increase the Progress Bar value by 1 """ self.loadProgressBar.setValue(self.loadProgressBar.value() + 1) Receiver.send_message(u'openlp_process_events') def finishedProgressBar(self): """ - Trigger it's removal after 1 second + Trigger it's removal after 2.5 second """ - LoadSleepThread(self).start() + self.timer_id = self.startTimer(2500) - def removeProgressBar(self): + def timerEvent(self, event): """ Remove the Progress bar from view. """ - self.statusBar.removeWidget(self.loadProgressBar) - Receiver.send_message(u'openlp_process_events') + if event.timerId() == self.timer_id: + self.loadProgressBar.hide() + Receiver.send_message(u'openlp_process_events') diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 24cf5c936..9ad527826 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -461,7 +461,7 @@ class ServiceManager(QtGui.QWidget): write_list = [] total_size = 0 Receiver.send_message(u'cursor_busy') - # Number if items + 1 to zip it + # Number of items + 1 to zip it self.mainwindow.displayProgressBar(len(self.serviceItems) + 1) for item in self.serviceItems: self.mainwindow.incrementProgressBar() diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index fa1ebf68a..1bc7037ae 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -100,19 +100,6 @@ class VersionThread(QtCore.QThread): remote_version[u'revision'] > local_version[u'revision']: Receiver.send_message(u'openlp_version_check', u'%s' % version) -class LoadSleepThread(QtCore.QThread): - """ - A special Qt thread class sleep then remove the load progress bar - """ - def __init__(self, parent): - QtCore.QThread.__init__(self, parent) - - def run(self): - """ - Run the thread. - """ - time.sleep(1) - Receiver.send_message(u'mainwindow_remove_progress') class AppLocation(object): """ From 7908ac4f6742ea308a2e7f688cf73ee4f338a5c7 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 29 Apr 2011 09:45:36 +0100 Subject: [PATCH 5/7] Fix large Service Files --- openlp/core/lib/mediamanageritem.py | 2 +- openlp/core/ui/servicemanager.py | 13 ++++++++----- openlp/plugins/images/lib/mediaitem.py | 13 ++++++++----- openlp/plugins/presentations/lib/mediaitem.py | 9 ++++++--- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index e7d7bc4ec..8b63963a0 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -554,4 +554,4 @@ class MediaManagerItem(QtGui.QWidget): item_id = remoteItem else: item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] - return item_id \ No newline at end of file + return item_id diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 9ad527826..8b3e63e4f 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -591,7 +591,7 @@ class ServiceManager(QtGui.QWidget): serviceItem.renderer = self.mainwindow.renderer serviceItem.set_from_service(item, self.servicePath) self.validateItem(serviceItem) - self.addServiceItem(serviceItem) + self.addServiceItem(serviceItem, repaint=False) if serviceItem.is_capable(ItemCapabilities.OnLoadUpdate): Receiver.send_message(u'%s_service_load' % serviceItem.name.lower(), serviceItem) @@ -601,8 +601,6 @@ class ServiceManager(QtGui.QWidget): self.setModified(False) QtCore.QSettings().setValue( 'service/last file', QtCore.QVariant(fileName)) - self.mainwindow.finishedProgressBar() - Receiver.send_message(u'cursor_normal') else: critical_error_message_box( message=translate('OpenLP.ServiceManager', @@ -633,6 +631,9 @@ class ServiceManager(QtGui.QWidget): fileTo.close() if zip: zip.close() + self.mainwindow.finishedProgressBar() + Receiver.send_message(u'cursor_normal') + self.repaintServiceList(-1, -1) def loadLastFile(self): """ @@ -1066,7 +1067,8 @@ class ServiceManager(QtGui.QWidget): newItem) self.setModified() - def addServiceItem(self, item, rebuild=False, expand=None, replace=False): + def addServiceItem(self, item, rebuild=False, expand=None, replace=False, + repaint=True): """ Add a Service item to the list @@ -1099,7 +1101,8 @@ class ServiceManager(QtGui.QWidget): self.serviceItems.append({u'service_item': item, u'order': len(self.serviceItems) + 1, u'expanded': expand}) - self.repaintServiceList(len(self.serviceItems) - 1, -1) + if repaint: + self.repaintServiceList(len(self.serviceItems) - 1, -1) else: self.serviceItems.insert(self.dropPosition, {u'service_item': item, u'order': self.dropPosition, diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index a2dd292d5..68da7fbe1 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -77,7 +77,7 @@ class ImageMediaItem(MediaManagerItem): u'thumbnails') check_directory_exists(self.servicePath) self.loadList(SettingsManager.load_list( - self.settingsSection, self.settingsSection)) + self.settingsSection, self.settingsSection), True) def addListViewToToolBar(self): MediaManagerItem.addListViewToToolBar(self) @@ -107,11 +107,13 @@ class ImageMediaItem(MediaManagerItem): SettingsManager.set_list(self.settingsSection, self.settingsSection, self.getFileList()) - def loadList(self, list): + def loadList(self, list, initialLoad=False): Receiver.send_message(u'cursor_busy') - self.parent.formparent.displayProgressBar(len(list)) + if not initialLoad: + self.parent.formparent.displayProgressBar(len(list)) for imageFile in list: - self.parent.formparent.incrementProgressBar() + if not initialLoad: + self.parent.formparent.incrementProgressBar() filename = os.path.split(unicode(imageFile))[1] thumb = os.path.join(self.servicePath, filename) if os.path.exists(thumb): @@ -126,7 +128,8 @@ class ImageMediaItem(MediaManagerItem): item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(imageFile)) self.listView.addItem(item_name) Receiver.send_message(u'cursor_normal') - self.parent.formparent.finishedProgressBar() + if not initialLoad: + self.parent.formparent.finishedProgressBar() def generateSlideData(self, service_item, item=None, xmlVersion=False): items = self.listView.selectedIndexes() diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index 45b8b81c4..455d42a72 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -159,9 +159,11 @@ class PresentationMediaItem(MediaManagerItem): for file in currlist: titles.append(os.path.split(file)[1]) Receiver.send_message(u'cursor_busy') - self.parent.formparent.displayProgressBar(len(list)) + if not initialLoad: + self.parent.formparent.displayProgressBar(len(list)) for file in list: - self.parent.formparent.incrementProgressBar() + if not initialLoad: + self.parent.formparent.incrementProgressBar() if currlist.count(file) > 0: continue filename = os.path.split(unicode(file))[1] @@ -202,7 +204,8 @@ class PresentationMediaItem(MediaManagerItem): item_name.setIcon(icon) self.listView.addItem(item_name) Receiver.send_message(u'cursor_normal') - self.parent.formparent.finishedProgressBar() + if not initialLoad: + self.parent.formparent.finishedProgressBar() def onDeleteClick(self): """ From e4c0d1227e7c8aa970f1e8b3dda03b528fe83620 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 29 Apr 2011 09:54:11 +0100 Subject: [PATCH 6/7] Fix timer --- openlp/core/ui/mainwindow.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 311aa7ec0..a8ffa2b9e 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -1044,5 +1044,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): Remove the Progress bar from view. """ if event.timerId() == self.timer_id: + self.timer_id = 0 self.loadProgressBar.hide() Receiver.send_message(u'openlp_process_events') From acb4f12ac9f9e71164502469625998104a57b155 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 29 Apr 2011 10:07:41 +0100 Subject: [PATCH 7/7] remove comments --- openlp/core/ui/mainwindow.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index a8ffa2b9e..aadc1c175 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -549,9 +549,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_information_message'), self.onInformationMessage) -# QtCore.QObject.connect(Receiver.get_receiver(), -# QtCore.SIGNAL(u'mainwindow_remove_progress'), -# self.removeProgressBar) # warning cyclic dependency # renderer needs to call ThemeManager and # ThemeManager needs to call Renderer