summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/gui/MainWindow.py35
-rw-r--r--module/gui/Queue.py3
-rwxr-xr-xpyLoadGui.py47
3 files changed, 47 insertions, 38 deletions
diff --git a/module/gui/MainWindow.py b/module/gui/MainWindow.py
index 5878d18d4..f9d2d0fb8 100644
--- a/module/gui/MainWindow.py
+++ b/module/gui/MainWindow.py
@@ -64,17 +64,17 @@ class MainWindow(QMainWindow):
self.tabw = QTabWidget()
self.tabs = {}
self.tabs["queue"] = {"w":QWidget()}
- self.tabs["collector_packages"] = {"w":QWidget()}
- self.tabs["collector_links"] = {"w":QWidget()}
+ self.tabs["collector"] = {"w":QWidget()}
self.tabw.addTab(self.tabs["queue"]["w"], "Queue")
- self.tabw.addTab(self.tabs["collector_packages"]["w"], "Package collector")
- self.tabw.addTab(self.tabs["collector_links"]["w"], "Link collector")
+ self.tabw.addTab(self.tabs["collector"]["w"], "Collector")
#init tabs
self.init_tabs()
#layout
self.masterlayout.addWidget(self.tabw)
+
+ self.connect(self.mactions["manager"], SIGNAL("triggered()"), self.slotShowConnector)
def init_toolbar(self):
self.toolbar = self.addToolBar("main")
@@ -104,17 +104,19 @@ class MainWindow(QMainWindow):
self.tabs["queue"]["view"] = QTreeWidget()
self.tabs["queue"]["l"].addWidget(self.tabs["queue"]["view"])
- #collector_packages
- self.tabs["collector_packages"]["l"] = QGridLayout()
- self.tabs["collector_packages"]["w"].setLayout(self.tabs["collector_packages"]["l"])
- self.tabs["collector_packages"]["treewidget"] = QTreeWidget()
- self.tabs["collector_packages"]["l"].addWidget(self.tabs["collector_packages"]["treewidget"])
-
- #collector_links
- self.tabs["collector_links"]["l"] = QGridLayout()
- self.tabs["collector_links"]["w"].setLayout(self.tabs["collector_links"]["l"])
- self.tabs["collector_links"]["listwidget"] = QListWidget()
- self.tabs["collector_links"]["l"].addWidget(self.tabs["collector_links"]["listwidget"])
+ #collector
+ groupPackage = QGroupBox("Packages")
+ groupLinks = QGroupBox("Links")
+ groupPackage.setLayout(QVBoxLayout())
+ groupLinks.setLayout(QVBoxLayout())
+ self.tabs["collector"]["l"] = QGridLayout()
+ self.tabs["collector"]["w"].setLayout(self.tabs["collector"]["l"])
+ self.tabs["collector"]["package_view"] = QTreeWidget()
+ self.tabs["collector"]["link_view"] = QListWidget()
+ groupPackage.layout().addWidget(self.tabs["collector"]["package_view"])
+ groupLinks.layout().addWidget(self.tabs["collector"]["link_view"])
+ self.tabs["collector"]["l"].addWidget(groupPackage, 0, 0)
+ self.tabs["collector"]["l"].addWidget(groupLinks, 0, 1)
def slotToggleStatus(self, status):
print "toggle status", status
@@ -124,3 +126,6 @@ class MainWindow(QMainWindow):
def slotAdd(self):
print "add"
+
+ def slotShowConnector(self):
+ self.emit(SIGNAL("connector"))
diff --git a/module/gui/Queue.py b/module/gui/Queue.py
index 7e63e6180..52f11fd8c 100644
--- a/module/gui/Queue.py
+++ b/module/gui/Queue.py
@@ -46,6 +46,9 @@ class Queue(QThread):
self.update()
sleep(self.interval)
+ def stop(self):
+ self.running = False
+
def update(self):
locker = QMutexLocker(self.mutex)
packs = self.connector.getPackageQueue()
diff --git a/pyLoadGui.py b/pyLoadGui.py
index c213b4fa7..7ac576f4e 100755
--- a/pyLoadGui.py
+++ b/pyLoadGui.py
@@ -42,6 +42,9 @@ class main(QObject):
"""
QObject.__init__(self)
self.app = QApplication(sys.argv)
+ self.init()
+
+ def init(self):
self.mainWindow = MainWindow()
self.pwWindow = PWInputWindow()
self.connWindow = ConnectionManager()
@@ -58,9 +61,19 @@ class main(QObject):
self.connector.start()
sleep(1)
self.mainWindow.show()
+ self.initQueue()
self.testStuff()
self.mainloop.start()
+ def stopMain(self):
+ self.mainloop.stop()
+ self.connector.stop()
+ self.mainWindow.hide()
+ self.queue.stop()
+ self.mainloop.wait()
+ self.connector.wait()
+ self.queue.wait()
+
def connectSignals(self):
"""
signal and slot stuff, yay!
@@ -71,6 +84,11 @@ class main(QObject):
self.connect(self.connWindow, SIGNAL("connect"), self.slotConnect)
self.connect(self.pwWindow, SIGNAL("ok"), self.slotPasswordTyped)
self.connect(self.pwWindow, SIGNAL("cancel"), self.quit)
+ self.connect(self.mainWindow, SIGNAL("connector"), self.slotShowConnector)
+
+ def slotShowConnector(self):
+ self.stopMain()
+ self.init()
def quit(self):
self.app.quit()
@@ -112,28 +130,8 @@ class main(QObject):
sub = QTreeWidgetItem(item)
sub.setData(0, Qt.DisplayRole, QVariant(info["filename"]))
self.mainWindow.tabs["collector_packages"]["treewidget"].addTopLevelItem(item)
-
- #test for queue
- """
- packs = self.connector.getPackageQueue()
- for data in packs:
- item = QTreeWidgetItem()
- item.setData(0, Qt.UserRole, QVariant(data))
- item.setData(0, Qt.DisplayRole, QVariant(data["package_name"]))
- files = self.connector.getPackageFiles(data["id"])
- for id in files:
- info = self.connector.getLinkInfo(id)
- sub = QTreeWidgetItem(item)
- sub.setData(0, Qt.DisplayRole, QVariant(info["filename"]))
- sub.setData(1, Qt.DisplayRole, QVariant(info["status_type"]))
- self.mainWindow.tabs["queue"]["treewidget"].addTopLevelItem(item)
-
- model = QueueModel(self.connector)
- model.setView(self.mainWindow.tabs["queue"]["view"])
- self.mainWindow.tabs["queue"]["view"].setModel(model)
- self.mainWindow.tabs["queue"]["view"].setup()
- model.startLoop()
- """
+
+ def initQueue(self):
view = self.mainWindow.tabs["queue"]["view"]
view.setColumnCount(3)
view.setHeaderLabels(["Name", "Status", "Fortschritt"])
@@ -197,7 +195,7 @@ class main(QObject):
raise Exception("null")
connections = self.parser.parseNode(connectionsNode)
connNode = self.parser.xml.createElement("connection")
- connNode.setAttribute("default", data["default"])
+ connNode.setAttribute("default", str(data["default"]))
connNode.setAttribute("type", data["type"])
connNode.setAttribute("id", data["id"])
nameNode = self.parser.xml.createElement("name")
@@ -291,6 +289,9 @@ class main(QObject):
def update(self):
self.parent.refreshServerStatus()
+
+ def stop(self):
+ self.running = False
if __name__ == "__main__":
app = main()