~jmarsden/ubiquity/lp775124

« back to all changes in this revision

Viewing changes to ubiquity/plugins/ubi-language.py

  • Committer: Evan Dandrea
  • Date: 2011-08-31 16:17:08 UTC
  • Revision ID: evan.dandrea@canonical.com-20110831161708-50ayk44ua2trze4t
Don't let the text wrap for the language names in oem-config.

Show diffs side-by-side

added added

removed removed

Lines of Context:
206
206
        from gi.repository import Gtk, GObject
207
207
        PageBase.set_language_choices(self, choices, choice_map)
208
208
        list_store = Gtk.ListStore.new([GObject.TYPE_STRING])
 
209
        longest_length = 0
 
210
        longest = ''
209
211
        for choice in choices:
210
212
            list_store.append([choice])
 
213
            # Work around the fact that GtkIconView wraps at 50px or the width
 
214
            # of the icon, which is nonexistent here. See adjust_wrap_width ()
 
215
            # in gtkiconview.c for the details.
 
216
            if self.only:
 
217
                length = len(choice)
 
218
                if length > longest_length:
 
219
                    longest_length = length
 
220
                    longest = choice
211
221
        # Support both iconview and treeview
212
222
        if self.only:
213
223
            self.iconview.set_model(list_store)
214
224
            self.iconview.set_text_column(0)
215
 
            lang_per_column = self.iconview.get_allocation().height / 50
216
 
            columns = int(round(len(choices) / float(lang_per_column)))
217
 
            self.iconview.set_columns(columns)
 
225
            pad = self.iconview.get_property('item-padding')
 
226
            layout = self.iconview.create_pango_layout(longest)
 
227
            self.iconview.set_item_width(layout.get_pixel_size()[0] + pad * 2)
218
228
        else:
219
229
            if len(self.treeview.get_columns()) < 1:
220
230
                column = Gtk.TreeViewColumn(None, Gtk.CellRendererText(), text=0)