def chartSimpleCalendar(self, dev, p_dict, k_dict, return_queue):
""""""
log = {'Threaddebug': [], 'Debug': [], 'Info': [], 'Warning': [], 'Critical': []}
try:
if self.verboseLogging:
log['Debug'].append(u"{0:<19}{1}".format("p_dict: ", [(k, v) for (k, v) in sorted(p_dict.items())]))
log['Debug'].append(u"{0:<19}{1}".format("k_dict: ", [(k, v) for (k, v) in sorted(k_dict.items())]))
import calendar
today = dt.datetime.today()
calendar.setfirstweekday(int(dev.pluginProps['firstDayOfWeek']))
cal = calendar.month(today.year, today.month)
ax = self.chartMakeFigure(350, 250, p_dict)
ax.text(0, 1, cal, transform=ax.transAxes, color=p_dict['fontColor'], fontname='Andale Mono', fontsize=dev.pluginProps['fontSize'], backgroundcolor=p_dict['faceColor'],
bbox=dict(pad=3), **k_dict['k_calendar'])
ax.axes.get_xaxis().set_visible(False)
ax.axes.get_yaxis().set_visible(False)
ax.axis('off') # uncomment this line to hide the box
if p_dict['fileName'] != '':
plt.savefig(u'{0}{1}'.format(p_dict['chartPath'], p_dict['fileName']), **k_dict['k_plot_fig'])
plt.clf()
plt.close('all')
return_queue.put({'Error': False, 'Log': log, 'Message': 'updated successfully.', 'Name': dev.name})
except UnicodeEncodeError as sub_error:
return_queue.put({'Error': True, 'Log': log, 'Message': sub_error, 'Name': dev.name})
except Exception as sub_error:
return_queue.put({'Error': True, 'Log': log, 'Message': sub_error, 'Name': dev.name})
评论列表
文章目录