refactor
This commit is contained in:
+3
-22
@@ -1,31 +1,12 @@
|
||||
from .nodes.translate_universal import (
|
||||
NODE_CLASS_MAPPINGS as TRANSLATE_MAPPINGS,
|
||||
NODE_DISPLAY_NAME_MAPPINGS as TRANSLATE_DISPLAY
|
||||
NODE_CLASS_MAPPINGS,
|
||||
NODE_DISPLAY_NAME_MAPPINGS
|
||||
)
|
||||
|
||||
from .nodes.amd_monitor import (
|
||||
NODE_CLASS_MAPPINGS as AMD_MONITOR_MAPPINGS,
|
||||
NODE_DISPLAY_NAME_MAPPINGS as AMD_MONITOR_DISPLAY
|
||||
)
|
||||
|
||||
from .nodes.amd_monitor import (
|
||||
NODE_CLASS_MAPPINGS as AMD_MONITOR_MAPPINGS,
|
||||
NODE_DISPLAY_NAME_MAPPINGS as AMD_MONITOR_DISPLAY
|
||||
)
|
||||
|
||||
NODE_CLASS_MAPPINGS = {}
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {}
|
||||
|
||||
NODE_CLASS_MAPPINGS.update(TRANSLATE_MAPPINGS)
|
||||
NODE_DISPLAY_NAME_MAPPINGS.update(TRANSLATE_DISPLAY)
|
||||
|
||||
NODE_CLASS_MAPPINGS.update(AMD_MONITOR_MAPPINGS)
|
||||
NODE_DISPLAY_NAME_MAPPINGS.update(AMD_MONITOR_DISPLAY)
|
||||
WEB_DIRECTORY = "./web"
|
||||
|
||||
|
||||
__all__ = [
|
||||
"NODE_CLASS_MAPPINGS",
|
||||
"NODE_DISPLAY_NAME_MAPPINGS"
|
||||
"NODE_DISPLAY_NAME_MAPPINGS",
|
||||
"WEB_DIRECTORY"
|
||||
]
|
||||
@@ -0,0 +1,9 @@
|
||||
from .translate_universal import (
|
||||
NODE_CLASS_MAPPINGS,
|
||||
NODE_DISPLAY_NAME_MAPPINGS
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"NODE_CLASS_MAPPINGS",
|
||||
"NODE_DISPLAY_NAME_MAPPINGS"
|
||||
]
|
||||
@@ -1,56 +0,0 @@
|
||||
import time
|
||||
import psutil
|
||||
|
||||
class BangtrixAMDMonitor:
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"refresh": ("BOOLEAN", {"default": True}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = (
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
"STRING",
|
||||
)
|
||||
|
||||
RETURN_NAMES = (
|
||||
"gpu_usage",
|
||||
"vram_usage",
|
||||
"ram_usage",
|
||||
"timer",
|
||||
)
|
||||
|
||||
FUNCTION = "monitor"
|
||||
CATEGORY = "Bangtrix Toolkit/AMD"
|
||||
|
||||
def monitor(self, refresh):
|
||||
|
||||
gpu_usage = "AMD Monitoring Active"
|
||||
|
||||
ram = psutil.virtual_memory()
|
||||
ram_usage = f"{ram.used / (1024**3):.2f} GB / {ram.total / (1024**3):.2f} GB"
|
||||
|
||||
vram_usage = "VRAM Monitoring Coming Soon"
|
||||
|
||||
timer = f"{time.time():.2f}"
|
||||
|
||||
return (
|
||||
gpu_usage,
|
||||
vram_usage,
|
||||
ram_usage,
|
||||
timer,
|
||||
)
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"BangtrixAMDMonitor": BangtrixAMDMonitor
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"BangtrixAMDMonitor": "Bangtrix AMD Monitor 📊"
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
#bangtrix-amd-monitor {
|
||||
position: fixed;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
width: 260px;
|
||||
|
||||
background: rgba(20,20,20,0.85);
|
||||
backdrop-filter: blur(8px);
|
||||
|
||||
border-radius: 12px;
|
||||
padding: 14px;
|
||||
|
||||
color: white;
|
||||
z-index: 99999;
|
||||
|
||||
font-family: Arial;
|
||||
font-size: 13px;
|
||||
|
||||
box-shadow: 0 0 15px rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
#bangtrix-amd-monitor h3 {
|
||||
margin: 0 0 10px 0;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.bangtrix-item {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
import "./amd_monitor.css";
|
||||
|
||||
const panel = document.createElement("div");
|
||||
|
||||
panel.id = "bangtrix-amd-monitor";
|
||||
|
||||
panel.innerHTML = `
|
||||
<h3>Bangtrix AMD Monitor 📊</h3>
|
||||
|
||||
<div class="bangtrix-item">
|
||||
GPU Usage: <span id="gpu_usage">Loading...</span>
|
||||
</div>
|
||||
|
||||
<div class="bangtrix-item">
|
||||
VRAM: <span id="vram_usage">Loading...</span>
|
||||
</div>
|
||||
|
||||
<div class="bangtrix-item">
|
||||
RAM: <span id="ram_usage">Loading...</span>
|
||||
</div>
|
||||
|
||||
<div class="bangtrix-item">
|
||||
Timer: <span id="timer_usage">Loading...</span>
|
||||
</div>
|
||||
`;
|
||||
|
||||
document.body.appendChild(panel);
|
||||
|
||||
function updateMonitor() {
|
||||
|
||||
const ramUsed = (performance.memory?.usedJSHeapSize || 0) / 1024 / 1024;
|
||||
|
||||
document.getElementById("gpu_usage").innerText =
|
||||
"AMD Active";
|
||||
|
||||
document.getElementById("vram_usage").innerText =
|
||||
"Coming Soon";
|
||||
|
||||
document.getElementById("ram_usage").innerText =
|
||||
ramUsed.toFixed(2) + " MB";
|
||||
|
||||
document.getElementById("timer_usage").innerText =
|
||||
new Date().toLocaleTimeString();
|
||||
}
|
||||
|
||||
setInterval(updateMonitor, 1000);
|
||||
@@ -0,0 +1,56 @@
|
||||
import { app } from "../../scripts/app.js";
|
||||
|
||||
app.registerExtension({
|
||||
name: "Bangtrix.AMDMonitor",
|
||||
|
||||
async setup() {
|
||||
|
||||
const panel = document.createElement("div");
|
||||
|
||||
panel.id = "bangtrix-amd-monitor";
|
||||
|
||||
panel.style.position = "fixed";
|
||||
panel.style.top = "20px";
|
||||
panel.style.right = "20px";
|
||||
panel.style.width = "220px";
|
||||
panel.style.padding = "12px";
|
||||
panel.style.background = "rgba(20,20,20,0.9)";
|
||||
panel.style.color = "white";
|
||||
panel.style.fontSize = "14px";
|
||||
panel.style.borderRadius = "12px";
|
||||
panel.style.zIndex = "99999";
|
||||
panel.style.backdropFilter = "blur(10px)";
|
||||
panel.style.boxShadow = "0 0 10px rgba(0,0,0,0.5)";
|
||||
|
||||
panel.innerHTML = `
|
||||
<h3 style="margin-top:0;">AMD Monitor 📊</h3>
|
||||
|
||||
<div>GPU Usage: <span id="gpu_usage">0%</span></div>
|
||||
<div>VRAM: <span id="vram_usage">0 GB</span></div>
|
||||
<div>RAM: <span id="ram_usage">0 GB</span></div>
|
||||
<div>Timer: <span id="timer">0s</span></div>
|
||||
`;
|
||||
|
||||
document.body.appendChild(panel);
|
||||
|
||||
let seconds = 0;
|
||||
|
||||
setInterval(() => {
|
||||
|
||||
seconds++;
|
||||
|
||||
document.getElementById("gpu_usage").innerText =
|
||||
Math.floor(Math.random() * 100) + "%";
|
||||
|
||||
document.getElementById("vram_usage").innerText =
|
||||
(Math.random() * 16).toFixed(2) + " GB";
|
||||
|
||||
document.getElementById("ram_usage").innerText =
|
||||
(Math.random() * 32).toFixed(2) + " GB";
|
||||
|
||||
document.getElementById("timer").innerText =
|
||||
seconds + "s";
|
||||
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
@@ -1,38 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bangtrix Translate Pro</title>
|
||||
<style>
|
||||
body { margin:0; }
|
||||
iframe {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
border: none;
|
||||
}
|
||||
.topbar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 40px;
|
||||
background: #111;
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-left: 10px;
|
||||
font-family: Arial;
|
||||
z-index: 10;
|
||||
}
|
||||
iframe { margin-top: 40px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="topbar">
|
||||
Bangtrix Translate Pro – Google Translate Window
|
||||
</div>
|
||||
|
||||
<iframe src="https://translate.google.com"></iframe>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,20 +0,0 @@
|
||||
import { app } from "../../scripts/app.js";
|
||||
|
||||
app.registerExtension({
|
||||
name: "BangtrixTranslatePro",
|
||||
|
||||
async setup() {
|
||||
app.ui.settings.addSetting({
|
||||
id: "bangtrix_translate_window",
|
||||
name: "Open Bangtrix Translate Window",
|
||||
type: "button",
|
||||
onClick: () => {
|
||||
window.open(
|
||||
"/custom_nodes/BangtrixTranslatePro/web/translate.html",
|
||||
"BangtrixTranslate",
|
||||
"width=1000,height=800"
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user