Merge lp://qastaging/~gaspa/a4/fix-605324 into lp://qastaging/a4
Proposed by
Andrea Gasparini
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 74 | ||||||||
Proposed branch: | lp://qastaging/~gaspa/a4/fix-605324 | ||||||||
Merge into: | lp://qastaging/a4 | ||||||||
Diff against target: |
327 lines (+116/-41) 5 files modified
a4lib/app.py (+43/-5) a4lib/editor.py (+2/-2) a4lib/player.py (+6/-6) a4lib/presentation.py (+34/-15) data/window_main.glade (+31/-13) |
||||||||
To merge this branch: | bzr merge lp://qastaging/~gaspa/a4/fix-605324 | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrea Colangelo | Approve | ||
Andrea Gasparini | Needs Resubmitting | ||
Andrea Corbellini | Needs Fixing | ||
Andrea Gualano | Approve | ||
Review via email:
|
Description of the change
This should propose a fix for both bug #618162 (A4 should import plain SVG files) and bug #605324 (Presentation files should contain version information).
When a plain svg is opened, a dialog asks if the user wants to import the file or not, and then it saves a .svg that already contains our (empty) metadata.
Two kind of notices:
* not necessary saving the presentation. (i.e. no additional clicks).
* namespace is saved inside our metadata. I wasn't able to explain to lxml what i really wanted :P, but doesn't seem to me a big issue (on the contrary, this way everything we'll write is self-contained)
To post a comment you must log in.
I haven't tested it, because I've seen that the code is a bit too dirty and I'd like to see it cleaned up a bit first. :-)
For app.py:
* You have specified the encoding. Why have you done so and, if there's a reason to specify it, why haven't you used UTF-8?
* You are using gtk.Dialog instead of gtk.MessageDialog, why?
* I'd be really better to use the buttons from the stock instead of creating them with `add_button`.
* s/mgs/msg/
* During the import (although currently isn't a time-expensive operation), it'd be better not to destroy the dialog. This will implicitly tell the user "A4 is importing your file, don't touch anything!".
* After "except PresentationError as error" you have changed the error message. There are two issues with this:
1. PresentationError doesn't mean that the metadata is missing;
2. the user may not know what the 'metadata' is.
For editor.py:
* The messages placed in PresentationError exceptions will be displayed to the user, so they should be worded with care. Using the 'metadata' word makes the message very unfriendly, in my opinion. I'd prefer something like "The file you are trying to open has been created with a version of A4 newer than this one", maybe adding some instructions on how to proceed.
* You are using the list 'available_ versions' to check whether A4 can handle the file or not. Since we support just one version, I think this isn't good and here's why. Suppose that in one of the next releases (e.g. 0.4) we change the metadata format (and therefore its version) and suppose that a user tries to open a 0.1 file with A4 0.4. Now, A4 probably won't be able to use the 0.1 file directly, but will have to upgrade it first. Upgrading means calling some functions before making the file ready to use and probably also means displaying a message to the user. So, although 0.1 will be an available_version, it can't be used directly and should be special-cased. Probably we'll need to place all the supported versions in a dictionary, with (version, upgrade_function) pairs, probably we'll need some more complex methods. What I propose is, for now, to check the version with "== '0.1'" (instead of "in available_vers") and leave the work of handling old metadata for the next releases.
Finally: PEP8, PEP8, PEP8. ;-)
Sorry for being so fussy, but I love to have code always clean, easy to maintain and on high quality.