This commit is contained in:
Tim Bentley 2012-09-06 17:38:54 +01:00
commit 9d692af5b9
2 changed files with 9 additions and 16 deletions

View File

@ -281,9 +281,9 @@ class ThemeManager(QtGui.QWidget):
for plugin in self.mainwindow.pluginManager.plugins: for plugin in self.mainwindow.pluginManager.plugins:
if plugin.usesTheme(old_theme_name): if plugin.usesTheme(old_theme_name):
plugin.renameTheme(old_theme_name, new_theme_name) plugin.renameTheme(old_theme_name, new_theme_name)
self.loadThemes()
self.mainwindow.renderer.update_theme( self.mainwindow.renderer.update_theme(
new_theme_name, old_theme_name) new_theme_name, old_theme_name)
self.loadThemes()
def onCopyTheme(self): def onCopyTheme(self):
""" """
@ -314,6 +314,7 @@ class ThemeManager(QtGui.QWidget):
theme_data.theme_name = new_theme_name theme_data.theme_name = new_theme_name
theme_data.extend_image_filename(self.path) theme_data.extend_image_filename(self.path)
self.saveTheme(theme_data, save_from, save_to) self.saveTheme(theme_data, save_from, save_to)
self.loadThemes()
def onEditTheme(self): def onEditTheme(self):
""" """
@ -331,6 +332,7 @@ class ThemeManager(QtGui.QWidget):
self.themeForm.exec_(True) self.themeForm.exec_(True)
self.oldBackgroundImage = None self.oldBackgroundImage = None
self.mainwindow.renderer.update_theme(theme.theme_name) self.mainwindow.renderer.update_theme(theme.theme_name)
self.loadThemes()
def onDeleteTheme(self): def onDeleteTheme(self):
""" """
@ -345,10 +347,10 @@ class ThemeManager(QtGui.QWidget):
row = self.themeListWidget.row(item) row = self.themeListWidget.row(item)
self.themeListWidget.takeItem(row) self.themeListWidget.takeItem(row)
self.deleteTheme(theme) self.deleteTheme(theme)
self.mainwindow.renderer.update_theme(theme, only_delete=True)
# 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):
""" """
@ -672,7 +674,6 @@ class ThemeManager(QtGui.QWidget):
theme.background_filename, theme.background_filename,
ImageSource.Theme, QtGui.QColor(theme.background_border_color)) ImageSource.Theme, QtGui.QColor(theme.background_border_color))
self.mainwindow.imageManager.processUpdates() self.mainwindow.imageManager.processUpdates()
self.loadThemes()
def _writeTheme(self, theme, image_from, image_to): def _writeTheme(self, theme, image_from, image_to):
""" """

View File

@ -208,24 +208,16 @@ class BibleManager(object):
def delete_bible(self, name): def delete_bible(self, name):
""" """
Delete a bible completly. Delete a bible completely.
``name`` ``name``
The name of the bible. The name of the bible.
""" """
log.debug(u'BibleManager.delete_bible("%s")', name) log.debug(u'BibleManager.delete_bible("%s")', name)
files = SettingsManager.get_files(self.settingsSection, bible = self.db_cache[name]
self.suffix) bible.session.close()
if u'alternative_book_names.sqlite' in files: bible.session = None
files.remove(u'alternative_book_names.sqlite') return delete_file(os.path.join(bible.path, bible.file))
for filename in files:
bible = BibleDB(self.parent, path=self.path, file=filename)
# Remove the bible files
if name == bible.get_name():
bible.session.close()
if delete_file(os.path.join(self.path, filename)):
return True
return False
def get_bibles(self): def get_bibles(self):
""" """