From e97c08a42bc1929e95c7f0b9fa971083f07bcab5 Mon Sep 17 00:00:00 2001 From: GeoffreyCoulaud Date: Mon, 19 Jun 2023 23:33:18 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Added=20debug=20info,=20improved?= =?UTF-8?q?=20messages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/importer/sources/location.py | 5 ++++- src/preferences.py | 10 ++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/importer/sources/location.py b/src/importer/sources/location.py index 545fe08..8374a20 100644 --- a/src/importer/sources/location.py +++ b/src/importer/sources/location.py @@ -1,3 +1,4 @@ +import logging from pathlib import Path from typing import Callable, Mapping, Iterable from os import PathLike @@ -73,7 +74,9 @@ class Location: raise UnresolvableLocationError() # Update the schema with the found candidate - shared.schema.set_string(self.schema_key, str(candidate)) + value = str(candidate) + shared.schema.set_string(self.schema_key, value) + logging.debug("Resolved value for schema key %s: %s", self.schema_key, value) def __getitem__(self, key: str): """Get the computed path from its key for the location""" diff --git a/src/preferences.py b/src/preferences.py index 7515c2f..2944bc8 100644 --- a/src/preferences.py +++ b/src/preferences.py @@ -17,7 +17,7 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -import os +import logging import re from pathlib import Path from shutil import rmtree @@ -267,17 +267,19 @@ class PreferencesWindow(Adw.PreferencesWindow): # Set the schema infix = "-cache" if location == "cache" else "" key = f"{source.id}{infix}-location" - shared.schema.set_string(key, str(path)) + value = str(path) + shared.schema.set_string(key, value) # Update the row self.update_source_action_row_paths(source) + logging.debug("User-set value for schema key %s: %s", key, value) # Bad picked location, inform user else: if location_name == "cache": - title = "Cache not found" + title = "Cache directory not found" subtitle_format = "Select the {} cache directory." else: - title = "Installation not found" + title = "Installation directory not found" subtitle_format = "Select the {} installation directory." dialog = create_dialog( self,