diff --git a/bauh/api/abstract/handler.py b/bauh/api/abstract/handler.py index ef766d42..393ede9c 100644 --- a/bauh/api/abstract/handler.py +++ b/bauh/api/abstract/handler.py @@ -21,7 +21,8 @@ class ProcessWatcher: confirmation_label: str = None, deny_label: str = None, deny_button: bool = True, window_cancel: bool = False, confirmation_button: bool = True, min_width: Optional[int] = None, - min_height: Optional[int] = None) -> bool: + min_height: Optional[int] = None, + max_width: Optional[int] = None) -> bool: """ request a user confirmation. In the current GUI implementation, it shows a popup to the user. :param title: popup title @@ -34,6 +35,7 @@ class ProcessWatcher: :param confirmation_button: if the confirmation button should be displayed :param min_width: minimum width for the confirmation dialog :param min_height: minimum height for the confirmation dialog + :param max_width: maximum width for the confirmation dialog :return: if the request was confirmed by the user """ pass diff --git a/bauh/view/qt/dialog.py b/bauh/view/qt/dialog.py index ae867a0f..13ffc0f5 100644 --- a/bauh/view/qt/dialog.py +++ b/bauh/view/qt/dialog.py @@ -35,7 +35,7 @@ class ConfirmationDialog(QDialog): widgets: Optional[List[QWidget]] = None, confirmation_button: bool = True, deny_button: bool = True, window_cancel: bool = False, confirmation_label: Optional[str] = None, deny_label: Optional[str] = None, confirmation_icon: bool = True, min_width: Optional[int] = None, - min_height: Optional[int] = None): + min_height: Optional[int] = None, max_width: Optional[int] = None): super(ConfirmationDialog, self).__init__() if not window_cancel: @@ -46,6 +46,9 @@ class ConfirmationDialog(QDialog): self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) self.setMinimumWidth(min_width if min_width and min_width > 0 else 250) + if max_width is not None and max_width > 0: + self.setMaximumWidth(max_width) + if isinstance(min_height, int) and min_height > 0: self.setMinimumHeight(min_height) diff --git a/bauh/view/qt/thread.py b/bauh/view/qt/thread.py index 42a65d8b..adece32f 100644 --- a/bauh/view/qt/thread.py +++ b/bauh/view/qt/thread.py @@ -60,13 +60,14 @@ class AsyncAction(QThread, ProcessWatcher): window_cancel: bool = False, confirmation_button: bool = True, min_width: Optional[int] = None, - min_height: Optional[int] = None) -> bool: + min_height: Optional[int] = None, + max_width: Optional[int] = None) -> bool: self.wait_confirmation = True self.signal_confirmation.emit({'title': title, 'body': body, 'components': components, 'confirmation_label': confirmation_label, 'deny_label': deny_label, 'deny_button': deny_button, 'window_cancel': window_cancel, 'confirmation_button': confirmation_button, 'min_width': min_width, - 'min_height': min_height}) + 'min_height': min_height, 'max_width': max_width}) self.wait_user() return self.confirmation_res diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index 23d6cbc3..1b3273e3 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -559,7 +559,8 @@ class ManageWindow(QWidget): window_cancel=msg['window_cancel'], confirmation_button=msg.get('confirmation_button', True), min_width=msg.get('min_width'), - min_height=msg.get('min_height')) + min_height=msg.get('min_height'), + max_width=msg.get('max_width')) diag.ask() res = diag.confirmed self.thread_animate_progress.animate()