Merge lp:~seif/docky/zg-docky into lp:docky

Proposed by Seif Lotfy
Status: Merged
Merged at revision: not available
Proposed branch: lp:~seif/docky/zg-docky
Merge into: lp:docky
Diff against target: 138 lines (+44/-25)
3 files modified
AUTHORS (+1/-1)
Docky/Docky/Docky.cs (+1/-1)
scripts/zeitgeist_docky.py (+42/-23)
To merge this branch: bzr merge lp:~seif/docky/zg-docky
Reviewer Review Type Date Requested Status
Docky Core Pending
Review via email: mp+24089@code.launchpad.net
To post a comment you must log in.
lp:~seif/docky/zg-docky updated
1304. By Seif Lotfy <seif@Gary>

fixed Author name

1305. By Seif Lotfy <seif@Gary>

remove prints

1306. By Seif Lotfy <seif@Gary>

remove uris2

1307. By Seif Lotfy <seif@Gary>

fixes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'AUTHORS'
2--- AUTHORS 2009-12-16 22:06:15 +0000
3+++ AUTHORS 2010-04-26 10:25:45 +0000
4@@ -13,6 +13,6 @@
5 Robert Dyer <psybers@gmail.com>
6 Chris Szikszoy <chris@szikszoy.com>
7 Rico Tzschichholz <ricotz@t-online.de>
8-Seif Lofty <seif@lotfy.com>
9+Seif Lotfy <seif@lotfy.com>
10 Chris Halse Rogers <raof@ubuntu.com>
11 Alex Launi <alex.launi@gmail.com>
12
13=== modified file 'Docky/Docky/Docky.cs'
14--- Docky/Docky/Docky.cs 2010-04-14 09:13:53 +0000
15+++ Docky/Docky/Docky.cs 2010-04-26 10:25:45 +0000
16@@ -119,7 +119,7 @@
17 "Robert Dyer <robert@go-docky.com>",
18 "Chris Szikszoy <chris@go-docky.com>",
19 "Rico Tzschichholz <rtz@go-docky.com>",
20- "Seif Lofty <seif@lotfy.com>",
21+ "Seif Lotfy <seif@lotfy.com>",
22 "Chris Halse Rogers <raof@ubuntu.com>",
23 "Alex Launi <alex.launi@gmail.com>"
24 };
25
26=== modified file 'scripts/zeitgeist_docky.py'
27--- scripts/zeitgeist_docky.py 2010-01-16 15:08:04 +0000
28+++ scripts/zeitgeist_docky.py 2010-04-26 10:25:45 +0000
29@@ -1,7 +1,7 @@
30 #!/usr/bin/env python
31
32 #
33-# Copyright (C) 2009 Jason Smith, Seif Lofty
34+# Copyright (C) 2009 Jason Smith, Seif Lotfy
35 #
36 # This program is free software: you can redistribute it and/or modify
37 # it under the terms of the GNU General Public License as published by
38@@ -40,9 +40,9 @@
39 try:
40 CLIENT = ZeitgeistClient()
41 version = [int(x) for x in CLIENT.get_version()]
42- MIN_VERSION = [0, 3, 1, 0]
43+ MIN_VERSION = [0, 3, 2, 0]
44 if version < MIN_VERSION:
45- print "PLEASE USE ZEITGEIST 0.3.1 or above"
46+ print "PLEASE USE ZEITGEIST 0.3.2 or above"
47 exit()
48
49
50@@ -53,6 +53,7 @@
51 class MostUsedProvider():
52 def __init__(self):
53 self._zg = CLIENT
54+ self.results = []
55
56 def get_path_most_used(self, path, handler, is_directoy=True):
57 today = time.time() * 1000
58@@ -66,31 +67,42 @@
59
60 def _handle_get_events(events):
61 uris = []
62- counter = 0
63+ uris_counter = {}
64 for event in events:
65- if counter < 5:
66- for subject in event.subjects:
67- if counter < 5 and exists(subject.uri):
68- uris.append(subject)
69- counter+=1
70- elif counter >= 5:
71- break
72- else:
73- pass
74- #print "skipping", subject.uri
75- else:
76- break
77- handler(uris)
78+ for subject in event.subjects:
79+ if exists(subject.uri):
80+ if not subject.uri in uris:
81+ uris.append(subject.uri)
82+ uris_counter[subject.uri] = 0
83+ uris_counter[subject.uri] += 1
84+
85+ counter = []
86+ for k, v in uris_counter.iteritems():
87+ counter.append((v, k))
88+ counter.sort(reverse = True)
89+
90+ recent =[]
91+ temp = [i[1] for i in counter]
92+ for uri in uris:
93+ if not uri in temp[0:5]:
94+ recent.append(uri)
95+ results = []
96+ results.append(recent[0:5])
97+
98+ results.append(counter[0:5])
99+ handler(results)
100
101 event = Event()
102 if is_directoy:
103 subject = Subject()
104 subject.set_origin(path)
105 event.set_subjects([subject])
106- self._zg.find_events_for_templates([event],_handle_get_events, [delta, today], StorageState.Any, 0, 4)
107+ self._zg.find_events_for_templates([event],_handle_get_events, [delta, today], StorageState.Any, 0, 0)
108 else:
109+ path = "application://" + path.split("/")[-1]
110 event.set_actor(path)
111- self._zg.find_events_for_templates([event],_handle_get_events, [delta, today], StorageState.Any, 0, 4)
112+ self._zg.find_events_for_templates([event],_handle_get_events, [delta, today], StorageState.Any, 0, 0)
113+
114
115 class DockyZGItem(DockyItem):
116 def __init__(self, path):
117@@ -108,10 +120,17 @@
118 return
119 self.mostusedprovider.get_path_most_used (self.uri, self._handle_get_most_used, self.iface.GetOwnsUri ())
120
121- def _handle_get_most_used(self, uris):
122- for subject in uris:
123- menu_id = self.iface.AddFileMenuItem(subject.uri,"Most Used Items")
124- self.id_map[menu_id] = subject.uri
125+ def _handle_get_most_used(self, results):
126+ uris = results[0]
127+ if len(uris) > 0:
128+ for subject in uris:
129+ menu_id = self.iface.AddFileMenuItem(subject ,"Other Recently Used Items")
130+ self.id_map[menu_id] = subject
131+ uris = results[1]
132+ if len(uris) > 0:
133+ for subject in uris:
134+ menu_id = self.iface.AddFileMenuItem(subject[1], "Most Used Items")
135+ self.id_map[menu_id] = subject
136
137 class DockyZGSink(DockySink):
138 def item_path_found(self, pathtoitem, item):

Subscribers

People subscribed via source and target branches

to status/vote changes: