GTG

Merge lp:~chihchun/gtg/gtg-lp1102453 into lp:~gtg/gtg/old-trunk

Proposed by Rex Tsai
Status: Merged
Merged at revision: 1310
Proposed branch: lp:~chihchun/gtg/gtg-lp1102453
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: 40 lines (+10/-6)
1 file modified
GTG/plugins/hamster/hamster.py (+10/-6)
To merge this branch: bzr merge lp:~chihchun/gtg/gtg-lp1102453
Reviewer Review Type Date Requested Status
Parin Porecha Approve
Izidor Matušov Needs Fixing
Review via email: mp+187676@code.launchpad.net

Description of the change

Fixed hamster dbus API changes. #1102453

To post a comment you must log in.
Revision history for this message
Izidor Matušov (izidor) wrote :

Hi, thanks for patch. It looks good (there is no error) but you don't set any activity name (and Hamster is using the default "Other" activity): http://i.imgur.com/wpJGaWq.png

Plus, I am not able to stop hamster activity from GTG. (This might be another issue)

Could you fix those?

review: Needs Fixing
Revision history for this message
Parin Porecha (parinporecha) wrote :

Hi,

Hamster was using default "Other" activity because of the default preferences.
I've changed them as follows -
- 'Set Hamster activity from' changed from 'GTG tag' to 'GTG task title'
- 'Set Hamster description from' changed from 'GTG task title' to 'GTG task contents'

Now the activity name will be set from Task title and activity description will be set from Task description

This patch was limited to the crash caused by hamster plugin and it works

I've merged after pep8ifying the changes

review: Approve
Revision history for this message
Parin Porecha (parinporecha) wrote :

The changed default preferences have also been merged

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'GTG/plugins/hamster/hamster.py'
2--- GTG/plugins/hamster/hamster.py 2013-03-03 07:27:26 +0000
3+++ GTG/plugins/hamster/hamster.py 2013-09-26 06:59:36 +0000
4@@ -23,6 +23,7 @@
5 import os
6 import re
7 import time
8+import datetime
9
10 from GTG import _
11
12@@ -96,19 +97,22 @@
13 tag_candidates = []
14 try:
15 if self.preferences['tags'] == 'existing':
16- hamster_tags = set([unicode(x) for x in
17- self.hamster.GetTags()])
18+ hamster_tags = set([unicode(x[1]) for x in
19+ self.hamster.GetTags(False)])
20 tag_candidates = list(hamster_tags.intersection(set(gtg_tags)))
21 elif self.preferences['tags'] == 'all':
22 tag_candidates = gtg_tags
23 except dbus.exceptions.DBusException:
24 # old hamster version, doesn't support tags
25 pass
26- tag_str = "".join([" ," + x for x in tag_candidates])
27+ tag_str = "".join([" #" + x for x in tag_candidates])
28
29- # print '%s%s,%s%s'%(activity, category, description, tag_str)
30- hamster_id = self.hamster.AddFact(activity, tag_str, 0, 0,
31- category, description)
32+ """ `[-]start_time[-end_time] activity@category, description #tag1 #tag2` """
33+ fact = activity
34+ if category:
35+ fact += "@%s" % category
36+ fact += ",%s%s" % (description, tag_str)
37+ hamster_id = self.hamster.AddFact(fact, timegm(datetime.datetime.now().timetuple()), 0, False)
38
39 ids = self.get_hamster_ids(task)
40 ids.append(str(hamster_id))

Subscribers

People subscribed via source and target branches

to status/vote changes: