View file File name : RecentFiles.cpython-36.pyc Content :3 ѢUP� � @ sX d Z ddlZddlZddlZddlZddlZddlmZ G dd� d�Z G dd� d�Z dS )z{ Implementation of the XDG Recent File Storage Specification Version 0.2 http://standards.freedesktop.org/recent-file-spec � N)�ParsingErrorc @ sT e Zd Zdd� Zddd�Zdd� Zddd �Zddd�Zddd�Zdd� Z dd� Z dS )�RecentFilesc C s g | _ d| _d S )N� )r �filename)�self� r �!/usr/lib/python3.6/RecentFiles.py�__init__ s zRecentFiles.__init__Nc C s� |st jjt jd�d�}ytjjj|�}W n@ tk rH t d|��Y n$ tj jjk rj t d|��Y nX || _ x\|jD ]R}|jtjjjkrz|jdkrzx2|jD ](}|jtjjjkr�|jdkr�| j|� q�W qzW | j� dS )ziParse a list of recently used files. filename defaults to ``~/.recently-used``. �HOMEz.recently-usedzFile not foundzNot a valid .menu filer Z RecentItemN)�os�path�join�getenv�xml�domZminidom�parse�IOErrorr ZparsersZexpatZ ExpatErrorr � childNodes�nodeType�Node�ELEMENT_NODE�tagName�_RecentFiles__parseRecentItem�sort)r r �docZchild�recentr r r r s"