Ejemplo n.º 1
0
 def setupImComboBox(self):
     # clear data
     self.imLs.clear()
     self.imCbIndexDic = {}
     # get max priority im
     maxPriUuid = IlUtil.getUuidWithMaxPri(self.curImInfoDic)
     # create locale list
     localeList = []  # localeList=[locale1,locale2,...]
     for uuid in self.curImInfoDic:
         localeList.append(self.curImInfoDic[uuid][IlUtil.InfoLocale])
     localeList = list(set(localeList))
     localeList.sort()
     # create im combo box
     localeInfoDic = {}  # localeInfoDic={locale:im_info_list}
     counter = 0
     for lang in localeList:
         localeInfoList = []  # localeInfoList=[im_info1,im_info2,...]
         for uuid in self.curImInfoDic:
             if self.curImInfoDic[uuid][IlUtil.InfoLocale] == lang:
                 localeInfoList.append(self.curImInfoDic[uuid])
         localeInfoDic[lang] = localeInfoList
         self.imLs.append((_(IlUtil.convertLocaleToLang(lang)), None, None, None))
         self.imCbIndexDic[counter] = "LangLabel"
         counter += 1
         for imInfo in localeInfoDic[lang]:
             self.imLs.append(
                 (
                     "   ",
                     gtk.gdk.pixbuf_new_from_file_at_size(imInfo[IlUtil.InfoIcon], 20, 20),
                     _(imInfo[IlUtil.InfoName]),
                     "",
                 )
             )
             self.imCbIndexDic[counter] = imInfo
             if imInfo[IlUtil.InfoUuid] == maxPriUuid:
                 self.imCb.set_active(counter)
             counter += 1
     self.imLs.append((None, None, None, _("Add/Remove...")))
     self.imCbIndexDic[counter] = "AddRemoveBtn"