Addon Manager: Ensure cache is rebuilt after firstrun dialog

This commit is contained in:
Chris Hennes
2021-12-31 20:19:52 -06:00
parent 024e404a0e
commit 70c9804fc0
2 changed files with 9 additions and 3 deletions

View File

@@ -24,7 +24,6 @@
# * *
# ***************************************************************************
from inspect import indentsize
import os
import shutil
import stat
@@ -155,6 +154,8 @@ class CommandAddonManager:
"DownloadMacros",
warning_dialog.checkBoxDownloadMacroMetadata.isChecked(),
)
if warning_dialog.checkBoxDownloadMacroMetadata.isChecked():
self.trigger_recache = True
selected_proxy_option = warning_dialog.comboBoxProxy.currentIndex()
if selected_proxy_option == 0:
pref.SetBool("NoProxyCheck", True)
@@ -202,6 +203,8 @@ class CommandAddonManager:
# 0: Update every launch
# >0: Update every n days
self.update_cache = False
if hasattr(self, "trigger_recache") and self.trigger_recache:
self.update_cache = True
update_frequency = pref.GetInt("UpdateFrequencyComboEntry", 0)
if update_frequency == 0:
days_between_updates = -1

View File

@@ -198,7 +198,10 @@ class Macro(object):
return
response = ""
block = 8192
while data := u2.read(block):
while True:
data = u2.read(block)
if not data:
break
if isinstance(data, bytes):
data = data.decode("utf-8")
response += data
@@ -232,7 +235,7 @@ class Macro(object):
FreeCAD.Console.PrintWarning(
translate(
"AddonsInstaller",
"Unable to retrieve a description for this macro.",
f"Unable to retrieve a description from the wiki for macro {self.name}",
)
+ "\n"
)