8 Commits
Author SHA1 Message Date
NimaNzrii edc45959f2 added debugging logs 2024-01-07 15:51:19 +03:30
NimaNzrii 1e02bfa05d Big Fix 2024-01-06 00:12:42 +03:30
NimaNzrii b32defa69c fixed installation bugs 2024-01-01 23:15:52 +03:30
NimaNzrii fc9c251cc2 fixed installation bug 2024-01-01 23:14:50 +03:30
NimaNzrii 89d6a9769c Installing Proccess Fixed on non portable version of comfyui 2023-12-31 03:10:02 +03:30
NimaNzrii 374eeb1ba6 bug fixed, installing proccess improved 2023-12-23 22:09:45 +03:30
NimaNzrii 3ddb46c659 Ux improvments 2023-12-17 14:05:07 +03:30
NimaNzrii 8d0f713354 installing bug fixed 2023-12-17 11:42:38 +03:30
11 changed files with 44 additions and 46 deletions
-2
View File
@@ -1,2 +0,0 @@
# Auto detect text files and perform LF normalization
* text=auto
-2
View File
@@ -1,2 +0,0 @@
# comfyui-popup_preview
popup preview for comfyui
BIN
View File
Binary file not shown.
+17 -5
View File
@@ -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']
+19 -16
View File
@@ -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()
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

-14
View File
@@ -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.
+5 -3
View File
@@ -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()
+2 -2
View File
@@ -1,3 +1,3 @@
opencv-python==4.8.1.78
pywin32==306
opencv-python
pywin32
pillow
+1 -2
View File
@@ -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