Merge lp:~submarine/ubuntu-scopes/colourlovers-set-as-wallpaper into lp:~submarine/ubuntu-scopes/colourlovers
Proposed by
David Callé
Status: | Merged |
---|---|
Approved by: | Martin Mrazik |
Approved revision: | 29 |
Merged at revision: | 25 |
Proposed branch: | lp:~submarine/ubuntu-scopes/colourlovers-set-as-wallpaper |
Merge into: | lp:~submarine/ubuntu-scopes/colourlovers |
Diff against target: |
160 lines (+81/-3) 2 files modified
src/unity_colourlovers_daemon.py (+47/-1) tests/test_colourlovers.py (+34/-2) |
To merge this branch: | bzr merge lp:~submarine/ubuntu-scopes/colourlovers-set-as-wallpaper |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
James Henstridge | Approve | ||
Review via email: mp+154044@code.launchpad.net |
Commit message
Create preview for each result. Add set as wallpaper option when previewing a pattern.
Description of the change
Create preview for each result. Add set as wallpaper option when previewing a pattern.
To post a comment you must log in.
A few issues:
[1]
Do you actually need the Preview.__init__() method? All it seems to be doing is chaining to the parent implementation without adding anything.
[2]
In your Preview.do_run() method, you start by assigning to a number of local variables that only get used once. It doesn't look like there is any real reason for this (e.g. code readability, or shortening long lines of code).
The preview variable is set to None, only to be assigned some other value before it is used further. Perhaps the code would be easier to read without these extra assignments?
[3] _action( ), might it be simpler to use the Python standard library to check for the file contents and make the cache directory (i.e. os.path.isfile() and os.makedirs(..., exist_ok=True)).
For the path manipulation in Scope.wallpaper
[4] as_wallpaper( ), you have more single-use locals. And creating a list of key strings that are then only accessed by index just makes the code more difficult to read compared to using those strings directly.
In Scope.set_
I'm also not sure what the purpose of this line is:
gsettings. get_string( KEY[0])
At first I thought that it might be there to trigger an exception if the 'picture-uri' key didn't exist, but it seems to crash the process with unknown keys (probably a bug in the GIR data). Perhaps remove it?
[5]
Can you test this new preview code? Ideally we'd want to know that the preview is generated as expected, and that activating "wallpaper" action correctly downloads the content. You've already split the gsettings code out into a separate method, so it should be easy to stub that out for the test so you don't mess with the developer's settings.