Merge pull request #2902 from expsa/younes_dev_odex25_project
IMP Project Status Report to project module for tracking project prog…
This commit is contained in:
commit
fb21eefb4c
|
|
@ -186,6 +186,7 @@
|
|||
width: 100%;
|
||||
padding-right: 15px;
|
||||
margin-top: 20px;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
</style>
|
||||
<div class="page">
|
||||
|
|
|
|||
|
|
@ -55,17 +55,17 @@ class ReportProjectStatus(models.AbstractModel):
|
|||
_logger.warning("All task counts are zero, using dummy data")
|
||||
task_data = {'new': 1, 'in_progress': 1, 'done': 1}
|
||||
|
||||
font_path = os.path.join(os.path.dirname(__file__), 'img', 'amiri-regular.ttf')
|
||||
if not os.path.exists(font_path):
|
||||
font_path = get_module_resource('project_base', 'static/fonts', 'amiri-regular.ttf')
|
||||
if not font_path:
|
||||
_logger.warning("Arabic font not found. Using default font.")
|
||||
font_path = None
|
||||
|
||||
if font_path:
|
||||
prop = matplotlib.font_manager.FontProperties(fname=font_path)
|
||||
else:
|
||||
prop = None
|
||||
# font_path = os.path.join(os.path.dirname(__file__), 'img', 'amiri-regular.ttf')
|
||||
# if not os.path.exists(font_path):
|
||||
# font_path = get_module_resource('project_base', 'static/fonts', 'amiri-regular.ttf')
|
||||
# if not font_path:
|
||||
# _logger.warning("Arabic font not found. Using default font.")
|
||||
# font_path = None
|
||||
#
|
||||
# if font_path:
|
||||
# prop = matplotlib.font_manager.FontProperties(fname=font_path)
|
||||
# else:
|
||||
# prop = None
|
||||
|
||||
fig = plt.figure(figsize=(5, 4))
|
||||
|
||||
|
|
@ -80,11 +80,13 @@ class ReportProjectStatus(models.AbstractModel):
|
|||
colors = ['#f0312e', '#add8e6', '#90ee90']
|
||||
|
||||
plt.pie(sizes, labels=labels, autopct='%1.1f%%', colors=colors, startangle=90,
|
||||
textprops={'fontproperties': prop, 'fontsize': 16} if prop else {'fontsize': 16})
|
||||
textprops= {'fontsize': 16})
|
||||
# {'fontproperties': prop, 'fontsize': 16} if prop else
|
||||
plt.axis('equal')
|
||||
plt.rcParams['font.size'] = 18
|
||||
title_text = format_arabic('احصائيات المهام')
|
||||
plt.title(title_text, fontproperties=prop if prop else None)
|
||||
plt.title(title_text)
|
||||
# fontproperties = prop if prop else None
|
||||
|
||||
buffer = io.BytesIO()
|
||||
plt.savefig(buffer, format='png', bbox_inches='tight', dpi=300)
|
||||
|
|
|
|||
Loading…
Reference in New Issue