mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 02:24:16 +02:00
[fix][ui] confirmation button is not set as default for all desktop environments
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from PyQt5.QtCore import QSize, Qt
|
from PyQt5.QtCore import QSize
|
||||||
from PyQt5.QtWidgets import QMessageBox, QVBoxLayout, QLabel, QWidget, QScrollArea, QFrame, QSizePolicy
|
from PyQt5.QtWidgets import QMessageBox, QVBoxLayout, QLabel, QWidget, QScrollArea, QFrame
|
||||||
|
|
||||||
from bauh.api.abstract.view import ViewComponent, SingleSelectComponent, MultipleSelectComponent, TextInputComponent, \
|
from bauh.api.abstract.view import ViewComponent, SingleSelectComponent, MultipleSelectComponent, TextInputComponent, \
|
||||||
FormComponent
|
FormComponent
|
||||||
from bauh.view.qt import css
|
from bauh.view.qt import css
|
||||||
from bauh.view.qt.components import MultipleSelectQt, new_single_select, TextInputQt, FormQt, new_spacer
|
from bauh.view.qt.components import MultipleSelectQt, new_single_select, TextInputQt, FormQt
|
||||||
from bauh.view.util.translation import I18n
|
from bauh.view.util.translation import I18n
|
||||||
|
|
||||||
|
|
||||||
@@ -19,6 +19,7 @@ class ConfirmationDialog(QMessageBox):
|
|||||||
self.setStyleSheet('QLabel { margin-right: 25px; }')
|
self.setStyleSheet('QLabel { margin-right: 25px; }')
|
||||||
self.bt_yes = self.addButton(i18n['popup.button.yes'] if not confirmation_label else confirmation_label.capitalize(), QMessageBox.YesRole)
|
self.bt_yes = self.addButton(i18n['popup.button.yes'] if not confirmation_label else confirmation_label.capitalize(), QMessageBox.YesRole)
|
||||||
self.bt_yes.setStyleSheet(css.OK_BUTTON)
|
self.bt_yes.setStyleSheet(css.OK_BUTTON)
|
||||||
|
self.setDefaultButton(self.bt_yes)
|
||||||
|
|
||||||
self.addButton(i18n['popup.button.no'] if not deny_label else deny_label.capitalize(), QMessageBox.NoRole)
|
self.addButton(i18n['popup.button.no'] if not deny_label else deny_label.capitalize(), QMessageBox.NoRole)
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ def ask_confirmation(title: str, body: str, i18n: I18n, icon: QIcon = QIcon(reso
|
|||||||
|
|
||||||
bt_yes = diag.addButton(i18n['popup.button.yes'], QMessageBox.YesRole)
|
bt_yes = diag.addButton(i18n['popup.button.yes'], QMessageBox.YesRole)
|
||||||
bt_yes.setStyleSheet(css.OK_BUTTON)
|
bt_yes.setStyleSheet(css.OK_BUTTON)
|
||||||
|
diag.setDefaultButton(bt_yes)
|
||||||
|
|
||||||
diag.addButton(i18n['popup.button.no'], QMessageBox.NoRole)
|
diag.addButton(i18n['popup.button.no'], QMessageBox.NoRole)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user