GLib.OptionGroup¶
Fields¶
None
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class GLib.OptionGroup¶
A
GOptionGroupstruct defines the options in a single group. The struct has only private fields and should not be directly accessed.All options in a group share the same translation function. Libraries which need to parse commandline options are expected to provide a function for getting a
GOptionGroupholding their options, which the application can then add to itsGLib.OptionContext.- classmethod new(name, description, help_description, user_data, destroy)[source]¶
- Parameters:
name (
str) – the name for the option group, this is used to provide help for the options in this group with--help-namedescription (
str) – a description for this group to be shown in--help. This string is translated using the translation domain or translation function of the grouphelp_description (
str) – a description for the--help-name option. This string is translated using the translation domain or translation function of the groupuser_data (
objectorNone) – user data that will be passed to the pre- and post-parse hooks, the error hook and to callbacks ofGLib.OptionArg.CALLBACKoptions, orNonedestroy (
GLib.DestroyNotifyorNone) – a function that will be called to free user_data, orNone
- Returns:
a newly created option group. It should be added to a
GLib.OptionContextor freed withGLib.OptionGroup.unref().- Return type:
Creates a new
GLib.OptionGroup.description is typically used to provide a title for the group. If so, it is recommended that it’s written in title case, and has a trailing colon so that it matches the style of built-in GLib group titles such as ‘Application Options:’.
New in version 2.6.
- add_entries(entries)[source]¶
- Parameters:
entries ([
GLib.OptionEntry]) – aNone-terminated array ofGLib.OptionEntrys
Adds the options specified in entries to self.
New in version 2.6.
- free()[source]¶
Frees a
GLib.OptionGroup. Note that you must not free groups which have been added to aGLib.OptionContext.New in version 2.6.
Deprecated since version 2.44: Use
GLib.OptionGroup.unref() instead.
- ref()[source]¶
- Returns:
- Return type:
Increments the reference count of self by one.
New in version 2.44.
- set_translate_func(func, *data)[source]¶
- Parameters:
func (
GLib.TranslateFuncorNone) – theGLib.TranslateFunc, orNone
Sets the function which is used to translate user-visible strings, for
--helpoutput. Different groups can use differentGLib.TranslateFuncs. If func isNone, strings are not translated.If you are using gettext(), you only need to set the translation domain, see
GLib.OptionGroup.set_translation_domain().New in version 2.6.