Skip to content

Commit d58b366

Browse files
committed
Cleanup to run AM outside FreeCAD
1 parent 514e5bf commit d58b366

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

addonmanager_cache.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: LGPL-2.1-or-later
22
# ***************************************************************************
33
# * *
4-
# * Copyright (c) 2022-2023 FreeCAD Project Association *
4+
# * Copyright (c) 2022-2025 The FreeCAD project association AISBL *
55
# * *
66
# * This file is part of FreeCAD. *
77
# * *
@@ -77,7 +77,7 @@ def _days_between_updates() -> int:
7777

7878

7979
def _cache_exists() -> bool:
80-
cache_path = fci.getUserCachePath()
80+
cache_path = fci.DataPaths().cache_dir
8181
am_path = os.path.join(cache_path, "AddonManager")
8282
return os.path.exists(am_path)
8383

@@ -94,20 +94,20 @@ def _last_update_was_interrupted(reset_status: bool) -> bool:
9494
)
9595
)
9696
return True
97+
return False
9798

9899

99100
def _custom_repo_list_changed() -> bool:
100-
pref = fci.ParamGet("User parameter:BaseApp/Preferences/Addons")
101-
stored_hash = pref.GetString("CustomRepoHash", "")
102-
custom_repos = pref.GetString("CustomRepositories", "")
101+
stored_hash = fci.Preferences().get("CustomRepoHash")
102+
custom_repos = fci.Preferences().get("CustomRepositories")
103103
if custom_repos:
104104
hasher = hashlib.sha1()
105105
hasher.update(custom_repos.encode("utf-8"))
106106
new_hash = hasher.hexdigest()
107107
else:
108108
new_hash = ""
109109
if new_hash != stored_hash:
110-
pref.SetString("CustomRepoHash", new_hash)
110+
fci.Preferences().set("CustomRepoHash", new_hash)
111111
fci.Console.PrintMessage(
112112
translate(
113113
"AddonsInstaller",

addonmanager_connection_checker.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,13 @@ def __init__(self):
5151

5252
def start(self):
5353
"""Start the connection check"""
54-
self.connection_checker.start()
5554
self.connection_checker.success.connect(self._check_succeeded)
5655
self.connection_checker.failure.connect(self._network_connection_failed)
5756
self.signals_connected = True
57+
self.connection_checker.start()
5858

5959
# If it takes longer than a half second to check the connection, show a message:
60-
self.connection_message_timer = QtCore.QTimer.singleShot(
61-
500, self._show_connection_check_message
62-
)
60+
QtCore.QTimer.singleShot(500, self._show_connection_check_message)
6361

6462
def _show_connection_check_message(self):
6563
"""Display a message informing the user that the check is in process"""

addonmanager_preferences_defaults.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"https://raw.githubusercontent.com/FreeCAD/FreeCAD-addons/master/.gitmodules",
3434
"ProxyUrl": "",
3535
"RemoteIconCacheURL": "https://addons.freecad.org/icon_cache.zip",
36+
"SearchString": "",
3637
"SelectedAddon": "",
3738
"ShowBranchSwitcher": false,
3839
"StatusSelection": 0,

main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@ def run_addon_manager():
5050

5151
if __name__ == "__main__":
5252
QtCore.QTimer.singleShot(0, run_addon_manager)
53+
app.setQuitOnLastWindowClosed(False)
5354
app.exec()
5455
sys.exit()

0 commit comments

Comments
 (0)