After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 549604 - Export report to csv / spreadsheet
Export report to csv / spreadsheet
Status: RESOLVED FIXED
Product: hamster-applet
Classification: Deprecated
Component: usability
0.6
Other All
: Normal enhancement
: ---
Assigned To: Juanje Ojeda
hamster-applet-maint
: 531342 580661 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-08-27 17:24 UTC by Ben Friedberg
Modified: 2009-06-07 11:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
CSV report added (7.82 KB, patch)
2008-08-28 11:53 UTC, Juanje Ojeda
none Details | Review

Description Ben Friedberg 2008-08-27 17:24:06 UTC
I enter my time from Hamster into a time-tracking spreadsheet.  CSV export would be a great time-saver and would make filtration / formatting much easier...
Comment 1 Juanje Ojeda 2008-08-28 11:53:21 UTC
Created attachment 117519 [details] [review]
CSV report added

Hi Ben,

Actually I was working on it, because I need it as well for the work. But I was trying to approach this not just as a another specific export thing, but as a more general way to show the stats.

In that way I was working on bug #531342. But all this will be on the next release, now we are on GNOME release process, so we can't ship out any change on the main version. 

Anyway, for the meantime I attach a simple change to export a CSV report. It just adds a button on the stats dialog for it and export a simple csv report, just as the HTML one does.

I hope this help a bit by now.
Comment 2 Ben Friedberg 2008-08-28 13:03:26 UTC
Thanks Juanje!  I appreciate the help!
Comment 3 Toms Bauģis 2009-02-18 11:46:46 UTC
*** Bug 531342 has been marked as a duplicate of this bug. ***
Comment 4 Toms Bauģis 2009-06-06 20:33:23 UTC
*** Bug 580661 has been marked as a duplicate of this bug. ***
Comment 5 Toms Bauģis 2009-06-06 20:41:07 UTC
Rudimentary XML export as well as TSV (tab separated values) is now in git master branch. Went with TSV because that should be a weeny bit safer than CSV in parsing (commas ar common for descriptions, but not tabs - didn't want to bother with escapes there).

Export is accessible via the save button in overview.

So, errrm, hooray and such.
Comment 6 Patryk Zawadzki 2009-06-07 00:26:41 UTC
Uhm, couldn't you just "import csv" and use csv.writer to do all the job?
Comment 7 Toms Bauģis 2009-06-07 09:43:11 UTC
hahah,i had no idea that there is such thing!

thanks for checking out the commit, fixed now!
Comment 8 Patryk Zawadzki 2009-06-07 10:54:18 UTC
One more thing, you need to wrap writer.writerow in a small function that does .encode('utf-8') on all unicode objects before passing them. Something like:

def csv_prefilter(data):
	for row in data:
		ret = []
		for field in row:
			if type(field) is unicode:
				result = field.encode('utf-8')
			elif field is None:
				result = ''
			else:
				result = str(field)
			ret.append(result)
		yield ret

That's because python csv module can't handle unicode yet (see "Note" at http://docs.python.org/library/csv.html).
Comment 9 Toms Bauģis 2009-06-07 11:28:54 UTC
Although it seems to work fine with unicode chars even without encode, i added it to name, category and description.
Also turned the whole thing somewhat more class oriented and added a lame iCal export.

There will be bugs (well, maybe, naturally) :)