Merge lp:~lderan/ubiquity-slideshow-ubuntu/test into lp:ubiquity-slideshow-ubuntu

Proposed by Thomas Molloy
Status: Needs review
Proposed branch: lp:~lderan/ubiquity-slideshow-ubuntu/test
Merge into: lp:ubiquity-slideshow-ubuntu
Diff against target: 100 lines (+52/-1)
3 files modified
Slideshow.py (+16/-0)
slideshows/link-core/slideshow.js (+35/-0)
slideshows/xubuntu/slides/00_welcome.html (+1/-1)
To merge this branch: bzr merge lp:~lderan/ubiquity-slideshow-ubuntu/test
Reviewer Review Type Date Requested Status
Dylan McCall Needs Fixing
Pasi Lallinaho community Approve
Ubiquity Slideshow code Pending
Review via email: mp+180747@code.launchpad.net

Commit message

Slideshow.py - now fetches the version number and name and sends them to the slideshow
Slideshow.js - replaces objects with .versionId & .releaseName with Id and name respectively

Usage example:

You are installing Ubuntu<span class="version-details"> <span class="version-id"></span>, <span class="releaseName"></span>.
results in:
You are installing Ubuntu 13.04, Raring Ringtail.

In the case the slideshow can't acquire the the version name or number, the contents of version-details will be ignored:
You are installing Ubuntu.

Description of the change

Slideshow.py - now fetches the version number and name and sends them to the slideshow
Slideshow.js - replaces objects with .versionId & .releaseName with Id and name respectively

Usage example
<span class="versionId"></span> <span class="releaseName"></span>
results in
13.04 Raring Ringtail

To post a comment you must log in.
Revision history for this message
Pasi Lallinaho (knome) :
review: Approve (community)
570. By Thomas Molloy

Change xubuntu welcome home back

Revision history for this message
Dylan McCall (dylanmccall) wrote :

So, my feeling on this is each slideshow content version should be targeted towards a particular Ubuntu release. If it's necessary to grab the version ID automatically, my assumption is that means we're either shipping outdated content (because, really, a lot changes from one release to the next and we've already had a few instances where flavours ship with plainly incorrect slideshow content); or we're shipping very general content (which could be argued for…). Am I missing something? :)

Personally, I've always been an advocate of just not repeating the version number here at all since Ubiquity already communicates that and it isn't really relevant information at this stage, but I don't think I've won that argument.

Anyway, this is optional, so I don't mind, but for this change to work, we'll also need a change in a released or to-be-released version of Ubiquity that is similar to what you have in Slideshow.py. Has that happened at this stage? It might also be nice to have a sensible fallback in the event that the version ID isn't provided, too. Right now it looks like we'll get an empty space after a comma, and no version number. Perhaps wrap that whole thing in an element that disappears if there's no version number available, like "Xubuntu<span class="versionDetails">, <span class="releaseName"></span> <span class="versionId"></span></span>"?

Also - and I promise this is a tiny thing - your element classes are inconsistent. Please use dashes instead of camel case, there, like "release-name" and "version-id".

Thank you!

review: Needs Fixing
Revision history for this message
Pasi Lallinaho (knome) wrote :

With the Xubuntu slideshows, we try to make the slideshow content as version-agnostic as possible: this change makes sense for us and leaves less room for human errors.

I agree that there should be a fallback, but I have no idea what that could be.

Revision history for this message
Pasi Lallinaho (knome) wrote :

Having read it again (and understood it) I agree with the proposed fallback.

Revision history for this message
Dylan McCall (dylanmccall) wrote :

Come to think of it, I just realized my proposed fallback could be trouble
for localisation, but to be honest I'm giving this a very cursory look :)
Happy with this being merged, anyway!
On 18 Aug 2013 14:41, "Pasi Lallinaho" <email address hidden> wrote:

> Having read it again (and understood it) I agree with the proposed
> fallback.
> --
>
> https://code.launchpad.net/~lderan/ubiquity-slideshow-ubuntu/test/+merge/180747
> You are reviewing the proposed merge of
> lp:~lderan/ubiquity-slideshow-ubuntu/test into lp:ubiquity-slideshow-ubuntu.
>

Revision history for this message
Pasi Lallinaho (knome) wrote :

Wouldn't the strings to be translated include the HTML tags as they are? In that case it would only mean the translators would need to know the usage, which I think is a relatively small problem.

571. By Thomas Molloy

