View file File name : Menu.cpython-36.pyc Content :3 �N�P�� � @ s� d Z ddlZddlZddlZddlZddlmZmZ ddl m Z ddlmZm Z mZ ddlmZ ddlZddlZejjjZdd� ZG d d � d �ZG dd� d�ZG d d� d�ZG dd� d�ZG dd� d�ZG dd� d�ZG dd� d�Zi Zdd� Z dIdd�Z!dJdd�Z"dd� Z#dd � Z$d!d"� Z%d#d$� Z&d%d&� Z'd'd(� Z(d)d*� Z)d+d,� Z*d-d.� Z+d/d0� Z,d1d2� Z-d3d4� Z.d5d6� Z/d7d8� Z0d9d:� Z1d;d<� Z2d=d>� Z3d?d@� Z4dAdB� Z5dCdD� Z6dEdF� Z7G dGdH� dH�Z8dS )Ka� Implementation of the XDG Menu Specification Version 1.0.draft-1 http://standards.freedesktop.org/menu-spec/ Example code: from xdg.Menu import parse, Menu, MenuEntry def print_menu(menu, tab=0): for submenu in menu.Entries: if isinstance(submenu, Menu): print (" " * tab) + unicode(submenu) print_menu(submenu, tab+1) elif isinstance(submenu, MenuEntry): print (" " * tab) + unicode(submenu.DesktopEntry) print_menu(parse()) � N)� xdg_data_dirs�xdg_config_dirs)�DesktopEntry)�ParsingError�ValidationError�debug)�PY3c C s$ t rt| t�r| jd�} tj| �S )zkWrapper around locale.strxfrm that accepts unicode strings on Python 2. See Python bug #2481. zutf-8)r � isinstance�unicode�encode�locale�strxfrm)�s� r �/usr/lib/python3.6/Menu.py�_strxfrm! s r c @ s� e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dd� Z d$dd�Zd%dd�Zdd� Z d&dd�Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#S )'�Menuz[Menu containing sub menus under menu.Entries Contains both Menu and MenuEntry items. c C s� d| _ d | _g | _d| _d| _d| _d | _d| _d| _d| _ g | _ d | _d| _g | _ g | _d | _g | _g | _d| _g | _g | _d S )N� r FT�notset)�Name� Directory�Entries�Doc�Filename�Depth�Parent�NotInXml�Show�Visible�AppDirs� DefaultLayout�Deleted�Directories� DirectoryDirs�Layout�MenuEntries�Moves�OnlyUnallocated�Rules�Submenus)�selfr r r �__init__/ s* z Menu.__init__c C s | j S )N)r )r* r r r �__str__K s zMenu.__str__c C s� x|j D ]}| j j|� qW x|jD ]}| jj|� q$W x|jD ]}| jj|� q@W |jdkrf|j| _|jdkrx|j| _|jr�|j| _|jr�|j| _x|jD ]}| jj|� q�W x|j D ]}| j j|� q�W x|j D ]}| j|� q�W | S )Nr )r �appendr# r"