mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-08 20:14:14 +02:00
fix: rendering confirmation options
This commit is contained in:
@@ -1,12 +1,11 @@
|
|||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtWidgets import QRadioButton, QGroupBox, QCheckBox, QComboBox, QGridLayout, QWidget, \
|
||||||
from PyQt5.QtWidgets import QRadioButton, QFormLayout, QGroupBox, QCheckBox, QComboBox, QGridLayout, QWidget, \
|
QLabel, QSizePolicy
|
||||||
QVBoxLayout, QLabel, QSizePolicy
|
from bauh_api.abstract.view import SingleSelectComponent, InputOption, MultipleSelectComponent, SelectViewType
|
||||||
from bauh_api.abstract.view import SingleSelectComponent, SelectOption, MultipleSelectComponent, SelectViewType
|
|
||||||
|
|
||||||
|
|
||||||
class RadioButtonQt(QRadioButton):
|
class RadioButtonQt(QRadioButton):
|
||||||
|
|
||||||
def __init__(self, model: SelectOption, model_parent: SingleSelectComponent):
|
def __init__(self, model: InputOption, model_parent: SingleSelectComponent):
|
||||||
super(RadioButtonQt, self).__init__()
|
super(RadioButtonQt, self).__init__()
|
||||||
self.model = model
|
self.model = model
|
||||||
self.model_parent = model_parent
|
self.model_parent = model_parent
|
||||||
@@ -19,7 +18,7 @@ class RadioButtonQt(QRadioButton):
|
|||||||
|
|
||||||
class CheckboxQt(QCheckBox):
|
class CheckboxQt(QCheckBox):
|
||||||
|
|
||||||
def __init__(self, model: SelectOption, model_parent: MultipleSelectComponent):
|
def __init__(self, model: InputOption, model_parent: MultipleSelectComponent):
|
||||||
super(CheckboxQt, self).__init__()
|
super(CheckboxQt, self).__init__()
|
||||||
self.model = model
|
self.model = model
|
||||||
self.model_parent = model_parent
|
self.model_parent = model_parent
|
||||||
@@ -102,7 +101,7 @@ class ComboSelectQt(QGroupBox):
|
|||||||
class MultipleSelectQt(QGroupBox):
|
class MultipleSelectQt(QGroupBox):
|
||||||
|
|
||||||
def __init__(self, model: MultipleSelectComponent):
|
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.setStyleSheet("QGroupBox { font-weight: bold }")
|
||||||
self.model = model
|
self.model = model
|
||||||
self._layout = QGridLayout()
|
self._layout = QGridLayout()
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class AsyncAction(QThread, ProcessWatcher):
|
|||||||
if msg:
|
if msg:
|
||||||
self.signal_output.emit(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_})
|
self.signal_message.emit({'title': title, 'body': body, 'type': type_})
|
||||||
|
|
||||||
def notify_finished(self, res: object):
|
def notify_finished(self, res: object):
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ class ManageWindow(QWidget):
|
|||||||
return action
|
return action
|
||||||
|
|
||||||
def _ask_confirmation(self, msg: dict):
|
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())
|
self.signal_user_res.emit(diag.is_confirmed())
|
||||||
|
|
||||||
def _show_message(self, msg: dict):
|
def _show_message(self, msg: dict):
|
||||||
|
|||||||
Reference in New Issue
Block a user