clean ups

This commit is contained in:
Andreas Preikschat 2012-05-23 23:02:34 +02:00
parent 28930a9c32
commit 45a9b5f615
2 changed files with 8 additions and 4 deletions

View File

@ -93,7 +93,7 @@ class Renderer(object):
self.display.setup() self.display.setup()
self._calculate_default() self._calculate_default()
def update_theme(self, theme_name, old_theme_name=None): def update_theme(self, theme_name, old_theme_name=None, only_delete=False):
""" """
This method updates the theme in ``_theme_dimensions`` when a theme This method updates the theme in ``_theme_dimensions`` when a theme
has been edited or renamed. has been edited or renamed.
@ -104,13 +104,17 @@ class Renderer(object):
``old_theme_name`` ``old_theme_name``
The old theme name. Has only to be passed, when the theme has been The old theme name. Has only to be passed, when the theme has been
renamed. Defaults to *None*. renamed. Defaults to *None*.
``only_delete``
a
""" """
if old_theme_name is not None and \ if old_theme_name is not None and \
old_theme_name in self._theme_dimensions: old_theme_name in self._theme_dimensions:
del self._theme_dimensions[old_theme_name] del self._theme_dimensions[old_theme_name]
if theme_name in self._theme_dimensions: if theme_name in self._theme_dimensions:
del self._theme_dimensions[theme_name] del self._theme_dimensions[theme_name]
self._set_theme(theme_name) if not only_delete:
self._set_theme(theme_name)
def _set_theme(self, theme_name): def _set_theme(self, theme_name):
""" """
@ -233,7 +237,7 @@ class Renderer(object):
self.imageManager.add_image(theme_data.theme_name, self.imageManager.add_image(theme_data.theme_name,
theme_data.background_filename, u'theme', theme_data.background_filename, u'theme',
QtGui.QColor(theme_data.background_border_color)) QtGui.QColor(theme_data.background_border_color))
theme_data, main, footer = self.post_render(theme_data) theme_data, main, footer = self.pre_render(theme_data)
serviceItem.themedata = theme_data serviceItem.themedata = theme_data
serviceItem.main = main serviceItem.main = main
serviceItem.footer = footer serviceItem.footer = footer

View File

@ -349,6 +349,7 @@ class ThemeManager(QtGui.QWidget):
# As we do not reload the themes, push out the change. Reload the # As we do not reload the themes, push out the change. Reload the
# list as the internal lists and events need to be triggered. # list as the internal lists and events need to be triggered.
self._pushThemes() self._pushThemes()
self.mainwindow.renderer.update_theme(theme, only_delete=True)
def deleteTheme(self, theme): def deleteTheme(self, theme):
""" """
@ -668,7 +669,6 @@ class ThemeManager(QtGui.QWidget):
u'theme', QtGui.QColor(theme.background_border_color)) u'theme', QtGui.QColor(theme.background_border_color))
self.mainwindow.imageManager.process_updates() self.mainwindow.imageManager.process_updates()
self.loadThemes() self.loadThemes()
#self.mainwindow.renderer.update_theme()
def _writeTheme(self, theme, image_from, image_to): def _writeTheme(self, theme, image_from, image_to):
""" """