-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.py
43 lines (31 loc) · 1013 Bytes
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from rich.panel import Panel
import os
def clear_terminal():
# Windows 운영 체제
if os.name == 'nt':
_ = os.system('cls')
# macOS, Linux 운영 체제
else:
_ = os.system('clear')
PANEL_TITLE = "ERC"
PANEL_BORDER_STYLE = "blue"
class MyPanel():
def __init__(self) :
self.buffer = ""
self.msg = ""
def flush(self):
self.buffer = ""
self.msg = ""
def get_panel(self, msg) :
clear_terminal()
self.buffer += self.msg + "\n"
if self.buffer == "\n":
self.buffer = ""
self.msg = msg
return Panel(self.buffer + self.msg, title=PANEL_TITLE, border_style=PANEL_BORDER_STYLE, expand=False)
def update(self, msg) :
self.msg = msg
return Panel(self.buffer + self.msg, title=PANEL_TITLE, border_style=PANEL_BORDER_STYLE, expand=False)
MY_PANEL = MyPanel()
# def get_panel(msg) :
# return Panel(msg, title=PANEL_TITLE, border_style=PANEL_BORDER_STYLE)