🐛 Added debug info, improved messages
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Callable, Mapping, Iterable
|
from typing import Callable, Mapping, Iterable
|
||||||
from os import PathLike
|
from os import PathLike
|
||||||
@@ -73,7 +74,9 @@ class Location:
|
|||||||
raise UnresolvableLocationError()
|
raise UnresolvableLocationError()
|
||||||
|
|
||||||
# Update the schema with the found candidate
|
# 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):
|
def __getitem__(self, key: str):
|
||||||
"""Get the computed path from its key for the location"""
|
"""Get the computed path from its key for the location"""
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
import os
|
import logging
|
||||||
import re
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
@@ -267,17 +267,19 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
|||||||
# Set the schema
|
# Set the schema
|
||||||
infix = "-cache" if location == "cache" else ""
|
infix = "-cache" if location == "cache" else ""
|
||||||
key = f"{source.id}{infix}-location"
|
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
|
# Update the row
|
||||||
self.update_source_action_row_paths(source)
|
self.update_source_action_row_paths(source)
|
||||||
|
logging.debug("User-set value for schema key %s: %s", key, value)
|
||||||
|
|
||||||
# Bad picked location, inform user
|
# Bad picked location, inform user
|
||||||
else:
|
else:
|
||||||
if location_name == "cache":
|
if location_name == "cache":
|
||||||
title = "Cache not found"
|
title = "Cache directory not found"
|
||||||
subtitle_format = "Select the {} cache directory."
|
subtitle_format = "Select the {} cache directory."
|
||||||
else:
|
else:
|
||||||
title = "Installation not found"
|
title = "Installation directory not found"
|
||||||
subtitle_format = "Select the {} installation directory."
|
subtitle_format = "Select the {} installation directory."
|
||||||
dialog = create_dialog(
|
dialog = create_dialog(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user