Setup.py 文件源码

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

项目:enigma2 作者: BlackHole 项目源码 文件源码
def addItems(self, list, parentNode):
        for x in parentNode:
            if not x.tag:
                continue
            if x.tag == 'item':
                item_level = int(x.get("level", 0))

                if not self.levelChanged in config.usage.setup_level.notifiers:
                    config.usage.setup_level.notifiers.append(self.levelChanged)
                    self.onClose.append(self.removeNotifier)

                if item_level > config.usage.setup_level.index:
                    continue

                requires = x.get("requires")
                if requires and requires.startswith('config.'):
                    item = eval(requires or "")
                    if item.value and not item.value == "0":
                        SystemInfo[requires] = True
                    else:
                        SystemInfo[requires] = False

                if requires and not SystemInfo.get(requires, False):
                    continue

                if self.PluginLanguageDomain:
                    item_text = dgettext(self.PluginLanguageDomain, x.get("text", "??").encode("UTF-8"))
                    item_description = dgettext(self.PluginLanguageDomain, x.get("description", " ").encode("UTF-8"))
                else:
                    item_text = _(x.get("text", "??").encode("UTF-8"))
                    item_description = _(x.get("description", " ").encode("UTF-8"))

                item_text = item_text.replace("%s %s","%s %s" % (getMachineBrand(), getMachineName()))
                item_description = item_description.replace("%s %s","%s %s" % (getMachineBrand(), getMachineName()))
                b = eval(x.text or "")
                if b == "":
                    continue
                #add to configlist
                item = b
                # the first b is the item itself, ignored by the configList.
                # the second one is converted to string.
                if not isinstance(item, ConfigNothing):
                    list.append((item_text, item, item_description))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号