Compare commits

...

3 Commits

Author SHA1 Message Date
Dogukan Karatas c5e0dfa36b Merge pull request #287 from specklesystems/bilal/handle-no-account-state
Release workflow / Build Zip (push) Has been cancelled
Release workflow / deploy-installers (push) Has been cancelled
Bilal/handle no account state
2025-06-23 11:54:04 +02:00
Mucahit Bilal GOKER 1f72741b62 update collapse icon 2025-06-23 11:34:43 +03:00
Mucahit Bilal GOKER 0f8f7e02be Added error handling in get_active_workspace to return default workspace if no account is found for the given ID. 2025-06-23 11:14:09 +03:00
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -169,5 +169,5 @@ class SPECKLE_PT_main_panel(bpy.types.Panel):
# Settings button in the model card
row_1.operator(
"speckle.model_card_settings", text="", icon="THREE_DOTS"
"speckle.model_card_settings", text="", icon="COLLAPSEMENU"
).model_card_id = model_card.get_model_card_id()
@@ -104,6 +104,9 @@ def get_active_workspace(account_id: str) -> Optional[Dict[str, str]]:
retrieves the ID of the default workspace for a given account ID
"""
account = next((acc for acc in get_local_accounts() if acc.id == account_id), None)
if account is None:
print(f"No account found for ID: {account_id}, returning default workspace.")
return {"id": "personal", "name": "Personal Projects"}
client = SpeckleClient(host=account.serverInfo.url)
client.authenticate_with_account(account)
active_workspace = client.active_user.get_active_workspace()