Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
NoCrypt committed Jul 23, 2023
1 parent f41c43b commit 5ddc151
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions scripts/photopea_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,8 @@
from modules.shared import opts
from modules import extensions

# Handy constants
PHOTOPEA_MAIN_URL = "https://www.photopea.com/"
PHOTOPEA_IFRAME_ID = "webui-photopea-iframe"
PHOTOPEA_IFRAME_HEIGHT = 768
PHOTOPEA_IFRAME_WIDTH = "100%"
PHOTOPEA_IFRAME_LOADED_EVENT = "onPhotopeaLoaded"


def gr_show(visible=True):
return {"visible": visible, "__type__": "update"}

# Adds the "Photopea" tab to the WebUI


def on_ui_tabs():
with gr.Blocks(analytics_enabled=False) as photopea_tab:
# Check if Controlnet is installed and enabled in settings, so we can show or hide the "Send to Controlnet" buttons.
Expand All @@ -32,13 +20,6 @@ def on_ui_tabs():

with gr.Row(elem_id="photopeaIframeContainer") as photopea_iframe:
pass
# # Add an iframe with Photopea directly in the tab.
# gr.HTML(
# f"""<iframe id="{PHOTOPEA_IFRAME_ID}"
# src = "{PHOTOPEA_MAIN_URL}{get_photopea_url_params()}"
# width = "{PHOTOPEA_IFRAME_WIDTH}"
# height = "{PHOTOPEA_IFRAME_HEIGHT}"
# onload = "{PHOTOPEA_IFRAME_LOADED_EVENT}(this)">""")

with gr.Row():
gr.Checkbox(
Expand Down Expand Up @@ -133,10 +114,5 @@ def on_ui_tabs():
return [(photopea_tab, "Photopea", "photopea_embed")]


# Initialize Photopea with an empty, 512x512 white image. It's baked as a base64 string with URI encoding.
def get_photopea_url_params():
return "#%7B%22resources%22:%5B%22data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIAAQMAAADOtka5AAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRF////p8QbyAAAADZJREFUeJztwQEBAAAAgiD/r25IQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfBuCAAAB0niJ8AAAAABJRU5ErkJggg==%22%5D%7D"


# Actually hooks up the tab to the WebUI tabs.
script_callbacks.on_ui_tabs(on_ui_tabs)

0 comments on commit 5ddc151

Please sign in to comment.