Add --font option, to specify font (.ttf) file to use for labels.
Add --font option, to specify font (.ttf) file to use for labels.
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)