def _on_save(self, evt):
		if not self._wnd.Validate():
			return
		if not self._wnd.TransferDataFromWindow():
			return
		details = 0
		if self['rb_details_normal'].GetValue():
			details = 1
		elif self['rb_details_verbose'].GetValue():
			details = 2
		filename = self['tc_filename'].GetValue()
		try:
			with open(filename, 'wt') as dfile:
				if self['rb_format_txt'].GetValue():  # txt
					exporter.dump_tasks_to_text(self._tasks, details, output=dfile)
				else:  # csv
					exporter.dump_tasks_to_csv(self._tasks, details, output=dfile)
			msg.message_box_info(self._wnd, _("Export complete."))
		except IOError as error:
			msg.message_box_error_ex(self._wnd, _("Export Error."),
					str(error))
Exemple #2
0
def _print_csv_tasks_list(tasks, verbose):
	""" Export task list to stdout in cvs format. """
	from wxgtd.model import exporter
	exporter.dump_tasks_to_csv(tasks, verbose)