Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acad7c4273 | ||
|
|
25889e53e3 | ||
|
|
852db490ef | ||
|
|
e258287ad7 | ||
|
|
38c9209a98 | ||
|
|
f17d5131ab | ||
|
|
47b55961f2 | ||
|
|
ed9a2868ff | ||
|
|
70c9b30ebf | ||
|
|
8115be4771 | ||
|
|
6c93712961 | ||
|
|
9591638263 | ||
|
|
bb195b17e2 | ||
|
|
44365fa3ea | ||
|
|
d6fc97799f | ||
|
|
8f439e074e | ||
|
|
fe2447ef6c | ||
|
|
d4e337eeb3 | ||
|
|
4548bf62a4 | ||
|
|
63ddd51d0b | ||
|
|
aefa323bab |
@@ -0,0 +1,25 @@
|
||||
name: Publish to Comfy registry
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "pyproject.toml"
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
publish-node:
|
||||
name: Publish Custom Node to registry
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == 'LEv145' }}
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
- name: Publish Custom Node
|
||||
uses: Comfy-Org/publish-node-action@v1
|
||||
with:
|
||||
## Add your own personal access token to your Github Repository secrets and reference it here.
|
||||
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PyMethodMayBeStaticInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyPackageRequirementsInspection" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="ignoredPackages">
|
||||
<value>
|
||||
<list size="10">
|
||||
<item index="0" class="java.lang.String" itemvalue="pandas" />
|
||||
<item index="1" class="java.lang.String" itemvalue="beautifulsoup4" />
|
||||
<item index="2" class="java.lang.String" itemvalue="selenium" />
|
||||
<item index="3" class="java.lang.String" itemvalue="textract" />
|
||||
<item index="4" class="java.lang.String" itemvalue="SQLAlchemy" />
|
||||
<item index="5" class="java.lang.String" itemvalue="psycopg2" />
|
||||
<item index="6" class="java.lang.String" itemvalue="python-dotenv" />
|
||||
<item index="7" class="java.lang.String" itemvalue="requests" />
|
||||
<item index="8" class="java.lang.String" itemvalue="urllib3" />
|
||||
<item index="9" class="java.lang.String" itemvalue="PyPDF2" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyRedundantParenthesesInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
</profile>
|
||||
</component>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
Generated
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Poetry (content_sync_server)" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Poetry (content_sync_server)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/images-grid-comfy-plugin.iml" filepath="$PROJECT_DIR$/.idea/images-grid-comfy-plugin.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,14 @@
|
||||
[project]
|
||||
name = "images-grid-comfy-plugin"
|
||||
description = "This tool provides a viewer node that allows for checking multiple outputs in a grid, similar to the X/Y Plot extension."
|
||||
version = "2.6.0"
|
||||
license = "MIT"
|
||||
|
||||
# Comfy UI
|
||||
[project.urls]
|
||||
Repository = "https://github.com/LEv145/images-grid-comfy-plugin"
|
||||
|
||||
[tool.comfy]
|
||||
PublisherId = "lev145"
|
||||
DisplayName = "images-grid-comfy-plugin"
|
||||
Icon = "https://img10.joyreactor.cc/pics/comment/Anime-%D1%84%D1%8D%D0%BD%D0%B4%D0%BE%D0%BC%D1%8B-vtuber-Neuro-sama-4808746.png"
|
||||
@@ -26,12 +26,8 @@ class GridAnnotationNode(BaseNode):
|
||||
font_size: int,
|
||||
) -> tuple[Annotation]:
|
||||
font = ImageFont.truetype(str(STATIC_PATH / "Roboto-Regular.ttf"), size=font_size)
|
||||
column_texts_list = self._set_value_to_texts_list(
|
||||
self._get_texts_from_string(column_texts),
|
||||
)
|
||||
row_texts_list = self._set_value_to_texts_list(
|
||||
self._get_texts_from_string(row_texts),
|
||||
)
|
||||
column_texts_list = self._get_texts_from_string(column_texts)
|
||||
row_texts_list = self._get_texts_from_string(row_texts)
|
||||
|
||||
result = Annotation(column_texts=column_texts_list, row_texts=row_texts_list, font=font)
|
||||
return (result,)
|
||||
@@ -42,8 +38,3 @@ class GridAnnotationNode(BaseNode):
|
||||
for i in string.split(";")
|
||||
if (result := i.strip()) != ""
|
||||
]
|
||||
|
||||
def _set_value_to_texts_list(self, texts_list: list[str]) -> list[str]:
|
||||
if not texts_list:
|
||||
return ["None"]
|
||||
return texts_list
|
||||
|
||||
+31
-24
@@ -92,19 +92,24 @@ def _create_grid_annotation(
|
||||
row_texts: list[str],
|
||||
font: ImageFont.FreeTypeFont,
|
||||
) -> Image.Image:
|
||||
if not column_texts or not row_texts:
|
||||
raise ValueError("Column text or row text is empty")
|
||||
if not column_texts and not row_texts:
|
||||
raise ValueError("Column text and row text is empty")
|
||||
|
||||
grid = grid_info.image
|
||||
left_padding = int(
|
||||
max(
|
||||
font.getlength(splitted_text)
|
||||
for raw_text in row_texts
|
||||
for splitted_text in raw_text.split("\n")
|
||||
left_padding = 0
|
||||
top_padding = 0
|
||||
|
||||
if row_texts:
|
||||
left_padding = int(
|
||||
max(
|
||||
font.getlength(splitted_text)
|
||||
for raw_text in row_texts
|
||||
for splitted_text in raw_text.split("\n")
|
||||
)
|
||||
+ font.getlength(WIDEST_LETTER)*2
|
||||
)
|
||||
+ font.getlength(WIDEST_LETTER)*2
|
||||
)
|
||||
top_padding = int(font.size * 2)
|
||||
if column_texts:
|
||||
top_padding = max(elem.count("\n") for elem in column_texts) * int(font.size) + int(font.size * 2)
|
||||
|
||||
image = Image.new(
|
||||
"RGB",
|
||||
@@ -116,20 +121,22 @@ def _create_grid_annotation(
|
||||
draw.font = font # type: ignore
|
||||
|
||||
_paste_image_to_lower_left_corner(image, grid)
|
||||
_draw_column_text(
|
||||
draw=draw,
|
||||
texts=column_texts,
|
||||
grid_info=grid_info,
|
||||
left_padding=left_padding,
|
||||
top_padding=top_padding,
|
||||
)
|
||||
_draw_row_text(
|
||||
draw=draw,
|
||||
texts=row_texts,
|
||||
grid_info=grid_info,
|
||||
left_padding=left_padding,
|
||||
top_padding=top_padding,
|
||||
)
|
||||
if column_texts:
|
||||
_draw_column_text(
|
||||
draw=draw,
|
||||
texts=column_texts,
|
||||
grid_info=grid_info,
|
||||
left_padding=left_padding,
|
||||
top_padding=top_padding,
|
||||
)
|
||||
if row_texts:
|
||||
_draw_row_text(
|
||||
draw=draw,
|
||||
texts=row_texts,
|
||||
grid_info=grid_info,
|
||||
left_padding=left_padding,
|
||||
top_padding=top_padding,
|
||||
)
|
||||
|
||||
return image
|
||||
|
||||
|
||||
Reference in New Issue
Block a user