From c7cf7a4ee1a328363209d47e4281c7aec5bc58be Mon Sep 17 00:00:00 2001 From: portnov Date: Sun, 25 May 2008 09:17:58 +0000 Subject: [PATCH] Add --font option, to specify font (.ttf) file to use for labels. --- stats.py | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/stats.py b/stats.py index 107d494..a054bb3 100755 --- a/stats.py +++ b/stats.py @@ -2,6 +2,8 @@ # encoding: utf-8 import os +import sys +from getopt import getopt from copy import copy from math import sqrt @@ -207,6 +209,17 @@ class GUI(object): gtk.main() if __name__ == "__main__": + + fontopt = "" + if len(sys.argv) > 1: + opts,args = getopt(sys.argv[1:],"f:",["font="]) + for k,v in opts: + font = v + path = os.path.dirname(font) + fontname = os.path.basename(font) + fontopt = "-font " + ".".join(fontname.split(".")[:-1]) + os.putenv("GDFONTPATH",path) + VARS = [] data = [] l = 0 @@ -233,12 +246,12 @@ if __name__ == "__main__": s = sigma(data) write_script(data,M,s) - os.system("ploticus -maxproclines 20000 -png %s -o %s" % (TMPPLOT,TMPPNG)) + os.system("ploticus %s -maxproclines 20000 -png %s -o %s" % (fontopt,TMPPLOT,TMPPNG)) gui = GUI() gui.show(M,D,s) - os.remove(TMPPLOT) +# os.remove(TMPPLOT) os.remove(TMPPNG) print "MX: %s\nDX: %s\nσX: %s\n" % (M,D,s) -- 1.7.2.3