diff --git a/main.py b/main.py index bc2ad35..179ca70 100644 --- a/main.py +++ b/main.py @@ -23,6 +23,7 @@ QLocale, QObject, QCoreApplication, + QEvent, ) from dotenv import load_dotenv from os import path @@ -104,8 +105,8 @@ def __init__(self, translator: QTranslator, parent: QObject): ) ) - menubar = self.menuBar() - file_menu = menubar.addMenu("File") + self.menubar = self.menuBar() + file_menu = self.menubar.addMenu("File") # check for updates check_for_updates(False) @@ -133,6 +134,12 @@ def __init__(self, translator: QTranslator, parent: QObject): self.addLanguageOption(languageMenu, "Russian", "ru_RU") self.addLanguageOption(languageMenu, "Chinese (Simplified)", "zh_CN") + # Hide the menu bar by default + self.menubar.setVisible(False) + + # Show the menu bar when the Alt key is pressed + self.installEventFilter(self) + self.ui.pushButton_connectObs.clicked.connect(self.openOBSConnectModal) self.ui.statusbar.showMessage("OBS: Not Connected") @@ -311,6 +318,25 @@ def __init__(self, translator: QTranslator, parent: QObject): self.get_sources.connect(self.getSources) self.get_sources.emit() + def eventFilter(self, obj, event): + if event.type() == QEvent.KeyPress and event.key() == Qt.Key_Alt: + self.menubar.setVisible(True) + elif event.type() == QEvent.FocusOut and self.menubar.isVisible(): + self.menubar.setVisible(False) + elif event.type() == QEvent.WindowDeactivate and self.menubar.isVisible(): + self.menubar.setVisible(False) + return super().eventFilter(obj, event) + + def focusOutEvent(self, event): + if self.menubar.isVisible(): + self.menubar.setVisible(False) + super().focusOutEvent(event) + + def changeEvent(self, event): + if event.type() == QEvent.WindowDeactivate and self.menubar.isVisible(): + self.menubar.setVisible(False) + super().changeEvent(event) + def changeLanguage(self, locale): locale_file = path.abspath( path.join(path.dirname(__file__), "translations", f"scoresight_{locale}.qm") @@ -441,11 +467,17 @@ def toggleStabilize(self): # self.ui.pushButton_starthttpserver.setText("🛑 Stop the server") def toggleStopUpdates(self, value): - self.ui.statusbar.showMessage("Stopped updates" if value else "Resumed updates") + self.ui.statusbar.showMessage( + self.translator.translate("main", "Stopped updates") + if value + else self.translator.translate("main", "Resumed updates") + ) self.updateOCRResults = not value # change the text on the button self.ui.pushButton_stopUpdates.setText( - "▶️ Resume updates" if value else "🛑 Stop updates" + self.translator.translate("main", "Resume updates") + if value + else self.translator.translate("main", "Stop updates") ) def selectOutputFolder(self): diff --git a/mainwindow.ui b/mainwindow.ui index f569519..1952223 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 961 - 858 + 720 @@ -37,7 +37,7 @@ - 12 + 3 @@ -160,7 +160,6 @@ 14 - 75 true @@ -180,7 +179,6 @@ 14 - 75 true @@ -238,18 +236,15 @@ - - Target Information Settings - - - false - + + 2 + 3 - 3 + 0 3 @@ -267,7 +262,7 @@ - 0 + 3 0 @@ -281,6 +276,13 @@ 0 + + + + Target: + + + @@ -945,7 +947,7 @@ - 2 + 3 0 @@ -1119,7 +1121,7 @@ - <html><head/><body><p>HTML Scoreboard: <a href="http://localhost:18099/scoresight"><span style=" text-decoration: underline; color:#0000ff;">http://localhost:18099/scoresight</span></a></p><p>JSON: <a href="http://localhost:18099/json"><span style=" text-decoration: underline; color:#0000ff;">http://localhost:18099/json</span></a> (optional: ?pivot)</p><p>XML: <a href="http://localhost:18099/xml"><span style=" text-decoration: underline; color:#0000ff;">http://localhost:18099/xml</span></a> (optional: ?pivot)</p><p>CSV: <a href="http://localhost:18099/csv"><span style=" text-decoration: underline; color:#0000ff;">http://localhost:18099/csv</span></a></p></body></html> + <html><head/><body><p>HTML Scoreboard: <a href="http://localhost:18099/scoresight"><span style=" text-decoration: underline; color:#0000ff;">http://localhost:18099/scoresight<br/></span></a>JSON: <a href="http://localhost:18099/json"><span style=" text-decoration: underline; color:#0000ff;">http://localhost:18099/json</span></a> (optional: ?pivot)<br/>XML: <a href="http://localhost:18099/xml"><span style=" text-decoration: underline; color:#0000ff;">http://localhost:18099/xml</span></a> (optional: ?pivot)<br/>CSV: <a href="http://localhost:18099/csv"><span style=" text-decoration: underline; color:#0000ff;">http://localhost:18099/csv</span></a></p></body></html> Qt::RichText @@ -1781,7 +1783,7 @@ 0 0 961 - 21 + 20 diff --git a/translations/scoresight_nl_NL.ts b/translations/scoresight_nl_NL.ts index 379c3e2..1fa4751 100644 --- a/translations/scoresight_nl_NL.ts +++ b/translations/scoresight_nl_NL.ts @@ -238,7 +238,7 @@ Select Preset - Preset selecteren + Selecteren voorkeuze @@ -268,7 +268,7 @@ Ordinal (1st, 2nd, ..) - Ordinaal (1e, 2e, ..) + Volgorde (1e, 2e, ..) @@ -293,7 +293,7 @@ Remove leading 0s - Leidende nullen verwijderen + Eerste nul verwijderen @@ -338,7 +338,7 @@ Adaptive - Adaptief + Aanpasbaar @@ -353,7 +353,7 @@ Dilate - Dilateren + Verbreden diff --git a/ui_about.py b/ui_about.py index 48758cd..5c8eac5 100644 --- a/ui_about.py +++ b/ui_about.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'about.ui' ## -## Created by: Qt User Interface Compiler version 6.7.0 +## Created by: Qt User Interface Compiler version 6.7.1 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/ui_connect_obs.py b/ui_connect_obs.py index e2b19c6..ab04702 100644 --- a/ui_connect_obs.py +++ b/ui_connect_obs.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'connect_obs.ui' ## -## Created by: Qt User Interface Compiler version 6.7.0 +## Created by: Qt User Interface Compiler version 6.7.1 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/ui_log_view.py b/ui_log_view.py index ee10f60..eeaa8e1 100644 --- a/ui_log_view.py +++ b/ui_log_view.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'log_view.ui' ## -## Created by: Qt User Interface Compiler version 6.7.0 +## Created by: Qt User Interface Compiler version 6.7.1 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/ui_mainwindow.py b/ui_mainwindow.py index 8950baa..73ff416 100644 --- a/ui_mainwindow.py +++ b/ui_mainwindow.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'mainwindow.ui' ## -## Created by: Qt User Interface Compiler version 6.7.0 +## Created by: Qt User Interface Compiler version 6.7.1 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ @@ -27,7 +27,7 @@ class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") - MainWindow.resize(961, 858) + MainWindow.resize(961, 720) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.horizontalLayout = QHBoxLayout(self.centralwidget) @@ -44,7 +44,7 @@ def setupUi(self, MainWindow): self.frame.setFrameShadow(QFrame.Plain) self.frame.setLineWidth(0) self.verticalLayout = QVBoxLayout(self.frame) - self.verticalLayout.setSpacing(12) + self.verticalLayout.setSpacing(3) self.verticalLayout.setObjectName(u"verticalLayout") self.groupBox_sb_info = QWidget(self.frame) self.groupBox_sb_info.setObjectName(u"groupBox_sb_info") @@ -137,10 +137,10 @@ def setupUi(self, MainWindow): self.groupBox_target_settings = QGroupBox(self.groupBox_sb_info) self.groupBox_target_settings.setObjectName(u"groupBox_target_settings") - self.groupBox_target_settings.setCheckable(False) self.verticalLayout_5 = QVBoxLayout(self.groupBox_target_settings) + self.verticalLayout_5.setSpacing(2) self.verticalLayout_5.setObjectName(u"verticalLayout_5") - self.verticalLayout_5.setContentsMargins(3, 3, 3, 3) + self.verticalLayout_5.setContentsMargins(3, 0, 3, 3) self.widget_10 = QWidget(self.groupBox_target_settings) self.widget_10.setObjectName(u"widget_10") sizePolicy2 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred) @@ -149,9 +149,14 @@ def setupUi(self, MainWindow): sizePolicy2.setHeightForWidth(self.widget_10.sizePolicy().hasHeightForWidth()) self.widget_10.setSizePolicy(sizePolicy2) self.horizontalLayout_12 = QHBoxLayout(self.widget_10) - self.horizontalLayout_12.setSpacing(0) + self.horizontalLayout_12.setSpacing(3) self.horizontalLayout_12.setObjectName(u"horizontalLayout_12") self.horizontalLayout_12.setContentsMargins(0, 0, 0, 0) + self.label_6 = QLabel(self.widget_10) + self.label_6.setObjectName(u"label_6") + + self.horizontalLayout_12.addWidget(self.label_6) + self.label_selectedInfo = QLabel(self.widget_10) self.label_selectedInfo.setObjectName(u"label_selectedInfo") @@ -491,7 +496,7 @@ def setupUi(self, MainWindow): self.tab_textFiles.setSizePolicy(sizePolicy3) self.formLayout_2 = QFormLayout(self.tab_textFiles) self.formLayout_2.setObjectName(u"formLayout_2") - self.formLayout_2.setVerticalSpacing(2) + self.formLayout_2.setVerticalSpacing(0) self.formLayout_2.setContentsMargins(-1, -1, -1, 0) self.label_7 = QLabel(self.tab_textFiles) self.label_7.setObjectName(u"label_7") @@ -917,7 +922,7 @@ def setupUi(self, MainWindow): MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") - self.menubar.setGeometry(QRect(0, 0, 961, 21)) + self.menubar.setGeometry(QRect(0, 0, 961, 20)) MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") @@ -942,7 +947,7 @@ def retranslateUi(self, MainWindow): self.toolButton_removeBox.setText(QCoreApplication.translate("MainWindow", u"-", None)) self.pushButton_makeBox.setText(QCoreApplication.translate("MainWindow", u"Add to Scene ->", None)) self.pushButton_removeBox.setText(QCoreApplication.translate("MainWindow", u"Remove Selected", None)) - self.groupBox_target_settings.setTitle(QCoreApplication.translate("MainWindow", u"Target Information Settings", None)) + self.label_6.setText(QCoreApplication.translate("MainWindow", u"Target:", None)) self.label_selectedInfo.setText(QCoreApplication.translate("MainWindow", u"Select an item above", None)) self.pushButton_restoreDefaults.setText(QCoreApplication.translate("MainWindow", u"Defaults", None)) self.label_2.setText(QCoreApplication.translate("MainWindow", u"Format", None)) @@ -1008,7 +1013,7 @@ def retranslateUi(self, MainWindow): #endif // QT_CONFIG(tooltip) self.label_savePerSec.setText(QCoreApplication.translate("MainWindow", u"Save / s", None)) self.tabWidget_outputs.setTabText(self.tabWidget_outputs.indexOf(self.tab_textFiles), QCoreApplication.translate("MainWindow", u"Text Files", None)) - self.label_8.setText(QCoreApplication.translate("MainWindow", u"

HTML Scoreboard: http://localhost:18099/scoresight

JSON: http://localhost:18099/json (optional: ?pivot)

XML: http://localhost:18099/xml (optional: ?pivot)

CSV: http://localhost:18099/csv

", None)) + self.label_8.setText(QCoreApplication.translate("MainWindow", u"

HTML Scoreboard: http://localhost:18099/scoresight
JSON: http://localhost:18099/json (optional: ?pivot)
XML: http://localhost:18099/xml (optional: ?pivot)
CSV: http://localhost:18099/csv

", None)) self.tabWidget_outputs.setTabText(self.tabWidget_outputs.indexOf(self.tab_browser), QCoreApplication.translate("MainWindow", u"Browser", None)) self.pushButton_connectObs.setText(QCoreApplication.translate("MainWindow", u"Connect OBS", None)) self.lineEdit_sceneName.setText(QCoreApplication.translate("MainWindow", u"ScoreSight Scene", None)) diff --git a/ui_screen_capture.py b/ui_screen_capture.py index d458801..cb3513a 100644 --- a/ui_screen_capture.py +++ b/ui_screen_capture.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'screen_capture.ui' ## -## Created by: Qt User Interface Compiler version 6.7.0 +## Created by: Qt User Interface Compiler version 6.7.1 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/ui_update_available.py b/ui_update_available.py index 3c593a4..caf9763 100644 --- a/ui_update_available.py +++ b/ui_update_available.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'update_available.ui' ## -## Created by: Qt User Interface Compiler version 6.7.0 +## Created by: Qt User Interface Compiler version 6.7.1 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ diff --git a/ui_url_source.py b/ui_url_source.py index 2bfa77e..e3482b2 100644 --- a/ui_url_source.py +++ b/ui_url_source.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'url_source.ui' ## -## Created by: Qt User Interface Compiler version 6.7.0 +## Created by: Qt User Interface Compiler version 6.7.1 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################