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

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

Subscribers

People subscribed via source and target branches

to all changes: