Current Path : /usr/lib/python2.7/dist-packages/gi/_glib/ |
Current File : //usr/lib/python2.7/dist-packages/gi/_glib/option.pyc |
-Oc @ s d Z d d l Z d d l Z d d l m Z m Z m Z m Z m Z e j d k rg e Z d Z n e Z e Z d d l Z e j d Z d d d d d d d d d g Z d e j f d YZ d e j f d YZ d e j f d YZ e Z d S( s, GOption command line parser Extends optparse to use the GOptionGroup, GOptionEntry and GOptionContext objects. So it is possible to use the gtk, gnome_program and gstreamer command line groups and contexts. Use this interface instead of the raw wrappers of GOptionContext and GOptionGroup in glib. iN( t OptParseErrort OptionErrort OptionValueErrort BadOptionErrort OptionConflictErrori i c C s | j S( N( t encode( t s( ( s3 /usr/lib/python2.7/dist-packages/gi/_glib/option.pyt <lambda>' s s gi._glib._glibR R R R R t Optiont OptionGroupt OptionParsert make_optionc B s_ e Z d Z e j j d Z e j j d d d g Z d e j Z d Z d Z d Z RS( s Represents a command line option To use the extended possibilities of the GOption API Option (and make_option) are extended with new types and attributes. Types: filename The supplied arguments are read as filename, GOption parses this type in with the GLib filename encoding. Attributes: optional_arg This does not need a arguement, but it can be supplied. hidden The help list does not show this option in_main This option apears in the main group, this should only be used for backwards compatibility. Use Option.REMAINING as option name to get all positional arguments. NOTE: Every argument to an option is passed as utf-8 coded string, the only exception are options which use the 'filename' type, its arguments are passed as strings in the GLib filename encoding. For further help, see optparse.Option. t filenamet hiddent in_maint optional_args --c O s t j j | | | | j s. t d n t | j t | j k r[ t d n | j s} t d | j d n d S( Ns! %s at least one long option name.s; %s at least more long option names than short option names.s %s needs a help message.i ( t optparseR t __init__t _long_optst ValueErrort lent _short_optst help( t selft argst kwargs( ( s3 /usr/lib/python2.7/dist-packages/gi/_glib/option.pyR _ s c C si | j | k r% | j j | j n t j j | | t | j t | j k re t d n d S( NsC goption.Option needs more long option names than short option names( t REMAININGR t appendR R t _set_opt_stringR R R ( R t opts( ( s3 /usr/lib/python2.7/dist-packages/gi/_glib/option.pyR l s c c s# d } | j r | t j O} n | j r8 | t j O} n | j r` | j rm | t j O} qm n | t j O} | j d k r | t j O} n xK t | j | j D]4 \ } } | d t | d | | j | j f Vq WxB | j t | j D]* } | d t d | | j | j f Vq Wd S( Ni R i i t ( R t _glibt OPTION_FLAG_HIDDENR t OPTION_FLAG_IN_MAINt takes_valueR t OPTION_FLAG_OPTIONAL_ARGt OPTION_FLAG_NO_ARGt typet OPTION_FLAG_FILENAMEt zipR R t _bytesR t metavarR ( R t flagst long_namet short_name( ( s3 /usr/lib/python2.7/dist-packages/gi/_glib/option.pyt _to_goptionentriest s ",( s filename( t __name__t __module__t __doc__R R t TYPESt ATTRSR t OPTION_REMAININGR R R R- ( ( ( s3 /usr/lib/python2.7/dist-packages/gi/_glib/option.pyR ; s c B sJ e Z d Z d d d d d Z d Z d Z d d Z d Z RS( s A group of command line options. Arguements: name: The groups name, used to create the --help-{name} option description: Shown as title of the groups help view help_description: Shown as help to the --help-{name} option option_list: The options used in this group, must be option.Option() defaults: A dicitionary of default values translation_domain: Sets the translation domain for gettext(). NOTE: This OptionGroup does not exactly map the optparse.OptionGroup interface. There is no parser object to supply, but it is possible to set default values and option_lists. Also the default values and values are not shared with the OptionParser. To pass a OptionGroup into a function which expects a GOptionGroup (e.g. gnome_program_init() ). OptionGroup.get_option_group() can be used. For further help, see optparse.OptionGroup. t c C s t j j | t d | | | _ d | _ | | _ | rF | | _ n d | _ | | _ | r x | D] } | j | qe Wn d S( Nt error( R t OptionContainerR R t namet Nonet parsert help_descriptiont defaultst valuest translation_domaint add_option( R R7 t descriptionR: t option_listR; R= t option( ( s3 /usr/lib/python2.7/dist-packages/gi/_glib/option.pyR s c C s g | _ | j d S( N( R@ t _create_option_mappings( R ( ( s3 /usr/lib/python2.7/dist-packages/gi/_glib/option.pyt _create_option_list s c s f d } t j j j j | } j rO | j j n g } x$ j D] } | j | j q_ W| j | | S( Nc s | j d r j | } n j | } y | j | | j Wnc t k r t j d } t j t | } t j | _ t j | _ t | | _ | n Xd S( Ns --i ( t startswitht _long_optt _short_optt processR<