summaryrefslogtreecommitdiffstats
path: root/module/gui/MainWindow.py
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2009-12-21 18:52:51 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2009-12-21 18:52:51 +0100
commit9a435f166b8d70fa2e61351b1d84db77c5b42472 (patch)
tree0b0fc9193e8666721b880351d9a5a5ac31f78cb8 /module/gui/MainWindow.py
parenttotal progressbar bullshit (diff)
parentmerged Wugy (diff)
downloadpyload-9a435f166b8d70fa2e61351b1d84db77c5b42472.tar.xz
merged Wugy, 2nd try
Diffstat (limited to 'module/gui/MainWindow.py')
-rw-r--r--module/gui/MainWindow.py31
1 files changed, 30 insertions, 1 deletions
diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py
index 6d68f4d7a..4f92f68a9 100644
--- a/module/gui/MainWindow.py
+++ b/module/gui/MainWindow.py
@@ -33,12 +33,16 @@ 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)
self.newLinkDock = NewLinkDock()
self.addDockWidget(Qt.RightDockWidgetArea, self.newLinkDock)
self.connect(self.newLinkDock, SIGNAL("done"), self.slotAddLinks)
+ self.connect(self.newPackDock, SIGNAL("done"), self.slotAddPackage)
#central widget, layout
self.masterlayout = QVBoxLayout()
@@ -88,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()
@@ -156,3 +161,27 @@ class MainWindow(QMainWindow):
def slotAddLinks(self, links):
self.emit(SIGNAL("addLinks"), links)
+
+ 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)
+