From 5b724f366ed6727f5a0b7cc50d5463efa48f9757 Mon Sep 17 00:00:00 2001 From: mailchuck Date: Thu, 12 Nov 2015 00:33:57 +0100 Subject: [PATCH] Prepare for tree widgets to store settings Precursor for #12 --- src/bitmessageqt/bitmessageui.py | 6 +++--- src/bitmessageqt/foldertree.py | 3 ++- src/bitmessageqt/settingsmixin.py | 14 +++++++++++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/bitmessageqt/bitmessageui.py b/src/bitmessageqt/bitmessageui.py index 269ec099..230104b3 100644 --- a/src/bitmessageqt/bitmessageui.py +++ b/src/bitmessageqt/bitmessageui.py @@ -59,7 +59,7 @@ class Ui_MainWindow(object): self.verticalSplitter_12 = settingsmixin.SSplitter() self.verticalSplitter_12.setObjectName(_fromUtf8("verticalSplitter_12")) self.verticalSplitter_12.setOrientation(QtCore.Qt.Vertical) - self.treeWidgetYourIdentities = QtGui.QTreeWidget(self.inbox) + self.treeWidgetYourIdentities = settingsmixin.STreeWidget(self.inbox) self.treeWidgetYourIdentities.setObjectName(_fromUtf8("treeWidgetYourIdentities")) self.treeWidgetYourIdentities.resize(200, self.treeWidgetYourIdentities.height()) icon1 = QtGui.QIcon() @@ -361,7 +361,7 @@ class Ui_MainWindow(object): self.verticalSplitter_3 = settingsmixin.SSplitter() self.verticalSplitter_3.setObjectName(_fromUtf8("verticalSplitter_3")) self.verticalSplitter_3.setOrientation(QtCore.Qt.Vertical) - self.treeWidgetSubscriptions = QtGui.QTreeWidget(self.subscriptions) + self.treeWidgetSubscriptions = settingsmixin.STreeWidget(self.subscriptions) self.treeWidgetSubscriptions.setAlternatingRowColors(True) self.treeWidgetSubscriptions.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) self.treeWidgetSubscriptions.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) @@ -458,7 +458,7 @@ class Ui_MainWindow(object): self.verticalSplitter_17 = settingsmixin.SSplitter() self.verticalSplitter_17.setObjectName(_fromUtf8("verticalSplitter_17")) self.verticalSplitter_17.setOrientation(QtCore.Qt.Vertical) - self.treeWidgetChans = QtGui.QTreeWidget(self.chans) + self.treeWidgetChans = settingsmixin.STreeWidget(self.chans) self.treeWidgetChans.setFrameShadow(QtGui.QFrame.Sunken) self.treeWidgetChans.setLineWidth(1) self.treeWidgetChans.setAlternatingRowColors(True) diff --git a/src/bitmessageqt/foldertree.py b/src/bitmessageqt/foldertree.py index c27cf6c5..59f16667 100644 --- a/src/bitmessageqt/foldertree.py +++ b/src/bitmessageqt/foldertree.py @@ -2,6 +2,7 @@ from PyQt4 import QtCore, QtGui from utils import * import shared +from settingsmixin import SettingsMixin class AccountMixin (object): def accountColor (self): @@ -116,7 +117,7 @@ class Ui_FolderWidget(QtGui.QTreeWidgetItem, AccountMixin): return super(QtGui.QTreeWidgetItem, self).__lt__(other) -class Ui_AddressWidget(QtGui.QTreeWidgetItem, AccountMixin): +class Ui_AddressWidget(QtGui.QTreeWidgetItem, AccountMixin, SettingsMixin): def __init__(self, parent, pos = 0, address = "", unreadCount = 0, enabled = True): super(QtGui.QTreeWidgetItem, self).__init__() parent.insertTopLevelItem(pos, self) diff --git a/src/bitmessageqt/settingsmixin.py b/src/bitmessageqt/settingsmixin.py index 75822fa4..c534d1b5 100644 --- a/src/bitmessageqt/settingsmixin.py +++ b/src/bitmessageqt/settingsmixin.py @@ -64,4 +64,16 @@ class SSplitter(QtGui.QSplitter, SettingsMixin): self.readState(self) def saveSettings(self): - self.writeState(self) \ No newline at end of file + self.writeState(self) + + +class STreeWidget(QtGui.QTreeWidget, SettingsMixin): + def loadSettings(self): + #recurse children + #self.readState(self) + pass + + def saveSettings(self): + #recurse children + #self.writeState(self) + pass