Merge lp:~unity-team/unity-lens-video/match-latest-design into lp:unity-lens-video

Proposed by Michal Hruby on 2012-09-14
Status: Merged
Approved by: Paweł Stołowski on 2012-09-17
Approved revision: 93
Merged at revision: 93
Proposed branch: lp:~unity-team/unity-lens-video/match-latest-design
Merge into: lp:unity-lens-video
Diff against target: 273 lines (+79/-35)
2 files modified
po/unity-lens-video.pot (+32/-8)
src/unity-lens-video (+47/-27)
To merge this branch: bzr merge lp:~unity-team/unity-lens-video/match-latest-design
Reviewer Review Type Date Requested Status
Paweł Stołowski 2012-09-14 Approve on 2012-09-17
Review via email: mp+124365@code.launchpad.net

Commit Message

Update to match latest designs

Description of the Change

Update to match latest designs. So far mostly visual changes, ordering changes might come later.

To post a comment you must log in.
Paweł Stołowski (stolowski) wrote :

Looking good. +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/unity-lens-video.pot'
2--- po/unity-lens-video.pot 2012-02-22 14:05:03 +0000
3+++ po/unity-lens-video.pot 2012-09-14 09:19:18 +0000
4@@ -8,7 +8,7 @@
5 msgstr ""
6 "Project-Id-Version: PACKAGE VERSION\n"
7 "Report-Msgid-Bugs-To: \n"
8-"POT-Creation-Date: 2012-02-22 11:42+0100\n"
9+"POT-Creation-Date: 2012-09-14 10:03+0100\n"
10 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13@@ -17,30 +17,54 @@
14 "Content-Type: text/plain; charset=CHARSET\n"
15 "Content-Transfer-Encoding: 8bit\n"
16
17-#: ../src/unity-lens-video:78 ../src/unity-lens-video:84
18+#: ../src/unity-lens-video:49 ../src/unity-lens-video:56
19 msgid "My Videos"
20 msgstr ""
21
22-#: ../src/unity-lens-video:79
23+#: ../src/unity-lens-video:50
24 msgid "Online"
25 msgstr ""
26
27-#: ../src/unity-lens-video:80 ../video.lens.in.h:2
28+#: ../src/unity-lens-video:51 ../video.lens.in.h:1
29 msgid "Videos"
30 msgstr ""
31
32-#: ../src/unity-lens-video:81
33+#: ../src/unity-lens-video:52
34 msgid "Recently Viewed"
35 msgstr ""
36
37-#: ../src/unity-lens-video:82
38+#: ../src/unity-lens-video:53
39+msgid "More suggestions"
40+msgstr ""
41+
42+#: ../src/unity-lens-video:54
43 msgid "Search Videos"
44 msgstr ""
45
46-#: ../src/unity-lens-video:83
47+#: ../src/unity-lens-video:55
48 msgid "Sources"
49 msgstr ""
50
51-#: ../video.lens.in.h:1
52+#: ../src/unity-lens-video:173
53+msgid "Format"
54+msgstr ""
55+
56+#: ../src/unity-lens-video:174
57+msgid "Dimensions"
58+msgstr ""
59+
60+#: ../src/unity-lens-video:175
61+msgid "Size"
62+msgstr ""
63+
64+#: ../src/unity-lens-video:178
65+msgid "Show in Folder"
66+msgstr ""
67+
68+#: ../src/unity-lens-video:181
69+msgid "Play"
70+msgstr ""
71+
72+#: ../video.lens.in.h:2
73 msgid "Search local videos"
74 msgstr ""
75
76=== modified file 'src/unity-lens-video'
77--- src/unity-lens-video 2012-09-14 07:31:36 +0000
78+++ src/unity-lens-video 2012-09-14 09:19:18 +0000
79@@ -50,10 +50,15 @@
80 CAT_ONLINE = _("Online")
81 CAT_GLOBAL = _("Videos")
82 CAT_RECENT = _("Recently Viewed")
83+CAT_MORE_SUGGESTIONS = _("More suggestions")
84 HINT = _("Search Videos")
85 SOURCES = _("Sources")
86 LOCAL_VIDEOS = _("My Videos")
87
88+CAT_INDEX_MY_VIDEOS = 0
89+CAT_INDEX_ONLINE = 1
90+CAT_INDEX_MORE = 2
91+
92 BUS_NAME = "net.launchpad.lens.video"
93 FOLDER = GLib.get_user_special_dir(GLib.USER_DIRECTORY_VIDEOS)
94 HOME_FOLDER = GLib.get_home_dir()
95@@ -66,6 +71,7 @@
96 except:
97 raise SystemExit(1)
98
99+REFRESH_TIMEOUT = 300
100 PREVIEW_PLAYER_DBUS_NAME = "com.canonical.Unity.Lens.Music.PreviewPlayer"
101 PREVIEW_PLAYER_DBUS_PATH = "/com/canonical/Unity/Lens/Music/PreviewPlayer"
102 PREVIEW_PLAYER_DBUS_IFACE = PREVIEW_PLAYER_DBUS_NAME
103@@ -85,18 +91,14 @@
104
105 svg_dir = "/usr/share/icons/unity-icon-theme/places/svg/"
106 cats = []
107- cats.append(Unity.Category.new(CAT_RECENT,
108- Gio.ThemedIcon.new(svg_dir + "group-recent.svg"),
109- Unity.CategoryRenderer.VERTICAL_TILE))
110 cats.append(Unity.Category.new(CAT_ONCOMPUTER,
111 Gio.ThemedIcon.new(svg_dir + "group-videos.svg"),
112 Unity.CategoryRenderer.VERTICAL_TILE))
113 cats.append(Unity.Category.new(CAT_ONLINE,
114 Gio.ThemedIcon.new(svg_dir + "group-internet.svg"),
115- Unity.CategoryRenderer.HORIZONTAL_TILE))
116- # Specific Home Dash category
117- cats.append(Unity.Category.new(CAT_GLOBAL,
118- Gio.ThemedIcon.new("/usr/share/unity/6/lens-nav-video.svg"),
119+ Unity.CategoryRenderer.VERTICAL_TILE))
120+ cats.append(Unity.Category.new(CAT_MORE_SUGGESTIONS,
121+ Gio.ThemedIcon.new(svg_dir + "group-treat-yourself.svg"),
122 Unity.CategoryRenderer.VERTICAL_TILE))
123 self._lens.props.categories = cats
124
125@@ -110,7 +112,6 @@
126 self._scope.search_in_global = True
127 self._scope.props.sources.add_option('local', LOCAL_VIDEOS, None)
128 self._scope.connect("search-changed", self.on_search_changed)
129- self._lens.connect("notify::active", self.on_lens_active)
130 self._scope.connect("filters-changed",self.on_filtering_changed)
131 self._scope.props.sources.connect("notify::filtering",
132 self.on_filtering_changed)
133@@ -118,6 +119,15 @@
134 self._lens.add_local_scope(self._scope)
135 self._lens.export()
136
137+ GLib.timeout_add_seconds(REFRESH_TIMEOUT, self.refresh_results)
138+ self._scope.queue_search_changed(Unity.SearchType.DEFAULT)
139+
140+ def refresh_results(self, *_):
141+ """Update the results on a timeout."""
142+ print "Queuing new search because of timeout"
143+ self._scope.queue_search_changed(Unity.SearchType.DEFAULT)
144+ return True
145+
146 def on_filtering_changed(self, *_):
147 """Run another search when a filter change is notified."""
148 self._scope.queue_search_changed(Unity.SearchType.DEFAULT)
149@@ -193,11 +203,6 @@
150 return Unity.ActivationResponse(handled=Unity.HandledType.NOT_HANDLED)
151 return Unity.ActivationResponse(handled=Unity.HandledType.HIDE_DASH)
152
153- def on_lens_active(self, *_):
154- """ Run a search when the lens is opened """
155- if self._lens.props.active:
156- self._scope.queue_search_changed(Unity.SearchType.DEFAULT)
157-
158 def on_search_changed(self, scope, search, search_type, cancellable):
159 """On a new search, differentiate between lens view
160 and global search before updating the model"""
161@@ -216,13 +221,17 @@
162 else:
163 self.update_results_model(search_string, model, 'global', cancellable, search_status)
164 else:
165- self.update_results_model(search_string, model, 'lens', cancellable, search_status)
166+ if not search_string:
167+ # this will call update_results_model as well
168+ self.zg_call(cancellable, search_status)
169+ else:
170+ self.update_results_model(search_string, model, 'lens', cancellable, search_status)
171 else:
172 model.clear()
173 if search_status:
174 search_status.finished ()
175
176- def update_results_model(self, search, model, cat, cancellable, search_status):
177+ def update_results_model(self, search, model, cat, cancellable, search_status, clear_model=True):
178 """Check for the existence of the cache folder, create it if needed,
179 and run the search method."""
180 if not Gio.file_new_for_path(CACHE).query_exists(None):
181@@ -273,22 +282,21 @@
182 result_list.append(item)
183 result_list = self.sort_alpha(result_list)
184
185- GLib.idle_add(self.add_results, search_status, model, cat, cancellable, result_list, search)
186+ GLib.idle_add(self.add_results, search_status, model, cat, cancellable, result_list, search, clear_model)
187
188
189 def add_results (self, search_status=None, model=None,
190- cat=None, cancellable=None, result_list=[], search=None):
191+ cat=None, cancellable=None, result_list=[], search=None,
192+ clear_model=None):
193 result_sets = []
194
195 if cancellable and not cancellable.is_cancelled():
196 if cat == 'global':
197 # Create only one result set for the Global search
198- result_sets.append({'category':3, 'results':result_list})
199+ result_sets.append({'category':CAT_INDEX_MY_VIDEOS, 'results':result_list})
200 else:
201- if not search:
202- self.zg_call ()
203- result_sets.append({'category':1, 'results':result_list})
204- model.clear()
205+ result_sets.append({'category':CAT_INDEX_MY_VIDEOS, 'results':result_list})
206+ if clear_model: model.clear()
207 for result_set in result_sets:
208 cat = result_set['category']
209 for i in result_set['results']:
210@@ -424,7 +432,7 @@
211 icon_path = 'video'
212 return icon_path
213
214- def zg_call (self):
215+ def zg_call (self, cancellable, search_status):
216 active = self._scope.props.sources.get_option("local").props.active
217 filtering = self._scope.props.sources.props.filtering
218 if active and filtering:
219@@ -437,16 +445,23 @@
220 interpretation = datamodel.Interpretation.VIDEO
221 event_template.append_subject(
222 datamodel.Subject.new_for_values(uri=uri,interpretation=interpretation))
223+ def wrap(callback):
224+ def wrapped(events):
225+ callback(events, cancellable, search_status)
226+
227+ return wrapped
228+
229 ZG.find_events_for_templates(
230 [event_template, ],
231- self.zg_events ,
232+ wrap(self.progress_zg_events),
233 timerange = time_range,
234 storage_state = datamodel.StorageState.Any,
235 num_events = max_amount_results,
236 result_type = datamodel.ResultType.MostRecentSubjects
237 )
238
239- def zg_events(self, events):
240+ def progress_zg_events(self, events, cancellable, search_status):
241+ if cancellable.is_cancelled(): return
242 blacklist = self.get_blacklist ()
243 result_list = []
244 for event in events:
245@@ -462,6 +477,7 @@
246 item.append('')
247 item.append(uri)
248 item.append(self.get_icon(path))
249+ item.append(CAT_INDEX_MY_VIDEOS)
250 result_list.append(item)
251 elif uri.startswith('http'):
252 # If the file is distant, we take
253@@ -472,6 +488,7 @@
254 # these two *should* be ascii, but it can't hurt to be safe
255 item.append(event.get_subjects()[0].uri.encode("utf-8"))
256 item.append(event.get_subjects()[0].storage.encode("utf-8"))
257+ item.append(CAT_INDEX_ONLINE)
258 result_list.append(item)
259
260 for i in result_list:
261@@ -480,8 +497,11 @@
262 uri = str(i[2])
263 dnd_uri = str(i[2])
264 icon_hint = str(i[3])
265- self._scope.props.results_model.append(uri, icon_hint,
266- 0, "text/html", title, comment, dnd_uri)
267+ category = i[4]
268+ self._scope.props.results_model.append(uri, icon_hint,
269+ category, "text/html", title, comment, dnd_uri)
270+
271+ self.update_results_model("", search_status.props.results_model, 'lens', cancellable, search_status, False)
272
273 # pylint: enable=R0903
274

Subscribers

People subscribed via source and target branches