supporting custom confirmation / deny button label

This commit is contained in:
Vinicius Moreira
2019-08-26 14:32:33 -03:00
parent 0f33597168
commit 69b1837c83
6 changed files with 17 additions and 9 deletions

View File

@@ -8,12 +8,12 @@ from bauh.view.qt.components import MultipleSelectQt, new_single_select
class ConfirmationDialog(QMessageBox):
def __init__(self, title: str, body: str, locale_keys: dict, components: List[ViewComponent] = None):
def __init__(self, title: str, body: str, locale_keys: dict, components: List[ViewComponent] = None, confirmation_label: str = None, deny_label: str = None):
super(ConfirmationDialog, self).__init__()
self.setWindowTitle(title)
self.setStyleSheet('QLabel { margin-right: 25px; }')
self.bt_yes = self.addButton(locale_keys['popup.button.yes'], QMessageBox.YesRole)
self.addButton(locale_keys['popup.button.no'], QMessageBox.NoRole)
self.bt_yes = self.addButton(locale_keys['popup.button.yes'] if not confirmation_label else confirmation_label.capitalize(), QMessageBox.YesRole)
self.addButton(locale_keys['popup.button.no'] if not deny_label else deny_label.capitalize(), QMessageBox.NoRole)
if body:
if components: