diff --git a/lib/gui_lite.py b/lib/gui_lite.py index 950598b14..bb267e365 100644 --- a/lib/gui_lite.py +++ b/lib/gui_lite.py @@ -5,6 +5,7 @@ from PyQt4.QtGui import * from decimal import Decimal as D from interface import DEFAULT_SERVERS +from simple_config import SimpleConfig from util import get_resource_path as rsrc from i18n import _ import decimal @@ -231,6 +232,12 @@ class MiniWindow(QDialog): close_shortcut = QShortcut(QKeySequence("Ctrl+W"), self) close_shortcut.activated.connect(self.close) + cfg = SimpleConfig() + g = cfg.config["winpos-lite"] + self.setGeometry(g[0], g[1], g[2], g[3]) + show_history.setChecked(cfg.config["history"]) + self.show_history(cfg.config["history"]) + self.setWindowIcon(QIcon(":electrum.png")) self.setWindowTitle("Electrum") self.setWindowFlags(Qt.Window|Qt.MSWindowsFixedSizeDialogHint) @@ -247,6 +254,12 @@ class MiniWindow(QDialog): QDir.setCurrent(old_path) def closeEvent(self, event): + cfg = SimpleConfig() + g = self.geometry() + cfg.config["winpos-lite"] = [g.left(),g.top(),g.width(),g.height()] + cfg.config["history"] = self.history_list.isVisible() + cfg.save_config() + super(MiniWindow, self).closeEvent(event) qApp.quit() diff --git a/lib/gui_qt.py b/lib/gui_qt.py index 972b28cd1..e3eb724a2 100644 --- a/lib/gui_qt.py +++ b/lib/gui_qt.py @@ -204,7 +204,9 @@ class ElectrumWindow(QMainWindow): tabs.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.setCentralWidget(tabs) self.create_status_bar() - self.setGeometry(100,100,840,400) + cfg = SimpleConfig() + g = cfg.config["winpos-qt"] + self.setGeometry(g[0], g[1], g[2], g[3]) title = 'Electrum ' + self.wallet.electrum_version + ' - ' + self.wallet.path if not self.wallet.seed: title += ' [seedless]' self.setWindowTitle( title ) @@ -1457,6 +1459,12 @@ class ElectrumWindow(QMainWindow): return True + def closeEvent(self, event): + cfg = SimpleConfig() + g = self.geometry() + cfg.config["winpos-qt"] = [g.left(),g.top(),g.width(),g.height()] + cfg.save_config() + event.accept() class ElectrumGui: diff --git a/lib/simple_config.py b/lib/simple_config.py index a71c4810e..6a007be7f 100644 --- a/lib/simple_config.py +++ b/lib/simple_config.py @@ -3,7 +3,8 @@ import os from util import user_dir class SimpleConfig: - default_options = {"gui": "lite", "proxy": { "mode": "none", "host":"localhost", "port":"8080" } } + default_options = {"gui": "lite", "proxy": { "mode": "none", "host":"localhost", "port":"8080" }, + "winpos-qt": [100, 100, 840, 400], "winpos-lite": [4, 25, 351, 149], "history": False } def set_key(self, key, value, save = True): self.config[key] = value