summaryrefslogtreecommitdiffstats
path: root/pyLoadGui.py
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2009-12-21 17:57:17 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2009-12-21 17:57:17 +0100
commit59eaacc4228707f715be147350adb0a670de6985 (patch)
treed9048d89724c123ad7500dc51e91c5673582b20a /pyLoadGui.py
parentpackage creation works (diff)
downloadpyload-59eaacc4228707f715be147350adb0a670de6985.tar.xz
save window state
Diffstat (limited to 'pyLoadGui.py')
-rwxr-xr-xpyLoadGui.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/pyLoadGui.py b/pyLoadGui.py
index ccab8ba64..a21c27cb9 100755
--- a/pyLoadGui.py
+++ b/pyLoadGui.py
@@ -61,6 +61,7 @@ class main(QObject):
def startMain(self):
self.connector.start()
sleep(1)
+ self.restoreMainWindow()
self.mainWindow.show()
self.initQueue()
self.initPackageCollector()
@@ -90,6 +91,7 @@ class main(QObject):
self.connect(self.mainWindow, SIGNAL("addLinks"), self.slotAddLinks)
self.connect(self.mainWindow, SIGNAL("addPackage"), self.slotAddPackage)
self.connect(self.mainWindow, SIGNAL("setDownloadStatus"), self.slotSetDownloadStatus)
+ self.connect(self.mainWindow, SIGNAL("saveMainWindow"), self.slotSaveMainWindow)
def slotShowConnector(self):
self.stopMain()
@@ -293,6 +295,33 @@ class main(QObject):
for fileid in ids:
self.connector.addFileToPackage(fileid, packid)
+ def slotSaveMainWindow(self, state, geo):
+ mainWindowNode = self.parser.xml.elementsByTagName("mainWindow").item(0)
+ if mainWindowNode.isNull():
+ raise Exception("null")
+ stateNode = mainWindowNode.toElement().elementsByTagName("state").item(0)
+ geoNode = mainWindowNode.toElement().elementsByTagName("geometry").item(0)
+ newStateNode = self.parser.xml.createTextNode(state)
+ newGeoNode = self.parser.xml.createTextNode(geo)
+
+ stateNode.removeChild(stateNode.firstChild())
+ geoNode.removeChild(geoNode.firstChild())
+ stateNode.appendChild(newStateNode)
+ geoNode.appendChild(newGeoNode)
+
+ self.parser.saveData()
+
+ def restoreMainWindow(self):
+ mainWindowNode = self.parser.xml.elementsByTagName("mainWindow").item(0)
+ if mainWindowNode.isNull():
+ raise Exception("null")
+ nodes = self.parser.parseNode(mainWindowNode, "dict")
+
+ state = str(nodes["state"].text())
+ geo = str(nodes["geometry"].text())
+
+ self.mainWindow.restoreWindow(state, geo)
+
class Loop(QThread):
def __init__(self, parent):
QThread.__init__(self)