Skip to content

Commit 7b663ae

Browse files
committed
feat: error message
1 parent 9e59a9e commit 7b663ae

File tree

4 files changed

+57
-44
lines changed

4 files changed

+57
-44
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
你可能需要使用管理员权限运行。
2020

21+
***不要打开除了Watt Toolkit之外的所有可能干扰网络连接的软件,包括Clash/游戏加速器/网络连接管理/下载加速器等,它们会干扰SSL验证。***
22+
2123
## 源代码运行
2224
克隆仓库。
2325

@@ -29,7 +31,7 @@
2931

3032
## 从Github自动下载
3133
如果你要添加的仓库有pgpl.yaml文件,你可以在添加配置时输入Github仓库地址,从而自动下载并识别远程仓库的配置文件。
32-
如果你在大陆,推荐使用Watt Toolkit加速Github。***极其强烈不推荐使用Clash***因为它会代理国内的部分链接
34+
如果你在大陆,推荐使用Watt Toolkit加速Github。***极其强烈不推荐使用Clash***因为它会干扰ssl验证
3335

3436
## 手动添加
3537
按照软件内说明操作。同时按照`设置配置`中的说明填写。

translation/generate_pot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
command=r''
77

88
command+='../main.py'
9+
command+=' ../utils.py'
910

1011
print(f'{command_head_en} {command}')
1112
os.system(f'{command_head_en} {command}')

translation/locale/zh_CN/LC_MESSAGES/zh_CN.po

Lines changed: 48 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
msgid ""
66
msgstr ""
77
"Project-Id-Version: \n"
8-
"POT-Creation-Date: 2023-07-07 22:01+0800\n"
9-
"PO-Revision-Date: 2023-07-07 22:01+0800\n"
8+
"POT-Creation-Date: 2023-07-12 18:27+0800\n"
9+
"PO-Revision-Date: 2023-07-12 18:28+0800\n"
1010
"Last-Translator: \n"
1111
"Language-Team: \n"
1212
"Language: zh_CN\n"
@@ -53,7 +53,7 @@ msgstr "展示版本"
5353
msgid "AutoUpdate is disabled, skip"
5454
msgstr "自动更新禁用,跳过"
5555

56-
#: ../main.py:145 ../main.py:170
56+
#: ../main.py:145 ../main.py:172
5757
msgid "Update Dependencies"
5858
msgstr "更新依赖"
5959

@@ -69,92 +69,87 @@ msgstr "检测Python"
6969
msgid "Update pip"
7070
msgstr "更新pip"
7171

72-
#: ../main.py:179
72+
#: ../main.py:181
7373
msgid "downloading url:"
7474
msgstr "下载url:"
7575

76-
#: ../main.py:242
76+
#: ../main.py:246
7777
msgid "Download python successfully, extract zip"
7878
msgstr "下载python成功,解压压缩包"
7979

80-
#: ../main.py:291
80+
#: ../main.py:295
8181
msgid "Download Successfully"
8282
msgstr "下载成功"
8383

84-
#: ../main.py:304
84+
#: ../main.py:308
8585
msgid "Please waiting, python is installing. It may cost a few minutes."
8686
msgstr "请等待,python正在安装。这可能需要几分钟。"
8787

88-
#: ../main.py:310
88+
#: ../main.py:314
8989
msgid "Python installed successfully. Cleaning."
9090
msgstr "Python安装成功。清理中。"
9191

92-
#: ../main.py:312
92+
#: ../main.py:316
9393
msgid "Python is installed."
9494
msgstr "Python已安装。"
9595

96-
#: ../main.py:325
97-
msgid ""
98-
"Please do not exit the program while python is being downloaded. If you "
99-
"accidentally quit or the installation fails, empty the . /toolkit/python "
100-
"folder in the corresponding folder and try again."
96+
#: ../main.py:335
97+
msgid "pip fail, reinstall python"
10198
msgstr ""
102-
"请不要在下载python时退出程序。如果你不小心退出了或安装失败,请清空./toolkit/"
103-
"python文件夹中的对应文件夹后重试。"
10499

105-
#: ../main.py:341 ../main.py:371
100+
#: ../main.py:354 ../main.py:384
106101
msgid "Input"
107102
msgstr "输入"
108103

109-
#: ../main.py:345 ../main.py:480
104+
#: ../main.py:358 ../main.py:493
110105
msgid "Options"
111106
msgstr "选项"
112107

113-
#: ../main.py:353
108+
#: ../main.py:366
114109
msgid "Illegal parameters"
115110
msgstr "非法参数"
116111

117-
#: ../main.py:361
112+
#: ../main.py:374
118113
msgid "Illegal parameters: Empty"
119114
msgstr "非法参数:空输入"
120115

121-
#: ../main.py:367
116+
#: ../main.py:380
122117
msgid "Illegal parameter type"
123118
msgstr "非法参数:无效类型"
124119

125-
#: ../main.py:391
120+
#: ../main.py:404
126121
msgid "download config from repo succ"
127122
msgstr "从仓库下载配置成功"
128123

129-
#: ../main.py:394
124+
#: ../main.py:407
130125
msgid "Invalid address"
131126
msgstr "无效链接"
132127

133-
#: ../main.py:403
128+
#: ../main.py:416
134129
msgid "possible configs:"
135130
msgstr "可能的配置"
136131

