From d5743f12b95148b27118249e5bfd97eb7a35b40f Mon Sep 17 00:00:00 2001 From: mailchuck Date: Sun, 8 Nov 2015 21:44:02 +0100 Subject: [PATCH] More tabs resizable and save state Fixes #15 Addresses #12 --- src/bitmessageqt/__init__.py | 48 ++-- src/bitmessageqt/bitmessageui.py | 352 +++++++++++++++++++----------- src/bitmessageqt/settingsmixin.py | 69 ++++++ 3 files changed, 318 insertions(+), 151 deletions(-) create mode 100644 src/bitmessageqt/settingsmixin.py diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index ce5e3fc4..9bc69d79 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -36,6 +36,7 @@ from newchandialog import * from specialaddressbehavior import * from emailgateway import * from settings import * +import settingsmixin from about import * from help import * from iconglossary import * @@ -55,6 +56,7 @@ import subprocess import datetime from helper_sql import * import l10n +import types from utils import * from collections import OrderedDict from account import * @@ -73,7 +75,7 @@ def change_translation(locale): qtranslator.load(translationpath) QtGui.QApplication.installTranslator(qtranslator) -class MyForm(QtGui.QMainWindow): +class MyForm(settingsmixin.SMainWindow): # sound type constants SOUND_NONE = 0 @@ -701,9 +703,9 @@ class MyForm(QtGui.QMainWindow): QtCore.QObject.connect(self.ui.horizontalSliderTTL, QtCore.SIGNAL( "valueChanged(int)"), self.updateTTL) - - self.readSettings() - + + self.initSettings() + # Check to see whether we can connect to namecoin. Hide the 'Fetch Namecoin ID' button if we can't. try: options = {} @@ -2860,9 +2862,9 @@ class MyForm(QtGui.QMainWindow): if self.mmapp is not None: self.mmapp.unregister() - settings = QSettings("Bitmessage", "PyBitmessage") - settings.setValue("geometry", self.saveGeometry()) - settings.setValue("state", self.saveState()) +# settings = QSettings("Bitmessage", "PyBitmessage") +# settings.setValue("geometry", self.saveGeometry()) +# settings.setValue("state", self.saveState()) self.statusBar().showMessage(_translate( "MainWindow", "All done. Closing user interface...")) @@ -2883,6 +2885,13 @@ class MyForm(QtGui.QMainWindow): # minimize the application event.ignore() else: + # save state and geometry self and all widgets + self.saveSettings() + for attr, obj in self.ui.__dict__.iteritems(): + if hasattr(obj, "__class__") and isinstance(obj, settingsmixin.SettingsMixin): + saveMethod = getattr(obj, "saveSettings", None) + if callable (saveMethod): + obj.saveSettings() # quit the application event.accept() self.quit() @@ -3887,20 +3896,17 @@ class MyForm(QtGui.QMainWindow): self.statusBar().showMessage(data) - def readSettings(self): - settings = QSettings("Bitmessage", "PyBitmessage") - try: - geom = settings.value("geometry") - self.restoreGeometry(geom.toByteArray() if hasattr(geom, 'toByteArray') else geom) - except Exception as e: - pass - - try: - state = settings.value("state") - self.restoreState(state.toByteArray() if hasattr(state, 'toByteArray') else state) - except Exception as e: - pass - + def initSettings(self): + QtCore.QCoreApplication.setOrganizationName("PyBitmessage") + QtCore.QCoreApplication.setOrganizationDomain("bitmessage.org") + QtCore.QCoreApplication.setApplicationName("pybitmessageqt") + self.loadSettings() + for attr, obj in self.ui.__dict__.iteritems(): + if hasattr(obj, "__class__") and isinstance(obj, settingsmixin.SettingsMixin): + loadMethod = getattr(obj, "loadSettings", None) + if callable (loadMethod): + obj.loadSettings() + class helpDialog(QtGui.QDialog): diff --git a/src/bitmessageqt/bitmessageui.py b/src/bitmessageqt/bitmessageui.py index 26493241..0e719c17 100644 --- a/src/bitmessageqt/bitmessageui.py +++ b/src/bitmessageqt/bitmessageui.py @@ -8,6 +8,7 @@ # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui +import settingsmixin try: _fromUtf8 = QtCore.QString.fromUtf8 @@ -53,9 +54,9 @@ class Ui_MainWindow(object): self.inbox.setObjectName(_fromUtf8("inbox")) self.gridLayout = QtGui.QGridLayout(self.inbox) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) - self.horizontalSplitter_3 = QtGui.QSplitter() + self.horizontalSplitter_3 = settingsmixin.SSplitter() self.horizontalSplitter_3.setObjectName(_fromUtf8("horizontalSplitter_3")) - self.verticalSplitter_12 = QtGui.QSplitter() + 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) @@ -75,10 +76,10 @@ class Ui_MainWindow(object): self.verticalSplitter_12.setCollapsible(1, False) self.verticalSplitter_12.handle(1).setEnabled(False) self.horizontalSplitter_3.addWidget(self.verticalSplitter_12) - self.verticalSplitter_7 = QtGui.QSplitter() + self.verticalSplitter_7 = settingsmixin.SSplitter() self.verticalSplitter_7.setObjectName(_fromUtf8("verticalSplitter_7")) self.verticalSplitter_7.setOrientation(QtCore.Qt.Vertical) - self.horizontalSplitterSearch = QtGui.QSplitter() + self.horizontalSplitterSearch = settingsmixin.SSplitter() self.horizontalSplitterSearch.setObjectName(_fromUtf8("horizontalSplitterSearch")) self.inboxSearchLineEdit = QtGui.QLineEdit(self.inbox) self.inboxSearchLineEdit.setObjectName(_fromUtf8("inboxSearchLineEdit")) @@ -96,7 +97,7 @@ class Ui_MainWindow(object): self.horizontalSplitterSearch.setStretchFactor(0, 1) self.horizontalSplitterSearch.setStretchFactor(1, 0) self.verticalSplitter_7.addWidget(self.horizontalSplitterSearch) - self.tableWidgetInbox = QtGui.QTableWidget(self.inbox) + self.tableWidgetInbox = settingsmixin.STableWidget(self.inbox) self.tableWidgetInbox.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) self.tableWidgetInbox.setAlternatingRowColors(True) self.tableWidgetInbox.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) @@ -147,18 +148,19 @@ class Ui_MainWindow(object): self.send.setObjectName(_fromUtf8("send")) self.gridLayout_7 = QtGui.QGridLayout(self.send) self.gridLayout_7.setObjectName(_fromUtf8("gridLayout_7")) - self.horizontalLayout = QtGui.QHBoxLayout() - self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) - self.verticalLayout_2 = QtGui.QVBoxLayout() - self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) - self.tableWidgetAddressBook = QtGui.QTableWidget(self.send) - self.tableWidgetAddressBook.setMaximumSize(QtCore.QSize(200, 16777215)) + self.horizontalSplitter = settingsmixin.SSplitter() + self.horizontalSplitter.setObjectName(_fromUtf8("horizontalSplitter")) + self.verticalSplitter_2 = settingsmixin.SSplitter() + self.verticalSplitter_2.setObjectName(_fromUtf8("verticalSplitter_2")) + self.verticalSplitter_2.setOrientation(QtCore.Qt.Vertical) + self.tableWidgetAddressBook = settingsmixin.STableWidget(self.send) self.tableWidgetAddressBook.setAlternatingRowColors(True) self.tableWidgetAddressBook.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) self.tableWidgetAddressBook.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self.tableWidgetAddressBook.setObjectName(_fromUtf8("tableWidgetAddressBook")) self.tableWidgetAddressBook.setColumnCount(2) self.tableWidgetAddressBook.setRowCount(0) + self.tableWidgetAddressBook.resize(200, self.tableWidgetAddressBook.height()) item = QtGui.QTableWidgetItem() icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/addressbook.png")), QtGui.QIcon.Selected, QtGui.QIcon.Off) @@ -171,95 +173,119 @@ class Ui_MainWindow(object): self.tableWidgetAddressBook.horizontalHeader().setHighlightSections(False) self.tableWidgetAddressBook.horizontalHeader().setStretchLastSection(True) self.tableWidgetAddressBook.verticalHeader().setVisible(False) - self.verticalLayout_2.addWidget(self.tableWidgetAddressBook) + self.verticalSplitter_2.addWidget(self.tableWidgetAddressBook) self.pushButtonAddAddressBook = QtGui.QPushButton(self.send) - self.pushButtonAddAddressBook.setMaximumSize(QtCore.QSize(200, 16777215)) self.pushButtonAddAddressBook.setObjectName(_fromUtf8("pushButtonAddAddressBook")) - self.verticalLayout_2.addWidget(self.pushButtonAddAddressBook) + self.pushButtonAddAddressBook.resize(200, self.pushButtonAddAddressBook.height()) + self.verticalSplitter_2.addWidget(self.pushButtonAddAddressBook) self.pushButtonFetchNamecoinID = QtGui.QPushButton(self.send) - self.pushButtonFetchNamecoinID.setMaximumSize(QtCore.QSize(200, 16777215)) + self.pushButtonFetchNamecoinID.resize(200, self.pushButtonFetchNamecoinID.height()) font = QtGui.QFont() font.setPointSize(9) self.pushButtonFetchNamecoinID.setFont(font) self.pushButtonFetchNamecoinID.setObjectName(_fromUtf8("pushButtonFetchNamecoinID")) - self.verticalLayout_2.addWidget(self.pushButtonFetchNamecoinID) - self.horizontalLayout.addLayout(self.verticalLayout_2) - self.verticalLayout = QtGui.QVBoxLayout() - self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) + self.verticalSplitter_2.addWidget(self.pushButtonFetchNamecoinID) + self.verticalSplitter_2.setStretchFactor(0, 1) + self.verticalSplitter_2.setStretchFactor(1, 0) + self.verticalSplitter_2.setStretchFactor(2, 0) + self.verticalSplitter_2.setCollapsible(0, False) + self.verticalSplitter_2.setCollapsible(1, False) + self.verticalSplitter_2.setCollapsible(2, False) + self.verticalSplitter_2.handle(1).setEnabled(False) + self.verticalSplitter_2.handle(2).setEnabled(False) + self.horizontalSplitter.addWidget(self.verticalSplitter_2) + self.verticalSplitter = settingsmixin.SSplitter() + self.verticalSplitter.setObjectName(_fromUtf8("verticalSplitter")) + self.verticalSplitter.setOrientation(QtCore.Qt.Vertical) self.tabWidgetSend = QtGui.QTabWidget(self.send) self.tabWidgetSend.setObjectName(_fromUtf8("tabWidgetSend")) - self.tab = QtGui.QWidget() - self.tab.setObjectName(_fromUtf8("tab")) - self.gridLayout_8 = QtGui.QGridLayout(self.tab) + self.sendDirect = QtGui.QWidget() + self.sendDirect.setObjectName(_fromUtf8("sendDirect")) + self.gridLayout_8 = QtGui.QGridLayout(self.sendDirect) self.gridLayout_8.setObjectName(_fromUtf8("gridLayout_8")) - self.verticalLayout_5 = QtGui.QVBoxLayout() - self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5")) + self.verticalSplitter_5 = settingsmixin.SSplitter() + self.verticalSplitter_5.setObjectName(_fromUtf8("verticalSplitter_5")) + self.verticalSplitter_5.setOrientation(QtCore.Qt.Vertical) self.gridLayout_2 = QtGui.QGridLayout() self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2")) - self.label_3 = QtGui.QLabel(self.tab) + self.label_3 = QtGui.QLabel(self.sendDirect) self.label_3.setObjectName(_fromUtf8("label_3")) self.gridLayout_2.addWidget(self.label_3, 2, 0, 1, 1) - self.label_2 = QtGui.QLabel(self.tab) + self.label_2 = QtGui.QLabel(self.sendDirect) self.label_2.setObjectName(_fromUtf8("label_2")) self.gridLayout_2.addWidget(self.label_2, 0, 0, 1, 1) - self.lineEditSubject = QtGui.QLineEdit(self.tab) + self.lineEditSubject = QtGui.QLineEdit(self.sendDirect) self.lineEditSubject.setText(_fromUtf8("")) self.lineEditSubject.setObjectName(_fromUtf8("lineEditSubject")) self.gridLayout_2.addWidget(self.lineEditSubject, 2, 1, 1, 1) - self.label = QtGui.QLabel(self.tab) + self.label = QtGui.QLabel(self.sendDirect) self.label.setObjectName(_fromUtf8("label")) self.gridLayout_2.addWidget(self.label, 1, 0, 1, 1) - self.comboBoxSendFrom = QtGui.QComboBox(self.tab) + self.comboBoxSendFrom = QtGui.QComboBox(self.sendDirect) self.comboBoxSendFrom.setMinimumSize(QtCore.QSize(300, 0)) self.comboBoxSendFrom.setObjectName(_fromUtf8("comboBoxSendFrom")) self.gridLayout_2.addWidget(self.comboBoxSendFrom, 0, 1, 1, 1) - self.lineEditTo = QtGui.QLineEdit(self.tab) + self.lineEditTo = QtGui.QLineEdit(self.sendDirect) self.lineEditTo.setObjectName(_fromUtf8("lineEditTo")) self.gridLayout_2.addWidget(self.lineEditTo, 1, 1, 1, 1) - self.verticalLayout_5.addLayout(self.gridLayout_2) - self.textEditMessage = QtGui.QTextEdit(self.tab) + self.gridLayout_2_Widget = QtGui.QWidget() + self.gridLayout_2_Widget.setLayout(self.gridLayout_2) + self.verticalSplitter_5.addWidget(self.gridLayout_2_Widget) + self.textEditMessage = QtGui.QTextEdit(self.sendDirect) self.textEditMessage.setObjectName(_fromUtf8("textEditMessage")) - self.verticalLayout_5.addWidget(self.textEditMessage) - self.gridLayout_8.addLayout(self.verticalLayout_5, 0, 0, 1, 1) - self.tabWidgetSend.addTab(self.tab, _fromUtf8("")) - self.tab_2 = QtGui.QWidget() - self.tab_2.setObjectName(_fromUtf8("tab_2")) - self.gridLayout_9 = QtGui.QGridLayout(self.tab_2) + self.verticalSplitter_5.addWidget(self.textEditMessage) + self.verticalSplitter_5.setStretchFactor(0, 0) + self.verticalSplitter_5.setStretchFactor(1, 1) + self.verticalSplitter_5.setCollapsible(0, False) + self.verticalSplitter_5.setCollapsible(1, False) + self.verticalSplitter_5.handle(1).setEnabled(False) + self.gridLayout_8.addWidget(self.verticalSplitter_5, 0, 0, 1, 1) + self.tabWidgetSend.addTab(self.sendDirect, _fromUtf8("")) + self.sendBroadcast = QtGui.QWidget() + self.sendBroadcast.setObjectName(_fromUtf8("sendBroadcast")) + self.gridLayout_9 = QtGui.QGridLayout(self.sendBroadcast) self.gridLayout_9.setObjectName(_fromUtf8("gridLayout_9")) - self.verticalLayout_6 = QtGui.QVBoxLayout() - self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6")) + self.verticalSplitter_6 = settingsmixin.SSplitter() + self.verticalSplitter_6.setObjectName(_fromUtf8("verticalSplitter_6")) + self.verticalSplitter_6.setOrientation(QtCore.Qt.Vertical) self.gridLayout_5 = QtGui.QGridLayout() self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5")) - self.label_8 = QtGui.QLabel(self.tab_2) + self.label_8 = QtGui.QLabel(self.sendBroadcast) self.label_8.setObjectName(_fromUtf8("label_8")) self.gridLayout_5.addWidget(self.label_8, 0, 0, 1, 1) - self.lineEditSubjectBroadcast = QtGui.QLineEdit(self.tab_2) + self.lineEditSubjectBroadcast = QtGui.QLineEdit(self.sendBroadcast) self.lineEditSubjectBroadcast.setText(_fromUtf8("")) self.lineEditSubjectBroadcast.setObjectName(_fromUtf8("lineEditSubjectBroadcast")) self.gridLayout_5.addWidget(self.lineEditSubjectBroadcast, 1, 1, 1, 1) - self.label_7 = QtGui.QLabel(self.tab_2) + self.label_7 = QtGui.QLabel(self.sendBroadcast) self.label_7.setObjectName(_fromUtf8("label_7")) self.gridLayout_5.addWidget(self.label_7, 1, 0, 1, 1) - self.comboBoxSendFromBroadcast = QtGui.QComboBox(self.tab_2) + self.comboBoxSendFromBroadcast = QtGui.QComboBox(self.sendBroadcast) self.comboBoxSendFromBroadcast.setMinimumSize(QtCore.QSize(300, 0)) self.comboBoxSendFromBroadcast.setObjectName(_fromUtf8("comboBoxSendFromBroadcast")) self.gridLayout_5.addWidget(self.comboBoxSendFromBroadcast, 0, 1, 1, 1) - self.verticalLayout_6.addLayout(self.gridLayout_5) - self.textEditMessageBroadcast = QtGui.QTextEdit(self.tab_2) + self.gridLayout_5_Widget = QtGui.QWidget() + self.gridLayout_5_Widget.setLayout(self.gridLayout_5) + self.verticalSplitter_6.addWidget(self.gridLayout_5_Widget) + self.textEditMessageBroadcast = QtGui.QTextEdit(self.sendBroadcast) self.textEditMessageBroadcast.setObjectName(_fromUtf8("textEditMessageBroadcast")) - self.verticalLayout_6.addWidget(self.textEditMessageBroadcast) - self.gridLayout_9.addLayout(self.verticalLayout_6, 0, 0, 1, 1) - self.tabWidgetSend.addTab(self.tab_2, _fromUtf8("")) - self.verticalLayout.addWidget(self.tabWidgetSend) - self.horizontalLayout_5 = QtGui.QHBoxLayout() - self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5")) + self.verticalSplitter_6.addWidget(self.textEditMessageBroadcast) + self.verticalSplitter_6.setStretchFactor(0, 0) + self.verticalSplitter_6.setStretchFactor(1, 1) + self.verticalSplitter_6.setCollapsible(0, False) + self.verticalSplitter_6.setCollapsible(1, False) + self.verticalSplitter_6.handle(1).setEnabled(False) + self.gridLayout_9.addWidget(self.verticalSplitter_6, 0, 0, 1, 1) + self.tabWidgetSend.addTab(self.sendBroadcast, _fromUtf8("")) + self.verticalSplitter.addWidget(self.tabWidgetSend) + self.horizontalSplitter_5 = settingsmixin.SSplitter() + self.horizontalSplitter_5.setObjectName(_fromUtf8("horizontalSplitter_5")) self.pushButtonTTL = QtGui.QPushButton(self.send) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.pushButtonTTL.sizePolicy().hasHeightForWidth()) - self.pushButtonTTL.setSizePolicy(sizePolicy) - self.pushButtonTTL.setMaximumSize(QtCore.QSize(32, 16777215)) +# sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) +# sizePolicy.setHorizontalStretch(0) +# sizePolicy.setVerticalStretch(0) +# sizePolicy.setHeightForWidth(self.pushButtonTTL.sizePolicy().hasHeightForWidth()) +# self.pushButtonTTL.setSizePolicy(sizePolicy) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(0, 0, 255)) brush.setStyle(QtCore.Qt.SolidPattern) @@ -276,32 +302,53 @@ class Ui_MainWindow(object): self.pushButtonTTL.setFont(font) self.pushButtonTTL.setFlat(True) self.pushButtonTTL.setObjectName(_fromUtf8("pushButtonTTL")) - self.horizontalLayout_5.addWidget(self.pushButtonTTL) + self.horizontalSplitter_5.addWidget(self.pushButtonTTL) self.horizontalSliderTTL = QtGui.QSlider(self.send) self.horizontalSliderTTL.setMinimumSize(QtCore.QSize(35, 0)) - self.horizontalSliderTTL.setMaximumSize(QtCore.QSize(70, 16777215)) self.horizontalSliderTTL.setOrientation(QtCore.Qt.Horizontal) self.horizontalSliderTTL.setInvertedAppearance(False) self.horizontalSliderTTL.setInvertedControls(False) self.horizontalSliderTTL.setObjectName(_fromUtf8("horizontalSliderTTL")) - self.horizontalLayout_5.addWidget(self.horizontalSliderTTL) + self.horizontalSplitter_5.addWidget(self.horizontalSliderTTL) self.labelHumanFriendlyTTLDescription = QtGui.QLabel(self.send) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.labelHumanFriendlyTTLDescription.sizePolicy().hasHeightForWidth()) - self.labelHumanFriendlyTTLDescription.setSizePolicy(sizePolicy) +# sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred) +# sizePolicy.setHorizontalStretch(0) +# sizePolicy.setVerticalStretch(0) +# sizePolicy.setHeightForWidth(self.labelHumanFriendlyTTLDescription.sizePolicy().hasHeightForWidth()) +# self.labelHumanFriendlyTTLDescription.setSizePolicy(sizePolicy) self.labelHumanFriendlyTTLDescription.setMinimumSize(QtCore.QSize(45, 0)) - self.labelHumanFriendlyTTLDescription.setMaximumSize(QtCore.QSize(45, 16777215)) self.labelHumanFriendlyTTLDescription.setObjectName(_fromUtf8("labelHumanFriendlyTTLDescription")) - self.horizontalLayout_5.addWidget(self.labelHumanFriendlyTTLDescription) + self.horizontalSplitter_5.addWidget(self.labelHumanFriendlyTTLDescription) self.pushButtonSend = QtGui.QPushButton(self.send) - self.pushButtonSend.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.pushButtonSend.setObjectName(_fromUtf8("pushButtonSend")) - self.horizontalLayout_5.addWidget(self.pushButtonSend) - self.verticalLayout.addLayout(self.horizontalLayout_5) - self.horizontalLayout.addLayout(self.verticalLayout) - self.gridLayout_7.addLayout(self.horizontalLayout, 0, 0, 1, 1) + self.horizontalSplitter_5.addWidget(self.pushButtonSend) + self.pushButtonTTL.setMaximumSize(QtCore.QSize(32, self.pushButtonSend.height())) + self.labelHumanFriendlyTTLDescription.setMaximumSize(QtCore.QSize(45, self.pushButtonSend.height())) + self.horizontalSliderTTL.setMaximumSize(QtCore.QSize(70, self.pushButtonSend.height())) + self.horizontalSplitter_5.resize(self.horizontalSplitter_5.width(), self.pushButtonSend.height()) + self.horizontalSplitter_5.setStretchFactor(0, 0) + self.horizontalSplitter_5.setStretchFactor(1, 0) + self.horizontalSplitter_5.setStretchFactor(2, 0) + self.horizontalSplitter_5.setStretchFactor(3, 1) + self.horizontalSplitter_5.setCollapsible(0, False) + self.horizontalSplitter_5.setCollapsible(1, False) + self.horizontalSplitter_5.setCollapsible(2, False) + self.horizontalSplitter_5.setCollapsible(3, False) + self.horizontalSplitter_5.handle(1).setEnabled(False) + self.horizontalSplitter_5.handle(2).setEnabled(False) + self.horizontalSplitter_5.handle(3).setEnabled(False) + self.verticalSplitter.addWidget(self.horizontalSplitter_5) + self.verticalSplitter.setStretchFactor(0, 0) + self.verticalSplitter.setStretchFactor(1, 1) + self.verticalSplitter.setCollapsible(0, False) + self.verticalSplitter.setCollapsible(1, False) + self.verticalSplitter.handle(1).setEnabled(False) + self.horizontalSplitter.addWidget(self.verticalSplitter) + self.horizontalSplitter.setStretchFactor(0, 0) + self.horizontalSplitter.setStretchFactor(1, 1) + self.horizontalSplitter.setCollapsible(0, False) + self.horizontalSplitter.setCollapsible(1, False) + self.gridLayout_7.addWidget(self.horizontalSplitter, 0, 0, 1, 1) icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/send.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tabWidget.addTab(self.send, icon4, _fromUtf8("")) @@ -309,32 +356,39 @@ class Ui_MainWindow(object): self.subscriptions.setObjectName(_fromUtf8("subscriptions")) self.gridLayout_3 = QtGui.QGridLayout(self.subscriptions) self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3")) - self.horizontalLayout_4 = QtGui.QHBoxLayout() - self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) - self.verticalLayout_3 = QtGui.QVBoxLayout() - self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) + self.horizontalSplitter_4 = settingsmixin.SSplitter() + self.horizontalSplitter_4.setObjectName(_fromUtf8("horizontalSplitter_4")) + 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.setMaximumSize(QtCore.QSize(200, 16777215)) self.treeWidgetSubscriptions.setAlternatingRowColors(True) self.treeWidgetSubscriptions.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) self.treeWidgetSubscriptions.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self.treeWidgetSubscriptions.setObjectName(_fromUtf8("treeWidgetSubscriptions")) + self.treeWidgetSubscriptions.resize(200, self.treeWidgetSubscriptions.height()) icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/subscriptions.png")), QtGui.QIcon.Selected, QtGui.QIcon.Off) self.treeWidgetSubscriptions.headerItem().setIcon(0, icon5) - self.verticalLayout_3.addWidget(self.treeWidgetSubscriptions) + self.verticalSplitter_3.addWidget(self.treeWidgetSubscriptions) self.pushButtonAddSubscription = QtGui.QPushButton(self.subscriptions) - self.pushButtonAddSubscription.setMaximumSize(QtCore.QSize(200, 16777215)) self.pushButtonAddSubscription.setObjectName(_fromUtf8("pushButtonAddSubscription")) - self.verticalLayout_3.addWidget(self.pushButtonAddSubscription) - self.horizontalLayout_4.addLayout(self.verticalLayout_3) - self.verticalLayout_4 = QtGui.QVBoxLayout() - self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4")) - self.horizontalLayout_2 = QtGui.QHBoxLayout() - self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) + self.pushButtonAddSubscription.resize(200, self.pushButtonAddSubscription.height()) + self.verticalSplitter_3.addWidget(self.pushButtonAddSubscription) + self.verticalSplitter_3.setStretchFactor(0, 1) + self.verticalSplitter_3.setStretchFactor(1, 0) + self.verticalSplitter_3.setCollapsible(0, False) + self.verticalSplitter_3.setCollapsible(1, False) + self.verticalSplitter_3.handle(1).setEnabled(False) + self.horizontalSplitter_4.addWidget(self.verticalSplitter_3) + self.verticalSplitter_4 = settingsmixin.SSplitter() + self.verticalSplitter_4.setObjectName(_fromUtf8("verticalSplitter_4")) + self.verticalSplitter_4.setOrientation(QtCore.Qt.Vertical) + self.horizontalSplitter_2 = settingsmixin.SSplitter() + self.horizontalSplitter_2.setObjectName(_fromUtf8("horizontalSplitter_2")) self.inboxSearchLineEditSubscriptions = QtGui.QLineEdit(self.subscriptions) self.inboxSearchLineEditSubscriptions.setObjectName(_fromUtf8("inboxSearchLineEditSubscriptions")) - self.horizontalLayout_2.addWidget(self.inboxSearchLineEditSubscriptions) + self.horizontalSplitter_2.addWidget(self.inboxSearchLineEditSubscriptions) self.inboxSearchOptionSubscriptions = QtGui.QComboBox(self.subscriptions) self.inboxSearchOptionSubscriptions.setObjectName(_fromUtf8("inboxSearchOptionSubscriptions")) self.inboxSearchOptionSubscriptions.addItem(_fromUtf8("")) @@ -342,9 +396,13 @@ class Ui_MainWindow(object): self.inboxSearchOptionSubscriptions.addItem(_fromUtf8("")) self.inboxSearchOptionSubscriptions.addItem(_fromUtf8("")) self.inboxSearchOptionSubscriptions.addItem(_fromUtf8("")) - self.horizontalLayout_2.addWidget(self.inboxSearchOptionSubscriptions) - self.verticalLayout_4.addLayout(self.horizontalLayout_2) - self.tableWidgetInboxSubscriptions = QtGui.QTableWidget(self.subscriptions) + self.inboxSearchOptionSubscriptions.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) + self.horizontalSplitter_2.addWidget(self.inboxSearchOptionSubscriptions) + self.horizontalSplitter_2.handle(1).setEnabled(False) + self.horizontalSplitter_2.setStretchFactor(0, 1) + self.horizontalSplitter_2.setStretchFactor(1, 0) + self.verticalSplitter_4.addWidget(self.horizontalSplitter_2) + self.tableWidgetInboxSubscriptions = settingsmixin.STableWidget(self.subscriptions) self.tableWidgetInboxSubscriptions.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) self.tableWidgetInboxSubscriptions.setAlternatingRowColors(True) self.tableWidgetInboxSubscriptions.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) @@ -369,59 +427,81 @@ class Ui_MainWindow(object): self.tableWidgetInboxSubscriptions.horizontalHeader().setStretchLastSection(True) self.tableWidgetInboxSubscriptions.verticalHeader().setVisible(False) self.tableWidgetInboxSubscriptions.verticalHeader().setDefaultSectionSize(26) - self.verticalLayout_4.addWidget(self.tableWidgetInboxSubscriptions) + self.verticalSplitter_4.addWidget(self.tableWidgetInboxSubscriptions) self.textEditInboxMessageSubscriptions = QtGui.QTextEdit(self.subscriptions) self.textEditInboxMessageSubscriptions.setBaseSize(QtCore.QSize(0, 500)) self.textEditInboxMessageSubscriptions.setReadOnly(True) self.textEditInboxMessageSubscriptions.setObjectName(_fromUtf8("textEditInboxMessageSubscriptions")) - self.verticalLayout_4.addWidget(self.textEditInboxMessageSubscriptions) - self.horizontalLayout_4.addLayout(self.verticalLayout_4) - self.gridLayout_3.addLayout(self.horizontalLayout_4, 0, 0, 1, 1) + self.verticalSplitter_4.addWidget(self.textEditInboxMessageSubscriptions) + self.verticalSplitter_4.setStretchFactor(0, 0) + self.verticalSplitter_4.setStretchFactor(1, 1) + self.verticalSplitter_4.setStretchFactor(2, 2) + self.verticalSplitter_4.setCollapsible(0, False) + self.verticalSplitter_4.setCollapsible(1, False) + self.verticalSplitter_4.setCollapsible(2, False) + self.verticalSplitter_4.handle(1).setEnabled(False) + self.horizontalSplitter_4.addWidget(self.verticalSplitter_4) + self.horizontalSplitter_4.setStretchFactor(0, 0) + self.horizontalSplitter_4.setStretchFactor(1, 1) + self.horizontalSplitter_4.setCollapsible(0, False) + self.horizontalSplitter_4.setCollapsible(1, False) + self.gridLayout_3.addWidget(self.horizontalSplitter_4, 0, 0, 1, 1) icon6 = QtGui.QIcon() icon6.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/subscriptions.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tabWidget.addTab(self.subscriptions, icon6, _fromUtf8("")) - self.tab_3 = QtGui.QWidget() - self.tab_3.setObjectName(_fromUtf8("tab_3")) - self.gridLayout_4 = QtGui.QGridLayout(self.tab_3) + self.chans = QtGui.QWidget() + self.chans.setObjectName(_fromUtf8("chans")) + self.gridLayout_4 = QtGui.QGridLayout(self.chans) self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4")) - self.horizontalLayout_7 = QtGui.QHBoxLayout() - self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7")) - self.verticalLayout_17 = QtGui.QVBoxLayout() - self.verticalLayout_17.setObjectName(_fromUtf8("verticalLayout_17")) - self.treeWidgetChans = QtGui.QTreeWidget(self.tab_3) - self.treeWidgetChans.setMaximumSize(QtCore.QSize(200, 16777215)) + self.horizontalSplitter_7 = settingsmixin.SSplitter() + self.horizontalSplitter_7.setObjectName(_fromUtf8("horizontalSplitter_7")) + 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.setFrameShadow(QtGui.QFrame.Sunken) self.treeWidgetChans.setLineWidth(1) self.treeWidgetChans.setAlternatingRowColors(True) self.treeWidgetChans.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) self.treeWidgetChans.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self.treeWidgetChans.setObjectName(_fromUtf8("treeWidgetChans")) + self.treeWidgetChans.resize(200, self.treeWidgetChans.height()) icon7 = QtGui.QIcon() icon7.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/can-icon-16px.png")), QtGui.QIcon.Selected, QtGui.QIcon.Off) self.treeWidgetChans.headerItem().setIcon(0, icon7) - self.verticalLayout_17.addWidget(self.treeWidgetChans) - self.pushButtonAddChan = QtGui.QPushButton(self.tab_3) - self.pushButtonAddChan.setMaximumSize(QtCore.QSize(200, 16777215)) + self.verticalSplitter_17.addWidget(self.treeWidgetChans) + self.pushButtonAddChan = QtGui.QPushButton(self.chans) self.pushButtonAddChan.setObjectName(_fromUtf8("pushButtonAddChan")) - self.verticalLayout_17.addWidget(self.pushButtonAddChan) - self.horizontalLayout_7.addLayout(self.verticalLayout_17) - self.verticalLayout_8 = QtGui.QVBoxLayout() - self.verticalLayout_8.setObjectName(_fromUtf8("verticalLayout_8")) - self.horizontalLayout_6 = QtGui.QHBoxLayout() - self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6")) - self.inboxSearchLineEditChans = QtGui.QLineEdit(self.tab_3) + self.pushButtonAddChan.resize(200, self.pushButtonAddChan.height()) + self.verticalSplitter_17.addWidget(self.pushButtonAddChan) + self.verticalSplitter_17.setStretchFactor(0, 1) + self.verticalSplitter_17.setStretchFactor(1, 0) + self.verticalSplitter_17.setCollapsible(0, False) + self.verticalSplitter_17.setCollapsible(1, False) + self.verticalSplitter_17.handle(1).setEnabled(False) + self.horizontalSplitter_7.addWidget(self.verticalSplitter_17) + self.verticalSplitter_8 = settingsmixin.SSplitter() + self.verticalSplitter_8.setObjectName(_fromUtf8("verticalSplitter_8")) + self.verticalSplitter_8.setOrientation(QtCore.Qt.Vertical) + self.horizontalSplitter_6 = settingsmixin.SSplitter() + self.horizontalSplitter_6.setObjectName(_fromUtf8("horizontalSplitter_6")) + self.inboxSearchLineEditChans = QtGui.QLineEdit(self.chans) self.inboxSearchLineEditChans.setObjectName(_fromUtf8("inboxSearchLineEditChans")) - self.horizontalLayout_6.addWidget(self.inboxSearchLineEditChans) - self.inboxSearchOptionChans = QtGui.QComboBox(self.tab_3) + self.horizontalSplitter_6.addWidget(self.inboxSearchLineEditChans) + self.inboxSearchOptionChans = QtGui.QComboBox(self.chans) self.inboxSearchOptionChans.setObjectName(_fromUtf8("inboxSearchOptionChans")) self.inboxSearchOptionChans.addItem(_fromUtf8("")) self.inboxSearchOptionChans.addItem(_fromUtf8("")) self.inboxSearchOptionChans.addItem(_fromUtf8("")) self.inboxSearchOptionChans.addItem(_fromUtf8("")) self.inboxSearchOptionChans.addItem(_fromUtf8("")) - self.horizontalLayout_6.addWidget(self.inboxSearchOptionChans) - self.verticalLayout_8.addLayout(self.horizontalLayout_6) - self.tableWidgetInboxChans = QtGui.QTableWidget(self.tab_3) + self.inboxSearchOptionChans.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) + self.horizontalSplitter_6.addWidget(self.inboxSearchOptionChans) + self.horizontalSplitter_6.handle(1).setEnabled(False) + self.horizontalSplitter_6.setStretchFactor(0, 1) + self.horizontalSplitter_6.setStretchFactor(1, 0) + self.verticalSplitter_8.addWidget(self.horizontalSplitter_6) + self.tableWidgetInboxChans = settingsmixin.STableWidget(self.chans) self.tableWidgetInboxChans.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) self.tableWidgetInboxChans.setAlternatingRowColors(True) self.tableWidgetInboxChans.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) @@ -446,17 +526,28 @@ class Ui_MainWindow(object): self.tableWidgetInboxChans.horizontalHeader().setStretchLastSection(True) self.tableWidgetInboxChans.verticalHeader().setVisible(False) self.tableWidgetInboxChans.verticalHeader().setDefaultSectionSize(26) - self.verticalLayout_8.addWidget(self.tableWidgetInboxChans) - self.textEditInboxMessageChans = QtGui.QTextEdit(self.tab_3) + self.verticalSplitter_8.addWidget(self.tableWidgetInboxChans) + self.textEditInboxMessageChans = QtGui.QTextEdit(self.chans) self.textEditInboxMessageChans.setBaseSize(QtCore.QSize(0, 500)) self.textEditInboxMessageChans.setReadOnly(True) self.textEditInboxMessageChans.setObjectName(_fromUtf8("textEditInboxMessageChans")) - self.verticalLayout_8.addWidget(self.textEditInboxMessageChans) - self.horizontalLayout_7.addLayout(self.verticalLayout_8) - self.gridLayout_4.addLayout(self.horizontalLayout_7, 0, 0, 1, 1) + self.verticalSplitter_8.addWidget(self.textEditInboxMessageChans) + self.verticalSplitter_8.setStretchFactor(0, 0) + self.verticalSplitter_8.setStretchFactor(1, 1) + self.verticalSplitter_8.setStretchFactor(2, 2) + self.verticalSplitter_8.setCollapsible(0, False) + self.verticalSplitter_8.setCollapsible(1, False) + self.verticalSplitter_8.setCollapsible(2, False) + self.verticalSplitter_8.handle(1).setEnabled(False) + self.horizontalSplitter_7.addWidget(self.verticalSplitter_8) + self.horizontalSplitter_7.setStretchFactor(0, 0) + self.horizontalSplitter_7.setStretchFactor(1, 1) + self.horizontalSplitter_7.setCollapsible(0, False) + self.horizontalSplitter_7.setCollapsible(1, False) + self.gridLayout_4.addWidget(self.horizontalSplitter_7, 0, 0, 1, 1) icon8 = QtGui.QIcon() icon8.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/can-icon-16px.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.tabWidget.addTab(self.tab_3, icon8, _fromUtf8("")) + self.tabWidget.addTab(self.chans, icon8, _fromUtf8("")) self.blackwhitelist = QtGui.QWidget() self.blackwhitelist.setObjectName(_fromUtf8("blackwhitelist")) self.gridLayout_6 = QtGui.QGridLayout(self.blackwhitelist) @@ -473,7 +564,7 @@ class Ui_MainWindow(object): self.gridLayout_6.addWidget(self.pushButtonAddBlacklist, 2, 0, 1, 1) spacerItem = QtGui.QSpacerItem(689, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.gridLayout_6.addItem(spacerItem, 2, 1, 1, 1) - self.tableWidgetBlacklist = QtGui.QTableWidget(self.blackwhitelist) + self.tableWidgetBlacklist = settingsmixin.STableWidget(self.blackwhitelist) self.tableWidgetBlacklist.setAlternatingRowColors(True) self.tableWidgetBlacklist.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) self.tableWidgetBlacklist.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) @@ -504,7 +595,7 @@ class Ui_MainWindow(object): self.pushButtonStatusIcon.setIcon(icon10) self.pushButtonStatusIcon.setFlat(True) self.pushButtonStatusIcon.setObjectName(_fromUtf8("pushButtonStatusIcon")) - self.tableWidgetConnectionCount = QtGui.QTableWidget(self.networkstatus) + self.tableWidgetConnectionCount = settingsmixin.STableWidget(self.networkstatus) self.tableWidgetConnectionCount.setGeometry(QtCore.QRect(20, 70, 241, 241)) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(212, 208, 200)) @@ -675,7 +766,7 @@ class Ui_MainWindow(object): "p, li { white-space: pre-wrap; }\n" "\n" "


