# HG changeset patch # User Dirk Olmes # Date 1313892277 -7200 # Node ID e830fa1cc7a2bfd4f733ad9ce32838b14b8a0e04 # Parent 04a730f9d07dea251721d4bf7ee448c2a7227fb8 re-enabled PreferencesDialog diff -r 04a730f9d07d -r e830fa1cc7a2 MainWindow.py --- 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) diff -r 04a730f9d07d -r e830fa1cc7a2 PreferencesDialog.py --- 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) diff -r 04a730f9d07d -r e830fa1cc7a2 backend/sqlalchemy/Preferences.py --- 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)