ci_program.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:ci_edit 作者: google 项目源码 文件源码
def setUpPalette(self):
    def applyPalette(name):
      palette = app.prefs.palette[name]
      foreground = palette['foregroundIndexes']
      background = palette['backgroundIndexes']
      for i in range(1, curses.COLORS):
        curses.init_pair(i, foreground[i], background[i])
    def twoTries(primary, fallback):
      try:
        applyPalette(primary)
      except:
        try:
          applyPalette(fallback)
        except:
          pass
    if curses.COLORS == 8:
      app.prefs.prefs['color'] = app.prefs.color8
      app.prefs.color = app.prefs.color8
      app.color.colors = 8
      twoTries(app.prefs.editor['palette8'], 'default8')
    elif curses.COLORS == 256:
      app.prefs.prefs['color'] = app.prefs.color256
      app.prefs.color = app.prefs.color256
      app.color.colors = 256
      twoTries(app.prefs.editor['palette'], 'default')
    else:
      raise Exception('unknown palette color count ' + repr(curses.COLORS))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号