Fix theme loading logic and missing item from cleaning

This commit is contained in:
Jon Tibble 2009-11-12 23:49:35 +00:00
parent b6eadecb46
commit b79d535e04
2 changed files with 8 additions and 4 deletions

View File

@ -184,7 +184,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
def loadTheme(self, theme): def loadTheme(self, theme):
log.debug(u'LoadTheme %s', theme) log.debug(u'LoadTheme %s', theme)
self.theme = self.thememanager.getThemeData(theme) self.theme = theme
# Stop the initial screen setup generating 1 preview per field! # Stop the initial screen setup generating 1 preview per field!
self.allowPreview = False self.allowPreview = False
self.paintUi(self.theme) self.paintUi(self.theme)

View File

@ -150,15 +150,17 @@ class ThemeManager(QtGui.QWidget):
self.pushThemes() self.pushThemes()
def onAddTheme(self): def onAddTheme(self):
self.amendThemeForm.loadTheme(None) theme = self.createThemeFromXml(self.baseTheme(), self.path)
self.amendThemeForm.loadTheme(theme)
self.saveThemeName = u'' self.saveThemeName = u''
self.amendThemeForm.exec_() self.amendThemeForm.exec_()
def onEditTheme(self): def onEditTheme(self):
item = self.ThemeListWidget.currentItem() item = self.ThemeListWidget.currentItem()
if item: if item:
self.amendThemeForm.loadTheme( theme = self.getThemeData(
unicode(item.data(QtCore.Qt.UserRole).toString())) unicode(item.data(QtCore.Qt.UserRole).toString()))
self.amendThemeForm.loadTheme(theme)
self.saveThemeName = unicode( self.saveThemeName = unicode(
item.data(QtCore.Qt.UserRole).toString()) item.data(QtCore.Qt.UserRole).toString())
self.amendThemeForm.exec_() self.amendThemeForm.exec_()
@ -501,6 +503,8 @@ class ThemeManager(QtGui.QWidget):
theme.display_wrapStyle = theme.display_wrapStyle.strip() theme.display_wrapStyle = theme.display_wrapStyle.strip()
theme.font_footer_color = theme.font_footer_color.strip() theme.font_footer_color = theme.font_footer_color.strip()
theme.font_footer_height = int(theme.font_footer_height.strip()) theme.font_footer_height = int(theme.font_footer_height.strip())
theme.font_footer_indentation = \
int(theme.font_footer_indentation.strip())
theme.font_footer_italics = str_to_bool(theme.font_footer_italics) theme.font_footer_italics = str_to_bool(theme.font_footer_italics)
theme.font_footer_name = theme.font_footer_name.strip() theme.font_footer_name = theme.font_footer_name.strip()
#theme.font_footer_override #theme.font_footer_override