mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
switch to blessed
This commit is contained in:
parent
f5d8f36e1f
commit
8c70ebb78d
4 changed files with 53 additions and 52 deletions
|
|
@ -110,45 +110,45 @@
|
|||
\ \ \___/ ---- *
|
||||
\ \____\ / \____\*
|
||||
\/____/ \/____/.
|
||||
____________
|
||||
____________
|
||||
/\ ___ \ .
|
||||
\ \ \/_\ \ *
|
||||
\ \ _____/ *
|
||||
\ \ \___/ ---- *
|
||||
\ \____\ / \____\ .
|
||||
\/____/ \/____/
|
||||
\/____/ \/____/
|
||||
____________
|
||||
/\ ___ \
|
||||
/\ ___ \
|
||||
\ \ \/_\ \ .
|
||||
\ \ _____/ *
|
||||
\ \ \___/ ---- *
|
||||
\ \____\ / \____\ .
|
||||
\/____/ \/____/
|
||||
\/____/ \/____/
|
||||
____________
|
||||
/\ ___ \
|
||||
\ \ \/_\ \
|
||||
\ \ \/_\ \
|
||||
\ \ _____/ .
|
||||
\ \ \___/ ---- *
|
||||
\ \____\ / \____\ .
|
||||
\/____/ \/____/
|
||||
\/____/ \/____/
|
||||
____________
|
||||
/\ ___ \
|
||||
\ \ \/_\ \
|
||||
\ \ _____/
|
||||
\ \ _____/
|
||||
\ \ \___/ ---- *
|
||||
\ \____\ / \____\
|
||||
\/____/ \/____/
|
||||
\ \____\ / \____\
|
||||
\/____/ \/____/
|
||||
____________
|
||||
/\ ___ \
|
||||
\ \ \/_\ \
|
||||
\ \ _____/
|
||||
\ \ \___/ ---- .
|
||||
\ \____\ / \____\
|
||||
\/____/ \/____/
|
||||
\ \____\ / \____\
|
||||
\/____/ \/____/
|
||||
____________
|
||||
/\ ___ \
|
||||
\ \ \/_\ \
|
||||
\ \ _____/ _
|
||||
\ \ _____/ _
|
||||
\ \ \___/ ----
|
||||
\ \____\ / \____\
|
||||
\/____/ \/____/
|
||||
|
|
@ -410,4 +410,4 @@
|
|||
\ \ _____/ ___ ___ ___
|
||||
\ \ \___/ ---- \ \\ \\ \
|
||||
\ \____\ / \____\ \__\\__\\__\
|
||||
\/____/ \/____/ . PYPE Club .
|
||||
\/____/ \/____/ . PYPE Club .
|
||||
|
|
|
|||
|
|
@ -13,11 +13,10 @@
|
|||
import re
|
||||
import os
|
||||
import sys
|
||||
noColorama = False
|
||||
try:
|
||||
from colorama import Fore, Style, init, ansitowin32
|
||||
except ImportError:
|
||||
noColorama = True
|
||||
import blessed
|
||||
|
||||
|
||||
term = blessed.Terminal()
|
||||
|
||||
|
||||
class Terminal:
|
||||
|
|
@ -30,40 +29,37 @@ class Terminal:
|
|||
"""
|
||||
|
||||
# shortcuts for colorama codes
|
||||
if noColorama:
|
||||
_SB = _RST = _LR = _LG = _LB = _LM = _R = _G = _B = _C = _Y = _W = ""
|
||||
_LY = ""
|
||||
else:
|
||||
_SB = Style.BRIGHT
|
||||
_RST = Style.RESET_ALL
|
||||
_LR = Fore.LIGHTRED_EX
|
||||
_LG = Fore.LIGHTGREEN_EX
|
||||
_LB = Fore.LIGHTBLUE_EX
|
||||
_LM = Fore.LIGHTMAGENTA_EX
|
||||
_LY = Fore.LIGHTYELLOW_EX
|
||||
_R = Fore.RED
|
||||
_G = Fore.GREEN
|
||||
_B = Fore.BLUE
|
||||
_C = Fore.CYAN
|
||||
_Y = Fore.YELLOW
|
||||
_W = Fore.WHITE
|
||||
|
||||
_SB = term.bold
|
||||
_RST = ""
|
||||
_LR = term.tomato2
|
||||
_LG = term.aquamarine3
|
||||
_LB = term.turquoise2
|
||||
_LM = term.slateblue2
|
||||
_LY = term.gold
|
||||
_R = term.red
|
||||
_G = term.green
|
||||
_B = term.blue
|
||||
_C = term.cyan
|
||||
_Y = term.yellow
|
||||
_W = term.white
|
||||
|
||||
# dictionary replacing string sequences with colorized one
|
||||
_sdict = {
|
||||
|
||||
r">>> ": _SB + _G + r">>> " + _RST,
|
||||
r">>> ": _SB + _LG + r">>> " + _RST,
|
||||
r"!!!(?!\sCRI|\sERR)": _SB + _R + r"!!! " + _RST,
|
||||
r"\-\-\- ": _SB + _C + r"--- " + _RST,
|
||||
r"\*\*\*(?!\sWRN)": _SB + _LM + r"***" + _RST,
|
||||
r"\*\*\*(?!\sWRN)": _SB + _LY + r"***" + _RST,
|
||||
r"\*\*\* WRN": _SB + _LY + r"*** WRN" + _RST,
|
||||
r" \- ": _SB + _Y + r" - " + _RST,
|
||||
r" \- ": _SB + _LY + r" - " + _RST,
|
||||
r"\[ ": _SB + _LG + r"[ " + _RST,
|
||||
r"\]": _SB + _LG + r"]" + _RST,
|
||||
r"{": _LG + r"{",
|
||||
r"}": r"}" + _RST,
|
||||
r"\(": _LY + r"(",
|
||||
r"\)": r")" + _RST,
|
||||
r"^\.\.\. ": _SB + _LM + r"... " + _RST,
|
||||
r"^\.\.\. ": _SB + _LR + r"... " + _RST,
|
||||
r"!!! ERR: ":
|
||||
_SB + _LR + r"!!! ERR: " + _RST,
|
||||
r"!!! CRI: ":
|
||||
|
|
@ -73,8 +69,7 @@ class Terminal:
|
|||
}
|
||||
|
||||
def __init__(self):
|
||||
if not noColorama:
|
||||
init()
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def _multiple_replace(text, adict):
|
||||
|
|
@ -108,11 +103,6 @@ class Terminal:
|
|||
str: Colorized message.
|
||||
|
||||
"""
|
||||
if noColorama:
|
||||
print(message)
|
||||
return message
|
||||
if not isinstance(sys.stdout, ansitowin32.StreamWrapper):
|
||||
init()
|
||||
colorized = Terminal.log(message)
|
||||
print(colorized)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,15 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Pype terminal animation :)"""
|
||||
import os
|
||||
import blessed
|
||||
from pathlib import Path
|
||||
from time import sleep
|
||||
import sys
|
||||
|
||||
term = blessed.Terminal()
|
||||
|
||||
def play_animation():
|
||||
print(term.home + term.clear)
|
||||
frame_size = 7
|
||||
splash_file = Path(__file__).parent / "splash.txt"
|
||||
with splash_file.open("r") as sf:
|
||||
|
|
@ -15,11 +18,17 @@ def play_animation():
|
|||
animation_length = int(len(animation) / frame_size)
|
||||
current_frame = 0
|
||||
for _ in range(animation_length):
|
||||
if sys.platform.startswith('win'):
|
||||
os.system('cls')
|
||||
else:
|
||||
os.system('clear')
|
||||
frame = ""
|
||||
y = 0
|
||||
for scanline in animation[current_frame:current_frame + frame_size]:
|
||||
print(scanline.rstrip())
|
||||
sleep(0.005)
|
||||
frame += scanline
|
||||
y += 1
|
||||
|
||||
with term.location(0, 0):
|
||||
# term.aquamarine3_bold(frame)
|
||||
print(f"{term.bold}{term.aquamarine3}{frame}{term.normal}")
|
||||
|
||||
|
||||
sleep(0.05)
|
||||
current_frame += frame_size
|
||||
print(term.move_y(7))
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
aiohttp
|
||||
appdirs
|
||||
arrow
|
||||
blessed
|
||||
certifi
|
||||
Click
|
||||
clique==1.5.0
|
||||
colorama
|
||||
coverage
|
||||
cx_Freeze
|
||||
ftrack-python-api==2.0.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue