Skip to content

Commit

Permalink
Fix upscale workspace prompt label expanding the docker width #1302
Browse files Browse the repository at this point in the history
  • Loading branch information
Acly committed Oct 23, 2024
1 parent edf3204 commit 4afacd8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ai_diffusion/ui/settings_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def _toggle(self, value: bool):
class WarningIcon(QLabel):
def __init__(self, parent=None):
super().__init__(parent)
font_height = int(1.2 * self.fontMetrics().height())
warning_icon = icon("warning").pixmap(font_height, font_height)
self.icon_size = int(1.2 * self.fontMetrics().height())
warning_icon = icon("warning").pixmap(self.icon_size, self.icon_size)
self.setPixmap(warning_icon)
self.setVisible(False)

Expand Down
5 changes: 4 additions & 1 deletion ai_diffusion/ui/upscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def __init__(self):
self.use_prompt_value = QLabel(_("Off"), self)
self.prompt_warning = WarningIcon(self)
self.prompt_label = QLabel(self)
self.prompt_label.setMinimumWidth(40)
self.prompt_label.setEnabled(False)
prompt_layout = QHBoxLayout()
prompt_layout.addWidget(QLabel(_("Use Prompt"), self))
Expand Down Expand Up @@ -241,15 +242,17 @@ def _update_prompt(self):
text = self.model.regions.positive
if len(self.model.regions) > 0:
text = f"<b>{len(self.model.regions)} " + _("Regions") + f"</b> | {text}"
padding = 8
if self.model.upscale.use_prompt and len(self.model.regions) == 0:
padding += self.prompt_warning.icon_size
self.prompt_warning.show_message(
_(
"Text prompt regions have not been set up.\nIt is not recommended to use a single text description for tiled upscale,\nunless it can be generally applied to all parts of the image."
)
)
else:
self.prompt_warning.hide()
set_text_clipped(self.prompt_label, text, padding=12)
set_text_clipped(self.prompt_label, text, padding=padding)


def _upscaler_order(filename: str):
Expand Down

0 comments on commit 4afacd8

Please sign in to comment.