lot of fixes
diff --git a/chart/__init__.py b/chart/__init__.py
index 91f24c6..cd49ed9 100644
--- a/chart/__init__.py
+++ b/chart/__init__.py
@@ -1,9 +1,8 @@
-# Patch MARKER constant
-
import sys
-from GChartWrapper import constants
-import GChartWrapper.GChart
+from GChartWrapper import constants
+
+# Patch MARKER constant
constants.MARKERS += 'E'
-print sys.modules['GChartWrapper.GChart']
+
sys.modules['GChartWrapper.GChart'].MARKERS += 'E'
diff --git a/chart/charts.py b/chart/charts.py
index 549b820..7c49abd 100644
--- a/chart/charts.py
+++ b/chart/charts.py
@@ -1,5 +1,5 @@
-import hashlib
import os
+import hashlib
import threading
from GChartWrapper import VerticalBarGroup
@@ -13,10 +13,9 @@
constants.MARKERS += 'E' # append E marker to available markers
-def save_image(chart, img_path):
- t = threading.Thread(target=chart.save, kwargs={'fname': img_path})
- t.daemon = True
- t.start()
+def get_top_top_dir(path):
+ top_top_dir = os.path.dirname(os.path.dirname(path))
+ return path[len(top_top_dir) + 1:]
def render_vertical_bar(title, legend, bars_data, bars_dev_top,
@@ -106,10 +105,11 @@
bar.scale(*scale)
img_name = hashlib.md5(str(bar)).hexdigest() + ".png"
img_path = os.path.join(cfg_dict['charts_img_path'], img_name)
+
if not os.path.exists(img_path):
- save_image(bar, img_path)
- return str(bar)
- return img_path
+ bar.save(img_path)
+
+ return get_top_top_dir(img_path)
def render_lines(title, legend, dataset, scale_x, width=700, height=400):
@@ -129,6 +129,6 @@
img_name = hashlib.md5(str(line)).hexdigest() + ".png"
img_path = os.path.join(cfg_dict['charts_img_path'], img_name)
if not os.path.exists(img_path):
- save_image(line, img_path)
- return str(line)
- return img_path
+ line.save(img_path)
+
+ return get_top_top_dir(img_path)