Ejemplo n.º 1
0
 def saveNRXconfig(self):
     # Only the modification of ImList needn't restartx, other configures need to restartx.
     # compare the imInfoDic data(no need to restartx)
     oriSortedUuid = []
     oriPriList = [self.oriImInfoDic[uuid][4] for uuid in self.oriImInfoDic.keys()]
     oriPriList.sort()
     for pri in oriPriList:
         for uuid in self.oriImInfoDic.keys():
             if self.oriImInfoDic[uuid][4] == pri:
                 oriSortedUuid.append(uuid)
                 break
     curSortedUuid = []
     curPriList = [self.curImInfoDic[uuid][4] for uuid in self.curImInfoDic.keys()]
     curPriList.sort()
     for pri in curPriList:
         for uuid in self.curImInfoDic.keys():
             if self.curImInfoDic[uuid][4] == pri:
                 curSortedUuid.append(uuid)
                 break
     if oriSortedUuid != curSortedUuid:
         IlUtil.writeImInfo(oriSortedUuid, curSortedUuid, self.curIl)
     # if use XKB, also save the current input language and keyboard
     xkbenable = os.environ.get("DI_DEF_KB_XKB", "no")
     if xkbenable == "yes":
         if self.curIl != self.oriIl:
             Util.set_env_param("INPUTLANG", self.curIl)
         if self.curKb != self.oriKb:
             Util.set_env_param("KEYBOARD", self.curKb)
             cmd = "/bin/setuserkeyboard"
             os.system(cmd)
     if self.saveMode == IlUtil.IS:
         # restore configure data
         self.oriImInfoDic = self.curImInfoDic.copy()