aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichoko <michoko@hotmail.com>2022-09-27 23:02:11 +0200
committerAUTOMATIC1111 <16777216c@gmail.com>2022-09-29 12:10:00 +0300
commitf8acbb8f880815facb5037efcd676f2f0d2b5bf4 (patch)
treeb66752ce0b66222e2a842ac2ee079bf567895c2f
parent4127f4aff8aff3d72bdd47224fabf9697633b352 (diff)
Add output folder icons
Adds icons on the first 3 tabs to directly open the corresponding images output directory
-rw-r--r--javascript/hints.js1
-rw-r--r--modules/ui.py26
-rw-r--r--style.css8
3 files changed, 33 insertions, 2 deletions
diff --git a/javascript/hints.js b/javascript/hints.js
index 59dd770c..96cd24d5 100644
--- a/javascript/hints.js
+++ b/javascript/hints.js
@@ -15,6 +15,7 @@ titles = {
"\u267b\ufe0f": "Reuse seed from last generation, mostly useful if it was randomed",
"\u{1f3a8}": "Add a random artist to the prompt.",
"\u2199\ufe0f": "Read generation parameters from prompt into user interface.",
+ "\uD83D\uDCC2": "Open images output directory",
"Inpaint a part of image": "Draw a mask over an image, and the script will regenerate the masked area with content according to prompt",
"SD upscale": "Upscale image normally, split result into tiles, improve each tile using img2img, merge whole image back",
diff --git a/modules/ui.py b/modules/ui.py
index 87024238..4c93fca9 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -61,7 +61,7 @@ random_symbol = '\U0001f3b2\ufe0f' # 🎲️
reuse_symbol = '\u267b\ufe0f' # ♻️
art_symbol = '\U0001f3a8' # 🎨
paste_symbol = '\u2199\ufe0f' # ↙
-
+folder_symbol = '\uD83D\uDCC2'
def plaintext_to_html(text):
text = "<p>" + "<br>\n".join([f"{html.escape(x)}" for x in text.split('\n')]) + "</p>"
@@ -461,6 +461,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
send_to_img2img = gr.Button('Send to img2img')
send_to_inpaint = gr.Button('Send to inpaint')
send_to_extras = gr.Button('Send to extras')
+ open_txt2img_folder = gr.Button(folder_symbol, elem_id="open_folder")
with gr.Group():
html_info = gr.HTML()
@@ -637,6 +638,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
img2img_send_to_img2img = gr.Button('Send to img2img')
img2img_send_to_inpaint = gr.Button('Send to inpaint')
img2img_send_to_extras = gr.Button('Send to extras')
+ open_img2img_folder = gr.Button(folder_symbol, elem_id="open_folder")
with gr.Group():
html_info = gr.HTML()
@@ -809,6 +811,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
html_info = gr.HTML()
extras_send_to_img2img = gr.Button('Send to img2img')
extras_send_to_inpaint = gr.Button('Send to inpaint')
+ open_extras_folder = gr.Button('Open output directory')
submit.click(
fn=run_extras,
@@ -907,6 +910,9 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
components = []
component_dict = {}
+ def open_folder(f):
+ os.startfile(os.path.normpath(f))
+
def run_settings(*args):
changed = 0
@@ -1068,6 +1074,24 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
outputs=[extras_image],
)
+ open_txt2img_folder.click(
+ fn=lambda: open_folder(opts.outdir_samples or opts.outdir_txt2img_samples),
+ inputs=[],
+ outputs=[],
+ )
+
+ open_img2img_folder.click(
+ fn=lambda: open_folder(opts.outdir_samples or opts.outdir_img2img_samples),
+ inputs=[],
+ outputs=[],
+ )
+
+ open_extras_folder.click(
+ fn=lambda: open_folder(opts.outdir_samples or opts.outdir_extras_samples),
+ inputs=[],
+ outputs=[],
+ )
+
img2img_send_to_extras.click(
fn=lambda x: image_from_url_text(x),
_js="extract_image_from_gallery_extras",
diff --git a/style.css b/style.css
index 877f2f7f..a98c46ec 100644
--- a/style.css
+++ b/style.css
@@ -1,5 +1,11 @@
.output-html p {margin: 0 0.5em;}
+.row > *,
+.row > .gr-form > * {
+ min-width: min(120px, 100%);
+ flex: 1 1 0%;
+}
+
.performance {
font-size: 0.85em;
color: #444;
@@ -43,7 +49,7 @@
margin-right: auto;
}
-#random_seed, #random_subseed, #reuse_seed, #reuse_subseed{
+#random_seed, #random_subseed, #reuse_seed, #reuse_subseed, #open_folder{
min-width: auto;
flex-grow: 0;
padding-left: 0.25em;