From ad18f57d3c9dca5d2e8f11c3e344f09a87cd9f6f Mon Sep 17 00:00:00 2001 From: "radek.pasiok" Date: Tue, 9 Jul 2024 19:43:36 +0200 Subject: [PATCH] Sort workspaces list in new project wizard - this is mainly for support agents who need to find the right one in a list of more than 100 of them --- Mergin/create_project_wizard.py | 2 +- scripts/deploy_win.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Mergin/create_project_wizard.py b/Mergin/create_project_wizard.py index 27434527..c6158036 100644 --- a/Mergin/create_project_wizard.py +++ b/Mergin/create_project_wizard.py @@ -115,7 +115,7 @@ def initializePage(self): def populate_namespace_cbo(self): if self.parent.workspaces is not None: - for ws in self.parent.workspaces: + for ws in sorted(self.parent.workspaces, key=lambda x: x["name"].lower()): is_writable = ws.get("role", "owner") in ["owner", "admin", "writer"] self.project_owner_cbo.addItem(ws["name"], is_writable) diff --git a/scripts/deploy_win.py b/scripts/deploy_win.py index bf87f715..80a8a022 100644 --- a/scripts/deploy_win.py +++ b/scripts/deploy_win.py @@ -1,12 +1,15 @@ import os import shutil + +profile = "default" + this_dir = os.path.dirname(os.path.realpath(__file__)) home_dir = os.path.expanduser("~") -dest_dir_plug = os.path.join(home_dir, "AppData", "Roaming", "QGIS", "QGIS3", "profiles", "default", "python", "plugins", "Mergin") +dest_dir_plug = os.path.join(home_dir, "AppData", "Roaming", "QGIS", "QGIS3", "profiles", profile, "python", "plugins", "Mergin") print(dest_dir_plug) src_dir_plug = os.path.join(os.path.dirname(this_dir), "Mergin") try: shutil.rmtree(dest_dir_plug) except OSError: - pass # directory doesn't not exist + print("Could not remove Mergin") shutil.copytree(src_dir_plug, dest_dir_plug)