feat(dialogs): change buttons accept/reject to AutoSizeButton
Some checks failed
Code and build check / Check code (pull_request) Failing after 1m38s
Code and build check / Build with uv (pull_request) Successful in 56s

This commit is contained in:
2025-06-28 11:53:11 +07:00
committed by Boris Yumankulov
parent 797e203156
commit 1c1110a6e7

View File

@ -359,6 +359,7 @@ class AddGameDialog(QDialog):
def __init__(self, parent=None, theme=None, edit_mode=False, game_name=None, exe_path=None, cover_path=None): def __init__(self, parent=None, theme=None, edit_mode=False, game_name=None, exe_path=None, cover_path=None):
super().__init__(parent) super().__init__(parent)
self.theme = theme if theme else default_styles self.theme = theme if theme else default_styles
self.theme_manager = ThemeManager()
self.edit_mode = edit_mode self.edit_mode = edit_mode
self.original_name = game_name self.original_name = game_name
@ -418,13 +419,18 @@ class AddGameDialog(QDialog):
layout.addRow(preview_label, self.coverPreview) layout.addRow(preview_label, self.coverPreview)
# Dialog buttons # Dialog buttons
buttonBox = QDialogButtonBox( self.button_layout = QHBoxLayout()
QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel self.button_layout.setSpacing(10)
) self.select_button = AutoSizeButton(_("Select"), icon=self.theme_manager.get_icon("apply"))
buttonBox.setStyleSheet(self.theme.ACTION_BUTTON_STYLE) self.cancel_button = AutoSizeButton(_("Cancel"), icon=self.theme_manager.get_icon("cancel"))
buttonBox.accepted.connect(self.accept) self.select_button.setStyleSheet(self.theme.ACTION_BUTTON_STYLE)
buttonBox.rejected.connect(self.reject) self.cancel_button.setStyleSheet(self.theme.ACTION_BUTTON_STYLE)
layout.addRow(buttonBox) self.button_layout.addWidget(self.select_button)
self.button_layout.addWidget(self.cancel_button)
layout.addRow(self.button_layout)
self.select_button.clicked.connect(self.accept)
self.cancel_button.clicked.connect(self.reject)
self.coverEdit.textChanged.connect(self.updatePreview) self.coverEdit.textChanged.connect(self.updatePreview)
self.exeEdit.textChanged.connect(self.updatePreview) self.exeEdit.textChanged.connect(self.updatePreview)