Skip to content

Commit

Permalink
[release]ui: 移除所有Emoji;修改日志格式看起来更Print
Browse files Browse the repository at this point in the history
  • Loading branch information
ikun0014 committed Oct 19, 2024
1 parent 738e0eb commit 3178303
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 29 deletions.
2 changes: 1 addition & 1 deletion common/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async def check_github_api_rate_limit(headers, session):
log.error('Github请求数检查失败, 网络错误')

except KeyboardInterrupt:
log.info("程序已退出")
log.info("\n 程序已退出")
except ClientError as e:
log.error(f'检查Github API 请求数失败,{stack_error(e)}')
except ConnectionTimeoutError as e:
Expand Down
2 changes: 1 addition & 1 deletion common/checkcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def checkcn():
return True

except KeyboardInterrupt:
log.info("程序已退出")
log.info("\n 程序已退出")
except requests.RequestException as e:
os.environ['IS_CN'] = 'yes'
log.warning('检查服务器位置失败,已忽略,自动认为你在中国大陆')
Expand Down
4 changes: 2 additions & 2 deletions common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async def gen_config_file():

log.info('🖱️ 程序可能为第一次启动或配置重置,请填写配置文件后重新启动程序')
except KeyboardInterrupt:
log.info("程序已退出")
log.info("\n 程序已退出")
except Exception as e:
log.error(f'配置文件生成失败,{stack_error(e)}')

Expand All @@ -35,7 +35,7 @@ async def load_config():
config = json.loads(await f.read())
return config
except KeyboardInterrupt:
log.info("程序已退出")
log.info("\n 程序已退出")
except Exception as e:
log.error(f"配置文件加载失败,原因: {stack_error(e)},重置配置文件中...")
os.remove("./config.json")
Expand Down
2 changes: 1 addition & 1 deletion common/dkey_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async def depotkey_merge(config_path: Path, depots_config: dict) -> bool:
return True

except KeyboardInterrupt:
log.info("程序已退出")
log.info("\n 程序已退出")
except Exception as e:
async with lock:
log.error(f'合并失败, 原因: {e}')
Expand Down
2 changes: 1 addition & 1 deletion common/get_manifest_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def get_manifest(sha: str, path: str, steam_path: Path, repo: str, session
]

except KeyboardInterrupt:
log.info("程序已退出")
log.info("\n 程序已退出")
except Exception as e:
log.error(f'处理失败: {path} - {stack_error(e)}')
raise
Expand Down
2 changes: 1 addition & 1 deletion common/get_steam_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def get_steam_path() -> Path:
custom_steam_path = config.get("Custom_Steam_Path", "").strip()
return Path(custom_steam_path) if custom_steam_path else steam_path
except KeyboardInterrupt:
log.info("程序已退出")
log.info("\n 程序已退出")
except Exception as e:
log.error(f'Steam路径获取失败, {stack_error(e)}, 请检查是否正确安装Steam')
os.system('pause')
Expand Down
27 changes: 13 additions & 14 deletions common/init_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@

def init():
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}",
f" _____ __ _ _____ _ _ _____ __ __ ",
f" / _ \\ | \\ | | | ____| | | / / | ____| \\ \\ / /",
f" | | | | | \\| | | |__ | |/ / | |__ \\ \\/ /",
f" | | | | | |\\ | | __| | |\\ \\ | __| \\ / ",
f" | |_| | | | \\ | | |___ | | \\ \\ | |___ / /",
f" \\_____/ |_| \\_| |_____| |_| \\_\\ |_____| /_/",
]
for line in banner_lines:
print(line)
log.info(line)

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.3.0')
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)')
log.info(f'作者: ikun0014')
log.warning(f'本项目采用GNU General Public License v3开源许可证,请勿用于商业用途')
log.info(f'版本: 1.3.0')
log.info(f'项目Github仓库: https://github.com/ikunshare/Onekey')
log.info(f'官网: ikunshare.com')
log.warning(f'本项目完全开源免费, 如果你在淘宝, QQ群内通过购买方式获得, 赶紧回去骂商家死全家\n 交流群组:\n https://t.me/ikunshare_qun')
2 changes: 1 addition & 1 deletion common/log.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import colorlog

LOG_FORMAT = '%(log_color)s[%(name)s][%(levelname)s]%(message)s'
LOG_FORMAT = '%(log_color)s%(message)s'
LOG_COLORS = {
'INFO': 'cyan',
'WARNING': 'yellow',
Expand Down
2 changes: 1 addition & 1 deletion common/main_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async def fetch_branch_info(session, url, headers):
async with session.get(url, headers=headers, ssl=False) as response:
return await response.json()
except KeyboardInterrupt:
log.info("程序已退出")
log.info("\n 程序已退出")
except Exception as e:
log.error(f'获取信息失败: {stack_error(e)}')
return None
Expand Down
2 changes: 1 addition & 1 deletion common/manifest_down.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async def get(sha: str, path: str, repo: str, session, chunk_size: int = 1024) -
else:
log.error(f'获取失败: {path} - 状态码: {response.status}')
except KeyboardInterrupt:
log.info("程序已退出")
log.info("\n 程序已退出")
except ClientError as e:
log.error(f'获取失败: {path} - 连接错误: {str(e)}')
except ConnectionTimeoutError as e:
Expand Down
2 changes: 1 addition & 1 deletion common/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def download_setup_file(session) -> None:
else:
log.error('网络错误,无法下载安装程序')
except KeyboardInterrupt:
log.info("程序已退出")
log.info("\n 程序已退出")
except Exception as e:
log.error(f'下载失败: {e}')
except ConnectionTimeoutError as e:
Expand Down
2 changes: 1 addition & 1 deletion common/st_unlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def stool_add(depot_data: list, app_id: str) -> bool:

log.info('处理完成')
except KeyboardInterrupt:
log.info("程序已退出")
log.info("\n 程序已退出")
except Exception as e:
log.error(f'处理过程出现错误: {e}')
return False
Expand Down
6 changes: 3 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def main_loop():
app_id = prompt_app_id()
await main(app_id, repos)
except KeyboardInterrupt:
log.info("程序已退出")
log.info("\n 程序已退出")
except EOFError:
break

Expand All @@ -43,7 +43,7 @@ async def run():
log.info('App ID可以在SteamDB或Steam商店链接页面查看')
await main_loop()
except KeyboardInterrupt:
log.info("程序已退出")
log.info("\n 程序已退出")
except Exception as e:
log.error(f'发生错误: {stack_error(e)}, 将在5秒后退出')
await asyncio.sleep(5)
Expand All @@ -52,6 +52,6 @@ async def run():
try:
asyncio.run(run())
except KeyboardInterrupt:
log.info("程序已退出")
log.info("\n 程序已退出")
except SystemExit:
sys.exit()

0 comments on commit 3178303

Please sign in to comment.