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

Proposed by Lorenzo Mattei on 2012-03-07
Status: Merged
Approved by: David Callé on 2012-03-11
Approved revision: 4
Merged at revision: 4
Proposed branch: lp:~lore-mattei/onehundredscopes/deviantart-precise
Merge into: lp:~davidc3/onehundredscopes/deviantart
Diff against target: 112 lines (+41/-21)
2 files modified
debian/control (+4/-4)
src/unity-scope-deviantart (+37/-17)
To merge this branch: bzr merge lp:~lore-mattei/onehundredscopes/deviantart-precise
Reviewer Review Type Date Requested Status
David Callé 2012-03-07 Pending
Review via email: mp+96474@code.launchpad.net
To post a comment you must log in.

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-02-27 15:05:49 +0000
3+++ debian/control 2012-03-07 22:22:28 +0000
4@@ -5,8 +5,8 @@
5 Build-Depends: debhelper (>= 7),
6 pkg-config,
7 libglib2.0-dev (>= 2.27),
8- libdee-dev (>= 0.5.16),
9- libunity-dev (>= 3.6.2),
10+ libdee-dev (>= 1.0.4),
11+ libunity-dev (>= 5.0.0),
12 python-all,
13 python-distutils-extra
14 Standards-Version: 3.9.1
15@@ -17,8 +17,8 @@
16 Depends: ${shlibs:Depends},
17 ${misc:Depends},
18 ${python:Depends},
19- gir1.2-unity-4.0,
20- gir1.2-dee-0.5,
21+ gir1.2-unity-5.0,
22+ gir1.2-dee-1.0,
23 python-lxml,
24 unity-lens-graphicdesign,
25 Description: Unity Deviantart scope
26
27=== modified file 'src/unity-scope-deviantart'
28--- src/unity-scope-deviantart 2012-02-27 15:05:49 +0000
29+++ src/unity-scope-deviantart 2012-03-07 22:22:28 +0000
30@@ -29,9 +29,12 @@
31 def __init__ (self):
32 self.scope = Unity.Scope.new ("/net/launchpad/scope/image/deviantart")
33 self.scope.search_in_global = False
34- self.scope.connect ("notify::active-search", self.on_search_changed)
35- self.scope.connect ("filters-changed", self.on_search_changed);
36+ self.scope.connect ("search-changed", self.on_search_changed)
37+ self.scope.connect ("filters-changed", self.on_filtering_changed);
38 self.scope.connect ("activate-uri", self.on_activate_uri);
39+ self.scope.connect("notify::active", self.on_lens_active)
40+ self.scope.props.sources.connect("notify::filtering",
41+ self.on_filtering_changed)
42 self.scope.export()
43
44 def on_activate_uri (self, scope, uri):
45@@ -46,19 +49,39 @@
46 # GLib.spawn_command_line_async("eog %s" % uri)
47 return Unity.ActivationResponse(Unity.HandledType.HIDE_DASH, uri)
48
49- def get_search_string (self):
50- search = self.scope.props.active_search
51- return search.props.search_string if search else None
52-
53- def on_search_changed (self, scope, param_spec=None):
54- search = self.get_search_string()
55+ def on_filtering_changed(self, *_):
56+ """Run another search when a filter change is notified."""
57+ self.scope.queue_search_changed(Unity.SearchType.DEFAULT)
58+
59+ def on_lens_active(self, *_):
60+ """ Run a search when the lens is opened """
61+ if self.scope.props.active:
62+ self.scope.queue_search_changed(Unity.SearchType.DEFAULT)
63+
64+
65+# def get_search_string (self):
66+# search = self.scope.props.active_search
67+# return search.props.search_string if search else None
68+
69+ def on_search_changed (self, scope, search, search_type, _):
70+ search_string = search.props.search_string.strip()
71 print "Search changed to: '%s'" % search
72- results = self.scope.props.results_model
73- results.clear()
74- self.update_results_model (search, results, 0)
75- results.flush_revision_queue ()
76+ model = search.props.results_model
77+ model.clear()
78+ if search_type is Unity.SearchType.DEFAULT:
79+ if search_string == '':
80+ print "Global view without search string : hide"
81+ else:
82+ self.update_results_model(search_string, model, 0)
83+ if search:
84+ search.finished()
85
86 def update_results_model(self, search, model, page):
87+ cat = 0
88+ if len(search) > 0:
89+ cat = 3
90+ else:
91+ cat = 0
92 if self.check_filters("art_categories") == "brushes" or self.check_filters("art_categories") is None:
93 i = None
94 for i in self.deviantart(search, page):
95@@ -66,15 +89,12 @@
96 comment = i[1]
97 uri = i[2]
98 icon_hint = i[3]
99- model.append (uri, icon_hint, 3,"text/html", title, comment, uri)
100+ model.append (uri, icon_hint, cat,"text/html", title, comment, uri)
101 if i:
102 if not search:
103 search = ''
104 page = int(page)+24
105- model.append ("more__"+search+"__"+str(page), "add", 3,"text/html", "More results", '', '')
106-
107- if self.scope.props.active_search:
108- self.scope.props.active_search.emit("finished")
109+ model.append ("more__"+search+"__"+str(page), "add", cat,"text/html", "More results", '', '')
110
111 def check_filters(self, filter_name):
112 try:

Subscribers

People subscribed via source and target branches

to all changes: