Über Menü "Einstellungen ..." wird der AppSettings-Dialog eröffnet

This commit is contained in:
2025-06-14 12:30:39 +02:00
parent e7923280d7
commit 9046dc9174
3 changed files with 306 additions and 267 deletions
+13
View File
@@ -320,6 +320,8 @@
<addaction name="actionNeu"/> <addaction name="actionNeu"/>
<addaction name="action_ffnen"/> <addaction name="action_ffnen"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionEinstellungen"/>
<addaction name="separator"/>
<addaction name="actionBeenden"/> <addaction name="actionBeenden"/>
</widget> </widget>
<widget class="QMenu" name="menuThema"> <widget class="QMenu" name="menuThema">
@@ -361,6 +363,17 @@
<string>Beenden</string> <string>Beenden</string>
</property> </property>
</action> </action>
<action name="actionEinstellungen">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::DocumentProperties"/>
</property>
<property name="text">
<string>Einstellungen ...</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action>
</widget> </widget>
<resources/> <resources/>
<connections> <connections>
+14 -4
View File
@@ -39,6 +39,10 @@ class Ui_MainWindow(object):
self.actionBeenden.setObjectName(u"actionBeenden") self.actionBeenden.setObjectName(u"actionBeenden")
icon2 = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.ApplicationExit)) icon2 = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.ApplicationExit))
self.actionBeenden.setIcon(icon2) self.actionBeenden.setIcon(icon2)
self.actionEinstellungen = QAction(MainWindow)
self.actionEinstellungen.setObjectName(u"actionEinstellungen")
icon3 = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.DocumentProperties))
self.actionEinstellungen.setIcon(icon3)
self.centralwidget = QWidget(MainWindow) self.centralwidget = QWidget(MainWindow)
self.centralwidget.setObjectName(u"centralwidget") self.centralwidget.setObjectName(u"centralwidget")
self.horizontalLayout = QHBoxLayout(self.centralwidget) self.horizontalLayout = QHBoxLayout(self.centralwidget)
@@ -77,16 +81,16 @@ class Ui_MainWindow(object):
self.pushButton = QPushButton(self.frame_2) self.pushButton = QPushButton(self.frame_2)
self.pushButton.setObjectName(u"pushButton") self.pushButton.setObjectName(u"pushButton")
self.pushButton.setLayoutDirection(Qt.LayoutDirection.LeftToRight) self.pushButton.setLayoutDirection(Qt.LayoutDirection.LeftToRight)
icon3 = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.MediaPlaybackStart)) icon4 = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.MediaPlaybackStart))
self.pushButton.setIcon(icon3) self.pushButton.setIcon(icon4)
self.horizontalLayout_2.addWidget(self.pushButton) self.horizontalLayout_2.addWidget(self.pushButton)
self.pushButton_2 = QPushButton(self.frame_2) self.pushButton_2 = QPushButton(self.frame_2)
self.pushButton_2.setObjectName(u"pushButton_2") self.pushButton_2.setObjectName(u"pushButton_2")
self.pushButton_2.setAutoFillBackground(False) self.pushButton_2.setAutoFillBackground(False)
icon4 = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.MediaSeekForward)) icon5 = QIcon(QIcon.fromTheme(QIcon.ThemeIcon.MediaSeekForward))
self.pushButton_2.setIcon(icon4) self.pushButton_2.setIcon(icon5)
self.horizontalLayout_2.addWidget(self.pushButton_2) self.horizontalLayout_2.addWidget(self.pushButton_2)
@@ -233,6 +237,8 @@ class Ui_MainWindow(object):
self.menuProjekt.addAction(self.actionNeu) self.menuProjekt.addAction(self.actionNeu)
self.menuProjekt.addAction(self.action_ffnen) self.menuProjekt.addAction(self.action_ffnen)
self.menuProjekt.addSeparator() self.menuProjekt.addSeparator()
self.menuProjekt.addAction(self.actionEinstellungen)
self.menuProjekt.addSeparator()
self.menuProjekt.addAction(self.actionBeenden) self.menuProjekt.addAction(self.actionBeenden)
self.retranslateUi(MainWindow) self.retranslateUi(MainWindow)
@@ -252,6 +258,10 @@ class Ui_MainWindow(object):
self.action_ffnen.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+O", None)) self.action_ffnen.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+O", None))
#endif // QT_CONFIG(shortcut) #endif // QT_CONFIG(shortcut)
self.actionBeenden.setText(QCoreApplication.translate("MainWindow", u"Beenden", None)) self.actionBeenden.setText(QCoreApplication.translate("MainWindow", u"Beenden", None))
self.actionEinstellungen.setText(QCoreApplication.translate("MainWindow", u"Einstellungen ...", None))
#if QT_CONFIG(shortcut)
self.actionEinstellungen.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+S", None))
#endif // QT_CONFIG(shortcut)
self.pushButton.setText(QCoreApplication.translate("MainWindow", u"nur ge\u00e4nderte generieren", None)) self.pushButton.setText(QCoreApplication.translate("MainWindow", u"nur ge\u00e4nderte generieren", None))
self.pushButton_2.setText(QCoreApplication.translate("MainWindow", u"Alle generieren", None)) self.pushButton_2.setText(QCoreApplication.translate("MainWindow", u"Alle generieren", None))
self.label.setText("") self.label.setText("")
+16
View File
@@ -9,6 +9,8 @@ from PySide6.QtPdf import QPdfDocument
from PySide6.QtPdfWidgets import QPdfView from PySide6.QtPdfWidgets import QPdfView
from ui.MainWinddow_ui import Ui_MainWindow from ui.MainWinddow_ui import Ui_MainWindow
from ui.AppSettings import AppSettingsDlg
from conf import app_settings
class MainWindow(QMainWindow): class MainWindow(QMainWindow):
@@ -439,6 +441,9 @@ class MainWindow(QMainWindow):
self.ui.alpha.valueChanged.connect(self.on_alpha_changed) self.ui.alpha.valueChanged.connect(self.on_alpha_changed)
self.ui.alpha.mouseDoubleClickEvent = lambda event: self.ui.alpha.setValue(0) self.ui.alpha.mouseDoubleClickEvent = lambda event: self.ui.alpha.setValue(0)
# Menü-Aktionen verbinden
self.ui.actionEinstellungen.triggered.connect(self.open_settings_dialog)
def on_alpha_changed(self, alpha_value): def on_alpha_changed(self, alpha_value):
""" """
Wird ausgeführt, wenn der Alpha-Slider geändert wird. Wird ausgeführt, wenn der Alpha-Slider geändert wird.
@@ -455,6 +460,17 @@ class MainWindow(QMainWindow):
alpha_time = time.time() - start_time alpha_time = time.time() - start_time
print(f"Alpha-Update in {alpha_time:.6f}s") print(f"Alpha-Update in {alpha_time:.6f}s")
def open_settings_dialog(self):
"""Öffnet den Einstellungen-Dialog."""
try:
# Erstelle und zeige den Dialog
dialog = AppSettingsDlg(self, app_settings)
if dialog.exec() == AppSettingsDlg.DialogCode.Accepted:
# Einstellungen wurden gespeichert, hier könnten weitere Aktionen folgen
print("Einstellungen wurden gespeichert")
except Exception as e:
print(f"Fehler beim Öffnen des Einstellungen-Dialogs: {e}")
def on_button_clicked(self): def on_button_clicked(self):
"""Wird ausgeführt, wenn der Button geklickt wird.""" """Wird ausgeführt, wenn der Button geklickt wird."""
print("Button wurde geklickt!") print("Button wurde geklickt!")