From 26ceb592042d38f0878497c12f2258af23f28808 Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 12:44:15 +0100
Subject: [PATCH 01/26] Add generic disabled style
---
src/ui/styles/_elements.scss | 3 +++
src/ui/styles/alien.css | 2 ++
src/ui/styles/bavaria.css | 2 ++
src/ui/styles/berry.css | 2 ++
src/ui/styles/default.css | 2 ++
5 files changed, 11 insertions(+)
diff --git a/src/ui/styles/_elements.scss b/src/ui/styles/_elements.scss
index 1dd023fb..a8b29509 100644
--- a/src/ui/styles/_elements.scss
+++ b/src/ui/styles/_elements.scss
@@ -95,6 +95,9 @@ QWidget {
&[cssClass~='right-shift'] {
margin: 5px 20px 5px 0px;
}
+ &:disabled {
+ text-decoration: line-through;
+ }
}
QTabWidget::pane {
diff --git a/src/ui/styles/alien.css b/src/ui/styles/alien.css
index 3ab07502..8fedb1d2 100644
--- a/src/ui/styles/alien.css
+++ b/src/ui/styles/alien.css
@@ -67,6 +67,8 @@ QWidget {
margin: 5px 0px 5px 20px; }
QWidget[cssClass~='right-shift'] {
margin: 5px 20px 5px 0px; }
+ QWidget:disabled {
+ text-decoration: line-through; }
QTabWidget::pane {
border: 1px solid #586c5b;
diff --git a/src/ui/styles/bavaria.css b/src/ui/styles/bavaria.css
index 5e263e69..b8bf6d0a 100644
--- a/src/ui/styles/bavaria.css
+++ b/src/ui/styles/bavaria.css
@@ -67,6 +67,8 @@ QWidget {
margin: 5px 0px 5px 20px; }
QWidget[cssClass~='right-shift'] {
margin: 5px 20px 5px 0px; }
+ QWidget:disabled {
+ text-decoration: line-through; }
QTabWidget::pane {
border: 1px solid #0b0e41;
diff --git a/src/ui/styles/berry.css b/src/ui/styles/berry.css
index e14d6ed2..7195c2ca 100644
--- a/src/ui/styles/berry.css
+++ b/src/ui/styles/berry.css
@@ -67,6 +67,8 @@ QWidget {
margin: 5px 0px 5px 20px; }
QWidget[cssClass~='right-shift'] {
margin: 5px 20px 5px 0px; }
+ QWidget:disabled {
+ text-decoration: line-through; }
QTabWidget::pane {
border: 1px solid #6f6f87;
diff --git a/src/ui/styles/default.css b/src/ui/styles/default.css
index 2abdd1f2..c4ebeabc 100644
--- a/src/ui/styles/default.css
+++ b/src/ui/styles/default.css
@@ -67,6 +67,8 @@ QWidget {
margin: 5px 0px 5px 20px; }
QWidget[cssClass~='right-shift'] {
margin: 5px 20px 5px 0px; }
+ QWidget:disabled {
+ text-decoration: line-through; }
QTabWidget::pane {
border: 1px solid #616161;
From d6057509678a4c53448bd4ca8b1a8d71cfa766d8 Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 12:44:48 +0100
Subject: [PATCH 02/26] Add log and rfid button
---
src/ui_elements/optionwindow.py | 138 ++++++----
src/ui_elements/optionwindow.ui | 447 ++++++++++++++++++--------------
2 files changed, 341 insertions(+), 244 deletions(-)
diff --git a/src/ui_elements/optionwindow.py b/src/ui_elements/optionwindow.py
index ede23acb..5e3749c7 100644
--- a/src/ui_elements/optionwindow.py
+++ b/src/ui_elements/optionwindow.py
@@ -28,60 +28,66 @@ def setupUi(self, Optionwindow):
self.centralwidget.setObjectName("centralwidget")
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
- self.button_back = QtWidgets.QPushButton(self.centralwidget)
- self.button_back.setMaximumSize(QtCore.QSize(5000, 300))
+ self.scrollArea = QtWidgets.QScrollArea(self.centralwidget)
+ self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.scrollArea.setFrameShadow(QtWidgets.QFrame.Plain)
+ self.scrollArea.setLineWidth(1)
+ self.scrollArea.setWidgetResizable(True)
+ self.scrollArea.setObjectName("scrollArea")
+ self.scrollAreaWidgetContents = QtWidgets.QWidget()
+ self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 782, 462))
+ self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
+ self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents)
+ self.verticalLayout_3.setContentsMargins(0, 0, 4, 0)
+ self.verticalLayout_3.setObjectName("verticalLayout_3")
+ self.gridLayout_2 = QtWidgets.QGridLayout()
+ self.gridLayout_2.setObjectName("gridLayout_2")
+ self.button_shutdown = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
+ self.button_shutdown.setMaximumSize(QtCore.QSize(5000, 300))
font = QtGui.QFont()
font.setPointSize(28)
font.setBold(True)
font.setWeight(75)
- self.button_back.setFont(font)
- self.button_back.setObjectName("button_back")
- self.gridLayout.addWidget(self.button_back, 5, 0, 1, 1)
- self.horizontalLayout = QtWidgets.QHBoxLayout()
- self.horizontalLayout.setObjectName("horizontalLayout")
- self.button_reboot = QtWidgets.QPushButton(self.centralwidget)
- self.button_reboot.setMaximumSize(QtCore.QSize(5000, 300))
+ self.button_shutdown.setFont(font)
+ self.button_shutdown.setObjectName("button_shutdown")
+ self.gridLayout_2.addWidget(self.button_shutdown, 3, 1, 1, 1)
+ self.button_config = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
+ self.button_config.setMaximumSize(QtCore.QSize(5000, 300))
font = QtGui.QFont()
font.setPointSize(28)
font.setBold(True)
font.setWeight(75)
- self.button_reboot.setFont(font)
- self.button_reboot.setObjectName("button_reboot")
- self.horizontalLayout.addWidget(self.button_reboot)
- self.button_shutdown = QtWidgets.QPushButton(self.centralwidget)
- self.button_shutdown.setMaximumSize(QtCore.QSize(5000, 300))
+ self.button_config.setFont(font)
+ self.button_config.setObjectName("button_config")
+ self.gridLayout_2.addWidget(self.button_config, 1, 0, 1, 1)
+ self.button_export = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
+ self.button_export.setMaximumSize(QtCore.QSize(5000, 300))
font = QtGui.QFont()
font.setPointSize(28)
font.setBold(True)
font.setWeight(75)
- self.button_shutdown.setFont(font)
- self.button_shutdown.setObjectName("button_shutdown")
- self.horizontalLayout.addWidget(self.button_shutdown)
- self.gridLayout.addLayout(self.horizontalLayout, 4, 0, 1, 1)
- self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
- self.horizontalLayout_2.setObjectName("horizontalLayout_2")
- self.button_clean = QtWidgets.QPushButton(self.centralwidget)
- self.button_clean.setMaximumSize(QtCore.QSize(5000, 300))
+ self.button_export.setFont(font)
+ self.button_export.setObjectName("button_export")
+ self.gridLayout_2.addWidget(self.button_export, 1, 1, 1, 1)
+ self.button_calibration = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
+ self.button_calibration.setMaximumSize(QtCore.QSize(5000, 300))
font = QtGui.QFont()
font.setPointSize(28)
font.setBold(True)
font.setWeight(75)
- self.button_clean.setFont(font)
- self.button_clean.setObjectName("button_clean")
- self.horizontalLayout_2.addWidget(self.button_clean)
- self.button_calibration = QtWidgets.QPushButton(self.centralwidget)
- self.button_calibration.setMaximumSize(QtCore.QSize(5000, 300))
+ self.button_calibration.setFont(font)
+ self.button_calibration.setObjectName("button_calibration")
+ self.gridLayout_2.addWidget(self.button_calibration, 0, 1, 1, 1)
+ self.button_clean = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
+ self.button_clean.setMaximumSize(QtCore.QSize(5000, 300))
font = QtGui.QFont()
font.setPointSize(28)
font.setBold(True)
font.setWeight(75)
- self.button_calibration.setFont(font)
- self.button_calibration.setObjectName("button_calibration")
- self.horizontalLayout_2.addWidget(self.button_calibration)
- self.gridLayout.addLayout(self.horizontalLayout_2, 1, 0, 1, 1)
- self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
- self.horizontalLayout_3.setObjectName("horizontalLayout_3")
- self.button_backup = QtWidgets.QPushButton(self.centralwidget)
+ self.button_clean.setFont(font)
+ self.button_clean.setObjectName("button_clean")
+ self.gridLayout_2.addWidget(self.button_clean, 0, 0, 1, 1)
+ self.button_backup = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
self.button_backup.setMaximumSize(QtCore.QSize(5000, 300))
font = QtGui.QFont()
font.setPointSize(28)
@@ -89,8 +95,17 @@ def setupUi(self, Optionwindow):
font.setWeight(75)
self.button_backup.setFont(font)
self.button_backup.setObjectName("button_backup")
- self.horizontalLayout_3.addWidget(self.button_backup)
- self.button_restore = QtWidgets.QPushButton(self.centralwidget)
+ self.gridLayout_2.addWidget(self.button_backup, 2, 0, 1, 1)
+ self.button_reboot = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
+ self.button_reboot.setMaximumSize(QtCore.QSize(5000, 300))
+ font = QtGui.QFont()
+ font.setPointSize(28)
+ font.setBold(True)
+ font.setWeight(75)
+ self.button_reboot.setFont(font)
+ self.button_reboot.setObjectName("button_reboot")
+ self.gridLayout_2.addWidget(self.button_reboot, 3, 0, 1, 1)
+ self.button_restore = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
self.button_restore.setMaximumSize(QtCore.QSize(5000, 300))
font = QtGui.QFont()
font.setPointSize(28)
@@ -98,29 +113,38 @@ def setupUi(self, Optionwindow):
font.setWeight(75)
self.button_restore.setFont(font)
self.button_restore.setObjectName("button_restore")
- self.horizontalLayout_3.addWidget(self.button_restore)
- self.gridLayout.addLayout(self.horizontalLayout_3, 3, 0, 1, 1)
- self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
- self.horizontalLayout_4.setObjectName("horizontalLayout_4")
- self.button_config = QtWidgets.QPushButton(self.centralwidget)
- self.button_config.setMaximumSize(QtCore.QSize(5000, 300))
+ self.gridLayout_2.addWidget(self.button_restore, 2, 1, 1, 1)
+ self.button_back = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
+ self.button_back.setMaximumSize(QtCore.QSize(5000, 300))
font = QtGui.QFont()
font.setPointSize(28)
font.setBold(True)
font.setWeight(75)
- self.button_config.setFont(font)
- self.button_config.setObjectName("button_config")
- self.horizontalLayout_4.addWidget(self.button_config)
- self.button_export = QtWidgets.QPushButton(self.centralwidget)
- self.button_export.setMaximumSize(QtCore.QSize(5000, 300))
+ self.button_back.setFont(font)
+ self.button_back.setObjectName("button_back")
+ self.gridLayout_2.addWidget(self.button_back, 5, 0, 1, 2)
+ self.log_button = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
+ self.log_button.setMaximumSize(QtCore.QSize(5000, 300))
font = QtGui.QFont()
font.setPointSize(28)
font.setBold(True)
font.setWeight(75)
- self.button_export.setFont(font)
- self.button_export.setObjectName("button_export")
- self.horizontalLayout_4.addWidget(self.button_export)
- self.gridLayout.addLayout(self.horizontalLayout_4, 2, 0, 1, 1)
+ self.log_button.setFont(font)
+ self.log_button.setObjectName("log_button")
+ self.gridLayout_2.addWidget(self.log_button, 4, 0, 1, 1)
+ self.rfid_button = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
+ self.rfid_button.setEnabled(False)
+ self.rfid_button.setMaximumSize(QtCore.QSize(5000, 300))
+ font = QtGui.QFont()
+ font.setPointSize(28)
+ font.setBold(True)
+ font.setWeight(75)
+ self.rfid_button.setFont(font)
+ self.rfid_button.setObjectName("rfid_button")
+ self.gridLayout_2.addWidget(self.rfid_button, 4, 1, 1, 1)
+ self.verticalLayout_3.addLayout(self.gridLayout_2)
+ self.scrollArea.setWidget(self.scrollAreaWidgetContents)
+ self.gridLayout.addWidget(self.scrollArea, 4, 0, 1, 1)
Optionwindow.setCentralWidget(self.centralwidget)
self.retranslateUi(Optionwindow)
@@ -129,15 +153,17 @@ def setupUi(self, Optionwindow):
def retranslateUi(self, Optionwindow):
_translate = QtCore.QCoreApplication.translate
Optionwindow.setWindowTitle(_translate("Optionwindow", "Options"))
- self.button_back.setText(_translate("Optionwindow", "< Back"))
- self.button_reboot.setText(_translate("Optionwindow", "Reboot"))
self.button_shutdown.setText(_translate("Optionwindow", "Shutdown"))
- self.button_clean.setText(_translate("Optionwindow", "Cleaning"))
+ self.button_config.setText(_translate("Optionwindow", "Change Config"))
+ self.button_export.setText(_translate("Optionwindow", "Export"))
self.button_calibration.setText(_translate("Optionwindow", "Calibration"))
+ self.button_clean.setText(_translate("Optionwindow", "Cleaning"))
self.button_backup.setText(_translate("Optionwindow", "Backup"))
+ self.button_reboot.setText(_translate("Optionwindow", "Reboot"))
self.button_restore.setText(_translate("Optionwindow", "Restore"))
- self.button_config.setText(_translate("Optionwindow", "Change Config"))
- self.button_export.setText(_translate("Optionwindow", "Export"))
+ self.button_back.setText(_translate("Optionwindow", "< Back"))
+ self.log_button.setText(_translate("Optionwindow", "Logs"))
+ self.rfid_button.setText(_translate("Optionwindow", "Write RFID"))
if __name__ == "__main__":
diff --git a/src/ui_elements/optionwindow.ui b/src/ui_elements/optionwindow.ui
index 4f4b4ea0..324e9ec4 100644
--- a/src/ui_elements/optionwindow.ui
+++ b/src/ui_elements/optionwindow.ui
@@ -39,201 +39,272 @@
- -
-
-
-
- 5000
- 300
-
+
-
+
+
+ QFrame::NoFrame
-
-
- 28
- 75
- true
-
+
+ QFrame::Plain
-
- < Back
+
+ 1
-
-
- -
-
-
-
-
-
-
- 5000
- 300
-
-
-
-
- 28
- 75
- true
-
-
-
- Reboot
-
-
-
- -
-
-
-
- 5000
- 300
-
-
-
-
- 28
- 75
- true
-
-
-
- Shutdown
-
-
-
-
-
- -
-
-
-
-
-
-
- 5000
- 300
-
-
-
-
- 28
- 75
- true
-
-
-
- Cleaning
-
-
-
- -
-
-
-
- 5000
- 300
-
-
-
-
- 28
- 75
- true
-
-
-
- Calibration
-
-
-
-
-
- -
-
-
-
-
-
-
- 5000
- 300
-
-
-
-
- 28
- 75
- true
-
-
-
- Backup
-
-
-
- -
-
-
-
- 5000
- 300
-
-
-
-
- 28
- 75
- true
-
-
-
- Restore
-
-
-
-
-
- -
-
-
-
-
-
-
- 5000
- 300
-
-
-
-
- 28
- 75
- true
-
-
-
- Change Config
+
+ true
+
+
+
+
+ 0
+ 0
+ 782
+ 462
+
+
+
+
+ 0
-
-
- -
-
-
-
- 5000
- 300
-
+
+ 0
-
-
- 28
- 75
- true
-
+
+ 4
-
- Export
+
+ 0
-
-
-
+ -
+
+
-
+
+
+
+ 5000
+ 300
+
+
+
+
+ 28
+ 75
+ true
+
+
+
+ Shutdown
+
+
+
+ -
+
+
+
+ 5000
+ 300
+
+
+
+
+ 28
+ 75
+ true
+
+
+
+ Change Config
+
+
+
+ -
+
+
+
+ 5000
+ 300
+
+
+
+
+ 28
+ 75
+ true
+
+
+
+ Export
+
+
+
+ -
+
+
+
+ 5000
+ 300
+
+
+
+
+ 28
+ 75
+ true
+
+
+
+ Calibration
+
+
+
+ -
+
+
+
+ 5000
+ 300
+
+
+
+
+ 28
+ 75
+ true
+
+
+
+ Cleaning
+
+
+
+ -
+
+
+
+ 5000
+ 300
+
+
+
+
+ 28
+ 75
+ true
+
+
+
+ Backup
+
+
+
+ -
+
+
+
+ 5000
+ 300
+
+
+
+
+ 28
+ 75
+ true
+
+
+
+ Reboot
+
+
+
+ -
+
+
+
+ 5000
+ 300
+
+
+
+
+ 28
+ 75
+ true
+
+
+
+ Restore
+
+
+
+ -
+
+
+
+ 5000
+ 300
+
+
+
+
+ 28
+ 75
+ true
+
+
+
+ < Back
+
+
+
+ -
+
+
+
+ 5000
+ 300
+
+
+
+
+ 28
+ 75
+ true
+
+
+
+ Logs
+
+
+
+ -
+
+
+ false
+
+
+
+ 5000
+ 300
+
+
+
+
+ 28
+ 75
+ true
+
+
+
+ Write RFID
+
+
+
+
+
+
+
+
From 315f7a989129edb7b0f354cb3631538f0b8d5a5e Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 13:08:06 +0100
Subject: [PATCH 03/26] Add new window to compile
---
scripts/compile_ui_to_python.ps1 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/compile_ui_to_python.ps1 b/scripts/compile_ui_to_python.ps1
index 6ae431ce..ddea74cd 100644
--- a/scripts/compile_ui_to_python.ps1
+++ b/scripts/compile_ui_to_python.ps1
@@ -1,6 +1,6 @@
cd .\src\ui_elements\
-$files = @("available", "bonusingredient", "bottlewindow", "cocktailmanager", "calibration", "customdialog", "datepicker", "handadds", "keyboard", "optionwindow", "numpad", "progressbarwindow", "teamselection", "passworddialog", "customprompt")
+$files = @("available", "bonusingredient", "bottlewindow", "cocktailmanager", "calibration", "customdialog", "datepicker", "handadds", "keyboard", "optionwindow", "numpad", "progressbarwindow", "teamselection", "passworddialog", "customprompt", "logwindow")
foreach ($f in $files) {
pyuic5 -x .\$f.ui -o .\$f.py
From 88e2d21fb5daac0261abcb33c3e94f01050c3076 Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 13:08:21 +0100
Subject: [PATCH 04/26] Add generic back button
---
src/language.yaml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/language.yaml b/src/language.yaml
index 0ec3c4b2..944aa4a4 100644
--- a/src/language.yaml
+++ b/src/language.yaml
@@ -183,6 +183,9 @@ ui:
no_button:
en: 'No'
de: 'Nein'
+ back:
+ en: '< Back'
+ de: '< Zurück'
# dynamic values for maker tab
maker:
add_self:
From 39435e75123048d8d7d4825efed0f6b3bd1c5bb9 Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 13:08:35 +0100
Subject: [PATCH 05/26] Add translation for log window
---
src/dialog_handler.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/dialog_handler.py b/src/dialog_handler.py
index bb3c808a..feeee315 100644
--- a/src/dialog_handler.py
+++ b/src/dialog_handler.py
@@ -474,5 +474,9 @@ def adjust_custom_prompt(self, w):
w.yes_button.setText(self.__choose_language("yes_button"))
w.no_button.setText(self.__choose_language("no_button"))
+ def adjust_log_window(self, w):
+ """Translates the elements from the logs window"""
+ w.button_back.setText(self.__choose_language("back"))
+
UI_LANGUAGE = UiLanguage()
From 8bdaaa303f0c49884eb18335fa502eb342d0c3f5 Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 13:08:51 +0100
Subject: [PATCH 06/26] Add basic log window
---
src/ui_elements/logwindow.py | 93 ++++++++++++++++++++++
src/ui_elements/logwindow.ui | 147 +++++++++++++++++++++++++++++++++++
2 files changed, 240 insertions(+)
create mode 100644 src/ui_elements/logwindow.py
create mode 100644 src/ui_elements/logwindow.ui
diff --git a/src/ui_elements/logwindow.py b/src/ui_elements/logwindow.py
new file mode 100644
index 00000000..7f77be4e
--- /dev/null
+++ b/src/ui_elements/logwindow.py
@@ -0,0 +1,93 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '.\logwindow.ui'
+#
+# Created by: PyQt5 UI code generator 5.15.7
+#
+# WARNING: Any manual changes made to this file will be lost when pyuic5 is
+# run again. Do not edit this file unless you know what you are doing.
+
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+
+class Ui_LogWindow(object):
+ def setupUi(self, LogWindow):
+ LogWindow.setObjectName("LogWindow")
+ LogWindow.resize(800, 480)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(LogWindow.sizePolicy().hasHeightForWidth())
+ LogWindow.setSizePolicy(sizePolicy)
+ LogWindow.setMinimumSize(QtCore.QSize(800, 480))
+ LogWindow.setMaximumSize(QtCore.QSize(800, 480))
+ LogWindow.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
+ LogWindow.setStyleSheet("")
+ self.centralwidget = QtWidgets.QWidget(LogWindow)
+ self.centralwidget.setObjectName("centralwidget")
+ self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget)
+ self.verticalLayout_2.setObjectName("verticalLayout_2")
+ self.scrollArea = QtWidgets.QScrollArea(self.centralwidget)
+ self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.scrollArea.setFrameShadow(QtWidgets.QFrame.Plain)
+ self.scrollArea.setLineWidth(1)
+ self.scrollArea.setWidgetResizable(True)
+ self.scrollArea.setObjectName("scrollArea")
+ self.scrollAreaWidgetContents = QtWidgets.QWidget()
+ self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 782, 401))
+ self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
+ self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents)
+ self.verticalLayout_3.setContentsMargins(0, 0, 4, 0)
+ self.verticalLayout_3.setObjectName("verticalLayout_3")
+ self.verticalLayout = QtWidgets.QVBoxLayout()
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.text_display = QtWidgets.QTextBrowser(self.scrollAreaWidgetContents)
+ self.text_display.setObjectName("text_display")
+ self.verticalLayout.addWidget(self.text_display)
+ self.verticalLayout_3.addLayout(self.verticalLayout)
+ self.scrollArea.setWidget(self.scrollAreaWidgetContents)
+ self.verticalLayout_2.addWidget(self.scrollArea)
+ self.horizontalLayout = QtWidgets.QHBoxLayout()
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.button_back = QtWidgets.QPushButton(self.centralwidget)
+ self.button_back.setMaximumSize(QtCore.QSize(5000, 300))
+ font = QtGui.QFont()
+ font.setPointSize(28)
+ font.setBold(True)
+ font.setWeight(75)
+ self.button_back.setFont(font)
+ self.button_back.setObjectName("button_back")
+ self.horizontalLayout.addWidget(self.button_back)
+ self.selection_logs = QtWidgets.QComboBox(self.centralwidget)
+ self.selection_logs.setMinimumSize(QtCore.QSize(105, 38))
+ self.selection_logs.setMaximumSize(QtCore.QSize(300, 100))
+ font = QtGui.QFont()
+ font.setPointSize(14)
+ font.setBold(True)
+ font.setWeight(75)
+ self.selection_logs.setFont(font)
+ self.selection_logs.setMaxVisibleItems(11)
+ self.selection_logs.setObjectName("selection_logs")
+ self.horizontalLayout.addWidget(self.selection_logs)
+ self.verticalLayout_2.addLayout(self.horizontalLayout)
+ LogWindow.setCentralWidget(self.centralwidget)
+
+ self.retranslateUi(LogWindow)
+ QtCore.QMetaObject.connectSlotsByName(LogWindow)
+
+ def retranslateUi(self, LogWindow):
+ _translate = QtCore.QCoreApplication.translate
+ LogWindow.setWindowTitle(_translate("LogWindow", "Options"))
+ self.button_back.setText(_translate("LogWindow", "< Back"))
+ self.button_back.setProperty("cssClass", _translate("LogWindow", "btn-inverted"))
+
+
+if __name__ == "__main__":
+ import sys
+ app = QtWidgets.QApplication(sys.argv)
+ LogWindow = QtWidgets.QMainWindow()
+ ui = Ui_LogWindow()
+ ui.setupUi(LogWindow)
+ LogWindow.show()
+ sys.exit(app.exec_())
diff --git a/src/ui_elements/logwindow.ui b/src/ui_elements/logwindow.ui
new file mode 100644
index 00000000..259cb8f2
--- /dev/null
+++ b/src/ui_elements/logwindow.ui
@@ -0,0 +1,147 @@
+
+
+ LogWindow
+
+
+
+ 0
+ 0
+ 800
+ 480
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 800
+ 480
+
+
+
+
+ 800
+ 480
+
+
+
+ ArrowCursor
+
+
+ Options
+
+
+
+
+
+
+ -
+
+
+ QFrame::NoFrame
+
+
+ QFrame::Plain
+
+
+ 1
+
+
+ true
+
+
+
+
+ 0
+ 0
+ 782
+ 401
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 4
+
+
+ 0
+
+
-
+
+
-
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 5000
+ 300
+
+
+
+
+ 28
+ 75
+ true
+
+
+
+ < Back
+
+
+ btn-inverted
+
+
+
+ -
+
+
+
+ 105
+ 38
+
+
+
+
+ 300
+ 100
+
+
+
+
+ 14
+ 75
+ true
+
+
+
+ 11
+
+
+
+
+
+
+
+
+
+
+
From 3b82185a9c2d40fdf5b45c53625bd2b5c568be8b Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 13:09:15 +0100
Subject: [PATCH 07/26] Rename to fit naming convention
---
src/ui_elements/optionwindow.py | 26 +++++++++++++-------------
src/ui_elements/optionwindow.ui | 4 ++--
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/ui_elements/optionwindow.py b/src/ui_elements/optionwindow.py
index 5e3749c7..1053ebb2 100644
--- a/src/ui_elements/optionwindow.py
+++ b/src/ui_elements/optionwindow.py
@@ -123,25 +123,25 @@ def setupUi(self, Optionwindow):
self.button_back.setFont(font)
self.button_back.setObjectName("button_back")
self.gridLayout_2.addWidget(self.button_back, 5, 0, 1, 2)
- self.log_button = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
- self.log_button.setMaximumSize(QtCore.QSize(5000, 300))
+ self.button_logs = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
+ self.button_logs.setMaximumSize(QtCore.QSize(5000, 300))
font = QtGui.QFont()
font.setPointSize(28)
font.setBold(True)
font.setWeight(75)
- self.log_button.setFont(font)
- self.log_button.setObjectName("log_button")
- self.gridLayout_2.addWidget(self.log_button, 4, 0, 1, 1)
- self.rfid_button = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
- self.rfid_button.setEnabled(False)
- self.rfid_button.setMaximumSize(QtCore.QSize(5000, 300))
+ self.button_logs.setFont(font)
+ self.button_logs.setObjectName("button_logs")
+ self.gridLayout_2.addWidget(self.button_logs, 4, 0, 1, 1)
+ self.button_rfid = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
+ self.button_rfid.setEnabled(False)
+ self.button_rfid.setMaximumSize(QtCore.QSize(5000, 300))
font = QtGui.QFont()
font.setPointSize(28)
font.setBold(True)
font.setWeight(75)
- self.rfid_button.setFont(font)
- self.rfid_button.setObjectName("rfid_button")
- self.gridLayout_2.addWidget(self.rfid_button, 4, 1, 1, 1)
+ self.button_rfid.setFont(font)
+ self.button_rfid.setObjectName("button_rfid")
+ self.gridLayout_2.addWidget(self.button_rfid, 4, 1, 1, 1)
self.verticalLayout_3.addLayout(self.gridLayout_2)
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
self.gridLayout.addWidget(self.scrollArea, 4, 0, 1, 1)
@@ -162,8 +162,8 @@ def retranslateUi(self, Optionwindow):
self.button_reboot.setText(_translate("Optionwindow", "Reboot"))
self.button_restore.setText(_translate("Optionwindow", "Restore"))
self.button_back.setText(_translate("Optionwindow", "< Back"))
- self.log_button.setText(_translate("Optionwindow", "Logs"))
- self.rfid_button.setText(_translate("Optionwindow", "Write RFID"))
+ self.button_logs.setText(_translate("Optionwindow", "Logs"))
+ self.button_rfid.setText(_translate("Optionwindow", "Write RFID"))
if __name__ == "__main__":
diff --git a/src/ui_elements/optionwindow.ui b/src/ui_elements/optionwindow.ui
index 324e9ec4..d0026609 100644
--- a/src/ui_elements/optionwindow.ui
+++ b/src/ui_elements/optionwindow.ui
@@ -258,7 +258,7 @@
-
-
+
5000
@@ -278,7 +278,7 @@
-
-
+
false
From 9a823edda8e11cb6b625eb239d6144a2514189bc Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 13:09:40 +0100
Subject: [PATCH 08/26] Connect to new window objects
---
src/ui/setup_option_window.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/ui/setup_option_window.py b/src/ui/setup_option_window.py
index 9052209e..8dd916d2 100644
--- a/src/ui/setup_option_window.py
+++ b/src/ui/setup_option_window.py
@@ -10,6 +10,7 @@
from PyQt5.QtWidgets import QMainWindow
from src.ui.create_config_window import ConfigWindow
+from src.ui.setup_log_window import LogWindow
from src.ui_elements.optionwindow import Ui_Optionwindow
from src.display_controller import DP_CONTROLLER
from src.dialog_handler import UI_LANGUAGE
@@ -51,8 +52,10 @@ def __init__(self, parent):
self.button_backup.clicked.connect(self._create_backup)
self.button_restore.clicked.connect(self._upload_backup)
self.button_export.clicked.connect(SAVE_HANDLER.export_data)
+ self.button_logs.clicked.connect(self._show_logs)
self.config_window: Optional[ConfigWindow] = None
+ self.log_window: Optional[LogWindow] = None
UI_LANGUAGE.adjust_option_window(self)
self.showFullScreen()
DP_CONTROLLER.set_display_settings(self)
@@ -131,3 +134,12 @@ def _get_user_folder_response(self):
if not selected_path:
return None
return Path(selected_path).absolute()
+
+ def _show_logs(self):
+ """Opens the logs window"""
+ self.close()
+ self.log_window = LogWindow()
+
+ def _open_rfid_writer(self):
+ """Opens the rfid writer window"""
+ # TODO: Implement the rfid logic
From 2692a81ae7059181b67a029747194284d699ea2c Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 13:09:57 +0100
Subject: [PATCH 09/26] Base initialization of log window
---
src/ui/setup_log_window.py | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
create mode 100644 src/ui/setup_log_window.py
diff --git a/src/ui/setup_log_window.py b/src/ui/setup_log_window.py
new file mode 100644
index 00000000..f9f9497d
--- /dev/null
+++ b/src/ui/setup_log_window.py
@@ -0,0 +1,23 @@
+from PyQt5.QtCore import Qt
+from PyQt5.QtWidgets import QMainWindow
+from src.dialog_handler import UI_LANGUAGE
+from src.display_controller import DP_CONTROLLER
+from src.ui_elements.logwindow import Ui_LogWindow
+
+
+class LogWindow(QMainWindow, Ui_LogWindow):
+ """ Creates the log window Widget. """
+
+ def __init__(self):
+ """ Init. Connect all the buttons and set window policy. """
+ super().__init__()
+ self.setupUi(self)
+ self.setWindowFlags(Qt.Window | Qt.CustomizeWindowHint | Qt.WindowStaysOnTopHint) # type: ignore
+ self.setAttribute(Qt.WA_DeleteOnClose) # type: ignore
+ DP_CONTROLLER.inject_stylesheet(self)
+ # Connect all the buttons, generates a list of the numbers an object names to do that
+ self.button_back.clicked.connect(self.close)
+ self.move(0, 0)
+ UI_LANGUAGE.adjust_log_window(self)
+ self.showFullScreen()
+ DP_CONTROLLER.set_display_settings(self)
From d4dea936022a783d3c402f13dee8dd95f1a14e3d Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 15:24:14 +0100
Subject: [PATCH 10/26] Change window name
---
src/ui_elements/logwindow.py | 4 ++--
src/ui_elements/logwindow.ui | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/ui_elements/logwindow.py b/src/ui_elements/logwindow.py
index 7f77be4e..08514fc1 100644
--- a/src/ui_elements/logwindow.py
+++ b/src/ui_elements/logwindow.py
@@ -31,7 +31,7 @@ def setupUi(self, LogWindow):
self.scrollArea = QtWidgets.QScrollArea(self.centralwidget)
self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
self.scrollArea.setFrameShadow(QtWidgets.QFrame.Plain)
- self.scrollArea.setLineWidth(1)
+ self.scrollArea.setLineWidth(0)
self.scrollArea.setWidgetResizable(True)
self.scrollArea.setObjectName("scrollArea")
self.scrollAreaWidgetContents = QtWidgets.QWidget()
@@ -78,7 +78,7 @@ def setupUi(self, LogWindow):
def retranslateUi(self, LogWindow):
_translate = QtCore.QCoreApplication.translate
- LogWindow.setWindowTitle(_translate("LogWindow", "Options"))
+ LogWindow.setWindowTitle(_translate("LogWindow", "Logs"))
self.button_back.setText(_translate("LogWindow", "< Back"))
self.button_back.setProperty("cssClass", _translate("LogWindow", "btn-inverted"))
diff --git a/src/ui_elements/logwindow.ui b/src/ui_elements/logwindow.ui
index 259cb8f2..bc0cfaa0 100644
--- a/src/ui_elements/logwindow.ui
+++ b/src/ui_elements/logwindow.ui
@@ -32,7 +32,7 @@
ArrowCursor
- Options
+ Logs
@@ -48,7 +48,7 @@
QFrame::Plain
- 1
+ 0
true
From 71fa41aabaa4bcd89bcb2c1a2c968be41c47238d Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 15:29:41 +0100
Subject: [PATCH 11/26] Remove 2nd border
---
src/ui_elements/logwindow.py | 9 ++++++++-
src/ui_elements/logwindow.ui | 22 ++++++++++++++++++++--
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/src/ui_elements/logwindow.py b/src/ui_elements/logwindow.py
index 08514fc1..0e5cb7eb 100644
--- a/src/ui_elements/logwindow.py
+++ b/src/ui_elements/logwindow.py
@@ -32,10 +32,11 @@ def setupUi(self, LogWindow):
self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
self.scrollArea.setFrameShadow(QtWidgets.QFrame.Plain)
self.scrollArea.setLineWidth(0)
+ self.scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
self.scrollArea.setWidgetResizable(True)
self.scrollArea.setObjectName("scrollArea")
self.scrollAreaWidgetContents = QtWidgets.QWidget()
- self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 782, 401))
+ self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 782, 384))
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents)
self.verticalLayout_3.setContentsMargins(0, 0, 4, 0)
@@ -43,6 +44,12 @@ def setupUi(self, LogWindow):
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.text_display = QtWidgets.QTextBrowser(self.scrollAreaWidgetContents)
+ font = QtGui.QFont()
+ font.setPointSize(12)
+ self.text_display.setFont(font)
+ self.text_display.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.text_display.setFrameShadow(QtWidgets.QFrame.Plain)
+ self.text_display.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.text_display.setObjectName("text_display")
self.verticalLayout.addWidget(self.text_display)
self.verticalLayout_3.addLayout(self.verticalLayout)
diff --git a/src/ui_elements/logwindow.ui b/src/ui_elements/logwindow.ui
index bc0cfaa0..89857fb1 100644
--- a/src/ui_elements/logwindow.ui
+++ b/src/ui_elements/logwindow.ui
@@ -50,6 +50,9 @@
0
+
+ Qt::ScrollBarAlwaysOn
+
true
@@ -59,7 +62,7 @@
0
0
782
- 401
+ 384
@@ -78,7 +81,22 @@
-
-
-
+
+
+
+ 12
+
+
+
+ QFrame::NoFrame
+
+
+ QFrame::Plain
+
+
+ Qt::ScrollBarAlwaysOff
+
+
From 9782e65a1441df06a370e63bf3f299af800e54b7 Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 15:34:38 +0100
Subject: [PATCH 12/26] Add horizontal scroll
---
src/ui_elements/logwindow.py | 25 +++------------
src/ui_elements/logwindow.ui | 62 ++++++------------------------------
2 files changed, 13 insertions(+), 74 deletions(-)
diff --git a/src/ui_elements/logwindow.py b/src/ui_elements/logwindow.py
index 0e5cb7eb..a2245b9c 100644
--- a/src/ui_elements/logwindow.py
+++ b/src/ui_elements/logwindow.py
@@ -28,33 +28,16 @@ def setupUi(self, LogWindow):
self.centralwidget.setObjectName("centralwidget")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget)
self.verticalLayout_2.setObjectName("verticalLayout_2")
- self.scrollArea = QtWidgets.QScrollArea(self.centralwidget)
- self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
- self.scrollArea.setFrameShadow(QtWidgets.QFrame.Plain)
- self.scrollArea.setLineWidth(0)
- self.scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
- self.scrollArea.setWidgetResizable(True)
- self.scrollArea.setObjectName("scrollArea")
- self.scrollAreaWidgetContents = QtWidgets.QWidget()
- self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 782, 384))
- self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
- self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents)
- self.verticalLayout_3.setContentsMargins(0, 0, 4, 0)
- self.verticalLayout_3.setObjectName("verticalLayout_3")
- self.verticalLayout = QtWidgets.QVBoxLayout()
- self.verticalLayout.setObjectName("verticalLayout")
- self.text_display = QtWidgets.QTextBrowser(self.scrollAreaWidgetContents)
+ self.text_display = QtWidgets.QTextBrowser(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(12)
self.text_display.setFont(font)
self.text_display.setFrameShape(QtWidgets.QFrame.NoFrame)
self.text_display.setFrameShadow(QtWidgets.QFrame.Plain)
- self.text_display.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
+ self.text_display.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
+ self.text_display.setLineWrapMode(QtWidgets.QTextEdit.NoWrap)
self.text_display.setObjectName("text_display")
- self.verticalLayout.addWidget(self.text_display)
- self.verticalLayout_3.addLayout(self.verticalLayout)
- self.scrollArea.setWidget(self.scrollAreaWidgetContents)
- self.verticalLayout_2.addWidget(self.scrollArea)
+ self.verticalLayout_2.addWidget(self.text_display)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.button_back = QtWidgets.QPushButton(self.centralwidget)
diff --git a/src/ui_elements/logwindow.ui b/src/ui_elements/logwindow.ui
index 89857fb1..ec24c353 100644
--- a/src/ui_elements/logwindow.ui
+++ b/src/ui_elements/logwindow.ui
@@ -40,68 +40,24 @@
-
-
+
+
+
+ 12
+
+
QFrame::NoFrame
QFrame::Plain
-
- 0
-
- Qt::ScrollBarAlwaysOn
+ Qt::ScrollBarAsNeeded
-
- true
+
+ QTextEdit::NoWrap
-
-
-
- 0
- 0
- 782
- 384
-
-
-
-
- 0
-
-
- 0
-
-
- 4
-
-
- 0
-
-
-
-
-
-
-
-
-
- 12
-
-
-
- QFrame::NoFrame
-
-
- QFrame::Plain
-
-
- Qt::ScrollBarAlwaysOff
-
-
-
-
-
-
-
-
From fd43bdee5bbec469ae3d6fdca499e12d43eea0f2 Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 15:50:24 +0100
Subject: [PATCH 13/26] Add logic for log read
---
src/ui/setup_log_window.py | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/src/ui/setup_log_window.py b/src/ui/setup_log_window.py
index f9f9497d..f991e022 100644
--- a/src/ui/setup_log_window.py
+++ b/src/ui/setup_log_window.py
@@ -1,9 +1,14 @@
+from pathlib import Path
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QMainWindow
from src.dialog_handler import UI_LANGUAGE
from src.display_controller import DP_CONTROLLER
from src.ui_elements.logwindow import Ui_LogWindow
+_DIRPATH = Path(__file__).parent.absolute()
+_LOG_FOLDER = _DIRPATH.parents[1] / "logs"
+_DEFAULT_SELECTED = "production_logs.log"
+
class LogWindow(QMainWindow, Ui_LogWindow):
""" Creates the log window Widget. """
@@ -17,7 +22,32 @@ def __init__(self):
DP_CONTROLLER.inject_stylesheet(self)
# Connect all the buttons, generates a list of the numbers an object names to do that
self.button_back.clicked.connect(self.close)
+
+ # Get log file names, fill widget, select default, if it exists
+ self.log_files = self._get_log_files()
+ self.selection_logs.activated.connect(self._read_logs)
+ DP_CONTROLLER.fill_single_combobox(self.selection_logs, self.log_files, first_empty=False)
+ if _DEFAULT_SELECTED in self.log_files:
+ DP_CONTROLLER.set_combobox_item(self.selection_logs, _DEFAULT_SELECTED)
+ # activated does only trigger if changed by user, so we need to read in here
+ self._read_logs()
+
self.move(0, 0)
UI_LANGUAGE.adjust_log_window(self)
self.showFullScreen()
DP_CONTROLLER.set_display_settings(self)
+
+ def _get_log_files(self):
+ """Checks the logs folder for all existing log files"""
+ return [file.name for file in _LOG_FOLDER.glob("*.log")]
+
+ def _read_logs(self):
+ """Read the current selected log file"""
+ log_name = self.selection_logs.currentText()
+ # Return if empty selection
+ if log_name == "":
+ return
+ log_path = _LOG_FOLDER / log_name
+ log_text = log_path.read_text()
+ latest_to_oldest = "\n".join(log_text.splitlines()[::-1])
+ self.text_display.setText(latest_to_oldest)
From 92b4ed90a93f578468d241a075f5dd72273ab42e Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 16:06:08 +0100
Subject: [PATCH 14/26] Empty cfg password = no password needed
---
src/dialog_handler.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/dialog_handler.py b/src/dialog_handler.py
index feeee315..64813115 100644
--- a/src/dialog_handler.py
+++ b/src/dialog_handler.py
@@ -66,6 +66,9 @@ def user_okay(self, text: str):
def password_prompt(self):
"""Opens a password prompt, return if successful entered password"""
from src.ui.setup_password_dialog import PasswordDialog
+ # if password is empty, return true
+ if cfg.UI_MASTERPASSWORD == "":
+ return True
password_dialog = PasswordDialog()
if password_dialog.exec_():
return True
From eeb557d54f34bfe09dc18d8dd29cdfcd06afa664 Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 16:06:21 +0100
Subject: [PATCH 15/26] Use new logger structure
---
src/logger_handler.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/logger_handler.py b/src/logger_handler.py
index bb424e8b..bd62f2c4 100644
--- a/src/logger_handler.py
+++ b/src/logger_handler.py
@@ -27,7 +27,7 @@ def __init__(self, logger_name: str, filename: str = LogFiles.PRODUCTION):
if not logger.hasHandlers():
file_handler = logging.FileHandler(self.path)
file_handler.setLevel(logging.DEBUG)
- formatter = logging.Formatter("%(asctime)s | %(name)s | %(levelname)s: %(message)s", "%Y-%m-%d %H:%M")
+ formatter = logging.Formatter("%(asctime)s | %(levelname)-8s | %(message)s [%(name)s]", "%Y-%m-%d %H:%M")
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)
From 6f42b95a20dab54e6a313be2076f8f92a1805f77 Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 16:06:46 +0100
Subject: [PATCH 16/26] Switch control to top
---
src/ui_elements/logwindow.py | 22 +++++++++---------
src/ui_elements/logwindow.ui | 44 ++++++++++++++++++------------------
2 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/src/ui_elements/logwindow.py b/src/ui_elements/logwindow.py
index a2245b9c..04fcd119 100644
--- a/src/ui_elements/logwindow.py
+++ b/src/ui_elements/logwindow.py
@@ -28,16 +28,6 @@ def setupUi(self, LogWindow):
self.centralwidget.setObjectName("centralwidget")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget)
self.verticalLayout_2.setObjectName("verticalLayout_2")
- self.text_display = QtWidgets.QTextBrowser(self.centralwidget)
- font = QtGui.QFont()
- font.setPointSize(12)
- self.text_display.setFont(font)
- self.text_display.setFrameShape(QtWidgets.QFrame.NoFrame)
- self.text_display.setFrameShadow(QtWidgets.QFrame.Plain)
- self.text_display.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
- self.text_display.setLineWrapMode(QtWidgets.QTextEdit.NoWrap)
- self.text_display.setObjectName("text_display")
- self.verticalLayout_2.addWidget(self.text_display)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.button_back = QtWidgets.QPushButton(self.centralwidget)
@@ -51,7 +41,7 @@ def setupUi(self, LogWindow):
self.horizontalLayout.addWidget(self.button_back)
self.selection_logs = QtWidgets.QComboBox(self.centralwidget)
self.selection_logs.setMinimumSize(QtCore.QSize(105, 38))
- self.selection_logs.setMaximumSize(QtCore.QSize(300, 100))
+ self.selection_logs.setMaximumSize(QtCore.QSize(5000, 100))
font = QtGui.QFont()
font.setPointSize(14)
font.setBold(True)
@@ -61,6 +51,16 @@ def setupUi(self, LogWindow):
self.selection_logs.setObjectName("selection_logs")
self.horizontalLayout.addWidget(self.selection_logs)
self.verticalLayout_2.addLayout(self.horizontalLayout)
+ self.text_display = QtWidgets.QTextBrowser(self.centralwidget)
+ font = QtGui.QFont()
+ font.setPointSize(12)
+ self.text_display.setFont(font)
+ self.text_display.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.text_display.setFrameShadow(QtWidgets.QFrame.Plain)
+ self.text_display.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
+ self.text_display.setLineWrapMode(QtWidgets.QTextEdit.NoWrap)
+ self.text_display.setObjectName("text_display")
+ self.verticalLayout_2.addWidget(self.text_display)
LogWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(LogWindow)
diff --git a/src/ui_elements/logwindow.ui b/src/ui_elements/logwindow.ui
index ec24c353..5e678acf 100644
--- a/src/ui_elements/logwindow.ui
+++ b/src/ui_elements/logwindow.ui
@@ -39,27 +39,6 @@
-
-
-
-
-
- 12
-
-
-
- QFrame::NoFrame
-
-
- QFrame::Plain
-
-
- Qt::ScrollBarAsNeeded
-
-
- QTextEdit::NoWrap
-
-
-
-
-
@@ -95,7 +74,7 @@
- 300
+ 5000
100
@@ -113,6 +92,27 @@
+ -
+
+
+
+ 12
+
+
+
+ QFrame::NoFrame
+
+
+ QFrame::Plain
+
+
+ Qt::ScrollBarAsNeeded
+
+
+ QTextEdit::NoWrap
+
+
+
From 08bb398adf073d879aa8ed0522e8b015e71f528a Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 16:07:02 +0100
Subject: [PATCH 17/26] Style for horizontal scrollbar
---
src/ui/styles/_elements.scss | 59 +++++++++++++++++++++++++++++++-----
src/ui/styles/alien.css | 43 +++++++++++++++++++++++---
src/ui/styles/bavaria.css | 43 +++++++++++++++++++++++---
src/ui/styles/berry.css | 43 +++++++++++++++++++++++---
src/ui/styles/default.css | 43 +++++++++++++++++++++++---
5 files changed, 207 insertions(+), 24 deletions(-)
diff --git a/src/ui/styles/_elements.scss b/src/ui/styles/_elements.scss
index a8b29509..490fd6db 100644
--- a/src/ui/styles/_elements.scss
+++ b/src/ui/styles/_elements.scss
@@ -278,12 +278,19 @@ QListWidget {
& QScrollBar:vertical {
border-right: 0px solid $border;
}
+ & QScrollBar:horizontal {
+ border-bottom: 0px solid $border;
+ }
}
QScrollArea QScrollBar:vertical {
border-right: $default-element-border;
}
+QScrollArea QScrollBar:horizontal {
+ border-bottom: $default-element-border;
+}
+
/* Moving List Widget here from the single objects */
QScrollBar:vertical {
border: $default-element-border;
@@ -294,12 +301,24 @@ QScrollBar:vertical {
margin: 25px 0px 25px 0px;
}
-QScrollBar::handle:vertical {
- background: $primary;
- border-radius: $scrollbar-border-radius - 5px;
- &:pressed {
- background-color: $secondary;
- border-color: $secondary;
+QScrollBar:horizontal {
+ border: $default-element-border;
+ border-bottom: 1px solid $border;
+ border-radius: $scrollbar-border-radius;
+ background: $background;
+ height: 40px;
+ margin: 0px 25px 0px 25px;
+}
+
+QScrollBar::handle {
+ &:vertical,
+ &:horizontal {
+ background: $primary;
+ border-radius: $scrollbar-border-radius - 5px;
+ &:pressed {
+ background-color: $secondary;
+ border-color: $secondary;
+ }
}
}
@@ -314,6 +333,16 @@ QScrollBar::add-line:vertical {
subcontrol-origin: margin;
}
+QScrollBar::add-line:horizontal {
+ border: $default-element-border;
+ border-top-right-radius: $scrollbar-border-radius;
+ border-bottom-right-radius: $scrollbar-border-radius;
+ background-color: $border;
+ width: 38px;
+ subcontrol-position: right;
+ subcontrol-origin: margin;
+}
+
// top button
QScrollBar::sub-line:vertical {
border: $default-element-border;
@@ -325,14 +354,28 @@ QScrollBar::sub-line:vertical {
subcontrol-origin: margin;
}
+QScrollBar::sub-line:horizontal {
+ border: $default-element-border;
+ border-top-left-radius: $scrollbar-border-radius;
+ border-bottom-left-radius: $scrollbar-border-radius;
+ background-color: $border;
+ width: 38px;
+ subcontrol-position: left;
+ subcontrol-origin: margin;
+}
+
// remove the grid thingy from bg
QScrollBar::add-page:vertical,
-QScrollBar::sub-page:vertical {
+QScrollBar::sub-page:vertical,
+QScrollBar::add-page:horizontal,
+QScrollBar::sub-page:horizontal {
background: none;
}
QScrollBar::sub-line:vertical:pressed,
-QScrollBar::add-line:vertical:pressed {
+QScrollBar::add-line:vertical:pressed,
+QScrollBar::sub-line:horizontal:pressed,
+QScrollBar::add-line:horizontal:pressed {
background-color: $secondary;
border-color: $secondary;
}
diff --git a/src/ui/styles/alien.css b/src/ui/styles/alien.css
index 8fedb1d2..744f9b17 100644
--- a/src/ui/styles/alien.css
+++ b/src/ui/styles/alien.css
@@ -213,10 +213,15 @@ QListWidget {
border-top-right-radius: 21px; }
QListWidget QScrollBar:vertical {
border-right: 0px solid #586c5b; }
+ QListWidget QScrollBar:horizontal {
+ border-bottom: 0px solid #586c5b; }
QScrollArea QScrollBar:vertical {
border-right: 2px solid #586c5b; }
+QScrollArea QScrollBar:horizontal {
+ border-bottom: 2px solid #586c5b; }
+
/* Moving List Widget here from the single objects */
QScrollBar:vertical {
border: 2px solid #586c5b;
@@ -226,10 +231,18 @@ QScrollBar:vertical {
width: 40px;
margin: 25px 0px 25px 0px; }
-QScrollBar::handle:vertical {
+QScrollBar:horizontal {
+ border: 2px solid #586c5b;
+ border-bottom: 1px solid #586c5b;
+ border-radius: 15px;
+ background: #111111;
+ height: 40px;
+ margin: 0px 25px 0px 25px; }
+
+QScrollBar::handle:vertical, QScrollBar::handle:horizontal {
background: #00dd4a;
border-radius: 10px; }
- QScrollBar::handle:vertical:pressed {
+ QScrollBar::handle:vertical:pressed, QScrollBar::handle:horizontal:pressed {
background-color: #00e4d1;
border-color: #00e4d1; }
@@ -242,6 +255,15 @@ QScrollBar::add-line:vertical {
subcontrol-position: bottom;
subcontrol-origin: margin; }
+QScrollBar::add-line:horizontal {
+ border: 2px solid #586c5b;
+ border-top-right-radius: 15px;
+ border-bottom-right-radius: 15px;
+ background-color: #586c5b;
+ width: 38px;
+ subcontrol-position: right;
+ subcontrol-origin: margin; }
+
QScrollBar::sub-line:vertical {
border: 2px solid #586c5b;
border-top-left-radius: 15px;
@@ -251,12 +273,25 @@ QScrollBar::sub-line:vertical {
subcontrol-position: top;
subcontrol-origin: margin; }
+QScrollBar::sub-line:horizontal {
+ border: 2px solid #586c5b;
+ border-top-left-radius: 15px;
+ border-bottom-left-radius: 15px;
+ background-color: #586c5b;
+ width: 38px;
+ subcontrol-position: left;
+ subcontrol-origin: margin; }
+
QScrollBar::add-page:vertical,
-QScrollBar::sub-page:vertical {
+QScrollBar::sub-page:vertical,
+QScrollBar::add-page:horizontal,
+QScrollBar::sub-page:horizontal {
background: none; }
QScrollBar::sub-line:vertical:pressed,
-QScrollBar::add-line:vertical:pressed {
+QScrollBar::add-line:vertical:pressed,
+QScrollBar::sub-line:horizontal:pressed,
+QScrollBar::add-line:horizontal:pressed {
background-color: #00e4d1;
border-color: #00e4d1; }
diff --git a/src/ui/styles/bavaria.css b/src/ui/styles/bavaria.css
index b8bf6d0a..947c91b9 100644
--- a/src/ui/styles/bavaria.css
+++ b/src/ui/styles/bavaria.css
@@ -213,10 +213,15 @@ QListWidget {
border-top-right-radius: 21px; }
QListWidget QScrollBar:vertical {
border-right: 0px solid #0b0e41; }
+ QListWidget QScrollBar:horizontal {
+ border-bottom: 0px solid #0b0e41; }
QScrollArea QScrollBar:vertical {
border-right: 2px solid #0b0e41; }
+QScrollArea QScrollBar:horizontal {
+ border-bottom: 2px solid #0b0e41; }
+
/* Moving List Widget here from the single objects */
QScrollBar:vertical {
border: 2px solid #0b0e41;
@@ -226,10 +231,18 @@ QScrollBar:vertical {
width: 40px;
margin: 25px 0px 25px 0px; }
-QScrollBar::handle:vertical {
+QScrollBar:horizontal {
+ border: 2px solid #0b0e41;
+ border-bottom: 1px solid #0b0e41;
+ border-radius: 15px;
+ background: #dad9d9;
+ height: 40px;
+ margin: 0px 25px 0px 25px; }
+
+QScrollBar::handle:vertical, QScrollBar::handle:horizontal {
background: #007bff;
border-radius: 10px; }
- QScrollBar::handle:vertical:pressed {
+ QScrollBar::handle:vertical:pressed, QScrollBar::handle:horizontal:pressed {
background-color: #01276a;
border-color: #01276a; }
@@ -242,6 +255,15 @@ QScrollBar::add-line:vertical {
subcontrol-position: bottom;
subcontrol-origin: margin; }
+QScrollBar::add-line:horizontal {
+ border: 2px solid #0b0e41;
+ border-top-right-radius: 15px;
+ border-bottom-right-radius: 15px;
+ background-color: #0b0e41;
+ width: 38px;
+ subcontrol-position: right;
+ subcontrol-origin: margin; }
+
QScrollBar::sub-line:vertical {
border: 2px solid #0b0e41;
border-top-left-radius: 15px;
@@ -251,12 +273,25 @@ QScrollBar::sub-line:vertical {
subcontrol-position: top;
subcontrol-origin: margin; }
+QScrollBar::sub-line:horizontal {
+ border: 2px solid #0b0e41;
+ border-top-left-radius: 15px;
+ border-bottom-left-radius: 15px;
+ background-color: #0b0e41;
+ width: 38px;
+ subcontrol-position: left;
+ subcontrol-origin: margin; }
+
QScrollBar::add-page:vertical,
-QScrollBar::sub-page:vertical {
+QScrollBar::sub-page:vertical,
+QScrollBar::add-page:horizontal,
+QScrollBar::sub-page:horizontal {
background: none; }
QScrollBar::sub-line:vertical:pressed,
-QScrollBar::add-line:vertical:pressed {
+QScrollBar::add-line:vertical:pressed,
+QScrollBar::sub-line:horizontal:pressed,
+QScrollBar::add-line:horizontal:pressed {
background-color: #01276a;
border-color: #01276a; }
diff --git a/src/ui/styles/berry.css b/src/ui/styles/berry.css
index 7195c2ca..754fb617 100644
--- a/src/ui/styles/berry.css
+++ b/src/ui/styles/berry.css
@@ -213,10 +213,15 @@ QListWidget {
border-top-right-radius: 21px; }
QListWidget QScrollBar:vertical {
border-right: 0px solid #6f6f87; }
+ QListWidget QScrollBar:horizontal {
+ border-bottom: 0px solid #6f6f87; }
QScrollArea QScrollBar:vertical {
border-right: 2px solid #6f6f87; }
+QScrollArea QScrollBar:horizontal {
+ border-bottom: 2px solid #6f6f87; }
+
/* Moving List Widget here from the single objects */
QScrollBar:vertical {
border: 2px solid #6f6f87;
@@ -226,10 +231,18 @@ QScrollBar:vertical {
width: 40px;
margin: 25px 0px 25px 0px; }
-QScrollBar::handle:vertical {
+QScrollBar:horizontal {
+ border: 2px solid #6f6f87;
+ border-bottom: 1px solid #6f6f87;
+ border-radius: 15px;
+ background: #0d0d0d;
+ height: 40px;
+ margin: 0px 25px 0px 25px; }
+
+QScrollBar::handle:vertical, QScrollBar::handle:horizontal {
background: #3a4cbf;
border-radius: 10px; }
- QScrollBar::handle:vertical:pressed {
+ QScrollBar::handle:vertical:pressed, QScrollBar::handle:horizontal:pressed {
background-color: #ec407a;
border-color: #ec407a; }
@@ -242,6 +255,15 @@ QScrollBar::add-line:vertical {
subcontrol-position: bottom;
subcontrol-origin: margin; }
+QScrollBar::add-line:horizontal {
+ border: 2px solid #6f6f87;
+ border-top-right-radius: 15px;
+ border-bottom-right-radius: 15px;
+ background-color: #6f6f87;
+ width: 38px;
+ subcontrol-position: right;
+ subcontrol-origin: margin; }
+
QScrollBar::sub-line:vertical {
border: 2px solid #6f6f87;
border-top-left-radius: 15px;
@@ -251,12 +273,25 @@ QScrollBar::sub-line:vertical {
subcontrol-position: top;
subcontrol-origin: margin; }
+QScrollBar::sub-line:horizontal {
+ border: 2px solid #6f6f87;
+ border-top-left-radius: 15px;
+ border-bottom-left-radius: 15px;
+ background-color: #6f6f87;
+ width: 38px;
+ subcontrol-position: left;
+ subcontrol-origin: margin; }
+
QScrollBar::add-page:vertical,
-QScrollBar::sub-page:vertical {
+QScrollBar::sub-page:vertical,
+QScrollBar::add-page:horizontal,
+QScrollBar::sub-page:horizontal {
background: none; }
QScrollBar::sub-line:vertical:pressed,
-QScrollBar::add-line:vertical:pressed {
+QScrollBar::add-line:vertical:pressed,
+QScrollBar::sub-line:horizontal:pressed,
+QScrollBar::add-line:horizontal:pressed {
background-color: #ec407a;
border-color: #ec407a; }
diff --git a/src/ui/styles/default.css b/src/ui/styles/default.css
index c4ebeabc..04421fc1 100644
--- a/src/ui/styles/default.css
+++ b/src/ui/styles/default.css
@@ -213,10 +213,15 @@ QListWidget {
border-top-right-radius: 21px; }
QListWidget QScrollBar:vertical {
border-right: 0px solid #616161; }
+ QListWidget QScrollBar:horizontal {
+ border-bottom: 0px solid #616161; }
QScrollArea QScrollBar:vertical {
border-right: 2px solid #616161; }
+QScrollArea QScrollBar:horizontal {
+ border-bottom: 2px solid #616161; }
+
/* Moving List Widget here from the single objects */
QScrollBar:vertical {
border: 2px solid #616161;
@@ -226,10 +231,18 @@ QScrollBar:vertical {
width: 40px;
margin: 25px 0px 25px 0px; }
-QScrollBar::handle:vertical {
+QScrollBar:horizontal {
+ border: 2px solid #616161;
+ border-bottom: 1px solid #616161;
+ border-radius: 15px;
+ background: #0d0d0d;
+ height: 40px;
+ margin: 0px 25px 0px 25px; }
+
+QScrollBar::handle:vertical, QScrollBar::handle:horizontal {
background: #007bff;
border-radius: 10px; }
- QScrollBar::handle:vertical:pressed {
+ QScrollBar::handle:vertical:pressed, QScrollBar::handle:horizontal:pressed {
background-color: #ef9700;
border-color: #ef9700; }
@@ -242,6 +255,15 @@ QScrollBar::add-line:vertical {
subcontrol-position: bottom;
subcontrol-origin: margin; }
+QScrollBar::add-line:horizontal {
+ border: 2px solid #616161;
+ border-top-right-radius: 15px;
+ border-bottom-right-radius: 15px;
+ background-color: #616161;
+ width: 38px;
+ subcontrol-position: right;
+ subcontrol-origin: margin; }
+
QScrollBar::sub-line:vertical {
border: 2px solid #616161;
border-top-left-radius: 15px;
@@ -251,12 +273,25 @@ QScrollBar::sub-line:vertical {
subcontrol-position: top;
subcontrol-origin: margin; }
+QScrollBar::sub-line:horizontal {
+ border: 2px solid #616161;
+ border-top-left-radius: 15px;
+ border-bottom-left-radius: 15px;
+ background-color: #616161;
+ width: 38px;
+ subcontrol-position: left;
+ subcontrol-origin: margin; }
+
QScrollBar::add-page:vertical,
-QScrollBar::sub-page:vertical {
+QScrollBar::sub-page:vertical,
+QScrollBar::add-page:horizontal,
+QScrollBar::sub-page:horizontal {
background: none; }
QScrollBar::sub-line:vertical:pressed,
-QScrollBar::add-line:vertical:pressed {
+QScrollBar::add-line:vertical:pressed,
+QScrollBar::sub-line:horizontal:pressed,
+QScrollBar::add-line:horizontal:pressed {
background-color: #ef9700;
border-color: #ef9700; }
From eb20ea431fcc2c87163d9242350a90037a9b2fe4 Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 16:07:17 +0100
Subject: [PATCH 18/26] Retrieve list before joining
---
src/ui/setup_log_window.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/ui/setup_log_window.py b/src/ui/setup_log_window.py
index f991e022..f6067703 100644
--- a/src/ui/setup_log_window.py
+++ b/src/ui/setup_log_window.py
@@ -49,5 +49,5 @@ def _read_logs(self):
return
log_path = _LOG_FOLDER / log_name
log_text = log_path.read_text()
- latest_to_oldest = "\n".join(log_text.splitlines()[::-1])
- self.text_display.setText(latest_to_oldest)
+ latest_to_oldest_list = log_text.splitlines()[::-1]
+ self.text_display.setText("\n".join(latest_to_oldest_list))
From d6ed40a7eb0edf4fe23f1f0ae1717cad7c85c776 Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Sun, 5 Mar 2023 18:02:46 +0100
Subject: [PATCH 19/26] Add parsing + grouping for logs
---
src/ui/setup_log_window.py | 46 ++++++++++++++++++++++++++++++++++++--
1 file changed, 44 insertions(+), 2 deletions(-)
diff --git a/src/ui/setup_log_window.py b/src/ui/setup_log_window.py
index f6067703..24fe60a5 100644
--- a/src/ui/setup_log_window.py
+++ b/src/ui/setup_log_window.py
@@ -1,4 +1,6 @@
+import re
from pathlib import Path
+from collections import Counter
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QMainWindow
from src.dialog_handler import UI_LANGUAGE
@@ -8,6 +10,7 @@
_DIRPATH = Path(__file__).parent.absolute()
_LOG_FOLDER = _DIRPATH.parents[1] / "logs"
_DEFAULT_SELECTED = "production_logs.log"
+_DEBUG_FILE = "debuglog.log"
class LogWindow(QMainWindow, Ui_LogWindow):
@@ -49,5 +52,44 @@ def _read_logs(self):
return
log_path = _LOG_FOLDER / log_name
log_text = log_path.read_text()
- latest_to_oldest_list = log_text.splitlines()[::-1]
- self.text_display.setText("\n".join(latest_to_oldest_list))
+ # Handle debug logs differently, since they save error traces,
+ # just display the read in text from log in this case
+ if log_name == _DEBUG_FILE:
+ logs_to_render = self._parse_debug_logs(log_text)
+ else:
+ logs_to_render = self._parse_log(log_text)
+ self.text_display.setText(logs_to_render)
+
+ def _parse_log(self, log_text: str):
+ """Parse all logs and return display object.
+ Needs logs from new to old, if same message was already there, skip it.
+ """
+ data: dict[str, str] = {}
+ counter = Counter()
+ for line in log_text.splitlines()[::-1]:
+ date, message = self._parse_log_line(line)
+ if message not in data:
+ data[message] = date
+ counter[message] = 1
+ else:
+ counter[message] += 1
+ log_list_data = [f"{key} ({counter[key]}x, latest: {value})" for key, value in data.items()]
+ return "\n".join(log_list_data)
+
+ def _parse_log_line(self, line: str):
+ """Parse the log message and return the timestamp + msg"""
+ parts = line.split(" | ", maxsplit=1)
+ parsed_date = parts[0]
+ # usually, we only get 2 parts, due to the maxsplit
+ parsed_message = " | ".join(parts[1::])
+ return parsed_date, parsed_message
+
+ def _parse_debug_logs(self, log):
+ """Parses and inverts the debug logs"""
+ # having into group returns also the matched date
+ # This needs to be joined before inverting.
+ # Also, the first value is an empty string
+ date_regex = r"(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2})"
+ information_list = [x for x in re.split(date_regex, log) if x != ""]
+ pairs = [" ".join(information_list[i:i + 2]) for i in range(0, len(information_list), 2)]
+ return "\n".join(pairs[::-1])
From 9b1181be6681d37a0bcffd42dce4f030e37da783 Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Mon, 6 Mar 2023 20:54:54 +0100
Subject: [PATCH 20/26] Change format of cocktail log
---
src/tabs/maker.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/tabs/maker.py b/src/tabs/maker.py
index 6b9bca0d..05c74211 100644
--- a/src/tabs/maker.py
+++ b/src/tabs/maker.py
@@ -18,7 +18,7 @@
from src.config_manager import shared
-LOG_HANDLER = LoggerHandler("maker_module")
+_LOGGER = LoggerHandler("maker_module")
T = TypeVar('T', int, float)
@@ -71,7 +71,7 @@ def __generate_maker_log_entry(cocktail_volume: int, cocktail_name: str, taken_t
if not shared.make_cocktail:
pumped_volume = round(cocktail_volume * (taken_time) / max_time)
cancel_log_addition = f" - Recipe canceled at {round(taken_time, 1)} s - {pumped_volume} ml"
- LOG_HANDLER.log_event("INFO", f"{volume_string:6} | {cocktail_name}{cancel_log_addition}")
+ _LOGGER.log_event("INFO", f"{volume_string:6} - {cocktail_name}{cancel_log_addition}")
@logerror
From afb3aa3febb79fc09e608612e0b6f49f6782e057 Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Tue, 7 Mar 2023 17:44:56 +0100
Subject: [PATCH 21/26] Let led circle two rounds per second
---
src/machine/leds.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/machine/leds.py b/src/machine/leds.py
index 2a5abfdb..d326f9d8 100644
--- a/src/machine/leds.py
+++ b/src/machine/leds.py
@@ -127,7 +127,8 @@ def __init__(self, pin: int) -> None:
def _preparation_thread(self):
"""Fills one by one with same random color, then repeats / overwrites old ones"""
- wait_ms = 40
+ # Make the circle / dot approximate 2 rounds per second
+ wait_ms = 500 / cfg.LED_COUNT
self.turn_on(Color(randint(0, 255), randint(0, 255), randint(0, 255)))
while self.is_preparing:
color = Color(
From 900b4835e7d3d59dc17ef854dbd3339a4d6e548d Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Tue, 7 Mar 2023 17:45:30 +0100
Subject: [PATCH 22/26] Connect rfid button to function
---
src/ui/setup_option_window.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/ui/setup_option_window.py b/src/ui/setup_option_window.py
index 8dd916d2..7a92a832 100644
--- a/src/ui/setup_option_window.py
+++ b/src/ui/setup_option_window.py
@@ -53,6 +53,7 @@ def __init__(self, parent):
self.button_restore.clicked.connect(self._upload_backup)
self.button_export.clicked.connect(SAVE_HANDLER.export_data)
self.button_logs.clicked.connect(self._show_logs)
+ self.button_rfid.clicked.connect(self._open_rfid_writer)
self.config_window: Optional[ConfigWindow] = None
self.log_window: Optional[LogWindow] = None
From 325de12427e60b12847bfd6d4b822580c053521f Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Tue, 7 Mar 2023 17:45:48 +0100
Subject: [PATCH 23/26] Add section for config reset
---
docs/troubleshooting.md | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md
index 3a9bd9ee..d4e785ac 100644
--- a/docs/troubleshooting.md
+++ b/docs/troubleshooting.md
@@ -123,6 +123,11 @@ Ensure that you have unchecked the "Reserve space, and not covered by maximised
You can find it under the panel preferences (right click the task bar > panel settings > Advanced).
Unchecking this box usually fixes this problem.
+## Reset Config
+
+In case you want to reset the configuration, it is the best way to just delete the custom_config.yaml in the main folder.
+This file holds your configuration and will be created with the defaults if it does not exists.
+
## Problems Installing Software on Raspberry Pi
The Raspberry Pi can sometimes differ from other machines in terms of installation. Here are some issues that might occur.
From 52760d1235421e2a156b6737b6f8fffa181d97e8 Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Tue, 7 Mar 2023 17:45:59 +0100
Subject: [PATCH 24/26] Add section for program exit + logs
---
docs/faq.md | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/docs/faq.md b/docs/faq.md
index 4f4fd065..74ba1030 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -138,6 +138,18 @@ If you don't understand what docker is or what it does, don't worry.
CocktailBerry will perfectly run without Docker installed.
It's for some optional advanced features you can add anytime you are interested or ready for them.
+### How to Exit the Program
+
+If you want to exit the program to get to the desktop, because you want to do some adjustments,
+just press alt+F4 in the main program on your keyboard.
+Like with most programs, this will exit the current opened program.
+You will then be on your desktop.
+
+### I don't Need a Password
+
+Just set the password empty / delete all numbers.
+If the password setting ist empty, actions requiring a password will automatically succeed without prompting a password.
+
## Other
### What about Tube Volume
@@ -146,7 +158,7 @@ If your pumps got a long tube to the bottle, the first cocktail may have too lit
You can set the `MAKER_TUBE_VOLUME` to an approximate value which corresponds to the average of the tube volume.
When applying a new bottle, CocktailBerry will also pump that much volume up.
-### Whats up with LEDs
+### Implementing LEDs
You can define one or more pins which control a LED (array).
The LEDs will light up during cocktail preparation, as well when the cocktail is finished.
@@ -155,4 +167,12 @@ Instead of just turning on / off / blinking, the LED will then have some advance
If you want to have multiple ring LEDs having the effect synchronously, you can define the number of identical daisy chained rings.
The program will then not treat this chain as one, but as multiple chains.
This does not include some default LEDs used for general lighting of the machine, because they usually don't need controlling.
-It's better to directly connect them to the main source current and turn them on when the machine is turned on.
\ No newline at end of file
+It's better to directly connect them to the main source current and turn them on when the machine is turned on.
+
+### View Logs
+
+You can either go to the logs folder to have the raw logs.
+Or you can go to the option window and select the logs option.
+Then you will get a summarized view of the logs.
+The latest logs are shown on top.
+Identical logs are only shown once, with their latest occurrence time, as well as count.
\ No newline at end of file
From aa0b9138721e6d5fe289d0802c653477b39ed957 Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Tue, 7 Mar 2023 17:46:08 +0100
Subject: [PATCH 25/26] Add logs feature
---
docs/features.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/features.md b/docs/features.md
index f4959381..8e01750f 100644
--- a/docs/features.md
+++ b/docs/features.md
@@ -21,6 +21,7 @@ Usually, updating to the lastest version is always a good idea.
| **v1.13.1** | Clearing the database over the CLI |
| **v1.14.0** | Can invert pin, set simultaneous pump count, generic board |
| **v1.15.0** | Control a LED during cocktail preparation |
+| **v1.16.0** | Summarized logs over the GUI |
!!! abstract "And much More"
This list is by no means a full list of changes.
From 887ad157a4f6b07028fc8869a6a3b61565b0656e Mon Sep 17 00:00:00 2001
From: Andre Wohnsland <50302161+AndreWohnsland@users.noreply.github.com>
Date: Tue, 7 Mar 2023 18:12:34 +0100
Subject: [PATCH 26/26] Limit led cycle time to max 10ms
---
src/machine/leds.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/machine/leds.py b/src/machine/leds.py
index d326f9d8..7401f7c1 100644
--- a/src/machine/leds.py
+++ b/src/machine/leds.py
@@ -129,6 +129,8 @@ def _preparation_thread(self):
"""Fills one by one with same random color, then repeats / overwrites old ones"""
# Make the circle / dot approximate 2 rounds per second
wait_ms = 500 / cfg.LED_COUNT
+ # not faster than 10ms
+ wait_ms = max(10, wait_ms)
self.turn_on(Color(randint(0, 255), randint(0, 255), randint(0, 255)))
while self.is_preparing:
color = Color(