ml_controlLibrary.py 文件源码

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

项目:ml_tools 作者: morganloomis 项目源码 文件源码
def refreshShelfLayout(self, *args):
        '''Delete and the shelf buttons and remake them
        '''

        shelfButtons = mc.shelfLayout(self.shelfLayout, query=True, childArray=True)
        if shelfButtons:
            for child in shelfButtons:
                mc.deleteUI(child)

        mc.setParent(self.shelfLayout)

        for each in os.listdir(REPOSITORY_PATH):
            if each.endswith('.ctrl'):
                name = os.path.splitext(each)[0]
                icon = None
                imageFile = os.path.join(REPOSITORY_PATH,name+'.png')
                if os.path.isfile(imageFile):
                    icon = imageFile
                filename = os.path.join(REPOSITORY_PATH,each)
                button = mc.shelfButton(command=partial(importControl, name),
                                        image=icon, 
                                        width=70,
                                        height=70,
                                        imageOverlayLabel=name.replace('_',' ').replace('  ',' '),
                                        annotation=name)

                menus = mc.shelfButton(button, query=True, popupMenuArray=True)
                if menus:
                    for menu in menus:
                        mc.deleteUI(menu)
                #mc.popupMenu()
                #mc.menuItem('delete', command=partial(self.deleteShelfButton, name))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号