Mercurial > hg > Feedworm
changeset 120:e830fa1cc7a2 backend
re-enabled PreferencesDialog
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Sun, 21 Aug 2011 04:04:37 +0200 |
parents | 04a730f9d07d |
children | 510a5d00e98a |
files | MainWindow.py PreferencesDialog.py backend/sqlalchemy/Preferences.py |
diffstat | 3 files changed, 14 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/MainWindow.py Sun Aug 21 03:55:16 2011 +0200 +++ b/MainWindow.py Sun Aug 21 04:04:37 2011 +0200 @@ -4,7 +4,7 @@ from FeedEntryItemDelegate import FeedEntryItemDelegate from FeedEntryTableModel import FeedEntryTableModel from FeedSettings import FeedSettings -#from PreferencesDialog import PreferencesDialog +from PreferencesDialog import PreferencesDialog from PyQt4.QtCore import QUrl from PyQt4.QtGui import QApplication from PyQt4.QtGui import QMainWindow @@ -165,9 +165,8 @@ self._updateStatusBar(message) def showPreferences(self): - pass -# preferences = PreferencesDialog(self.session) -# preferences.exec_() + preferences = PreferencesDialog(self.backend) + preferences.exec_() def showFeedSettings(self): feedSettings = FeedSettings(self.session, self.selectedFeed)
--- a/PreferencesDialog.py Sun Aug 21 03:55:16 2011 +0200 +++ b/PreferencesDialog.py Sun Aug 21 04:04:37 2011 +0200 @@ -1,13 +1,12 @@ -from Preferences import Preferences from PyQt4 import QtGui from Ui_Preferences import Ui_Preferences class PreferencesDialog(QtGui.QDialog): - def __init__(self, session=None): + def __init__(self, backend=None): QtGui.QWidget.__init__(self, None) - self.session = session - self.preferences = Preferences(session) + self.backend = backend + self.preferences = backend.preferences() self.ui = Ui_Preferences() self.ui.setupUi(self) self.fillUi() @@ -77,10 +76,10 @@ def accept(self): self.storeProxySettings() - self.session.commit() + self.preferences.commit(); QtGui.QDialog.accept(self) def reject(self): - self.session.rollback() + self.preferences.rollback() QtGui.QDialog.reject(self)
--- a/backend/sqlalchemy/Preferences.py Sun Aug 21 03:55:16 2011 +0200 +++ b/backend/sqlalchemy/Preferences.py Sun Aug 21 04:04:37 2011 +0200 @@ -35,6 +35,12 @@ self.cache[key] = pref return pref + def commit(self): + self.session.commit() + + def rollback(self): + self.session.rollback() + def startMaximized(self): pref = self._cachedPreference(START_MAXIMIZED, False) return str2bool(pref.value)