mirror of
https://github.com/vinefeeder/TwinVine.git
synced 2026-07-15 18:10:04 +02:00
console singleton
This commit is contained in:
@@ -15,7 +15,6 @@ from envied.core.commands import Commands
|
|||||||
from envied.core.config import config
|
from envied.core.config import config
|
||||||
from envied.core.console import ComfyRichHandler, console
|
from envied.core.console import ComfyRichHandler, console
|
||||||
from envied.core.constants import context_settings
|
from envied.core.constants import context_settings
|
||||||
from envied.core.update_checker import UpdateChecker
|
|
||||||
from envied.core.utilities import rotate_log_file
|
from envied.core.utilities import rotate_log_file
|
||||||
|
|
||||||
LOGGING_PATH = None
|
LOGGING_PATH = None
|
||||||
@@ -67,36 +66,15 @@ def main(version: bool, debug: bool, log_path: Path) -> None:
|
|||||||
r"░▀▀▀░▀░▀░░▀░░▀▀▀░▀▀▀░▀▀░" + "\n" ,
|
r"░▀▀▀░▀░▀░░▀░░▀▀▀░▀▀▀░▀▀░" + "\n" ,
|
||||||
style="ascii.art",
|
style="ascii.art",
|
||||||
),
|
),
|
||||||
|
Text(" and more than unshackled...", style = "ascii.art"),
|
||||||
f"\nv [repr.number]{__version__}[/] - https://github.com/unshackle-dl/unshackle",
|
f"\nv [repr.number]{__version__}[/] - https://github.com/videfeeder/envied",
|
||||||
),
|
),
|
||||||
(1, 11, 1, 10),
|
(1, 11, 1, 10),
|
||||||
expand=True,
|
expand=True,
|
||||||
),
|
),
|
||||||
justify="center",
|
justify="center",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
'''if version:
|
|
||||||
return
|
|
||||||
|
|
||||||
if config.update_checks:
|
|
||||||
try:
|
|
||||||
latest_version = UpdateChecker.check_for_updates_sync(__version__)
|
|
||||||
if latest_version:
|
|
||||||
console.print(
|
|
||||||
f"\n[yellow]⚠️ Update available![/yellow] "
|
|
||||||
f"Current: {__version__} → Latest: [green]{latest_version}[/green]",
|
|
||||||
justify="center",
|
|
||||||
)
|
|
||||||
console.print(
|
|
||||||
"Visit: https://github.com/envied-dl/envied/releases/latest\n",
|
|
||||||
justify="center",
|
|
||||||
)
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
'''
|
|
||||||
|
|
||||||
@atexit.register
|
@atexit.register
|
||||||
def save_log():
|
def save_log():
|
||||||
if console.record and LOGGING_PATH:
|
if console.record and LOGGING_PATH:
|
||||||
|
|||||||
@@ -167,6 +167,13 @@ class ComfyConsole(Console):
|
|||||||
time.monotonic.
|
time.monotonic.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
_instance: Optional["ComfyConsole"] = None
|
||||||
|
|
||||||
|
def __new__(cls, *args, **kwargs):
|
||||||
|
if cls._instance is None:
|
||||||
|
cls._instance = super().__new__(cls)
|
||||||
|
return cls._instance
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
@@ -200,6 +207,10 @@ class ComfyConsole(Console):
|
|||||||
_environ: Optional[Mapping[str, str]] = None,
|
_environ: Optional[Mapping[str, str]] = None,
|
||||||
log_renderer: Optional[LogRender] = None,
|
log_renderer: Optional[LogRender] = None,
|
||||||
):
|
):
|
||||||
|
# prevent re-initialisation on repeated calls
|
||||||
|
if getattr(self, "_initialized", False):
|
||||||
|
return
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
color_system=color_system,
|
color_system=color_system,
|
||||||
force_terminal=force_terminal,
|
force_terminal=force_terminal,
|
||||||
@@ -232,6 +243,7 @@ class ComfyConsole(Console):
|
|||||||
)
|
)
|
||||||
if log_renderer:
|
if log_renderer:
|
||||||
self._log_render = log_renderer
|
self._log_render = log_renderer
|
||||||
|
self._initialized = True
|
||||||
|
|
||||||
def status(
|
def status(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user