-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
142 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
from terminaltexteffects.effects.effect_print import Print | ||
from colorama import Fore, Back, Style, init | ||
|
||
init() | ||
|
||
from .log import log | ||
|
||
def init(): | ||
text = ( | ||
" _____ __ _ _____ _ _ _____ __ __ \n" | ||
" / _ \\ | \\ | | | ____| | | / / | ____| \\ \\ / /\n" | ||
" | | | | | \\| | | |__ | |/ / | |__ \\ \\/ /\n" | ||
" | | | | | |\\ | | __| | |\\ \\ | __| \\ / \n" | ||
" | |_| | | | \\ | | |___ | | \\ \\ | |___ / / \n" | ||
" \\_____/ |_| \\_| |_____| |_| \\_\\ |_____| /_/ " | ||
) | ||
|
||
effect = Print(text) | ||
|
||
with effect.terminal_output() as terminal: | ||
for frame in effect: | ||
terminal.print(frame) | ||
banner_lines = [ | ||
f"{Fore.GREEN}{Back.BLACK}{Style.BRIGHT} _____ __ _ _____ _ _ _____ __ __ {Style.RESET_ALL}", | ||
f"{Fore.GREEN}{Back.BLACK}{Style.BRIGHT} / _ \\ | \\ | | | ____| | | / / | ____| \\ \\ / /{Style.RESET_ALL}", | ||
f"{Fore.GREEN}{Back.BLACK}{Style.BRIGHT} | | | | | \\| | | |__ | |/ / | |__ \\ \\/ /{Style.RESET_ALL}", | ||
f"{Fore.GREEN}{Back.BLACK}{Style.BRIGHT} | | | | | |\\ | | __| | |\\ \\ | __| \\ / {Style.RESET_ALL}", | ||
f"{Fore.GREEN}{Back.BLACK}{Style.BRIGHT} | |_| | | | \\ | | |___ | | \\ \\ | |___ / /{Style.RESET_ALL}", | ||
f"{Fore.GREEN}{Back.BLACK}{Style.BRIGHT} \\_____/ |_| \\_| |_____| |_| \\_\\ |_____| /_/{Style.RESET_ALL}", | ||
] | ||
for line in banner_lines: | ||
print(line) | ||
|
||
log(f'作者: ikun0014') | ||
log(f'本项目采用GNU General Public License v3开源许可证,请勿用于商业用途') | ||
log('版本: 1.3.0') | ||
log(f'项目Github仓库: https://github.com/ikunshare/Onekey') | ||
log('官网: ikunshare.com') | ||
log('本项目完全开源免费, 如果你在淘宝, QQ群内通过购买方式获得, 赶紧回去骂商家死全家\n交流群组:\n https://t.me/ikunshare_qun') | ||
log('如果本项目中的Emoji(即表情包)无法正常显示, 请使用支持Emoji的终端(例如Windows Terminal)') | ||
log.info(f'作者: {Fore.RED}{Back.BLACK}{Style.BRIGHT}ikun0014{Style.RESET_ALL}') | ||
log.info(f'{Fore.RED}{Back.BLACK}{Style.BRIGHT}本项目采用GNU General Public License v3开源许可证,请勿用于商业用途{Style.RESET_ALL}') | ||
log.info('版本: 1.2.9') | ||
log.info(f'{Fore.RED}{Back.BLACK}{Style.BRIGHT}项目Github仓库: https://github.com/ikunshare/Onekey{Style.RESET_ALL}') | ||
log.info('官网: ikunshare.com') | ||
log.warning('本项目完全开源免费, 如果你在淘宝, QQ群内通过购买方式获得, 赶紧回去骂商家死全家\n交流群组:\n https://t.me/ikunshare_qun') | ||
log.warning('如果本项目中的Emoji(即表情包)无法正常显示, 请使用支持Emoji的终端(例如Windows Terminal)') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
from terminaltexteffects.effects.effect_print import Print | ||
import logging | ||
import colorlog | ||
|
||
def logger(text): | ||
effect = Print(text) | ||
|
||
with effect.terminal_output() as terminal: | ||
for frame in effect: | ||
terminal.print(frame) | ||
LOG_FORMAT = '%(log_color)s[%(name)s][%(levelname)s]%(message)s' | ||
LOG_COLORS = { | ||
'INFO': 'cyan', | ||
'WARNING': 'yellow', | ||
'ERROR': 'red', | ||
'CRITICAL': 'purple', | ||
} | ||
|
||
def init_log(level=logging.DEBUG) -> logging.Logger: | ||
logger = logging.getLogger('Onekey') | ||
logger.setLevel(level) | ||
|
||
log = logger | ||
stream_handler = logging.StreamHandler() | ||
stream_handler.setLevel(level) | ||
|
||
fmt = colorlog.ColoredFormatter(LOG_FORMAT, log_colors=LOG_COLORS) | ||
stream_handler.setFormatter(fmt) | ||
|
||
# 避免重复添加处理器 | ||
if not logger.handlers: | ||
logger.addHandler(stream_handler) | ||
|
||
return logger | ||
|
||
|
||
log = init_log() |
Oops, something went wrong.