Addon Manager: Add error checking for proxy setup

Also make a minor tweak to the enabled status of the check all for updates button.
This commit is contained in:
Chris Hennes
2022-02-18 08:37:20 -06:00
parent 13fb62fc3f
commit f28278dca5
2 changed files with 23 additions and 1 deletions

View File

@@ -340,7 +340,6 @@ class CommandAddonManager:
)
)
# If we are checking for updates automatically, hide the Check for updates button:
autocheck = pref.GetBool("AutoCheck", False)
if autocheck:
@@ -772,6 +771,7 @@ class CommandAddonManager:
translate("AddonsInstaller", "Checking for updates...")
)
self.dialog.buttonUpdateAll.show()
self.dialog.buttonCheckForUpdates.setDisabled(True)
self.check_worker = CheckWorkbenchesForUpdatesWorker(self.item_model.repos)
self.check_worker.finished.connect(self.do_next_startup_phase)
self.check_worker.finished.connect(self.update_check_complete)
@@ -812,6 +812,7 @@ class CommandAddonManager:
def update_check_complete(self) -> None:
self.enable_updates(len(self.packages_with_updates))
self.dialog.buttonCheckForUpdates.setEnabled(True)
def add_addon_repo(self, addon_repo: AddonManagerRepo) -> None:
"""adds a workbench to the list"""

View File

@@ -173,6 +173,26 @@ if HAVE_QTNETWORK:
systemProxyCheck = pref.GetBool("SystemProxyCheck", systemProxyCheck)
userProxyCheck = pref.GetBool("UserProxyCheck", userProxyCheck)
proxy_string = pref.GetString("ProxyUrl", "")
# Add some error checking to the proxy setup, since for historical reasons they
# are indepdendent booleans, rather than an enumeration:
count = [noProxyCheck, systemProxyCheck, userProxyCheck].count(True)
if count != 1:
FreeCAD.Console.PrintWarning(translate("AddonsInstaller","Parameter error: mutually exclusive proxy options set. Resetting to default.") + "\n")
noProxyCheck = True
systemProxyCheck = False
userProxyCheck = False
pref.SetBool("NoProxyCheck", noProxyCheck)
pref.SetBool("SystemProxyCheck", systemProxyCheck)
pref.SetBool("UserProxyCheck", userProxyCheck)
if userProxyCheck and not proxy_string:
FreeCAD.Console.PrintWarning(translate("AddonsInstaller","Parameter error: user proxy indicated, but no proxy provided. Resetting to default.") + "\n")
noProxyCheck = True
userProxyCheck = False
pref.SetBool("NoProxyCheck", noProxyCheck)
pref.SetBool("UserProxyCheck", userProxyCheck)
else:
print("Please select a proxy type:")
print("1) No proxy")
@@ -191,6 +211,7 @@ if HAVE_QTNETWORK:
else:
print(f"Got {result}, expected 1, 2, or 3.")
app.quit()
if noProxyCheck:
pass