mirror of https://github.com/aristocratos/bpytop
Fixed issues when importing from non terminal
parent
34662b46de
commit
4a85353b3d
13
bpytop.py
13
bpytop.py
|
@ -470,8 +470,10 @@ class Config:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
CONFIG: Config = Config(CONFIG_FILE)
|
CONFIG: Config = Config(CONFIG_FILE)
|
||||||
if DEBUG:
|
if not __name__ == "__main__":
|
||||||
errlog.setLevel(DEBUG)
|
errlog.setLevel(logging.ERROR)
|
||||||
|
elif DEBUG:
|
||||||
|
errlog.setLevel(logging.DEBUG)
|
||||||
else:
|
else:
|
||||||
errlog.setLevel(getattr(logging, CONFIG.log_level))
|
errlog.setLevel(getattr(logging, CONFIG.log_level))
|
||||||
if CONFIG.log_level == "DEBUG": DEBUG = True
|
if CONFIG.log_level == "DEBUG": DEBUG = True
|
||||||
|
@ -501,8 +503,11 @@ if psutil.version_info[0] < 5 or (psutil.version_info[0] == 5 and psutil.version
|
||||||
|
|
||||||
class Term:
|
class Term:
|
||||||
"""Terminal info and commands"""
|
"""Terminal info and commands"""
|
||||||
width: int = os.get_terminal_size().columns #* Current terminal width in columns
|
width: int = 0
|
||||||
height: int = os.get_terminal_size().lines #* Current terminal height in lines
|
height: int = 0
|
||||||
|
if __name__ == "__main__":
|
||||||
|
width = os.get_terminal_size().columns
|
||||||
|
height = os.get_terminal_size().lines
|
||||||
resized: bool = False
|
resized: bool = False
|
||||||
_w : int = 0
|
_w : int = 0
|
||||||
_h : int = 0
|
_h : int = 0
|
||||||
|
|
Loading…
Reference in New Issue