", None)) - self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.tab), _translate("MainWindow", "Send ordinary Message", None)) + self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.sendDirect), _translate("MainWindow", "Send ordinary Message", None)) self.label_8.setText(_translate("MainWindow", "From:", None)) self.label_7.setText(_translate("MainWindow", "Subject:", None)) self.textEditMessageBroadcast.setHtml(_translate("MainWindow", "\n" @@ -683,7 +774,7 @@ class Ui_MainWindow(object): "p, li { white-space: pre-wrap; }\n" "\n" "


", None)) - self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.tab_2), _translate("MainWindow", "Send Message to your Subscribers", None)) + self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.sendBroadcast), _translate("MainWindow", "Send Message to your Subscribers", None)) self.pushButtonTTL.setText(_translate("MainWindow", "TTL:", None)) self.labelHumanFriendlyTTLDescription.setText(_translate("MainWindow", "X days", None)) self.pushButtonSend.setText(_translate("MainWindow", "Send", None)) @@ -723,7 +814,7 @@ class Ui_MainWindow(object): item.setText(_translate("MainWindow", "Subject", None)) item = self.tableWidgetInboxChans.horizontalHeaderItem(3) item.setText(_translate("MainWindow", "Received", None)) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("MainWindow", "Chans", None)) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.chans), _translate("MainWindow", "Chans", None)) self.radioButtonBlacklist.setText(_translate("MainWindow", "Use a Blacklist (Allow all incoming messages except those on the Blacklist)", None)) self.radioButtonWhitelist.setText(_translate("MainWindow", "Use a Whitelist (Block all incoming messages except those on the Whitelist)", None)) self.pushButtonAddBlacklist.setText(_translate("MainWindow", "Add new entry", None)) @@ -765,8 +856,9 @@ import bitmessage_icons_rc if __name__ == "__main__": import sys + app = QtGui.QApplication(sys.argv) - MainWindow = QtGui.QMainWindow() + MainWindow = settingsmixin.SMainWindow() ui = Ui_MainWindow() ui.setupUi(MainWindow) MainWindow.show() diff --git a/src/bitmessageqt/settingsmixin.py b/src/bitmessageqt/settingsmixin.py new file mode 100644 index 00000000..301ce96e --- /dev/null +++ b/src/bitmessageqt/settingsmixin.py @@ -0,0 +1,69 @@ +#!/usr/bin/python2.7 + +from PyQt4 import QtCore, QtGui + +class SettingsMixin(object): + def warnIfNoObjectName(self): + if self.objectName() == "": + # TODO: logger + pass + + def writeState(self, source): + self.warnIfNoObjectName() + settings = QtCore.QSettings() + settings.beginGroup(self.objectName()) + settings.setValue("state", source.saveState()) + settings.endGroup() + + def writeGeometry(self, source): + self.warnIfNoObjectName() + settings = QtCore.QSettings() + settings.beginGroup(self.objectName()) + settings.setValue("geometry", source.saveGeometry()) + settings.endGroup() + + def readGeometry(self, target): + self.warnIfNoObjectName() + settings = QtCore.QSettings() + try: + geom = settings.value("/".join([str(self.objectName()), "geometry"])) + target.restoreGeometry(geom.toByteArray() if hasattr(geom, 'toByteArray') else geom) + except Exception as e: + pass + + def readState(self, target): + self.warnIfNoObjectName() + settings = QtCore.QSettings() + try: + state = settings.value("/".join([str(self.objectName()), "state"])) + target.restoreState(state.toByteArray() if hasattr(state, 'toByteArray') else state) + except Exception as e: + pass + + +class SMainWindow(QtGui.QMainWindow, SettingsMixin): + def loadSettings(self): + self.readGeometry(self) + self.readState(self) + + def saveSettings(self): + self.writeState(self) + self.writeGeometry(self) + + +class STableWidget(QtGui.QTableWidget, SettingsMixin): + def loadSettings(self): + self.readState(self.horizontalHeader()) + + def saveSettings(self): + return + self.writeState(self.horizontalHeader()) + + +class SSplitter(QtGui.QSplitter, SettingsMixin): + def loadSettings(self): + self.readState(self) + + def saveSettings(self): + return + self.writeState(self) \ No newline at end of file