bookmarks-indicator.py 文件源码

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

项目:bookmarks-indicator 作者: antoniocoratelli 项目源码 文件源码
def append_item(self, parent, path):
        '''
        Append a folder or a file to a menu.
        '''
        name = os.path.basename(path)
        items = []
        if name == ".":
            # the item is a '.' element: add a menu entry to open the folder
            # in the default file explorer, and a menu entry to open a shell
            # with that folder as working directory
            item_dot = gtk.MenuItem(".", False)
            item_dot.connect("activate", self.onclick, path)
            item_shell = gtk.MenuItem(">_", False)
            item_shell.connect("activate", self.onshell, path)
            items.append(item_dot)
            items.append(item_shell)
        elif os.path.isdir(path):
            item = gtk.MenuItem(name, False)
            submenu = self.append_dummy(item)
            item.connect("activate", self.onhover, path, submenu)
            items.append(item)
        else:
            item = gtk.MenuItem(name, False)
            item.connect("activate", self.onclick, path)
            items.append(item)
        for i in items:
            i.show()
            parent.append(i)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号