mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-26 17:47:40 +00:00
fix(linux/config): Display dialog when metadata is invalid
This commit is contained in:
parent
5ff61520e6
commit
f95acb6b98
2 changed files with 16 additions and 2 deletions
|
|
@ -45,7 +45,17 @@ class KeyboardDetailsView(Gtk.Dialog):
|
|||
info, system, options, keyboards, files = parsemetadata(kmp_json)
|
||||
|
||||
if info is None:
|
||||
raise Exception(_("could not parse kmp.json"), kmp['packageID'], packageDir, kmp_json)
|
||||
# Dialog when invalid metadata
|
||||
self.add_button(_("_Close"), Gtk.ResponseType.CLOSE)
|
||||
grid = Gtk.Grid()
|
||||
self.get_content_area().pack_start(grid, True, True, 12)
|
||||
lbl_invalid_metadata = Gtk.Label()
|
||||
lbl_invalid_metadata.set_text(_("ERROR: Could not parse kmp.json in " + packageDir))
|
||||
lbl_invalid_metadata.set_halign(Gtk.Align.END)
|
||||
grid.add(lbl_invalid_metadata)
|
||||
self.resize(700, 200)
|
||||
self.show_all()
|
||||
return
|
||||
|
||||
kbdata = None
|
||||
jsonfile = os.path.join(packageDir, kmp['packageID'] + ".json")
|
||||
|
|
|
|||
|
|
@ -446,7 +446,11 @@ def parsemetadata(jsonfile, verbose=False):
|
|||
data = json.load(read_file)
|
||||
except JSONDecodeError as e:
|
||||
logging.error("parsemetadata: " + jsonfile + " invalid")
|
||||
sys.exit(1)
|
||||
# Use empty details
|
||||
data = {"nonexistent": "none"}
|
||||
keyboards = []
|
||||
files = []
|
||||
|
||||
for x in data:
|
||||
if x == 'info':
|
||||
info = data[x]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue