def createImModel(self,langStr): #get data from simf and current scim config imInfoDic=IlUtil.getImInfoDicWithLang(langStr,"all") for uuid in imInfoDic: if uuid in self.curImInfoDic: imInfoDic[uuid]=self.curImInfoDic[uuid] else: imInfoDic[uuid][IlUtil.InfoPri]=0 #create language list langList=[] for uuid in imInfoDic: langList.append(imInfoDic[uuid][IlUtil.InfoLocale]) langList=list(set(langList)) langList.sort() #insert im in model model=gtk.TreeStore(gtk.gdk.Pixbuf,gobject.TYPE_STRING,gobject.TYPE_BOOLEAN,\ gobject.TYPE_BOOLEAN,gobject.TYPE_STRING) langImDic={} for lang in langList: iter=model.append(None) model.set(iter, IconCol,None, NameCol,_(IlUtil.convertLocaleToLang(lang)), EnableCol,True, IncCol,False, UuidCol,None) langInfoList=[] for uuid in imInfoDic: if imInfoDic[uuid][IlUtil.InfoLocale]==lang: langInfoList.append(imInfoDic[uuid]); langImDic[lang]=langInfoList for imInfo in langImDic[lang]: childIter=model.append(iter) model.set(childIter, IconCol,gtk.gdk.pixbuf_new_from_file_at_size(imInfo[IlUtil.InfoIcon],20,20), NameCol,_(imInfo[IlUtil.InfoName]), EnableCol,imInfo[IlUtil.InfoPri]>0, IncCol,False, UuidCol,imInfo[IlUtil.InfoUuid]) return model
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"