137-
#: ../main.py:406
132+
#: ../main.py:419
138133
msgid "end"
139134
msgstr "结束"
140135

141-
#: ../main.py:408
136+
#: ../main.py:421
142137
msgid ""
143138
"Do you want to edit or add config? If you do not need to edit or add config, "
144139
"just select other config, please enter `n` or enter directly."
145140
msgstr ""
146141
"你想编辑或添加配置吗?如果你不需要编辑或添加配置,只是选择其他配置,请输入"
147142
"`n'或直接按下回车。"
148143

149-
#: ../main.py:413
144+
#: ../main.py:426
150145
msgid "Please enter the config name."
151146
msgstr "请输入配置名"
152147

153-
#: ../main.py:414
148+
#: ../main.py:427
154149
msgid "Config will be created automatically if the file does not exist."
155150
msgstr "如果配置文件不存在将自动创建。"
156151

157-
#: ../main.py:416
152+
#: ../main.py:429
158153
msgid ""
159154
"If the repository has pre-configured files, you can also download the "
160155
"configuration file by entering the repository address directly. (if the "
@@ -163,50 +158,64 @@ msgstr ""
163158
"如果远程仓库有预先配置的文件,你也可以直接输入远程仓库地址下载配置文件。(远程"
164159
"仓库需要包含pgpl.yaml)"
165160

166-
#: ../main.py:422
161+
#: ../main.py:435
167162
msgid ""
168163
"If you do not want to change the settings, press enter directly on the "
169164
"option."
170165
msgstr "如果你不想修改,请在编辑选项时直接按下回车"
171166

172-
#: ../main.py:425
167+
#: ../main.py:438
173168
msgid "Please enter the launching config name."
174169
msgstr "请输入启动配置名"
175170

176-
#: ../main.py:469
171+
#: ../main.py:482
177172
msgid "Successfully edit config."
178173
msgstr "编辑配置成功。"
179174

180-
#: ../main.py:476
175+
#: ../main.py:489
181176
msgid "Current Config"
182177
msgstr "当前配置"
183178

184-
#: ../main.py:477
179+
#: ../main.py:490
185180
msgid "Do you want to edit settings or select other settings?"
186181
msgstr "你想要编辑设置或选择其他设置吗?"
187182

188-
#: ../main.py:480
183+
#: ../main.py:493
189184
msgid "After $t$ seconds without input, PGPL will automatically start."
190185
msgstr "无输入 $t$ 秒后,PGPL将自动启动。"
191186

192-
#: ../main.py:488
187+
#: ../main.py:501
193188
msgid "No config selected. A config must be selected."
194189
msgstr "未选择配置文件。必须选择配置文件。"
195190

196-
#: ../main.py:502
191+
#: ../main.py:515
197192
msgid "The program is free and open source on github"
198193
msgstr "该程序在github免费开源"
199194

200-
#: ../main.py:503
195+
#: ../main.py:516
201196
msgid ""
202197
"Please see the help file at https://github.com/infstellar/python-git-program-"
203198
"launcher"
204199
msgstr ""
205200
"请在https://github.com/infstellar/python-git-program-launcher查看使用说明"
206201

207-
#: ../main.py:515
202+
#: ../main.py:528
208203
msgid "Launching..."
209204
msgstr "启动中..."
210205

206+
#: ../utils.py:149
207+
msgid "Please check your NETWORK ENVIROUMENT and re-open Launcher.exe"
208+
msgstr ""
209+
"请检查你的网络环境,彻底关闭除了Watt Toolkit之外的所有可能干扰网络连接的软"
210+
"件,包括Clash/游戏加速器/网络连接管理/下载加速器等,然后重新打开Launcher.exe"
211+
212+
#~ msgid ""
213+
#~ "Please do not exit the program while python is being downloaded. If you "
214+
#~ "accidentally quit or the installation fails, empty the . /toolkit/python "
215+
#~ "folder in the corresponding folder and try again."
216+
#~ msgstr ""
217+
#~ "请不要在下载python时退出程序。如果你不小心退出了或安装失败,请清空./"
218+
#~ "toolkit/python文件夹中的对应文件夹后重试。"
219+
211220
#~ msgid "Generate PGPL.pth"
212221
#~ msgstr "生成PGPL.pth"

utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ def show_error(self, command=None, error_code=None):
146146
# self.show_config()
147147
logger.info("")
148148
logger.info(f"Last command: {command}\nerror_code: {error_code}")
149-
logger.info(
150-
"Please check your NETWORK ENVIROUMENT "
151-
"and re-open Launcher.exe"
152-
)
149+
logger.warning(t2t("Please check your NETWORK ENVIROUMENT and re-open Launcher.exe"))
150+
logger.warning(t2t("Please check your NETWORK ENVIROUMENT and re-open Launcher.exe"))
151+
logger.warning(t2t("Please check your NETWORK ENVIROUMENT and re-open Launcher.exe"))
153152

153+
@logger.catch(reraise=True)
154154
def execute(self, command, allow_failure=False, output=True, is_format=True):
155155
"""
156156
Args:
@@ -178,6 +178,7 @@ def execute(self, command, allow_failure=False, output=True, is_format=True):
178178
logger.info(f"[ failure ], error_code: {error_code}")
179179
self.show_error(command, error_code)
180180
raise ExecutionError
181+
181182
else:
182183
logger.info(f"[ success ]")
183184
return True

0 commit comments

Comments
 (0)