From dd9f7f9f5e5a85c5408807ac2f77a1832c9c821e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maria=20H=C3=B6ller?= Date: Fri, 27 Sep 2024 10:40:05 +0200 Subject: [PATCH 1/2] Resolve #1355, switching projects only if the new project is not already the current project --- activity_browser/actions/project/project_switch.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/activity_browser/actions/project/project_switch.py b/activity_browser/actions/project/project_switch.py index 3064625c6..d725b7a72 100644 --- a/activity_browser/actions/project/project_switch.py +++ b/activity_browser/actions/project/project_switch.py @@ -17,5 +17,12 @@ class ProjectSwitch(ABAction): @staticmethod @exception_dialogs def run(project_name: str): - bd.projects.set_current(project_name) - log.info(f"Brightway2 current project: {project_name}") + + # compare the new to the current project name and switch to the new one if the two are not the same + if not project_name == bd.projects.current: + bd.projects.set_current(project_name) + log.info(f"Brightway2 current project: {project_name}") + + # if the project to be switched to is already the current project, do nothing + else: + log.info(f"Brightway2 already selected: {project_name}") From ad7b9f1d2b99fd19db5afe00da0e4ada32bd1db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maria=20H=C3=B6ller?= Date: Fri, 27 Sep 2024 11:35:38 +0200 Subject: [PATCH 2/2] changing the log level from info to debug --- activity_browser/actions/project/project_switch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activity_browser/actions/project/project_switch.py b/activity_browser/actions/project/project_switch.py index d725b7a72..3a22b4095 100644 --- a/activity_browser/actions/project/project_switch.py +++ b/activity_browser/actions/project/project_switch.py @@ -25,4 +25,4 @@ def run(project_name: str): # if the project to be switched to is already the current project, do nothing else: - log.info(f"Brightway2 already selected: {project_name}") + log.debug(f"Brightway2 already selected: {project_name}")