parent
3ee2882093
commit
6eda9eb7bc
7 changed files with 0 additions and 143 deletions
@ -1,63 +0,0 @@ |
||||
#!/usr/bin/env python3 |
||||
import os |
||||
import time |
||||
import subprocess |
||||
from openpilot.common.basedir import BASEDIR |
||||
|
||||
|
||||
class TextWindow: |
||||
def __init__(self, text): |
||||
try: |
||||
self.text_proc = subprocess.Popen(["./text", text], |
||||
stdin=subprocess.PIPE, |
||||
cwd=os.path.join(BASEDIR, "selfdrive", "ui"), |
||||
close_fds=True) |
||||
except OSError: |
||||
self.text_proc = None |
||||
|
||||
def get_status(self): |
||||
if self.text_proc is not None: |
||||
self.text_proc.poll() |
||||
return self.text_proc.returncode |
||||
return None |
||||
|
||||
def __enter__(self): |
||||
return self |
||||
|
||||
def close(self): |
||||
if self.text_proc is not None: |
||||
self.text_proc.terminate() |
||||
self.text_proc = None |
||||
|
||||
def wait_for_exit(self): |
||||
if self.text_proc is not None: |
||||
while True: |
||||
if self.get_status() == 1: |
||||
return |
||||
time.sleep(0.1) |
||||
|
||||
def __del__(self): |
||||
self.close() |
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback): |
||||
self.close() |
||||
|
||||
|
||||
if __name__ == "__main__": |
||||
text = """Traceback (most recent call last): |
||||
File "./controlsd.py", line 608, in <module> |
||||
main() |
||||
File "./controlsd.py", line 604, in main |
||||
controlsd_thread(sm, pm, logcan) |
||||
File "./controlsd.py", line 455, in controlsd_thread |
||||
1/0 |
||||
ZeroDivisionError: division by zero""" |
||||
print(text) |
||||
|
||||
with TextWindow(text) as s: |
||||
for _ in range(100): |
||||
if s.get_status() == 1: |
||||
print("Got exit button") |
||||
break |
||||
time.sleep(0.1) |
||||
print("gone") |
@ -1,64 +0,0 @@ |
||||
#include <QApplication> |
||||
#include <QLabel> |
||||
#include <QPushButton> |
||||
#include <QScrollBar> |
||||
#include <QVBoxLayout> |
||||
#include <QWidget> |
||||
|
||||
#include "system/hardware/hw.h" |
||||
#include "selfdrive/ui/qt/util.h" |
||||
#include "selfdrive/ui/qt/qt_window.h" |
||||
#include "selfdrive/ui/qt/widgets/scrollview.h" |
||||
|
||||
int main(int argc, char *argv[]) { |
||||
initApp(argc, argv); |
||||
QApplication a(argc, argv); |
||||
QWidget window; |
||||
setMainWindow(&window); |
||||
|
||||
QGridLayout *main_layout = new QGridLayout(&window); |
||||
main_layout->setMargin(50); |
||||
|
||||
QLabel *label = new QLabel(argv[1]); |
||||
label->setWordWrap(true); |
||||
label->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); |
||||
ScrollView *scroll = new ScrollView(label); |
||||
scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); |
||||
main_layout->addWidget(scroll, 0, 0, Qt::AlignTop); |
||||
|
||||
// Scroll to the bottom
|
||||
QObject::connect(scroll->verticalScrollBar(), &QAbstractSlider::rangeChanged, [=]() { |
||||
scroll->verticalScrollBar()->setValue(scroll->verticalScrollBar()->maximum()); |
||||
}); |
||||
|
||||
QPushButton *btn = new QPushButton(); |
||||
#ifdef __aarch64__ |
||||
btn->setText(QObject::tr("Reboot")); |
||||
QObject::connect(btn, &QPushButton::clicked, [=]() { |
||||
Hardware::reboot(); |
||||
}); |
||||
#else |
||||
btn->setText(QObject::tr("Exit")); |
||||
QObject::connect(btn, &QPushButton::clicked, &a, &QApplication::quit); |
||||
#endif |
||||
main_layout->addWidget(btn, 0, 0, Qt::AlignRight | Qt::AlignBottom); |
||||
|
||||
window.setStyleSheet(R"( |
||||
* { |
||||
outline: none; |
||||
color: white; |
||||
background-color: black; |
||||
font-size: 60px; |
||||
} |
||||
QPushButton { |
||||
padding: 50px; |
||||
padding-right: 100px; |
||||
padding-left: 100px; |
||||
border: 2px solid white; |
||||
border-radius: 20px; |
||||
margin-right: 40px; |
||||
} |
||||
)"); |
||||
|
||||
return a.exec(); |
||||
} |
@ -1,3 +0,0 @@ |
||||
version https://git-lfs.github.com/spec/v1 |
||||
oid sha256:61f539845ebfc9568c8d28867f1e5642e882f52ead8862c9b2224b7139f4a552 |
||||
size 3787480 |
@ -1,7 +0,0 @@ |
||||
#!/bin/sh |
||||
|
||||
if [ -f /TICI ] && [ ! -f _text ]; then |
||||
cp qt/text_larch64 _text |
||||
fi |
||||
|
||||
exec ./_text "$1" |
Loading…
Reference in new issue