Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
edc45959f2 | ||
|
|
1e02bfa05d | ||
|
|
b32defa69c | ||
|
|
fc9c251cc2 | ||
|
|
89d6a9769c | ||
|
|
374eeb1ba6 | ||
|
|
3ddb46c659 | ||
|
|
8d0f713354 |
@@ -1,2 +0,0 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
Binary file not shown.
+17
-5
@@ -1,13 +1,25 @@
|
||||
import importlib
|
||||
import os
|
||||
import subprocess
|
||||
import folder_paths
|
||||
|
||||
|
||||
import os
|
||||
|
||||
default_directory = os.getcwd()
|
||||
node_path = os.path.join(folder_paths.get_folder_paths("custom_nodes")[0], "comfyui-popup_preview")
|
||||
os.chdir(os.path.join(node_path, "window"))
|
||||
if not os.path.exists(r".\venv"):
|
||||
os.system(r".\setup.bat")
|
||||
os.chdir(default_directory)
|
||||
|
||||
|
||||
try:
|
||||
import torchvision.transforms.functional as tf
|
||||
from PIL import ImageFile
|
||||
except ImportError:
|
||||
subprocess.run(["./python_embeded/python.exe", "-m", "pip", "install", "pillow"])
|
||||
subprocess.run(["./python_embeded/python.exe", "-m", "pip", "install", "torch torchvision"])
|
||||
|
||||
|
||||
subprocess.run(["python.exe", "-m", "pip", "install", "pillow"])
|
||||
subprocess.run(["python.exe", "-m", "pip", "install", "torch torchvision"])
|
||||
|
||||
node_list = [
|
||||
"popup"
|
||||
@@ -22,4 +34,4 @@ for module_name in node_list:
|
||||
NODE_CLASS_MAPPINGS = {**NODE_CLASS_MAPPINGS, **imported_module.NODE_CLASS_MAPPINGS}
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {**NODE_DISPLAY_NAME_MAPPINGS, **imported_module.NODE_DISPLAY_NAME_MAPPINGS}
|
||||
|
||||
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
|
||||
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
|
||||
@@ -1,24 +1,27 @@
|
||||
from PIL import ImageFile
|
||||
import psutil
|
||||
import os
|
||||
from PIL import Image
|
||||
import torch
|
||||
import torchvision.transforms.functional as tf
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import tempfile
|
||||
import folder_paths
|
||||
|
||||
import time
|
||||
node_path = os.path.join(folder_paths.get_folder_paths("custom_nodes")[0], "comfyui-popup_preview")
|
||||
popup_window_path = os.path.join(node_path, 'window', 'popup_window.py')
|
||||
python_path = os.path.join(node_path, 'window', 'venv', 'Scripts', 'python.exe')
|
||||
|
||||
last_execution_time = 0
|
||||
|
||||
def execute_after_save():
|
||||
global last_execution_time
|
||||
current_time = time.time()
|
||||
|
||||
# بررسی زمان گذشته از آخرین اجرا
|
||||
if current_time - last_execution_time >= 5:
|
||||
subprocess.Popen("./ComfyUI/custom_nodes/comfyui-popup_preview/window/launcher.exe")
|
||||
last_execution_time = current_time
|
||||
|
||||
ImageFile.LOAD_TRUNCATED_IMAGES = True
|
||||
def openWindow():
|
||||
if os.path.exists( python_path ):
|
||||
python_running = any(p.info['exe'] == python_path for p in psutil.process_iter(['pid', 'name', 'exe']))
|
||||
if os.path.exists( popup_window_path ):
|
||||
if not python_running:
|
||||
import subprocess
|
||||
subprocess.Popen([python_path, popup_window_path])
|
||||
else:
|
||||
print(f'popup window not exist on: {popup_window_path}')
|
||||
else:
|
||||
print(f'Python not exist on: {python_path} and this is popup window path {popup_window_path}')
|
||||
|
||||
def save_image(img: torch.Tensor, subpath):
|
||||
path = subpath
|
||||
@@ -33,7 +36,7 @@ def save_image(img: torch.Tensor, subpath):
|
||||
img = tf.to_pil_image(img)
|
||||
|
||||
img.save(path, format="PNG", compress_level=1)
|
||||
execute_after_save()
|
||||
openWindow()
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.2 KiB |
@@ -1,14 +0,0 @@
|
||||
IfWinNotExist, LIVE Show - by NimaNzri
|
||||
{
|
||||
SetWorkingDir, ComfyUI\custom_nodes\comfyui-popup_preview\window\
|
||||
IfNotExist, venv
|
||||
{
|
||||
Run, setup.bat
|
||||
}
|
||||
Else
|
||||
{
|
||||
Run, venv\Scripts\python.exe popup_window.py
|
||||
}
|
||||
|
||||
}
|
||||
ExitApp
|
||||
Binary file not shown.
@@ -25,7 +25,7 @@ class ImageWindow:
|
||||
self.window.geometry(f"+50+65")
|
||||
|
||||
|
||||
self.window.iconphoto(False, ImageTk.PhotoImage(Image.open("icon.ico")))
|
||||
|
||||
|
||||
|
||||
self.window.bind("<Configure>", self.on_window_configure)
|
||||
@@ -69,10 +69,12 @@ class ImageWindow:
|
||||
self.canvas.pack(fill=tk.BOTH, expand=True)
|
||||
|
||||
def create_buttons(self):
|
||||
borderless_button = tk.Button(self.window, text="◼", command=self.borderless, width=2, height=1)
|
||||
borderless_button = tk.Button(self.window, text="📌", command=self.borderless, width=2, height=1)
|
||||
borderless_button.place(x=0, y=0)
|
||||
|
||||
self.right_click_menu = tk.Menu(self.window, tearoff=0)
|
||||
self.right_click_menu.add_command(label="📌 Always On Top", command=self.borderless)
|
||||
self.right_click_menu.add_separator()
|
||||
self.right_click_menu.add_command(label="📸 Open", command=self.open_image_with_browser)
|
||||
self.right_click_menu.add_command(label="📄 Copy to ClipBoard", command=self.copy_image_to_clipboard)
|
||||
# self.right_click_menu.add_command(label="💾 Save Fast", command=self.contax_save_fast)
|
||||
@@ -174,4 +176,4 @@ class ImageWindow:
|
||||
print(f"Image saved: {file_path}")
|
||||
|
||||
# Create an instance of ImageWindow
|
||||
window = ImageWindow()
|
||||
window = ImageWindow()
|
||||
@@ -1,3 +1,3 @@
|
||||
opencv-python==4.8.1.78
|
||||
pywin32==306
|
||||
opencv-python
|
||||
pywin32
|
||||
pillow
|
||||
|
||||
+1
-2
@@ -15,5 +15,4 @@ call .\venv\Scripts\activate.bat
|
||||
echo Installing requirements...
|
||||
pip install -r requirements.txt
|
||||
|
||||
echo installed successfully, Launching. . .
|
||||
call venv\Scripts\python.exe popup_window.py
|
||||
echo installed successfully
|
||||
Reference in New Issue
Block a user