Skip to content

Commit

Permalink
all nodes dynamic help -- no more remote load
Browse files Browse the repository at this point in the history
sync for frontend 1.2.30
  • Loading branch information
Amorano committed Aug 25, 2024
1 parent c7b51cc commit 1bfd6eb
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 207 deletions.
304 changes: 127 additions & 177 deletions __init__.py

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "jovimetrix"
description = "Integrates Webcam, MIDI, Spout and GLSL shader support. Animation via tick. Parameter manipulation with wave generator. Math operations with Unary and Binary support. Value conversion for all major types (int, string, list, dict, Image, Mask). Shape mask generation, image stacking and channel ops, batch splitting, merging and randomizing, load images and video from anywhere, dynamic bus routing with a single node, export support for GIPHY, save output anywhere! flatten, crop, transform; check colorblindness, make stereogram or stereoscopic images, or liner interpolate values and more."
version = "1.2.29"
version = "1.2.30"
license = { file = "LICENSE" }
dependencies = [
"aenum>=3.1.15,<4",
Expand All @@ -10,6 +10,7 @@ dependencies = [
"daltonlens>=0.1.5",
"glfw>=2.7.0",
"loguru>=0.7.2",
"markdown>=3.7",
"matplotlib>=3.8.4",
"mido[ports-rtmidi]>=1.3.2",
"mss>=9.0.1",
Expand All @@ -25,7 +26,7 @@ dependencies = [
"scikit-learn>=1.5.1",
"SpoutGL>=0.0.6; platform_system==\"Windows\"",
"stereoscopy[auto_align]>=2.0.1",
"vnoise>=0.1.0"
"vnoise>=0.1.0",
]

[project.urls]
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cupy-cuda12x>=13.3.0
daltonlens>=0.1.5
glfw>=2.7.0
loguru>=0.7.2
markdown>=3.7
matplotlib>=3.8.4
mido[ports-rtmidi]>=1.3.2
mss>=9.0.1
Expand Down
25 changes: 25 additions & 0 deletions res/doc/template_node_plain.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>${title}</title>
</head>
<body>
<div class='jov-panel-doc'>
<h2>${name}</h2>
<h3>${category}</h3>
<p>${documentation}</p>
<p>OUTPUT NODE?: ${output_node}</p>
<h2>INPUT</h2>
${input_content}
<h2>OUTPUT</h2>
<table>
<tr><th>Name</th><th>Type</th><th>Description</th></tr>
${output_content}
</table>
<footer>
<p>Original help system powered by <a href="https://github.com/melMass">MelMass</a> & the <a href="https://github.com/melMass/comfy_mtb">comfy_mtb</a> project</p>
</footer>
</div>
</body>
</html>
33 changes: 9 additions & 24 deletions web/core/core_help.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,35 @@
/**
* File: core_help.js
* Project: Jovimetrix
* code based on mtb nodes by Mel Massadian https://github.com/melMass/comfy_mtb/
* The original code to show the help was based on Mel Massadian's mtb node help extension:
*
* https://github.com/melMass/comfy_mtb/
*/

import { app } from '../../../scripts/app.js'
import '../extern/shodown.min.js'


// OLD: https://github.com/Amorano/Jovimetrix/wiki/COMPOSE#-TRANSFORM
// NEW: https://github.com/Amorano/Jovimetrix/wiki/Z.-REFERENCE#-transform

const JOV_WEBWIKI_URL = "https://github.com/Amorano/Jovimetrix/wiki/Z.-REFERENCE#";
// help now is 100% dynamically built as it is used, no more requests out
const CACHE_DOCUMENTATION = {};

if (!window.jovimetrixEvents) {
window.jovimetrixEvents = new EventTarget();
}
const jovimetrixEvents = window.jovimetrixEvents;

const documentationConverter = new showdown.Converter({
tables: true,
strikethrough: true,
emoji: true,
ghCodeBlocks: true,
tasklists: true,
ghMentions: true,
smoothLivePreview: true,
simplifiedAutoLink: true,
parseImgDimensions: true,
openLinksInNewWindow: true,
});

const JOV_HELP_URL = "/jovimetrix/doc";
const JOV_HELP_URL = "./api/jovimetrix/doc";

async function load_help(name, custom_data) {
// overwrite
if (custom_data) {
CACHE_DOCUMENTATION[name] = documentationConverter.makeHtml(custom_data);
CACHE_DOCUMENTATION[name] = custom_data;
}

if (name in CACHE_DOCUMENTATION) {
return CACHE_DOCUMENTATION[name];
}

const url = `${JOV_HELP_URL}/${name}`;

// Check if data is already cached
const result = fetch(url,
{ cache: "no-store" }
Expand Down Expand Up @@ -107,8 +92,8 @@ app.extensionManager.registerSidebarTab({

// Listen for the custom event
jovimetrixEvents.addEventListener('jovimetrixHelpRequested', async (event) => {
const node = `${event.detail.class}/${event.detail.name}`;
await updateContent(node);
// const node = `${event.detail.class}/${event.detail.name}`;
await updateContent(event.detail.name);
});


Expand Down
3 changes: 0 additions & 3 deletions web/extern/shodown.min.js

This file was deleted.

1 change: 0 additions & 1 deletion web/extern/showdown.min.js.map

This file was deleted.

0 comments on commit 1bfd6eb

Please sign in to comment.