menu.py 文件源码

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

项目:ukui-menu 作者: ukui 项目源码 文件源码
def add_to_desktop(self, widget, desktopEntry):
        try:
            # Determine where the Desktop folder is (could be localized)
            import subprocess
            #sys.path.append('/usr/lib/ubuntu-mate/common')
            from configobj import ConfigObj
            config = ConfigObj(GLib.get_home_dir() + "/.config/user-dirs.dirs")
            desktopDir = GLib.get_home_dir() + "/Desktop"
            tmpdesktopDir = config['XDG_DESKTOP_DIR']
            tmpdesktopDir = subprocess.getoutput("echo " + tmpdesktopDir)
            if os.path.exists(tmpdesktopDir):
                desktopDir = tmpdesktopDir
            # Copy the desktop file to the desktop
            os.system("cp \"%s\" \"%s/\"" % (desktopEntry.desktopFile, desktopDir))
            os.system("chmod a+rx %s/*.desktop" % (desktopDir))
        except Exception as detail:
            print (detail)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号