From 4faa334bf601dbbb11b0cfc39431dc89af9289f9 Mon Sep 17 00:00:00 2001 From: ManInDark <61268856+ManInDark@users.noreply.github.com> Date: Thu, 10 Aug 2023 23:27:35 +0200 Subject: [PATCH] Styled up the opened tab --- ui/easydiffusion/bucket_manager.py | 2 +- ui/easydiffusion/easydb/mappings.py | 38 ++++++++++++++--------------- ui/media/css/single-gallery.css | 33 +++++++++++++++++++++++-- ui/media/js/main.js | 8 ++++-- 4 files changed, 57 insertions(+), 24 deletions(-) diff --git a/ui/easydiffusion/bucket_manager.py b/ui/easydiffusion/bucket_manager.py index e17a1c2a..34b8bd2f 100644 --- a/ui/easydiffusion/bucket_manager.py +++ b/ui/easydiffusion/bucket_manager.py @@ -116,7 +116,7 @@ def init(): try: image: GalleryImage = db.query(GalleryImage).filter(GalleryImage.path == image_path).first() head = "" - body = "
" + image.htmlForm() + "" + body = "
" + image.htmlForm() + "" return Response(content="" + head + body + "", media_type="text/html") except Exception as e: print(e) diff --git a/ui/easydiffusion/easydb/mappings.py b/ui/easydiffusion/easydb/mappings.py index 653539ad..a01b50de 100644 --- a/ui/easydiffusion/easydb/mappings.py +++ b/ui/easydiffusion/easydb/mappings.py @@ -25,31 +25,31 @@ class GalleryImage(Base): prompt = Column(String) negative_prompt = Column(String) time_created = Column(DateTime(timezone=True), server_default=func.now()) - nsfw = Column(String, server_default='unknown') + nsfw = Column(Boolean, server_default=None) def __repr__(self): return "" % ( self.path, self.seed, self.use_stable_diffusion_model, self.clip_skip, self.use_vae_model, self.sampler_name, self.width, self.height, self.num_inference_steps, self.guidance_scale, self.lora, self.use_hypernetwork_model, self.tiling, self.use_face_correction, self.use_upscale, self.prompt, self.negative_prompt) def htmlForm(self) -> str: - return "

Path: " + str(self.path) + "

" + \ - "Seed: " + str(self.seed) + "

" + \ - "Stable Diffusion Model: " + str(self.use_stable_diffusion_model) + "

" + \ - "Prompt: " + str(self.prompt) + "

" + \ - "Negative Prompt: " + str(self.negative_prompt) + "

" + \ - "Clip Skip: " + str(self.clip_skip) + "

" + \ - "VAE Model: " + str(self.use_vae_model) + "

" + \ - "Sampler: " + str(self.sampler_name) + "

" + \ - "Size: " + str(self.height) + "x" + str(self.width) + "

" + \ - "Inference Steps: " + str(self.num_inference_steps) + "

" + \ - "Guidance Scale: " + str(self.guidance_scale) + "

" + \ - "LoRA: " + str(self.lora) + "

" + \ - "Hypernetwork: " + str(self.use_hypernetwork_model) + "

" + \ - "Tiling: " + str(self.tiling) + "

" + \ - "Face Correction: " + str(self.use_face_correction) + "

" + \ - "Upscale: " + str(self.use_upscale) + "

" + \ - "Time Created: " + str(self.time_created) + "

" + \ - "NSFW: " + str(self.nsfw) + "

" + return "

Path: " + str(self.path) + "

" + \ + "

Seed: " + str(self.seed) + "

" + \ + "

Stable Diffusion Model: " + str(self.use_stable_diffusion_model) + "

" + \ + "

Prompt: " + str(self.prompt) + "

" + \ + "

Negative Prompt: " + str(self.negative_prompt) + "

" + \ + "

Clip Skip: " + str(self.clip_skip) + "

" + \ + "

VAE Model: " + str(self.use_vae_model) + "

" + \ + "

Sampler: " + str(self.sampler_name) + "

" + \ + "

Size: " + str(self.height) + "x" + str(self.width) + "

" + \ + "

Inference Steps: " + str(self.num_inference_steps) + "

" + \ + "

Guidance Scale: " + str(self.guidance_scale) + "

" + \ + "

LoRA: " + str(self.lora) + "

" + \ + "

Hypernetwork: " + str(self.use_hypernetwork_model) + "

" + \ + "

Tiling: " + str(self.tiling) + "

" + \ + "

Face Correction: " + str(self.use_face_correction) + "

" + \ + "

Upscale: " + str(self.use_upscale) + "

" + \ + "

Time Created: " + str(self.time_created) + "

" + \ + "

NSFW: " + str(self.nsfw) + "

" from easydiffusion.easydb.database import engine diff --git a/ui/media/css/single-gallery.css b/ui/media/css/single-gallery.css index dbaedfa1..24f22e47 100644 --- a/ui/media/css/single-gallery.css +++ b/ui/media/css/single-gallery.css @@ -1,9 +1,38 @@ +@import url("/media/css/themes.css"); +@import url("/media/css/main.css"); + body { display: flex; flex-direction: column; align-items: center; + background-color: var(--background-color1); } -p { - margin: 0px; +img { + border-radius: 5px; +} + +p, h1, h2, h3, h4, h5, h6 { + color: var(--text-color); + cursor: default; + margin: 6px; +} + +::-moz-selection { + /* Code for Firefox */ + color: none; + background: none; +} + +::selection { + color: none; + background: none; +} + +button { + margin: 8px; +} + +div { + margin: 16px; } \ No newline at end of file diff --git a/ui/media/js/main.js b/ui/media/js/main.js index 72cd72e8..11011a20 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -3092,8 +3092,12 @@ function galleryImage(item) { let w; w = window.open("/single_image?image_path=" + item.path, "_blank") w.addEventListener("DOMContentLoaded", () => { - w.document.getElementById("button").addEventListener("click", () => { - document.title = "hi" + w.document.getElementsByTagName("body")[0].classList.add(themeField.value) + w.document.getElementById("use_these_settings").addEventListener("click", () => { + alert("use these settings") + }) + w.document.getElementById("use_as_input").addEventListener("click", () => { + alert("use as input") }) }) })