diff --git a/board/fischertechnik/TXT/rootfs/opt/ftc/ftc_gui.py b/board/fischertechnik/TXT/rootfs/opt/ftc/ftc_gui.py index f4d09abb5a..165ad1a60e 100755 --- a/board/fischertechnik/TXT/rootfs/opt/ftc/ftc_gui.py +++ b/board/fischertechnik/TXT/rootfs/opt/ftc/ftc_gui.py @@ -31,6 +31,8 @@ app = None app_executable = "" +# A fullscreen message dialog. Currently only used to show the +# "shutting down" message class MessageDialog(QDialog): def __init__(self,str): QDialog.__init__(self) @@ -181,6 +183,8 @@ def animate(self): self.repaint() def close(self): + self.etimer.stop() + self.atimer.stop() super(BusyAnimation, self).close() super(BusyAnimation, self).deleteLater() @@ -202,17 +206,12 @@ def paintEvent(self, event): painter.end() -class OutputDialog(TxtDialog): +class TextmodeDialog(TxtDialog): def __init__(self,title,parent): TxtDialog.__init__(self, title, parent) self.txt = QTextEdit() self.txt.setReadOnly(True) - - font = QFont() - font.setPointSize(16) - self.txt.setFont(font) - self.setCentralWidget(self.txt) self.p = None @@ -244,6 +243,10 @@ def append(self, str): self.txt.moveCursor(QTextCursor.End) self.txt.insertPlainText(str) + def close(self): + self.timer.stop() + TxtDialog.close(self) + class FtcGuiApplication(QApplication): def __init__(self, args): QApplication.__init__(self, args) @@ -321,12 +324,14 @@ def on_app_running(self, pid): if self.popup: self.popup.close() - def launch_textmode_app(self, executable,name): - dialog = OutputDialog(name, self.w) + def launch_textmode_app(self, executable, name): + global app, app_executable + dialog = TextmodeDialog(name, self.w) + app_executable = executable master_fd, slave_fd = pty.openpty() - p = subprocess.Popen(str(executable), stdout=slave_fd, stderr=slave_fd) - dialog.poll(p, master_fd) + app = subprocess.Popen(str(executable), stdout=slave_fd, stderr=slave_fd) + dialog.poll(app, master_fd) dialog.exec_() os.close(master_fd) os.close(slave_fd) @@ -342,7 +347,7 @@ def launch_app(self, executable, managed, name): if managed.lower() == "text": self.launch_textmode_app(executable, name) return - + # run the executable app_executable = executable app = subprocess.Popen(str(executable))