Merge lp:~jamesh/unity-scope-calculator/preview-image into lp:unity-scope-calculator

Proposed by James Henstridge
Status: Merged
Approved by: James Henstridge
Approved revision: 37
Merged at revision: 37
Proposed branch: lp:~jamesh/unity-scope-calculator/preview-image
Merge into: lp:unity-scope-calculator
Diff against target: 36 lines (+15/-1)
2 files modified
src/unity_calculator_daemon.py (+2/-1)
tests/test_calculator.py (+13/-0)
To merge this branch: bzr merge lp:~jamesh/unity-scope-calculator/preview-image
Reviewer Review Type Date Requested Status
David Callé Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+163263@code.launchpad.net

Commit message

Add a calculator image to the scope preview.

Description of the change

Add a calculator image to the scope preview.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
David Callé (davidc3) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/unity_calculator_daemon.py'
--- src/unity_calculator_daemon.py 2013-03-22 14:24:10 +0000
+++ src/unity_calculator_daemon.py 2013-05-10 05:41:25 +0000
@@ -146,7 +146,8 @@
146class Preview (Unity.ResultPreviewer):146class Preview (Unity.ResultPreviewer):
147147
148 def do_run(self):148 def do_run(self):
149 preview = Unity.GenericPreview.new(self.result.title, '', None)149 image = Gio.ThemedIcon.new('gnome-calculator')
150 preview = Unity.GenericPreview.new(self.result.title, '', image)
150 preview.props.subtitle = self.result.comment151 preview.props.subtitle = self.result.comment
151 open_action = Unity.PreviewAction.new("open", _("Open in calculator"), None)152 open_action = Unity.PreviewAction.new("open", _("Open in calculator"), None)
152 preview.add_action(open_action)153 preview.add_action(open_action)
153154
=== modified file 'tests/test_calculator.py'
--- tests/test_calculator.py 2013-03-22 11:32:08 +0000
+++ tests/test_calculator.py 2013-05-10 05:41:25 +0000
@@ -68,5 +68,18 @@
68 self.assertResultTitle('bob', [])68 self.assertResultTitle('bob', [])
69 self.assertResultTitle('1**1', [])69 self.assertResultTitle('1**1', [])
7070
71 def test_preview(self):
72 result = Unity.ScopeResult()
73 result.uri = "3"
74 result.title = "3"
75 result.comment = "1+2"
76 metadata = Unity.SearchMetadata()
77 previewer = self.scope.create_previewer(result, metadata)
78 preview = previewer.run()
79 self.assertEqual(preview.props.title, "3")
80 self.assertEqual(preview.props.subtitle, "1+2")
81 self.assertNotEqual(preview.props.image, None)
82 self.assertEqual(preview.props.image.get_names(), ['gnome-calculator'])
83
71if __name__ == '__main__':84if __name__ == '__main__':
72 unittest.main()85 unittest.main()

Subscribers

People subscribed via source and target branches

to all changes: