diff --git a/bauh/api/abstract/view.py b/bauh/api/abstract/view.py index b442c4e1..0918e5e8 100644 --- a/bauh/api/abstract/view.py +++ b/bauh/api/abstract/view.py @@ -157,7 +157,7 @@ class TextInputComponent(ViewComponent): def __init__(self, label: str, value: str = '', placeholder: str = None, tooltip: str = None, read_only: bool =False, id_: str = None, only_int: bool = False, max_width: int = -1, type_: TextInputType = TextInputType.SINGLE_LINE, - capitalize_label: bool = True): + capitalize_label: bool = True, min_width: int = -1, min_height: int = -1): super(TextInputComponent, self).__init__(id_=id_) self.label = label self.value = value @@ -168,6 +168,8 @@ class TextInputComponent(ViewComponent): self.max_width = max_width self.type = type_ self.capitalize_label = capitalize_label + self.min_width = min_width + self.min_height = min_height def get_value(self) -> str: if self.value is not None: diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index 4beb5a93..4de5646b 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -1596,7 +1596,8 @@ class ArchManager(SoftwareManager): with open(pkgbuild_path) as f: pkgbuild = f.read() - pkgbuild_input = TextInputComponent(label='', value=pkgbuild, type_=TextInputType.MULTIPLE_LINES) + pkgbuild_input = TextInputComponent(label='', value=pkgbuild, type_=TextInputType.MULTIPLE_LINES, + min_width=500, min_height=350) watcher.request_confirmation(title='PKGBUILD ({})'.format(pkgname), body='', diff --git a/bauh/view/qt/components.py b/bauh/view/qt/components.py index d6f7bdd7..40b01f9a 100644 --- a/bauh/view/qt/components.py +++ b/bauh/view/qt/components.py @@ -475,6 +475,12 @@ class TextInputQt(QGroupBox): if model.placeholder: self.text_input.setPlaceholderText(model.placeholder) + if model.min_width >= 0: + self.text_input.setMinimumWidth(model.min_width) + + if model.min_height >= 0: + self.text_input.setMinimumHeight(model.min_height) + if model.tooltip: self.text_input.setToolTip(model.tooltip) @@ -799,6 +805,12 @@ class FormQt(QGroupBox): def _new_text_input(self, c: TextInputComponent) -> Tuple[QLabel, QLineEdit]: view = QLineEditObserver() if c.type == TextInputType.SINGLE_LINE else QPlainTextEditObserver() + if c.min_width >= 0: + view.setMinimumWidth(c.min_width) + + if c.min_height >= 0: + view.setMinimumHeight(c.min_height) + if c.only_int: view.setValidator(QIntValidator())