DisplayMinion.py 文件源码

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

项目:displayminion 作者: cedarsuite 项目源码 文件源码
def update_minion_blocks(self, dt):
        # Note: Sections were originally named "blocks", so far I've been too lazy to rewrite all the cedarserver code to reflect the new name. -IHS
        start_length = len(self.sections)
        block_delta = len(self.minion['settings']['blocks']) - start_length

        if block_delta > 0:
            for n in range(block_delta):
                config = self.minion['settings']['blocks'][start_length + n]

                section = Section(
                    source = self.source,
                    block = config,
                    client = self
                )

                self.layout.add_widget(section)
                self.sections.append(section)

        elif block_delta < 0:
            for n in range(abs(block_delta)):
                section = self.sections.pop()
                self.layout.remove_widget(section)

        for index, section in enumerate(self.sections):
            config = self.minion['settings']['blocks'][index]
            if not section.block == config: # TODO add brightness etc.
                section.block = config
                section.recalc()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号