Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLipu Fei <lipu.fei815@gmail.com>2018-09-13 11:55:33 +0300
committerLipu Fei <lipu.fei815@gmail.com>2018-09-13 11:55:37 +0300
commite629ea89ffe7e30c1f766bcf65492bf3b5be443b (patch)
tree5caa00b7c03f4d9945788f6a4f75ec05182c9e0b /scripts
parent7ec62315e0a5ca5e79bcb9219c10951a0a81af08 (diff)
Improve shortcut check script
CURA-5642 More information in the output.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/check_shortcut_keys.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/scripts/check_shortcut_keys.py b/scripts/check_shortcut_keys.py
index 2796002c3f..a47a8143f7 100644
--- a/scripts/check_shortcut_keys.py
+++ b/scripts/check_shortcut_keys.py
@@ -85,10 +85,12 @@ class ShortcutKeysChecker:
msg_section = data_dict[self.MSGCTXT]
keys_dict = shortcut_dict[msg_section]
if shortcut_key not in keys_dict:
- keys_dict[shortcut_key] = dict()
- existing_data_dict = keys_dict[shortcut_key]
+ keys_dict[shortcut_key] = {"shortcut_key": shortcut_key,
+ "section": msg_section,
+ "existing_lines": dict(),
+ }
+ existing_data_dict = keys_dict[shortcut_key]["existing_lines"]
existing_data_dict[start_line] = {"message": msg,
- "shortcut_key": shortcut_key,
}
def _get_shortcut_key(self, text: str) -> Optional[str]:
@@ -105,16 +107,18 @@ class ShortcutKeysChecker:
has_duplicates = False
for keys_dict in shortcut_dict.values():
for shortcut_key, data_dict in keys_dict.items():
- if len(data_dict) == 1:
+ if len(data_dict["existing_lines"]) == 1:
continue
has_duplicates = True
print("")
print("The following messages have the same shortcut key '%s':" % shortcut_key)
- for line, msg in data_dict.items():
+ print(" shortcut: '%s'" % data_dict["shortcut_key"])
+ print(" section : '%s'" % data_dict["section"])
+ for line, msg in data_dict["existing_lines"].items():
relative_filename = (filename.rsplit("..", 1)[-1])[1:]
- print(" - [%s] L%7d : [%s]" % (relative_filename, line, msg))
+ print(" - [%s] L%7d : '%s'" % (relative_filename, line, msg["message"]))
return has_duplicates