Merge lp:~dylanmccall/ubiquity/ubiquity-slideshow-quantal-beta-1 into lp:ubiquity

Proposed by Dylan McCall
Status: Merged
Merged at revision: 5604
Proposed branch: lp:~dylanmccall/ubiquity/ubiquity-slideshow-quantal-beta-1
Merge into: lp:ubiquity
Diff against target: 108 lines (+35/-32)
3 files modified
ubiquity/frontend/base.py (+13/-15)
ubiquity/frontend/gtk_ui.py (+12/-9)
ubiquity/frontend/kde_ui.py (+10/-8)
To merge this branch: bzr merge lp:~dylanmccall/ubiquity/ubiquity-slideshow-quantal-beta-1
Reviewer Review Type Date Requested Status
Ubuntu Installer Team Pending
Review via email: mp+119280@code.launchpad.net

Description of the change

This change brings Ubiquity in line with the upcoming changes to ubiquity-slideshow. It involves the following:

- Translations for ubiquity-slideshow are arranged differently now, and there's a funny hack in Ubiquity that looks up translations so it can correctly tell the slideshow whether text should flow right-to-left or left-to-right. It would be nice to actually remove that hack, but for the time being I just cleaned it up a little and made it use the new directory structure.

- New format for parameters sent to the slideshow, removing crazy and unnecessary '?' characters.

In addition, I cleaned up my code in some places, using os.path.join instead of hard-coded '/' characters where appropriate.

Old versions of ubiquity-slideshow will behave strangely with Ubiquity with this patch, and vice-versa. I'd like to get everything in place before beta 1 :)

To post a comment you must log in.
5586. By Dylan McCall

Tweaks to support ubiquity-slideshow's new file structure and parameter format (LP: #1035806)

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

I did not test LTR/RTL.
I did test translations and they are ok.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubiquity/frontend/base.py'
--- ubiquity/frontend/base.py 2012-07-16 14:29:13 +0000
+++ ubiquity/frontend/base.py 2012-08-12 22:56:19 +0000
@@ -437,24 +437,22 @@
437437
438 def slideshow_get_available_locale(self, slideshow_dir, locale):438 def slideshow_get_available_locale(self, slideshow_dir, locale):
439 # Returns the ideal locale for the given slideshow, based on the439 # Returns the ideal locale for the given slideshow, based on the
440 # given locale, or 'c' if an ideal one is not available.440 # given locale, or 'C' if an ideal one is not available.
441 # For example, with locale=en_CA, this returns en if en_CA is not441 # For example, with locale=en_CA, this returns en if en_CA is not
442 # available. If en is not available this would return c.442 # available. If en is not available this would return c.
443443
444 slides_dir = '%s/slides' % slideshow_dir444 base_slides_dir = os.path.join(slideshow_dir, 'slides', 'l10n')
445 locale_choice = 'c'445 extra_slides_dir = os.path.join(base_slides_dir, 'extra')
446446
447 if os.path.exists('%s/loc.%s' % (slides_dir, locale)):447 ll_cc = locale.split('.')[0]
448 locale_choice = locale448 ll = ll_cc.split('_')[0]
449 else:449
450 ll_cc = locale.split('.')[0]450 for slides_dir in [extra_slides_dir, base_slides_dir]:
451 ll = ll_cc.split('_')[0]451 for test_locale in [locale, ll_cc, ll]:
452 if os.path.exists('%s/loc.%s' % (slides_dir, ll_cc)):452 locale_dir = os.path.join(slides_dir, test_locale)
453 locale_choice = ll_cc453 if os.path.exists(locale_dir):
454 elif os.path.exists('%s/loc.%s' % (slides_dir, ll)):454 return test_locale
455 locale_choice = ll455 return 'C'
456
457 return locale_choice
458456
459 def check_returncode(self, *args):457 def check_returncode(self, *args):
460 if self.wget_retcode is not None or self.wget_proc is None:458 if self.wget_retcode is not None or self.wget_proc is None:
461459
=== modified file 'ubiquity/frontend/gtk_ui.py'
--- ubiquity/frontend/gtk_ui.py 2012-07-16 14:29:13 +0000
+++ ubiquity/frontend/gtk_ui.py 2012-08-12 22:56:19 +0000
@@ -803,17 +803,20 @@
803 return803 return
804804
805 self.page_section.hide()805 self.page_section.hide()
806
806 slideshow_locale = self.slideshow_get_available_locale(807 slideshow_locale = self.slideshow_get_available_locale(
807 self.slideshow, self.locale)808 self.slideshow, self.locale)
808 slideshow_main = self.slideshow + '/slides/index.html'809 slideshow_main = os.path.join(self.slideshow, 'slides', 'index.html')
809810
810 slides = 'file://' + slideshow_main811 parameters = []
811 if slideshow_locale != 'c': # slideshow will use default automatically812 parameters.append('locale=%s' % slideshow_locale)
812 slides += '#?locale=' + slideshow_locale813 ltr = i18n.get_string(
813 ltr = i18n.get_string(814 'default-ltr', slideshow_locale, 'ubiquity/imported')
814 'default-ltr', slideshow_locale, 'ubiquity/imported')815 if ltr == 'default:RTL':
815 if ltr == 'default:RTL':816 parameters.append('rtl')
816 slides += '?rtl'817 parameters_encoded = '&'.join(parameters)
818
819 slides = 'file://%s#%s' % (slideshow_main, parameters_encoded)
817820
818 from gi.repository import WebKit821 from gi.repository import WebKit
819 # We have no significant browsing interface, so there isn't much point822 # We have no significant browsing interface, so there isn't much point
820823
=== modified file 'ubiquity/frontend/kde_ui.py'
--- ubiquity/frontend/kde_ui.py 2012-07-16 14:29:13 +0000
+++ ubiquity/frontend/kde_ui.py 2012-08-12 22:56:19 +0000
@@ -568,18 +568,20 @@
568 slideshow_dir = '/usr/share/ubiquity-slideshow'568 slideshow_dir = '/usr/share/ubiquity-slideshow'
569 slideshow_locale = self.slideshow_get_available_locale(slideshow_dir,569 slideshow_locale = self.slideshow_get_available_locale(slideshow_dir,
570 self.locale)570 self.locale)
571 slideshow_main = slideshow_dir + '/slides/index.html'571 slideshow_main = os.path.join(slideshow_dir, 'slides', 'index.html')
572 if not os.path.exists(slideshow_main) or self.hide_slideshow:572 if not os.path.exists(slideshow_main) or self.hide_slideshow:
573 self.ui.pageMode.hide()573 self.ui.pageMode.hide()
574 return574 return
575575
576 slides = 'file://' + slideshow_main576 parameters = []
577 if slideshow_locale != 'c': # slideshow will use default automatically577 parameters.append('locale=%s' % slideshow_locale)
578 slides += '#?locale=' + slideshow_locale578 ltr = i18n.get_string(
579 ltr = i18n.get_string('default-ltr', slideshow_locale,579 'default-ltr', slideshow_locale, 'ubiquity/imported')
580 'ubiquity/imported')580 if ltr == 'default:RTL':
581 if ltr == 'default:RTL':581 parameters.append('rtl')
582 slides += '?rtl'582 parameters_encoded = '&'.join(parameters)
583
584 slides = 'file://%s#%s' % (slideshow_main, parameters_encoded)
583585
584 from PyQt4.QtWebKit import QWebView586 from PyQt4.QtWebKit import QWebView
585 from PyQt4.QtWebKit import QWebPage587 from PyQt4.QtWebKit import QWebPage

Subscribers

People subscribed via source and target branches

to status/vote changes: