Example #1
0
    def __init__(self, parent, id_, default=None):
        """Creates a combobox with a list of all translations for the
        editor as well as displaying the countries flag next to the item
        in the list.

        @param default: The default item to show in the combo box

        """
        self.default = default
        lang_ids = GetLocaleDict(GetAvailLocales()).values()
        if wx.LANGUAGE_DEFAULT not in lang_ids:
            lang_ids.append(wx.LANGUAGE_DEFAULT)

        lang_items = langlist.CreateLanguagesResourceLists(langlist.LC_ONLY, \
                                                               lang_ids)
        wx.combo.BitmapComboBox.__init__(self,
                                         parent,
                                         id_,
                                         size=wx.Size(250, 26),
                                         style=wx.CB_READONLY)
        for lang_d in lang_items[1]:
            bit_m = lang_items[0].GetBitmap(lang_items[1].index(lang_d))
            self.Append(lang_d, bit_m)

        if default:
            self.SetValue(default)
Example #2
0
    def __init__(self, parent, id=-1, default=None, langs=[]):
        """Creates a combobox with a list of all translations for the
        editor as well as displaying the countries flag next to the item
        in the list.

        @param default: The default item to show in the combo box

        """
        lang_ids = [t.lang_id for t in getTranslationMap().values()]
        #print lang_ids
        lang_items = langlist.CreateLanguagesResourceLists(langlist.LC_ONLY, \
                                                           lang_ids)
        #print lang_items
        wx.combo.BitmapComboBox.__init__(self,
                                         parent,
                                         id,
                                         size=wx.Size(250, 26),
                                         style=wx.CB_READONLY)
        for lang_d in lang_items[1]:
            bit_m = lang_items[0].GetBitmap(lang_items[1].index(lang_d))
            self.Append(lang_d, bit_m)

        if default:
            if default in translation_map:
                self.SetValue(translation_map[default].description)