colourful greetings
This commit is contained in:
parent
733b1b05b1
commit
5b63b0298f
3 changed files with 40 additions and 4 deletions
|
@ -11,3 +11,4 @@ websocket_client
|
||||||
gevent-ws
|
gevent-ws
|
||||||
coincurve
|
coincurve
|
||||||
maxminddb
|
maxminddb
|
||||||
|
rich
|
||||||
|
|
|
@ -13,9 +13,9 @@ import time
|
||||||
class Config(object):
|
class Config(object):
|
||||||
|
|
||||||
def __init__(self, argv):
|
def __init__(self, argv):
|
||||||
self.version = "0.7.4"
|
self.version = "0.7.4+"
|
||||||
# DEPRECATED ; replace with git-generated commit
|
# DEPRECATED ; replace with git-generated commit
|
||||||
self.rev = 5003
|
self.rev = 5004
|
||||||
self.argv = argv
|
self.argv = argv
|
||||||
self.action = None
|
self.action = None
|
||||||
self.test_parser = None
|
self.test_parser = None
|
||||||
|
|
39
zeronet.py
39
zeronet.py
|
@ -1,7 +1,43 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from src.Config import config
|
||||||
|
|
||||||
|
def grad(n):
|
||||||
|
s = 0x08
|
||||||
|
r = 0xff
|
||||||
|
g = 0x00
|
||||||
|
b = 0x00
|
||||||
|
for i in range(n):
|
||||||
|
if r >= s and b < s:
|
||||||
|
r -= s
|
||||||
|
g += s
|
||||||
|
elif g >= s and r < s:
|
||||||
|
g -= s
|
||||||
|
b += s
|
||||||
|
elif b >= s and g < s:
|
||||||
|
b -= s
|
||||||
|
r += s
|
||||||
|
return f'#{r:02x}{g:02x}{b:02x}'
|
||||||
|
|
||||||
|
def fancy_greet():
|
||||||
|
from rich.console import Console
|
||||||
|
from rich.text import Text
|
||||||
|
zc_msg = f'''
|
||||||
|
||| __. _. . _ . . _ _. _|_ _. . . _ .-- _. . _ . . __. . _ _. . .
|
||||||
|
||| / /_| |/ / \ |/ | /_| | == / / \ |/ | \ /_| |/ | | __| |/ | / \_|
|
||||||
|
||| /_. \_ | \_/ | | \_ |. \__ \_/ | | ._| \_ | \/ |__| | | \__ |
|
||||||
|
||| _/
|
||||||
|
||| v{config.version}
|
||||||
|
'''
|
||||||
|
lns = zc_msg.split('\n')
|
||||||
|
console = Console()
|
||||||
|
for l in lns:
|
||||||
|
txt = Text(l)
|
||||||
|
txt.stylize('bold')
|
||||||
|
for i in range(len(l)):
|
||||||
|
txt.stylize(grad(i), i, i+1)
|
||||||
|
console.print(txt)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if sys.version_info.major < 3:
|
if sys.version_info.major < 3:
|
||||||
|
@ -9,7 +45,7 @@ def main():
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if "--silent" not in sys.argv:
|
if "--silent" not in sys.argv:
|
||||||
print("- Starting zeronet-conservancy...")
|
fancy_greet()
|
||||||
|
|
||||||
main = None
|
main = None
|
||||||
try:
|
try:
|
||||||
|
@ -23,7 +59,6 @@ def main():
|
||||||
except Exception as log_err:
|
except Exception as log_err:
|
||||||
print("Failed to log error:", log_err)
|
print("Failed to log error:", log_err)
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
from Config import config
|
|
||||||
error_log_path = config.log_dir + "/error.log"
|
error_log_path = config.log_dir + "/error.log"
|
||||||
traceback.print_exc(file=open(error_log_path, "w"))
|
traceback.print_exc(file=open(error_log_path, "w"))
|
||||||
print("---")
|
print("---")
|
||||||
|
|
Loading…
Reference in a new issue