diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-01-15 17:22:58 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-01-21 20:37:49 +0100 |
commit | 5143de38cffb353a99adf354fab47bbbc66b9df7 (patch) | |
tree | aa567fb76140647c893c082f44b12a68e9599cbc /bin | |
parent | f9b2db53b111d59f3cf9704ab49321e148616897 (diff) |
remove deprecated [x|y]align property for CheckBoxes and RadioButtons
the gtk default is left aligned, change the vcl one to match and drop
the deprecated and unnecessary [x|y]align
Unfortunately on load glade's inline preview shows centered alignment, though
its "true" preview tool shows left alignment and unsetting and resetting
draw-indicator will update the preview to show the alignment which will
be used: https://gitlab.gnome.org/GNOME/glade/-/issues/502
See https://gitlab.gnome.org/GNOME/glade/-/merge_requests/110 for my
stab at making glade do the right thing.
Change-Id: If454e9ce8462e6b271d2423fe7e8a55788e01fac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109487
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ui-converter-skeleton.py | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/bin/ui-converter-skeleton.py b/bin/ui-converter-skeleton.py index e16b4a7b6e09..ac27eb5304af 100755 --- a/bin/ui-converter-skeleton.py +++ b/bin/ui-converter-skeleton.py @@ -72,7 +72,7 @@ def do_replace_button_use_stock(current, use_stock, use_underline, label, insert elif label.text == 'gtk-yes': label.text = "_Yes" else: - raise("unknown label") + raise Exception(sys.argv[1] + ': unknown label', label.text) def replace_button_use_stock(current): use_underline = False @@ -145,7 +145,7 @@ def do_replace_image_stock(current, stock): elif stock.text == 'gtk-help': stock.text = "help-browser" else: - raise("unknown stock name") + raise Exception(sys.argv[1] + ': unknown stock name', stock.text) def replace_image_stock(current): stock = None @@ -162,6 +162,31 @@ def replace_image_stock(current): if isimage and stock != None: do_replace_image_stock(current, stock) +def remove_check_button_align(current): + xalign = None + yalign = None + ischeckorradiobutton = current.get('class') == "GtkCheckButton" or current.get('class') == "GtkRadioButton" + for child in current: + remove_check_button_align(child) + if not ischeckorradiobutton: + continue + if child.tag == "property": + attributes = child.attrib + if attributes.get("name") == "xalign": + xalign = child + if attributes.get("name") == "yalign": + yalign = child + + if ischeckorradiobutton: + if xalign != None: + if xalign.text != "0": + raise Exception(sys.argv[1] + ': non-default xalign', xalign.text) + current.remove(xalign) + if yalign != None: + if yalign.text != "0.5": + raise Exception(sys.argv[1] + ': non-default yalign', yalign.text) + current.remove(yalign) + with open(sys.argv[1], encoding="utf-8") as f: header = f.readline() firstline = f.readline() @@ -187,6 +212,7 @@ if not sys.argv[1].endswith('/multiline.ui'): # let this one alone not truncate add_truncate_multiline(root) replace_button_use_stock(root) replace_image_stock(root) +remove_check_button_align(root) with open(sys.argv[1], 'wb') as o: # without encoding='unicode' (and the matching encode("utf8")) we get &#XXXX replacements for non-ascii characters |