Improve resource pack downloading (#1042)
* Improve resource pack downloading Fixed trackback in GUI. Added message dialog to allow the user to retry downloading. * Reformatted
This commit is contained in:
parent
9a3d9c5a3a
commit
1e22d83a4b
@ -143,6 +143,7 @@ program_3d_edit.canvas.java_rp_failed=Failed to download the latest Java resourc
|
||||
program_3d_edit.canvas.java_rp_failed_default=Check your internet connection and restart Amulet.
|
||||
program_3d_edit.canvas.java_rp_failed_mac_certificates=The certificates to access the internet were not installed.\nRun the "Install Certificates.command" program that can be found in "Applications/Python 3.x".
|
||||
program_3d_edit.canvas.loading_resource_packs=Loading resource packs
|
||||
program_3d_edit.canvas.retry_download=Failed to download the resource pack. Do you want to retry?
|
||||
program_3d_edit.canvas.creating_texture_atlas=Creating texture atlas
|
||||
program_3d_edit.canvas.setting_up_renderer=Setting up renderer
|
||||
|
||||
|
@ -145,14 +145,18 @@ class BaseEditCanvas(EventCanvas):
|
||||
yield 0.1, lang.get(
|
||||
"program_3d_edit.canvas.downloading_java_vanilla_resource_pack"
|
||||
)
|
||||
while True:
|
||||
gen = get_java_vanilla_latest_iter()
|
||||
try:
|
||||
while True:
|
||||
yield next(gen) * 0.4 + 0.1
|
||||
except StopIteration as e:
|
||||
packs.append(e.value)
|
||||
break
|
||||
except Exception as e:
|
||||
if sys.platform == "darwin" and "CERTIFICATE_VERIFY_FAILED" in str(e):
|
||||
if sys.platform == "darwin" and "CERTIFICATE_VERIFY_FAILED" in str(
|
||||
e
|
||||
):
|
||||
msg = lang.get(
|
||||
"program_3d_edit.canvas.java_rp_failed_mac_certificates"
|
||||
)
|
||||
@ -163,6 +167,7 @@ class BaseEditCanvas(EventCanvas):
|
||||
exc_info=True,
|
||||
)
|
||||
wait = True
|
||||
tb = traceback.format_exc()
|
||||
|
||||
def show_error():
|
||||
nonlocal wait
|
||||
@ -171,7 +176,7 @@ class BaseEditCanvas(EventCanvas):
|
||||
self,
|
||||
lang.get("program_3d_edit.canvas.java_rp_failed"),
|
||||
f"{msg}\n{e}",
|
||||
traceback.format_exc(),
|
||||
tb,
|
||||
)
|
||||
dialog.ShowModal()
|
||||
dialog.Destroy()
|
||||
@ -182,6 +187,14 @@ class BaseEditCanvas(EventCanvas):
|
||||
while wait:
|
||||
time.sleep(0.1)
|
||||
|
||||
msg = wx.MessageDialog(
|
||||
self,
|
||||
lang.get("program_3d_edit.canvas.retry_download"),
|
||||
style=wx.YES_NO,
|
||||
)
|
||||
if msg.ShowModal() == wx.ID_NO:
|
||||
break
|
||||
|
||||
yield 0.5, lang.get("program_3d_edit.canvas.loading_resource_packs")
|
||||
packs += [pack for pack in user_packs if isinstance(pack, JavaResourcePack)]
|
||||
packs.append(get_java_vanilla_fix())
|
||||
|
Loading…
x
Reference in New Issue
Block a user