Move tabs

Nw emoji for `round`
This commit is contained in:
LEv145
2023-07-04 11:24:49 +02:00
parent ed155fc877
commit 15ac0bd30e

View File

@@ -14,7 +14,7 @@ SWITCH_VALUES_SYMBOL = "\U000021C5" # ⇅
DIMENSIONS_SYMBOL = "\u2B07\ufe0f" # ⬇️
IMAGE_DIMENSIONS_SYMBOL = "\U0001F5BC" # 🖼
REVERSE_LOGIC_SYMBOL = "\U0001F503" # 🔃
ROUND_SYMBOL = "\U0001F522" # 🔢
ROUND_SYMBOL = "\U0001F50D" # 🔍
IMAGE_ROUNDING_MULTIPLIER = 4
is_reverse_logic_mode = False # Fixme: Global value
@@ -360,12 +360,8 @@ class AspectRatioScript(scripts.Script):
arc_desired_height,
],
)
arc_round = ToolButton(value=ROUND_SYMBOL)
with contextlib.suppress(AttributeError):
# For img2img tab
if is_img2img:
# Get slider dimensions button
resolution = [self.i2i_w, self.i2i_h]
arc_get_img2img_dim = ToolButton(
value=DIMENSIONS_SYMBOL
@@ -375,7 +371,21 @@ class AspectRatioScript(scripts.Script):
inputs=resolution,
outputs=[arc_width1, arc_height1],
)
else:
resolution = [self.t2i_w, self.t2i_h]
arc_get_txt2img_dim = ToolButton(
value=DIMENSIONS_SYMBOL
)
arc_get_txt2img_dim.click(
lambda w, h: (w, h),
inputs=resolution,
outputs=[arc_width1, arc_height1],
)
arc_round = ToolButton(value=ROUND_SYMBOL)
if is_img2img:
with contextlib.suppress(AttributeError):
# Javascript function to select image element from current img2img tab
current_tab_image = """
function current_tab_image(...args) {
@@ -421,19 +431,6 @@ class AspectRatioScript(scripts.Script):
_js=current_tab_image,
)
else:
# For txt2img tab
# Get slider dimensions button
resolution = [self.t2i_w, self.t2i_h]
arc_get_txt2img_dim = ToolButton(
value=DIMENSIONS_SYMBOL
)
arc_get_txt2img_dim.click(
lambda w, h: (w, h),
inputs=resolution,
outputs=[arc_width1, arc_height1],
)
# Update aspect ratio display on change
arc_width1.change(
lambda w, h: (f"Aspect Ratio: **{get_reduced_ratio(w,h)}**"),