fix: rendering confirmation options

This commit is contained in:
Vinicius Moreira
2019-08-25 20:26:34 -03:00
parent 76e78a821e
commit 0f33597168
3 changed files with 8 additions and 9 deletions

View File

@@ -1,12 +1,11 @@
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QRadioButton, QFormLayout, QGroupBox, QCheckBox, QComboBox, QGridLayout, QWidget, \
QVBoxLayout, QLabel, QSizePolicy
from bauh_api.abstract.view import SingleSelectComponent, SelectOption, MultipleSelectComponent, SelectViewType
from PyQt5.QtWidgets import QRadioButton, QGroupBox, QCheckBox, QComboBox, QGridLayout, QWidget, \
QLabel, QSizePolicy
from bauh_api.abstract.view import SingleSelectComponent, InputOption, MultipleSelectComponent, SelectViewType
class RadioButtonQt(QRadioButton):
def __init__(self, model: SelectOption, model_parent: SingleSelectComponent):
def __init__(self, model: InputOption, model_parent: SingleSelectComponent):
super(RadioButtonQt, self).__init__()
self.model = model
self.model_parent = model_parent
@@ -19,7 +18,7 @@ class RadioButtonQt(QRadioButton):
class CheckboxQt(QCheckBox):
def __init__(self, model: SelectOption, model_parent: MultipleSelectComponent):
def __init__(self, model: InputOption, model_parent: MultipleSelectComponent):
super(CheckboxQt, self).__init__()
self.model = model
self.model_parent = model_parent
@@ -102,7 +101,7 @@ class ComboSelectQt(QGroupBox):
class MultipleSelectQt(QGroupBox):
def __init__(self, model: MultipleSelectComponent):
super(MultipleSelectQt, self).__init__(model.label + ' :')
super(MultipleSelectQt, self).__init__(model.label + ' :' if model.label else None)
self.setStyleSheet("QGroupBox { font-weight: bold }")
self.model = model
self._layout = QGridLayout()

View File

@@ -46,7 +46,7 @@ class AsyncAction(QThread, ProcessWatcher):
if msg:
self.signal_output.emit(msg)
def show_message(self, title: str, body: str, type_: MessageType):
def show_message(self, title: str, body: str, type_: MessageType = MessageType.INFO):
self.signal_message.emit({'title': title, 'body': body, 'type': type_})
def notify_finished(self, res: object):

View File

@@ -223,7 +223,7 @@ class ManageWindow(QWidget):
return action
def _ask_confirmation(self, msg: dict):
diag = ConfirmationDialog(msg['title'], msg['body'], self.locale_keys)
diag = ConfirmationDialog(title=msg['title'], body=msg['body'], locale_keys=self.locale_keys, components=msg['options'])
self.signal_user_res.emit(diag.is_confirmed())
def _show_message(self, msg: dict):