diff -Nru unity-scope-launchpad-0.1daily13.04.10ubuntu.unity.experimental.certified/data/launchpad.scope.in unity-scope-launchpad-0.1daily13.05.07ubuntu.unity.experimental.certified/data/launchpad.scope.in --- unity-scope-launchpad-0.1daily13.04.10ubuntu.unity.experimental.certified/data/launchpad.scope.in 2013-04-10 07:38:25.000000000 +0000 +++ unity-scope-launchpad-0.1daily13.05.07ubuntu.unity.experimental.certified/data/launchpad.scope.in 2013-05-07 07:25:29.000000000 +0000 @@ -1,15 +1,15 @@ [Scope] DBusName=com.canonical.Unity.Scope.Developer.Launchpad DBusPath=/com/canonical/unity/scope/developer/launchpad -Icon= +Icon=/usr/share/icons/unity-icon-theme/places/svg/service-launchpad.svg _Keywords=launchpad;code;bug;project;lp; RequiredMetadata= OptionalMetadata= Loader=/usr/share/unity-scopes/launchpad/unity_launchpad_daemon.py RemoteContent=true -Type=developer +Type=code _Name=Launchpad -_Description=Find Launchpad bugs and projects +_Description=This is an Ubuntu search plugin that enables information from Launchpad to be searched and displayed in the Dash underneath the Code header. If you do not wish to search this content source, you can disable this search plugin. _SearchHint=Search Launchpad [Desktop Entry] diff -Nru unity-scope-launchpad-0.1daily13.04.10ubuntu.unity.experimental.certified/debian/changelog unity-scope-launchpad-0.1daily13.05.07ubuntu.unity.experimental.certified/debian/changelog --- unity-scope-launchpad-0.1daily13.04.10ubuntu.unity.experimental.certified/debian/changelog 2013-05-07 16:48:39.000000000 +0000 +++ unity-scope-launchpad-0.1daily13.05.07ubuntu.unity.experimental.certified/debian/changelog 2013-05-07 16:48:39.000000000 +0000 @@ -1,3 +1,10 @@ +unity-scope-launchpad (0.1daily13.05.07ubuntu.unity.experimental.certified-0ubuntu1) raring; urgency=low + + * Automatic snapshot from revision 22 (ubuntu-unity/experimental- + certified) + + -- Ubuntu daily release Tue, 07 May 2013 07:25:56 +0000 + unity-scope-launchpad (0.1daily13.04.10ubuntu.unity.experimental.certified-0ubuntu1) raring; urgency=low [ David Callé ] diff -Nru unity-scope-launchpad-0.1daily13.04.10ubuntu.unity.experimental.certified/src/unity_launchpad_daemon.py unity-scope-launchpad-0.1daily13.05.07ubuntu.unity.experimental.certified/src/unity_launchpad_daemon.py --- unity-scope-launchpad-0.1daily13.04.10ubuntu.unity.experimental.certified/src/unity_launchpad_daemon.py 2013-04-10 07:38:25.000000000 +0000 +++ unity-scope-launchpad-0.1daily13.05.07ubuntu.unity.experimental.certified/src/unity_launchpad_daemon.py 2013-05-07 07:25:29.000000000 +0000 @@ -18,6 +18,7 @@ from gi.repository import Gio, GLib from launchpadlib.launchpad import Launchpad import gettext +import datetime APP_NAME = 'unity-scope-launchpad' LOCAL_PATH = '/usr/share/locale/' @@ -33,7 +34,7 @@ PROVIDER_CREDITS = _('Powered by Launchpad') SVG_DIR = '/usr/share/icons/unity-icon-theme/places/svg/' PROVIDER_ICON = SVG_DIR+'service-launchpad.svg' -DEFAULT_RESULT_ICON = SVG_DIR+'result-developer.svg' +DEFAULT_RESULT_ICON = SVG_DIR+'group-developer.svg' DEFAULT_RESULT_MIMETYPE = 'text/html' DEFAULT_RESULT_TYPE = Unity.ResultType.DEFAULT @@ -66,7 +67,8 @@ extras metadata fields (variant) ''' results = [] - + if len(search) < 2: + return results if search[0] == '#': search = search[1:] if search.isdigit(): @@ -81,16 +83,13 @@ print (error) if not len(search) >= 3 and search.isdigit(): return results - i = 0 for project in lp.projects.search(text=search): - if not i < 200: - return results - if not project.title: - return results results.append({'uri':str(project.web_link), - 'icon':str(project.logo_link), - 'title':project.title}) - i += 1 + 'icon':str(project.brand_link), + 'title':str(project.title.encode('utf-8')), + 'comment':str(project.name.encode('utf-8'))}) + if len(results) > 25: + break return results @@ -127,22 +126,58 @@ i['comment'] = '' if not 'dnd_uri' in i or not i['dnd_uri'] or i['dnd_uri'] == '': i['dnd_uri'] = i['uri'] - i['metadata'] = {} - if EXTRA_METADATA: - for e in i: - for m in EXTRA_METADATA: - if m['id'] == e: - i['metadata'][e] = i[e] - i['metadata']['provider_credits'] = GLib.Variant('s', PROVIDER_CREDITS) - result = Unity.ScopeResult.create(str(i['uri']), str(i['icon']), - i['category'], i['result_type'], - str(i['mimetype']), str(i['title']), - str(i['comment']), str(i['dnd_uri']), - i['metadata']) - result_set.add_result(result) + result_set.add_result(**i) except Exception as error: print (error) +class Preview (Unity.ResultPreviewer): + + def do_run(self): + project = lp.projects(self.result.comment) + image = Gio.FileIcon.new(Gio.file_new_for_uri(self.result.icon_hint)) + screenshot = project.screenshots_url + if screenshot and screenshot != '': + if screenshot.endswith('.jpg') or screenshot.endswith('.png'): + image = Gio.FileIcon.new(Gio.file_new_for_uri(screenshot)) + description = project.description + if description: + description = description.encode('utf-8') + else: + description = '' + preview = Unity.GenericPreview.new(self.result.title, description, image) + summary = project.summary + if summary: + summary = summary.encode('utf-8') + preview.props.subtitle = summary + created = project.date_created + if created: + created = created.strftime('%x') + preview.add_info(Unity.InfoHint.new("created", _("Created"), None, str(created))) + + licenses = project.licenses + if licenses: + licenses = ','.join(licenses) + if ',' in licenses: + license_display = _("Licenses") + else: + license_display = _("License") + preview.add_info(Unity.InfoHint.new("licenses", license_display, None, licenses)) + + programming_language = project.programming_language + if programming_language: + programming_language = programming_language.encode('utf-8') + if ',' in programming_language: + language_display = _("Languages") + else: + language_display = _("Language") + preview.add_info(Unity.InfoHint.new("languages", language_display, None, programming_language)) + icon = Gio.FileIcon.new (Gio.file_new_for_path(PROVIDER_ICON)) + view_action = Unity.PreviewAction.new("view", _("View"), icon) + preview.add_action(view_action) + return preview + + + class Scope (Unity.AbstractScope): def __init__(self): Unity.AbstractScope.__init__(self) @@ -194,5 +229,11 @@ se = MySearch (search_context) return se + def do_create_previewer(self, result, metadata): + rp = Preview() + rp.set_scope_result(result) + rp.set_search_metadata(metadata) + return rp + def load_scope(): return Scope()