scripts/tpconv.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
New commits: commit eab2c16a8792a2a5ed564a9be73d122a96fc954a Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Tue May 12 15:39:34 2020 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue May 12 15:40:15 2020 +0200 scripts: switch to python3 in tpconv, allow custom DPI The wrap polygon in Writer does a pixel -> mm100 conversion at 72 DPI, it seems. Change-Id: I5e7c2d80e1c00aceffb37102042e103219076219 diff --git a/scripts/tpconv.py b/scripts/tpconv.py index ba65827..141db10 100755 --- a/scripts/tpconv.py +++ b/scripts/tpconv.py @@ -1,10 +1,11 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. # +import os import re import sys @@ -30,7 +31,7 @@ conv = { # We know that VirtualDevices use a DPI of 96. # Could use 'gtk.gdk.screen_get_default().get_resolution()' from pygtk. -conv['pixel'] = conv['inch'] / 96; +conv['pixel'] = conv['inch'] / int(os.environ.get("DPI", "96")); def convert(amount, fro, to): # convert to EMU @@ -43,10 +44,10 @@ def main(args): fro = args[2] to = args[4] except IndexError: - print "usage: tpconv <amount> <from> in <to>" + print("usage: tpconv <amount> <from> in <to>") return - print convert(amount, fro, to) + print(convert(amount, fro, to)) if __name__ == '__main__': main(sys.argv) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits