ó §Zc @s:dZddlZddlZddlmZmZmZmZmZddlm Z ej dkrwe Z d„Z n eZ e Z dd lmZdd lmZe d ƒZejejƒƒZd d dddddddg Zdejfd„ƒYZdejfd„ƒYZdejfd„ƒYZeZdS(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. iÿÿÿÿN(t OptParseErrort OptionErrortOptionValueErrortBadOptionErrortOptionConflictErrori(tget_introspection_moduleiicCs |jƒS(N(tencode(ts((s0/usr/lib64/python2.7/site-packages/gi/_option.pyt&s(t_glib(tGErrortGLibRRRRRtOptiont OptionGroupt OptionParsert make_optioncBs_eZdZejjd ZejjdddgZdejZ 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. :ivar optional_arg: This does not need a arguement, but it can be supplied. :ivar hidden: The help list does not show this option :ivar 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. tfilenamethiddentin_maint optional_args--cOstjj|||Ž|js.tdƒ‚nt|jƒt|jƒkr[tdƒ‚n|js}td|jdƒ‚ndS(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(toptparseR t__init__t _long_optst ValueErrortlent _short_optsthelp(tselftargstkwargs((s0/usr/lib64/python2.7/site-packages/gi/_option.pyRes   cCsi|j|kr%|jj|jƒntjj||ƒt|jƒt|jƒkretdƒ‚ndS(NsCgoption.Option needs more long option names than short option names( t REMAININGRtappendRR t_set_opt_stringRRR(Rtopts((s0/usr/lib64/python2.7/site-packages/gi/_option.pyR qs ccs2d}|jr"|tjjO}n|jr>|tjjO}n|jƒri|jry|tjjO}qyn|tjj O}|j dkr›|tjj O}nxKt |j |jƒD]4\}}|dt|dƒ||j|jfVq±WxB|j t|jƒD]*}|dtdƒ||j|jfVqWdS(NiRiit(RR t OptionFlagstHIDDENRtIN_MAINt takes_valueRt OPTIONAL_ARGtNO_ARGttypetFILENAMEtzipRRt_bytesRtmetavarR(Rtflagst long_namet short_name((s0/usr/lib64/python2.7/site-packages/gi/_option.pyt_to_goptionentriesys    ",(sfilename( t__name__t __module__t__doc__RR tTYPEStATTRSR tOPTION_REMAININGRRR R1(((s0/usr/lib64/python2.7/site-packages/gi/_option.pyR >s     cBsJeZdZddddd„Zd„Zd„Zdd„Zd„ZRS(s÷A group of command line options. :param str name: The groups name, used to create the --help-{name} option :param str description: Shown as title of the groups help view :param str help_description: Shown as help to the --help-{name} option :param list option_list: The options used in this group, must be option.Option() :param dict defaults: A dicitionary of default values :param 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. tcCsƒtjj|td|ƒ||_d|_||_|rF||_nd|_ ||_ |rx|D]}|j |ƒqeWndS(Nterror( RtOptionContainerRR tnametNonetparserthelp_descriptiontdefaultstvaluesttranslation_domaint add_option(RR;t descriptionR>t option_listR?RAtoption((s0/usr/lib64/python2.7/site-packages/gi/_option.pyR­s       cCsg|_|jƒdS(N(RDt_create_option_mappings(R((s0/usr/lib64/python2.7/site-packages/gi/_option.pyt_create_option_list¿s cs‡‡fd†}tjˆjˆjˆj|ƒ}ˆjrO|jˆjƒng}x$ˆjD]}|j|j ƒƒq_W|j |ƒ|S(Ncs°|jdƒrˆj|}n ˆj|}y|j||ˆjˆƒWn`tk r«tjƒd}tt |ƒƒ}t |_ t j j|_t |ƒ|_|‚nXdS(Ns--i(t startswitht _long_optt _short_opttprocessR@Rtsystexc_infoR tstrtOPTION_CONTEXT_ERROR_QUARKtdomainR Rt BAD_VALUEtcodetmessage(t option_namet option_valuetgrouptoptR9tgerror(R=R(s0/usr/lib64/python2.7/site-packages/gi/_option.pytcallbackÄs   ( R R R;RCR>RAtset_translation_domainRDtextendR1t add_entries(RR=RYRVtentriesRE((R=Rs0/usr/lib64/python2.7/site-packages/gi/_option.pyt_to_goptiongroupÃs  cCs|jƒ|j|ƒS(s€ Returns the corresponding GOptionGroup object. Can be used as parameter for gnome_program_init(), gtk_init(). (tset_values_to_defaultsR^(RR=((s0/usr/lib64/python2.7/site-packages/gi/_option.pytget_option_groupás cCs|x`|jD]U}|jj|jƒ}t|tƒr |jƒ}|j||ƒ|j|js4  (   Ta€