diff --git a/client-py3/full/src/UDSClientLauncher.py b/client-py3/full/src/UDSClientLauncher.py index f2898d52..656e08d9 100644 --- a/client-py3/full/src/UDSClientLauncher.py +++ b/client-py3/full/src/UDSClientLauncher.py @@ -13,14 +13,28 @@ SCRIPT_NAME = 'UDSClientLauncher' class UdsApplication(QtWidgets.QApplication): path: str + tunnels: typing.List[subprocess.Popen] + def __init__(self, argv: typing.List[str]) -> None: super().__init__(argv) self.path = os.path.join(os.path.dirname(sys.argv[0]).replace('Resources', 'MacOS'), SCRIPT_NAME) + self.tunnels = [] + self.lastWindowClosed.connect(self.closeTunnels) # type: ignore + + def cleanTunnels(self) -> None: + for k in [i for i, tunnel in enumerate(self.tunnels) if tunnel.poll() is not None]: + del self.tunnels[k] + + def closeTunnels(self) -> None: + logger.debug('Closing remaining tunnels') + for tunnel in self.tunnels: + if tunnel.poll() is None: # Running + logger.info('Found running tunnel %s, closing it', tunnel.pid) + tunnel.kill() def event(self, evnt: QtCore.QEvent) -> bool: - logger.debug('Got event %s -> %s', evnt, evnt.type()) - if evnt.type() == QtCore.QEvent.FileOpen: + # First, remove all finished tunnel processed from check queue fe = typing.cast(QtGui.QFileOpenEvent, evnt) logger.debug('Got url: %s', fe.url().url()) fe.accept() diff --git a/client-py3/full/src/UDSLauncherMac.py b/client-py3/full/src/UDSLauncherMac.py index 72719984..f7bc9037 100644 --- a/client-py3/full/src/UDSLauncherMac.py +++ b/client-py3/full/src/UDSLauncherMac.py @@ -15,8 +15,8 @@ class Ui_MacLauncher(object): def setupUi(self, MacLauncher): MacLauncher.setObjectName("MacLauncher") MacLauncher.setWindowModality(QtCore.Qt.NonModal) - MacLauncher.resize(256, 150) - MacLauncher.setCursor(QtGui.QCursor(QtCore.Qt.BusyCursor)) + MacLauncher.resize(235, 120) + MacLauncher.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor)) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/images/logo-uds-small"), QtGui.QIcon.Normal, QtGui.QIcon.Off) MacLauncher.setWindowIcon(icon) @@ -32,14 +32,14 @@ class Ui_MacLauncher(object): self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel) self.frame.setFrameShadow(QtWidgets.QFrame.Raised) self.frame.setObjectName("frame") - self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.frame) - self.verticalLayout_3.setContentsMargins(4, 4, 4, 4) - self.verticalLayout_3.setSpacing(4) - self.verticalLayout_3.setObjectName("verticalLayout_3") - self.verticalLayout = QtWidgets.QVBoxLayout() + self.verticalLayout = QtWidgets.QVBoxLayout(self.frame) self.verticalLayout.setObjectName("verticalLayout") + self.topLabel = QtWidgets.QLabel(self.frame) + self.topLabel.setTextFormat(QtCore.Qt.RichText) + self.topLabel.setObjectName("topLabel") + self.verticalLayout.addWidget(self.topLabel) self.image = QtWidgets.QLabel(self.frame) - self.image.setMinimumSize(QtCore.QSize(0, 24)) + self.image.setMinimumSize(QtCore.QSize(0, 32)) self.image.setAutoFillBackground(True) self.image.setText("") self.image.setPixmap(QtGui.QPixmap(":/images/logo-uds-small")) @@ -47,14 +47,10 @@ class Ui_MacLauncher(object): self.image.setAlignment(QtCore.Qt.AlignCenter) self.image.setObjectName("image") self.verticalLayout.addWidget(self.image) - self.info = QtWidgets.QLabel(self.frame) - self.info.setMaximumSize(QtCore.QSize(16777215, 16)) - self.info.setAlignment(QtCore.Qt.AlignCenter) - self.info.setObjectName("info") - self.verticalLayout.addWidget(self.info) - spacerItem = QtWidgets.QSpacerItem(20, 30, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) - self.verticalLayout.addItem(spacerItem) - self.verticalLayout_3.addLayout(self.verticalLayout) + self.label_2 = QtWidgets.QLabel(self.frame) + self.label_2.setTextFormat(QtCore.Qt.RichText) + self.label_2.setObjectName("label_2") + self.verticalLayout.addWidget(self.label_2) self.verticalLayout_2.addWidget(self.frame) MacLauncher.setCentralWidget(self.centralwidget) @@ -64,7 +60,8 @@ class Ui_MacLauncher(object): def retranslateUi(self, MacLauncher): _translate = QtCore.QCoreApplication.translate MacLauncher.setWindowTitle(_translate("MacLauncher", "UDS Launcher")) - self.info.setText(_translate("MacLauncher", "UDS Launcher")) + self.topLabel.setText(_translate("MacLauncher", "
UDS Launcher
")) + self.label_2.setText(_translate("MacLauncher", "Closing this window will end all UDS tunnels
")) import UDSResources_rc diff --git a/client-py3/full/src/UDSLauncherMac.ui b/client-py3/full/src/UDSLauncherMac.ui index 959dc16b..d5d97f44 100644 --- a/client-py3/full/src/UDSLauncherMac.ui +++ b/client-py3/full/src/UDSLauncherMac.ui @@ -9,12 +9,12 @@