diff options
author | mkaay <mkaay@mkaay.de> | 2009-12-21 17:57:17 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2009-12-21 17:57:17 +0100 |
commit | 59eaacc4228707f715be147350adb0a670de6985 (patch) | |
tree | d9048d89724c123ad7500dc51e91c5673582b20a /module/gui | |
parent | package creation works (diff) | |
download | pyload-59eaacc4228707f715be147350adb0a670de6985.tar.xz |
save window state
Diffstat (limited to 'module/gui')
-rw-r--r-- | module/gui/LinkDock.py | 1 | ||||
-rw-r--r-- | module/gui/MainWindow.py | 27 | ||||
-rw-r--r-- | module/gui/PackageDock.py | 1 |
3 files changed, 28 insertions, 1 deletions
diff --git a/module/gui/LinkDock.py b/module/gui/LinkDock.py index 01a0cc193..99429d04b 100644 --- a/module/gui/LinkDock.py +++ b/module/gui/LinkDock.py @@ -22,6 +22,7 @@ from PyQt4.QtGui import * class NewLinkDock(QDockWidget): def __init__(self): QDockWidget.__init__(self, "New Links") + self.setObjectName("New Links Dock") self.widget = NewLinkWindow(self) self.setWidget(self.widget) self.setAllowedAreas(Qt.RightDockWidgetArea|Qt.LeftDockWidgetArea) diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py index 63ffb86a0..4f92f68a9 100644 --- a/module/gui/MainWindow.py +++ b/module/gui/MainWindow.py @@ -33,6 +33,9 @@ class MainWindow(QMainWindow): self.setWindowIcon(QIcon("icons/logo.png")) self.resize(750,500) + #layout version + self.version = 1 + #init docks self.newPackDock = NewPackageDock() self.addDockWidget(Qt.RightDockWidgetArea, self.newPackDock) @@ -89,7 +92,8 @@ class MainWindow(QMainWindow): self.connect(self.mactions["exit"], SIGNAL("triggered()"), self.close) def init_toolbar(self): - self.toolbar = self.addToolBar("main") + self.toolbar = self.addToolBar("Main Toolbar") + self.toolbar.setObjectName("Main Toolbar") self.toolbar.setIconSize(QSize(40,40)) self.actions["toggle_status"] = self.toolbar.addAction("Toggle Pause/Resume") pricon = QIcon() @@ -160,3 +164,24 @@ class MainWindow(QMainWindow): def slotAddPackage(self, name, ids): self.emit(SIGNAL("addPackage"), name, ids) + + def closeEvent(self, event): + state_raw = self.saveState(self.version) + geo_raw = self.saveGeometry() + + state = str(state_raw.toBase64()) + geo = str(geo_raw.toBase64()) + + self.emit(SIGNAL("saveMainWindow"), state, geo) + event.accept() + + def restoreWindow(self, state, geo): + state = QByteArray(state) + geo = QByteArray(geo) + + state_raw = QByteArray.fromBase64(state) + geo_raw = QByteArray.fromBase64(geo) + + self.restoreState(state_raw, self.version) + self.restoreGeometry(geo_raw) + diff --git a/module/gui/PackageDock.py b/module/gui/PackageDock.py index 7367efda4..b90e3533d 100644 --- a/module/gui/PackageDock.py +++ b/module/gui/PackageDock.py @@ -22,6 +22,7 @@ from PyQt4.QtGui import * class NewPackageDock(QDockWidget): def __init__(self): QDockWidget.__init__(self, "New Package") + self.setObjectName("New Package Dock") self.widget = NewPackageWindow(self) self.setWidget(self.widget) self.setAllowedAreas(Qt.RightDockWidgetArea|Qt.LeftDockWidgetArea) |