Merge lp:~lore-mattei/onehundredscopes/flickr-precise into lp:~davidc3/onehundredscopes/flickr

Proposed by Lorenzo Mattei on 2012-02-29
Status: Merged
Merged at revision: 10
Proposed branch: lp:~lore-mattei/onehundredscopes/flickr-precise
Merge into: lp:~davidc3/onehundredscopes/flickr
Diff against target: 106 lines (+32/-22)
2 files modified
debian/control (+2/-2)
src/unity-scope-flickr (+30/-20)
To merge this branch: bzr merge lp:~lore-mattei/onehundredscopes/flickr-precise
Reviewer Review Type Date Requested Status
David Callé 2012-02-29 Approve on 2012-02-29
Review via email: mp+95182@code.launchpad.net
To post a comment you must log in.
David Callé (davidc3) wrote :

I'm merging it with a few changes. Have a look at the final diff.

review: Approve
10. By David Callé on 2012-02-29

Port to Precise. Thanks Lorenzo.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2012-01-08 15:33:20 +0000
3+++ debian/control 2012-02-29 14:38:19 +0000
4@@ -17,8 +17,8 @@
5 Depends: ${shlibs:Depends},
6 ${misc:Depends},
7 ${python:Depends},
8- gir1.2-unity-4.0,
9- gir1.2-dee-0.5,
10+ gir1.2-unity-5.0,
11+ gir1.2-dee-1.0,
12 python-flickrapi,
13 unity-lens-photo,
14 Enhances: unity-lens-photo
15
16=== modified file 'src/unity-scope-flickr'
17--- src/unity-scope-flickr 2012-01-07 20:07:47 +0000
18+++ src/unity-scope-flickr 2012-02-29 14:38:19 +0000
19@@ -43,10 +43,10 @@
20 def __init__ (self):
21 self.scope = Unity.Scope.new ("/net/launchpad/scope/image/flickr")
22 self.scope.search_in_global = False
23- self.scope.connect ("notify::active-search", self.on_search_changed)
24- self.scope.connect ("filters-changed", self.on_search_changed);
25-# self.scope.connect ("notify::active", self.on_search_changed);
26+ self.scope.connect ("search-changed", self.on_search_changed)
27+ self.scope.connect ("filters-changed", self.on_search_changed)
28 self.scope.connect ("activate-uri", self.on_activate_uri);
29+ self.scope.connect("notify::active", self.on_lens_active)
30 self.scope.export()
31
32 def on_activate_uri (self, scope, uri):
33@@ -71,30 +71,42 @@
34 (token, frob) = flickr.get_token_part_one(perms='write')
35 global clicked
36 clicked = True
37-
38- def get_search_string (self):
39- search = self.scope.props.active_search
40- return search.props.search_string if search else None
41-
42- def on_search_changed (self, scope, param_spec=None):
43- search = self.get_search_string()
44- print "Search changed to: '%s'" % search
45- results = self.scope.props.results_model
46- results.clear()
47+
48+ def on_lens_active(self, *_):
49+ """ Run a search when the lens is opened """
50+ if self.scope.props.active:
51+ self.scope.queue_search_changed(Unity.SearchType.DEFAULT)
52+
53+ def on_search_changed (self, scope, search, search_type, _):
54+ search_string = search.props.search_string.strip()
55+ model = search.props.results_model
56+ model.clear()
57+ print "Search changed to: '%s'" % search_string
58+
59 if flickr.token_cache.token:
60 has_token = True
61 else:
62 has_token = False
63 if clicked:
64 flickr.get_token_part_two((token, frob))
65- self.update_results_model (search, results, '1', has_token)
66- results.flush_revision_queue ()
67+ if search_type is Unity.SearchType.DEFAULT:
68+ if search_string == '':
69+ print "Global view without search string : hide"
70+ else:
71+ self.update_results_model(search_string, model, '1', has_token)
72+ if search:
73+ search.finished()
74
75 def update_results_model(self, search, model, page, has_token):
76 i = ''
77 counter = 0
78+ cat = 0
79+ if len(search) > 0:
80+ cat = 2
81+ else:
82+ cat = 0
83 if not has_token:
84- model.append ("connect", "goa-panel", 2,"text/html", "Authorize with Flickr", '', '')
85+ model.append ("connect", "goa-panel", cat,"text/html", "Authorize with Flickr", '', '')
86 else:
87 taken_by = self.check_filters("taken_by")
88 date = self.check_filters("date")
89@@ -104,15 +116,13 @@
90 comment = i[1]
91 uri = i[2]
92 icon_hint = i[3]
93- model.append (uri, icon_hint, 2,"text/html", title, comment, uri)
94+ model.append (uri, icon_hint, cat,"text/html", title, comment, uri)
95 if i and counter > 49:
96 if not search:
97 search = ''
98 page = int(page)+1
99- model.append ("more__"+search+"__"+str(page), "add", 2,"text/html", "More results", '', '')
100+ model.append ("more__"+search+"__"+str(page), "add", cat,"text/html", "More results", '', '')
101
102- if self.scope.props.active_search:
103- self.scope.props.active_search.emit("finished")
104
105 def check_filters(self, filter_name):
106 try:

Subscribers

People subscribed via source and target branches

to all changes: