commit ecdeb0a44cd0cd2faf6d4540449be9eb555b89e4 Author: bartool Date: Tue Jul 12 07:25:44 2022 +0200 start repository diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b0f2192 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +__pycache__ +.venv \ No newline at end of file diff --git a/Highlighter.py b/Highlighter.py new file mode 100644 index 0000000..d0bf5f0 --- /dev/null +++ b/Highlighter.py @@ -0,0 +1,38 @@ +from dataclasses import dataclass +from PySide6 import QtWidgets, QtGui, QtCore + +from TextFormat import TextFormat + +@dataclass +class Rule: + name: str + enable: bool + format: TextFormat + regex: QtCore.QRegularExpression + + def isEnable(self): + return self.enable + + def getTextCharFormat(self): + return self.format.format + + def setPattern(self, pattern: str): + self.regex.setPattern(pattern) + +class Highlighter(QtGui.QSyntaxHighlighter): + def __init__(self, document): + super().__init__(document) + self.rules: list[Rule] = [] + + def setListOfRules(self, rules: list[Rule]): + self.rules = rules + + def highlightBlock(self, text): + for rule in self.rules: + if not rule.enable: + continue + i = rule.regex.globalMatch(text) + while i.hasNext(): + match = i.next() + # print(f"0: {match.captured(0)}, 1: {match.captured(1)}, start: {match.capturedStart(1)}, lenght: {match.capturedLength(1)}") + self.setFormat(match.capturedStart(1), match.capturedLength(1), rule.getTextCharFormat()) diff --git a/MainWindow.ui b/MainWindow.ui new file mode 100644 index 0000000..bc7f067 --- /dev/null +++ b/MainWindow.ui @@ -0,0 +1,455 @@ + + + MainWindow + + + + 0 + 0 + 1024 + 480 + + + + Serial Vizualizer + + + + + 10 + + + + + + + + + false + + + + 0 + 50 + + + + Connect + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 50 + + + + Settings + + + + + + + + + Qt::Horizontal + + + + + + + 6 + + + + + + + + + Add + + + + + + + Remove + + + + + + + + + + 0 + 0 + + + + QAbstractItemView::InternalMove + + + Qt::MoveAction + + + QListView::Snap + + + + + + + Pattern info + + + + 20 + + + + + Name: + + + + + + + Regex1 + + + + + + + Pattern: + + + + + + + "/d/d/d" + + + + + + + isValid: + + + + + + + True + + + + + + + Matches: + + + + + + + 120 + + + + + + + Example: + + + + + + + + 0 + 0 + + + + Edit + + + + + + + Qt::LeftToRight + + + background-color: rgb(35, 35, 35); +color: rgb(244, 244, 244); + + + __example text__ + + + Qt::AlignCenter + + + + + + + + + + + + + + + + Timestamp + + + true + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Clear + + + + + + + AutoScroll + + + true + + + true + + + + + + + + + + + + + + + + + EndLine + + + true + + + true + + + + + + + Send + + + + + + + + + + + + + Edit Commands + + + + + + + + 120 + 0 + + + + Qt::ScrollBarAlwaysOff + + + true + + + + + 0 + 0 + 101 + 318 + + + + + 9 + + + + + Command1 + + + + + + + Command2 + + + + + + + Command3 + + + + + + + Command4 + + + + + + + Command5 + + + + + + + Command6 + + + + + + + Command7 + + + + + + + Command8 + + + + + + + Command9 + + + + + + + Command10 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + + + + PushButton + + + + + + + + + + + + diff --git a/MainWindow_ui.py b/MainWindow_ui.py new file mode 100644 index 0000000..74a5eee --- /dev/null +++ b/MainWindow_ui.py @@ -0,0 +1,1480 @@ +# -*- coding: utf-8 -*- + +################################################################################ +## Form generated from reading UI file 'SerialVizualizerMainWindow.ui' +## +## Created by: Qt User Interface Compiler version 6.2.3 +## +## WARNING! All changes made in this file will be lost when recompiling UI file! +################################################################################ + +from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, + QMetaObject, QObject, QPoint, QRect, + QSize, QTime, QUrl, Qt) +from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor, + QFont, QFontDatabase, QGradient, QIcon, + QImage, QKeySequence, QLinearGradient, QPainter, + QPalette, QPixmap, QRadialGradient, QTransform) +from PySide6.QtWidgets import (QApplication, QFormLayout, QFrame, QGroupBox, + QHBoxLayout, QLabel, QLineEdit, QListWidget, + QListWidgetItem, QMainWindow, QPushButton, QScrollArea, + QSizePolicy, QSpacerItem, QStatusBar, QTextEdit, + QVBoxLayout, QWidget) + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + if not MainWindow.objectName(): + MainWindow.setObjectName(u"MainWindow") + MainWindow.resize(1024, 480) + self.centralwidget = QWidget(MainWindow) + self.centralwidget.setObjectName(u"centralwidget") + font = QFont() + font.setPointSize(10) + self.centralwidget.setFont(font) + self.verticalLayout_5 = QVBoxLayout(self.centralwidget) + self.verticalLayout_5.setObjectName(u"verticalLayout_5") + self.horizontalLayout = QHBoxLayout() + self.horizontalLayout.setObjectName(u"horizontalLayout") + self.btn_connect = QPushButton(self.centralwidget) + self.btn_connect.setObjectName(u"btn_connect") + self.btn_connect.setEnabled(False) + self.btn_connect.setMinimumSize(QSize(0, 50)) + + self.horizontalLayout.addWidget(self.btn_connect) + + self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + + self.horizontalLayout.addItem(self.horizontalSpacer) + + self.btn_settings = QPushButton(self.centralwidget) + self.btn_settings.setObjectName(u"btn_settings") + self.btn_settings.setMinimumSize(QSize(0, 50)) + + self.horizontalLayout.addWidget(self.btn_settings) + + + self.verticalLayout_5.addLayout(self.horizontalLayout) + + self.line = QFrame(self.centralwidget) + self.line.setObjectName(u"line") + self.line.setFrameShape(QFrame.HLine) + self.line.setFrameShadow(QFrame.Sunken) + + self.verticalLayout_5.addWidget(self.line) + + self.horizontalLayout_5 = QHBoxLayout() + self.horizontalLayout_5.setSpacing(6) + self.horizontalLayout_5.setObjectName(u"horizontalLayout_5") + self.verticalLayout_2 = QVBoxLayout() + self.verticalLayout_2.setObjectName(u"verticalLayout_2") + self.horizontalLayout_4 = QHBoxLayout() + self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") + self.btn_addPattern = QPushButton(self.centralwidget) + self.btn_addPattern.setObjectName(u"btn_addPattern") + + self.horizontalLayout_4.addWidget(self.btn_addPattern) + + self.btn_removePattern = QPushButton(self.centralwidget) + self.btn_removePattern.setObjectName(u"btn_removePattern") + + self.horizontalLayout_4.addWidget(self.btn_removePattern) + + + self.verticalLayout_2.addLayout(self.horizontalLayout_4) + + self.listWidget = QListWidget(self.centralwidget) + self.listWidget.setObjectName(u"listWidget") + sizePolicy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.listWidget.sizePolicy().hasHeightForWidth()) + self.listWidget.setSizePolicy(sizePolicy) + + self.verticalLayout_2.addWidget(self.listWidget) + + self.groupBox = QGroupBox(self.centralwidget) + self.groupBox.setObjectName(u"groupBox") + self.formLayout = QFormLayout(self.groupBox) + self.formLayout.setObjectName(u"formLayout") + self.formLayout.setHorizontalSpacing(20) + self.label = QLabel(self.groupBox) + self.label.setObjectName(u"label") + + self.formLayout.setWidget(0, QFormLayout.LabelRole, self.label) + + self.lbl_namePattern = QLabel(self.groupBox) + self.lbl_namePattern.setObjectName(u"lbl_namePattern") + + self.formLayout.setWidget(0, QFormLayout.FieldRole, self.lbl_namePattern) + + self.label_3 = QLabel(self.groupBox) + self.label_3.setObjectName(u"label_3") + + self.formLayout.setWidget(1, QFormLayout.LabelRole, self.label_3) + + self.lbl_patternPattern = QLabel(self.groupBox) + self.lbl_patternPattern.setObjectName(u"lbl_patternPattern") + + self.formLayout.setWidget(1, QFormLayout.FieldRole, self.lbl_patternPattern) + + self.label_5 = QLabel(self.groupBox) + self.label_5.setObjectName(u"label_5") + + self.formLayout.setWidget(2, QFormLayout.LabelRole, self.label_5) + + self.lbl_isValidPattern = QLabel(self.groupBox) + self.lbl_isValidPattern.setObjectName(u"lbl_isValidPattern") + + self.formLayout.setWidget(2, QFormLayout.FieldRole, self.lbl_isValidPattern) + + self.label_7 = QLabel(self.groupBox) + self.label_7.setObjectName(u"label_7") + + self.formLayout.setWidget(3, QFormLayout.LabelRole, self.label_7) + + self.lbl_matchesCountPattern = QLabel(self.groupBox) + self.lbl_matchesCountPattern.setObjectName(u"lbl_matchesCountPattern") + + self.formLayout.setWidget(3, QFormLayout.FieldRole, self.lbl_matchesCountPattern) + + self.label_9 = QLabel(self.groupBox) + self.label_9.setObjectName(u"label_9") + + self.formLayout.setWidget(4, QFormLayout.LabelRole, self.label_9) + + self.lbl_examplePattern = QLabel(self.groupBox) + self.lbl_examplePattern.setObjectName(u"lbl_examplePattern") + self.lbl_examplePattern.setStyleSheet(u"background-color: rgb(35, 35, 35);\n" +"color: rgb(244, 244, 244);") + + self.formLayout.setWidget(4, QFormLayout.FieldRole, self.lbl_examplePattern) + + self.btn_editPattern = QPushButton(self.groupBox) + self.btn_editPattern.setObjectName(u"btn_editPattern") + sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) + sizePolicy1.setHorizontalStretch(0) + sizePolicy1.setVerticalStretch(0) + sizePolicy1.setHeightForWidth(self.btn_editPattern.sizePolicy().hasHeightForWidth()) + self.btn_editPattern.setSizePolicy(sizePolicy1) + + self.formLayout.setWidget(5, QFormLayout.SpanningRole, self.btn_editPattern) + + + self.verticalLayout_2.addWidget(self.groupBox) + + + self.horizontalLayout_5.addLayout(self.verticalLayout_2) + + self.verticalLayout = QVBoxLayout() + self.verticalLayout.setObjectName(u"verticalLayout") + self.horizontalLayout_3 = QHBoxLayout() + self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") + self.btn_timestamp = QPushButton(self.centralwidget) + self.btn_timestamp.setObjectName(u"btn_timestamp") + self.btn_timestamp.setCheckable(True) + self.btn_timestamp.setChecked(True) + + self.horizontalLayout_3.addWidget(self.btn_timestamp) + + self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + + self.horizontalLayout_3.addItem(self.horizontalSpacer_2) + + self.btn_clearMainTerminal = QPushButton(self.centralwidget) + self.btn_clearMainTerminal.setObjectName(u"btn_clearMainTerminal") + + self.horizontalLayout_3.addWidget(self.btn_clearMainTerminal) + + self.btn_autoScrollMainTermianl = QPushButton(self.centralwidget) + self.btn_autoScrollMainTermianl.setObjectName(u"btn_autoScrollMainTermianl") + self.btn_autoScrollMainTermianl.setCheckable(True) + self.btn_autoScrollMainTermianl.setChecked(True) + + self.horizontalLayout_3.addWidget(self.btn_autoScrollMainTermianl) + + + self.verticalLayout.addLayout(self.horizontalLayout_3) + + self.txtEdit_mainTerminal = QTextEdit(self.centralwidget) + self.txtEdit_mainTerminal.setObjectName(u"txtEdit_mainTerminal") + + self.verticalLayout.addWidget(self.txtEdit_mainTerminal) + + self.horizontalLayout_2 = QHBoxLayout() + self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") + self.lineEdit = QLineEdit(self.centralwidget) + self.lineEdit.setObjectName(u"lineEdit") + + self.horizontalLayout_2.addWidget(self.lineEdit) + + self.btn_endLine = QPushButton(self.centralwidget) + self.btn_endLine.setObjectName(u"btn_endLine") + self.btn_endLine.setCheckable(True) + self.btn_endLine.setChecked(True) + + self.horizontalLayout_2.addWidget(self.btn_endLine) + + self.btn_send = QPushButton(self.centralwidget) + self.btn_send.setObjectName(u"btn_send") + + self.horizontalLayout_2.addWidget(self.btn_send) + + + self.verticalLayout.addLayout(self.horizontalLayout_2) + + + self.horizontalLayout_5.addLayout(self.verticalLayout) + + self.verticalLayout_3 = QVBoxLayout() + self.verticalLayout_3.setObjectName(u"verticalLayout_3") + self.pushButton_10 = QPushButton(self.centralwidget) + self.pushButton_10.setObjectName(u"pushButton_10") + + self.verticalLayout_3.addWidget(self.pushButton_10) + + self.scrollArea = QScrollArea(self.centralwidget) + self.scrollArea.setObjectName(u"scrollArea") + self.scrollArea.setMinimumSize(QSize(120, 0)) + self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) + self.scrollArea.setWidgetResizable(True) + self.scrollAreaWidgetContents = QWidget() + self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents") + self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 101, 318)) + self.verticalLayout_6 = QVBoxLayout(self.scrollAreaWidgetContents) + self.verticalLayout_6.setObjectName(u"verticalLayout_6") + self.verticalLayout_6.setContentsMargins(-1, -1, 9, -1) + self.btn_command1 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command1.setObjectName(u"btn_command1") + + self.verticalLayout_6.addWidget(self.btn_command1) + + self.btn_command2 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command2.setObjectName(u"btn_command2") + + self.verticalLayout_6.addWidget(self.btn_command2) + + self.btn_command3 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command3.setObjectName(u"btn_command3") + + self.verticalLayout_6.addWidget(self.btn_command3) + + self.btn_command4 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command4.setObjectName(u"btn_command4") + + self.verticalLayout_6.addWidget(self.btn_command4) + + self.btn_command5 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command5.setObjectName(u"btn_command5") + + self.verticalLayout_6.addWidget(self.btn_command5) + + self.btn_command6 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command6.setObjectName(u"btn_command6") + + self.verticalLayout_6.addWidget(self.btn_command6) + + self.btn_command7 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command7.setObjectName(u"btn_command7") + + self.verticalLayout_6.addWidget(self.btn_command7) + + self.btn_command8 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command8.setObjectName(u"btn_command8") + + self.verticalLayout_6.addWidget(self.btn_command8) + + self.btn_command9 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command9.setObjectName(u"btn_command9") + + self.verticalLayout_6.addWidget(self.btn_command9) + + self.btn_command10 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command10.setObjectName(u"btn_command10") + + self.verticalLayout_6.addWidget(self.btn_command10) + + self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) + + self.verticalLayout_6.addItem(self.verticalSpacer) + + self.scrollArea.setWidget(self.scrollAreaWidgetContents) + + self.verticalLayout_3.addWidget(self.scrollArea) + + + self.horizontalLayout_5.addLayout(self.verticalLayout_3) + + self.horizontalLayout_5.setStretch(1, 1) + + self.verticalLayout_5.addLayout(self.horizontalLayout_5) + + self.verticalLayout_4 = QVBoxLayout() + self.verticalLayout_4.setObjectName(u"verticalLayout_4") + self.pushButton_9 = QPushButton(self.centralwidget) + self.pushButton_9.setObjectName(u"pushButton_9") + + self.verticalLayout_4.addWidget(self.pushButton_9) + + + self.verticalLayout_5.addLayout(self.verticalLayout_4) + + MainWindow.setCentralWidget(self.centralwidget) + self.statusbar = QStatusBar(MainWindow) + self.statusbar.setObjectName(u"statusbar") + MainWindow.setStatusBar(self.statusbar) + + self.retranslateUi(MainWindow) + self.btn_clearMainTerminal.clicked.connect(self.txtEdit_mainTerminal.clear) + + QMetaObject.connectSlotsByName(MainWindow) + # setupUi + + def retranslateUi(self, MainWindow): + MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Serial Vizualizer", None)) + self.btn_connect.setText(QCoreApplication.translate("MainWindow", u"Connect", None)) + self.btn_settings.setText(QCoreApplication.translate("MainWindow", u"Settings", None)) + self.btn_addPattern.setText(QCoreApplication.translate("MainWindow", u"Add", None)) + self.btn_removePattern.setText(QCoreApplication.translate("MainWindow", u"Remove", None)) + self.groupBox.setTitle(QCoreApplication.translate("MainWindow", u"Pattern info", None)) + self.label.setText(QCoreApplication.translate("MainWindow", u"Name:", None)) + self.lbl_namePattern.setText(QCoreApplication.translate("MainWindow", u"Regex1", None)) + self.label_3.setText(QCoreApplication.translate("MainWindow", u"Pattern:", None)) + self.lbl_patternPattern.setText(QCoreApplication.translate("MainWindow", u"\"/d/d/d\"", None)) + self.label_5.setText(QCoreApplication.translate("MainWindow", u"isValid:", None)) + self.lbl_isValidPattern.setText(QCoreApplication.translate("MainWindow", u"True", None)) + self.label_7.setText(QCoreApplication.translate("MainWindow", u"Matches:", None)) + self.lbl_matchesCountPattern.setText(QCoreApplication.translate("MainWindow", u"120", None)) + self.label_9.setText(QCoreApplication.translate("MainWindow", u"Example:", None)) + self.lbl_examplePattern.setText(QCoreApplication.translate("MainWindow", u"__example text__", None)) + self.btn_editPattern.setText(QCoreApplication.translate("MainWindow", u"Edit", None)) + self.btn_timestamp.setText(QCoreApplication.translate("MainWindow", u"Timestamp", None)) + self.btn_clearMainTerminal.setText(QCoreApplication.translate("MainWindow", u"Clear", None)) + self.btn_autoScrollMainTermianl.setText(QCoreApplication.translate("MainWindow", u"AutoScroll", None)) + self.btn_endLine.setText(QCoreApplication.translate("MainWindow", u"EndLine", None)) + self.btn_send.setText(QCoreApplication.translate("MainWindow", u"Send", None)) + self.pushButton_10.setText(QCoreApplication.translate("MainWindow", u"Edit Commands", None)) + self.btn_command1.setText(QCoreApplication.translate("MainWindow", u"Command1", None)) + self.btn_command2.setText(QCoreApplication.translate("MainWindow", u"Command2", None)) + self.btn_command3.setText(QCoreApplication.translate("MainWindow", u"Command3", None)) + self.btn_command4.setText(QCoreApplication.translate("MainWindow", u"Command4", None)) + self.btn_command5.setText(QCoreApplication.translate("MainWindow", u"Command5", None)) + self.btn_command6.setText(QCoreApplication.translate("MainWindow", u"Command6", None)) + self.btn_command7.setText(QCoreApplication.translate("MainWindow", u"Command7", None)) + self.btn_command8.setText(QCoreApplication.translate("MainWindow", u"Command8", None)) + self.btn_command9.setText(QCoreApplication.translate("MainWindow", u"Command9", None)) + self.btn_command10.setText(QCoreApplication.translate("MainWindow", u"Command10", None)) + self.pushButton_9.setText(QCoreApplication.translate("MainWindow", u"PushButton", None)) + # retranslateUi + +# -*- coding: utf-8 -*- + +################################################################################ +## Form generated from reading UI file 'MainWindow.ui' +## +## Created by: Qt User Interface Compiler version 6.2.3 +## +## WARNING! All changes made in this file will be lost when recompiling UI file! +################################################################################ + +from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, + QMetaObject, QObject, QPoint, QRect, + QSize, QTime, QUrl, Qt) +from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor, + QFont, QFontDatabase, QGradient, QIcon, + QImage, QKeySequence, QLinearGradient, QPainter, + QPalette, QPixmap, QRadialGradient, QTransform) +from PySide6.QtWidgets import (QAbstractItemView, QApplication, QFormLayout, QFrame, + QGroupBox, QHBoxLayout, QLabel, QLineEdit, + QListView, QListWidget, QListWidgetItem, QMainWindow, + QPlainTextEdit, QPushButton, QScrollArea, QSizePolicy, + QSpacerItem, QStatusBar, QVBoxLayout, QWidget) + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + if not MainWindow.objectName(): + MainWindow.setObjectName(u"MainWindow") + MainWindow.resize(1024, 480) + self.centralwidget = QWidget(MainWindow) + self.centralwidget.setObjectName(u"centralwidget") + font = QFont() + font.setPointSize(10) + self.centralwidget.setFont(font) + self.verticalLayout_5 = QVBoxLayout(self.centralwidget) + self.verticalLayout_5.setObjectName(u"verticalLayout_5") + self.horizontalLayout = QHBoxLayout() + self.horizontalLayout.setObjectName(u"horizontalLayout") + self.btn_connect = QPushButton(self.centralwidget) + self.btn_connect.setObjectName(u"btn_connect") + self.btn_connect.setEnabled(False) + self.btn_connect.setMinimumSize(QSize(0, 50)) + + self.horizontalLayout.addWidget(self.btn_connect) + + self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + + self.horizontalLayout.addItem(self.horizontalSpacer) + + self.btn_settings = QPushButton(self.centralwidget) + self.btn_settings.setObjectName(u"btn_settings") + self.btn_settings.setMinimumSize(QSize(0, 50)) + + self.horizontalLayout.addWidget(self.btn_settings) + + + self.verticalLayout_5.addLayout(self.horizontalLayout) + + self.line = QFrame(self.centralwidget) + self.line.setObjectName(u"line") + self.line.setFrameShape(QFrame.HLine) + self.line.setFrameShadow(QFrame.Sunken) + + self.verticalLayout_5.addWidget(self.line) + + self.horizontalLayout_5 = QHBoxLayout() + self.horizontalLayout_5.setSpacing(6) + self.horizontalLayout_5.setObjectName(u"horizontalLayout_5") + self.verticalLayout_2 = QVBoxLayout() + self.verticalLayout_2.setObjectName(u"verticalLayout_2") + self.horizontalLayout_4 = QHBoxLayout() + self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") + self.btn_addPattern = QPushButton(self.centralwidget) + self.btn_addPattern.setObjectName(u"btn_addPattern") + + self.horizontalLayout_4.addWidget(self.btn_addPattern) + + self.btn_removePattern = QPushButton(self.centralwidget) + self.btn_removePattern.setObjectName(u"btn_removePattern") + + self.horizontalLayout_4.addWidget(self.btn_removePattern) + + + self.verticalLayout_2.addLayout(self.horizontalLayout_4) + + self.lst_regex = QListWidget(self.centralwidget) + self.lst_regex.setObjectName(u"lst_regex") + sizePolicy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.lst_regex.sizePolicy().hasHeightForWidth()) + self.lst_regex.setSizePolicy(sizePolicy) + self.lst_regex.setDragDropMode(QAbstractItemView.InternalMove) + self.lst_regex.setDefaultDropAction(Qt.MoveAction) + self.lst_regex.setMovement(QListView.Snap) + + self.verticalLayout_2.addWidget(self.lst_regex) + + self.groupBox = QGroupBox(self.centralwidget) + self.groupBox.setObjectName(u"groupBox") + self.formLayout = QFormLayout(self.groupBox) + self.formLayout.setObjectName(u"formLayout") + self.formLayout.setHorizontalSpacing(20) + self.label = QLabel(self.groupBox) + self.label.setObjectName(u"label") + + self.formLayout.setWidget(0, QFormLayout.LabelRole, self.label) + + self.lbl_namePattern = QLabel(self.groupBox) + self.lbl_namePattern.setObjectName(u"lbl_namePattern") + + self.formLayout.setWidget(0, QFormLayout.FieldRole, self.lbl_namePattern) + + self.label_3 = QLabel(self.groupBox) + self.label_3.setObjectName(u"label_3") + + self.formLayout.setWidget(1, QFormLayout.LabelRole, self.label_3) + + self.lbl_patternPattern = QLabel(self.groupBox) + self.lbl_patternPattern.setObjectName(u"lbl_patternPattern") + + self.formLayout.setWidget(1, QFormLayout.FieldRole, self.lbl_patternPattern) + + self.label_5 = QLabel(self.groupBox) + self.label_5.setObjectName(u"label_5") + + self.formLayout.setWidget(2, QFormLayout.LabelRole, self.label_5) + + self.lbl_isValidPattern = QLabel(self.groupBox) + self.lbl_isValidPattern.setObjectName(u"lbl_isValidPattern") + + self.formLayout.setWidget(2, QFormLayout.FieldRole, self.lbl_isValidPattern) + + self.label_7 = QLabel(self.groupBox) + self.label_7.setObjectName(u"label_7") + + self.formLayout.setWidget(3, QFormLayout.LabelRole, self.label_7) + + self.lbl_matchesCountPattern = QLabel(self.groupBox) + self.lbl_matchesCountPattern.setObjectName(u"lbl_matchesCountPattern") + + self.formLayout.setWidget(3, QFormLayout.FieldRole, self.lbl_matchesCountPattern) + + self.label_9 = QLabel(self.groupBox) + self.label_9.setObjectName(u"label_9") + + self.formLayout.setWidget(4, QFormLayout.LabelRole, self.label_9) + + self.lbl_examplePattern = QLabel(self.groupBox) + self.lbl_examplePattern.setObjectName(u"lbl_examplePattern") + self.lbl_examplePattern.setStyleSheet(u"background-color: rgb(35, 35, 35);\n" +"color: rgb(244, 244, 244);") + + self.formLayout.setWidget(4, QFormLayout.FieldRole, self.lbl_examplePattern) + + self.btn_editPattern = QPushButton(self.groupBox) + self.btn_editPattern.setObjectName(u"btn_editPattern") + sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) + sizePolicy1.setHorizontalStretch(0) + sizePolicy1.setVerticalStretch(0) + sizePolicy1.setHeightForWidth(self.btn_editPattern.sizePolicy().hasHeightForWidth()) + self.btn_editPattern.setSizePolicy(sizePolicy1) + + self.formLayout.setWidget(5, QFormLayout.SpanningRole, self.btn_editPattern) + + + self.verticalLayout_2.addWidget(self.groupBox) + + + self.horizontalLayout_5.addLayout(self.verticalLayout_2) + + self.verticalLayout = QVBoxLayout() + self.verticalLayout.setObjectName(u"verticalLayout") + self.horizontalLayout_3 = QHBoxLayout() + self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") + self.btn_timestamp = QPushButton(self.centralwidget) + self.btn_timestamp.setObjectName(u"btn_timestamp") + self.btn_timestamp.setCheckable(True) + self.btn_timestamp.setChecked(True) + + self.horizontalLayout_3.addWidget(self.btn_timestamp) + + self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + + self.horizontalLayout_3.addItem(self.horizontalSpacer_2) + + self.btn_clearMainTerminal = QPushButton(self.centralwidget) + self.btn_clearMainTerminal.setObjectName(u"btn_clearMainTerminal") + + self.horizontalLayout_3.addWidget(self.btn_clearMainTerminal) + + self.btn_autoScrollMainTermianl = QPushButton(self.centralwidget) + self.btn_autoScrollMainTermianl.setObjectName(u"btn_autoScrollMainTermianl") + self.btn_autoScrollMainTermianl.setCheckable(True) + self.btn_autoScrollMainTermianl.setChecked(True) + + self.horizontalLayout_3.addWidget(self.btn_autoScrollMainTermianl) + + + self.verticalLayout.addLayout(self.horizontalLayout_3) + + self.txtEdit_mainTerminal = QPlainTextEdit(self.centralwidget) + self.txtEdit_mainTerminal.setObjectName(u"txtEdit_mainTerminal") + + self.verticalLayout.addWidget(self.txtEdit_mainTerminal) + + self.horizontalLayout_2 = QHBoxLayout() + self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") + self.lineEdit = QLineEdit(self.centralwidget) + self.lineEdit.setObjectName(u"lineEdit") + + self.horizontalLayout_2.addWidget(self.lineEdit) + + self.btn_endLine = QPushButton(self.centralwidget) + self.btn_endLine.setObjectName(u"btn_endLine") + self.btn_endLine.setCheckable(True) + self.btn_endLine.setChecked(True) + + self.horizontalLayout_2.addWidget(self.btn_endLine) + + self.btn_send = QPushButton(self.centralwidget) + self.btn_send.setObjectName(u"btn_send") + + self.horizontalLayout_2.addWidget(self.btn_send) + + + self.verticalLayout.addLayout(self.horizontalLayout_2) + + + self.horizontalLayout_5.addLayout(self.verticalLayout) + + self.verticalLayout_3 = QVBoxLayout() + self.verticalLayout_3.setObjectName(u"verticalLayout_3") + self.pushButton_10 = QPushButton(self.centralwidget) + self.pushButton_10.setObjectName(u"pushButton_10") + + self.verticalLayout_3.addWidget(self.pushButton_10) + + self.scrollArea = QScrollArea(self.centralwidget) + self.scrollArea.setObjectName(u"scrollArea") + self.scrollArea.setMinimumSize(QSize(120, 0)) + self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) + self.scrollArea.setWidgetResizable(True) + self.scrollAreaWidgetContents = QWidget() + self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents") + self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 101, 318)) + self.verticalLayout_6 = QVBoxLayout(self.scrollAreaWidgetContents) + self.verticalLayout_6.setObjectName(u"verticalLayout_6") + self.verticalLayout_6.setContentsMargins(-1, -1, 9, -1) + self.btn_command1 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command1.setObjectName(u"btn_command1") + + self.verticalLayout_6.addWidget(self.btn_command1) + + self.btn_command2 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command2.setObjectName(u"btn_command2") + + self.verticalLayout_6.addWidget(self.btn_command2) + + self.btn_command3 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command3.setObjectName(u"btn_command3") + + self.verticalLayout_6.addWidget(self.btn_command3) + + self.btn_command4 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command4.setObjectName(u"btn_command4") + + self.verticalLayout_6.addWidget(self.btn_command4) + + self.btn_command5 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command5.setObjectName(u"btn_command5") + + self.verticalLayout_6.addWidget(self.btn_command5) + + self.btn_command6 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command6.setObjectName(u"btn_command6") + + self.verticalLayout_6.addWidget(self.btn_command6) + + self.btn_command7 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command7.setObjectName(u"btn_command7") + + self.verticalLayout_6.addWidget(self.btn_command7) + + self.btn_command8 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command8.setObjectName(u"btn_command8") + + self.verticalLayout_6.addWidget(self.btn_command8) + + self.btn_command9 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command9.setObjectName(u"btn_command9") + + self.verticalLayout_6.addWidget(self.btn_command9) + + self.btn_command10 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command10.setObjectName(u"btn_command10") + + self.verticalLayout_6.addWidget(self.btn_command10) + + self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) + + self.verticalLayout_6.addItem(self.verticalSpacer) + + self.scrollArea.setWidget(self.scrollAreaWidgetContents) + + self.verticalLayout_3.addWidget(self.scrollArea) + + + self.horizontalLayout_5.addLayout(self.verticalLayout_3) + + self.horizontalLayout_5.setStretch(1, 1) + + self.verticalLayout_5.addLayout(self.horizontalLayout_5) + + self.verticalLayout_4 = QVBoxLayout() + self.verticalLayout_4.setObjectName(u"verticalLayout_4") + self.pushButton_9 = QPushButton(self.centralwidget) + self.pushButton_9.setObjectName(u"pushButton_9") + + self.verticalLayout_4.addWidget(self.pushButton_9) + + + self.verticalLayout_5.addLayout(self.verticalLayout_4) + + MainWindow.setCentralWidget(self.centralwidget) + self.statusbar = QStatusBar(MainWindow) + self.statusbar.setObjectName(u"statusbar") + MainWindow.setStatusBar(self.statusbar) + + self.retranslateUi(MainWindow) + + QMetaObject.connectSlotsByName(MainWindow) + # setupUi + + def retranslateUi(self, MainWindow): + MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Serial Vizualizer", None)) + self.btn_connect.setText(QCoreApplication.translate("MainWindow", u"Connect", None)) + self.btn_settings.setText(QCoreApplication.translate("MainWindow", u"Settings", None)) + self.btn_addPattern.setText(QCoreApplication.translate("MainWindow", u"Add", None)) + self.btn_removePattern.setText(QCoreApplication.translate("MainWindow", u"Remove", None)) + self.groupBox.setTitle(QCoreApplication.translate("MainWindow", u"Pattern info", None)) + self.label.setText(QCoreApplication.translate("MainWindow", u"Name:", None)) + self.lbl_namePattern.setText(QCoreApplication.translate("MainWindow", u"Regex1", None)) + self.label_3.setText(QCoreApplication.translate("MainWindow", u"Pattern:", None)) + self.lbl_patternPattern.setText(QCoreApplication.translate("MainWindow", u"\"/d/d/d\"", None)) + self.label_5.setText(QCoreApplication.translate("MainWindow", u"isValid:", None)) + self.lbl_isValidPattern.setText(QCoreApplication.translate("MainWindow", u"True", None)) + self.label_7.setText(QCoreApplication.translate("MainWindow", u"Matches:", None)) + self.lbl_matchesCountPattern.setText(QCoreApplication.translate("MainWindow", u"120", None)) + self.label_9.setText(QCoreApplication.translate("MainWindow", u"Example:", None)) + self.lbl_examplePattern.setText(QCoreApplication.translate("MainWindow", u"__example text__", None)) + self.btn_editPattern.setText(QCoreApplication.translate("MainWindow", u"Edit", None)) + self.btn_timestamp.setText(QCoreApplication.translate("MainWindow", u"Timestamp", None)) + self.btn_clearMainTerminal.setText(QCoreApplication.translate("MainWindow", u"Clear", None)) + self.btn_autoScrollMainTermianl.setText(QCoreApplication.translate("MainWindow", u"AutoScroll", None)) + self.btn_endLine.setText(QCoreApplication.translate("MainWindow", u"EndLine", None)) + self.btn_send.setText(QCoreApplication.translate("MainWindow", u"Send", None)) + self.pushButton_10.setText(QCoreApplication.translate("MainWindow", u"Edit Commands", None)) + self.btn_command1.setText(QCoreApplication.translate("MainWindow", u"Command1", None)) + self.btn_command2.setText(QCoreApplication.translate("MainWindow", u"Command2", None)) + self.btn_command3.setText(QCoreApplication.translate("MainWindow", u"Command3", None)) + self.btn_command4.setText(QCoreApplication.translate("MainWindow", u"Command4", None)) + self.btn_command5.setText(QCoreApplication.translate("MainWindow", u"Command5", None)) + self.btn_command6.setText(QCoreApplication.translate("MainWindow", u"Command6", None)) + self.btn_command7.setText(QCoreApplication.translate("MainWindow", u"Command7", None)) + self.btn_command8.setText(QCoreApplication.translate("MainWindow", u"Command8", None)) + self.btn_command9.setText(QCoreApplication.translate("MainWindow", u"Command9", None)) + self.btn_command10.setText(QCoreApplication.translate("MainWindow", u"Command10", None)) + self.pushButton_9.setText(QCoreApplication.translate("MainWindow", u"PushButton", None)) + # retranslateUi + +# -*- coding: utf-8 -*- + +################################################################################ +## Form generated from reading UI file 'MainWindow.ui' +## +## Created by: Qt User Interface Compiler version 6.2.3 +## +## WARNING! All changes made in this file will be lost when recompiling UI file! +################################################################################ + +from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, + QMetaObject, QObject, QPoint, QRect, + QSize, QTime, QUrl, Qt) +from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor, + QFont, QFontDatabase, QGradient, QIcon, + QImage, QKeySequence, QLinearGradient, QPainter, + QPalette, QPixmap, QRadialGradient, QTransform) +from PySide6.QtWidgets import (QAbstractItemView, QApplication, QFormLayout, QFrame, + QGroupBox, QHBoxLayout, QLabel, QLineEdit, + QListView, QListWidget, QListWidgetItem, QMainWindow, + QPlainTextEdit, QPushButton, QScrollArea, QSizePolicy, + QSpacerItem, QStatusBar, QVBoxLayout, QWidget) + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + if not MainWindow.objectName(): + MainWindow.setObjectName(u"MainWindow") + MainWindow.resize(1024, 480) + self.centralwidget = QWidget(MainWindow) + self.centralwidget.setObjectName(u"centralwidget") + font = QFont() + font.setPointSize(10) + self.centralwidget.setFont(font) + self.verticalLayout_5 = QVBoxLayout(self.centralwidget) + self.verticalLayout_5.setObjectName(u"verticalLayout_5") + self.horizontalLayout = QHBoxLayout() + self.horizontalLayout.setObjectName(u"horizontalLayout") + self.btn_connect = QPushButton(self.centralwidget) + self.btn_connect.setObjectName(u"btn_connect") + self.btn_connect.setEnabled(False) + self.btn_connect.setMinimumSize(QSize(0, 50)) + + self.horizontalLayout.addWidget(self.btn_connect) + + self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + + self.horizontalLayout.addItem(self.horizontalSpacer) + + self.btn_settings = QPushButton(self.centralwidget) + self.btn_settings.setObjectName(u"btn_settings") + self.btn_settings.setMinimumSize(QSize(0, 50)) + + self.horizontalLayout.addWidget(self.btn_settings) + + + self.verticalLayout_5.addLayout(self.horizontalLayout) + + self.line = QFrame(self.centralwidget) + self.line.setObjectName(u"line") + self.line.setFrameShape(QFrame.HLine) + self.line.setFrameShadow(QFrame.Sunken) + + self.verticalLayout_5.addWidget(self.line) + + self.horizontalLayout_5 = QHBoxLayout() + self.horizontalLayout_5.setSpacing(6) + self.horizontalLayout_5.setObjectName(u"horizontalLayout_5") + self.verticalLayout_2 = QVBoxLayout() + self.verticalLayout_2.setObjectName(u"verticalLayout_2") + self.horizontalLayout_4 = QHBoxLayout() + self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") + self.btn_addPattern = QPushButton(self.centralwidget) + self.btn_addPattern.setObjectName(u"btn_addPattern") + + self.horizontalLayout_4.addWidget(self.btn_addPattern) + + self.btn_removePattern = QPushButton(self.centralwidget) + self.btn_removePattern.setObjectName(u"btn_removePattern") + + self.horizontalLayout_4.addWidget(self.btn_removePattern) + + + self.verticalLayout_2.addLayout(self.horizontalLayout_4) + + self.lst_regex = QListWidget(self.centralwidget) + self.lst_regex.setObjectName(u"lst_regex") + sizePolicy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.lst_regex.sizePolicy().hasHeightForWidth()) + self.lst_regex.setSizePolicy(sizePolicy) + self.lst_regex.setDragDropMode(QAbstractItemView.InternalMove) + self.lst_regex.setDefaultDropAction(Qt.MoveAction) + self.lst_regex.setMovement(QListView.Snap) + + self.verticalLayout_2.addWidget(self.lst_regex) + + self.groupBox = QGroupBox(self.centralwidget) + self.groupBox.setObjectName(u"groupBox") + self.formLayout = QFormLayout(self.groupBox) + self.formLayout.setObjectName(u"formLayout") + self.formLayout.setHorizontalSpacing(20) + self.label = QLabel(self.groupBox) + self.label.setObjectName(u"label") + + self.formLayout.setWidget(0, QFormLayout.LabelRole, self.label) + + self.lbl_namePattern = QLabel(self.groupBox) + self.lbl_namePattern.setObjectName(u"lbl_namePattern") + + self.formLayout.setWidget(0, QFormLayout.FieldRole, self.lbl_namePattern) + + self.label_3 = QLabel(self.groupBox) + self.label_3.setObjectName(u"label_3") + + self.formLayout.setWidget(1, QFormLayout.LabelRole, self.label_3) + + self.lbl_patternPattern = QLabel(self.groupBox) + self.lbl_patternPattern.setObjectName(u"lbl_patternPattern") + + self.formLayout.setWidget(1, QFormLayout.FieldRole, self.lbl_patternPattern) + + self.label_5 = QLabel(self.groupBox) + self.label_5.setObjectName(u"label_5") + + self.formLayout.setWidget(2, QFormLayout.LabelRole, self.label_5) + + self.lbl_isValidPattern = QLabel(self.groupBox) + self.lbl_isValidPattern.setObjectName(u"lbl_isValidPattern") + + self.formLayout.setWidget(2, QFormLayout.FieldRole, self.lbl_isValidPattern) + + self.label_7 = QLabel(self.groupBox) + self.label_7.setObjectName(u"label_7") + + self.formLayout.setWidget(3, QFormLayout.LabelRole, self.label_7) + + self.lbl_matchesCountPattern = QLabel(self.groupBox) + self.lbl_matchesCountPattern.setObjectName(u"lbl_matchesCountPattern") + + self.formLayout.setWidget(3, QFormLayout.FieldRole, self.lbl_matchesCountPattern) + + self.label_9 = QLabel(self.groupBox) + self.label_9.setObjectName(u"label_9") + + self.formLayout.setWidget(4, QFormLayout.LabelRole, self.label_9) + + self.btn_editPattern = QPushButton(self.groupBox) + self.btn_editPattern.setObjectName(u"btn_editPattern") + sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) + sizePolicy1.setHorizontalStretch(0) + sizePolicy1.setVerticalStretch(0) + sizePolicy1.setHeightForWidth(self.btn_editPattern.sizePolicy().hasHeightForWidth()) + self.btn_editPattern.setSizePolicy(sizePolicy1) + + self.formLayout.setWidget(6, QFormLayout.SpanningRole, self.btn_editPattern) + + self.lbl_examplePattern = QLabel(self.groupBox) + self.lbl_examplePattern.setObjectName(u"lbl_examplePattern") + self.lbl_examplePattern.setStyleSheet(u"background-color: rgb(35, 35, 35);\n" +"color: rgb(244, 244, 244);") + + self.formLayout.setWidget(5, QFormLayout.SpanningRole, self.lbl_examplePattern) + + + self.verticalLayout_2.addWidget(self.groupBox) + + + self.horizontalLayout_5.addLayout(self.verticalLayout_2) + + self.verticalLayout = QVBoxLayout() + self.verticalLayout.setObjectName(u"verticalLayout") + self.horizontalLayout_3 = QHBoxLayout() + self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") + self.btn_timestamp = QPushButton(self.centralwidget) + self.btn_timestamp.setObjectName(u"btn_timestamp") + self.btn_timestamp.setCheckable(True) + self.btn_timestamp.setChecked(True) + + self.horizontalLayout_3.addWidget(self.btn_timestamp) + + self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + + self.horizontalLayout_3.addItem(self.horizontalSpacer_2) + + self.btn_clearMainTerminal = QPushButton(self.centralwidget) + self.btn_clearMainTerminal.setObjectName(u"btn_clearMainTerminal") + + self.horizontalLayout_3.addWidget(self.btn_clearMainTerminal) + + self.btn_autoScrollMainTermianl = QPushButton(self.centralwidget) + self.btn_autoScrollMainTermianl.setObjectName(u"btn_autoScrollMainTermianl") + self.btn_autoScrollMainTermianl.setCheckable(True) + self.btn_autoScrollMainTermianl.setChecked(True) + + self.horizontalLayout_3.addWidget(self.btn_autoScrollMainTermianl) + + + self.verticalLayout.addLayout(self.horizontalLayout_3) + + self.txtEdit_mainTerminal = QPlainTextEdit(self.centralwidget) + self.txtEdit_mainTerminal.setObjectName(u"txtEdit_mainTerminal") + + self.verticalLayout.addWidget(self.txtEdit_mainTerminal) + + self.horizontalLayout_2 = QHBoxLayout() + self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") + self.lineEdit = QLineEdit(self.centralwidget) + self.lineEdit.setObjectName(u"lineEdit") + + self.horizontalLayout_2.addWidget(self.lineEdit) + + self.btn_endLine = QPushButton(self.centralwidget) + self.btn_endLine.setObjectName(u"btn_endLine") + self.btn_endLine.setCheckable(True) + self.btn_endLine.setChecked(True) + + self.horizontalLayout_2.addWidget(self.btn_endLine) + + self.btn_send = QPushButton(self.centralwidget) + self.btn_send.setObjectName(u"btn_send") + + self.horizontalLayout_2.addWidget(self.btn_send) + + + self.verticalLayout.addLayout(self.horizontalLayout_2) + + + self.horizontalLayout_5.addLayout(self.verticalLayout) + + self.verticalLayout_3 = QVBoxLayout() + self.verticalLayout_3.setObjectName(u"verticalLayout_3") + self.pushButton_10 = QPushButton(self.centralwidget) + self.pushButton_10.setObjectName(u"pushButton_10") + + self.verticalLayout_3.addWidget(self.pushButton_10) + + self.scrollArea = QScrollArea(self.centralwidget) + self.scrollArea.setObjectName(u"scrollArea") + self.scrollArea.setMinimumSize(QSize(120, 0)) + self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) + self.scrollArea.setWidgetResizable(True) + self.scrollAreaWidgetContents = QWidget() + self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents") + self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 101, 318)) + self.verticalLayout_6 = QVBoxLayout(self.scrollAreaWidgetContents) + self.verticalLayout_6.setObjectName(u"verticalLayout_6") + self.verticalLayout_6.setContentsMargins(-1, -1, 9, -1) + self.btn_command1 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command1.setObjectName(u"btn_command1") + + self.verticalLayout_6.addWidget(self.btn_command1) + + self.btn_command2 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command2.setObjectName(u"btn_command2") + + self.verticalLayout_6.addWidget(self.btn_command2) + + self.btn_command3 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command3.setObjectName(u"btn_command3") + + self.verticalLayout_6.addWidget(self.btn_command3) + + self.btn_command4 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command4.setObjectName(u"btn_command4") + + self.verticalLayout_6.addWidget(self.btn_command4) + + self.btn_command5 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command5.setObjectName(u"btn_command5") + + self.verticalLayout_6.addWidget(self.btn_command5) + + self.btn_command6 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command6.setObjectName(u"btn_command6") + + self.verticalLayout_6.addWidget(self.btn_command6) + + self.btn_command7 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command7.setObjectName(u"btn_command7") + + self.verticalLayout_6.addWidget(self.btn_command7) + + self.btn_command8 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command8.setObjectName(u"btn_command8") + + self.verticalLayout_6.addWidget(self.btn_command8) + + self.btn_command9 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command9.setObjectName(u"btn_command9") + + self.verticalLayout_6.addWidget(self.btn_command9) + + self.btn_command10 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command10.setObjectName(u"btn_command10") + + self.verticalLayout_6.addWidget(self.btn_command10) + + self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) + + self.verticalLayout_6.addItem(self.verticalSpacer) + + self.scrollArea.setWidget(self.scrollAreaWidgetContents) + + self.verticalLayout_3.addWidget(self.scrollArea) + + + self.horizontalLayout_5.addLayout(self.verticalLayout_3) + + self.horizontalLayout_5.setStretch(1, 1) + + self.verticalLayout_5.addLayout(self.horizontalLayout_5) + + self.verticalLayout_4 = QVBoxLayout() + self.verticalLayout_4.setObjectName(u"verticalLayout_4") + self.pushButton_9 = QPushButton(self.centralwidget) + self.pushButton_9.setObjectName(u"pushButton_9") + + self.verticalLayout_4.addWidget(self.pushButton_9) + + + self.verticalLayout_5.addLayout(self.verticalLayout_4) + + MainWindow.setCentralWidget(self.centralwidget) + self.statusbar = QStatusBar(MainWindow) + self.statusbar.setObjectName(u"statusbar") + MainWindow.setStatusBar(self.statusbar) + + self.retranslateUi(MainWindow) + + QMetaObject.connectSlotsByName(MainWindow) + # setupUi + + def retranslateUi(self, MainWindow): + MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Serial Vizualizer", None)) + self.btn_connect.setText(QCoreApplication.translate("MainWindow", u"Connect", None)) + self.btn_settings.setText(QCoreApplication.translate("MainWindow", u"Settings", None)) + self.btn_addPattern.setText(QCoreApplication.translate("MainWindow", u"Add", None)) + self.btn_removePattern.setText(QCoreApplication.translate("MainWindow", u"Remove", None)) + self.groupBox.setTitle(QCoreApplication.translate("MainWindow", u"Pattern info", None)) + self.label.setText(QCoreApplication.translate("MainWindow", u"Name:", None)) + self.lbl_namePattern.setText(QCoreApplication.translate("MainWindow", u"Regex1", None)) + self.label_3.setText(QCoreApplication.translate("MainWindow", u"Pattern:", None)) + self.lbl_patternPattern.setText(QCoreApplication.translate("MainWindow", u"\"/d/d/d\"", None)) + self.label_5.setText(QCoreApplication.translate("MainWindow", u"isValid:", None)) + self.lbl_isValidPattern.setText(QCoreApplication.translate("MainWindow", u"True", None)) + self.label_7.setText(QCoreApplication.translate("MainWindow", u"Matches:", None)) + self.lbl_matchesCountPattern.setText(QCoreApplication.translate("MainWindow", u"120", None)) + self.label_9.setText(QCoreApplication.translate("MainWindow", u"Example:", None)) + self.btn_editPattern.setText(QCoreApplication.translate("MainWindow", u"Edit", None)) + self.lbl_examplePattern.setText(QCoreApplication.translate("MainWindow", u"__example text__", None)) + self.btn_timestamp.setText(QCoreApplication.translate("MainWindow", u"Timestamp", None)) + self.btn_clearMainTerminal.setText(QCoreApplication.translate("MainWindow", u"Clear", None)) + self.btn_autoScrollMainTermianl.setText(QCoreApplication.translate("MainWindow", u"AutoScroll", None)) + self.btn_endLine.setText(QCoreApplication.translate("MainWindow", u"EndLine", None)) + self.btn_send.setText(QCoreApplication.translate("MainWindow", u"Send", None)) + self.pushButton_10.setText(QCoreApplication.translate("MainWindow", u"Edit Commands", None)) + self.btn_command1.setText(QCoreApplication.translate("MainWindow", u"Command1", None)) + self.btn_command2.setText(QCoreApplication.translate("MainWindow", u"Command2", None)) + self.btn_command3.setText(QCoreApplication.translate("MainWindow", u"Command3", None)) + self.btn_command4.setText(QCoreApplication.translate("MainWindow", u"Command4", None)) + self.btn_command5.setText(QCoreApplication.translate("MainWindow", u"Command5", None)) + self.btn_command6.setText(QCoreApplication.translate("MainWindow", u"Command6", None)) + self.btn_command7.setText(QCoreApplication.translate("MainWindow", u"Command7", None)) + self.btn_command8.setText(QCoreApplication.translate("MainWindow", u"Command8", None)) + self.btn_command9.setText(QCoreApplication.translate("MainWindow", u"Command9", None)) + self.btn_command10.setText(QCoreApplication.translate("MainWindow", u"Command10", None)) + self.pushButton_9.setText(QCoreApplication.translate("MainWindow", u"PushButton", None)) + # retranslateUi + +# -*- coding: utf-8 -*- + +################################################################################ +## Form generated from reading UI file 'MainWindow.ui' +## +## Created by: Qt User Interface Compiler version 6.2.3 +## +## WARNING! All changes made in this file will be lost when recompiling UI file! +################################################################################ + +from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, + QMetaObject, QObject, QPoint, QRect, + QSize, QTime, QUrl, Qt) +from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor, + QFont, QFontDatabase, QGradient, QIcon, + QImage, QKeySequence, QLinearGradient, QPainter, + QPalette, QPixmap, QRadialGradient, QTransform) +from PySide6.QtWidgets import (QAbstractItemView, QApplication, QFormLayout, QFrame, + QGroupBox, QHBoxLayout, QLabel, QLineEdit, + QListView, QListWidget, QListWidgetItem, QMainWindow, + QPlainTextEdit, QPushButton, QScrollArea, QSizePolicy, + QSpacerItem, QStatusBar, QVBoxLayout, QWidget) + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + if not MainWindow.objectName(): + MainWindow.setObjectName(u"MainWindow") + MainWindow.resize(1024, 480) + self.centralwidget = QWidget(MainWindow) + self.centralwidget.setObjectName(u"centralwidget") + font = QFont() + font.setPointSize(10) + self.centralwidget.setFont(font) + self.verticalLayout_5 = QVBoxLayout(self.centralwidget) + self.verticalLayout_5.setObjectName(u"verticalLayout_5") + self.horizontalLayout = QHBoxLayout() + self.horizontalLayout.setObjectName(u"horizontalLayout") + self.btn_connect = QPushButton(self.centralwidget) + self.btn_connect.setObjectName(u"btn_connect") + self.btn_connect.setEnabled(False) + self.btn_connect.setMinimumSize(QSize(0, 50)) + + self.horizontalLayout.addWidget(self.btn_connect) + + self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + + self.horizontalLayout.addItem(self.horizontalSpacer) + + self.btn_settings = QPushButton(self.centralwidget) + self.btn_settings.setObjectName(u"btn_settings") + self.btn_settings.setMinimumSize(QSize(0, 50)) + + self.horizontalLayout.addWidget(self.btn_settings) + + + self.verticalLayout_5.addLayout(self.horizontalLayout) + + self.line = QFrame(self.centralwidget) + self.line.setObjectName(u"line") + self.line.setFrameShape(QFrame.HLine) + self.line.setFrameShadow(QFrame.Sunken) + + self.verticalLayout_5.addWidget(self.line) + + self.horizontalLayout_5 = QHBoxLayout() + self.horizontalLayout_5.setSpacing(6) + self.horizontalLayout_5.setObjectName(u"horizontalLayout_5") + self.verticalLayout_2 = QVBoxLayout() + self.verticalLayout_2.setObjectName(u"verticalLayout_2") + self.horizontalLayout_4 = QHBoxLayout() + self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") + self.btn_addPattern = QPushButton(self.centralwidget) + self.btn_addPattern.setObjectName(u"btn_addPattern") + + self.horizontalLayout_4.addWidget(self.btn_addPattern) + + self.btn_removePattern = QPushButton(self.centralwidget) + self.btn_removePattern.setObjectName(u"btn_removePattern") + + self.horizontalLayout_4.addWidget(self.btn_removePattern) + + + self.verticalLayout_2.addLayout(self.horizontalLayout_4) + + self.lst_regex = QListWidget(self.centralwidget) + self.lst_regex.setObjectName(u"lst_regex") + sizePolicy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.lst_regex.sizePolicy().hasHeightForWidth()) + self.lst_regex.setSizePolicy(sizePolicy) + self.lst_regex.setDragDropMode(QAbstractItemView.InternalMove) + self.lst_regex.setDefaultDropAction(Qt.MoveAction) + self.lst_regex.setMovement(QListView.Snap) + + self.verticalLayout_2.addWidget(self.lst_regex) + + self.groupBox = QGroupBox(self.centralwidget) + self.groupBox.setObjectName(u"groupBox") + self.formLayout = QFormLayout(self.groupBox) + self.formLayout.setObjectName(u"formLayout") + self.formLayout.setHorizontalSpacing(20) + self.label = QLabel(self.groupBox) + self.label.setObjectName(u"label") + + self.formLayout.setWidget(0, QFormLayout.LabelRole, self.label) + + self.lbl_namePattern = QLabel(self.groupBox) + self.lbl_namePattern.setObjectName(u"lbl_namePattern") + + self.formLayout.setWidget(0, QFormLayout.FieldRole, self.lbl_namePattern) + + self.label_3 = QLabel(self.groupBox) + self.label_3.setObjectName(u"label_3") + + self.formLayout.setWidget(1, QFormLayout.LabelRole, self.label_3) + + self.lbl_patternPattern = QLabel(self.groupBox) + self.lbl_patternPattern.setObjectName(u"lbl_patternPattern") + + self.formLayout.setWidget(1, QFormLayout.FieldRole, self.lbl_patternPattern) + + self.label_5 = QLabel(self.groupBox) + self.label_5.setObjectName(u"label_5") + + self.formLayout.setWidget(2, QFormLayout.LabelRole, self.label_5) + + self.lbl_isValidPattern = QLabel(self.groupBox) + self.lbl_isValidPattern.setObjectName(u"lbl_isValidPattern") + + self.formLayout.setWidget(2, QFormLayout.FieldRole, self.lbl_isValidPattern) + + self.label_7 = QLabel(self.groupBox) + self.label_7.setObjectName(u"label_7") + + self.formLayout.setWidget(3, QFormLayout.LabelRole, self.label_7) + + self.lbl_matchesCountPattern = QLabel(self.groupBox) + self.lbl_matchesCountPattern.setObjectName(u"lbl_matchesCountPattern") + + self.formLayout.setWidget(3, QFormLayout.FieldRole, self.lbl_matchesCountPattern) + + self.label_9 = QLabel(self.groupBox) + self.label_9.setObjectName(u"label_9") + + self.formLayout.setWidget(4, QFormLayout.LabelRole, self.label_9) + + self.btn_editPattern = QPushButton(self.groupBox) + self.btn_editPattern.setObjectName(u"btn_editPattern") + sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) + sizePolicy1.setHorizontalStretch(0) + sizePolicy1.setVerticalStretch(0) + sizePolicy1.setHeightForWidth(self.btn_editPattern.sizePolicy().hasHeightForWidth()) + self.btn_editPattern.setSizePolicy(sizePolicy1) + + self.formLayout.setWidget(6, QFormLayout.SpanningRole, self.btn_editPattern) + + self.lbl_examplePattern = QLabel(self.groupBox) + self.lbl_examplePattern.setObjectName(u"lbl_examplePattern") + self.lbl_examplePattern.setLayoutDirection(Qt.LeftToRight) + self.lbl_examplePattern.setStyleSheet(u"background-color: rgb(35, 35, 35);\n" +"color: rgb(244, 244, 244);") + self.lbl_examplePattern.setAlignment(Qt.AlignCenter) + + self.formLayout.setWidget(5, QFormLayout.SpanningRole, self.lbl_examplePattern) + + + self.verticalLayout_2.addWidget(self.groupBox) + + + self.horizontalLayout_5.addLayout(self.verticalLayout_2) + + self.verticalLayout = QVBoxLayout() + self.verticalLayout.setObjectName(u"verticalLayout") + self.horizontalLayout_3 = QHBoxLayout() + self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") + self.btn_timestamp = QPushButton(self.centralwidget) + self.btn_timestamp.setObjectName(u"btn_timestamp") + self.btn_timestamp.setCheckable(True) + self.btn_timestamp.setChecked(True) + + self.horizontalLayout_3.addWidget(self.btn_timestamp) + + self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + + self.horizontalLayout_3.addItem(self.horizontalSpacer_2) + + self.btn_clearMainTerminal = QPushButton(self.centralwidget) + self.btn_clearMainTerminal.setObjectName(u"btn_clearMainTerminal") + + self.horizontalLayout_3.addWidget(self.btn_clearMainTerminal) + + self.btn_autoScrollMainTermianl = QPushButton(self.centralwidget) + self.btn_autoScrollMainTermianl.setObjectName(u"btn_autoScrollMainTermianl") + self.btn_autoScrollMainTermianl.setCheckable(True) + self.btn_autoScrollMainTermianl.setChecked(True) + + self.horizontalLayout_3.addWidget(self.btn_autoScrollMainTermianl) + + + self.verticalLayout.addLayout(self.horizontalLayout_3) + + self.txtEdit_mainTerminal = QPlainTextEdit(self.centralwidget) + self.txtEdit_mainTerminal.setObjectName(u"txtEdit_mainTerminal") + + self.verticalLayout.addWidget(self.txtEdit_mainTerminal) + + self.horizontalLayout_2 = QHBoxLayout() + self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") + self.lineEdit = QLineEdit(self.centralwidget) + self.lineEdit.setObjectName(u"lineEdit") + + self.horizontalLayout_2.addWidget(self.lineEdit) + + self.btn_endLine = QPushButton(self.centralwidget) + self.btn_endLine.setObjectName(u"btn_endLine") + self.btn_endLine.setCheckable(True) + self.btn_endLine.setChecked(True) + + self.horizontalLayout_2.addWidget(self.btn_endLine) + + self.btn_send = QPushButton(self.centralwidget) + self.btn_send.setObjectName(u"btn_send") + + self.horizontalLayout_2.addWidget(self.btn_send) + + + self.verticalLayout.addLayout(self.horizontalLayout_2) + + + self.horizontalLayout_5.addLayout(self.verticalLayout) + + self.verticalLayout_3 = QVBoxLayout() + self.verticalLayout_3.setObjectName(u"verticalLayout_3") + self.pushButton_10 = QPushButton(self.centralwidget) + self.pushButton_10.setObjectName(u"pushButton_10") + + self.verticalLayout_3.addWidget(self.pushButton_10) + + self.scrollArea = QScrollArea(self.centralwidget) + self.scrollArea.setObjectName(u"scrollArea") + self.scrollArea.setMinimumSize(QSize(120, 0)) + self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) + self.scrollArea.setWidgetResizable(True) + self.scrollAreaWidgetContents = QWidget() + self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents") + self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 101, 318)) + self.verticalLayout_6 = QVBoxLayout(self.scrollAreaWidgetContents) + self.verticalLayout_6.setObjectName(u"verticalLayout_6") + self.verticalLayout_6.setContentsMargins(-1, -1, 9, -1) + self.btn_command1 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command1.setObjectName(u"btn_command1") + + self.verticalLayout_6.addWidget(self.btn_command1) + + self.btn_command2 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command2.setObjectName(u"btn_command2") + + self.verticalLayout_6.addWidget(self.btn_command2) + + self.btn_command3 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command3.setObjectName(u"btn_command3") + + self.verticalLayout_6.addWidget(self.btn_command3) + + self.btn_command4 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command4.setObjectName(u"btn_command4") + + self.verticalLayout_6.addWidget(self.btn_command4) + + self.btn_command5 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command5.setObjectName(u"btn_command5") + + self.verticalLayout_6.addWidget(self.btn_command5) + + self.btn_command6 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command6.setObjectName(u"btn_command6") + + self.verticalLayout_6.addWidget(self.btn_command6) + + self.btn_command7 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command7.setObjectName(u"btn_command7") + + self.verticalLayout_6.addWidget(self.btn_command7) + + self.btn_command8 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command8.setObjectName(u"btn_command8") + + self.verticalLayout_6.addWidget(self.btn_command8) + + self.btn_command9 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command9.setObjectName(u"btn_command9") + + self.verticalLayout_6.addWidget(self.btn_command9) + + self.btn_command10 = QPushButton(self.scrollAreaWidgetContents) + self.btn_command10.setObjectName(u"btn_command10") + + self.verticalLayout_6.addWidget(self.btn_command10) + + self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) + + self.verticalLayout_6.addItem(self.verticalSpacer) + + self.scrollArea.setWidget(self.scrollAreaWidgetContents) + + self.verticalLayout_3.addWidget(self.scrollArea) + + + self.horizontalLayout_5.addLayout(self.verticalLayout_3) + + self.horizontalLayout_5.setStretch(1, 1) + + self.verticalLayout_5.addLayout(self.horizontalLayout_5) + + self.verticalLayout_4 = QVBoxLayout() + self.verticalLayout_4.setObjectName(u"verticalLayout_4") + self.pushButton_9 = QPushButton(self.centralwidget) + self.pushButton_9.setObjectName(u"pushButton_9") + + self.verticalLayout_4.addWidget(self.pushButton_9) + + + self.verticalLayout_5.addLayout(self.verticalLayout_4) + + MainWindow.setCentralWidget(self.centralwidget) + self.statusbar = QStatusBar(MainWindow) + self.statusbar.setObjectName(u"statusbar") + MainWindow.setStatusBar(self.statusbar) + + self.retranslateUi(MainWindow) + + QMetaObject.connectSlotsByName(MainWindow) + # setupUi + + def retranslateUi(self, MainWindow): + MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Serial Vizualizer", None)) + self.btn_connect.setText(QCoreApplication.translate("MainWindow", u"Connect", None)) + self.btn_settings.setText(QCoreApplication.translate("MainWindow", u"Settings", None)) + self.btn_addPattern.setText(QCoreApplication.translate("MainWindow", u"Add", None)) + self.btn_removePattern.setText(QCoreApplication.translate("MainWindow", u"Remove", None)) + self.groupBox.setTitle(QCoreApplication.translate("MainWindow", u"Pattern info", None)) + self.label.setText(QCoreApplication.translate("MainWindow", u"Name:", None)) + self.lbl_namePattern.setText(QCoreApplication.translate("MainWindow", u"Regex1", None)) + self.label_3.setText(QCoreApplication.translate("MainWindow", u"Pattern:", None)) + self.lbl_patternPattern.setText(QCoreApplication.translate("MainWindow", u"\"/d/d/d\"", None)) + self.label_5.setText(QCoreApplication.translate("MainWindow", u"isValid:", None)) + self.lbl_isValidPattern.setText(QCoreApplication.translate("MainWindow", u"True", None)) + self.label_7.setText(QCoreApplication.translate("MainWindow", u"Matches:", None)) + self.lbl_matchesCountPattern.setText(QCoreApplication.translate("MainWindow", u"120", None)) + self.label_9.setText(QCoreApplication.translate("MainWindow", u"Example:", None)) + self.btn_editPattern.setText(QCoreApplication.translate("MainWindow", u"Edit", None)) + self.lbl_examplePattern.setText(QCoreApplication.translate("MainWindow", u"__example text__", None)) + self.btn_timestamp.setText(QCoreApplication.translate("MainWindow", u"Timestamp", None)) + self.btn_clearMainTerminal.setText(QCoreApplication.translate("MainWindow", u"Clear", None)) + self.btn_autoScrollMainTermianl.setText(QCoreApplication.translate("MainWindow", u"AutoScroll", None)) + self.btn_endLine.setText(QCoreApplication.translate("MainWindow", u"EndLine", None)) + self.btn_send.setText(QCoreApplication.translate("MainWindow", u"Send", None)) + self.pushButton_10.setText(QCoreApplication.translate("MainWindow", u"Edit Commands", None)) + self.btn_command1.setText(QCoreApplication.translate("MainWindow", u"Command1", None)) + self.btn_command2.setText(QCoreApplication.translate("MainWindow", u"Command2", None)) + self.btn_command3.setText(QCoreApplication.translate("MainWindow", u"Command3", None)) + self.btn_command4.setText(QCoreApplication.translate("MainWindow", u"Command4", None)) + self.btn_command5.setText(QCoreApplication.translate("MainWindow", u"Command5", None)) + self.btn_command6.setText(QCoreApplication.translate("MainWindow", u"Command6", None)) + self.btn_command7.setText(QCoreApplication.translate("MainWindow", u"Command7", None)) + self.btn_command8.setText(QCoreApplication.translate("MainWindow", u"Command8", None)) + self.btn_command9.setText(QCoreApplication.translate("MainWindow", u"Command9", None)) + self.btn_command10.setText(QCoreApplication.translate("MainWindow", u"Command10", None)) + self.pushButton_9.setText(QCoreApplication.translate("MainWindow", u"PushButton", None)) + # retranslateUi + diff --git a/README.md b/README.md new file mode 100644 index 0000000..4bc2f2c --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# SerialVisualizer + +Program wspierajÄ…cy testowanie komunikacji z mikrokontrolerem za pomocÄ… portu szeregowego. diff --git a/RegexSettings.ui b/RegexSettings.ui new file mode 100644 index 0000000..76f6bab --- /dev/null +++ b/RegexSettings.ui @@ -0,0 +1,224 @@ + + + RegexSettings + + + Qt::ApplicationModal + + + + 0 + 0 + 463 + 269 + + + + Regex Settings + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + 9 + + + 10 + + + + + + + + + + + Name + + + + + + + Pattern + + + + + + + + + true + + + Font + + + false + + + + + + Family: + + + + + + + + 16777215 + 20 + + + + Style: + + + + + + + false + + + true + + + + + + + + + + Size: + + + + + + + + 10 + 75 + true + + + + B + + + true + + + + + + + Color + + + + + + + + 10 + true + + + + I + + + true + + + + + + + + 10 + true + + + + U + + + true + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + RegexSettings + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + RegexSettings + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/RegexSettings_ui.py b/RegexSettings_ui.py new file mode 100644 index 0000000..57d50a9 --- /dev/null +++ b/RegexSettings_ui.py @@ -0,0 +1,169 @@ +# -*- coding: utf-8 -*- + +################################################################################ +## Form generated from reading UI file 'RegexSettings.ui' +## +## Created by: Qt User Interface Compiler version 6.2.3 +## +## WARNING! All changes made in this file will be lost when recompiling UI file! +################################################################################ + +from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, + QMetaObject, QObject, QPoint, QRect, + QSize, QTime, QUrl, Qt) +from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor, + QFont, QFontDatabase, QGradient, QIcon, + QImage, QKeySequence, QLinearGradient, QPainter, + QPalette, QPixmap, QRadialGradient, QTransform) +from PySide6.QtWidgets import (QAbstractButton, QApplication, QComboBox, QDialog, + QDialogButtonBox, QFontComboBox, QFormLayout, QGridLayout, + QGroupBox, QLabel, QLineEdit, QPushButton, + QSizePolicy, QSpacerItem, QToolButton, QVBoxLayout, + QWidget) + +class Ui_RegexSettings(object): + def setupUi(self, RegexSettings): + if not RegexSettings.objectName(): + RegexSettings.setObjectName(u"RegexSettings") + RegexSettings.setWindowModality(Qt.ApplicationModal) + RegexSettings.resize(463, 269) + self.verticalLayout = QVBoxLayout(RegexSettings) + self.verticalLayout.setObjectName(u"verticalLayout") + self.formLayout = QFormLayout() + self.formLayout.setObjectName(u"formLayout") + self.formLayout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow) + self.formLayout.setContentsMargins(9, -1, 10, -1) + self.le_regexName = QLineEdit(RegexSettings) + self.le_regexName.setObjectName(u"le_regexName") + + self.formLayout.setWidget(1, QFormLayout.FieldRole, self.le_regexName) + + self.le_regexPattern = QLineEdit(RegexSettings) + self.le_regexPattern.setObjectName(u"le_regexPattern") + + self.formLayout.setWidget(2, QFormLayout.FieldRole, self.le_regexPattern) + + self.lbl_regexName = QLabel(RegexSettings) + self.lbl_regexName.setObjectName(u"lbl_regexName") + + self.formLayout.setWidget(1, QFormLayout.LabelRole, self.lbl_regexName) + + self.lbl_regexPattern = QLabel(RegexSettings) + self.lbl_regexPattern.setObjectName(u"lbl_regexPattern") + + self.formLayout.setWidget(2, QFormLayout.LabelRole, self.lbl_regexPattern) + + + self.verticalLayout.addLayout(self.formLayout) + + self.gbox_font = QGroupBox(RegexSettings) + self.gbox_font.setObjectName(u"gbox_font") + self.gbox_font.setEnabled(True) + self.gbox_font.setChecked(False) + self.gridLayout_3 = QGridLayout(self.gbox_font) + self.gridLayout_3.setObjectName(u"gridLayout_3") + self.lbl_echoFont = QLabel(self.gbox_font) + self.lbl_echoFont.setObjectName(u"lbl_echoFont") + + self.gridLayout_3.addWidget(self.lbl_echoFont, 0, 0, 1, 1) + + self.lbl_echoStyle = QLabel(self.gbox_font) + self.lbl_echoStyle.setObjectName(u"lbl_echoStyle") + self.lbl_echoStyle.setMaximumSize(QSize(16777215, 20)) + + self.gridLayout_3.addWidget(self.lbl_echoStyle, 2, 0, 1, 1) + + self.cb_regexFont = QFontComboBox(self.gbox_font) + self.cb_regexFont.setObjectName(u"cb_regexFont") + self.cb_regexFont.setEditable(False) + self.cb_regexFont.setFrame(True) + + self.gridLayout_3.addWidget(self.cb_regexFont, 0, 1, 1, 4) + + self.cb_regexFontSize = QComboBox(self.gbox_font) + self.cb_regexFontSize.setObjectName(u"cb_regexFontSize") + + self.gridLayout_3.addWidget(self.cb_regexFontSize, 1, 1, 1, 4) + + self.lbl_echoFontSize = QLabel(self.gbox_font) + self.lbl_echoFontSize.setObjectName(u"lbl_echoFontSize") + + self.gridLayout_3.addWidget(self.lbl_echoFontSize, 1, 0, 1, 1) + + self.btn_regexFontBold = QToolButton(self.gbox_font) + self.btn_regexFontBold.setObjectName(u"btn_regexFontBold") + font = QFont() + font.setPointSize(10) + font.setBold(True) + self.btn_regexFontBold.setFont(font) + self.btn_regexFontBold.setCheckable(True) + + self.gridLayout_3.addWidget(self.btn_regexFontBold, 2, 1, 1, 1) + + self.btn_regexFontColor = QPushButton(self.gbox_font) + self.btn_regexFontColor.setObjectName(u"btn_regexFontColor") + + self.gridLayout_3.addWidget(self.btn_regexFontColor, 2, 4, 1, 1) + + self.btn_regexFontItalic = QToolButton(self.gbox_font) + self.btn_regexFontItalic.setObjectName(u"btn_regexFontItalic") + font1 = QFont() + font1.setPointSize(10) + font1.setItalic(True) + self.btn_regexFontItalic.setFont(font1) + self.btn_regexFontItalic.setCheckable(True) + + self.gridLayout_3.addWidget(self.btn_regexFontItalic, 2, 2, 1, 1) + + self.btn_regexFontUnderline = QToolButton(self.gbox_font) + self.btn_regexFontUnderline.setObjectName(u"btn_regexFontUnderline") + font2 = QFont() + font2.setPointSize(10) + font2.setUnderline(True) + self.btn_regexFontUnderline.setFont(font2) + self.btn_regexFontUnderline.setCheckable(True) + + self.gridLayout_3.addWidget(self.btn_regexFontUnderline, 2, 3, 1, 1) + + self.gridLayout_3.setColumnStretch(1, 1) + self.gridLayout_3.setColumnStretch(2, 1) + self.gridLayout_3.setColumnStretch(3, 1) + self.gridLayout_3.setColumnStretch(4, 1) + self.gridLayout_3.setColumnMinimumWidth(0, 100) + + self.verticalLayout.addWidget(self.gbox_font) + + self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) + + self.verticalLayout.addItem(self.verticalSpacer) + + self.buttonBox = QDialogButtonBox(RegexSettings) + self.buttonBox.setObjectName(u"buttonBox") + self.buttonBox.setOrientation(Qt.Horizontal) + self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok) + + self.verticalLayout.addWidget(self.buttonBox) + + self.verticalLayout.setStretch(2, 1) + + self.retranslateUi(RegexSettings) + self.buttonBox.accepted.connect(RegexSettings.accept) + self.buttonBox.rejected.connect(RegexSettings.reject) + + QMetaObject.connectSlotsByName(RegexSettings) + # setupUi + + def retranslateUi(self, RegexSettings): + RegexSettings.setWindowTitle(QCoreApplication.translate("RegexSettings", u"Regex Settings", None)) + self.lbl_regexName.setText(QCoreApplication.translate("RegexSettings", u"Name", None)) + self.lbl_regexPattern.setText(QCoreApplication.translate("RegexSettings", u"Pattern", None)) + self.gbox_font.setTitle(QCoreApplication.translate("RegexSettings", u"Font", None)) + self.lbl_echoFont.setText(QCoreApplication.translate("RegexSettings", u"Family:", None)) + self.lbl_echoStyle.setText(QCoreApplication.translate("RegexSettings", u"Style:", None)) + self.lbl_echoFontSize.setText(QCoreApplication.translate("RegexSettings", u"Size:", None)) + self.btn_regexFontBold.setText(QCoreApplication.translate("RegexSettings", u"B", None)) + self.btn_regexFontColor.setText(QCoreApplication.translate("RegexSettings", u"Color", None)) + self.btn_regexFontItalic.setText(QCoreApplication.translate("RegexSettings", u"I", None)) + self.btn_regexFontUnderline.setText(QCoreApplication.translate("RegexSettings", u"U", None)) + # retranslateUi + diff --git a/SettingsDialog.py b/SettingsDialog.py new file mode 100644 index 0000000..28c0dbb --- /dev/null +++ b/SettingsDialog.py @@ -0,0 +1,193 @@ +from json import dumps +import json +from PySide6 import QtWidgets, QtGui, QtCore, QtSerialPort +from SettingsDialog_ui import Ui_SettingsDialog + + + + +class SettingsWindow(QtWidgets.QDialog): + def __init__(self, settings: dict): + super().__init__() + self.ui = Ui_SettingsDialog() + self.ui.setupUi(self) + self.setWindowModality(QtCore.Qt.ApplicationModal) + # self.setAttribute(QtCore.Qt.WA_DeleteOnClose) + + self.setupListOptions() + self.setupConnectionOption() + self.setupFontsOption() + self.setupDisplayOption() + + + if settings: + self.connectionOption = settings["connection"] + self.fontsOption = settings["fonts"] + self.displayOption = settings["display"] + else: + self.saveConnectionSettings() + self.saveFontSettings() + self.saveDisplaySettings() + + self.applyConnectionSettings() + self.applyFontSettings() + self.applyDisplaySettings() + + + def setupListOptions(self): + self.ui.lstview_options.addItems(["Connection", "Fonts", "Display"]) + self.ui.lstview_options.itemClicked.connect(self.on_listItemClicked) + self.ui.lstview_options.setCurrentRow(0) + self.ui.stackedWidget.setCurrentIndex(0) + + def setupConnectionOption(self): + self.connectionOption = dict() + self.on_refreshPortsClicked() + + font = self.ui.cb_port.font() + font.setPointSize(8) + self.ui.cb_port.setFont(font) + + self.ui.cb_baudrate.addItems([str(baudrate) for baudrate in QtSerialPort.QSerialPortInfo.standardBaudRates()]) + self.ui.cb_baudrate.setCurrentText("9600") + self.ui.cb_databits.addItems([data_bits[4:] for data_bits in QtSerialPort.QSerialPort.DataBits.values]) + self.ui.cb_databits.setCurrentText("8") + self.ui.cb_stopbits.addItems([stop_bits for stop_bits in QtSerialPort.QSerialPort.StopBits.values]) + self.ui.cb_stopbits.setCurrentText("OneStop") + self.ui.cb_parity.addItems([parity for parity in QtSerialPort.QSerialPort.Parity.values]) + self.ui.cb_parity.setCurrentText("NoParity") + + self.ui.btn_refreshports.clicked.connect(self.on_refreshPortsClicked) + + def setupFontsOption(self): + FONTSIZE = [str(x) for x in range(6,22) if (x<12 or x%2 == 0)] + + self.fontsOption = {"terminal": {}, "echo": {}} + self._fontColor = {"terminal": (0,0,0), "echo": (0,0,0)} + self._backgroundTerminalColor = (255,255,255) + + self.ui.cb_terminalFont.currentFontChanged.connect(lambda arg: self.on_fontFamilyChanged(arg, "terminal")) + + self.ui.cb_terminalFontSize.addItems(FONTSIZE) + self.ui.cb_terminalFontSize.setCurrentIndex(4) + self.ui.cb_terminalFontSize.currentIndexChanged.connect(lambda arg: self.on_fontSizeChanged(arg, "terminal")) + + self.ui.btn_terminalFontColor.clicked.connect(lambda: self.on_fontColorClicked("terminal")) + self.ui.btn_terminalBackgroundColor.clicked.connect(self.on_backgroundTerminalColorClicked) + + self.ui.cb_echoFontSize.addItems(FONTSIZE) + self.ui.cb_echoFontSize.setCurrentIndex(4) + + self.ui.btn_echoFontColor.clicked.connect(lambda: self.on_fontColorClicked("echo")) + + def setupDisplayOption(self): + self.displayOption = dict() + + def saveConnectionSettings(self): + self.connectionOption["com_port"] = self.ui.cb_port.currentText() + self.connectionOption["baudrate"] = self.ui.cb_baudrate.currentText() + self.connectionOption["data_bits"] = self.ui.cb_databits.currentText() + self.connectionOption["stop_bits"] = self.ui.cb_stopbits.currentText() + self.connectionOption["parity"] = self.ui.cb_parity.currentText() + + def saveFontSettings(self): + self.fontsOption["terminal"]["font_family"] = self.ui.cb_terminalFont.currentText() + self.fontsOption["terminal"]["font_size"] = self.ui.cb_terminalFontSize.currentText() + self.fontsOption["terminal"]["bold"] = self.ui.btn_terminalFontBold.isChecked() + self.fontsOption["terminal"]["italic"] = self.ui.btn_terminalFontItalic.isChecked() + self.fontsOption["terminal"]["underline"] = self.ui.btn_terminalFontUnderline.isChecked() + self.fontsOption["terminal"]["fg_color"] = self._fontColor["terminal"] + self.fontsOption["terminal"]["bg_color"] = self._backgroundTerminalColor + + self.fontsOption["echo"]["enable"] = self.ui.gbox_echoFont.isChecked() + self.fontsOption["echo"]["font_family"] = self.ui.cb_echoFont.currentText() + self.fontsOption["echo"]["font_size"] = self.ui.cb_echoFontSize.currentText() + self.fontsOption["echo"]["bold"] = self.ui.btn_echoFontBold.isChecked() + self.fontsOption["echo"]["italic"] = self.ui.btn_echoFontItalic.isChecked() + self.fontsOption["echo"]["underline"] = self.ui.btn_echoFontUnderline.isChecked() + self.fontsOption["echo"]["fg_color"] = self._fontColor["echo"] + + def applyConnectionSettings(self): + self.on_refreshPortsClicked() + + cb_port_items = [self.ui.cb_port.itemText(i) for i in range(self.ui.cb_port.count())] + if self.connectionOption["com_port"] in cb_port_items: + self.ui.cb_port.setCurrentText(self.connectionOption["com_port"]) + + self.ui.cb_baudrate.setCurrentText(self.connectionOption["baudrate"]) + self.ui.cb_databits.setCurrentText(self.connectionOption["data_bits"]) + self.ui.cb_stopbits.setCurrentText(self.connectionOption["stop_bits"]) + self.ui.cb_parity.setCurrentText(self.connectionOption["parity"]) + + def applyFontSettings(self): + self.ui.cb_terminalFont.setCurrentText(self.fontsOption["terminal"]["font_family"]) + self.ui.cb_terminalFontSize.setCurrentText(self.fontsOption["terminal"]["font_size"]) + self.ui.btn_terminalFontBold.setChecked(self.fontsOption["terminal"]["bold"]) + self.ui.btn_terminalFontItalic.setChecked(self.fontsOption["terminal"]["italic"]) + self.ui.btn_terminalFontUnderline.setChecked(self.fontsOption["terminal"]["underline"]) + self._fontColor["terminal"] = self.fontsOption["terminal"]["fg_color"] + self._backgroundTerminalColor = self.fontsOption["terminal"]["bg_color"] + + self.ui.gbox_echoFont.setChecked(self.fontsOption["echo"]["enable"]) + self.ui.cb_echoFont.setCurrentText(self.fontsOption["echo"]["font_family"]) + self.ui.cb_echoFontSize.setCurrentText(self.fontsOption["echo"]["font_size"]) + self.ui.btn_echoFontBold.setChecked(self.fontsOption["echo"]["bold"]) + self.ui.btn_echoFontItalic.setChecked(self.fontsOption["echo"]["italic"]) + self.ui.btn_echoFontUnderline.setChecked(self.fontsOption["echo"]["underline"]) + self._fontColor["echo"] = self.fontsOption["echo"]["fg_color"] + + def applyDisplaySettings(self): + pass + + def saveDisplaySettings(self): + pass + + def showEvent(self, arg__1: QtGui.QShowEvent) -> None: + self.applyConnectionSettings() + self.applyFontSettings() + return super().showEvent(arg__1) + + def accept(self) -> None: + self.saveConnectionSettings() + self.saveFontSettings() + self.saveDisplaySettings() + return super().accept() + + def getSettings(self): + return { + "connection": self.connectionOption, + "fonts" : self.fontsOption, + "display" : self.displayOption + } + + + def on_listItemClicked(self, item: QtWidgets.QListWidgetItem): + self.ui.stackedWidget.setCurrentIndex(self.ui.lstview_options.currentRow()) + + def on_refreshPortsClicked(self): + self.ui.cb_port.clear() + + for info in QtSerialPort.QSerialPortInfo.availablePorts(): + self.ui.cb_port.addItem(f"{info.portName()} ({info.description()}, {info.manufacturer()})", info.portName()) + + def on_fontFamilyChanged(self, font: QtGui.QFont, sender: str): + if self.ui.gbox_echoFont.isChecked(): + self.ui.cb_echoFont.setCurrentText(self.ui.cb_terminalFont.currentText()) + + def on_fontSizeChanged(self, index: int, sender: str): + if not self.ui.gbox_echoFont.isChecked(): + self.ui.cb_echoFontSize.setCurrentText(self.ui.cb_terminalFontSize.currentText()) + + def on_fontColorClicked(self, sender: str): + current_color: QtGui.QColor = QtGui.QColor(*self.fontsOption[sender]["fg_color"]) + new_color: QtGui.QColor = QtWidgets.QColorDialog.getColor(parent=self, initial=current_color) + if new_color.isValid(): + self._fontColor[sender] = new_color.getRgb() + + def on_backgroundTerminalColorClicked(self): + current_color: QtGui.QColor = QtGui.QColor(*self.fontsOption["terminal"]["bg_color"]) + new_color: QtGui.QColor = QtWidgets.QColorDialog.getColor(parent=self, initial=current_color) + if new_color.isValid(): + self._backgroundTerminalColor = new_color.getRgb() + + diff --git a/SettingsDialog.ui b/SettingsDialog.ui new file mode 100644 index 0000000..8e8bbea --- /dev/null +++ b/SettingsDialog.ui @@ -0,0 +1,607 @@ + + + SettingsDialog + + + + 0 + 0 + 531 + 348 + + + + + 10 + + + + Settings + + + + + + + + + 0 + 0 + + + + + 150 + 0 + + + + + 150 + 16777215 + + + + + + + + 2 + + + + + + + Serial Port Options + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + false + + + false + + + + + + + + + Parity: + + + + + + + + + + Stop bits: + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Re-Scan Serial Ports + + + + + + + Baudrate: + + + + + + + + + + + + + Data bits: + + + + + + + Ports: + + + + + + + + + + + + + + + + + Terminal Font + + + + QLayout::SetDefaultConstraint + + + + + Family: + + + + + + + Color + + + + + + + + 10 + true + + + + I + + + true + + + + + + + + 10 + true + + + + U + + + true + + + false + + + + + + + + 10 + 75 + true + + + + B + + + true + + + + + + + Size: + + + + + + + + 0 + 0 + + + + Style: + + + + + + + + 0 + 0 + + + + Background: + + + + + + + + 0 + 0 + + + + false + + + true + + + + + + + + 0 + 0 + + + + false + + + + + + + background color + + + + + + + + + + true + + + Local Echo + + + true + + + false + + + + + + Family: + + + + + + + + 16777215 + 20 + + + + Style: + + + + + + + false + + + true + + + + + + + + + + Size: + + + + + + + + 10 + 75 + true + + + + B + + + true + + + + + + + Color + + + + + + + + 10 + true + + + + I + + + true + + + + + + + + 10 + true + + + + U + + + true + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Timestamp + + + false + + + false + + + + + + + 100 + 0 + + + + Time Format: + + + + + + + ss.ms + + + true + + + + + + + mm:ss.ms + + + + + + + hh:mm:ss.ms + + + + + + + + + + Text + + + + + + + 100 + 0 + + + + End Line: + + + + + + + CR+LF + + + true + + + + + + + CR + + + + + + + LF + + + + + + + Show unprintable characters + + + false + + + + + + + Wrap text + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + false + + + + + + + + + buttonBox + accepted() + SettingsDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + SettingsDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/SettingsDialog_ui.py b/SettingsDialog_ui.py new file mode 100644 index 0000000..4385839 --- /dev/null +++ b/SettingsDialog_ui.py @@ -0,0 +1,459 @@ +# -*- coding: utf-8 -*- + +################################################################################ +## Form generated from reading UI file 'SerialVizualizerSettings.ui' +## +## Created by: Qt User Interface Compiler version 6.2.3 +## +## WARNING! All changes made in this file will be lost when recompiling UI file! +################################################################################ + +from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, + QMetaObject, QObject, QPoint, QRect, + QSize, QTime, QUrl, Qt) +from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor, + QFont, QFontDatabase, QGradient, QIcon, + QImage, QKeySequence, QLinearGradient, QPainter, + QPalette, QPixmap, QRadialGradient, QTransform) +from PySide6.QtWidgets import (QAbstractButton, QApplication, QCheckBox, QComboBox, + QDialog, QDialogButtonBox, QFontComboBox, QFormLayout, + QGridLayout, QGroupBox, QHBoxLayout, QLabel, + QLayout, QListWidget, QListWidgetItem, QPushButton, + QRadioButton, QSizePolicy, QSpacerItem, QStackedWidget, + QToolButton, QVBoxLayout, QWidget) + +class Ui_SettingsDialog(object): + def setupUi(self, SettingsDialog): + if not SettingsDialog.objectName(): + SettingsDialog.setObjectName(u"SettingsDialog") + SettingsDialog.resize(531, 348) + font = QFont() + font.setPointSize(10) + SettingsDialog.setFont(font) + self.verticalLayout = QVBoxLayout(SettingsDialog) + self.verticalLayout.setObjectName(u"verticalLayout") + self.lay_settings = QHBoxLayout() + self.lay_settings.setObjectName(u"lay_settings") + self.lstview_options = QListWidget(SettingsDialog) + self.lstview_options.setObjectName(u"lstview_options") + sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.lstview_options.sizePolicy().hasHeightForWidth()) + self.lstview_options.setSizePolicy(sizePolicy) + self.lstview_options.setMinimumSize(QSize(150, 0)) + self.lstview_options.setMaximumSize(QSize(150, 16777215)) + + self.lay_settings.addWidget(self.lstview_options) + + self.stackedWidget = QStackedWidget(SettingsDialog) + self.stackedWidget.setObjectName(u"stackedWidget") + self.connection_page = QWidget() + self.connection_page.setObjectName(u"connection_page") + self.verticalLayout_2 = QVBoxLayout(self.connection_page) + self.verticalLayout_2.setObjectName(u"verticalLayout_2") + self.gbox_serialOptions = QGroupBox(self.connection_page) + self.gbox_serialOptions.setObjectName(u"gbox_serialOptions") + self.gbox_serialOptions.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop) + self.gbox_serialOptions.setFlat(False) + self.gbox_serialOptions.setCheckable(False) + self.gridLayout = QGridLayout(self.gbox_serialOptions) + self.gridLayout.setObjectName(u"gridLayout") + self.cb_parity = QComboBox(self.gbox_serialOptions) + self.cb_parity.setObjectName(u"cb_parity") + + self.gridLayout.addWidget(self.cb_parity, 3, 1, 1, 1) + + self.lbl_parity = QLabel(self.gbox_serialOptions) + self.lbl_parity.setObjectName(u"lbl_parity") + + self.gridLayout.addWidget(self.lbl_parity, 3, 0, 1, 1) + + self.cb_port = QComboBox(self.gbox_serialOptions) + self.cb_port.setObjectName(u"cb_port") + + self.gridLayout.addWidget(self.cb_port, 0, 1, 1, 1) + + self.lbl_stopbits = QLabel(self.gbox_serialOptions) + self.lbl_stopbits.setObjectName(u"lbl_stopbits") + + self.gridLayout.addWidget(self.lbl_stopbits, 4, 0, 1, 1) + + self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) + + self.gridLayout.addItem(self.verticalSpacer, 5, 0, 1, 1) + + self.btn_refreshports = QPushButton(self.gbox_serialOptions) + self.btn_refreshports.setObjectName(u"btn_refreshports") + + self.gridLayout.addWidget(self.btn_refreshports, 6, 0, 1, 2) + + self.lbl_baudrate = QLabel(self.gbox_serialOptions) + self.lbl_baudrate.setObjectName(u"lbl_baudrate") + + self.gridLayout.addWidget(self.lbl_baudrate, 1, 0, 1, 1) + + self.cb_stopbits = QComboBox(self.gbox_serialOptions) + self.cb_stopbits.setObjectName(u"cb_stopbits") + + self.gridLayout.addWidget(self.cb_stopbits, 4, 1, 1, 1) + + self.cb_baudrate = QComboBox(self.gbox_serialOptions) + self.cb_baudrate.setObjectName(u"cb_baudrate") + + self.gridLayout.addWidget(self.cb_baudrate, 1, 1, 1, 1) + + self.lbl_databits = QLabel(self.gbox_serialOptions) + self.lbl_databits.setObjectName(u"lbl_databits") + + self.gridLayout.addWidget(self.lbl_databits, 2, 0, 1, 1) + + self.lbl_port = QLabel(self.gbox_serialOptions) + self.lbl_port.setObjectName(u"lbl_port") + + self.gridLayout.addWidget(self.lbl_port, 0, 0, 1, 1) + + self.cb_databits = QComboBox(self.gbox_serialOptions) + self.cb_databits.setObjectName(u"cb_databits") + + self.gridLayout.addWidget(self.cb_databits, 2, 1, 1, 1) + + self.gridLayout.setColumnStretch(1, 2) + self.gridLayout.setColumnMinimumWidth(0, 100) + + self.verticalLayout_2.addWidget(self.gbox_serialOptions) + + self.stackedWidget.addWidget(self.connection_page) + self.terminalFont_page = QWidget() + self.terminalFont_page.setObjectName(u"terminalFont_page") + self.verticalLayout_3 = QVBoxLayout(self.terminalFont_page) + self.verticalLayout_3.setObjectName(u"verticalLayout_3") + self.gbox_terminalFont = QGroupBox(self.terminalFont_page) + self.gbox_terminalFont.setObjectName(u"gbox_terminalFont") + self.gridLayout_2 = QGridLayout(self.gbox_terminalFont) + self.gridLayout_2.setObjectName(u"gridLayout_2") + self.gridLayout_2.setSizeConstraint(QLayout.SetDefaultConstraint) + self.lbl_terminalFont = QLabel(self.gbox_terminalFont) + self.lbl_terminalFont.setObjectName(u"lbl_terminalFont") + + self.gridLayout_2.addWidget(self.lbl_terminalFont, 0, 0, 1, 1) + + self.btn_terminalFontColor = QPushButton(self.gbox_terminalFont) + self.btn_terminalFontColor.setObjectName(u"btn_terminalFontColor") + + self.gridLayout_2.addWidget(self.btn_terminalFontColor, 2, 4, 1, 1) + + self.btn_terminalFontItalic = QToolButton(self.gbox_terminalFont) + self.btn_terminalFontItalic.setObjectName(u"btn_terminalFontItalic") + font1 = QFont() + font1.setPointSize(10) + font1.setItalic(True) + self.btn_terminalFontItalic.setFont(font1) + self.btn_terminalFontItalic.setCheckable(True) + + self.gridLayout_2.addWidget(self.btn_terminalFontItalic, 2, 2, 1, 1) + + self.btn_terminalFontUnderline = QToolButton(self.gbox_terminalFont) + self.btn_terminalFontUnderline.setObjectName(u"btn_terminalFontUnderline") + font2 = QFont() + font2.setPointSize(10) + font2.setUnderline(True) + self.btn_terminalFontUnderline.setFont(font2) + self.btn_terminalFontUnderline.setCheckable(True) + self.btn_terminalFontUnderline.setChecked(False) + + self.gridLayout_2.addWidget(self.btn_terminalFontUnderline, 2, 3, 1, 1) + + self.btn_terminalFontBold = QToolButton(self.gbox_terminalFont) + self.btn_terminalFontBold.setObjectName(u"btn_terminalFontBold") + font3 = QFont() + font3.setPointSize(10) + font3.setBold(True) + self.btn_terminalFontBold.setFont(font3) + self.btn_terminalFontBold.setCheckable(True) + + self.gridLayout_2.addWidget(self.btn_terminalFontBold, 2, 1, 1, 1) + + self.lbl_terminalFontSize = QLabel(self.gbox_terminalFont) + self.lbl_terminalFontSize.setObjectName(u"lbl_terminalFontSize") + + self.gridLayout_2.addWidget(self.lbl_terminalFontSize, 1, 0, 1, 1) + + self.lbl_terminalStyle = QLabel(self.gbox_terminalFont) + self.lbl_terminalStyle.setObjectName(u"lbl_terminalStyle") + sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) + sizePolicy1.setHorizontalStretch(0) + sizePolicy1.setVerticalStretch(0) + sizePolicy1.setHeightForWidth(self.lbl_terminalStyle.sizePolicy().hasHeightForWidth()) + self.lbl_terminalStyle.setSizePolicy(sizePolicy1) + + self.gridLayout_2.addWidget(self.lbl_terminalStyle, 2, 0, 1, 1) + + self.lbl_terminalBackgroundColor = QLabel(self.gbox_terminalFont) + self.lbl_terminalBackgroundColor.setObjectName(u"lbl_terminalBackgroundColor") + sizePolicy2 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) + sizePolicy2.setHorizontalStretch(0) + sizePolicy2.setVerticalStretch(0) + sizePolicy2.setHeightForWidth(self.lbl_terminalBackgroundColor.sizePolicy().hasHeightForWidth()) + self.lbl_terminalBackgroundColor.setSizePolicy(sizePolicy2) + + self.gridLayout_2.addWidget(self.lbl_terminalBackgroundColor, 3, 0, 1, 1) + + self.cb_terminalFont = QFontComboBox(self.gbox_terminalFont) + self.cb_terminalFont.setObjectName(u"cb_termianalFont") + sizePolicy3 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed) + sizePolicy3.setHorizontalStretch(0) + sizePolicy3.setVerticalStretch(0) + sizePolicy3.setHeightForWidth(self.cb_terminalFont.sizePolicy().hasHeightForWidth()) + self.cb_terminalFont.setSizePolicy(sizePolicy3) + self.cb_terminalFont.setEditable(False) + self.cb_terminalFont.setFrame(True) + + self.gridLayout_2.addWidget(self.cb_terminalFont, 0, 1, 1, 4) + + self.cb_terminalFontSize = QComboBox(self.gbox_terminalFont) + self.cb_terminalFontSize.setObjectName(u"cb_terminalFontSize") + sizePolicy3.setHeightForWidth(self.cb_terminalFontSize.sizePolicy().hasHeightForWidth()) + self.cb_terminalFontSize.setSizePolicy(sizePolicy3) + self.cb_terminalFontSize.setEditable(False) + + self.gridLayout_2.addWidget(self.cb_terminalFontSize, 1, 1, 1, 4) + + self.btn_terminalBackgroundColor = QPushButton(self.gbox_terminalFont) + self.btn_terminalBackgroundColor.setObjectName(u"btn_terminalBackgroundColor") + + self.gridLayout_2.addWidget(self.btn_terminalBackgroundColor, 3, 1, 1, 4) + + self.gridLayout_2.setColumnStretch(1, 1) + self.gridLayout_2.setColumnStretch(2, 1) + self.gridLayout_2.setColumnStretch(3, 1) + self.gridLayout_2.setColumnStretch(4, 1) + self.gridLayout_2.setColumnMinimumWidth(0, 100) + self.gridLayout_2.setColumnMinimumWidth(1, 10) + self.gridLayout_2.setColumnMinimumWidth(2, 10) + self.gridLayout_2.setColumnMinimumWidth(3, 10) + self.gridLayout_2.setColumnMinimumWidth(4, 10) + + self.verticalLayout_3.addWidget(self.gbox_terminalFont) + + self.gbox_echoFont = QGroupBox(self.terminalFont_page) + self.gbox_echoFont.setObjectName(u"gbox_echoFont") + self.gbox_echoFont.setEnabled(True) + self.gbox_echoFont.setCheckable(True) + self.gbox_echoFont.setChecked(False) + self.gridLayout_3 = QGridLayout(self.gbox_echoFont) + self.gridLayout_3.setObjectName(u"gridLayout_3") + self.lbl_echoFont = QLabel(self.gbox_echoFont) + self.lbl_echoFont.setObjectName(u"lbl_echoFont") + + self.gridLayout_3.addWidget(self.lbl_echoFont, 0, 0, 1, 1) + + self.lbl_echoStyle = QLabel(self.gbox_echoFont) + self.lbl_echoStyle.setObjectName(u"lbl_echoStyle") + self.lbl_echoStyle.setMaximumSize(QSize(16777215, 20)) + + self.gridLayout_3.addWidget(self.lbl_echoStyle, 2, 0, 1, 1) + + self.cb_echoFont = QFontComboBox(self.gbox_echoFont) + self.cb_echoFont.setObjectName(u"cb_echoFont") + self.cb_echoFont.setEditable(False) + self.cb_echoFont.setFrame(True) + + self.gridLayout_3.addWidget(self.cb_echoFont, 0, 1, 1, 4) + + self.cb_echoFontSize = QComboBox(self.gbox_echoFont) + self.cb_echoFontSize.setObjectName(u"cb_echoFontSize") + + self.gridLayout_3.addWidget(self.cb_echoFontSize, 1, 1, 1, 4) + + self.lbl_echoFontSize = QLabel(self.gbox_echoFont) + self.lbl_echoFontSize.setObjectName(u"lbl_echoFontSize") + + self.gridLayout_3.addWidget(self.lbl_echoFontSize, 1, 0, 1, 1) + + self.btn_echoFontBold = QToolButton(self.gbox_echoFont) + self.btn_echoFontBold.setObjectName(u"btn_echoFontBold") + self.btn_echoFontBold.setFont(font3) + self.btn_echoFontBold.setCheckable(True) + + self.gridLayout_3.addWidget(self.btn_echoFontBold, 2, 1, 1, 1) + + self.btn_echoFontColor = QPushButton(self.gbox_echoFont) + self.btn_echoFontColor.setObjectName(u"btn_echoFontColor") + + self.gridLayout_3.addWidget(self.btn_echoFontColor, 2, 4, 1, 1) + + self.btn_echoFontItalic = QToolButton(self.gbox_echoFont) + self.btn_echoFontItalic.setObjectName(u"btn_echoFontItalic") + self.btn_echoFontItalic.setFont(font1) + self.btn_echoFontItalic.setCheckable(True) + + self.gridLayout_3.addWidget(self.btn_echoFontItalic, 2, 2, 1, 1) + + self.btn_echoFontUnderline = QToolButton(self.gbox_echoFont) + self.btn_echoFontUnderline.setObjectName(u"btn_echoFontUnderline") + self.btn_echoFontUnderline.setFont(font2) + self.btn_echoFontUnderline.setCheckable(True) + + self.gridLayout_3.addWidget(self.btn_echoFontUnderline, 2, 3, 1, 1) + + self.gridLayout_3.setColumnStretch(1, 1) + self.gridLayout_3.setColumnStretch(2, 1) + self.gridLayout_3.setColumnStretch(3, 1) + self.gridLayout_3.setColumnStretch(4, 1) + self.gridLayout_3.setColumnMinimumWidth(0, 100) + + self.verticalLayout_3.addWidget(self.gbox_echoFont) + + self.verticalSpacer_2 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) + + self.verticalLayout_3.addItem(self.verticalSpacer_2) + + self.stackedWidget.addWidget(self.terminalFont_page) + self.terminalOptions_page = QWidget() + self.terminalOptions_page.setObjectName(u"terminalOptions_page") + self.verticalLayout_4 = QVBoxLayout(self.terminalOptions_page) + self.verticalLayout_4.setObjectName(u"verticalLayout_4") + self.gbox_timestamp = QGroupBox(self.terminalOptions_page) + self.gbox_timestamp.setObjectName(u"gbox_timestamp") + self.gbox_timestamp.setCheckable(False) + self.gbox_timestamp.setChecked(False) + self.formLayout = QFormLayout(self.gbox_timestamp) + self.formLayout.setObjectName(u"formLayout") + self.lbl_timeFormat = QLabel(self.gbox_timestamp) + self.lbl_timeFormat.setObjectName(u"lbl_timeFormat") + self.lbl_timeFormat.setMinimumSize(QSize(100, 0)) + + self.formLayout.setWidget(0, QFormLayout.LabelRole, self.lbl_timeFormat) + + self.rdbtn_ssms = QRadioButton(self.gbox_timestamp) + self.rdbtn_ssms.setObjectName(u"rdbtn_ssms") + self.rdbtn_ssms.setChecked(True) + + self.formLayout.setWidget(0, QFormLayout.FieldRole, self.rdbtn_ssms) + + self.rdbtn_mmssms = QRadioButton(self.gbox_timestamp) + self.rdbtn_mmssms.setObjectName(u"rdbtn_mmssms") + + self.formLayout.setWidget(1, QFormLayout.FieldRole, self.rdbtn_mmssms) + + self.rdbtn_hhmmssms = QRadioButton(self.gbox_timestamp) + self.rdbtn_hhmmssms.setObjectName(u"rdbtn_hhmmssms") + + self.formLayout.setWidget(2, QFormLayout.FieldRole, self.rdbtn_hhmmssms) + + + self.verticalLayout_4.addWidget(self.gbox_timestamp) + + self.gbox_text = QGroupBox(self.terminalOptions_page) + self.gbox_text.setObjectName(u"gbox_text") + self.formLayout_2 = QFormLayout(self.gbox_text) + self.formLayout_2.setObjectName(u"formLayout_2") + self.lbl_endLine = QLabel(self.gbox_text) + self.lbl_endLine.setObjectName(u"lbl_endLine") + self.lbl_endLine.setMinimumSize(QSize(100, 0)) + + self.formLayout_2.setWidget(0, QFormLayout.LabelRole, self.lbl_endLine) + + self.rdbtn_crlf = QRadioButton(self.gbox_text) + self.rdbtn_crlf.setObjectName(u"rdbtn_crlf") + self.rdbtn_crlf.setChecked(True) + + self.formLayout_2.setWidget(0, QFormLayout.FieldRole, self.rdbtn_crlf) + + self.rdbtn_cr = QRadioButton(self.gbox_text) + self.rdbtn_cr.setObjectName(u"rdbtn_cr") + + self.formLayout_2.setWidget(1, QFormLayout.FieldRole, self.rdbtn_cr) + + self.rdbtn_lf = QRadioButton(self.gbox_text) + self.rdbtn_lf.setObjectName(u"rdbtn_lf") + + self.formLayout_2.setWidget(2, QFormLayout.FieldRole, self.rdbtn_lf) + + self.chbox_showAscii = QCheckBox(self.gbox_text) + self.chbox_showAscii.setObjectName(u"chbox_showAscii") + self.chbox_showAscii.setTristate(False) + + self.formLayout_2.setWidget(3, QFormLayout.SpanningRole, self.chbox_showAscii) + + self.chbox_wrapText = QCheckBox(self.gbox_text) + self.chbox_wrapText.setObjectName(u"chbox_wrapText") + + self.formLayout_2.setWidget(4, QFormLayout.SpanningRole, self.chbox_wrapText) + + + self.verticalLayout_4.addWidget(self.gbox_text) + + self.verticalSpacer_3 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) + + self.verticalLayout_4.addItem(self.verticalSpacer_3) + + self.verticalLayout_4.setStretch(2, 1) + self.stackedWidget.addWidget(self.terminalOptions_page) + + self.lay_settings.addWidget(self.stackedWidget) + + + self.verticalLayout.addLayout(self.lay_settings) + + self.buttonBox = QDialogButtonBox(SettingsDialog) + self.buttonBox.setObjectName(u"buttonBox") + self.buttonBox.setOrientation(Qt.Horizontal) + self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok) + self.buttonBox.setCenterButtons(False) + + self.verticalLayout.addWidget(self.buttonBox) + + + self.retranslateUi(SettingsDialog) + self.buttonBox.accepted.connect(SettingsDialog.accept) + self.buttonBox.rejected.connect(SettingsDialog.reject) + + self.stackedWidget.setCurrentIndex(2) + + + QMetaObject.connectSlotsByName(SettingsDialog) + # setupUi + + def retranslateUi(self, SettingsDialog): + SettingsDialog.setWindowTitle(QCoreApplication.translate("SettingsDialog", u"Settings", None)) + self.gbox_serialOptions.setTitle(QCoreApplication.translate("SettingsDialog", u"Serial Port Options", None)) + self.lbl_parity.setText(QCoreApplication.translate("SettingsDialog", u"Parity:", None)) + self.lbl_stopbits.setText(QCoreApplication.translate("SettingsDialog", u"Stop bits:", None)) + self.btn_refreshports.setText(QCoreApplication.translate("SettingsDialog", u"Re-Scan Serial Ports", None)) + self.lbl_baudrate.setText(QCoreApplication.translate("SettingsDialog", u"Baudrate:", None)) + self.lbl_databits.setText(QCoreApplication.translate("SettingsDialog", u"Data bits:", None)) + self.lbl_port.setText(QCoreApplication.translate("SettingsDialog", u"Ports:", None)) + self.gbox_terminalFont.setTitle(QCoreApplication.translate("SettingsDialog", u"Terminal Font", None)) + self.lbl_terminalFont.setText(QCoreApplication.translate("SettingsDialog", u"Family:", None)) + self.btn_terminalFontColor.setText(QCoreApplication.translate("SettingsDialog", u"Color", None)) + self.btn_terminalFontItalic.setText(QCoreApplication.translate("SettingsDialog", u"I", None)) + self.btn_terminalFontUnderline.setText(QCoreApplication.translate("SettingsDialog", u"U", None)) + self.btn_terminalFontBold.setText(QCoreApplication.translate("SettingsDialog", u"B", None)) + self.lbl_terminalFontSize.setText(QCoreApplication.translate("SettingsDialog", u"Size:", None)) + self.lbl_terminalStyle.setText(QCoreApplication.translate("SettingsDialog", u"Style:", None)) + self.lbl_terminalBackgroundColor.setText(QCoreApplication.translate("SettingsDialog", u"Background:", None)) + self.btn_terminalBackgroundColor.setText(QCoreApplication.translate("SettingsDialog", u"background color", None)) + self.gbox_echoFont.setTitle(QCoreApplication.translate("SettingsDialog", u"Local Echo", None)) + self.lbl_echoFont.setText(QCoreApplication.translate("SettingsDialog", u"Family:", None)) + self.lbl_echoStyle.setText(QCoreApplication.translate("SettingsDialog", u"Style:", None)) + self.lbl_echoFontSize.setText(QCoreApplication.translate("SettingsDialog", u"Size:", None)) + self.btn_echoFontBold.setText(QCoreApplication.translate("SettingsDialog", u"B", None)) + self.btn_echoFontColor.setText(QCoreApplication.translate("SettingsDialog", u"Color", None)) + self.btn_echoFontItalic.setText(QCoreApplication.translate("SettingsDialog", u"I", None)) + self.btn_echoFontUnderline.setText(QCoreApplication.translate("SettingsDialog", u"U", None)) + self.gbox_timestamp.setTitle(QCoreApplication.translate("SettingsDialog", u"Timestamp", None)) + self.lbl_timeFormat.setText(QCoreApplication.translate("SettingsDialog", u"Time Format:", None)) + self.rdbtn_ssms.setText(QCoreApplication.translate("SettingsDialog", u"ss.ms", None)) + self.rdbtn_mmssms.setText(QCoreApplication.translate("SettingsDialog", u"mm:ss.ms", None)) + self.rdbtn_hhmmssms.setText(QCoreApplication.translate("SettingsDialog", u"hh:mm:ss.ms", None)) + self.gbox_text.setTitle(QCoreApplication.translate("SettingsDialog", u"Text", None)) + self.lbl_endLine.setText(QCoreApplication.translate("SettingsDialog", u"End Line:", None)) + self.rdbtn_crlf.setText(QCoreApplication.translate("SettingsDialog", u"CR+LF", None)) + self.rdbtn_cr.setText(QCoreApplication.translate("SettingsDialog", u"CR", None)) + self.rdbtn_lf.setText(QCoreApplication.translate("SettingsDialog", u"LF", None)) + self.chbox_showAscii.setText(QCoreApplication.translate("SettingsDialog", u"Show unprintable characters", None)) + self.chbox_wrapText.setText(QCoreApplication.translate("SettingsDialog", u"Wrap text", None)) + # retranslateUi + diff --git a/TextFormat.py b/TextFormat.py new file mode 100644 index 0000000..4994380 --- /dev/null +++ b/TextFormat.py @@ -0,0 +1,26 @@ +from dataclasses import dataclass, field +from PySide6 import QtWidgets, QtGui, QtCore + +@dataclass +class TextFormat: + font_family: str = "Segoe UI" + font_size: str = "10" + bold: bool = False + italic: bool = False + underline: bool = False + fg_color: tuple[int] = field(default=(0,0,0)) + format: QtGui.QTextCharFormat = field(default_factory=QtGui.QTextCharFormat, init=False, repr=False) + + def __post_init__(self): + format = QtGui.QTextCharFormat() + format.setFontFamily(self.font_family) + format.setFontPointSize(int(self.font_size)) + format.setForeground(QtGui.QColor(*self.fg_color)) + if self.bold: + format.setFontWeight(QtGui.QFont.Bold) + if self.italic: + format.setFontItalic(True) + if self.underline: + format.setUnderlineStyle(QtGui.QTextCharFormat.SingleUnderline) + + self.format = format diff --git a/main.py b/main.py new file mode 100644 index 0000000..41bdf29 --- /dev/null +++ b/main.py @@ -0,0 +1,174 @@ +import json +import sys +from PySide6 import QtWidgets, QtGui, QtCore +from Highlighter import Highlighter, Rule +from MainWindow_ui import Ui_MainWindow +from SettingsDialog import SettingsWindow +from TextFormat import TextFormat + +def loadSettingsFromFile() -> dict: + try: + with open("settings.json", 'r') as f: + return json.load(f) + except IOError: + return None + +def saveSettingsToFile(settings: dict) -> None: + with open("settings.json", 'w') as f: + json.dump(settings, f, indent=4) + + +class CommandStack: + def __init__(self) -> None: + self.__stack = list() + self.__curIndex = -1 + + def add(self, cmd: str) -> None: + self.__stack.append(cmd) + self.__curIndex = len(self.__stack) + # print("lenght: ", len(self.__stack)) + + def hasPrevious(self) -> bool: + return self.__curIndex > 0 + + def hasNext(self) -> bool: + return (self.__curIndex + 1 < len(self.__stack)) and (len(self.__stack) != 0) + + def getPrevious(self) -> str: + if len(self.__stack) < 1: + return "" + + self.__curIndex -= 1 + if self.__curIndex < 0: + self.__curIndex = 0 + + # print("index: ", self.__curIndex) + return self.__stack[self.__curIndex] + + def getNext(self): + if len(self.__stack) < 1: + return "" + + self.__curIndex = min(self.__curIndex + 1, len(self.__stack)) + if self.__curIndex == len(self.__stack): + return self.__stack[self.__curIndex-1] + + return self.__stack[self.__curIndex] + + + +class MainWindow(QtWidgets.QMainWindow): + def __init__(self) -> None: + super().__init__() + self.ui = Ui_MainWindow() + self.ui.setupUi(self) + + settings = loadSettingsFromFile() + self.ui_settings = SettingsWindow(settings=settings) + + self.stack = CommandStack() + self.highlighter = Highlighter(self.ui.txtEdit_mainTerminal.document()) + + self.setup() + + self.ruleItemList = [] + + def setup(self): + # header buttons + self.ui.btn_settings.clicked.connect(self.on_settingsClicked) + self.ui.btn_connect.clicked.connect(self.on_connectClicked) + + # left side + self.ui.btn_addPattern.clicked.connect(self.on_addPaternClicked) + # self.ui.btn_removePattern.clicked.connect(self.on_removePatternClicked) + self.ui.lst_regex.model().rowsMoved.connect(self.on_item_move) + + # right side + + # main side + self.ui.lineEdit.returnPressed.connect(self.on_returnPressed) + self.ui.lineEdit.installEventFilter(self) + + def on_connectClicked(self): + pass + + def on_settingsClicked(self): + if self.ui_settings.exec(): + self.setTerminalFont(**self.ui_settings.fontsOption["terminal"]) + self.setCommandFont(**self.ui_settings.fontsOption["echo"]) + + saveSettingsToFile(self.ui_settings.getSettings()) + + def on_addPaternClicked(self): + item = QtWidgets.QListWidgetItem(f"regex{str(self.ui.lst_regex.count())}") + item.setFlags(item.flags() | QtGui.Qt.ItemIsUserCheckable) + item.setCheckState(QtGui.Qt.Unchecked) + self.ui.lst_regex.addItem(item) + + textFormat = TextFormat() + regex = QtCore.QRegularExpression() + rule = Rule(item.text(), True, textFormat, regex) + self.ruleItemList.append((item, rule)) + print( [ ( i.text(), r.name )for i, r in self.ruleItemList ] ) + self.highlighter.setListOfRules([ r for i, r in self.ruleItemList]) + + def on_item_move(self): + itemList = [self.ui.lst_regex.item(row) for row in range(self.ui.lst_regex.count())] + self.ruleItemList.sort(key=lambda t: itemList.index(t[0])) + print( [ ( i.text(), r.name )for i, r in self.ruleItemList ] ) + self.highlighter.setListOfRules([ r for i, r in self.ruleItemList]) + + def on_returnPressed(self): + cmd = self.ui.lineEdit.text() + self.stack.add(cmd) + self.ui.txtEdit_mainTerminal.appendPlainText(cmd) + self.ui.lineEdit.clear() + + def setTerminalFont(self, font_family: str, font_size: str, bold: bool, italic: bool, underline: bool, fg_color: tuple, bg_color: tuple): + font = list() + font.append(f'font-family: "{font_family}"') + font.append(f"font-size: {font_size}pt") + font.append(f'font-weight: {"bold" if bold else "normal"}') + font.append(f'font-style: {"italic" if italic else "normal"}') + font.append(f'text-decoration: {"underline" if underline else "none"}') + font.append(f"color: rgb({fg_color[0]}, {fg_color[1]}, {fg_color[2]})") + font.append(f"background-color: rgb({bg_color[0]}, {bg_color[1]}, {bg_color[2]})") + self.ui.txtEdit_mainTerminal.setStyleSheet(";".join(font)) + self.ui.lbl_examplePattern.setStyleSheet(";".join(font)) + + def setCommandFont(self, font_family: str, font_size: str, bold: bool, italic: bool, underline: bool, fg_color: tuple, enable: bool): + textFormat = TextFormat(font_family, font_size, bold, italic, underline, fg_color) + regex = QtCore.QRegularExpression(r"^<<[\s]*(.*)") + rule = Rule("command", enable, textFormat, regex) + self.highlighter.addRule(rule) + self.highlighter.rehighlight() + + def eventFilter(self, watched: QtCore.QObject, event: QtCore.QEvent) -> bool: + if watched is self.ui.lineEdit: + if event.type() == QtCore.QEvent.KeyPress: + keyEvent = QtGui.QKeyEvent(event) + if keyEvent.key() == QtCore.Qt.Key_Up: + self.on_upArrow() + if keyEvent.key() == QtCore.Qt.Key_Down: + self.on_downArrow() + + return super().eventFilter(watched, event) + + def on_upArrow(self): + if self.stack.hasPrevious(): + self.ui.lineEdit.setText(self.stack.getPrevious()) + + def on_downArrow(self): + if self.stack.hasNext(): + self.ui.lineEdit.setText(self.stack.getNext()) + +def main(): + app = QtWidgets.QApplication(sys.argv) + + window = MainWindow() + window.show() + + sys.exit(app.exec()) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/settings.json b/settings.json new file mode 100644 index 0000000..4d1bf4b --- /dev/null +++ b/settings.json @@ -0,0 +1,45 @@ +{ + "connection": { + "com_port": "COM1 (Port komunikacyjny, (Standardowe typy port\u00f3w))", + "baudrate": "19200", + "data_bits": "8", + "stop_bits": "OneStop", + "parity": "NoParity" + }, + "fonts": { + "terminal": { + "font_family": "Segoe UI", + "font_size": "10", + "bold": false, + "italic": false, + "underline": false, + "fg_color": [ + 255, + 255, + 255, + 255 + ], + "bg_color": [ + 0, + 0, + 0, + 255 + ] + }, + "echo": { + "enable": true, + "font_family": "Segoe UI", + "font_size": "10", + "bold": false, + "italic": false, + "underline": true, + "fg_color": [ + 255, + 255, + 11, + 255 + ] + } + }, + "display": {} +} \ No newline at end of file diff --git a/tescik.py b/tescik.py new file mode 100644 index 0000000..0bffb16 --- /dev/null +++ b/tescik.py @@ -0,0 +1,25 @@ + + +# x = {1: 20, 3: 40, 4: 30, 2: 10, 0: 0} + +# list_of_tuple = sorted(x.items(), key=lambda item: item[0]) +# print([ v for k, v in list_of_tuple]) + +# print( { k: v for k, v in sorted(x.items(), key=lambda item: item[0])} ) + + +l = [5, 8, 2, 4, 1, 10, None] + + +class test: + def __init__(self, l) -> None: + self.l = l + + def print(self): + print(l) + +t = test(l) + +l.sort(key=lambda x: (x is None, x)) + +t.print() \ No newline at end of file