🐛 Added debug info, improved messages

This commit is contained in:
GeoffreyCoulaud
2023-06-19 23:33:18 +02:00
parent e57a2a74df
commit e97c08a42b
2 changed files with 10 additions and 5 deletions

View File

@@ -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"""

View File

@@ -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,