Skip to content

Commit

Permalink
cs_keyboard.py: Skip invalid bindings (#12396)
Browse files Browse the repository at this point in the history
It is possible to remove Spices manually by removing the associated directories
rather than using the appropriate module. This results in the bindings still
being stored internally. When loading the Keyboard module and this scenario has
occurred, it results in a failure due to the matching files having been
removed. We leave the mappings internally so that if the matching Spice is
reinstalled, the previous settings will be retained.
  • Loading branch information
rcalixte authored Nov 3, 2024
1 parent 90fe77c commit c5d83f3
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,12 @@ def on_module_selected(self):
home = os.path.expanduser("~")
gettext.bindtextdomain(name, f"{home}/.local/share/locale")
gettext.textdomain(name)
with open(f"{home}/.local/share/cinnamon/{_type}/{name}/metadata.json", encoding="utf-8") as metadata:
json_data = json.load(metadata)
category_label = gettext.gettext(_(json_data["name"]))
try:
with open(f"{home}/.local/share/cinnamon/{_type}/{name}/metadata.json", encoding="utf-8") as metadata:
json_data = json.load(metadata)
category_label = gettext.gettext(_(json_data["name"]))
except FileNotFoundError:
continue
if not _id:
cat_label = category_label if category_label else name
CATEGORIES.append([cat_label, name, "spices", None, properties])
Expand Down

0 comments on commit c5d83f3

Please sign in to comment.