From a08a214fd008af824fb3bf7cbb4aa48896fa7e38 Mon Sep 17 00:00:00 2001 From: jacopods Date: Wed, 28 Feb 2018 23:43:35 -0500 Subject: [PATCH] Fix legend alignment on stepped keys --- import_keyboard.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/import_keyboard.py b/import_keyboard.py index 17a5310..fc6abba 100644 --- a/import_keyboard.py +++ b/import_keyboard.py @@ -751,13 +751,13 @@ def read(filepath): else: # set default values if they aren't set if "x2" not in key: - key["x2"] = 0 + key["x2"] = key["x"] if "y2" not in key: - key["y2"] = 0 + key["y2"] = key["y"] if "w2" not in key: - key["w2"] = 1 + key["w2"] = key["w"] if "h2" not in key: - key["h2"] = 1 + key["h2"] = key["h"] # check if we need the middle strip; # force middle strip for DCS and DSA @@ -1038,10 +1038,8 @@ def read(filepath): label_verticalCorrection = -0.1 if label_text in [",", ";", ".", "[", "]" ] else 0; - boxHeight = new_obj_tl.dimensions[ - 1] - (alignLegendsProfile(key["p"])[1] + alignLegendsProfile(key["p"])[3]) - boxWidth = new_obj_tl.dimensions[ - 0] - (alignLegendsProfile(key["p"])[0] + alignLegendsProfile(key["p"])[2]) + boxHeight = key["h"] - (alignLegendsProfile(key["p"])[1] + alignLegendsProfile(key["p"])[3]) + boxWidth = key["w"] - 0.05 - (alignLegendsProfile(key["p"])[0] + alignLegendsProfile(key["p"])[2]) new_label.data.text_boxes[0].width = boxWidth new_label.data.text_boxes[0].height = boxHeight + label_verticalCorrection * new_label.data.size @@ -1116,10 +1114,8 @@ def read(filepath): boxTop = key["y"] + alignLegendsProfile(key["p"])[1] boxLeft = -1 * key["x"] - alignLegendsProfile(key["p"])[0] - boxHeight = new_obj_tl.dimensions[ - 1] - (alignLegendsProfile(key["p"])[1] + alignLegendsProfile(key["p"])[3]) - boxWidth = new_obj_tl.dimensions[ - 0] - (alignLegendsProfile(key["p"])[0] + alignLegendsProfile(key["p"])[2]) + boxHeight = key["h"] - (alignLegendsProfile(key["p"])[1] + alignLegendsProfile(key["p"])[3]) + boxWidth = key["w"] - 0.05 - (alignLegendsProfile(key["p"])[0] + alignLegendsProfile(key["p"])[2]) new_label.data.text_boxes[0].width = boxWidth new_label.data.text_boxes[0].height = boxHeight