move argument handling from mainwindow.py to bin/secop-gui
allows calling the GUI client independently from command line arguments Change-Id: If51b899c456ad610cf8a64f9b0f7c8a218cf5c5b Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/22503 Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
parent
8cf4c2d8eb
commit
89c98fa716
@ -58,7 +58,10 @@ def main(argv=None):
|
||||
|
||||
app = QApplication(argv)
|
||||
|
||||
win = MainWindow()
|
||||
hosts = [host for host in argv[1:] if not host.startswith('-')]
|
||||
if not hosts:
|
||||
hosts = ['localhost:10767']
|
||||
win = MainWindow(hosts)
|
||||
win.show()
|
||||
|
||||
return app.exec_()
|
||||
|
@ -22,8 +22,6 @@
|
||||
# *****************************************************************************
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
import secop.client
|
||||
from secop.gui.modulectrl import ModuleCtrl
|
||||
from secop.gui.nodectrl import NodeCtrl
|
||||
@ -111,7 +109,7 @@ class QSECNode(QObject):
|
||||
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
def __init__(self, parent=None):
|
||||
def __init__(self, hosts, parent=None):
|
||||
super(MainWindow, self).__init__(parent)
|
||||
|
||||
loadUi(self, 'mainwindow.ui')
|
||||
@ -130,12 +128,7 @@ class MainWindow(QMainWindow):
|
||||
self._currentWidget = self.splitter.widget(1).layout().takeAt(0)
|
||||
|
||||
# add localhost (if available) and SEC nodes given as arguments
|
||||
args = sys.argv[1:]
|
||||
if '-d' in args:
|
||||
args.remove('-d')
|
||||
if not args:
|
||||
args = ['localhost']
|
||||
for host in args:
|
||||
for host in hosts:
|
||||
try:
|
||||
self._addNode(host)
|
||||
except Exception as e:
|
||||
|
Loading…
x
Reference in New Issue
Block a user