added a fallback and added an example to the xubuntu welcome

572. By Thomas Molloy

tidying up

Revision history for this message
Thomas Molloy (lderan) wrote :

I have put in the suggested fallback, is the current functionality of it okay?
As for translations, the bit that replaces the text happens after the slide is translated so it should be as Knome says.

Unmerged revisions

572. By Thomas Molloy

tidying up

571. By Thomas Molloy

added a fallback and added an example to the xubuntu welcome

570. By Thomas Molloy

Change xubuntu welcome home back

569. By Thomas Molloy

version number and name passed to the slideshow

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Slideshow.py'
2--- Slideshow.py 2012-09-05 20:16:23 +0000
3+++ Slideshow.py 2013-08-19 23:59:45 +0000
4@@ -4,6 +4,8 @@
5 from gi.repository import GLib, Gdk, Gtk, WebKit
6 from configparser import ConfigParser
7 import subprocess
8+import platform
9+import csv
10
11 import sys
12 import locale
13@@ -36,6 +38,20 @@
14 if controls:
15 parameters.append('controls')
16
17+ ''' Fetches the version number from /etc/lsb-release '''
18+ version = platform.linux_distribution()[1]
19+ ''' now to get the full name as .linux_distribution only returns the shortname '''
20+ release = ""
21+ distroInfoFile = open("/usr/share/distro-info/ubuntu.csv")
22+ csv_reader = csv.DictReader(distroInfoFile)
23+ for row in csv_reader:
24+ if row['version'] == version:
25+ release = row['codename']
26+ break
27+
28+ parameters.append('ver='+version)
29+ parameters.append('release='+release)
30+
31 WebKit.WebView.__init__(self)
32 parameters_encoded = '&'.join(parameters)
33 self.open('%s#%s' % (slideshow_main, parameters_encoded))
34
35=== modified file 'slideshows/link-core/slideshow.js'
36--- slideshows/link-core/slideshow.js 2013-02-13 16:02:10 +0000
37+++ slideshows/link-core/slideshow.js 2013-08-19 23:59:45 +0000
38@@ -37,7 +37,30 @@
39 var directory = {};
40 var extra_directory = {};
41
42+var version_number;
43+var release_name;
44+
45+$.extend({
46+ getUrlVars: function(){
47+ var vars = [], hash;
48+ var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
49+ for(var i = 0; i < hashes.length; i++)
50+ {
51+ hash = hashes[i].split('=');
52+ vars.push(hash[0]);
53+ vars[hash[0]] = hash[1];
54+ }
55+ return vars;
56+ },
57+ getUrlVar: function(name){
58+ return decodeURIComponent($.getUrlVars()[name]);
59+ }
60+});
61+
62 $(document).ready(function() {
63+ versionNumber = $.getUrlVar('ver');
64+ releaseName = $.getUrlVar('release');
65+
66 function loadExtraSlides() {
67 $.ajax({
68 type: 'GET',
69@@ -212,6 +235,18 @@
70 success: function(data, status, xhr) {
71 $(data).appendTo(slide);
72 translateSlideContents(locale, slide);
73+ if(version_number == "undefined" || release_name == "undefined"){
74+ $(slide).find(".version-details").each(function(){
75+ $(this).remove();
76+ });
77+ } else {
78+ $(slide).find(".version-id").each(function(){
79+ $(this).html(version_number);
80+ });
81+ $(slide).find(".release-name").each(function(){
82+ $(this).html(release_name);
83+ });
84+ }
85 }
86 });
87 } else {
88
89=== modified file 'slideshows/xubuntu/slides/00_welcome.html'
90--- slideshows/xubuntu/slides/00_welcome.html 2013-06-25 15:52:49 +0000
91+++ slideshows/xubuntu/slides/00_welcome.html 2013-08-19 23:59:45 +0000
92@@ -4,7 +4,7 @@
93
94 <div class="main">
95 <div class="content">
96- <p>You have chosen to install the latest version of Xubuntu, 13.10.</p>
97+ <p>You have chosen to install the latest version of Xubuntu<span class="version-details">, <span class="version-id"></span></span>.</p>
98 <p>This exciting piece of software is brought to you free of any fees, for your use and any others you want to share it with.</p>
99 <p>Since you are installing this software using the Xubuntu live installation, feel free to examine things as it installs. After the installation, the desktop will look much the same as it does now.</p>
100 </div>

Subscribers

People subscribed via source and target branches