Skip to content

Commit

Permalink
chore: make installable via manager
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelass committed Aug 1, 2023
1 parent e636c60 commit 8e6f058
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 37 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
.idea
__pycache__/*
5 changes: 3 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import os
import shutil

comfy_path = '../..'
comfy_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
failfast_path = os.path.abspath(os.path.dirname(__file__))

def setup_js():
try:
js_dest_path = os.path.join(comfy_path, "web", "extensions", "failfast-comfyui-extensions")
js_src_path = os.path.join(failfast_path, "extensions")

print(js_src_path)
print(js_dest_path)
if os.path.exists(js_dest_path):
shutil.rmtree(js_dest_path)

Expand Down
2 changes: 1 addition & 1 deletion disable.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import shutil
import subprocess

comfy_path = '../..'
comfy_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

def rmtree(path):
retry_count = 3
Expand Down
8 changes: 4 additions & 4 deletions extensions/arrange.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* GitHub: https://github.com/failfa-st
* Discord: https://discord.com/invite/m3TBB9XEkb
*/
import { app } from "../scripts/app.js";
import { $el } from "../scripts/ui.js";
import { app } from "/scripts/app.js";
import { $el } from "/scripts/ui.js";

/**
* Render Shadow
Expand All @@ -32,13 +32,13 @@ app.registerExtension({
callback: () =>
app.graph.arrange(
LiteGraph.CANVAS_GRID_SIZE * 4,
LiteGraph.VERTICAL_LAYOUT,
LiteGraph.VERTICAL_LAYOUT
),
},
{
content: "Arrange (horizontal)",
callback: () => app.graph.arrange(LiteGraph.CANVAS_GRID_SIZE * 2),
},
}
);

return menuOptions;
Expand Down
20 changes: 10 additions & 10 deletions extensions/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* GitHub: https://github.com/failfa-st
* Discord: https://discord.com/invite/m3TBB9XEkb
*/
import { app } from "../scripts/app.js";
import { $el } from "../scripts/ui.js";
import { app } from "/scripts/app.js";
import { $el } from "/scripts/ui.js";

function getColor(index, lengthOfItems, l = 0.5) {
// Normalize the index value to be between 0 and 360 for full spectrum of hue
Expand Down Expand Up @@ -311,9 +311,9 @@ app.registerExtension({
node.setDirtyCanvas(true, true);
},
}),
],
]
),
]),
])
);
if (isGroup) {
menuRoot.append(
Expand Down Expand Up @@ -351,9 +351,9 @@ app.registerExtension({
node.setDirtyCanvas(true, true);
},
}),
],
]
),
]),
])
);
}
return response;
Expand Down Expand Up @@ -385,7 +385,7 @@ app.registerExtension({
value: index,
selected: index === +value,
});
}),
})
),
$el(
"label",
Expand All @@ -398,19 +398,19 @@ app.registerExtension({
type: "checkbox",
checked:
window.localStorage.getItem(
`Comfy.Settings.${colorsName}-posneg`,
`Comfy.Settings.${colorsName}-posneg`
) === "true",
onchange: (event) => {
window.localStorage.setItem(
`Comfy.Settings.${colorsName}-posneg`,
event.target.checked.toString(),
event.target.checked.toString()
);
if (event.target.checked) {
colorPositiveNegative(app);
}
},
}),
],
]
),
]),
]);
Expand Down
2 changes: 1 addition & 1 deletion extensions/connectionsWidth.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* GitHub: https://github.com/failfa-st
* Discord: https://discord.com/invite/m3TBB9XEkb
*/
import { app } from "../scripts/app.js";
import { app } from "/scripts/app.js";

/**
* Connections Width
Expand Down
2 changes: 1 addition & 1 deletion extensions/forceBoxNodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* GitHub: https://github.com/failfa-st
* Discord: https://discord.com/invite/m3TBB9XEkb
*/
import { app } from "../scripts/app.js";
import { app } from "/scripts/app.js";

/**
* Render all nodes as box
Expand Down
2 changes: 1 addition & 1 deletion extensions/forceSnapToGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* GitHub: https://github.com/failfa-st
* Discord: https://discord.com/invite/m3TBB9XEkb
*/
import { app } from "../scripts/app.js";
import { app } from "/scripts/app.js";

/**
* Always snap to grid
Expand Down
6 changes: 3 additions & 3 deletions extensions/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* GitHub: https://github.com/failfa-st
* Discord: https://discord.com/invite/m3TBB9XEkb
*/
import { app } from "../scripts/app.js";
import { app } from "/scripts/app.js";

/**
* Render Shadow
Expand Down Expand Up @@ -52,7 +52,7 @@ app.registerExtension({
node.flags.pinned = true;
});
},
},
}
);

return menuOptions;
Expand Down Expand Up @@ -92,7 +92,7 @@ app.registerExtension({
});
});
},
},
}
);

return menuOptions;
Expand Down
6 changes: 3 additions & 3 deletions extensions/linksRenderMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* Discord: https://discord.com/invite/m3TBB9XEkb
*/

import { app } from "../scripts/app.js";
import { $el } from "../scripts/ui.js";
import { app } from "/scripts/app.js";
import { $el } from "/scripts/ui.js";

/**
* Toggle links render mode
Expand Down Expand Up @@ -50,7 +50,7 @@ app.registerExtension({
value: index,
selected: index === +value,
});
}),
})
),
]),
]);
Expand Down
6 changes: 3 additions & 3 deletions extensions/nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* GitHub: https://github.com/failfa-st
* Discord: https://discord.com/invite/m3TBB9XEkb
*/
import { app } from "../scripts/app.js";
import { app } from "/scripts/app.js";

/**
* Nodes
Expand All @@ -35,7 +35,7 @@ app.registerExtension({
async setup(app) {
app.graph._nodes.forEach(function (node) {
let active = JSON.parse(
window.localStorage.getItem(`Comfy.Settings.${nodesName}`) ?? "false",
window.localStorage.getItem(`Comfy.Settings.${nodesName}`) ?? "false"
);
const onResize = node.onResize;
node.onResize = function (size) {
Expand Down Expand Up @@ -63,7 +63,7 @@ app.registerExtension({
const onMouseDown = node.onMouseDown;
node.onMouseDown = function () {
active = JSON.parse(
window.localStorage.getItem(`Comfy.Settings.${nodesName}`) ?? "false",
window.localStorage.getItem(`Comfy.Settings.${nodesName}`) ?? "false"
);
return onMouseDown?.apply(this, arguments);
};
Expand Down
5 changes: 2 additions & 3 deletions extensions/pinNodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
* GitHub: https://github.com/failfa-st
* Discord: https://discord.com/invite/m3TBB9XEkb
*/
import { app } from "../scripts/app.js";
import { $el } from "../scripts/ui.js";
import { app } from "/scripts/app.js";

/**
* Pin/Unpin all nodes on canvas
Expand Down Expand Up @@ -41,7 +40,7 @@ app.registerExtension({
node.flags.pinned = false;
});
},
},
}
);

return menuOptions;
Expand Down
2 changes: 1 addition & 1 deletion extensions/renderShadows.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* GitHub: https://github.com/failfa-st
* Discord: https://discord.com/invite/m3TBB9XEkb
*/
import { app } from "../scripts/app.js";
import { app } from "/scripts/app.js";

/**
* Render Shadow
Expand Down
4 changes: 2 additions & 2 deletions extensions/textFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* GitHub: https://github.com/failfa-st
* Discord: https://discord.com/invite/m3TBB9XEkb
*/
import { app } from "../scripts/app.js";
import { $el } from "../scripts/ui.js";
import { app } from "/scripts/app.js";
import { $el } from "/scripts/ui.js";

/**
* Font size of prompt fields
Expand Down
2 changes: 1 addition & 1 deletion uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import shutil
import subprocess

comfy_path = '../..'
comfy_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

def rmtree(path):
retry_count = 3
Expand Down

0 comments on commit 8e6f058

Please sign in to comment.