Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 88

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 215

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 216

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 217

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 218

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 219

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 220
PK!11 __init__.pynu[import types import warnings import importlib import sys from pkgutil import get_loader from gi import PyGIDeprecationWarning from gi._gi import CallableInfo from gi._constants import \ TYPE_NONE, \ TYPE_INVALID # support overrides in different directories than our gi module from pkgutil import extend_path __path__ = extend_path(__path__, __name__) # namespace -> (attr, replacement) _deprecated_attrs = {} def wraps(wrapped): def assign(wrapper): wrapper.__name__ = wrapped.__name__ wrapper.__module__ = wrapped.__module__ return wrapper return assign class OverridesProxyModule(types.ModuleType): """Wraps a introspection module and contains all overrides""" def __init__(self, introspection_module): super(OverridesProxyModule, self).__init__( introspection_module.__name__) self._introspection_module = introspection_module def __getattr__(self, name): return getattr(self._introspection_module, name) def __dir__(self): result = set(dir(self.__class__)) result.update(self.__dict__.keys()) result.update(dir(self._introspection_module)) return sorted(result) def __repr__(self): return "<%s %r>" % (type(self).__name__, self._introspection_module) class _DeprecatedAttribute(object): """A deprecation descriptor for OverridesProxyModule subclasses. Emits a PyGIDeprecationWarning on every access and tries to act as a normal instance attribute (can be replaced and deleted). """ def __init__(self, namespace, attr, value, replacement): self._attr = attr self._value = value self._warning = PyGIDeprecationWarning( '%s.%s is deprecated; use %s instead' % ( namespace, attr, replacement)) def __get__(self, instance, owner): if instance is None: raise AttributeError(self._attr) warnings.warn(self._warning, stacklevel=2) return self._value def __set__(self, instance, value): attr = self._attr # delete the descriptor, then set the instance value delattr(type(instance), attr) setattr(instance, attr, value) def __delete__(self, instance): # delete the descriptor delattr(type(instance), self._attr) def load_overrides(introspection_module): """Loads overrides for an introspection module. Either returns the same module again in case there are no overrides or a proxy module including overrides. Doesn't cache the result. """ namespace = introspection_module.__name__.rsplit(".", 1)[-1] module_key = 'gi.repository.' + namespace # We use sys.modules so overrides can import from gi.repository # but restore everything at the end so this doesn't have any side effects has_old = module_key in sys.modules old_module = sys.modules.get(module_key) # Create a new sub type, so we can separate descriptors like # _DeprecatedAttribute for each namespace. proxy_type = type(namespace + "ProxyModule", (OverridesProxyModule, ), {}) proxy = proxy_type(introspection_module) sys.modules[module_key] = proxy # backwards compat: # gedit uses gi.importer.modules['Gedit']._introspection_module from ..importer import modules assert hasattr(proxy, "_introspection_module") modules[namespace] = proxy try: override_package_name = 'gi.overrides.' + namespace # http://bugs.python.org/issue14710 try: override_loader = get_loader(override_package_name) except AttributeError: override_loader = None # Avoid checking for an ImportError, an override might # depend on a missing module thus causing an ImportError if override_loader is None: return introspection_module override_mod = importlib.import_module(override_package_name) finally: del modules[namespace] del sys.modules[module_key] if has_old: sys.modules[module_key] = old_module # backwards compat: for gst-python/gstmodule.c, # which tries to access Gst.Fraction through # Gst._overrides_module.Fraction. We assign the proxy instead as that # contains all overridden classes like Fraction during import anyway and # there is no need to keep the real override module alive. proxy._overrides_module = proxy override_all = [] if hasattr(override_mod, "__all__"): override_all = override_mod.__all__ for var in override_all: try: item = getattr(override_mod, var) except (AttributeError, TypeError): # Gedit puts a non-string in __all__, so catch TypeError here continue setattr(proxy, var, item) # Replace deprecated module level attributes with a descriptor # which emits a warning when accessed. for attr, replacement in _deprecated_attrs.pop(namespace, []): try: value = getattr(proxy, attr) except AttributeError: raise AssertionError( "%s was set deprecated but wasn't added to __all__" % attr) delattr(proxy, attr) deprecated_attr = _DeprecatedAttribute( namespace, attr, value, replacement) setattr(proxy_type, attr, deprecated_attr) return proxy def override(type_): """Decorator for registering an override. Other than objects added to __all__, these can get referenced in the same override module via the gi.repository module (get_parent_for_object() does for example), so they have to be added to the module immediately. """ if isinstance(type_, CallableInfo): func = type_ namespace = func.__module__.rsplit('.', 1)[-1] module = sys.modules["gi.repository." + namespace] def wrapper(func): setattr(module, func.__name__, func) return func return wrapper elif isinstance(type_, types.FunctionType): raise TypeError("func must be a gi function, got %s" % type_) else: try: info = getattr(type_, '__info__') except AttributeError: raise TypeError( 'Can not override a type %s, which is not in a gobject ' 'introspection typelib' % type_.__name__) if not type_.__module__.startswith('gi.overrides'): raise KeyError( 'You have tried override outside of the overrides module. ' 'This is not allowed (%s, %s)' % (type_, type_.__module__)) g_type = info.get_g_type() assert g_type != TYPE_NONE if g_type != TYPE_INVALID: g_type.pytype = type_ namespace = type_.__module__.rsplit(".", 1)[-1] module = sys.modules["gi.repository." + namespace] setattr(module, type_.__name__, type_) return type_ overridefunc = override """Deprecated""" def deprecated(fn, replacement): """Decorator for marking methods and classes as deprecated""" @wraps(fn) def wrapped(*args, **kwargs): warnings.warn('%s is deprecated; use %s instead' % (fn.__name__, replacement), PyGIDeprecationWarning, stacklevel=2) return fn(*args, **kwargs) return wrapped def deprecated_attr(namespace, attr, replacement): """Marks a module level attribute as deprecated. Accessing it will emit a PyGIDeprecationWarning warning. e.g. for ``deprecated_attr("GObject", "STATUS_FOO", "GLib.Status.FOO")`` accessing GObject.STATUS_FOO will emit: "GObject.STATUS_FOO is deprecated; use GLib.Status.FOO instead" :param str namespace: The namespace of the override this is called in. :param str namespace: The attribute name (which gets added to __all__). :param str replacement: The replacement text which will be included in the warning. """ _deprecated_attrs.setdefault(namespace, []).append((attr, replacement)) def deprecated_init(super_init_func, arg_names, ignore=tuple(), deprecated_aliases={}, deprecated_defaults={}, category=PyGIDeprecationWarning, stacklevel=2): """Wrapper for deprecating GObject based __init__ methods which specify defaults already available or non-standard defaults. :param callable super_init_func: Initializer to wrap. :param list arg_names: Ordered argument name list. :param list ignore: List of argument names to ignore when calling the wrapped function. This is useful for function which take a non-standard keyword that is munged elsewhere. :param dict deprecated_aliases: Dictionary mapping a keyword alias to the actual g_object_newv keyword. :param dict deprecated_defaults: Dictionary of non-standard defaults that will be used when the keyword is not explicitly passed. :param Exception category: Exception category of the error. :param int stacklevel: Stack level for the deprecation passed on to warnings.warn :returns: Wrapped version of ``super_init_func`` which gives a deprecation warning when non-keyword args or aliases are used. :rtype: callable """ # We use a list of argument names to maintain order of the arguments # being deprecated. This allows calls with positional arguments to # continue working but with a deprecation message. def new_init(self, *args, **kwargs): """Initializer for a GObject based classes with support for property sets through the use of explicit keyword arguments. """ # Print warnings for calls with positional arguments. if args: warnings.warn('Using positional arguments with the GObject constructor has been deprecated. ' 'Please specify keyword(s) for "%s" or use a class specific constructor. ' 'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations' % ', '.join(arg_names[:len(args)]), category, stacklevel=stacklevel) new_kwargs = dict(zip(arg_names, args)) else: new_kwargs = {} new_kwargs.update(kwargs) # Print warnings for alias usage and transfer them into the new key. aliases_used = [] for key, alias in deprecated_aliases.items(): if alias in new_kwargs: new_kwargs[key] = new_kwargs.pop(alias) aliases_used.append(key) if aliases_used: warnings.warn('The keyword(s) "%s" have been deprecated in favor of "%s" respectively. ' 'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations' % (', '.join(deprecated_aliases[k] for k in sorted(aliases_used)), ', '.join(sorted(aliases_used))), category, stacklevel=stacklevel) # Print warnings for defaults different than what is already provided by the property defaults_used = [] for key, value in deprecated_defaults.items(): if key not in new_kwargs: new_kwargs[key] = deprecated_defaults[key] defaults_used.append(key) if defaults_used: warnings.warn('Initializer is relying on deprecated non-standard ' 'defaults. Please update to explicitly use: %s ' 'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations' % ', '.join('%s=%s' % (k, deprecated_defaults[k]) for k in sorted(defaults_used)), category, stacklevel=stacklevel) # Remove keywords that should be ignored. for key in ignore: if key in new_kwargs: new_kwargs.pop(key) return super_init_func(self, **new_kwargs) return new_init def strip_boolean_result(method, exc_type=None, exc_str=None, fail_ret=None): """Translate method's return value for stripping off success flag. There are a lot of methods which return a "success" boolean and have several out arguments. Translate such a method to return the out arguments on success and None on failure. """ @wraps(method) def wrapped(*args, **kwargs): ret = method(*args, **kwargs) if ret[0]: if len(ret) == 2: return ret[1] else: return ret[1:] else: if exc_type: raise exc_type(exc_str or 'call failed') return fail_ret return wrapped PK!5aGtk.pynu[# -*- Mode: Python; py-indent-offset: 4 -*- # vim: tabstop=4 shiftwidth=4 expandtab # # Copyright (C) 2009 Johan Dahlin # 2010 Simon van der Linden # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA import collections import sys import warnings from gi.repository import GObject from .._ossighelper import wakeup_on_signal, register_sigint_fallback from ..overrides import override, strip_boolean_result, deprecated_init from ..module import get_introspection_module from gi import PyGIDeprecationWarning if sys.version_info >= (3, 0): _basestring = str else: _basestring = basestring Gtk = get_introspection_module('Gtk') __all__ = [] if Gtk._version == '2.0': warn_msg = "You have imported the Gtk 2.0 module. Because Gtk 2.0 \ was not designed for use with introspection some of the \ interfaces and API will fail. As such this is not supported \ by the pygobject development team and we encourage you to \ port your app to Gtk 3 or greater. PyGTK is the recomended \ python module to use with Gtk 2.0" warnings.warn(warn_msg, RuntimeWarning) class PyGTKDeprecationWarning(PyGIDeprecationWarning): pass __all__.append('PyGTKDeprecationWarning') def _construct_target_list(targets): """Create a list of TargetEntry items from a list of tuples in the form (target, flags, info) The list can also contain existing TargetEntry items in which case the existing entry is re-used in the return list. """ target_entries = [] for entry in targets: if not isinstance(entry, Gtk.TargetEntry): entry = Gtk.TargetEntry.new(*entry) target_entries.append(entry) return target_entries __all__.append('_construct_target_list') def _extract_handler_and_args(obj_or_map, handler_name): handler = None if isinstance(obj_or_map, collections.Mapping): handler = obj_or_map.get(handler_name, None) else: handler = getattr(obj_or_map, handler_name, None) if handler is None: raise AttributeError('Handler %s not found' % handler_name) args = () if isinstance(handler, collections.Sequence): if len(handler) == 0: raise TypeError("Handler %s tuple can not be empty" % handler) args = handler[1:] handler = handler[0] elif not callable(handler): raise TypeError('Handler %s is not a method, function or tuple' % handler) return handler, args # Exposed for unit-testing. __all__.append('_extract_handler_and_args') def _builder_connect_callback(builder, gobj, signal_name, handler_name, connect_obj, flags, obj_or_map): handler, args = _extract_handler_and_args(obj_or_map, handler_name) after = flags & GObject.ConnectFlags.AFTER if connect_obj is not None: if after: gobj.connect_object_after(signal_name, handler, connect_obj, *args) else: gobj.connect_object(signal_name, handler, connect_obj, *args) else: if after: gobj.connect_after(signal_name, handler, *args) else: gobj.connect(signal_name, handler, *args) class Widget(Gtk.Widget): translate_coordinates = strip_boolean_result(Gtk.Widget.translate_coordinates) def drag_dest_set_target_list(self, target_list): if (target_list is not None) and (not isinstance(target_list, Gtk.TargetList)): target_list = Gtk.TargetList.new(_construct_target_list(target_list)) super(Widget, self).drag_dest_set_target_list(target_list) def drag_source_set_target_list(self, target_list): if (target_list is not None) and (not isinstance(target_list, Gtk.TargetList)): target_list = Gtk.TargetList.new(_construct_target_list(target_list)) super(Widget, self).drag_source_set_target_list(target_list) def style_get_property(self, property_name, value=None): if value is None: prop = self.find_style_property(property_name) if prop is None: raise ValueError('Class "%s" does not contain style property "%s"' % (self, property_name)) value = GObject.Value(prop.value_type) Gtk.Widget.style_get_property(self, property_name, value) return value.get_value() Widget = override(Widget) __all__.append('Widget') class Container(Gtk.Container, Widget): def __len__(self): return len(self.get_children()) def __contains__(self, child): return child in self.get_children() def __iter__(self): return iter(self.get_children()) def __bool__(self): return True # alias for Python 2.x object protocol __nonzero__ = __bool__ get_focus_chain = strip_boolean_result(Gtk.Container.get_focus_chain) def child_get_property(self, child, property_name, value=None): if value is None: prop = self.find_child_property(property_name) if prop is None: raise ValueError('Class "%s" does not contain child property "%s"' % (self, property_name)) value = GObject.Value(prop.value_type) Gtk.Container.child_get_property(self, child, property_name, value) return value.get_value() def child_get(self, child, *prop_names): """Returns a list of child property values for the given names.""" return [self.child_get_property(child, name) for name in prop_names] def child_set(self, child, **kwargs): """Set a child properties on the given child to key/value pairs.""" for name, value in kwargs.items(): name = name.replace('_', '-') self.child_set_property(child, name, value) Container = override(Container) __all__.append('Container') class Editable(Gtk.Editable): def insert_text(self, text, position): return super(Editable, self).insert_text(text, -1, position) get_selection_bounds = strip_boolean_result(Gtk.Editable.get_selection_bounds, fail_ret=()) Editable = override(Editable) __all__.append("Editable") if Gtk._version in ("2.0", "3.0"): class Action(Gtk.Action): __init__ = deprecated_init(Gtk.Action.__init__, arg_names=('name', 'label', 'tooltip', 'stock_id'), category=PyGTKDeprecationWarning) Action = override(Action) __all__.append("Action") class RadioAction(Gtk.RadioAction): __init__ = deprecated_init(Gtk.RadioAction.__init__, arg_names=('name', 'label', 'tooltip', 'stock_id', 'value'), category=PyGTKDeprecationWarning) RadioAction = override(RadioAction) __all__.append("RadioAction") class ActionGroup(Gtk.ActionGroup): __init__ = deprecated_init(Gtk.ActionGroup.__init__, arg_names=('name',), category=PyGTKDeprecationWarning) def add_actions(self, entries, user_data=None): """ The add_actions() method is a convenience method that creates a number of gtk.Action objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The entry tuples can vary in size from one to six items with the following information: * The name of the action. Must be specified. * The stock id for the action. Optional with a default value of None if a label is specified. * The label for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None if a stock id is specified. * The accelerator for the action, in the format understood by the gtk.accelerator_parse() function. Optional with a default value of None. * The tooltip for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None. * The callback function invoked when the action is activated. Optional with a default value of None. The "activate" signals of the actions are connected to the callbacks and their accel paths are set to /group-name/action-name. """ try: iter(entries) except (TypeError): raise TypeError('entries must be iterable') def _process_action(name, stock_id=None, label=None, accelerator=None, tooltip=None, callback=None): action = Action(name=name, label=label, tooltip=tooltip, stock_id=stock_id) if callback is not None: if user_data is None: action.connect('activate', callback) else: action.connect('activate', callback, user_data) self.add_action_with_accel(action, accelerator) for e in entries: # using inner function above since entries can leave out optional arguments _process_action(*e) def add_toggle_actions(self, entries, user_data=None): """ The add_toggle_actions() method is a convenience method that creates a number of gtk.ToggleAction objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The toggle action entry tuples can vary in size from one to seven items with the following information: * The name of the action. Must be specified. * The stock id for the action. Optional with a default value of None if a label is specified. * The label for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None if a stock id is specified. * The accelerator for the action, in the format understood by the gtk.accelerator_parse() function. Optional with a default value of None. * The tooltip for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None. * The callback function invoked when the action is activated. Optional with a default value of None. * A flag indicating whether the toggle action is active. Optional with a default value of False. The "activate" signals of the actions are connected to the callbacks and their accel paths are set to /group-name/action-name. """ try: iter(entries) except (TypeError): raise TypeError('entries must be iterable') def _process_action(name, stock_id=None, label=None, accelerator=None, tooltip=None, callback=None, is_active=False): action = Gtk.ToggleAction(name=name, label=label, tooltip=tooltip, stock_id=stock_id) action.set_active(is_active) if callback is not None: if user_data is None: action.connect('activate', callback) else: action.connect('activate', callback, user_data) self.add_action_with_accel(action, accelerator) for e in entries: # using inner function above since entries can leave out optional arguments _process_action(*e) def add_radio_actions(self, entries, value=None, on_change=None, user_data=None): """ The add_radio_actions() method is a convenience method that creates a number of gtk.RadioAction objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The entry tuples can vary in size from one to six items with the following information: * The name of the action. Must be specified. * The stock id for the action. Optional with a default value of None if a label is specified. * The label for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None if a stock id is specified. * The accelerator for the action, in the format understood by the gtk.accelerator_parse() function. Optional with a default value of None. * The tooltip for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None. * The value to set on the radio action. Optional with a default value of 0. Should be specified in applications. The value parameter specifies the radio action that should be set active. The "changed" signal of the first radio action is connected to the on_change callback (if specified and not None) and the accel paths of the actions are set to /group-name/action-name. """ try: iter(entries) except (TypeError): raise TypeError('entries must be iterable') first_action = None def _process_action(group_source, name, stock_id=None, label=None, accelerator=None, tooltip=None, entry_value=0): action = RadioAction(name=name, label=label, tooltip=tooltip, stock_id=stock_id, value=entry_value) # FIXME: join_group is a patch to Gtk+ 3.0 # otherwise we can't effectively add radio actions to a # group. Should we depend on 3.0 and error out here # or should we offer the functionality via a compat # C module? if hasattr(action, 'join_group'): action.join_group(group_source) if value == entry_value: action.set_active(True) self.add_action_with_accel(action, accelerator) return action for e in entries: # using inner function above since entries can leave out optional arguments action = _process_action(first_action, *e) if first_action is None: first_action = action if first_action is not None and on_change is not None: if user_data is None: first_action.connect('changed', on_change) else: first_action.connect('changed', on_change, user_data) ActionGroup = override(ActionGroup) __all__.append('ActionGroup') class UIManager(Gtk.UIManager): def add_ui_from_string(self, buffer): if not isinstance(buffer, _basestring): raise TypeError('buffer must be a string') length = len(buffer.encode('UTF-8')) return Gtk.UIManager.add_ui_from_string(self, buffer, length) def insert_action_group(self, buffer, length=-1): return Gtk.UIManager.insert_action_group(self, buffer, length) UIManager = override(UIManager) __all__.append('UIManager') class ComboBox(Gtk.ComboBox, Container): get_active_iter = strip_boolean_result(Gtk.ComboBox.get_active_iter) ComboBox = override(ComboBox) __all__.append('ComboBox') class Box(Gtk.Box): __init__ = deprecated_init(Gtk.Box.__init__, arg_names=('homogeneous', 'spacing'), category=PyGTKDeprecationWarning) Box = override(Box) __all__.append('Box') class SizeGroup(Gtk.SizeGroup): __init__ = deprecated_init(Gtk.SizeGroup.__init__, arg_names=('mode',), deprecated_defaults={'mode': Gtk.SizeGroupMode.VERTICAL}, category=PyGTKDeprecationWarning) SizeGroup = override(SizeGroup) __all__.append('SizeGroup') class MenuItem(Gtk.MenuItem): __init__ = deprecated_init(Gtk.MenuItem.__init__, arg_names=('label',), category=PyGTKDeprecationWarning) MenuItem = override(MenuItem) __all__.append('MenuItem') class Builder(Gtk.Builder): def connect_signals(self, obj_or_map): """Connect signals specified by this builder to a name, handler mapping. Connect signal, name, and handler sets specified in the builder with the given mapping "obj_or_map". The handler/value aspect of the mapping can also contain a tuple in the form of (handler [,arg1 [,argN]]) allowing for extra arguments to be passed to the handler. For example: .. code-block:: python builder.connect_signals({'on_clicked': (on_clicked, arg1, arg2)}) """ self.connect_signals_full(_builder_connect_callback, obj_or_map) def add_from_string(self, buffer): if not isinstance(buffer, _basestring): raise TypeError('buffer must be a string') length = len(buffer) return Gtk.Builder.add_from_string(self, buffer, length) def add_objects_from_string(self, buffer, object_ids): if not isinstance(buffer, _basestring): raise TypeError('buffer must be a string') length = len(buffer) return Gtk.Builder.add_objects_from_string(self, buffer, length, object_ids) Builder = override(Builder) __all__.append('Builder') # NOTE: This must come before any other Window/Dialog subclassing, to ensure # that we have a correct inheritance hierarchy. class Window(Gtk.Window): __init__ = deprecated_init(Gtk.Window.__init__, arg_names=('type',), category=PyGTKDeprecationWarning) Window = override(Window) __all__.append('Window') class Dialog(Gtk.Dialog, Container): _old_arg_names = ('title', 'parent', 'flags', 'buttons', '_buttons_property') _init = deprecated_init(Gtk.Dialog.__init__, arg_names=('title', 'transient_for', 'flags', 'add_buttons', 'buttons'), ignore=('flags', 'add_buttons'), deprecated_aliases={'transient_for': 'parent', 'buttons': '_buttons_property'}, category=PyGTKDeprecationWarning) def __init__(self, *args, **kwargs): new_kwargs = kwargs.copy() old_kwargs = dict(zip(self._old_arg_names, args)) old_kwargs.update(kwargs) # Increment the warning stacklevel for sub-classes which implement their own __init__. stacklevel = 2 if self.__class__ != Dialog and self.__class__.__init__ != Dialog.__init__: stacklevel += 1 # buttons was overloaded by PyGtk but is needed for Gtk.MessageDialog # as a pass through, so type check the argument and give a deprecation # when it is not of type Gtk.ButtonsType add_buttons = old_kwargs.get('buttons', None) if add_buttons is not None and not isinstance(add_buttons, Gtk.ButtonsType): warnings.warn('The "buttons" argument must be a Gtk.ButtonsType enum value. ' 'Please use the "add_buttons" method for adding buttons. ' 'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations', PyGTKDeprecationWarning, stacklevel=stacklevel) if 'buttons' in new_kwargs: del new_kwargs['buttons'] else: add_buttons = None flags = old_kwargs.get('flags', 0) if flags: warnings.warn('The "flags" argument for dialog construction is deprecated. ' 'Please use initializer keywords: modal=True and/or destroy_with_parent=True. ' 'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations', PyGTKDeprecationWarning, stacklevel=stacklevel) if flags & Gtk.DialogFlags.MODAL: new_kwargs['modal'] = True if flags & Gtk.DialogFlags.DESTROY_WITH_PARENT: new_kwargs['destroy_with_parent'] = True self._init(*args, **new_kwargs) if add_buttons: self.add_buttons(*add_buttons) def run(self, *args, **kwargs): with register_sigint_fallback(self.destroy): with wakeup_on_signal(): return Gtk.Dialog.run(self, *args, **kwargs) action_area = property(lambda dialog: dialog.get_action_area()) vbox = property(lambda dialog: dialog.get_content_area()) def add_buttons(self, *args): """ The add_buttons() method adds several buttons to the Gtk.Dialog using the button data passed as arguments to the method. This method is the same as calling the Gtk.Dialog.add_button() repeatedly. The button data pairs - button text (or stock ID) and a response ID integer are passed individually. For example: .. code-block:: python dialog.add_buttons(Gtk.STOCK_OPEN, 42, "Close", Gtk.ResponseType.CLOSE) will add "Open" and "Close" buttons to dialog. """ def _button(b): while b: t, r = b[0:2] b = b[2:] yield t, r try: for text, response in _button(args): self.add_button(text, response) except (IndexError): raise TypeError('Must pass an even number of arguments') Dialog = override(Dialog) __all__.append('Dialog') class MessageDialog(Gtk.MessageDialog, Dialog): __init__ = deprecated_init(Gtk.MessageDialog.__init__, arg_names=('parent', 'flags', 'message_type', 'buttons', 'message_format'), deprecated_aliases={'text': 'message_format', 'message_type': 'type'}, category=PyGTKDeprecationWarning) def format_secondary_text(self, message_format): self.set_property('secondary-use-markup', False) self.set_property('secondary-text', message_format) def format_secondary_markup(self, message_format): self.set_property('secondary-use-markup', True) self.set_property('secondary-text', message_format) MessageDialog = override(MessageDialog) __all__.append('MessageDialog') if Gtk._version in ("2.0", "3.0"): class ColorSelectionDialog(Gtk.ColorSelectionDialog): __init__ = deprecated_init(Gtk.ColorSelectionDialog.__init__, arg_names=('title',), category=PyGTKDeprecationWarning) ColorSelectionDialog = override(ColorSelectionDialog) __all__.append('ColorSelectionDialog') class FileChooserDialog(Gtk.FileChooserDialog): __init__ = deprecated_init(Gtk.FileChooserDialog.__init__, arg_names=('title', 'parent', 'action', 'buttons'), category=PyGTKDeprecationWarning) FileChooserDialog = override(FileChooserDialog) __all__.append('FileChooserDialog') if Gtk._version in ("2.0", "3.0"): class FontSelectionDialog(Gtk.FontSelectionDialog): __init__ = deprecated_init(Gtk.FontSelectionDialog.__init__, arg_names=('title',), category=PyGTKDeprecationWarning) FontSelectionDialog = override(FontSelectionDialog) __all__.append('FontSelectionDialog') class RecentChooserDialog(Gtk.RecentChooserDialog): # Note, the "manager" keyword must work across the entire 3.x series because # "recent_manager" is not backwards compatible with PyGObject versions prior to 3.10. __init__ = deprecated_init(Gtk.RecentChooserDialog.__init__, arg_names=('title', 'parent', 'recent_manager', 'buttons'), deprecated_aliases={'recent_manager': 'manager'}, category=PyGTKDeprecationWarning) RecentChooserDialog = override(RecentChooserDialog) __all__.append('RecentChooserDialog') class IconView(Gtk.IconView): __init__ = deprecated_init(Gtk.IconView.__init__, arg_names=('model',), category=PyGTKDeprecationWarning) get_item_at_pos = strip_boolean_result(Gtk.IconView.get_item_at_pos) get_visible_range = strip_boolean_result(Gtk.IconView.get_visible_range) get_dest_item_at_pos = strip_boolean_result(Gtk.IconView.get_dest_item_at_pos) IconView = override(IconView) __all__.append('IconView') class ToolButton(Gtk.ToolButton): __init__ = deprecated_init(Gtk.ToolButton.__init__, arg_names=('stock_id',), category=PyGTKDeprecationWarning) ToolButton = override(ToolButton) __all__.append('ToolButton') class IMContext(Gtk.IMContext): get_surrounding = strip_boolean_result(Gtk.IMContext.get_surrounding) IMContext = override(IMContext) __all__.append('IMContext') class RecentInfo(Gtk.RecentInfo): get_application_info = strip_boolean_result(Gtk.RecentInfo.get_application_info) RecentInfo = override(RecentInfo) __all__.append('RecentInfo') class TextBuffer(Gtk.TextBuffer): def _get_or_create_tag_table(self): table = self.get_tag_table() if table is None: table = Gtk.TextTagTable() self.set_tag_table(table) return table def create_tag(self, tag_name=None, **properties): """Creates a tag and adds it to the tag table of the TextBuffer. :param str tag_name: Name of the new tag, or None :param **properties: Keyword list of properties and their values This is equivalent to creating a Gtk.TextTag and then adding the tag to the buffer's tag table. The returned tag is owned by the buffer's tag table. If ``tag_name`` is None, the tag is anonymous. If ``tag_name`` is not None, a tag called ``tag_name`` must not already exist in the tag table for this buffer. Properties are passed as a keyword list of names and values (e.g. foreground='DodgerBlue', weight=Pango.Weight.BOLD) :returns: A new tag. """ tag = Gtk.TextTag(name=tag_name, **properties) self._get_or_create_tag_table().add(tag) return tag def create_mark(self, mark_name, where, left_gravity=False): return Gtk.TextBuffer.create_mark(self, mark_name, where, left_gravity) def set_text(self, text, length=-1): Gtk.TextBuffer.set_text(self, text, length) def insert(self, iter, text, length=-1): if not isinstance(text, _basestring): raise TypeError('text must be a string, not %s' % type(text)) Gtk.TextBuffer.insert(self, iter, text, length) def insert_with_tags(self, iter, text, *tags): start_offset = iter.get_offset() self.insert(iter, text) if not tags: return start = self.get_iter_at_offset(start_offset) for tag in tags: self.apply_tag(tag, start, iter) def insert_with_tags_by_name(self, iter, text, *tags): tag_objs = [] for tag in tags: tag_obj = self.get_tag_table().lookup(tag) if not tag_obj: raise ValueError('unknown text tag: %s' % tag) tag_objs.append(tag_obj) self.insert_with_tags(iter, text, *tag_objs) def insert_at_cursor(self, text, length=-1): if not isinstance(text, _basestring): raise TypeError('text must be a string, not %s' % type(text)) Gtk.TextBuffer.insert_at_cursor(self, text, length) get_selection_bounds = strip_boolean_result(Gtk.TextBuffer.get_selection_bounds, fail_ret=()) TextBuffer = override(TextBuffer) __all__.append('TextBuffer') class TextIter(Gtk.TextIter): forward_search = strip_boolean_result(Gtk.TextIter.forward_search) backward_search = strip_boolean_result(Gtk.TextIter.backward_search) TextIter = override(TextIter) __all__.append('TextIter') class TreeModel(Gtk.TreeModel): def __len__(self): return self.iter_n_children(None) def __bool__(self): return True # alias for Python 2.x object protocol __nonzero__ = __bool__ def _getiter(self, key): if isinstance(key, Gtk.TreeIter): return key elif isinstance(key, int) and key < 0: index = len(self) + key if index < 0: raise IndexError("row index is out of bounds: %d" % key) try: aiter = self.get_iter(index) except ValueError: raise IndexError("could not find tree path '%s'" % key) return aiter else: try: aiter = self.get_iter(key) except ValueError: raise IndexError("could not find tree path '%s'" % key) return aiter def _coerce_path(self, path): if isinstance(path, Gtk.TreePath): return path else: return TreePath(path) def __getitem__(self, key): aiter = self._getiter(key) return TreeModelRow(self, aiter) def __setitem__(self, key, value): row = self[key] self.set_row(row.iter, value) def __delitem__(self, key): aiter = self._getiter(key) self.remove(aiter) def __iter__(self): return TreeModelRowIter(self, self.get_iter_first()) get_iter_first = strip_boolean_result(Gtk.TreeModel.get_iter_first) iter_children = strip_boolean_result(Gtk.TreeModel.iter_children) iter_nth_child = strip_boolean_result(Gtk.TreeModel.iter_nth_child) iter_parent = strip_boolean_result(Gtk.TreeModel.iter_parent) get_iter_from_string = strip_boolean_result(Gtk.TreeModel.get_iter_from_string, ValueError, 'invalid tree path') def get_iter(self, path): path = self._coerce_path(path) success, aiter = super(TreeModel, self).get_iter(path) if not success: raise ValueError("invalid tree path '%s'" % path) return aiter def iter_next(self, aiter): next_iter = aiter.copy() success = super(TreeModel, self).iter_next(next_iter) if success: return next_iter def iter_previous(self, aiter): prev_iter = aiter.copy() success = super(TreeModel, self).iter_previous(prev_iter) if success: return prev_iter def _convert_row(self, row): # TODO: Accept a dictionary for row # model.append(None,{COLUMN_ICON: icon, COLUMN_NAME: name}) if isinstance(row, str): raise TypeError('Expected a list or tuple, but got str') n_columns = self.get_n_columns() if len(row) != n_columns: raise ValueError('row sequence has the incorrect number of elements') result = [] columns = [] for cur_col, value in enumerate(row): # do not try to set None values, they are causing warnings if value is None: continue result.append(self._convert_value(cur_col, value)) columns.append(cur_col) return (result, columns) def set_row(self, treeiter, row): converted_row, columns = self._convert_row(row) for column in columns: value = row[column] if value is None: continue # None means skip this row self.set_value(treeiter, column, value) def _convert_value(self, column, value): '''Convert value to a GObject.Value of the expected type''' if isinstance(value, GObject.Value): return value return GObject.Value(self.get_column_type(column), value) def get(self, treeiter, *columns): n_columns = self.get_n_columns() values = [] for col in columns: if not isinstance(col, int): raise TypeError("column numbers must be ints") if col < 0 or col >= n_columns: raise ValueError("column number is out of range") values.append(self.get_value(treeiter, col)) return tuple(values) # # Signals supporting python iterables as tree paths # def row_changed(self, path, iter): return super(TreeModel, self).row_changed(self._coerce_path(path), iter) def row_inserted(self, path, iter): return super(TreeModel, self).row_inserted(self._coerce_path(path), iter) def row_has_child_toggled(self, path, iter): return super(TreeModel, self).row_has_child_toggled(self._coerce_path(path), iter) def row_deleted(self, path): return super(TreeModel, self).row_deleted(self._coerce_path(path)) def rows_reordered(self, path, iter, new_order): return super(TreeModel, self).rows_reordered(self._coerce_path(path), iter, new_order) TreeModel = override(TreeModel) __all__.append('TreeModel') class TreeSortable(Gtk.TreeSortable, ): get_sort_column_id = strip_boolean_result(Gtk.TreeSortable.get_sort_column_id, fail_ret=(None, None)) def set_sort_func(self, sort_column_id, sort_func, user_data=None): super(TreeSortable, self).set_sort_func(sort_column_id, sort_func, user_data) def set_default_sort_func(self, sort_func, user_data=None): super(TreeSortable, self).set_default_sort_func(sort_func, user_data) TreeSortable = override(TreeSortable) __all__.append('TreeSortable') class TreeModelSort(Gtk.TreeModelSort): __init__ = deprecated_init(Gtk.TreeModelSort.__init__, arg_names=('model',), category=PyGTKDeprecationWarning) TreeModelSort = override(TreeModelSort) __all__.append('TreeModelSort') class ListStore(Gtk.ListStore, TreeModel, TreeSortable): def __init__(self, *column_types): Gtk.ListStore.__init__(self) self.set_column_types(column_types) def _do_insert(self, position, row): if row is not None: row, columns = self._convert_row(row) treeiter = self.insert_with_valuesv(position, columns, row) else: treeiter = Gtk.ListStore.insert(self, position) return treeiter def append(self, row=None): if row: return self._do_insert(-1, row) # gtk_list_store_insert() does not know about the "position == -1" # case, so use append() here else: return Gtk.ListStore.append(self) def prepend(self, row=None): return self._do_insert(0, row) def insert(self, position, row=None): return self._do_insert(position, row) # FIXME: sends two signals; check if this can use an atomic # insert_with_valuesv() def insert_before(self, sibling, row=None): treeiter = Gtk.ListStore.insert_before(self, sibling) if row is not None: self.set_row(treeiter, row) return treeiter # FIXME: sends two signals; check if this can use an atomic # insert_with_valuesv() def insert_after(self, sibling, row=None): treeiter = Gtk.ListStore.insert_after(self, sibling) if row is not None: self.set_row(treeiter, row) return treeiter def set_value(self, treeiter, column, value): value = self._convert_value(column, value) Gtk.ListStore.set_value(self, treeiter, column, value) def set(self, treeiter, *args): def _set_lists(cols, vals): if len(cols) != len(vals): raise TypeError('The number of columns do not match the number of values') columns = [] values = [] for col_num, value in zip(cols, vals): if not isinstance(col_num, int): raise TypeError('TypeError: Expected integer argument for column.') columns.append(col_num) values.append(self._convert_value(col_num, value)) Gtk.ListStore.set(self, treeiter, columns, values) if args: if isinstance(args[0], int): _set_lists(args[::2], args[1::2]) elif isinstance(args[0], (tuple, list)): if len(args) != 2: raise TypeError('Too many arguments') _set_lists(args[0], args[1]) elif isinstance(args[0], dict): _set_lists(list(args[0]), args[0].values()) else: raise TypeError('Argument list must be in the form of (column, value, ...), ((columns,...), (values, ...)) or {column: value}. No -1 termination is needed.') ListStore = override(ListStore) __all__.append('ListStore') class TreeModelRow(object): def __init__(self, model, iter_or_path): if not isinstance(model, Gtk.TreeModel): raise TypeError("expected Gtk.TreeModel, %s found" % type(model).__name__) self.model = model if isinstance(iter_or_path, Gtk.TreePath): self.iter = model.get_iter(iter_or_path) elif isinstance(iter_or_path, Gtk.TreeIter): self.iter = iter_or_path else: raise TypeError("expected Gtk.TreeIter or Gtk.TreePath, \ %s found" % type(iter_or_path).__name__) @property def path(self): return self.model.get_path(self.iter) @property def next(self): return self.get_next() @property def previous(self): return self.get_previous() @property def parent(self): return self.get_parent() def get_next(self): next_iter = self.model.iter_next(self.iter) if next_iter: return TreeModelRow(self.model, next_iter) def get_previous(self): prev_iter = self.model.iter_previous(self.iter) if prev_iter: return TreeModelRow(self.model, prev_iter) def get_parent(self): parent_iter = self.model.iter_parent(self.iter) if parent_iter: return TreeModelRow(self.model, parent_iter) def __getitem__(self, key): if isinstance(key, int): if key >= self.model.get_n_columns(): raise IndexError("column index is out of bounds: %d" % key) elif key < 0: key = self._convert_negative_index(key) return self.model.get_value(self.iter, key) elif isinstance(key, slice): start, stop, step = key.indices(self.model.get_n_columns()) alist = [] for i in range(start, stop, step): alist.append(self.model.get_value(self.iter, i)) return alist elif isinstance(key, tuple): return [self[k] for k in key] else: raise TypeError("indices must be integers, slice or tuple, not %s" % type(key).__name__) def __setitem__(self, key, value): if isinstance(key, int): if key >= self.model.get_n_columns(): raise IndexError("column index is out of bounds: %d" % key) elif key < 0: key = self._convert_negative_index(key) self.model.set_value(self.iter, key, value) elif isinstance(key, slice): start, stop, step = key.indices(self.model.get_n_columns()) indexList = range(start, stop, step) if len(indexList) != len(value): raise ValueError( "attempt to assign sequence of size %d to slice of size %d" % (len(value), len(indexList))) for i, v in enumerate(indexList): self.model.set_value(self.iter, v, value[i]) elif isinstance(key, tuple): if len(key) != len(value): raise ValueError( "attempt to assign sequence of size %d to sequence of size %d" % (len(value), len(key))) for k, v in zip(key, value): self[k] = v else: raise TypeError("indices must be an integer, slice or tuple, not %s" % type(key).__name__) def _convert_negative_index(self, index): new_index = self.model.get_n_columns() + index if new_index < 0: raise IndexError("column index is out of bounds: %d" % index) return new_index def iterchildren(self): child_iter = self.model.iter_children(self.iter) return TreeModelRowIter(self.model, child_iter) __all__.append('TreeModelRow') class TreeModelRowIter(object): def __init__(self, model, aiter): self.model = model self.iter = aiter def __next__(self): if not self.iter: raise StopIteration row = TreeModelRow(self.model, self.iter) self.iter = self.model.iter_next(self.iter) return row # alias for Python 2.x object protocol next = __next__ def __iter__(self): return self __all__.append('TreeModelRowIter') class TreePath(Gtk.TreePath): def __new__(cls, path=0): if isinstance(path, int): path = str(path) elif not isinstance(path, _basestring): path = ":".join(str(val) for val in path) if len(path) == 0: raise TypeError("could not parse subscript '%s' as a tree path" % path) try: return TreePath.new_from_string(path) except TypeError: raise TypeError("could not parse subscript '%s' as a tree path" % path) def __init__(self, *args, **kwargs): super(TreePath, self).__init__() def __str__(self): return self.to_string() or "" def __lt__(self, other): return other is not None and self.compare(other) < 0 def __le__(self, other): return other is not None and self.compare(other) <= 0 def __eq__(self, other): return other is not None and self.compare(other) == 0 def __ne__(self, other): return other is None or self.compare(other) != 0 def __gt__(self, other): return other is None or self.compare(other) > 0 def __ge__(self, other): return other is None or self.compare(other) >= 0 def __iter__(self): return iter(self.get_indices()) def __len__(self): return self.get_depth() def __getitem__(self, index): return self.get_indices()[index] TreePath = override(TreePath) __all__.append('TreePath') class TreeStore(Gtk.TreeStore, TreeModel, TreeSortable): def __init__(self, *column_types): Gtk.TreeStore.__init__(self) self.set_column_types(column_types) def _do_insert(self, parent, position, row): if row is not None: row, columns = self._convert_row(row) treeiter = self.insert_with_values(parent, position, columns, row) else: treeiter = Gtk.TreeStore.insert(self, parent, position) return treeiter def append(self, parent, row=None): return self._do_insert(parent, -1, row) def prepend(self, parent, row=None): return self._do_insert(parent, 0, row) def insert(self, parent, position, row=None): return self._do_insert(parent, position, row) # FIXME: sends two signals; check if this can use an atomic # insert_with_valuesv() def insert_before(self, parent, sibling, row=None): treeiter = Gtk.TreeStore.insert_before(self, parent, sibling) if row is not None: self.set_row(treeiter, row) return treeiter # FIXME: sends two signals; check if this can use an atomic # insert_with_valuesv() def insert_after(self, parent, sibling, row=None): treeiter = Gtk.TreeStore.insert_after(self, parent, sibling) if row is not None: self.set_row(treeiter, row) return treeiter def set_value(self, treeiter, column, value): value = self._convert_value(column, value) Gtk.TreeStore.set_value(self, treeiter, column, value) def set(self, treeiter, *args): def _set_lists(cols, vals): if len(cols) != len(vals): raise TypeError('The number of columns do not match the number of values') columns = [] values = [] for col_num, value in zip(cols, vals): if not isinstance(col_num, int): raise TypeError('TypeError: Expected integer argument for column.') columns.append(col_num) values.append(self._convert_value(col_num, value)) Gtk.TreeStore.set(self, treeiter, columns, values) if args: if isinstance(args[0], int): _set_lists(args[::2], args[1::2]) elif isinstance(args[0], (tuple, list)): if len(args) != 2: raise TypeError('Too many arguments') _set_lists(args[0], args[1]) elif isinstance(args[0], dict): _set_lists(args[0].keys(), args[0].values()) else: raise TypeError('Argument list must be in the form of (column, value, ...), ((columns,...), (values, ...)) or {column: value}. No -1 termination is needed.') TreeStore = override(TreeStore) __all__.append('TreeStore') class TreeView(Gtk.TreeView, Container): __init__ = deprecated_init(Gtk.TreeView.__init__, arg_names=('model',), category=PyGTKDeprecationWarning) get_path_at_pos = strip_boolean_result(Gtk.TreeView.get_path_at_pos) get_visible_range = strip_boolean_result(Gtk.TreeView.get_visible_range) get_dest_row_at_pos = strip_boolean_result(Gtk.TreeView.get_dest_row_at_pos) def enable_model_drag_source(self, start_button_mask, targets, actions): target_entries = _construct_target_list(targets) super(TreeView, self).enable_model_drag_source(start_button_mask, target_entries, actions) def enable_model_drag_dest(self, targets, actions): target_entries = _construct_target_list(targets) super(TreeView, self).enable_model_drag_dest(target_entries, actions) def scroll_to_cell(self, path, column=None, use_align=False, row_align=0.0, col_align=0.0): if not isinstance(path, Gtk.TreePath): path = TreePath(path) super(TreeView, self).scroll_to_cell(path, column, use_align, row_align, col_align) def set_cursor(self, path, column=None, start_editing=False): if not isinstance(path, Gtk.TreePath): path = TreePath(path) super(TreeView, self).set_cursor(path, column, start_editing) def get_cell_area(self, path, column=None): if not isinstance(path, Gtk.TreePath): path = TreePath(path) return super(TreeView, self).get_cell_area(path, column) def insert_column_with_attributes(self, position, title, cell, **kwargs): column = TreeViewColumn() column.set_title(title) column.pack_start(cell, False) self.insert_column(column, position) column.set_attributes(cell, **kwargs) TreeView = override(TreeView) __all__.append('TreeView') class TreeViewColumn(Gtk.TreeViewColumn): def __init__(self, title='', cell_renderer=None, **attributes): Gtk.TreeViewColumn.__init__(self, title=title) if cell_renderer: self.pack_start(cell_renderer, True) for (name, value) in attributes.items(): self.add_attribute(cell_renderer, name, value) cell_get_position = strip_boolean_result(Gtk.TreeViewColumn.cell_get_position) def set_cell_data_func(self, cell_renderer, func, func_data=None): super(TreeViewColumn, self).set_cell_data_func(cell_renderer, func, func_data) def set_attributes(self, cell_renderer, **attributes): Gtk.CellLayout.clear_attributes(self, cell_renderer) for (name, value) in attributes.items(): Gtk.CellLayout.add_attribute(self, cell_renderer, name, value) TreeViewColumn = override(TreeViewColumn) __all__.append('TreeViewColumn') class TreeSelection(Gtk.TreeSelection): def select_path(self, path): if not isinstance(path, Gtk.TreePath): path = TreePath(path) super(TreeSelection, self).select_path(path) def get_selected(self): success, model, aiter = super(TreeSelection, self).get_selected() if success: return (model, aiter) else: return (model, None) # for compatibility with PyGtk def get_selected_rows(self): rows, model = super(TreeSelection, self).get_selected_rows() return (model, rows) TreeSelection = override(TreeSelection) __all__.append('TreeSelection') class Button(Gtk.Button, Container): _init = deprecated_init(Gtk.Button.__init__, arg_names=('label', 'stock', 'use_stock', 'use_underline'), ignore=('stock',), category=PyGTKDeprecationWarning, stacklevel=3) def __init__(self, *args, **kwargs): # Doubly deprecated initializer, the stock keyword is non-standard. # Simply give a warning that stock items are deprecated even though # we want to deprecate the non-standard keyword as well here from # the overrides. if 'stock' in kwargs and kwargs['stock']: warnings.warn('Stock items are deprecated. ' 'Please use: Gtk.Button.new_with_mnemonic(label)', PyGTKDeprecationWarning, stacklevel=2) new_kwargs = kwargs.copy() new_kwargs['label'] = new_kwargs['stock'] new_kwargs['use_stock'] = True new_kwargs['use_underline'] = True del new_kwargs['stock'] Gtk.Button.__init__(self, **new_kwargs) else: self._init(*args, **kwargs) Button = override(Button) __all__.append('Button') class LinkButton(Gtk.LinkButton): __init__ = deprecated_init(Gtk.LinkButton.__init__, arg_names=('uri', 'label'), category=PyGTKDeprecationWarning) LinkButton = override(LinkButton) __all__.append('LinkButton') class Label(Gtk.Label): __init__ = deprecated_init(Gtk.Label.__init__, arg_names=('label',), category=PyGTKDeprecationWarning) Label = override(Label) __all__.append('Label') class Adjustment(Gtk.Adjustment): _init = deprecated_init(Gtk.Adjustment.__init__, arg_names=('value', 'lower', 'upper', 'step_increment', 'page_increment', 'page_size'), deprecated_aliases={'page_increment': 'page_incr', 'step_increment': 'step_incr'}, category=PyGTKDeprecationWarning, stacklevel=3) def __init__(self, *args, **kwargs): self._init(*args, **kwargs) # The value property is set between lower and (upper - page_size). # Just in case lower, upper or page_size was still 0 when value # was set, we set it again here. if 'value' in kwargs: self.set_value(kwargs['value']) elif len(args) >= 1: self.set_value(args[0]) Adjustment = override(Adjustment) __all__.append('Adjustment') if Gtk._version in ("2.0", "3.0"): class Table(Gtk.Table, Container): __init__ = deprecated_init(Gtk.Table.__init__, arg_names=('n_rows', 'n_columns', 'homogeneous'), deprecated_aliases={'n_rows': 'rows', 'n_columns': 'columns'}, category=PyGTKDeprecationWarning) def attach(self, child, left_attach, right_attach, top_attach, bottom_attach, xoptions=Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, xpadding=0, ypadding=0): Gtk.Table.attach(self, child, left_attach, right_attach, top_attach, bottom_attach, xoptions, yoptions, xpadding, ypadding) Table = override(Table) __all__.append('Table') class ScrolledWindow(Gtk.ScrolledWindow): __init__ = deprecated_init(Gtk.ScrolledWindow.__init__, arg_names=('hadjustment', 'vadjustment'), category=PyGTKDeprecationWarning) ScrolledWindow = override(ScrolledWindow) __all__.append('ScrolledWindow') if Gtk._version in ("2.0", "3.0"): class HScrollbar(Gtk.HScrollbar): __init__ = deprecated_init(Gtk.HScrollbar.__init__, arg_names=('adjustment',), category=PyGTKDeprecationWarning) HScrollbar = override(HScrollbar) __all__.append('HScrollbar') class VScrollbar(Gtk.VScrollbar): __init__ = deprecated_init(Gtk.VScrollbar.__init__, arg_names=('adjustment',), category=PyGTKDeprecationWarning) VScrollbar = override(VScrollbar) __all__.append('VScrollbar') class Paned(Gtk.Paned): def pack1(self, child, resize=False, shrink=True): super(Paned, self).pack1(child, resize, shrink) def pack2(self, child, resize=True, shrink=True): super(Paned, self).pack2(child, resize, shrink) Paned = override(Paned) __all__.append('Paned') if Gtk._version in ("2.0", "3.0"): class Arrow(Gtk.Arrow): __init__ = deprecated_init(Gtk.Arrow.__init__, arg_names=('arrow_type', 'shadow_type'), category=PyGTKDeprecationWarning) Arrow = override(Arrow) __all__.append('Arrow') class IconSet(Gtk.IconSet): def __new__(cls, pixbuf=None): if pixbuf is not None: warnings.warn('Gtk.IconSet(pixbuf) has been deprecated. Please use: ' 'Gtk.IconSet.new_from_pixbuf(pixbuf)', PyGTKDeprecationWarning, stacklevel=2) iconset = Gtk.IconSet.new_from_pixbuf(pixbuf) else: iconset = Gtk.IconSet.__new__(cls) return iconset def __init__(self, *args, **kwargs): return super(IconSet, self).__init__() IconSet = override(IconSet) __all__.append('IconSet') class Viewport(Gtk.Viewport): __init__ = deprecated_init(Gtk.Viewport.__init__, arg_names=('hadjustment', 'vadjustment'), category=PyGTKDeprecationWarning) Viewport = override(Viewport) __all__.append('Viewport') class TreeModelFilter(Gtk.TreeModelFilter): def set_visible_func(self, func, data=None): super(TreeModelFilter, self).set_visible_func(func, data) def set_value(self, iter, column, value): # Delegate to child model iter = self.convert_iter_to_child_iter(iter) self.get_model().set_value(iter, column, value) TreeModelFilter = override(TreeModelFilter) __all__.append('TreeModelFilter') if Gtk._version != '2.0': class Menu(Gtk.Menu): def popup(self, parent_menu_shell, parent_menu_item, func, data, button, activate_time): self.popup_for_device(None, parent_menu_shell, parent_menu_item, func, data, button, activate_time) Menu = override(Menu) __all__.append('Menu') _Gtk_main_quit = Gtk.main_quit @override(Gtk.main_quit) def main_quit(*args): _Gtk_main_quit() _Gtk_main = Gtk.main @override(Gtk.main) def main(*args, **kwargs): with register_sigint_fallback(Gtk.main_quit): with wakeup_on_signal(): return _Gtk_main(*args, **kwargs) if Gtk._version in ("2.0", "3.0"): stock_lookup = strip_boolean_result(Gtk.stock_lookup) __all__.append('stock_lookup') if Gtk._version == "4.0": Gtk.init_check() else: initialized, argv = Gtk.init_check(sys.argv) sys.argv = list(argv) PK!78S~>#>#Gio.pynu[# -*- Mode: Python; py-indent-offset: 4 -*- # vim: tabstop=4 shiftwidth=4 expandtab # # Copyright (C) 2010 Ignacio Casal Quinteiro # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA import warnings from .._ossighelper import wakeup_on_signal, register_sigint_fallback from ..overrides import override, deprecated_init from ..module import get_introspection_module from gi import PyGIWarning from gi.repository import GLib import sys Gio = get_introspection_module('Gio') __all__ = [] class Application(Gio.Application): def run(self, *args, **kwargs): with register_sigint_fallback(self.quit): with wakeup_on_signal(): return Gio.Application.run(self, *args, **kwargs) Application = override(Application) __all__.append('Application') class VolumeMonitor(Gio.VolumeMonitor): def __init__(self, *args, **kwargs): super(VolumeMonitor, self).__init__(*args, **kwargs) # https://bugzilla.gnome.org/show_bug.cgi?id=744690 warnings.warn( "Gio.VolumeMonitor shouldn't be instantiated directly, " "use Gio.VolumeMonitor.get() instead.", PyGIWarning, stacklevel=2) VolumeMonitor = override(VolumeMonitor) __all__.append('VolumeMonitor') class FileEnumerator(Gio.FileEnumerator): def __iter__(self): return self def __next__(self): file_info = self.next_file(None) if file_info is not None: return file_info else: raise StopIteration # python 2 compat for the iter protocol next = __next__ FileEnumerator = override(FileEnumerator) __all__.append('FileEnumerator') class MenuItem(Gio.MenuItem): def set_attribute(self, attributes): for (name, format_string, value) in attributes: self.set_attribute_value(name, GLib.Variant(format_string, value)) MenuItem = override(MenuItem) __all__.append('MenuItem') class Settings(Gio.Settings): '''Provide dictionary-like access to GLib.Settings.''' __init__ = deprecated_init(Gio.Settings.__init__, arg_names=('schema', 'path', 'backend')) def __contains__(self, key): return key in self.list_keys() def __len__(self): return len(self.list_keys()) def __bool__(self): # for "if mysettings" we don't want a dictionary-like test here, just # if the object isn't None return True # alias for Python 2.x object protocol __nonzero__ = __bool__ def __getitem__(self, key): # get_value() aborts the program on an unknown key if key not in self: raise KeyError('unknown key: %r' % (key,)) return self.get_value(key).unpack() def __setitem__(self, key, value): # set_value() aborts the program on an unknown key if key not in self: raise KeyError('unknown key: %r' % (key,)) # determine type string of this key range = self.get_range(key) type_ = range.get_child_value(0).get_string() v = range.get_child_value(1) if type_ == 'type': # v is boxed empty array, type of its elements is the allowed value type type_str = v.get_child_value(0).get_type_string() assert type_str.startswith('a') type_str = type_str[1:] elif type_ == 'enum': # v is an array with the allowed values assert v.get_child_value(0).get_type_string().startswith('a') type_str = v.get_child_value(0).get_child_value(0).get_type_string() allowed = v.unpack() if value not in allowed: raise ValueError('value %s is not an allowed enum (%s)' % (value, allowed)) else: raise NotImplementedError('Cannot handle allowed type range class ' + str(type_)) self.set_value(key, GLib.Variant(type_str, value)) def keys(self): return self.list_keys() Settings = override(Settings) __all__.append('Settings') class _DBusProxyMethodCall: '''Helper class to implement DBusProxy method calls.''' def __init__(self, dbus_proxy, method_name): self.dbus_proxy = dbus_proxy self.method_name = method_name def __async_result_handler(self, obj, result, user_data): (result_callback, error_callback, real_user_data) = user_data try: ret = obj.call_finish(result) except Exception: etype, e = sys.exc_info()[:2] # return exception as value if error_callback: error_callback(obj, e, real_user_data) else: result_callback(obj, e, real_user_data) return result_callback(obj, self._unpack_result(ret), real_user_data) def __call__(self, *args, **kwargs): # the first positional argument is the signature, unless we are calling # a method without arguments; then signature is implied to be '()'. if args: signature = args[0] args = args[1:] if not isinstance(signature, str): raise TypeError('first argument must be the method signature string: %r' % signature) else: signature = '()' arg_variant = GLib.Variant(signature, tuple(args)) if 'result_handler' in kwargs: # asynchronous call user_data = (kwargs['result_handler'], kwargs.get('error_handler'), kwargs.get('user_data')) self.dbus_proxy.call(self.method_name, arg_variant, kwargs.get('flags', 0), kwargs.get('timeout', -1), None, self.__async_result_handler, user_data) else: # synchronous call result = self.dbus_proxy.call_sync(self.method_name, arg_variant, kwargs.get('flags', 0), kwargs.get('timeout', -1), None) return self._unpack_result(result) @classmethod def _unpack_result(klass, result): '''Convert a D-BUS return variant into an appropriate return value''' result = result.unpack() # to be compatible with standard Python behaviour, unbox # single-element tuples and return None for empty result tuples if len(result) == 1: result = result[0] elif len(result) == 0: result = None return result class DBusProxy(Gio.DBusProxy): '''Provide comfortable and pythonic method calls. This marshalls the method arguments into a GVariant, invokes the call_sync() method on the DBusProxy object, and unmarshalls the result GVariant back into a Python tuple. The first argument always needs to be the D-Bus signature tuple of the method call. Example: proxy = Gio.DBusProxy.new_sync(...) result = proxy.MyMethod('(is)', 42, 'hello') The exception are methods which take no arguments, like proxy.MyMethod('()'). For these you can omit the signature and just write proxy.MyMethod(). Optional keyword arguments: - timeout: timeout for the call in milliseconds (default to D-Bus timeout) - flags: Combination of Gio.DBusCallFlags.* - result_handler: Do an asynchronous method call and invoke result_handler(proxy_object, result, user_data) when it finishes. - error_handler: If the asynchronous call raises an exception, error_handler(proxy_object, exception, user_data) is called when it finishes. If error_handler is not given, result_handler is called with the exception object as result instead. - user_data: Optional user data to pass to result_handler for asynchronous calls. Example for asynchronous calls: def mymethod_done(proxy, result, user_data): if isinstance(result, Exception): # handle error else: # do something with result proxy.MyMethod('(is)', 42, 'hello', result_handler=mymethod_done, user_data='data') ''' def __getattr__(self, name): return _DBusProxyMethodCall(self, name) DBusProxy = override(DBusProxy) __all__.append('DBusProxy') PK!?HB_=_=Gdk.pynu[# -*- Mode: Python; py-indent-offset: 4 -*- # vim: tabstop=4 shiftwidth=4 expandtab # # Copyright (C) 2009 Johan Dahlin # 2010 Simon van der Linden # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA import sys import warnings from ..overrides import override, strip_boolean_result from ..module import get_introspection_module from gi import PyGIDeprecationWarning, require_version Gdk = get_introspection_module('Gdk') __all__ = [] # https://bugzilla.gnome.org/show_bug.cgi?id=673396 try: require_version("GdkX11", Gdk._version) from gi.repository import GdkX11 GdkX11 # pyflakes except (ValueError, ImportError): pass if hasattr(Gdk, 'Color'): # Gdk.Color was deprecated since 3.14 and dropped in Gtk+-4.0 class Color(Gdk.Color): MAX_VALUE = 65535 def __init__(self, red, green, blue): Gdk.Color.__init__(self) self.red = red self.green = green self.blue = blue def __eq__(self, other): return self.equal(other) def __repr__(self): return 'Gdk.Color(red=%d, green=%d, blue=%d)' % (self.red, self.green, self.blue) red_float = property(fget=lambda self: self.red / float(self.MAX_VALUE), fset=lambda self, v: setattr(self, 'red', int(v * self.MAX_VALUE))) green_float = property(fget=lambda self: self.green / float(self.MAX_VALUE), fset=lambda self, v: setattr(self, 'green', int(v * self.MAX_VALUE))) blue_float = property(fget=lambda self: self.blue / float(self.MAX_VALUE), fset=lambda self, v: setattr(self, 'blue', int(v * self.MAX_VALUE))) def to_floats(self): """Return (red_float, green_float, blue_float) triple.""" return (self.red_float, self.green_float, self.blue_float) @staticmethod def from_floats(red, green, blue): """Return a new Color object from red/green/blue values from 0.0 to 1.0.""" return Color(int(red * Color.MAX_VALUE), int(green * Color.MAX_VALUE), int(blue * Color.MAX_VALUE)) Color = override(Color) __all__.append('Color') if hasattr(Gdk, 'RGBA'): # Introduced since Gtk+-3.0 class RGBA(Gdk.RGBA): def __init__(self, red=1.0, green=1.0, blue=1.0, alpha=1.0): Gdk.RGBA.__init__(self) self.red = red self.green = green self.blue = blue self.alpha = alpha def __eq__(self, other): return self.equal(other) def __repr__(self): return 'Gdk.RGBA(red=%f, green=%f, blue=%f, alpha=%f)' % (self.red, self.green, self.blue, self.alpha) def __iter__(self): """Iterator which allows easy conversion to tuple and list types.""" yield self.red yield self.green yield self.blue yield self.alpha def to_color(self): """Converts this RGBA into a Color instance which excludes alpha.""" return Color(int(self.red * Color.MAX_VALUE), int(self.green * Color.MAX_VALUE), int(self.blue * Color.MAX_VALUE)) @classmethod def from_color(cls, color): """Returns a new RGBA instance given a Color instance.""" return cls(color.red_float, color.green_float, color.blue_float) RGBA = override(RGBA) __all__.append('RGBA') if Gdk._version == '2.0': class Rectangle(Gdk.Rectangle): def __init__(self, x, y, width, height): Gdk.Rectangle.__init__(self) self.x = x self.y = y self.width = width self.height = height def __repr__(self): return 'Gdk.Rectangle(x=%d, y=%d, width=%d, height=%d)' % (self.x, self.y, self.height, self.width) Rectangle = override(Rectangle) __all__.append('Rectangle') else: # Newer GTK+/gobject-introspection (3.17.x) include GdkRectangle in the # typelib. See https://bugzilla.gnome.org/show_bug.cgi?id=748832 and # https://bugzilla.gnome.org/show_bug.cgi?id=748833 if not hasattr(Gdk, 'Rectangle'): from gi.repository import cairo as _cairo Rectangle = _cairo.RectangleInt __all__.append('Rectangle') else: # https://bugzilla.gnome.org/show_bug.cgi?id=756364 # These methods used to be functions, keep aliases for backwards compat rectangle_intersect = Gdk.Rectangle.intersect rectangle_union = Gdk.Rectangle.union __all__.append('rectangle_intersect') __all__.append('rectangle_union') if Gdk._version == '2.0': class Drawable(Gdk.Drawable): def cairo_create(self): return Gdk.cairo_create(self) Drawable = override(Drawable) __all__.append('Drawable') else: class Window(Gdk.Window): def __new__(cls, parent, attributes, attributes_mask): # Gdk.Window had to be made abstract, # this override allows using the standard constructor return Gdk.Window.new(parent, attributes, attributes_mask) def __init__(self, parent, attributes, attributes_mask): pass def cairo_create(self): return Gdk.cairo_create(self) Window = override(Window) __all__.append('Window') Gdk.EventType._2BUTTON_PRESS = getattr(Gdk.EventType, "2BUTTON_PRESS") Gdk.EventType._3BUTTON_PRESS = getattr(Gdk.EventType, "3BUTTON_PRESS") class Event(Gdk.Event): _UNION_MEMBERS = { Gdk.EventType.DELETE: 'any', Gdk.EventType.DESTROY: 'any', Gdk.EventType.EXPOSE: 'expose', Gdk.EventType.MOTION_NOTIFY: 'motion', Gdk.EventType.BUTTON_PRESS: 'button', Gdk.EventType._2BUTTON_PRESS: 'button', Gdk.EventType._3BUTTON_PRESS: 'button', Gdk.EventType.BUTTON_RELEASE: 'button', Gdk.EventType.KEY_PRESS: 'key', Gdk.EventType.KEY_RELEASE: 'key', Gdk.EventType.ENTER_NOTIFY: 'crossing', Gdk.EventType.LEAVE_NOTIFY: 'crossing', Gdk.EventType.FOCUS_CHANGE: 'focus_change', Gdk.EventType.CONFIGURE: 'configure', Gdk.EventType.MAP: 'any', Gdk.EventType.UNMAP: 'any', Gdk.EventType.PROPERTY_NOTIFY: 'property', Gdk.EventType.SELECTION_CLEAR: 'selection', Gdk.EventType.SELECTION_REQUEST: 'selection', Gdk.EventType.SELECTION_NOTIFY: 'selection', Gdk.EventType.PROXIMITY_IN: 'proximity', Gdk.EventType.PROXIMITY_OUT: 'proximity', Gdk.EventType.DRAG_ENTER: 'dnd', Gdk.EventType.DRAG_LEAVE: 'dnd', Gdk.EventType.DRAG_MOTION: 'dnd', Gdk.EventType.DRAG_STATUS: 'dnd', Gdk.EventType.DROP_START: 'dnd', Gdk.EventType.DROP_FINISHED: 'dnd', Gdk.EventType.CLIENT_EVENT: 'client', Gdk.EventType.VISIBILITY_NOTIFY: 'visibility', } if Gdk._version == '2.0': _UNION_MEMBERS[Gdk.EventType.NO_EXPOSE] = 'no_expose' if hasattr(Gdk.EventType, 'TOUCH_BEGIN'): _UNION_MEMBERS.update( { Gdk.EventType.TOUCH_BEGIN: 'touch', Gdk.EventType.TOUCH_UPDATE: 'touch', Gdk.EventType.TOUCH_END: 'touch', Gdk.EventType.TOUCH_CANCEL: 'touch', }) def __getattr__(self, name): real_event = getattr(self, '_UNION_MEMBERS').get(self.type) if real_event: return getattr(getattr(self, real_event), name) else: raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, name)) def __setattr__(self, name, value): real_event = getattr(self, '_UNION_MEMBERS').get(self.type) if real_event: setattr(getattr(self, real_event), name, value) else: Gdk.Event.__setattr__(self, name, value) def __repr__(self): base_repr = Gdk.Event.__repr__(self).strip("><") return "<%s type=%r>" % (base_repr, self.type) Event = override(Event) __all__.append('Event') # manually bind GdkEvent members to GdkEvent modname = globals()['__name__'] module = sys.modules[modname] # right now we can't get the type_info from the # field info so manually list the class names event_member_classes = ['EventAny', 'EventExpose', 'EventVisibility', 'EventMotion', 'EventButton', 'EventScroll', 'EventKey', 'EventCrossing', 'EventFocus', 'EventConfigure', 'EventProperty', 'EventSelection', 'EventOwnerChange', 'EventProximity', 'EventDND', 'EventWindowState', 'EventSetting', 'EventGrabBroken'] if Gdk._version == '2.0': event_member_classes.append('EventNoExpose') if hasattr(Gdk, 'EventTouch'): event_member_classes.append('EventTouch') # whitelist all methods that have a success return we want to mask gsuccess_mask_funcs = ['get_state', 'get_axis', 'get_coords', 'get_root_coords'] for event_class in event_member_classes: override_class = type(event_class, (getattr(Gdk, event_class),), {}) # add the event methods for method_info in Gdk.Event.__info__.get_methods(): name = method_info.get_name() event_method = getattr(Gdk.Event, name) # python2 we need to use the __func__ attr to avoid internal # instance checks event_method = getattr(event_method, '__func__', event_method) # use the _gsuccess_mask decorator if this method is whitelisted if name in gsuccess_mask_funcs: event_method = strip_boolean_result(event_method) setattr(override_class, name, event_method) setattr(module, event_class, override_class) __all__.append(event_class) # end GdkEvent overrides class DragContext(Gdk.DragContext): def finish(self, success, del_, time): Gtk = get_introspection_module('Gtk') Gtk.drag_finish(self, success, del_, time) DragContext = override(DragContext) __all__.append('DragContext') class Cursor(Gdk.Cursor): def __new__(cls, *args, **kwds): arg_len = len(args) kwd_len = len(kwds) total_len = arg_len + kwd_len if total_len == 1: if Gdk._version == "4.0": raise ValueError("Wrong number of parameters") # Since g_object_newv (super.__new__) does not seem valid for # direct use with GdkCursor, we must assume usage of at least # one of the C constructors to be valid. return cls.new(*args, **kwds) elif total_len == 2: warnings.warn('Calling "Gdk.Cursor(display, cursor_type)" has been deprecated. ' 'Please use Gdk.Cursor.new_for_display(display, cursor_type). ' 'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations', PyGIDeprecationWarning) return cls.new_for_display(*args, **kwds) elif total_len == 4: warnings.warn('Calling "Gdk.Cursor(display, pixbuf, x, y)" has been deprecated. ' 'Please use Gdk.Cursor.new_from_pixbuf(display, pixbuf, x, y). ' 'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations', PyGIDeprecationWarning) return cls.new_from_pixbuf(*args, **kwds) elif total_len == 6: if Gdk._version != '2.0': # pixmaps don't exist in Gdk 3.0 raise ValueError("Wrong number of parameters") warnings.warn('Calling "Gdk.Cursor(source, mask, fg, bg, x, y)" has been deprecated. ' 'Please use Gdk.Cursor.new_from_pixmap(source, mask, fg, bg, x, y). ' 'See: https://wiki.gnome.org/PyGObject/InitializerDeprecations', PyGIDeprecationWarning) return cls.new_from_pixmap(*args, **kwds) else: raise ValueError("Wrong number of parameters") Cursor = override(Cursor) __all__.append('Cursor') if hasattr(Gdk, 'color_parse'): # Gdk.Color was deprecated since 3.14 and dropped in Gtk+-4.0 color_parse = strip_boolean_result(Gdk.color_parse) __all__.append('color_parse') # Note, we cannot override the entire class as Gdk.Atom has no gtype, so just # hack some individual methods def _gdk_atom_str(atom): n = atom.name() if n: return n # fall back to atom index return 'Gdk.Atom<%i>' % hash(atom) def _gdk_atom_repr(atom): n = atom.name() if n: return 'Gdk.Atom.intern("%s", False)' % n # fall back to atom index return '' % hash(atom) Gdk.Atom.__str__ = _gdk_atom_str Gdk.Atom.__repr__ = _gdk_atom_repr # constants if Gdk._version >= '3.0': SELECTION_PRIMARY = Gdk.atom_intern('PRIMARY', True) __all__.append('SELECTION_PRIMARY') SELECTION_SECONDARY = Gdk.atom_intern('SECONDARY', True) __all__.append('SELECTION_SECONDARY') SELECTION_CLIPBOARD = Gdk.atom_intern('CLIPBOARD', True) __all__.append('SELECTION_CLIPBOARD') TARGET_BITMAP = Gdk.atom_intern('BITMAP', True) __all__.append('TARGET_BITMAP') TARGET_COLORMAP = Gdk.atom_intern('COLORMAP', True) __all__.append('TARGET_COLORMAP') TARGET_DRAWABLE = Gdk.atom_intern('DRAWABLE', True) __all__.append('TARGET_DRAWABLE') TARGET_PIXMAP = Gdk.atom_intern('PIXMAP', True) __all__.append('TARGET_PIXMAP') TARGET_STRING = Gdk.atom_intern('STRING', True) __all__.append('TARGET_STRING') SELECTION_TYPE_ATOM = Gdk.atom_intern('ATOM', True) __all__.append('SELECTION_TYPE_ATOM') SELECTION_TYPE_BITMAP = Gdk.atom_intern('BITMAP', True) __all__.append('SELECTION_TYPE_BITMAP') SELECTION_TYPE_COLORMAP = Gdk.atom_intern('COLORMAP', True) __all__.append('SELECTION_TYPE_COLORMAP') SELECTION_TYPE_DRAWABLE = Gdk.atom_intern('DRAWABLE', True) __all__.append('SELECTION_TYPE_DRAWABLE') SELECTION_TYPE_INTEGER = Gdk.atom_intern('INTEGER', True) __all__.append('SELECTION_TYPE_INTEGER') SELECTION_TYPE_PIXMAP = Gdk.atom_intern('PIXMAP', True) __all__.append('SELECTION_TYPE_PIXMAP') SELECTION_TYPE_WINDOW = Gdk.atom_intern('WINDOW', True) __all__.append('SELECTION_TYPE_WINDOW') SELECTION_TYPE_STRING = Gdk.atom_intern('STRING', True) __all__.append('SELECTION_TYPE_STRING') if Gdk._version in ('2.0', '3.0'): import sys initialized, argv = Gdk.init_check(sys.argv) PK!?d"__pycache__/keysyms.cpython-36.pycnu[3 <_@sddlZddlZddlmZedZejdeedZej eZ xPe eD]DZ e j drNe ddZedd kr|d eZeee Zee eeqNWd Zd Zd ZdZdZdZdZdZdZdZdZdS)N)get_introspection_moduleGdkz?keysyms has been deprecated. Please use Gdk.KEY_ instead.__name__ZKEY_ 0123456789_iiiiiiiiii)syswarningsmodulerrwarnRuntimeWarningglobalsZ_modnamemodulesZ_keysymsdirname startswithtargetgetattrvaluesetattrZArmenian_eternityZArmenian_section_signZArmenian_parenleftZArmenian_guillemotrightZArmenian_guillemotleftZArmenian_em_dashZ Armenian_dotZArmenian_mijaketZArmenian_commaZArmenian_en_dashZArmenian_ellipsisrr/usr/lib64/python3.6/keysyms.pys2       PK!CICI"__pycache__/GObject.cpython-36.pycnu[3 <_e*@s~ddlZddlZddlmZddlZddlZddlmZmZddl m Z ddlm Z ddlm Z ddlmZddlmZejjd ZgZdd lmZeZx6dD].Zee eee<ed ed$eejeqWxXdD]PZej"ejdOe ee eee<WdQRXed ed$eejeqWxHdD]@Zejd\d]dZee eee<ed ed$eejeq0WxHdD]@Zejd\d]dZee eee<ed ed$eejeqzWejdpZ ejdqZ!ejdrZ"ejdsZ#ejdtZ$ejduZ%ejdvZ&ejdwZ'ejdxZ(ejdyZ)ejdzZ*ejd{Z+ejd|Z,ejd}Z-ejd~Z.ejdZ/ejdZ0ejdZ1ejdZ2ejdZ3ejd Z4ejdZ5ejdZ6ejdZ7ejdZ8ejdZ9ej:j;Zeee<ed edeejeqNWej>j?ej>j@BZAejdeBej>dred ddxLdD]DZejd\d]dZeejCeee<ed edeejeqWejDZDejEZEejFZFejGZGejHZHejIZIejJZJejKZKejLZLejMZMedd|d}drd dddddg 7ZejNZNejOZOejPZPejQZQe jRZRejSZSeddddddg7ZGddńdej:Z:ee:Z:ejdŃddDŽZejdǃddɄZTejdɃdd˄ZUdd̈́ZVejd̓ddτZWejdσddфZXejdуedddddddgZYdddڄZZejdڃGdd܄de[Z\ddބZ]ejdރddZ^ejdddZ_ejddddZ`ejddddZaejdejbZbejcZceddg7ZGddde[ZdddZeGdddejfZfeefZfefZHedd g7ZGdddejgZgeegZgejde jhZhejiZiejjZjehZked ddeddddg7ZdS(N) namedtuple)overridedeprecated_attr)GLib)PyGIDeprecationWarning)_propertyhelper) _signalhelper)_giGObject)_optionmarkup_escape_textget_application_nameset_application_name get_prgname set_prgname main_depthfilename_display_basenamefilename_display_namefilename_from_utf8uri_list_extract_urisMainLoop MainContextmain_context_default source_removeSourceIdleTimeoutPollFDidle_add timeout_addtimeout_add_seconds io_add_watchchild_watch_addget_current_time spawn_asynczGLib.PRIORITY_DEFAULTPRIORITY_DEFAULT_IDLE PRIORITY_HIGHPRIORITY_HIGH_IDLE PRIORITY_LOWIO_INIO_OUTIO_PRIIO_ERRIO_HUPIO_NVALIO_STATUS_ERRORIO_STATUS_NORMAL IO_STATUS_EOFIO_STATUS_AGAINIO_FLAG_APPENDIO_FLAG_NONBLOCKIO_FLAG_IS_READABLEIO_FLAG_IS_WRITEABLEIO_FLAG_IS_SEEKABLE IO_FLAG_MASKIO_FLAG_GET_MASKIO_FLAG_SET_MASKSPAWN_LEAVE_DESCRIPTORS_OPENSPAWN_DO_NOT_REAP_CHILDSPAWN_SEARCH_PATHSPAWN_STDOUT_TO_DEV_NULLSPAWN_STDERR_TO_DEV_NULLSPAWN_CHILD_INHERITS_STDINSPAWN_FILE_AND_ARGV_ZEROOPTION_FLAG_HIDDENOPTION_FLAG_IN_MAINOPTION_FLAG_REVERSEOPTION_FLAG_NO_ARGOPTION_FLAG_FILENAMEOPTION_FLAG_OPTIONAL_ARGOPTION_FLAG_NOALIASOPTION_ERROR_UNKNOWN_OPTIONOPTION_ERROR_BAD_VALUEOPTION_ERROR_FAILEDOPTION_REMAINING glib_versionignore G_MININT8 G_MAXINT8 G_MAXUINT8 G_MININT16 G_MAXINT16 G_MAXUINT16 G_MININT32 G_MAXINT32 G_MAXUINT32 G_MININT64 G_MAXINT64 G_MAXUINT64_ G_MINFLOAT G_MAXFLOAT G_MINDOUBLE G_MAXDOUBLE G_MINSHORT G_MAXSHORT G_MAXUSHORTG_MININTG_MAXINT G_MAXUINT G_MINLONG G_MAXLONG G_MAXULONG G_MAXSIZE G_MINSSIZE G_MAXSSIZE G_MINOFFSET G_MAXOFFSETZinvalidvoid GInterfaceZgcharZgucharZgbooleanZgintZguintZglongZgulongZgint64Zguint64GEnumGFlagsZgfloatZgdoubleZ gchararrayZgpointerGBoxedZGParamZPyObjectGTypeZGStrvZGVariantZGString TYPE_INVALID TYPE_NONETYPE_INTERFACE TYPE_CHAR TYPE_UCHAR TYPE_BOOLEANTYPE_INT TYPE_UINT TYPE_LONG TYPE_ULONG TYPE_INT64 TYPE_UINT64 TYPE_ENUM TYPE_FLAGS TYPE_FLOAT TYPE_DOUBLE TYPE_STRING TYPE_POINTER TYPE_BOXED TYPE_PARAM TYPE_OBJECT TYPE_PYOBJECT TYPE_GTYPE TYPE_STRV TYPE_VARIANT TYPE_GSTRING TYPE_UNICHAR TYPE_VALUEPidGError OptionGroup OptionContextPARAM_CONSTRUCTPARAM_CONSTRUCT_ONLYPARAM_LAX_VALIDATIONPARAM_READABLEPARAM_WRITABLEzGObject.ParamFlags.PARAM_READWRITEZ READWRITEz)GObject.ParamFlags.READWRITE (glib 2.42+) SIGNAL_ACTIONSIGNAL_DETAILEDSIGNAL_NO_HOOKSSIGNAL_NO_RECURSESIGNAL_RUN_CLEANUPSIGNAL_RUN_FIRSTSIGNAL_RUN_LASTzGObject.SignalFlags.GObjectWeakRef GParamSpecGPointerWarningfeatureslist_propertiesnewpygobject_version threads_init type_registercsNeZdZdddZfddZddZdd Zd d Zd d ZddZ Z S)ValueNcCs4tjj||dk r0|j||dk r0|j|dS)N) GObjectModuler__init__Zinit set_value)selfZ value_typepy_valuer/usr/lib64/python3.6/GObject.pyrs   zValue.__init__cs*|jr|jtkr|jtt|jdS)N)Z_free_on_deallocg_typervZunsetsuperr__del__)r) __class__rrrsz Value.__del__cCstj||dS)N)r Z _gvalue_set)rZboxedrrr set_boxedszValue.set_boxedcCs tj|S)N)r Z _gvalue_get)rrrr get_boxedszValue.get_boxedcCs|j}|tjkrtdnb|tkr2|j|nL|tkrH|j|n6|tkr^|j |n |t krt|j |n |t kr|j |n|tkr|j|n|tkr|j|n|tkr|j|n|tkr|j|n|tkr|j|n|tkr|j|nn|tkrt|tr0t|}nNtjdkrjt|trT|j d}nt!d|t"|fnt!d|t"|f|j#|n|t$kr|j%|n|j&t'r|j(|n|j&t)r|j*|n|j&t+r|j,|n|t-kr|j.|n|j&t/r|j0|nh|t1kr0|j t2|nN|t3krF|j4|n8|t5kr\|j6|n"|t7krr|j,|n td|dS) Nz+GObject.Value needs to be initialized firstrzUTF-8z'Expected string or unicode but got %s%szExpected string but got %s%szUnknown value type %s)rr)8rr rv TypeErrorr{Z set_booleanryZset_charrzZ set_ucharr|Zset_intr}Zset_uintr~Zset_longrZ set_ulongrZ set_int64rZ set_uint64rZ set_floatrZ set_doubler isinstancestrsys version_infoZunicodeencode ValueErrortypeZ set_stringrZ set_paramis_arZset_enumrZ set_flagsrrrZ set_pointerrZ set_objectrintrZ set_gtyperZ set_variantr)rrgtyperrrrsr                             zValue.set_valuecCs|j}|tkr|jS|tkr&|jS|tkr6|jS|tkrF|jS|t krV|j S|t krf|j S|t krv|jS|tkr|jS|tkr|jS|tkr|jS|tkr|jS|tkr|jS|tkr|jS|jtr|jS|jtr|jS|jt r|j!S|t"kr&|j#S|jt$r:|j%S|t&krL|j S|t'kr^|j(S|t)krp|j*S|t+kr|ndSdS)N),rr{Z get_booleanryZget_charrzZ get_ucharr|Zget_intr}Zget_uintr~Zget_longrZ get_ulongrZ get_int64rZ get_uint64rZ get_floatrZ get_doublerZ get_stringrZ get_paramrrZget_enumrZ get_flagsrrrZ get_pointerrZ get_objectrrZ get_gtyperZ get_variantr)rrrrr get_value-s\          zValue.get_valuecCsd|jj|jfS)Nz)rnamer)rrrr__repr___szValue.__repr__)NN) __name__ __module__ __qualname__rrrrrrr __classcell__rr)rrrs  A2rcCs"tj|}|tkrtd||S)Nzunknown type name: %s)rtype_from_namerv RuntimeError)rtype_rrrrgs  rcCstj|}|tkrtd|S)Nzno parent for type)r type_parentrvr)rparentrrrrqs rcCs4t|dr|j}|j r0|j r0td|dS)N __gtype__z1type must be instantiable or an interface, got %s)hasattrrZis_instantiatableZ is_interfacer)rrrr _validate_type_for_signal_method{s rcCst|tj|S)N)rrsignal_list_ids)rrrrrsrcCst|}tdd|DS)Ncss|]}tj|VqdS)N)r signal_name).0irrr sz$signal_list_names..)rtuple)rZidsrrrsignal_list_namessrcCst|tj||S)N)rr signal_lookup)rrrrrrsr SignalQuery signal_idritype signal_flags return_type param_typescCsX|dk rt||}tj|}|dkr(dS|jdkr6dSt|j|j|j|j|jt |j S)Nr) rr signal_queryrrrrrrrr)Z id_or_namerresrrrrs   rc@s$eZdZddZddZddZdS)_HandlerBlockManagercCs||_||_dS)N)obj handler_id)rrrrrrrsz_HandlerBlockManager.__init__cCsdS)Nr)rrrr __enter__sz_HandlerBlockManager.__enter__cCstj|j|jdS)N)rsignal_handler_unblockrr)rexc_type exc_value tracebackrrr__exit__sz_HandlerBlockManager.__exit__N)rrrrrrrrrrrsrcCstj||t||S)aBlocks the signal handler from being invoked until handler_unblock() is called. :param GObject.Object obj: Object instance to block handlers for. :param int handler_id: Id of signal to block. :returns: A context manager which optionally can be used to automatically unblock the handler: .. code-block:: python with GObject.signal_handler_block(obj, id): pass )rsignal_handler_blockr)rrrrrrs rcCs4tj|||\}}}|r ||fStd||fdS)a%Parse a detailed signal name into (signal_id, detail). :param str detailed_signal: Signal name which can include detail. For example: "notify:prop_name" :returns: Tuple of (signal_id, detail) :raises ValueError: If the given signal is unknown. z%s: unknown signal name: %sN)rsignal_parse_namer)detailed_signalrZforce_detail_quarkrrdetailrrrrs  rcCs t||d\}}tj||dS)NT)rrZsignal_remove_emission_hook)rrZhook_idrrrrrremove_emission_hooksrcCsd|fS)NFr)ihint return_accuhandler_return user_datarrrsignal_accumulator_first_winssrcCs | |fS)Nr)rrrrrrrsignal_accumulator_true_handledsradd_emission_hook signal_newc@s$eZdZddZddZddZdS)_FreezeNotifyManagercCs ||_dS)N)r)rrrrrrsz_FreezeNotifyManager.__init__cCsdS)Nr)rrrrrsz_FreezeNotifyManager.__enter__cCs|jjdS)N)rZ thaw_notify)rrrrrrrrsz_FreezeNotifyManager.__exit__N)rrrrrrrrrrrsrcstjjfdd}|S)Ncs ||S)Nr)argskwargs)funcrrmeth'sz_signalmethod..meth)giZ overrideswraps)rrr)rr _signalmethod#srcsjeZdZddZddZeZeZeZeZeZ eZ eZ eZ eZ eZeZeZeZeZeZejjZejjZejjZejjZeZeZeZeZejj Z ejj!Z!ejj"Z"ejj#Z#ejj$Z$ejj%Z%ejj&Z&ejj'Z'ejj(Z(ejj)Z)ejj*Z*ejj+Z+ejj,Z,ejj-Z-ejj.Z.ejj/Z/ejj0Z0fddZ1ddZ2e3Z4e5ej6Z7e5ej8Z9e5ej8Z:e5ej;Zd d Z?e?Z@ZAS) ObjectcOs tddS)Nz%This method is currently unsupported.)r)rrkargsrrr_unsupported_method.szObject._unsupported_methodcOs tddS)NzIData access methods are unsupported. Use normal Python attributes instead)r)rrrrrr_unsupported_data_method1szObject._unsupported_data_methodcstt|jt|S)aFreezes the object's property-changed notification queue. :returns: A context manager which optionally can be used to automatically thaw notifications. This will freeze the object so that "notify" signals are blocked until the thaw_notify() method is called. .. code-block:: python with obj.freeze_notify(): pass )rr freeze_notifyr)r)rrrriszObject.freeze_notifycst|jdd}|tjj@r"tjj}ntjj}|tjj@r^t |dkrPt d|gfdd}n}||||f|S)aConnect a callback to the given signal with optional user data. :param str detailed_signal: A detailed signal to connect to. :param callable handler: Callback handler to connect to the signal. :param *data: Variable data which is passed through to the signal handler. :param GObject.ConnectFlags connect_flags: Flags used for connection options. :returns: A signal id which can be used with disconnect. Z connect_flagsrr]zWUsing GObject.ConnectFlags.SWAPPED requires exactly one argument for user data, got: %scs(t|}|j}||g}|f|S)N)listpop)rrZswap)handlerrr new_handlers z(Object.connect_data..new_handler) getrZ ConnectFlagsZAFTERr r connect_afterconnectZSWAPPEDlenr)rrr datarflagsZ connect_funcr r)r r connect_data{s      zObject.connect_datacCstj|jjtdd|j|S)z-Deprecated, please use stop_emission_by_name.) stacklevel)warningswarn stop_emission__doc__rstop_emission_by_name)rrrrrrszObject.stop_emission)Brrrrrget_dataZ get_qdataset_dataZ steal_dataZ steal_qdataZ replace_dataZ replace_qdataZbind_property_fullZcompat_controlZinterface_find_propertyZinterface_install_propertyZinterface_list_propertiesZnotify_by_pspecZ run_disposeZ watch_closurerrrefZ_refZref_sinkZ _ref_sinkZunrefZ_unrefZforce_floatingZ_force_floatingr r Z get_propertyZget_propertiesZ set_propertyZset_propertiesZ bind_propertyrrZconnect_objectZconnect_object_afterZdisconnect_by_funcZhandler_block_by_funcZhandler_unblock_by_funcemitchainZweak_ref__copy__ __deepcopy__rrrZ handler_blockrrZhandler_unblockZsignal_handler_disconnectZ disconnectZhandler_disconnectZsignal_handler_is_connectedZhandler_is_connectedZsignal_stop_emission_by_namerrZemit_stop_by_namerrr)rrr-sh )     rcs$eZdZddZfddZZS)BindingcCstjdtdd|S)NzUsing parentheses (binding()) to retrieve the Binding object is no longer needed because the binding is returned directly from "bind_property.r)r)rrr)rrrr__call__s zBinding.__call__cs2t|drtdnt|ddtt|jdS)NZ_unboundz$binding has already been cleared outT)rrsetattrrr"unbind)r)rrrr%s   zBinding.unbind)rrrr#r%rrr)rrr"sr"propertyzGObject.PropertyPropertySignalSignalOverride)r r rrrrrrrrrrrrrrrrrrr r!r"r#r$)*r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrN) rPrQrRrSrTrUrVrWrXrYrZr[)r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnror*)rrrr)rrrrrr*)rrrrrrrr*)N)N)N)lrr collectionsrZ gi.overridesrZ gi.modulerrZ gi.repositoryrrrZpropertyhelperrZ signalhelperr moduleZget_introspection_moduler__all__r Zoptionrgetattrglobalsappendcatch_warnings simplefiltersplitnew_namerrvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrZ ParamFlagsZREADABLEZWRITABLErrZ SignalFlagsrtrrrsrqr rrrrurrrrrrrrrrrrrrobjectrrrrrrrrrrrr"r'r(r)r&rrrrs                                                                    PK!ass$__pycache__/Gio.cpython-36.opt-1.pycnu[3 <_>#@sJddlZddlmZmZddlmZmZddlmZddl m Z ddl m Z ddl Z edZgZGd d d ejZeeZejd Gd d d ejZeeZejd Gd ddejZeeZejdGdddejZeeZejdGdddejZeeZejdGdddZGdddejZeeZejddS)N)wakeup_on_signalregister_sigint_fallback)overridedeprecated_init)get_introspection_module) PyGIWarning)GLibGioc@seZdZddZdS) ApplicationcOs<t|j(ttjj|f||SQRXWdQRXdS)N)rquitrr r run)selfargskwargsr/usr/lib64/python3.6/Gio.pyr 's zApplication.runN)__name__ __module__ __qualname__r rrrrr %sr cseZdZfddZZS) VolumeMonitorcs&tt|j||tjdtdddS)NzZGio.VolumeMonitor shouldn't be instantiated directly, use Gio.VolumeMonitor.get() instead.r) stacklevel)superr__init__warningswarnr)rrr) __class__rrr3szVolumeMonitor.__init__)rrrr __classcell__rr)rrr1src@s eZdZddZddZeZdS)FileEnumeratorcCs|S)Nr)rrrr__iter__BszFileEnumerator.__iter__cCs|jd}|dk r|StdS)N)Z next_file StopIteration)r file_inforrr__next__Es zFileEnumerator.__next__N)rrrrr"nextrrrrrAs rc@seZdZddZdS)MenuItemcCs,x&|D]\}}}|j|tj||qWdS)N)Zset_attribute_valuer Variant)rZ attributesname format_stringvaluerrr set_attributeVszMenuItem.set_attributeN)rrrr)rrrrr$Usr$c@sTeZdZdZeejjddZddZdd Z d d Z e Z d d Z ddZ ddZdS)Settingsz0Provide dictionary-like access to GLib.Settings.schemapathbackend)Z arg_namescCs ||jkS)N) list_keys)rkeyrrr __contains__eszSettings.__contains__cCs t|jS)N)lenr.)rrrr__len__hszSettings.__len__cCsdS)NTr)rrrr__bool__kszSettings.__bool__cCs$||krtd|f|j|jS)Nzunknown key: %r)KeyErrorZ get_valueunpack)rr/rrr __getitem__sszSettings.__getitem__cCs||krtd|f|j|}|jdj}|jd}|dkr\|jdj}|dd}nN|dkr|jdjdj}|j}||krtd||fntdt||j |t j ||dS)Nzunknown key: %rrtypeenumz$value %s is not an allowed enum (%s)z'Cannot handle allowed type range class ) r4Z get_rangeZget_child_valueZ get_stringZget_type_stringr5 ValueErrorNotImplementedErrorstrZ set_valuer r%)rr/r(rangeZtype_vZtype_strZallowedrrr __setitem__zs  zSettings.__setitem__cCs|jS)N)r.)rrrrkeyssz Settings.keysN)r+r,r-)rrr__doc__rr r*rr0r2r3Z __nonzero__r6r?r@rrrrr*_sr*c@s4eZdZdZddZddZddZedd Zd S) _DBusProxyMethodCallz1Helper class to implement DBusProxy method calls.cCs||_||_dS)N) dbus_proxy method_name)rrCrDrrrrsz_DBusProxyMethodCall.__init__c Csv|\}}}y|j|}WnFtk r^tjdd\}} |rN||| |n ||| |dSX|||j||dS)Nr)Z call_finish Exceptionsysexc_info_unpack_result) robjresult user_dataZresult_callbackZerror_callbackZreal_user_dataretetypeerrrZ__async_result_handlers  z+_DBusProxyMethodCall.__async_result_handlercOs|r0|d}|dd}t|ts4td|nd}tj|t|}d|kr|d|jd|jdf}|jj|j ||jdd|jd d d|j |n0|jj |j ||jdd|jd d d}|j |SdS) Nrr7z6first argument must be the method signature string: %rz()Zresult_handlerZ error_handlerrKflagsZtimeoutrP) isinstancer< TypeErrorr r%tuplegetrCZcallrD*_DBusProxyMethodCall__async_result_handlerZ call_syncrH)rrrZ signatureZ arg_variantrKrJrrr__call__s&        z_DBusProxyMethodCall.__call__cCs2|j}t|dkr|d}nt|dkr.d}|S)z?Convert a D-BUS return variant into an appropriate return valuer7rN)r5r1)klassrJrrrrHs    z#_DBusProxyMethodCall._unpack_resultN) rrrrArrUrV classmethodrHrrrrrBs rBc@seZdZdZddZdS) DBusProxya$Provide comfortable and pythonic method calls. This marshalls the method arguments into a GVariant, invokes the call_sync() method on the DBusProxy object, and unmarshalls the result GVariant back into a Python tuple. The first argument always needs to be the D-Bus signature tuple of the method call. Example: proxy = Gio.DBusProxy.new_sync(...) result = proxy.MyMethod('(is)', 42, 'hello') The exception are methods which take no arguments, like proxy.MyMethod('()'). For these you can omit the signature and just write proxy.MyMethod(). Optional keyword arguments: - timeout: timeout for the call in milliseconds (default to D-Bus timeout) - flags: Combination of Gio.DBusCallFlags.* - result_handler: Do an asynchronous method call and invoke result_handler(proxy_object, result, user_data) when it finishes. - error_handler: If the asynchronous call raises an exception, error_handler(proxy_object, exception, user_data) is called when it finishes. If error_handler is not given, result_handler is called with the exception object as result instead. - user_data: Optional user data to pass to result_handler for asynchronous calls. Example for asynchronous calls: def mymethod_done(proxy, result, user_data): if isinstance(result, Exception): # handle error else: # do something with result proxy.MyMethod('(is)', 42, 'hello', result_handler=mymethod_done, user_data='data') cCs t||S)N)rB)rr&rrr __getattr__ szDBusProxy.__getattr__N)rrrrArZrrrrrYs,rY)rZ _ossighelperrrZ overridesrrmodulerZgirZ gi.repositoryr rFr __all__r appendrrr$r*rBrYrrrrs6        9 C1PK! >&3Z3Z__pycache__/GLib.cpython-36.pycnu[3 <_u@sddlZddlZddlZddlmZmZddlmZddlm Z m Z m Z m Z ddl mZmZmZddlmZmZedZgZdd lmZeejd dd lmZdd lmZeZejZejZejZejZd dZ ddZ!ddZ"de_#de_$ejj%e_%e!e_&e'e"e_(edddddddg7ZGddde)Z*Gdddej+Z+ddZ,e-e+de,ejddd d!Z.ejd!xFdD]>Z/d*e/Z0ede0d+e/e1ej2d,e/e3e0<eje0qxWx2dD]*Z/e1ej4e/e3d3e/<ejd3e/qWxBdD]:Z/d;e/Z0ede0dejd=xBdD]:Z/dCe/Z0e1ej8e/e3e0<ede0dDe/eje0qVWxBdD]:Z/dLe/Z0e1ej9e/e3e0<ede0dMe/eje0qWxBdD]:Z/dUe/Z0e1ej:e/e3e0<ede0dVe/eje0qWxBdD]:Z/dZe/Z0ede0d[e/e1ej;e/e3e0<eje0q"Wx8dD]0ZZ>ee>Z>ejdpGdqdrdrej?Z?ee?Z?ejdrGdsdtdtej@Z@ee@Z@ejdtGdudvdve@ZAejdvGdwdxdxe@ZBejdxdydzZCejdzd{d|ZDejd|d}d~ZEejd~ddZFejdddZGejdGdddejHZHeeHZHejdGdddejIZIeeIZIejdddZJejdddZKejdddZLeeLdZLejddddZMejdeNedsJddZOeOe_PejQejRejSfZTejdedddeZUejdeddddS)N)wakeup_on_signalregister_sigint_fallback)get_introspection_module)variant_type_from_string source_newsource_set_callbackio_channel_read)override deprecateddeprecated_attr)PyGIDeprecationWarning version_infoGLib)_optionoption)_gi)GErrorcCstjdtdddS)NzmSince version 3.11, calling threads_init is no longer needed. See: https://wiki.gnome.org/PyGObject/Threadingr) stacklevel)warningswarnr rr/usr/lib64/python3.6/GLib.py threads_init5srcCs2t|jtrtj|j}n|j}||jf||fkS)N) isinstancedomainstrrZquark_from_stringcode)selfrrZself_domain_quarkrrrgerror_matches;s rcCstj|}t|||S)N)rZquark_to_stringr)rmessagerZ domain_quarkrrrgerror_new_literalEs r!Errorr OptionContext OptionGroupPid spawn_asyncc@sneZdZejjejjejjejjejj ejj ejj ejj ejj ejjejjejjejjejjdZddZdS)_VariantCreator)bynqiuxthdsogvc Cstj|}||jkr"|j||Stjj|}|dkr>|jS|jrh|j|j|j j ||jSy t |Wn$t k rt d||fYnX|j r|jt|krt d||f|jrt|dkrt d||f|jr4|j j }t|tr|j}xl|D]}|j|j||qWnJ|dd}x<|D]4}t|j }|j|j|||t|d}qFW|jS)aBCreate a GVariant object from given format and a value that matches the format. This method recursively calls itself for complex structures (arrays, dictionaries, boxed). Returns the generated GVariant. If value is None it will generate an empty GVariant container type. NzOCould not create array, tuple or dictionary entry from non iterable value %s %sz1Tuple mismatches value's number of elements %s %srz/Dictionary entries must have two elements %s %s)r VariantType_LEAF_CONSTRUCTORSZVariantBuildernewendZis_maybeZ add_value_createelementZ dup_stringiter TypeErrorZis_tupleZn_itemslenZ is_dict_entryZis_arrayrdictitemsr) rformatvalueZgvtypeZbuilderZ element_typer,Zremainer_formatduprrrr;is<           z_VariantCreator._createN)__name__ __module__ __qualname__rVariantZ new_booleanZnew_byteZ new_int16Z new_uint16Z new_int32Z new_uint32Z new_int64Z new_uint64Z new_handleZ new_doubleZ new_stringZnew_object_pathZ new_signatureZ new_variantr8r;rrrrr'Vs r'c@seZdZddZeddZddZddZd d Zd d Z d dZ ddZ ddZ e ddZddZddZddZddZddZdS) rHcCs2tjj|std|t}|j||}||_|S)aCreate a GVariant from a native Python object. format_string is a standard GVariant type signature, value is a Python object whose structure has to match the signature. Examples: GLib.Variant('i', 1) GLib.Variant('(is)', (1, 'hello')) GLib.Variant('(asa{sv})', ([], {'foo': GLib.Variant('b', True), 'bar': GLib.Variant('i', 2)})) z#Invalid GVariant format string '%s')rr7Zstring_is_validr>r'r; format_string)clsrIrCZcreatorr5rrr__new__s   zVariant.__new__cGs tjj|S)N)rrH new_tuple)elementsrrrrLszVariant.new_tuplec Cs&y |jWntk r YnXdS)N)unref ImportError)rrrr__del__s zVariant.__del__cCs |jdS)NT)print_)rrrr__str__szVariant.__str__cCs,t|dr|j}n|j}d||jdfS)NrIzGLib.Variant('%s', %s)F)hasattrrIget_type_stringrQ)rfrrr__repr__s zVariant.__repr__c Cs$y |j|Stk rdSXdS)NF)equalr>)rotherrrr__eq__s zVariant.__eq__c Cs&y |j| Stk r dSXdS)NT)rWr>)rrXrrr__ne__s zVariant.__ne__cCst|j|jfS)N)hashrTunpack)rrrr__hash__szVariant.__hash__csXjjjjjjjjjj j j j d }|j j }|rR|Sj j drfddtjD}t|Sj j dri}x:tjD]*}j|}|jdj||jdj<qW|Sj j drfd dtjDSj j d rjjSj j d rDjs6d SjdjStd j d S)z1Decompose a GVariant into a native Python object.) r(r)r*r+r,r-r.r/r0r1r2r3r4(csg|]}j|jqSr)get_child_valuer\).0r,)rrr sz"Variant.unpack..za{r6racsg|]}j|jqSr)r_r\)r`r,)rrrrasr5mNzunsupported GVariant type ) get_booleanZget_byteZ get_int16Z get_uint16Z get_int32Z get_uint32Z get_int64Z get_uint64Z get_handleZ get_double get_stringgetrT startswithrange n_childrentupler_r\Z get_variantNotImplementedError)rZLEAF_ACCESSORSZlaresr,r5r)rrr\sH       zVariant.unpackc Cs|dkr gS|jds|gSg}d}|dd }x|r|d}||7}|dd}|d kr\q2|dkrd}|}|dkrzd }nd }xJ|dkr|d}||7}|dd}||kr|d7}q||kr|d8}qW|j|d}q2W|S)a[Return a list of the element signatures of the topmost signature tuple. If the signature is not a tuple, it returns one element with the entire signature. If the signature is an empty tuple, the result is []. This is useful for e. g. iterating over method parameters which are passed as a single Variant. z()r^r6rNrcrb{)})rcrb)r^rn)rgappend) klassZ signatureresultheadtailclevelZupZdownrrrsplit_signatures<         zVariant.split_signaturecCsP|jdkrt|jS|jjds4|jjdr<|jStd|jdS)Nr2r3r4rbr^z'GVariant type %s does not have a length)r2r3r4)rTr?rergrir>)rrrr__len__Is   zVariant.__len__c Cs&|jjdry(|j|td}|dkr0t||jStk rx>t|jD].}|j |}|j dj|krT|j djSqTWt|YnX|jjds|jjdrt |}|dkr|j|}|dks||jkrt d|j |jS|jd kr|j j |Std |jdS) Nza{*rr6rbr^zlist index out of ranger2r3r4z#GVariant type %s is not a container)r2r3r4)rTrgZ lookup_valuerKeyErrorr\r>rhrir_int IndexErrorre __getitem__)rkeyvalr,r5rrrrQs,  zVariant.__getitem__cCs|jS)N)__bool__)rrrr __nonzero__vszVariant.__nonzero__c Cs|jdkr|jd kS|jdkr,|jS|jdkrHt|jd kS|jjdsd|jjdrp|jd kS|jdkrt|jSdS)Nr)r*r+r,r-r.r/r0r1rr(r2r3r4rbr^r5T) r)r*r+r,r-r.r/r0r1)r()r2r3r4)r5)rTr\rdr?rergribool)rrrrrys       zVariant.__bool__cCsZ|jjdstd|jfSg}x2t|jD]"}|j|}|j|jdjq0W|S)Nza{z$GVariant type %s is not a dictionaryr)rTrgr>rhrir_rrr\)rrlr,r5rrrkeyss z Variant.keysN)rErFrGrK staticmethodrLrPrRrVrYrZr]r\ classmethodryrzrrrrrrrrrHs  7 6%rHcCstjj|\}}|S)N)rrHre)rrClengthrrrresrer6cCs,t|trtj|jd|Stj||SdS)NzUTF-8)rbytesrmarkup_escape_textdecode)textrrrrrs rDESKTOP DOCUMENTSDOWNLOADMUSICPICTURES PUBLIC_SHARE TEMPLATESVIDEOSZUSER_DIRECTORY_zGLib.UserDirectory.DIRECTORY_Z DIRECTORY_ERRHUPINNVALOUTPRIZIO_APPENDGET_MASK IS_READABLE IS_SEEKABLEMASKNONBLOCKSET_MASKZIO_FLAG_z GLib.IOFlags.IO_FLAG_IS_WRITEABLEzGLib.IOFlags.IS_WRITABLEAGAINEOFERRORNORMALZ IO_STATUS_zGLib.IOStatus.CHILD_INHERITS_STDINDO_NOT_REAP_CHILDFILE_AND_ARGV_ZEROLEAVE_DESCRIPTORS_OPEN SEARCH_PATHSTDERR_TO_DEV_NULLSTDOUT_TO_DEV_NULLZSPAWN_zGLib.SpawnFlags.HIDDENIN_MAINREVERSENO_ARGFILENAME OPTIONAL_ARGNOALIASZ OPTION_FLAG_zGLib.OptionFlags.UNKNOWN_OPTION BAD_VALUEFAILEDZ OPTION_ERROR_zGLib.OptionError. G_MINFLOAT G_MAXFLOAT G_MINDOUBLE G_MAXDOUBLE G_MINSHORT G_MAXSHORT G_MAXUSHORTG_MININTG_MAXINT G_MAXUINT G_MINLONG G_MAXLONG G_MAXULONG G_MAXSIZE G_MINSSIZE G_MAXSSIZE G_MINOFFSET G_MAXOFFSET_cs0eZdZdddZd ddZfddZZS) MainLoopNcCstjj|dS)NF)rrr9)rJcontextrrrrKszMainLoop.__new__cCsdS)Nr)rrrrr__init__szMainLoop.__init__cs:t|j&ttt|jWdQRXWdQRXdS)N)rquitrsuperrrun)r) __class__rrrs z MainLoop.run)N)N)rErFrGrKrr __classcell__rr)rrrs  rcseZdZdfdd ZZS) MainContextTcstt|j|S)N)rr iteration)rZ may_block)rrrrszMainContext.iteration)T)rErFrGrrrr)rrrsrcseZdZddZfddZddZdfdd Zd d Zeed Zd dZ ddZ e e e Z ddZ ddZe e eZZS)SourcecOst}||_t|dd|S)N__pygi_custom_sourceT)rrsetattr)rJargskwargssourcerrrrKs zSource.__new__cstt|jS)N)rrr)rrr)rrrr szSource.__init__cCst|dr|jdS)Nr)rSrN)rrrrrPs zSource.__del__Ncs.t|drt|||ntt|j||dS)Nr)rSrrr set_callback)rfn user_data)rrrrs zSource.set_callbackcCs tjdS)Ngư>)r get_real_time)rrrrget_current_timeszSource.get_current_timez.GLib.Source.get_time() or GLib.get_real_time()cCs|jS)N)Z get_priority)rrrrZ__get_priority$szSource.__get_prioritycCs|j|dS)N) set_priority)rrCrrrZ__set_priority'szSource.__set_prioritycCs|jS)N)Zget_can_recurse)rrrrZ__get_can_recurse,szSource.__get_can_recursecCs|j|dS)N)Zset_can_recurse)rrCrrrZ__set_can_recurse/szSource.__set_can_recurse)N)rErFrGrKrrPrrr Z_Source__get_priorityZ_Source__set_prioritypropertypriorityZ_Source__get_can_recurseZ_Source__set_can_recurseZ can_recurserrr)rrrs   rcs0eZdZejfddZejffdd ZZS)IdlecCstj}||_|S)N)rZidle_source_newr)rJrrrrrrK:sz Idle.__new__cs&tt|j|tjkr"|j|dS)N)rrrrPRIORITY_DEFAULTr)rr)rrrr?s z Idle.__init__)rErFrGrrrKrrrr)rrr9src@s,eZdZdejfddZdejfddZdS)TimeoutrcCstj|}||_|S)N)rZtimeout_source_newr)rJintervalrrrrrrKIs zTimeout.__new__cCs|tjkr|j|dS)N)rrr)rrrrrrrNs zTimeout.__init__N)rErFrGrrrKrrrrrrHsrcOs |jdtj}tj||f|S)Nr)rfrZPRIORITY_DEFAULT_IDLEidle_add)functionrrrrrrrWsrcOs"|jdtj}tj|||f|S)Nr)rfrr timeout_add)rrrrrrrrr_srcOs"|jdtj}tj|||f|S)Nr)rfrrtimeout_add_seconds)rrrrrrrrrgsrcsLt|t st|tjrftjdt|}||}ts@tdd|kr^tjdt|d}qtj }n6t |dkst|d rtd|d|dd}ttr‡fdd }tj j }n|tt j rtjd krfd d }tj jj}nFtd r$fd d }tj j j}nttj s6t}}|||||fS)NzFCalling io_add_watch without priority as second argument is deprecatedzthird argument must be callablerzgCalling io_add_watch with priority keyword argument is deprecated, put it as second positional argumentr6rz%expecting callback as fourth argumentcs|f|S)Nr)rconddata)callbackchannelrrsz(_io_add_watch_get_args..Zwin32cs|f|S)Nr)rrr)rrrrrsfilenocs|f|S)Nr)rrr)rrrrrs)rr}r IOConditionrrr callabler>rr? IOChannelunix_newsocketsysplatformZwin32_new_socketrrSAssertionError)rZ priority_ conditionZcb_and_user_datarrZfunc_fdtransformZ real_channelr)rrr_io_add_watch_get_args{s<    rcOs*t||\}}}}}tj||||f|S)zOio_add_watch(channel, priority, condition, func, *user_data) -> event_source_id)rr io_add_watch)rrrrrfuncrrrrrsrcseZdZdddZfddZdddZd d d Zd"d d Zd$d dZddZ e j j e j j e j jdZd%ddZddZeedZddZddZeZZS)&rNcCsN|dk rtjj|S|dk r.tjj||p*dS|dk rBtjj|StddS)NrzLeither a valid file descriptor, file name, or window handle must be supplied)rrrZnew_fileZ win32_new_fdr>)rJZfiledesfilenamemodeZhwndrrrrKs  zIOChannel.__new__cstt|jS)N)rrr)rrr)rrrrszIOChannel.__init__r6cCs t||S)N)r )rZ max_countrrrreadszIOChannel.readcCs |j\}}}}|dkrdS|S)Nrm) read_line)r size_hintstatusbufrterminator_posrrrreadlineszIOChannel.readlinecCsHg}tjj}x6|tjjkrB|j\}}}}|dkr6d}|j|qW|S)Nrm)rIOStatusrrrr)rrlinesrrrrrrr readlinesszIOChannel.readlinescCs8t|ts|jd}|dkr$t|}|j||\}}|S)NzUTF-8r6rq)rrencoder?Z write_chars)rrZbuflenrZwrittenrrrwrites   zIOChannel.writecCsx|D]}|j|qWdS)N)r )rrlinerrr writeliness zIOChannel.writelines)rr6rrc Cs8y|j|}Wntk r*tdYnX|j||S)Nzinvalid 'whence' value) _whence_mapr| ValueErrorZ seek_position)roffsetwhencewrrrseeks zIOChannel.seekcOs"|jdtj}t||||f|S)Nr)rfrrr)rrrrrrrrr add_watchszIOChannel.add_watchzGLib.io_add_watch()cCs|S)Nr)rrrr__iter__szIOChannel.__iter__cCs(|j\}}}}|tjjkr |StdS)N)rrrr StopIteration)rrrrrrrr__next__s zIOChannel.__next__)NNNNrq)rqrq)rqrq)rqrq)rq)r)rErFrGrKrrrr r r rZSeekTypeZSETZCURZENDrrrr rrnextrrr)rrrs       rc@seZdZddZddZdS)PollFDcCstj}||_|S)N)rrr)rJfdeventsZpollfdrrrrKszPollFD.__new__cCs||_||_dS)N)rr)rrrrrrr szPollFD.__init__N)rErFrGrKrrrrrrsrcOsg}t|rtjdt|}|}t|dkr<|jdtj}qt|dkr\|}|jdtj}qt|dkr||dg}|d}qtdnT|}|}d|kr|d}|}n6t|dkrt|dr|d}|dd}ntdd |kr|rtd |d g}||||fS) NzHCalling child_watch_add without priority as first argument is deprecatedrrr6rz'expected at most 4 positional argumentsrz#expected callback as third argumentrz'got multiple values for "data" argument) rrrr r?rfrrr>)Zpriority_or_pidZpid_or_callbackrrrpidrrrrr_child_watch_add_get_argss:       rcOs&t||\}}}}tj|||f|S)z/child_watch_add(priority, pid, function, *data))rrchild_watch_add)rrrrrrrrrrDsrcCs tjdS)Ngư>)rrrrrrrMsrzGLib.get_real_time()cCstj||dS)Nr)rfilename_from_utf8)Z utf8stringr?rrrrXsrunix_signal_add_fullcGstjdttj|S)NzAGLib.unix_signal_add_full() was renamed to GLib.unix_signal_add())rrr rZunix_signal_add)rrrradd_full_compatasr! glib_versionz<(GLib.MAJOR_VERSION, GLib.MINOR_VERSION, GLib.MICRO_VERSION)pyglib_versionzgi.version_inforq)rq)rrrrrrrr)rrrrrr)rrrrrrr)rrrr)rrrrrrr)rrrrrrr)rrr)rrrrrrrrrrrrrrrrrrrqrq)rq)VrrrZ _ossighelperrrmodulerrrrrr Z overridesr r r Zgir rr__all__rrrrZ gi._errorrr"r#r$r%r&rrr!rErFZ __gtype__ZmatchesrZ new_literalobjectr'rHrerrr*attrgetattrZ UserDirectoryglobalsrZIOFlagsZ IS_WRITABLErrZ SpawnFlagsZ OptionFlagsZ OptionErrornamesplitrrrrrrrrrrrrrrrrrSr!r Z MAJOR_VERSIONZ MINOR_VERSIONZ MICRO_VERSIONr"r#rrrrs           Fy           2      +  N   '         PK!@__pycache__/Gio.cpython-36.pycnu[3 <_>#@sJddlZddlmZmZddlmZmZddlmZddl m Z ddl m Z ddl Z edZgZGd d d ejZeeZejd Gd d d ejZeeZejd Gd ddejZeeZejdGdddejZeeZejdGdddejZeeZejdGdddZGdddejZeeZejddS)N)wakeup_on_signalregister_sigint_fallback)overridedeprecated_init)get_introspection_module) PyGIWarning)GLibGioc@seZdZddZdS) ApplicationcOs<t|j(ttjj|f||SQRXWdQRXdS)N)rquitrr r run)selfargskwargsr/usr/lib64/python3.6/Gio.pyr 's zApplication.runN)__name__ __module__ __qualname__r rrrrr %sr cseZdZfddZZS) VolumeMonitorcs&tt|j||tjdtdddS)NzZGio.VolumeMonitor shouldn't be instantiated directly, use Gio.VolumeMonitor.get() instead.r) stacklevel)superr__init__warningswarnr)rrr) __class__rrr3szVolumeMonitor.__init__)rrrr __classcell__rr)rrr1src@s eZdZddZddZeZdS)FileEnumeratorcCs|S)Nr)rrrr__iter__BszFileEnumerator.__iter__cCs|jd}|dk r|StdS)N)Z next_file StopIteration)r file_inforrr__next__Es zFileEnumerator.__next__N)rrrrr"nextrrrrrAs rc@seZdZddZdS)MenuItemcCs,x&|D]\}}}|j|tj||qWdS)N)Zset_attribute_valuer Variant)rZ attributesname format_stringvaluerrr set_attributeVszMenuItem.set_attributeN)rrrr)rrrrr$Usr$c@sTeZdZdZeejjddZddZdd Z d d Z e Z d d Z ddZ ddZdS)Settingsz0Provide dictionary-like access to GLib.Settings.schemapathbackend)Z arg_namescCs ||jkS)N) list_keys)rkeyrrr __contains__eszSettings.__contains__cCs t|jS)N)lenr.)rrrr__len__hszSettings.__len__cCsdS)NTr)rrrr__bool__kszSettings.__bool__cCs$||krtd|f|j|jS)Nzunknown key: %r)KeyErrorZ get_valueunpack)rr/rrr __getitem__sszSettings.__getitem__cCs||krtd|f|j|}|jdj}|jd}|dkrj|jdj}|jds\t|dd}nf|dkr|jdjjdst|jdjdj}|j}||krtd||fnt dt ||j |t j ||dS) Nzunknown key: %rrtypeaenumz$value %s is not an allowed enum (%s)z'Cannot handle allowed type range class )r4Z get_rangeZget_child_valueZ get_stringZget_type_string startswithAssertionErrorr5 ValueErrorNotImplementedErrorstrZ set_valuer r%)rr/r(rangeZtype_vZtype_strZallowedrrr __setitem__zs"  zSettings.__setitem__cCs|jS)N)r.)rrrrkeyssz Settings.keysN)r+r,r-)rrr__doc__rr r*rr0r2r3Z __nonzero__r6rBrCrrrrr*_sr*c@s4eZdZdZddZddZddZedd Zd S) _DBusProxyMethodCallz1Helper class to implement DBusProxy method calls.cCs||_||_dS)N) dbus_proxy method_name)rrFrGrrrrsz_DBusProxyMethodCall.__init__c Csv|\}}}y|j|}WnFtk r^tjdd\}} |rN||| |n ||| |dSX|||j||dS)Nr)Z call_finish Exceptionsysexc_info_unpack_result) robjresult user_dataZresult_callbackZerror_callbackZreal_user_dataretetypeerrrZ__async_result_handlers  z+_DBusProxyMethodCall.__async_result_handlercOs|r0|d}|dd}t|ts4td|nd}tj|t|}d|kr|d|jd|jdf}|jj|j ||jdd|jd d d|j |n0|jj |j ||jdd|jd d d}|j |SdS) Nrr7z6first argument must be the method signature string: %rz()Zresult_handlerZ error_handlerrNflagsZtimeoutrS) isinstancer? TypeErrorr r%tuplegetrFZcallrG*_DBusProxyMethodCall__async_result_handlerZ call_syncrK)rrrZ signatureZ arg_variantrNrMrrr__call__s&        z_DBusProxyMethodCall.__call__cCs2|j}t|dkr|d}nt|dkr.d}|S)z?Convert a D-BUS return variant into an appropriate return valuer7rN)r5r1)klassrMrrrrKs    z#_DBusProxyMethodCall._unpack_resultN) rrrrDrrXrY classmethodrKrrrrrEs rEc@seZdZdZddZdS) DBusProxya$Provide comfortable and pythonic method calls. This marshalls the method arguments into a GVariant, invokes the call_sync() method on the DBusProxy object, and unmarshalls the result GVariant back into a Python tuple. The first argument always needs to be the D-Bus signature tuple of the method call. Example: proxy = Gio.DBusProxy.new_sync(...) result = proxy.MyMethod('(is)', 42, 'hello') The exception are methods which take no arguments, like proxy.MyMethod('()'). For these you can omit the signature and just write proxy.MyMethod(). Optional keyword arguments: - timeout: timeout for the call in milliseconds (default to D-Bus timeout) - flags: Combination of Gio.DBusCallFlags.* - result_handler: Do an asynchronous method call and invoke result_handler(proxy_object, result, user_data) when it finishes. - error_handler: If the asynchronous call raises an exception, error_handler(proxy_object, exception, user_data) is called when it finishes. If error_handler is not given, result_handler is called with the exception object as result instead. - user_data: Optional user data to pass to result_handler for asynchronous calls. Example for asynchronous calls: def mymethod_done(proxy, result, user_data): if isinstance(result, Exception): # handle error else: # do something with result proxy.MyMethod('(is)', 42, 'hello', result_handler=mymethod_done, user_data='data') cCs t||S)N)rE)rr&rrr __getattr__ szDBusProxy.__getattr__N)rrrrDr]rrrrr\s,r\)rZ _ossighelperrrZ overridesrrmodulerZgirZ gi.repositoryr rIr __all__r appendrrr$r*rEr\rrrrs6        9 C1PK! $__pycache__/Gtk.cpython-36.opt-1.pycnu[3 <_@sddlZddlZddlZddlmZddlmZmZddlm Z m Z m Z ddl m Z ddlmZejdkrpeZneZe d ZgZejd krd ZejeeGd d d eZejd ddZejdddZejdddZGdddejZe eZejdGdddej eZ e e Z ejdGdddej!Z!e e!Z!ejdejdkrGdddej"Z"e e"Z"ejdGdddej#Z#e e#Z#ejdGdd d ej$Z$e e$Z$ejd Gd!d"d"ej%Z%e e%Z%ejd"Gd#d$d$ej&e Z&e e&Z&ejd$Gd%d&d&ej'Z'e e'Z'ejd&Gd'd(d(ej(Z(e e(Z(ejd(Gd)d*d*ej)Z)e e)Z)ejd*Gd+d,d,ej*Z*e e*Z*ejd,Gd-d.d.ej+Z+e e+Z+ejd.Gd/d0d0ej,e Z,e e,Z,ejd0Gd1d2d2ej-e,Z-e e-Z-ejd2ejdkr@Gd3d4d4ej.Z.e e.Z.ejd4Gd5d6d6ej/Z/e e/Z/ejd6ejdkrGd7d8d8ej0Z0e e0Z0ejd8Gd9d:d:ej1Z1e e1Z1ejd:Gd;d<dd>ej3Z3e e3Z3ejd>Gd?d@d@ej4Z4e e4Z4ejd@GdAdBdBej5Z5e e5Z5ejdBGdCdDdDej6Z6e e6Z6ejdDGdEdFdFej7Z7e e7Z7ejdFGdGdHdHej8Z8e e8Z8ejdHGdIdJdJej9Z9e e9Z9ejdJGdKdLdLej:Z:e e:Z:ejdLGdMdNdNej;e8e9Z;e e;Z;ejdNGdOdPdPe<Z=ejdPGdQdRdRe<Z>ejdRGdSdTdTej?Z?e e?Z?ejdTGdUdVdVej@e8e9Z@e e@Z@ejdVGdWdXdXejAe ZAe eAZAejdXGdYdZdZejBZBe eBZBejdZGd[d\d\ejCZCe eCZCejd\Gd]d^d^ejDe ZDe eDZDejd^Gd_d`d`ejEZEe eEZEejd`GdadbdbejFZFe eFZFejdbGdcddddejGZGe eGZGejddejdkrGdedfdfejHe ZHe eHZHejdfGdgdhdhejIZIe eIZIejdhejdkrNGdidjdjejJZJe eJZJejdjGdkdldlejKZKe eKZKejdlGdmdndnejLZLe eLZLejdnejdkrGdodpdpejMZMe eMZMejdpGdqdrdrejNZNe eNZNejdrGdsdtdtejOZOe eOZOejdtGdudvdvejPZPe ePZPejdvejd kr>GdwdxdxejQZQe eQZQejdxejRZSe ejRdydzZRejTZUe ejTd{d|ZTejdkre ejVZVejd}ejd~krejWnejWejX\ZYZXeZeXe_XdS)N)GObject)wakeup_on_signalregister_sigint_fallback)overridestrip_boolean_resultdeprecated_init)get_introspection_module)PyGIDeprecationWarningGtk2.0aBYou have imported the Gtk 2.0 module. Because Gtk 2.0 was not designed for use with introspection some of the interfaces and API will fail. As such this is not supported by the pygobject development team and we encourage you to port your app to Gtk 3 or greater. PyGTK is the recomended python module to use with Gtk 2.0c@s eZdZdS)PyGTKDeprecationWarningN)__name__ __module__ __qualname__rr/usr/lib64/python3.6/Gtk.pyr4srcCs8g}x.|D]&}t|tjs&tjj|}|j|q W|S)zCreate a list of TargetEntry items from a list of tuples in the form (target, flags, info) The list can also contain existing TargetEntry items in which case the existing entry is re-used in the return list. ) isinstancer Z TargetEntrynewappend)targetstarget_entriesentryrrr_construct_target_list;s    rcCsd}t|tjr|j|d}n t||d}|dkr>td|f}t|tjr|t|dkrftd||dd}|d}nt |std|||fS)NzHandler %s not foundrz!Handler %s tuple can not be emptyz-Handler %s is not a method, function or tuple) r collectionsMappinggetgetattrAttributeErrorSequencelen TypeErrorcallable) obj_or_map handler_namehandlerargsrrr_extract_handler_and_argsLs         r)c Cst||\}}|tjj@} |dk rR| r<|j|||f|q||j|||f|n*| rj|j||f|n|j||f|dS)N)r)rZ ConnectFlagsZAFTERZconnect_object_afterZconnect_objectZ connect_afterconnect) ZbuilderZgobjZ signal_namer&Z connect_objflagsr%r'r(afterrrr_builder_connect_callbackgs r-cs>eZdZeejjZfddZfddZdddZ Z S) Widgetcs:|dk r&t|tj r&tjjt|}tt|j|dS)N)rr TargetListrrsuperr.drag_dest_set_target_list)self target_list) __class__rrr1{sz Widget.drag_dest_set_target_listcs:|dk r&t|tj r&tjjt|}tt|j|dS)N)rr r/rrr0r.drag_source_set_target_list)r2r3)r4rrr5sz"Widget.drag_source_set_target_listNcCsN|dkr6|j|}|dkr*td||ftj|j}tjj||||jS)Nz/Class "%s" does not contain style property "%s") Zfind_style_property ValueErrorrValue value_typer r.style_get_property get_value)r2 property_namevalueproprrrr9s   zWidget.style_get_property)N) rrrrr r.Ztranslate_coordinatesr1r5r9 __classcell__rr)r4rr.ws   r.c@sVeZdZddZddZddZddZeZee j j Z dd d Z d d Z ddZd S) ContainercCs t|jS)N)r" get_children)r2rrr__len__szContainer.__len__cCs ||jkS)N)r@)r2childrrr __contains__szContainer.__contains__cCs t|jS)N)iterr@)r2rrr__iter__szContainer.__iter__cCsdS)NTr)r2rrr__bool__szContainer.__bool__NcCsP|dkr6|j|}|dkr*td||ftj|j}tjj|||||jS)Nz/Class "%s" does not contain child property "%s") Zfind_child_propertyr6rr7r8r r?child_get_propertyr:)r2rBr;r<r=rrrrGs   zContainer.child_get_propertycsfdd|DS)zsz'Container.child_get..r)r2rBZ prop_namesr)rBr2r child_getszContainer.child_getcKs4x.|jD]"\}}|jdd}|j|||q WdS)z=Set a child properties on the given child to key/value pairs._-N)itemsreplaceZchild_set_property)r2rBkwargsrIr<rrr child_sets zContainer.child_set)N)rrrrArCrErF __nonzero__rr r?Zget_focus_chainrGrKrQrrrrr?s  r?cs,eZdZfddZeejjfdZZS)Editablecstt|j|d|S)Nr)r0rS insert_text)r2textposition)r4rrrUszEditable.insert_text)fail_ret) rrrrUrr rSget_selection_boundsr>rr)r4rrSs rS3.0c@seZdZeejjdedZdS)ActionrIlabeltooltipstock_id) arg_namescategoryN)rIr\r]r^)rrrrr r[__init__rrrrrr[sr[c@seZdZeejjdedZdS) RadioActionrIr\r]r^r<)r_r`N)rIr\r]r^r<)rrrrr rbrarrrrrrbsrbc@s<eZdZeejjd edZd ddZd ddZ d dd Z dS) ActionGrouprI)r_r`Nc sTy t|Wntk r(tdYnXdfdd }x|D] }||q@WdS)a The add_actions() method is a convenience method that creates a number of gtk.Action objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The entry tuples can vary in size from one to six items with the following information: * The name of the action. Must be specified. * The stock id for the action. Optional with a default value of None if a label is specified. * The label for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None if a stock id is specified. * The accelerator for the action, in the format understood by the gtk.accelerator_parse() function. Optional with a default value of None. * The tooltip for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None. * The callback function invoked when the action is activated. Optional with a default value of None. The "activate" signals of the actions are connected to the callbacks and their accel paths are set to /group-name/action-name. zentries must be iterableNcsLt||||d}|dk r<dkr.|jd|n|jd|j||dS)N)rIr\r]r^activate)r[r*add_action_with_accel)rIr^r\ acceleratorr]callbackaction)r2 user_datarr_process_actions z0ActionGroup.add_actions.._process_action)NNNNN)rDr#)r2entriesrirjer)r2rir add_actionss  zActionGroup.add_actionscsTy t|Wntk r(tdYnXdfdd }x|D] }||q@WdS)a The add_toggle_actions() method is a convenience method that creates a number of gtk.ToggleAction objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The toggle action entry tuples can vary in size from one to seven items with the following information: * The name of the action. Must be specified. * The stock id for the action. Optional with a default value of None if a label is specified. * The label for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None if a stock id is specified. * The accelerator for the action, in the format understood by the gtk.accelerator_parse() function. Optional with a default value of None. * The tooltip for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None. * The callback function invoked when the action is activated. Optional with a default value of None. * A flag indicating whether the toggle action is active. Optional with a default value of False. The "activate" signals of the actions are connected to the callbacks and their accel paths are set to /group-name/action-name. zentries must be iterableNFcsXtj||||d}|j||dk rHdkr:|jd|n|jd|j||dS)N)rIr\r]r^rd)r Z ToggleAction set_activer*re)rIr^r\rfr]rgZ is_activerh)r2rirrrj3s z7ActionGroup.add_toggle_actions.._process_action)NNNNNF)rDr#)r2rkrirjrlr)r2riradd_toggle_actionss  zActionGroup.add_toggle_actionsc sy t|Wntk r(tdYnXd}dfdd }x&|D]}||f|}|dkrD|}qDW|dk r|dk r|dkr|jd|n|jd||dS)a The add_radio_actions() method is a convenience method that creates a number of gtk.RadioAction objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The entry tuples can vary in size from one to six items with the following information: * The name of the action. Must be specified. * The stock id for the action. Optional with a default value of None if a label is specified. * The label for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None if a stock id is specified. * The accelerator for the action, in the format understood by the gtk.accelerator_parse() function. Optional with a default value of None. * The tooltip for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None. * The value to set on the radio action. Optional with a default value of 0. Should be specified in applications. The value parameter specifies the radio action that should be set active. The "changed" signal of the first radio action is connected to the on_change callback (if specified and not None) and the accel paths of the actions are set to /group-name/action-name. zentries must be iterableNrcsHt|||||d}t|dr&|j||kr8|jdj|||S)N)rIr\r]r^r< join_groupT)rbhasattrrprnre)Z group_sourcerIr^r\rfr]Z entry_valuerh)r2r<rrrjes    z6ActionGroup.add_radio_actions.._process_actionZchanged)NNNNr)rDr#r*) r2rkr<Z on_changeriZ first_actionrjrlrhr)r2r<radd_radio_actionsBs  zActionGroup.add_radio_actions)rI)N)N)NNN) rrrrr rcrarrmrorrrrrrrcs  - 1rcc@seZdZddZdddZdS) UIManagercCs0t|tstdt|jd}tjj|||S)Nzbuffer must be a stringzUTF-8)r _basestringr#r"encoder rsadd_ui_from_string)r2bufferlengthrrrrvs zUIManager.add_ui_from_stringrcCstjj|||S)N)r rsinsert_action_group)r2rwrxrrrryszUIManager.insert_action_groupNrT)rT)rrrrvryrrrrrssrsc@seZdZeejjZdS)ComboBoxN)rrrrr rzZget_active_iterrrrrrzsrzc@seZdZeejjdedZdS)Box homogeneousspacing)r_r`N)r|r})rrrrr r{rarrrrrr{sr{c@s(eZdZeejjddejjie dZdS) SizeGroupmode)r_Zdeprecated_defaultsr`N)r) rrrrr r~raZ SizeGroupModeZVERTICALrrrrrr~s r~c@seZdZeejjdedZdS)MenuItemr\)r_r`N)r\)rrrrr rrarrrrrrsrc@s$eZdZddZddZddZdS)BuildercCs|jt|dS)aConnect signals specified by this builder to a name, handler mapping. Connect signal, name, and handler sets specified in the builder with the given mapping "obj_or_map". The handler/value aspect of the mapping can also contain a tuple in the form of (handler [,arg1 [,argN]]) allowing for extra arguments to be passed to the handler. For example: .. code-block:: python builder.connect_signals({'on_clicked': (on_clicked, arg1, arg2)}) N)Zconnect_signals_fullr-)r2r%rrrconnect_signalss zBuilder.connect_signalscCs*t|tstdt|}tjj|||S)Nzbuffer must be a string)rrtr#r"r radd_from_string)r2rwrxrrrrs zBuilder.add_from_stringcCs,t|tstdt|}tjj||||S)Nzbuffer must be a string)rrtr#r"r radd_objects_from_string)r2rwZ object_idsrxrrrrs zBuilder.add_objects_from_stringN)rrrrrrrrrrrsrc@seZdZeejjdedZdS)Windowtype)r_r`N)r)rrrrr rrarrrrrrsrc@s\eZdZdZeejjddddded Z d d Zd d Z e ddZ e ddZ ddZdS)Dialogtitleparentr+buttons_buttons_property transient_for add_buttons)rr)r_ignoredeprecated_aliasesr`cOs|j}tt|j|}|j|d}|jtkrF|jjtjkrF|d7}|jdd}|dk rt |t j  rt j dt|dd|kr|d=nd}|jdd}|rt j dt|d|t jj@rd |d <|t jj@rd |d <|j|||r|j|dS) NrrrzThe "buttons" argument must be a Gtk.ButtonsType enum value. Please use the "add_buttons" method for adding buttons. See: https://wiki.gnome.org/PyGObject/InitializerDeprecations) stacklevelr+rzThe "flags" argument for dialog construction is deprecated. Please use initializer keywords: modal=True and/or destroy_with_parent=True. See: https://wiki.gnome.org/PyGObject/InitializerDeprecationsTZmodalZdestroy_with_parent)copydictzip_old_arg_namesupdater4rrarrr Z ButtonsTypewarningswarnrZ DialogFlagsZMODALZDESTROY_WITH_PARENT_initr)r2r(rP new_kwargsZ old_kwargsrrr+rrrras0        zDialog.__init__cOs<t|j(ttjj|f||SQRXWdQRXdS)N)rZdestroyrr rrun)r2r(rPrrrr#s z Dialog.runcCs|jS)N)Zget_action_area)dialogrrr(szDialog.cCs|jS)N)Zget_content_area)rrrrr)sc GsPdd}y&x ||D]\}}|j||qWWntk rJtdYnXdS)a The add_buttons() method adds several buttons to the Gtk.Dialog using the button data passed as arguments to the method. This method is the same as calling the Gtk.Dialog.add_button() repeatedly. The button data pairs - button text (or stock ID) and a response ID integer are passed individually. For example: .. code-block:: python dialog.add_buttons(Gtk.STOCK_OPEN, 42, "Close", Gtk.ResponseType.CLOSE) will add "Open" and "Close" buttons to dialog. css4x.|r.|dd\}}|dd}||fVqWdS)Nrrr)btrrrr_button9s z#Dialog.add_buttons.._buttonz%Must pass an even number of argumentsN)Z add_button IndexErrorr#)r2r(rrVZresponserrrr+s zDialog.add_buttonsN)rrr+rr)rrr+rr)r+r)rrrrrr rrarrrpropertyZ action_areaZvboxrrrrrrs+  rc@s6eZdZeejjddddedZd d Zd d Z d S) MessageDialogrr+ message_typermessage_formatr)rVr)r_rr`cCs|jdd|jd|dS)Nzsecondary-use-markupFzsecondary-text) set_property)r2rrrrformat_secondary_textRs z#MessageDialog.format_secondary_textcCs|jdd|jd|dS)Nzsecondary-use-markupTzsecondary-text)r)r2rrrrformat_secondary_markupVs z%MessageDialog.format_secondary_markupN)rr+rrr) rrrrr rrarrrrrrrrJsrc@seZdZeejjdedZdS)ColorSelectionDialogr)r_r`N)r)rrrrr rrarrrrrr`src@seZdZeejjdedZdS)FileChooserDialogrrrhr)r_r`N)rrrhr)rrrrr rrarrrrrrisrc@seZdZeejjdedZdS)FontSelectionDialogr)r_r`N)r)rrrrr rrarrrrrrtsrc@s$eZdZeejjdddiedZdS) RecentChooserDialogrrrecent_managerrZmanager)r_rr`N)rrrr)rrrrr rrarrrrrr}src@sBeZdZeejjdedZeejj Z eejj Z eejj Z dS)IconViewmodel)r_r`N)r) rrrrr rrarrZget_item_at_posget_visible_rangeZget_dest_item_at_posrrrrrs   rc@seZdZeejjdedZdS) ToolButtonr^)r_r`N)r^)rrrrr rrarrrrrrsrc@seZdZeejjZdS) IMContextN)rrrrr rZget_surroundingrrrrrsrc@seZdZeejjZdS) RecentInfoN)rrrrr rZget_application_inforrrrrsrc@sfeZdZddZdddZdddZdd d Zdd d ZddZddZ dddZ e e j jfdZdS) TextBuffercCs&|j}|dkr"tj}|j||S)N) get_tag_tabler Z TextTagTableZ set_tag_table)r2tablerrr_get_or_create_tag_tables  z#TextBuffer._get_or_create_tag_tableNcKs&tjfd|i|}|jj||S)aCreates a tag and adds it to the tag table of the TextBuffer. :param str tag_name: Name of the new tag, or None :param **properties: Keyword list of properties and their values This is equivalent to creating a Gtk.TextTag and then adding the tag to the buffer's tag table. The returned tag is owned by the buffer's tag table. If ``tag_name`` is None, the tag is anonymous. If ``tag_name`` is not None, a tag called ``tag_name`` must not already exist in the tag table for this buffer. Properties are passed as a keyword list of names and values (e.g. foreground='DodgerBlue', weight=Pango.Weight.BOLD) :returns: A new tag. rI)r ZTextTagradd)r2Ztag_nameZ propertiestagrrr create_tagszTextBuffer.create_tagFcCstjj||||S)N)r r create_mark)r2Z mark_namewhereZ left_gravityrrrrszTextBuffer.create_markrcCstjj|||dS)N)r rset_text)r2rVrxrrrrszTextBuffer.set_textcCs0t|tstdt|tjj||||dS)Nztext must be a string, not %s)rrtr#rr rinsert)r2rDrVrxrrrrs zTextBuffer.insertcGsF|j}|j|||sdS|j|}x|D]}|j|||q,WdS)N)Z get_offsetrZget_iter_at_offsetZ apply_tag)r2rDrVtagsZ start_offsetstartrrrrinsert_with_tagss   zTextBuffer.insert_with_tagscGsPg}x4|D],}|jj|}|s,td||j|q W|j||f|dS)Nzunknown text tag: %s)rlookupr6rr)r2rDrVrZtag_objsrZtag_objrrrinsert_with_tags_by_names  z#TextBuffer.insert_with_tags_by_namecCs.t|tstdt|tjj|||dS)Nztext must be a string, not %s)rrtr#rr rinsert_at_cursor)r2rVrxrrrrs zTextBuffer.insert_at_cursor)rX)N)FrT)rTrT)rTrT)rT)rrrrrrrrrrrrr rrYrrrrrs      rc@s$eZdZeejjZeejjZdS)TextIterN)rrrrr rZforward_searchZbackward_searchrrrrrs rcseZdZddZddZeZddZddZd d Zd d Z d dZ ddZ e e jjZe e jjZe e jjZe e jjZe e jjedZfddZfddZfddZddZddZddZddZfd d!Zfd"d#Zfd$d%Zfd&d'Zfd(d)Z Z!S)* TreeModelcCs |jdS)N)Ziter_n_children)r2rrrrAszTreeModel.__len__cCsdS)NTr)r2rrrrFszTreeModel.__bool__c Cst|tjr|St|trv|dkrvt||}|dkrBtd|y|j|}Wn tk rptd|YnX|Sy|j|}Wn tk rtd|YnX|SdS)Nrzrow index is out of bounds: %dzcould not find tree path '%s')rr TreeIterintr"rget_iterr6)r2keyindexaiterrrr_getiters    zTreeModel._getitercCst|tjr|St|SdS)N)rr TreePath)r2pathrrr _coerce_path-s zTreeModel._coerce_pathcCs|j|}t||S)N)r TreeModelRow)r2rrrrr __getitem__3s zTreeModel.__getitem__cCs||}|j|j|dS)N)set_rowrD)r2rr<rowrrr __setitem__7szTreeModel.__setitem__cCs|j|}|j|dS)N)rremove)r2rrrrr __delitem__;s zTreeModel.__delitem__cCst||jS)N)TreeModelRowIterget_iter_first)r2rrrrE?szTreeModel.__iter__zinvalid tree pathcs2|j|}tt|j|\}}|s.td||S)Nzinvalid tree path '%s')rr0rrr6)r2rsuccessr)r4rrrIs   zTreeModel.get_itercs$|j}tt|j|}|r |SdS)N)rr0r iter_next)r2r next_iterr)r4rrrPszTreeModel.iter_nextcs$|j}tt|j|}|r |SdS)N)rr0r iter_previous)r2r prev_iterr)r4rrrVszTreeModel.iter_previouscCszt|trtd|j}t||kr.tdg}g}x:t|D].\}}|dkrRq@|j|j|||j|q@W||fS)Nz%Expected a list or tuple, but got strz1row sequence has the incorrect number of elements) rstrr# get_n_columnsr"r6 enumerater_convert_value)r2r n_columnsresultcolumnsZcur_colr<rrr _convert_row\s  zTreeModel._convert_rowcCs@|j|\}}x,|D]$}||}|dkr*q|j|||qWdS)N)r set_value)r2treeiterrZ converted_rowrcolumnr<rrrrps  zTreeModel.set_rowcCs"t|tjr|Stj|j||S)z5Convert value to a GObject.Value of the expected type)rrr7Zget_column_type)r2rr<rrrrys zTreeModel._convert_valuecGs^|j}g}xH|D]@}t|ts(td|dks8||kr@td|j|j||qWt|S)Nzcolumn numbers must be intsrzcolumn number is out of range)rrrr#r6rr:tuple)r2rrrvaluescolrrrrs  z TreeModel.getcstt|j|j||S)N)r0r row_changedr)r2rrD)r4rrrszTreeModel.row_changedcstt|j|j||S)N)r0r row_insertedr)r2rrD)r4rrrszTreeModel.row_insertedcstt|j|j||S)N)r0rrow_has_child_toggledr)r2rrD)r4rrrszTreeModel.row_has_child_toggledcstt|j|j|S)N)r0r row_deletedr)r2r)r4rrrszTreeModel.row_deletedcstt|j|j|||S)N)r0rrows_reorderedr)r2rrDZ new_order)r4rrrszTreeModel.rows_reordered)"rrrrArFrRrrrrrrErr rr iter_childrenZiter_nth_child iter_parentZget_iter_from_stringr6rrrrrrrrrrrrr>rr)r4rrs6            rcs<eZdZeejjddZdfdd Zd fdd ZZ S) TreeSortableN)rXcstt|j|||dS)N)r0r set_sort_func)r2Zsort_column_id sort_funcri)r4rrrszTreeSortable.set_sort_funccstt|j||dS)N)r0rset_default_sort_func)r2rri)r4rrrsz"TreeSortable.set_default_sort_func)NN)N)N) rrrrr rZget_sort_column_idrrr>rr)r4rrsrc@seZdZeejjdedZdS) TreeModelSortr)r_r`N)r)rrrrr rrarrrrrrsrc@s^eZdZddZddZdddZddd Zdd d Zdd d ZdddZ ddZ ddZ dS) ListStorecGstjj||j|dS)N)r rraset_column_types)r2 column_typesrrrras zListStore.__init__cCs8|dk r&|j|\}}|j|||}ntjj||}|S)N)rZinsert_with_valuesvr rr)r2rWrrrrrr _do_inserts zListStore._do_insertNcCs |r|jd|Stjj|SdS)NrrT)rr rr)r2rrrrrs zListStore.appendcCs |jd|S)Nr)r)r2rrrrprependszListStore.prependcCs |j||S)N)r)r2rWrrrrrszListStore.insertcCs&tjj||}|dk r"|j|||S)N)r r insert_beforer)r2siblingrrrrrrs zListStore.insert_beforecCs&tjj||}|dk r"|j|||S)N)r r insert_afterr)r2rrrrrrrs zListStore.insert_aftercCs"|j||}tjj||||dS)N)rr rr)r2rrr<rrrrs zListStore.set_valuecsfdd}|rt|dtr@||ddd|dddnlt|dttfrzt|dkrftd||d|dn2t|dtr|t|d|djntddS)Ncs|t|t|krtdg}g}xDt||D]6\}}t|tsFtd|j||jj||q,Wtjj ||dS)Nz7The number of columns do not match the number of valuesz0TypeError: Expected integer argument for column.) r"r#rrrrrr rset)colsvalsrrcol_numr<)r2rrr _set_listss  z!ListStore.set.._set_listsrrrzToo many argumentszArgument list must be in the form of (column, value, ...), ((columns,...), (values, ...)) or {column: value}. No -1 termination is needed.)rrrlistr"r#rr)r2rr(rr)r2rrrs  z ListStore.set)N)N)N)N)N) rrrrarrrrrrrrrrrrrs    rc@s|eZdZddZeddZeddZeddZed d Zd d Z d dZ ddZ ddZ ddZ ddZddZdS)rcCsht|tjstdt|j||_t|tjr>|j||_ n&t|tj rR||_ ntdt|jdS)Nz expected Gtk.TreeModel, %s foundz?expected Gtk.TreeIter or Gtk.TreePath, %s found) rr rr#rrrrrrDr)r2rZ iter_or_pathrrrras   zTreeModelRow.__init__cCs|jj|jS)N)rget_pathrD)r2rrrr&szTreeModelRow.pathcCs|jS)N)get_next)r2rrrnext*szTreeModelRow.nextcCs|jS)N) get_previous)r2rrrprevious.szTreeModelRow.previouscCs|jS)N) get_parent)r2rrrr2szTreeModelRow.parentcCs"|jj|j}|rt|j|SdS)N)rrrDr)r2rrrrr6szTreeModelRow.get_nextcCs"|jj|j}|rt|j|SdS)N)rrrDr)r2rrrrr ;szTreeModelRow.get_previouscCs"|jj|j}|rt|j|SdS)N)rrrDr)r2Z parent_iterrrrr @szTreeModelRow.get_parentcst|trH|jjkr&td|n|dkr8j|}jjj|St|tr|j jj\}}}g}x*t |||D]}|j jjj|qzW|St|t rfdd|DSt dt|jdS)Nz!column index is out of bounds: %drcsg|] }|qSrr)rHk)r2rrrJSsz,TreeModelRow.__getitem__..z0indices must be integers, slice or tuple, not %s)rrrrr_convert_negative_indexr:rDsliceindicesrangerrr#rr)r2rrstopstepZalistir)r2rrEs     zTreeModelRow.__getitem__c Cs>t|trL||jjkr&td|n|dkr8|j|}|jj|j||nt|tr|j |jj\}}}t |||}t |t |krt dt |t |fxt |D]\}}|jj|j|||qWnlt|tr(t |t |krt dt |t |fx4t||D]\} }||| <qWntdt|jdS)Nz!column index is out of bounds: %drz9attempt to assign sequence of size %d to slice of size %dzsz#TreePath.__new__..rz-could not parse subscript '%s' as a tree path) rrrrtjoinr"r#rZnew_from_string)clsrrrr__new__s      zTreePath.__new__cstt|jdS)N)r0rra)r2r(rP)r4rrraszTreePath.__init__cCs |jp dS)N)Z to_string)r2rrr__str__szTreePath.__str__cCs|dk o|j|dkS)Nr)compare)r2otherrrr__lt__szTreePath.__lt__cCs|dk o|j|dkS)Nr)r!)r2r"rrr__le__szTreePath.__le__cCs|dk o|j|dkS)Nr)r!)r2r"rrr__eq__szTreePath.__eq__cCs|dkp|j|dkS)Nr)r!)r2r"rrr__ne__szTreePath.__ne__cCs|dkp|j|dkS)Nr)r!)r2r"rrr__gt__szTreePath.__gt__cCs|dkp|j|dkS)Nr)r!)r2r"rrr__ge__szTreePath.__ge__cCs t|jS)N)rD get_indices)r2rrrrEszTreePath.__iter__cCs|jS)N)Z get_depth)r2rrrrAszTreePath.__len__cCs |j|S)N)r))r2rrrrrszTreePath.__getitem__)r)rrrrrar r#r$r%r&r'r(rErArr>rr)r4rrs rc@s^eZdZddZddZdddZddd Zdd d Zdd d ZdddZ ddZ ddZ dS) TreeStorecGstjj||j|dS)N)r r*rar)r2rrrrras zTreeStore.__init__cCs<|dk r(|j|\}}|j||||}ntjj|||}|S)N)rZinsert_with_valuesr r*r)r2rrWrrrrrrrs zTreeStore._do_insertNcCs|j|d|S)NrrT)r)r2rrrrrrszTreeStore.appendcCs|j|d|S)Nr)r)r2rrrrrrszTreeStore.prependcCs|j|||S)N)r)r2rrWrrrrrszTreeStore.insertcCs(tjj|||}|dk r$|j|||S)N)r r*rr)r2rrrrrrrrs zTreeStore.insert_beforecCs(tjj|||}|dk r$|j|||S)N)r r*rr)r2rrrrrrrrs zTreeStore.insert_aftercCs"|j||}tjj||||dS)N)rr r*r)r2rrr<rrrrs zTreeStore.set_valuecsfdd}|rt|dtr@||ddd|dddnlt|dttfrzt|dkrftd||d|dn2t|dtr||dj|djntddS)Ncs|t|t|krtdg}g}xDt||D]6\}}t|tsFtd|j||jj||q,Wtjj ||dS)Nz7The number of columns do not match the number of valuesz0TypeError: Expected integer argument for column.) r"r#rrrrrr r*r)rrrrrr<)r2rrrrs  z!TreeStore.set.._set_listsrrrzToo many argumentszArgument list must be in the form of (column, value, ...), ((columns,...), (values, ...)) or {column: value}. No -1 termination is needed.) rrrrr"r#rkeysr)r2rr(rr)r2rrrs  z TreeStore.set)N)N)N)N)N) rrrrarrrrrrrrrrrrr*s    r*cseZdZeejjdedZeejj Z eejj Z eejj Z fddZ fddZ dfd d Zdfd d Zdfdd ZddZZS)TreeViewr)r_r`cs t|}tt|j|||dS)N)rr0r,enable_model_drag_source)r2Zstart_button_maskractionsr)r4rrr-)s z!TreeView.enable_model_drag_sourcecst|}tt|j||dS)N)rr0r,enable_model_drag_dest)r2rr.r)r4rrr//s zTreeView.enable_model_drag_destNFcs0t|tjst|}tt|j|||||dS)N)rr rr0r,scroll_to_cell)r2rrZ use_alignZ row_alignZ col_align)r4rrr14s zTreeView.scroll_to_cellcs,t|tjst|}tt|j|||dS)N)rr rr0r, set_cursor)r2rrZ start_editing)r4rrr29s zTreeView.set_cursorcs&t|tjst|}tt|j||S)N)rr rr0r, get_cell_area)r2rr)r4rrr3>s zTreeView.get_cell_areacKs:t}|j||j|d|j|||j|f|dS)NF)TreeViewColumnZ set_title pack_startZ insert_columnset_attributes)r2rWrZcellrPrrrrinsert_column_with_attributesCs    z&TreeView.insert_column_with_attributes)r)NFr0r0)NF)N)rrrrr r,rarrZget_path_at_posrZget_dest_row_at_posr-r/r1r2r3r7r>rr)r4rr, s     r,cs<eZdZd ddZeejjZd fdd ZddZ Z S) r4rNcKsHtjj||d|r |j|dx"|jD]\}}|j|||q*WdS)N)rT)r r4rar5rN add_attribute)r2r cell_renderer attributesrIr<rrrraPs  zTreeViewColumn.__init__cstt|j|||dS)N)r0r4set_cell_data_func)r2r9funcZ func_data)r4rrr;\sz!TreeViewColumn.set_cell_data_funccKs:tjj||x&|jD]\}}tjj||||qWdS)N)r Z CellLayoutZclear_attributesrNr8)r2r9r:rIr<rrrr6_szTreeViewColumn.set_attributes)rN)N) rrrrarr r4Zcell_get_positionr;r6r>rr)r4rr4Os  r4cs4eZdZfddZfddZfddZZS) TreeSelectioncs(t|tjst|}tt|j|dS)N)rr rr0r= select_path)r2r)r4rrr>ls zTreeSelection.select_pathcs,tt|j\}}}|r ||fS|dfSdS)N)r0r= get_selected)r2rrr)r4rrr?qszTreeSelection.get_selectedcstt|j\}}||fS)N)r0r=get_selected_rows)r2rowsr)r4rrr@zszTreeSelection.get_selected_rows)rrrr>r?r@r>rr)r4rr=js  r=c@s*eZdZeejjd d eddZddZd S) Buttonr\stock use_stock use_underliner )r_rr`rcOsld|kr\|dr\tjdtdd|j}|d|d<d|d<d|d<|d=tjj|f|n |j||dS) NrCzKStock items are deprecated. Please use: Gtk.Button.new_with_mnemonic(label)r)rr\TrDrE)rrrrr rBrar)r2r(rPrrrrras  zButton.__init__N)r\rCrDrE)rC) rrrrr rBrarrrrrrrBs rBc@seZdZeejjdedZdS) LinkButtonurir\)r_r`N)rGr\)rrrrr rFrarrrrrrFsrFc@seZdZeejjdedZdS)Labelr\)r_r`N)r\)rrrrr rHrarrrrrrHsrHc@s0eZdZeejjdddd ed d Zd d ZdS) Adjustmentr<lowerupperstep_incrementpage_increment page_sizeZ page_incrZ step_incr)rMrLr )r_rr`rcOsB|j||d|kr$|j|dnt|dkr>|j|ddS)Nr<rr)rrr")r2r(rPrrrras   zAdjustment.__init__N)r<rJrKrLrMrN) rrrrr rIrarrrrrrrIsrIc@sPeZdZeejjd dddedZejj ejj Bejj ejj Bddfd d Z d S) Tablen_rowsrr|rAr)rPr)r_rr`rc Cs"tjj|||||||||| dS)N)r rOattach) r2rBZ left_attachZ right_attachZ top_attachZ bottom_attachZxoptionsZyoptionsZxpaddingZypaddingrrrrQsz Table.attachN)rPrr|) rrrrr rOrarZ AttachOptionsZEXPANDZFILLrQrrrrrOs rOc@seZdZeejjdedZdS)ScrolledWindow hadjustment vadjustment)r_r`N)rSrT)rrrrr rRrarrrrrrRsrRc@seZdZeejjdedZdS) HScrollbar adjustment)r_r`N)rV)rrrrr rUrarrrrrrUsrUc@seZdZeejjdedZdS) VScrollbarrV)r_r`N)rV)rrrrr rWrarrrrrrWsrWcs,eZdZdfdd Zdfdd ZZS) PanedFTcstt|j|||dS)N)r0rXpack1)r2rBresizeshrink)r4rrrYsz Paned.pack1cstt|j|||dS)N)r0rXpack2)r2rBrZr[)r4rrr\sz Paned.pack2)FT)TT)rrrrYr\r>rr)r4rrXsrXc@seZdZeejjdedZdS)Arrow arrow_type shadow_type)r_r`N)r^r_)rrrrr r]rarrrrrr]sr]cs&eZdZdddZfddZZS)IconSetNcCs6|dk r&tjdtddtjj|}n tjj|}|S)NzXGtk.IconSet(pixbuf) has been deprecated. Please use: Gtk.IconSet.new_from_pixbuf(pixbuf)r)r)rrrr r`Znew_from_pixbufr)rZpixbufZiconsetrrrrs   zIconSet.__new__cstt|jS)N)r0r`ra)r2r(rP)r4rrraszIconSet.__init__)N)rrrrrar>rr)r4rr` s r`c@seZdZeejjdedZdS)ViewportrSrT)r_r`N)rSrT)rrrrr rararrrrrrasracs&eZdZdfdd ZddZZS)TreeModelFilterNcstt|j||dS)N)r0rbset_visible_func)r2r<data)r4rrrc*sz TreeModelFilter.set_visible_funccCs |j|}|jj|||dS)N)Zconvert_iter_to_child_iterZ get_modelr)r2rDrr<rrrr-s zTreeModelFilter.set_value)N)rrrrcrr>rr)r4rrb)srbc@seZdZddZdS)MenucCs|jd||||||dS)N)Zpopup_for_device)r2Zparent_menu_shellZparent_menu_itemr<rdZbuttonZ activate_timerrrpopup8sz Menu.popupN)rrrrfrrrrre7srecGs tdS)N)_Gtk_main_quit)r(rrr main_quit@srhcOs2ttjt t||SQRXWdQRXdS)N)rr rhr _Gtk_main)r(rPrrrmainHs rj stock_lookupz4.0)r r)r rZ)r rZ)r rZ)r rZ)r rZ)r rZ)r rZ)[rsysrZ gi.repositoryrZ _ossighelperrrZ overridesrrrmoduler Zgir version_inforrtZ basestringr __all__Z_versionZwarn_msgrRuntimeWarningrrrr)r-r.r?rSr[rbrcrsrzr{r~rrrrrrrrrrrrrrrrrrrobjectrrrr*r,r4r=rBrFrHrIrOrRrUrWrXr]r`rarbrerhrgrjrirkZ init_checkargvZ initializedrrrrrs|          )     $          X              Q      S g  1 N +                            PK!E ++ __pycache__/Pango.cpython-36.pycnu[3 <_@spddlmZddlmZedZgZGdddejZeeZejdGdddejZeeZejddS) )override)get_introspection_modulePangocs&eZdZdddZfddZZS)FontDescriptionNcCs"|dk rtj|Stjj|SdS)N)rZfont_description_from_stringr__new__)clsstringr /usr/lib64/python3.6/Pango.pyrs zFontDescription.__new__cstt|jS)N)superr__init__)selfargskwargs) __class__r r r %szFontDescription.__init__)N)__name__ __module__ __qualname__rr __classcell__r r )rr rs rcs&eZdZddZdfdd ZZS)LayoutcCs tjj|S)N)rrnew)rcontextr r r r/szLayout.__new__cstt|j||dS)N)r r set_markup)r textZlength)rr r r2szLayout.set_markup)r)rrrrrrr r )rr r-srN) Z overridesrmodulerr__all__rappendrr r r r s     PK!((#__pycache__/__init__.cpython-36.pycnu[3 <_1@sddlZddlZddlZddlZddlmZddlmZddlm Z ddl m Z m Z ddlm Z e eeZiZddZGd d d ejZGd d d eZd dZddZeZddZddZeiiedfddZdddZdS)N) get_loader)PyGIDeprecationWarning) CallableInfo) TYPE_NONE TYPE_INVALID) extend_pathcsfdd}|S)Ncsj|_j|_|S)N)__name__ __module__)wrapper)wrapped /usr/lib64/python3.6/__init__.pyassignszwraps..assignr )r rr )r r wrapss rcs8eZdZdZfddZddZddZdd ZZS) OverridesProxyModulez7Wraps a introspection module and contains all overridescstt|j|j||_dS)N)superr__init__r_introspection_module)selfintrospection_module) __class__r r r!s zOverridesProxyModule.__init__cCs t|j|S)N)getattrr)rnamer r r __getattr__&sz OverridesProxyModule.__getattr__cCs6tt|j}|j|jj|jt|jt|S)N)setdirrupdate__dict__keysrsorted)rresultr r r __dir__)szOverridesProxyModule.__dir__cCsdt|j|jfS)Nz<%s %r>)typerr)rr r r __repr__/szOverridesProxyModule.__repr__) rr __qualname____doc__rrr!r# __classcell__r r )rr rs  rc@s0eZdZdZddZddZddZdd Zd S) _DeprecatedAttributezA deprecation descriptor for OverridesProxyModule subclasses. Emits a PyGIDeprecationWarning on every access and tries to act as a normal instance attribute (can be replaced and deleted). cCs$||_||_td|||f|_dS)Nz#%s.%s is deprecated; use %s instead)_attr_valuer_warning)r namespaceattrvalue replacementr r r r:s z_DeprecatedAttribute.__init__cCs(|dkrt|jtj|jdd|jS)N) stacklevel)AttributeErrorr(warningswarnr*r))rinstanceownerr r r __get__As z_DeprecatedAttribute.__get__cCs$|j}tt||t|||dS)N)r(delattrr"setattr)rr4r-r,r r r __set__Gsz_DeprecatedAttribute.__set__cCstt||jdS)N)r7r"r()rr4r r r __delete__Msz_DeprecatedAttribute.__delete__N)rr r$r%rr6r9r:r r r r r'3s r'cCs|jjddd }d|}|tjk}tjj|}t|dtfi}||}|tj|<ddlm}t|dsnt |||<zHd|}y t |} Wnt k rd } YnX| d kr|St j |} Wd ||=tj|=|r|tj|<X||_g} t| d r| j} xH| D]@} yt| | } Wnt tfk r.wYnXt|| | qWxptj|gD]`\}}yt||}Wn"t k rt d |YnXt||t||||}t|||qPW|S) zLoads overrides for an introspection module. Either returns the same module again in case there are no overrides or a proxy module including overrides. Doesn't cache the result. .zgi.repository.Z ProxyModuler/)modulesrz gi.overrides.N__all__z1%s was set deprecated but wasn't added to __all__)rrsplitsysr=getr"rZimporterhasattrAssertionErrorrr1 importlib import_moduleZ_overrides_moduler>r TypeErrorr8_deprecated_attrspopr7r')rr+Z module_keyZhas_oldZ old_moduleZ proxy_typeproxyr=Zoverride_package_nameZoverride_loaderZ override_modZ override_allvaritemr,r.r-deprecated_attrr r r load_overridesRsX            rNc st|tr>|}|jjddd }tjd|fdd}|St|tjrXtd|nyt |d}Wn"t k rtd|j YnX|jj d st d ||jf|j}|tkst|tkr||_|jjddd }tjd|t|j ||Sd S)aDecorator for registering an override. Other than objects added to __all__, these can get referenced in the same override module via the gi.repository module (get_parent_for_object() does for example), so they have to be added to the module immediately. r;r<zgi.repository.cst|j||S)N)r8r)func)moduler r r szoverride..wrapperz"func must be a gi function, got %sZ__info__zKCan not override a type %s, which is not in a gobject introspection typelibz gi.overrideszUYou have tried override outside of the overrides module. This is not allowed (%s, %s)Nr?r?) isinstancerr r@rAr=types FunctionTyperGrr1r startswithKeyErrorZ get_g_typerrDrZpytyper8)Ztype_rOr+r infoZg_typer )rPr overrides4     rWcstfdd}|S)z7Decorator for marking methods and classes as deprecatedcs$tjdjftdd||S)Nz %s is deprecated; use %s insteadr/)r0)r2r3rr)argskwargs)fnr.r r r s zdeprecated..wrapped)r)rZr.r r )rZr.r deprecatedsr[cCstj|gj||fdS)a:Marks a module level attribute as deprecated. Accessing it will emit a PyGIDeprecationWarning warning. e.g. for ``deprecated_attr("GObject", "STATUS_FOO", "GLib.Status.FOO")`` accessing GObject.STATUS_FOO will emit: "GObject.STATUS_FOO is deprecated; use GLib.Status.FOO instead" :param str namespace: The namespace of the override this is called in. :param str namespace: The attribute name (which gets added to __all__). :param str replacement: The replacement text which will be included in the warning. N)rH setdefaultappend)r+r,r.r r r rMsrMr/csfdd}|S)aWrapper for deprecating GObject based __init__ methods which specify defaults already available or non-standard defaults. :param callable super_init_func: Initializer to wrap. :param list arg_names: Ordered argument name list. :param list ignore: List of argument names to ignore when calling the wrapped function. This is useful for function which take a non-standard keyword that is munged elsewhere. :param dict deprecated_aliases: Dictionary mapping a keyword alias to the actual g_object_newv keyword. :param dict deprecated_defaults: Dictionary of non-standard defaults that will be used when the keyword is not explicitly passed. :param Exception category: Exception category of the error. :param int stacklevel: Stack level for the deprecation passed on to warnings.warn :returns: Wrapped version of ``super_init_func`` which gives a deprecation warning when non-keyword args or aliases are used. :rtype: callable c sZ|r:tjddjdt|dtt|}ni}|j|g}x4jD](\}}||krV|j|||<|j |qVW|rtjddjfddt |Ddjt |fdg}x2jD]&\}}||krΈ|||<|j |qW|r*tjddjfd dt |Ddx"D]}||kr0|j|q0W|f|S) zInitializer for a GObject based classes with support for property sets through the use of explicit keyword arguments. zUsing positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "%s" or use a class specific constructor. See: https://wiki.gnome.org/PyGObject/InitializerDeprecationsz, N)r0zThe keyword(s) "%s" have been deprecated in favor of "%s" respectively. See: https://wiki.gnome.org/PyGObject/InitializerDeprecationsc3s|]}|VqdS)Nr ).0k)deprecated_aliasesr r /sz4deprecated_init..new_init..zInitializer is relying on deprecated non-standard defaults. Please update to explicitly use: %s See: https://wiki.gnome.org/PyGObject/InitializerDeprecationsc3s|]}d||fVqdS)z%s=%sNr )r^r_)deprecated_defaultsr r ra>s) r2r3joinlendictzipritemsrIr]r) rrXrYZ new_kwargsZ aliases_usedkeyaliasZ defaults_usedr-) arg_namescategoryr`rbignorer0super_init_funcr r new_inits<       z!deprecated_init..new_initr )rmrjrlr`rbrkr0rnr )rjrkr`rbrlr0rmr deprecated_inits3rocstfdd}|S)aTranslate method's return value for stripping off success flag. There are a lot of methods which return a "success" boolean and have several out arguments. Translate such a method to return the out arguments on success and None on failure. csL||}|dr4t|dkr&|dS|ddSnrDp@dSdS)Nrr/r<z call failed)rd)rXrYret)exc_strexc_typefail_retmethodr r r Rs   z%strip_boolean_result..wrapped)r)rtrrrqrsr r )rqrrrsrtr strip_boolean_resultKs ru)NNN)rRr2rErAZpkgutilrZgirZgi._girZ gi._constantsrrr__path__rrHr ModuleTyperobjectr'rNrWZ overridefuncr[rMtuplerorur r r r s.     V-  QPK!^m(m()__pycache__/__init__.cpython-36.opt-1.pycnu[3 <_1@sddlZddlZddlZddlZddlmZddlmZddlm Z ddl m Z m Z ddlm Z e eeZiZddZGd d d ejZGd d d eZd dZddZeZddZddZeiiedfddZdddZdS)N) get_loader)PyGIDeprecationWarning) CallableInfo) TYPE_NONE TYPE_INVALID) extend_pathcsfdd}|S)Ncsj|_j|_|S)N)__name__ __module__)wrapper)wrapped /usr/lib64/python3.6/__init__.pyassignszwraps..assignr )r rr )r r wrapss rcs8eZdZdZfddZddZddZdd ZZS) OverridesProxyModulez7Wraps a introspection module and contains all overridescstt|j|j||_dS)N)superr__init__r_introspection_module)selfintrospection_module) __class__r r r!s zOverridesProxyModule.__init__cCs t|j|S)N)getattrr)rnamer r r __getattr__&sz OverridesProxyModule.__getattr__cCs6tt|j}|j|jj|jt|jt|S)N)setdirrupdate__dict__keysrsorted)rresultr r r __dir__)szOverridesProxyModule.__dir__cCsdt|j|jfS)Nz<%s %r>)typerr)rr r r __repr__/szOverridesProxyModule.__repr__) rr __qualname____doc__rrr!r# __classcell__r r )rr rs  rc@s0eZdZdZddZddZddZdd Zd S) _DeprecatedAttributezA deprecation descriptor for OverridesProxyModule subclasses. Emits a PyGIDeprecationWarning on every access and tries to act as a normal instance attribute (can be replaced and deleted). cCs$||_||_td|||f|_dS)Nz#%s.%s is deprecated; use %s instead)_attr_valuer_warning)r namespaceattrvalue replacementr r r r:s z_DeprecatedAttribute.__init__cCs(|dkrt|jtj|jdd|jS)N) stacklevel)AttributeErrorr(warningswarnr*r))rinstanceownerr r r __get__As z_DeprecatedAttribute.__get__cCs$|j}tt||t|||dS)N)r(delattrr"setattr)rr4r-r,r r r __set__Gsz_DeprecatedAttribute.__set__cCstt||jdS)N)r7r"r()rr4r r r __delete__Msz_DeprecatedAttribute.__delete__N)rr r$r%rr6r9r:r r r r r'3s r'cCs|jjddd }d|}|tjk}tjj|}t|dtfi}||}|tj|<ddlm}|||<zHd|}y t|} Wnt k rd} YnX| dkr|St j |} Wd||=tj|=|r|tj|<X||_ g} t | d r| j} xD| D]<} yt| | } Wnt tfk rwYnXt|| | qWxptj|gD]`\}}yt||}Wn"t k rvtd |YnXt||t||||}t|||q>W|S) zLoads overrides for an introspection module. Either returns the same module again in case there are no overrides or a proxy module including overrides. Doesn't cache the result. .zgi.repository.Z ProxyModuler/)modulesz gi.overrides.N__all__z1%s was set deprecated but wasn't added to __all__)rrsplitsysr=getr"rZimporterrr1 importlib import_moduleZ_overrides_modulehasattrr>r TypeErrorr8_deprecated_attrspopAssertionErrorr7r')rr+Z module_keyZhas_oldZ old_moduleZ proxy_typeproxyr=Zoverride_package_nameZoverride_loaderZ override_modZ override_allvaritemr,r.r-deprecated_attrr r r load_overridesRsV           rNc st|tr>|}|jjddd }tjd|fdd}|St|tjrXtd|nyt |d}Wn"t k rtd|j YnX|jj d st d ||jf|j}|tkr||_|jjddd }tjd|t|j ||Sd S)aDecorator for registering an override. Other than objects added to __all__, these can get referenced in the same override module via the gi.repository module (get_parent_for_object() does for example), so they have to be added to the module immediately. r;r<zgi.repository.cst|j||S)N)r8r)func)moduler r r szoverride..wrapperz"func must be a gi function, got %sZ__info__zKCan not override a type %s, which is not in a gobject introspection typelibz gi.overrideszUYou have tried override outside of the overrides module. This is not allowed (%s, %s)Nr?r?) isinstancerr r@rAr=types FunctionTyperFrr1r startswithKeyErrorZ get_g_typerZpytyper8)Ztype_rOr+r infoZg_typer )rPr overrides2    rWcstfdd}|S)z7Decorator for marking methods and classes as deprecatedcs$tjdjftdd||S)Nz %s is deprecated; use %s insteadr/)r0)r2r3rr)argskwargs)fnr.r r r s zdeprecated..wrapped)r)rZr.r r )rZr.r deprecatedsr[cCstj|gj||fdS)a:Marks a module level attribute as deprecated. Accessing it will emit a PyGIDeprecationWarning warning. e.g. for ``deprecated_attr("GObject", "STATUS_FOO", "GLib.Status.FOO")`` accessing GObject.STATUS_FOO will emit: "GObject.STATUS_FOO is deprecated; use GLib.Status.FOO instead" :param str namespace: The namespace of the override this is called in. :param str namespace: The attribute name (which gets added to __all__). :param str replacement: The replacement text which will be included in the warning. N)rG setdefaultappend)r+r,r.r r r rMsrMr/csfdd}|S)aWrapper for deprecating GObject based __init__ methods which specify defaults already available or non-standard defaults. :param callable super_init_func: Initializer to wrap. :param list arg_names: Ordered argument name list. :param list ignore: List of argument names to ignore when calling the wrapped function. This is useful for function which take a non-standard keyword that is munged elsewhere. :param dict deprecated_aliases: Dictionary mapping a keyword alias to the actual g_object_newv keyword. :param dict deprecated_defaults: Dictionary of non-standard defaults that will be used when the keyword is not explicitly passed. :param Exception category: Exception category of the error. :param int stacklevel: Stack level for the deprecation passed on to warnings.warn :returns: Wrapped version of ``super_init_func`` which gives a deprecation warning when non-keyword args or aliases are used. :rtype: callable c sZ|r:tjddjdt|dtt|}ni}|j|g}x4jD](\}}||krV|j|||<|j |qVW|rtjddjfddt |Ddjt |fdg}x2jD]&\}}||krΈ|||<|j |qW|r*tjddjfd dt |Ddx"D]}||kr0|j|q0W|f|S) zInitializer for a GObject based classes with support for property sets through the use of explicit keyword arguments. zUsing positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "%s" or use a class specific constructor. See: https://wiki.gnome.org/PyGObject/InitializerDeprecationsz, N)r0zThe keyword(s) "%s" have been deprecated in favor of "%s" respectively. See: https://wiki.gnome.org/PyGObject/InitializerDeprecationsc3s|]}|VqdS)Nr ).0k)deprecated_aliasesr r /sz4deprecated_init..new_init..zInitializer is relying on deprecated non-standard defaults. Please update to explicitly use: %s See: https://wiki.gnome.org/PyGObject/InitializerDeprecationsc3s|]}d||fVqdS)z%s=%sNr )r^r_)deprecated_defaultsr r ra>s) r2r3joinlendictzipritemsrHr]r) rrXrYZ new_kwargsZ aliases_usedkeyaliasZ defaults_usedr-) arg_namescategoryr`rbignorer0super_init_funcr r new_inits<       z!deprecated_init..new_initr )rmrjrlr`rbrkr0rnr )rjrkr`rbrlr0rmr deprecated_inits3rocstfdd}|S)aTranslate method's return value for stripping off success flag. There are a lot of methods which return a "success" boolean and have several out arguments. Translate such a method to return the out arguments on success and None on failure. csL||}|dr4t|dkr&|dS|ddSnrDp@dSdS)Nrr/r<z call failed)rd)rXrYret)exc_strexc_typefail_retmethodr r r Rs   z%strip_boolean_result..wrapped)r)rtrrrqrsr r )rqrrrsrtr strip_boolean_resultKs ru)NNN)rRr2rCrAZpkgutilrZgirZgi._girZ gi._constantsrrr__path__rrGr ModuleTyperobjectr'rNrWZ overridefuncr[rMtuplerorur r r r s.     V-  QPK!@ZZ%__pycache__/GLib.cpython-36.opt-1.pycnu[3 <_u@sddlZddlZddlZddlmZmZddlmZddlm Z m Z m Z m Z ddl mZmZmZddlmZmZedZgZdd lmZeejd dd lmZdd lmZeZejZejZejZejZd dZ ddZ!ddZ"de_#de_$ejj%e_%e!e_&e'e"e_(edddddddg7ZGddde)Z*Gdddej+Z+ddZ,e-e+de,ejddd d!Z.ejd!xFdD]>Z/d*e/Z0ede0d+e/e1ej2d,e/e3e0<eje0qxWx2dD]*Z/e1ej4e/e3d3e/<ejd3e/qWxBdD]:Z/d;e/Z0ede0dejd=xBdD]:Z/dCe/Z0e1ej8e/e3e0<ede0dDe/eje0qVWxBdD]:Z/dLe/Z0e1ej9e/e3e0<ede0dMe/eje0qWxBdD]:Z/dUe/Z0e1ej:e/e3e0<ede0dVe/eje0qWxBdD]:Z/dZe/Z0ede0d[e/e1ej;e/e3e0<eje0q"Wx8dD]0ZZ>ee>Z>ejdpGdqdrdrej?Z?ee?Z?ejdrGdsdtdtej@Z@ee@Z@ejdtGdudvdve@ZAejdvGdwdxdxe@ZBejdxdydzZCejdzd{d|ZDejd|d}d~ZEejd~ddZFejdddZGejdGdddejHZHeeHZHejdGdddejIZIeeIZIejdddZJejdddZKejdddZLeeLdZLejddddZMejdeNedsJddZOeOe_PejQejRejSfZTejdedddeZUejdeddddS)N)wakeup_on_signalregister_sigint_fallback)get_introspection_module)variant_type_from_string source_newsource_set_callbackio_channel_read)override deprecateddeprecated_attr)PyGIDeprecationWarning version_infoGLib)_optionoption)_gi)GErrorcCstjdtdddS)NzmSince version 3.11, calling threads_init is no longer needed. See: https://wiki.gnome.org/PyGObject/Threadingr) stacklevel)warningswarnr rr/usr/lib64/python3.6/GLib.py threads_init5srcCs2t|jtrtj|j}n|j}||jf||fkS)N) isinstancedomainstrrZquark_from_stringcode)selfrrZself_domain_quarkrrrgerror_matches;s rcCstj|}t|||S)N)rZquark_to_stringr)rmessagerZ domain_quarkrrrgerror_new_literalEs r!Errorr OptionContext OptionGroupPid spawn_asyncc@sneZdZejjejjejjejjejj ejj ejj ejj ejj ejjejjejjejjejjdZddZdS)_VariantCreator)bynqiuxthdsogvc Cstj|}||jkr"|j||Stjj|}|dkr>|jS|jrh|j|j|j j ||jSy t |Wn$t k rt d||fYnX|j r|jt|krt d||f|jrt|dkrt d||f|jr4|j j }t|tr|j}xl|D]}|j|j||qWnJ|dd}x<|D]4}t|j }|j|j|||t|d}qFW|jS)aBCreate a GVariant object from given format and a value that matches the format. This method recursively calls itself for complex structures (arrays, dictionaries, boxed). Returns the generated GVariant. If value is None it will generate an empty GVariant container type. NzOCould not create array, tuple or dictionary entry from non iterable value %s %sz1Tuple mismatches value's number of elements %s %srz/Dictionary entries must have two elements %s %s)r VariantType_LEAF_CONSTRUCTORSZVariantBuildernewendZis_maybeZ add_value_createelementZ dup_stringiter TypeErrorZis_tupleZn_itemslenZ is_dict_entryZis_arrayrdictitemsr) rformatvalueZgvtypeZbuilderZ element_typer,Zremainer_formatduprrrr;is<           z_VariantCreator._createN)__name__ __module__ __qualname__rVariantZ new_booleanZnew_byteZ new_int16Z new_uint16Z new_int32Z new_uint32Z new_int64Z new_uint64Z new_handleZ new_doubleZ new_stringZnew_object_pathZ new_signatureZ new_variantr8r;rrrrr'Vs r'c@seZdZddZeddZddZddZd d Zd d Z d dZ ddZ ddZ e ddZddZddZddZddZddZdS) rHcCs2tjj|std|t}|j||}||_|S)aCreate a GVariant from a native Python object. format_string is a standard GVariant type signature, value is a Python object whose structure has to match the signature. Examples: GLib.Variant('i', 1) GLib.Variant('(is)', (1, 'hello')) GLib.Variant('(asa{sv})', ([], {'foo': GLib.Variant('b', True), 'bar': GLib.Variant('i', 2)})) z#Invalid GVariant format string '%s')rr7Zstring_is_validr>r'r; format_string)clsrIrCZcreatorr5rrr__new__s   zVariant.__new__cGs tjj|S)N)rrH new_tuple)elementsrrrrLszVariant.new_tuplec Cs&y |jWntk r YnXdS)N)unref ImportError)rrrr__del__s zVariant.__del__cCs |jdS)NT)print_)rrrr__str__szVariant.__str__cCs,t|dr|j}n|j}d||jdfS)NrIzGLib.Variant('%s', %s)F)hasattrrIget_type_stringrQ)rfrrr__repr__s zVariant.__repr__c Cs$y |j|Stk rdSXdS)NF)equalr>)rotherrrr__eq__s zVariant.__eq__c Cs&y |j| Stk r dSXdS)NT)rWr>)rrXrrr__ne__s zVariant.__ne__cCst|j|jfS)N)hashrTunpack)rrrr__hash__szVariant.__hash__csXjjjjjjjjjj j j j d }|j j }|rR|Sj j drfddtjD}t|Sj j dri}x:tjD]*}j|}|jdj||jdj<qW|Sj j drfd dtjDSj j d rjjSj j d rDjs6d SjdjStd j d S)z1Decompose a GVariant into a native Python object.) r(r)r*r+r,r-r.r/r0r1r2r3r4(csg|]}j|jqSr)get_child_valuer\).0r,)rrr sz"Variant.unpack..za{r6racsg|]}j|jqSr)r_r\)r`r,)rrrrasr5mNzunsupported GVariant type ) get_booleanZget_byteZ get_int16Z get_uint16Z get_int32Z get_uint32Z get_int64Z get_uint64Z get_handleZ get_double get_stringgetrT startswithrange n_childrentupler_r\Z get_variantNotImplementedError)rZLEAF_ACCESSORSZlaresr,r5r)rrr\sH       zVariant.unpackc Cs|dkr gS|jds|gSg}d}|dd }x|r|d}||7}|dd}|d kr\q2|dkrd}|}|dkrzd }nd }xJ|dkr|d}||7}|dd}||kr|d7}q||kr|d8}qW|j|d}q2W|S)a[Return a list of the element signatures of the topmost signature tuple. If the signature is not a tuple, it returns one element with the entire signature. If the signature is an empty tuple, the result is []. This is useful for e. g. iterating over method parameters which are passed as a single Variant. z()r^r6rNrcrb{)})rcrb)r^rn)rgappend) klassZ signatureresultheadtailclevelZupZdownrrrsplit_signatures<         zVariant.split_signaturecCsP|jdkrt|jS|jjds4|jjdr<|jStd|jdS)Nr2r3r4rbr^z'GVariant type %s does not have a length)r2r3r4)rTr?rergrir>)rrrr__len__Is   zVariant.__len__c Cs&|jjdry(|j|td}|dkr0t||jStk rx>t|jD].}|j |}|j dj|krT|j djSqTWt|YnX|jjds|jjdrt |}|dkr|j|}|dks||jkrt d|j |jS|jd kr|j j |Std |jdS) Nza{*rr6rbr^zlist index out of ranger2r3r4z#GVariant type %s is not a container)r2r3r4)rTrgZ lookup_valuerKeyErrorr\r>rhrir_int IndexErrorre __getitem__)rkeyvalr,r5rrrrQs,  zVariant.__getitem__cCs|jS)N)__bool__)rrrr __nonzero__vszVariant.__nonzero__c Cs|jdkr|jd kS|jdkr,|jS|jdkrHt|jd kS|jjdsd|jjdrp|jd kS|jdkrt|jSdS)Nr)r*r+r,r-r.r/r0r1rr(r2r3r4rbr^r5T) r)r*r+r,r-r.r/r0r1)r()r2r3r4)r5)rTr\rdr?rergribool)rrrrrys       zVariant.__bool__cCsZ|jjdstd|jfSg}x2t|jD]"}|j|}|j|jdjq0W|S)Nza{z$GVariant type %s is not a dictionaryr)rTrgr>rhrir_rrr\)rrlr,r5rrrkeyss z Variant.keysN)rErFrGrK staticmethodrLrPrRrVrYrZr]r\ classmethodryrzrrrrrrrrrHs  7 6%rHcCstjj|\}}|S)N)rrHre)rrClengthrrrresrer6cCs,t|trtj|jd|Stj||SdS)NzUTF-8)rbytesrmarkup_escape_textdecode)textrrrrrs rDESKTOP DOCUMENTSDOWNLOADMUSICPICTURES PUBLIC_SHARE TEMPLATESVIDEOSZUSER_DIRECTORY_zGLib.UserDirectory.DIRECTORY_Z DIRECTORY_ERRHUPINNVALOUTPRIZIO_APPENDGET_MASK IS_READABLE IS_SEEKABLEMASKNONBLOCKSET_MASKZIO_FLAG_z GLib.IOFlags.IO_FLAG_IS_WRITEABLEzGLib.IOFlags.IS_WRITABLEAGAINEOFERRORNORMALZ IO_STATUS_zGLib.IOStatus.CHILD_INHERITS_STDINDO_NOT_REAP_CHILDFILE_AND_ARGV_ZEROLEAVE_DESCRIPTORS_OPEN SEARCH_PATHSTDERR_TO_DEV_NULLSTDOUT_TO_DEV_NULLZSPAWN_zGLib.SpawnFlags.HIDDENIN_MAINREVERSENO_ARGFILENAME OPTIONAL_ARGNOALIASZ OPTION_FLAG_zGLib.OptionFlags.UNKNOWN_OPTION BAD_VALUEFAILEDZ OPTION_ERROR_zGLib.OptionError. G_MINFLOAT G_MAXFLOAT G_MINDOUBLE G_MAXDOUBLE G_MINSHORT G_MAXSHORT G_MAXUSHORTG_MININTG_MAXINT G_MAXUINT G_MINLONG G_MAXLONG G_MAXULONG G_MAXSIZE G_MINSSIZE G_MAXSSIZE G_MINOFFSET G_MAXOFFSET_cs0eZdZdddZd ddZfddZZS) MainLoopNcCstjj|dS)NF)rrr9)rJcontextrrrrKszMainLoop.__new__cCsdS)Nr)rrrrr__init__szMainLoop.__init__cs:t|j&ttt|jWdQRXWdQRXdS)N)rquitrsuperrrun)r) __class__rrrs z MainLoop.run)N)N)rErFrGrKrr __classcell__rr)rrrs  rcseZdZdfdd ZZS) MainContextTcstt|j|S)N)rr iteration)rZ may_block)rrrrszMainContext.iteration)T)rErFrGrrrr)rrrsrcseZdZddZfddZddZdfdd Zd d Zeed Zd dZ ddZ e e e Z ddZ ddZe e eZZS)SourcecOst}||_t|dd|S)N__pygi_custom_sourceT)rrsetattr)rJargskwargssourcerrrrKs zSource.__new__cstt|jS)N)rrr)rrr)rrrr szSource.__init__cCst|dr|jdS)Nr)rSrN)rrrrrPs zSource.__del__Ncs.t|drt|||ntt|j||dS)Nr)rSrrr set_callback)rfn user_data)rrrrs zSource.set_callbackcCs tjdS)Ngư>)r get_real_time)rrrrget_current_timeszSource.get_current_timez.GLib.Source.get_time() or GLib.get_real_time()cCs|jS)N)Z get_priority)rrrrZ__get_priority$szSource.__get_prioritycCs|j|dS)N) set_priority)rrCrrrZ__set_priority'szSource.__set_prioritycCs|jS)N)Zget_can_recurse)rrrrZ__get_can_recurse,szSource.__get_can_recursecCs|j|dS)N)Zset_can_recurse)rrCrrrZ__set_can_recurse/szSource.__set_can_recurse)N)rErFrGrKrrPrrr Z_Source__get_priorityZ_Source__set_prioritypropertypriorityZ_Source__get_can_recurseZ_Source__set_can_recurseZ can_recurserrr)rrrs   rcs0eZdZejfddZejffdd ZZS)IdlecCstj}||_|S)N)rZidle_source_newr)rJrrrrrrK:sz Idle.__new__cs&tt|j|tjkr"|j|dS)N)rrrrPRIORITY_DEFAULTr)rr)rrrr?s z Idle.__init__)rErFrGrrrKrrrr)rrr9src@s,eZdZdejfddZdejfddZdS)TimeoutrcCstj|}||_|S)N)rZtimeout_source_newr)rJintervalrrrrrrKIs zTimeout.__new__cCs|tjkr|j|dS)N)rrr)rrrrrrrNs zTimeout.__init__N)rErFrGrrrKrrrrrrHsrcOs |jdtj}tj||f|S)Nr)rfrZPRIORITY_DEFAULT_IDLEidle_add)functionrrrrrrrWsrcOs"|jdtj}tj|||f|S)Nr)rfrr timeout_add)rrrrrrrrr_srcOs"|jdtj}tj|||f|S)Nr)rfrrtimeout_add_seconds)rrrrrrrrrgsrcs:t|t st|tjrftjdt|}||}ts@tdd|kr^tjdt|d}qtj }n6t |dkst|d rtd|d|dd}ttr‡fdd }tj j }njtt j rtjd krfd d }tj jj}n4td r$fd d }tj j j}n}}|||||fS)NzFCalling io_add_watch without priority as second argument is deprecatedzthird argument must be callablerzgCalling io_add_watch with priority keyword argument is deprecated, put it as second positional argumentr6rz%expecting callback as fourth argumentcs|f|S)Nr)rconddata)callbackchannelrrsz(_io_add_watch_get_args..Zwin32cs|f|S)Nr)rrr)rrrrrsfilenocs|f|S)Nr)rrr)rrrrrs)rr}r IOConditionrrr callabler>rr? IOChannelunix_newsocketsysplatformZwin32_new_socketrrS)rZ priority_ conditionZcb_and_user_datarrZfunc_fdtransformZ real_channelr)rrr_io_add_watch_get_args{s:    rcOs*t||\}}}}}tj||||f|S)zOio_add_watch(channel, priority, condition, func, *user_data) -> event_source_id)rr io_add_watch)rrrrrfuncrrrrrsrcseZdZdddZfddZdddZd d d Zd"d d Zd$d dZddZ e j j e j j e j jdZd%ddZddZeedZddZddZeZZS)&rNcCsN|dk rtjj|S|dk r.tjj||p*dS|dk rBtjj|StddS)NrzLeither a valid file descriptor, file name, or window handle must be supplied)rrrZnew_fileZ win32_new_fdr>)rJZfiledesfilenamemodeZhwndrrrrKs  zIOChannel.__new__cstt|jS)N)rrr)rrr)rrrrszIOChannel.__init__r6cCs t||S)N)r )rZ max_countrrrreadszIOChannel.readcCs |j\}}}}|dkrdS|S)Nrm) read_line)r size_hintstatusbufrterminator_posrrrreadlineszIOChannel.readlinecCsHg}tjj}x6|tjjkrB|j\}}}}|dkr6d}|j|qW|S)Nrm)rIOStatusrrrr)rrlinesrrrrrrr readlinesszIOChannel.readlinescCs8t|ts|jd}|dkr$t|}|j||\}}|S)NzUTF-8r6rq)rrencoder?Z write_chars)rrZbuflenrZwrittenrrrwrites   zIOChannel.writecCsx|D]}|j|qWdS)N)r )rrlinerrr writeliness zIOChannel.writelines)rr6rrc Cs8y|j|}Wntk r*tdYnX|j||S)Nzinvalid 'whence' value) _whence_mapr| ValueErrorZ seek_position)roffsetwhencewrrrseeks zIOChannel.seekcOs"|jdtj}t||||f|S)Nr)rfrrr)rrrrrrrrr add_watchszIOChannel.add_watchzGLib.io_add_watch()cCs|S)Nr)rrrr__iter__szIOChannel.__iter__cCs(|j\}}}}|tjjkr |StdS)N)rrrr StopIteration)rrrrrrrr__next__s zIOChannel.__next__)NNNNrq)rqrq)rqrq)rqrq)rq)r)rErFrGrKrrrrr r rZSeekTypeZSETZCURZENDr rrr rrnextrrr)rrrs       rc@seZdZddZddZdS)PollFDcCstj}||_|S)N)rrr)rJfdeventsZpollfdrrrrKszPollFD.__new__cCs||_||_dS)N)rr)rrrrrrr szPollFD.__init__N)rErFrGrKrrrrrrsrcOsg}t|rtjdt|}|}t|dkr<|jdtj}qt|dkr\|}|jdtj}qt|dkr||dg}|d}qtdnT|}|}d|kr|d}|}n6t|dkrt|dr|d}|dd}ntdd |kr|rtd |d g}||||fS) NzHCalling child_watch_add without priority as first argument is deprecatedrrr6rz'expected at most 4 positional argumentsrz#expected callback as third argumentrz'got multiple values for "data" argument) rrrr r?rfrrr>)Zpriority_or_pidZpid_or_callbackrrrpidrrrrr_child_watch_add_get_argss:       rcOs&t||\}}}}tj|||f|S)z/child_watch_add(priority, pid, function, *data))rrchild_watch_add)rrrrrrrrrrDsrcCs tjdS)Ngư>)rrrrrrrMsrzGLib.get_real_time()cCstj||dS)Nr)rfilename_from_utf8)Z utf8stringr?rrrrXsrunix_signal_add_fullcGstjdttj|S)NzAGLib.unix_signal_add_full() was renamed to GLib.unix_signal_add())rrr rZunix_signal_add)rrrradd_full_compatasr  glib_versionz<(GLib.MAJOR_VERSION, GLib.MINOR_VERSION, GLib.MICRO_VERSION)pyglib_versionzgi.version_inforq)rq)rrrrrrrr)rrrrrr)rrrrrrr)rrrr)rrrrrrr)rrrrrrr)rrr)rrrrrrrrrrrrrrrrrrrqrq)rq)VrrrZ _ossighelperrrmodulerrrrrr Z overridesr r r Zgir rr__all__rrrrZ gi._errorrr"r#r$r%r&rrr!rErFZ __gtype__ZmatchesrZ new_literalobjectr'rHrerrr*attrgetattrZ UserDirectoryglobalsrZIOFlagsZ IS_WRITABLErrZ SpawnFlagsZ OptionFlagsZ OptionErrornamesplitrrrrrrrrrrrrrrrrrSr rZ MAJOR_VERSIONZ MINOR_VERSIONZ MICRO_VERSIONr!r"rrrrs           Fy           2      +  N   '         PK!塟3__pycache__/GIMarshallingTests.cpython-36.opt-1.pycnu[3 <_@s~ddlmZddlmZedZgZdZejdGdddejZeeZejdGdd d ej Z ee Z ejd d S) )override)get_introspection_moduleGIMarshallingTestsOVERRIDES_CONSTANTc@s$eZdZddZddZddZdS)OverridesStructcCs tjj|S)N)rr__new__)clslong_r */usr/lib64/python3.6/GIMarshallingTests.pyr"szOverridesStruct.__new__cCstjj|||_dS)N)rr__init__r )selfr r r r r %s zOverridesStruct.__init__cCstjj|dS)Nr)rrmethod)rr r r r)szOverridesStruct.methodN)__name__ __module__ __qualname__rr rr r r r r src@s0eZdZddZddZeddZddZd S) OverridesObjectcCs tjj|S)N)rrr)r r r r r r3szOverridesObject.__new__cCstjj|dS)N)rrr )rr r r r r 6szOverridesObject.__init__cCstjj}|S)N)rrnew)r r rr r r r;s zOverridesObject.newcCstjj|dS)zOverridden doc string.r)rrr)rr r r rBszOverridesObject.methodN)rrrrr classmethodrrr r r r r1s rN) Z overridesrmodulerr__all__rappendrrr r r r s     PK!U鶒--$__pycache__/Gdk.cpython-36.opt-1.pycnu[3 <__=@sddlZddlZddlmZmZddlmZddlmZm Z edZ gZ y e de j ddl mZeWneefk rYnXee d rGd d d e jZeeZe jd ee d rGd d d e jZeeZe jd e j d krGddde jZeeZe jdnNee ds:ddl mZejZe jdn$e jjZe jjZe jde jde j d krGddde jZeeZe jdn$Gddde jZeeZe jdee j de j _!ee j de j _"Gddde j#Z#ee#Z#e jde$dZ%ej&e%Zddddd d!d"d#d$d%d&d'd(d)d*d+d,d-gZ'e j d krJe'jd.ee d/r`e'jd/d0d1d2d3gZ(xe'D]Z)e*e)ee e)fiZ+xTe j#j,j-D]DZ.e.j/Z0ee j#e0Z1ee1d4e1Z1e0e(kree1Z1e2e+e0e1qWe2ee)e+e je)qrWGd5d6d6e j3Z3ee3Z3e jd6Gd7d8d8e j4Z4ee4Z4e jd8ee d9rdee j5Z5e jd9d:d;Z6dkre j;d?d@Ze jdEe j;dFd@Z?e jdGe j;dHd@Z@e jdIe j;dJd@ZAe jdKe j;dLd@ZBe jdMe j;dNd@ZCe jdOe j;dPd@ZDe jdQe j;dFd@ZEe jdRe j;dHd@ZFe jdSe j;dJd@ZGe jdTe j;dUd@ZHe jdVe j;dLd@ZIe jdWe j;dXd@ZJe jdYe j;dNd@ZKe jdZe j d[krddlZe jLejM\ZNZMdS)\N)overridestrip_boolean_result)get_introspection_module)PyGIDeprecationWarningrequire_versionGdkGdkX11)r Colorc@sxeZdZdZddZddZddZedd d d d Zed d d d d Z edd dd d Z ddZ e ddZ dS)r icCs"tjj|||_||_||_dS)N)rr __init__redgreenblue)selfr r rr/usr/lib64/python3.6/Gdk.pyr /s zColor.__init__cCs |j|S)N)equal)rotherrrr__eq__5sz Color.__eq__cCsd|j|j|jfS)Nz$Gdk.Color(red=%d, green=%d, blue=%d))r r r)rrrr__repr__8szColor.__repr__cCs|jt|jS)N)r float MAX_VALUE)rrrr;szColor.cCst|dt||jS)Nr )setattrintr)rvrrrr<s)fgetfsetcCs|jt|jS)N)r rr)rrrrr>scCst|dt||jS)Nr )rrr)rrrrrr?scCs|jt|jS)N)rrr)rrrrrAscCst|dt||jS)Nr)rrr)rrrrrrBscCs|j|j|jfS)z3Return (red_float, green_float, blue_float) triple.) red_float green_float blue_float)rrrr to_floatsDszColor.to_floatscCs*tt|tjt|tjt|tjS)zEReturn a new Color object from red/green/blue values from 0.0 to 1.0.)r rr)r r rrrr from_floatsIs zColor.from_floatsN)__name__ __module__ __qualname__rr rrpropertyrrr r! staticmethodr"rrrrr ,s   RGBAc@sBeZdZdddZddZddZdd Zd d Zed d Z dS)r(?cCs(tjj|||_||_||_||_dS)N)rr(r r r ralpha)rr r rr*rrrr Ws  z RGBA.__init__cCs |j|S)N)r)rrrrrr^sz RGBA.__eq__cCsd|j|j|j|jfS)Nz-Gdk.RGBA(red=%f, green=%f, blue=%f, alpha=%f))r r rr*)rrrrrasz RGBA.__repr__ccs$|jV|jV|jV|jVdS)z>Iterator which allows easy conversion to tuple and list types.N)r r rr*)rrrr__iter__dsz RGBA.__iter__cCs0tt|jtjt|jtjt|jtjS)z>Converts this RGBA into a Color instance which excludes alpha.)r rr rr r)rrrrto_colorlsz RGBA.to_colorcCs||j|j|jS)z3Returns a new RGBA instance given a Color instance.)rrr )clsZcolorrrr from_colorsszRGBA.from_colorN)r)r)r)r)) r#r$r%r rrr+r, classmethodr.rrrrr(Vs  2.0c@seZdZddZddZdS) RectanglecCs(tjj|||_||_||_||_dS)N)rr1r xywidthheight)rr2r3r4r5rrrr s  zRectangle.__init__cCsd|j|j|j|jfS)Nz.Gdk.Rectangle(x=%d, y=%d, width=%d, height=%d))r2r3r5r4)rrrrrszRectangle.__repr__N)r#r$r%r rrrrrr1}sr1)cairorectangle_intersectrectangle_unionc@seZdZddZdS)DrawablecCs tj|S)N)r cairo_create)rrrrr:szDrawable.cairo_createN)r#r$r%r:rrrrr9sr9c@s$eZdZddZddZddZdS)WindowcCstjj|||S)N)rr;new)r-parent attributesattributes_maskrrr__new__szWindow.__new__cCsdS)Nr)rr=r>r?rrrr szWindow.__init__cCs tj|S)N)rr:)rrrrr:szWindow.cairo_createN)r#r$r%r@r r:rrrrr;sr;Z 2BUTTON_PRESSZ 3BUTTON_PRESSc<@sheZdZejjdejjdejjdejjdejj dejj dejj dejj dejj dejjdejjdejjdejjdejjdejjdejjdejjd ejjd ejjd ejjd ejjd ejjd ejjd ejjd ejjd ejjd ejjd ejj d ejj!d ejj"diZ#ej$dkrde#ejj%<e&ejdrLe#j'ejj(dejj)dejj*dejj+diddZ,ddZ-ddZ.dS)EventanyZexposeZmotionZbuttonkeyZcrossingZ focus_changeZ configurer&Z selectionZ proximityZdndZclientZ visibilityz2.0Z no_expose TOUCH_BEGINZtouchcCs>t|dj|j}|r&tt|||Std|jj|fdS)N_UNION_MEMBERSz!'%s' object has no attribute '%s')getattrgettypeAttributeError __class__r#)rname real_eventrrr __getattr__szEvent.__getattr__cCs>t|dj|j}|r*tt||||ntjj|||dS)NrE)rFrGrHrrrA __setattr__)rrKvaluerLrrrrNszEvent.__setattr__cCs tjj|jd}d||jfS)Nz>)rrArstriprH)rZ base_reprrrrrszEvent.__repr__N)/r#r$r%r EventTypeZDELETEZDESTROYZEXPOSEZ MOTION_NOTIFYZ BUTTON_PRESS_2BUTTON_PRESS_3BUTTON_PRESSZBUTTON_RELEASEZ KEY_PRESSZ KEY_RELEASEZ ENTER_NOTIFYZ LEAVE_NOTIFYZ FOCUS_CHANGEZ CONFIGUREZMAPZUNMAPZPROPERTY_NOTIFYZSELECTION_CLEARZSELECTION_REQUESTZSELECTION_NOTIFYZ PROXIMITY_INZ PROXIMITY_OUTZ DRAG_ENTERZ DRAG_LEAVEZ DRAG_MOTIONZ DRAG_STATUSZ DROP_STARTZ DROP_FINISHEDZ CLIENT_EVENTZVISIBILITY_NOTIFYrE_versionZ NO_EXPOSEhasattrupdaterDZ TOUCH_UPDATEZ TOUCH_ENDZ TOUCH_CANCELrMrNrrrrrrAsR   rAr#ZEventAnyZ EventExposeZEventVisibilityZ EventMotionZ EventButtonZ EventScrollZEventKeyZ EventCrossingZ EventFocusZEventConfigureZ EventPropertyZEventSelectionZEventOwnerChangeZEventProximityZEventDNDZEventWindowStateZ EventSettingZEventGrabBrokenZ EventNoExposeZ EventTouchZ get_stateZget_axisZ get_coordsZget_root_coords__func__c@seZdZddZdS) DragContextcCstd}|j||||dS)NGtk)rZ drag_finish)rsuccessZdel_ZtimerYrrrfinish:szDragContext.finishN)r#r$r%r[rrrrrX9srXc@seZdZddZdS)CursorcOst|}t|}||}|dkr>tjdkr2td|j||S|dkr^tjdt|j||S|dkr~tjdt|j ||S|dkrtjd krtdtjd t|j ||StddS) Nz4.0zWrong number of parametersrzCalling "Gdk.Cursor(display, cursor_type)" has been deprecated. Please use Gdk.Cursor.new_for_display(display, cursor_type). See: https://wiki.gnome.org/PyGObject/InitializerDeprecationszCalling "Gdk.Cursor(display, pixbuf, x, y)" has been deprecated. Please use Gdk.Cursor.new_from_pixbuf(display, pixbuf, x, y). See: https://wiki.gnome.org/PyGObject/InitializerDeprecationsz2.0zCalling "Gdk.Cursor(source, mask, fg, bg, x, y)" has been deprecated. Please use Gdk.Cursor.new_from_pixmap(source, mask, fg, bg, x, y). See: https://wiki.gnome.org/PyGObject/InitializerDeprecations) lenrrT ValueErrorr<warningswarnrZnew_for_displayZnew_from_pixbufZnew_from_pixmap)r-argskwdsZarg_lenZkwd_lenZ total_lenrrrr@Es,      zCursor.__new__N)r#r$r%r@rrrrr\Csr\ color_parsecCs|j}|r|Sdt|S)Nz Gdk.Atom<%i>)rKhash)atomnrrr _gdk_atom_strzsrjcCs |j}|rd|Sdt|S)NzGdk.Atom.intern("%s", False)z)rKrg)rhrirrr_gdk_atom_reprsrk3.0ZPRIMARYTSELECTION_PRIMARYZ SECONDARYSELECTION_SECONDARYZ CLIPBOARDSELECTION_CLIPBOARDZBITMAP TARGET_BITMAPZCOLORMAPTARGET_COLORMAPZDRAWABLETARGET_DRAWABLEZPIXMAP TARGET_PIXMAPSTRING TARGET_STRINGZATOMSELECTION_TYPE_ATOMSELECTION_TYPE_BITMAPSELECTION_TYPE_COLORMAPSELECTION_TYPE_DRAWABLEZINTEGERSELECTION_TYPE_INTEGERSELECTION_TYPE_PIXMAPZWINDOWSELECTION_TYPE_WINDOWSELECTION_TYPE_STRING)r0rl)OsysrbZ overridesrrmodulerZgirrr__all__rTZ gi.repositoryr ra ImportErrorrUr appendr(r1r6Z_cairoZ RectangleIntZ intersectr7unionr8r9r;rFrQrRrSrAglobalsmodnamemodulesZevent_member_classesZgsuccess_mask_funcsZ event_classrHZoverride_classZ__info__Z get_methodsZ method_infoZget_namerKZ event_methodrrXr\rfrjrkZAtom__str__rZ atom_internrmrnrorprqrrrsrurvrwrxryrzr{r|r}Z init_checkargvZ initializedrrrrs    %  #             A             ,                                      PK! __pycache__/Gtk.cpython-36.pycnu[3 <_@sddlZddlZddlZddlmZddlmZmZddlm Z m Z m Z ddl m Z ddlmZejdkrpeZneZe d ZgZejd krd ZejeeGd d d eZejd ddZejdddZejdddZGdddejZe eZejdGdddej eZ e e Z ejdGdddej!Z!e e!Z!ejdejdkrGdddej"Z"e e"Z"ejdGdddej#Z#e e#Z#ejdGdd d ej$Z$e e$Z$ejd Gd!d"d"ej%Z%e e%Z%ejd"Gd#d$d$ej&e Z&e e&Z&ejd$Gd%d&d&ej'Z'e e'Z'ejd&Gd'd(d(ej(Z(e e(Z(ejd(Gd)d*d*ej)Z)e e)Z)ejd*Gd+d,d,ej*Z*e e*Z*ejd,Gd-d.d.ej+Z+e e+Z+ejd.Gd/d0d0ej,e Z,e e,Z,ejd0Gd1d2d2ej-e,Z-e e-Z-ejd2ejdkr@Gd3d4d4ej.Z.e e.Z.ejd4Gd5d6d6ej/Z/e e/Z/ejd6ejdkrGd7d8d8ej0Z0e e0Z0ejd8Gd9d:d:ej1Z1e e1Z1ejd:Gd;d<dd>ej3Z3e e3Z3ejd>Gd?d@d@ej4Z4e e4Z4ejd@GdAdBdBej5Z5e e5Z5ejdBGdCdDdDej6Z6e e6Z6ejdDGdEdFdFej7Z7e e7Z7ejdFGdGdHdHej8Z8e e8Z8ejdHGdIdJdJej9Z9e e9Z9ejdJGdKdLdLej:Z:e e:Z:ejdLGdMdNdNej;e8e9Z;e e;Z;ejdNGdOdPdPe<Z=ejdPGdQdRdRe<Z>ejdRGdSdTdTej?Z?e e?Z?ejdTGdUdVdVej@e8e9Z@e e@Z@ejdVGdWdXdXejAe ZAe eAZAejdXGdYdZdZejBZBe eBZBejdZGd[d\d\ejCZCe eCZCejd\Gd]d^d^ejDe ZDe eDZDejd^Gd_d`d`ejEZEe eEZEejd`GdadbdbejFZFe eFZFejdbGdcddddejGZGe eGZGejddejdkrGdedfdfejHe ZHe eHZHejdfGdgdhdhejIZIe eIZIejdhejdkrNGdidjdjejJZJe eJZJejdjGdkdldlejKZKe eKZKejdlGdmdndnejLZLe eLZLejdnejdkrGdodpdpejMZMe eMZMejdpGdqdrdrejNZNe eNZNejdrGdsdtdtejOZOe eOZOejdtGdudvdvejPZPe ePZPejdvejd kr>GdwdxdxejQZQe eQZQejdxejRZSe ejRdydzZRejTZUe ejTd{d|ZTejdkre ejVZVejd}ejd~krejWnejWejX\ZYZXeZeXe_XdS)N)GObject)wakeup_on_signalregister_sigint_fallback)overridestrip_boolean_resultdeprecated_init)get_introspection_module)PyGIDeprecationWarningGtk2.0aBYou have imported the Gtk 2.0 module. Because Gtk 2.0 was not designed for use with introspection some of the interfaces and API will fail. As such this is not supported by the pygobject development team and we encourage you to port your app to Gtk 3 or greater. PyGTK is the recomended python module to use with Gtk 2.0c@s eZdZdS)PyGTKDeprecationWarningN)__name__ __module__ __qualname__rr/usr/lib64/python3.6/Gtk.pyr4srcCs8g}x.|D]&}t|tjs&tjj|}|j|q W|S)zCreate a list of TargetEntry items from a list of tuples in the form (target, flags, info) The list can also contain existing TargetEntry items in which case the existing entry is re-used in the return list. ) isinstancer Z TargetEntrynewappend)targetstarget_entriesentryrrr_construct_target_list;s    rcCsd}t|tjr|j|d}n t||d}|dkr>td|f}t|tjr|t|dkrftd||dd}|d}nt |std|||fS)NzHandler %s not foundrz!Handler %s tuple can not be emptyz-Handler %s is not a method, function or tuple) r collectionsMappinggetgetattrAttributeErrorSequencelen TypeErrorcallable) obj_or_map handler_namehandlerargsrrr_extract_handler_and_argsLs         r)c Cst||\}}|tjj@} |dk rR| r<|j|||f|q||j|||f|n*| rj|j||f|n|j||f|dS)N)r)rZ ConnectFlagsZAFTERZconnect_object_afterZconnect_objectZ connect_afterconnect) ZbuilderZgobjZ signal_namer&Z connect_objflagsr%r'r(afterrrr_builder_connect_callbackgs r-cs>eZdZeejjZfddZfddZdddZ Z S) Widgetcs:|dk r&t|tj r&tjjt|}tt|j|dS)N)rr TargetListrrsuperr.drag_dest_set_target_list)self target_list) __class__rrr1{sz Widget.drag_dest_set_target_listcs:|dk r&t|tj r&tjjt|}tt|j|dS)N)rr r/rrr0r.drag_source_set_target_list)r2r3)r4rrr5sz"Widget.drag_source_set_target_listNcCsN|dkr6|j|}|dkr*td||ftj|j}tjj||||jS)Nz/Class "%s" does not contain style property "%s") Zfind_style_property ValueErrorrValue value_typer r.style_get_property get_value)r2 property_namevalueproprrrr9s   zWidget.style_get_property)N) rrrrr r.Ztranslate_coordinatesr1r5r9 __classcell__rr)r4rr.ws   r.c@sVeZdZddZddZddZddZeZee j j Z dd d Z d d Z ddZd S) ContainercCs t|jS)N)r" get_children)r2rrr__len__szContainer.__len__cCs ||jkS)N)r@)r2childrrr __contains__szContainer.__contains__cCs t|jS)N)iterr@)r2rrr__iter__szContainer.__iter__cCsdS)NTr)r2rrr__bool__szContainer.__bool__NcCsP|dkr6|j|}|dkr*td||ftj|j}tjj|||||jS)Nz/Class "%s" does not contain child property "%s") Zfind_child_propertyr6rr7r8r r?child_get_propertyr:)r2rBr;r<r=rrrrGs   zContainer.child_get_propertycsfdd|DS)zsz'Container.child_get..r)r2rBZ prop_namesr)rBr2r child_getszContainer.child_getcKs4x.|jD]"\}}|jdd}|j|||q WdS)z=Set a child properties on the given child to key/value pairs._-N)itemsreplaceZchild_set_property)r2rBkwargsrIr<rrr child_sets zContainer.child_set)N)rrrrArCrErF __nonzero__rr r?Zget_focus_chainrGrKrQrrrrr?s  r?cs,eZdZfddZeejjfdZZS)Editablecstt|j|d|S)Nr)r0rS insert_text)r2textposition)r4rrrUszEditable.insert_text)fail_ret) rrrrUrr rSget_selection_boundsr>rr)r4rrSs rS3.0c@seZdZeejjdedZdS)ActionrIlabeltooltipstock_id) arg_namescategoryN)rIr\r]r^)rrrrr r[__init__rrrrrr[sr[c@seZdZeejjdedZdS) RadioActionrIr\r]r^r<)r_r`N)rIr\r]r^r<)rrrrr rbrarrrrrrbsrbc@s<eZdZeejjd edZd ddZd ddZ d dd Z dS) ActionGrouprI)r_r`Nc sTy t|Wntk r(tdYnXdfdd }x|D] }||q@WdS)a The add_actions() method is a convenience method that creates a number of gtk.Action objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The entry tuples can vary in size from one to six items with the following information: * The name of the action. Must be specified. * The stock id for the action. Optional with a default value of None if a label is specified. * The label for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None if a stock id is specified. * The accelerator for the action, in the format understood by the gtk.accelerator_parse() function. Optional with a default value of None. * The tooltip for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None. * The callback function invoked when the action is activated. Optional with a default value of None. The "activate" signals of the actions are connected to the callbacks and their accel paths are set to /group-name/action-name. zentries must be iterableNcsLt||||d}|dk r<dkr.|jd|n|jd|j||dS)N)rIr\r]r^activate)r[r*add_action_with_accel)rIr^r\ acceleratorr]callbackaction)r2 user_datarr_process_actions z0ActionGroup.add_actions.._process_action)NNNNN)rDr#)r2entriesrirjer)r2rir add_actionss  zActionGroup.add_actionscsTy t|Wntk r(tdYnXdfdd }x|D] }||q@WdS)a The add_toggle_actions() method is a convenience method that creates a number of gtk.ToggleAction objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The toggle action entry tuples can vary in size from one to seven items with the following information: * The name of the action. Must be specified. * The stock id for the action. Optional with a default value of None if a label is specified. * The label for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None if a stock id is specified. * The accelerator for the action, in the format understood by the gtk.accelerator_parse() function. Optional with a default value of None. * The tooltip for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None. * The callback function invoked when the action is activated. Optional with a default value of None. * A flag indicating whether the toggle action is active. Optional with a default value of False. The "activate" signals of the actions are connected to the callbacks and their accel paths are set to /group-name/action-name. zentries must be iterableNFcsXtj||||d}|j||dk rHdkr:|jd|n|jd|j||dS)N)rIr\r]r^rd)r Z ToggleAction set_activer*re)rIr^r\rfr]rgZ is_activerh)r2rirrrj3s z7ActionGroup.add_toggle_actions.._process_action)NNNNNF)rDr#)r2rkrirjrlr)r2riradd_toggle_actionss  zActionGroup.add_toggle_actionsc sy t|Wntk r(tdYnXd}dfdd }x&|D]}||f|}|dkrD|}qDW|dk r|dk r|dkr|jd|n|jd||dS)a The add_radio_actions() method is a convenience method that creates a number of gtk.RadioAction objects based on the information in the list of action entry tuples contained in entries and adds them to the action group. The entry tuples can vary in size from one to six items with the following information: * The name of the action. Must be specified. * The stock id for the action. Optional with a default value of None if a label is specified. * The label for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None if a stock id is specified. * The accelerator for the action, in the format understood by the gtk.accelerator_parse() function. Optional with a default value of None. * The tooltip for the action. This field should typically be marked for translation, see the set_translation_domain() method. Optional with a default value of None. * The value to set on the radio action. Optional with a default value of 0. Should be specified in applications. The value parameter specifies the radio action that should be set active. The "changed" signal of the first radio action is connected to the on_change callback (if specified and not None) and the accel paths of the actions are set to /group-name/action-name. zentries must be iterableNrcsHt|||||d}t|dr&|j||kr8|jdj|||S)N)rIr\r]r^r< join_groupT)rbhasattrrprnre)Z group_sourcerIr^r\rfr]Z entry_valuerh)r2r<rrrjes    z6ActionGroup.add_radio_actions.._process_actionZchanged)NNNNr)rDr#r*) r2rkr<Z on_changeriZ first_actionrjrlrhr)r2r<radd_radio_actionsBs  zActionGroup.add_radio_actions)rI)N)N)NNN) rrrrr rcrarrmrorrrrrrrcs  - 1rcc@seZdZddZdddZdS) UIManagercCs0t|tstdt|jd}tjj|||S)Nzbuffer must be a stringzUTF-8)r _basestringr#r"encoder rsadd_ui_from_string)r2bufferlengthrrrrvs zUIManager.add_ui_from_stringrcCstjj|||S)N)r rsinsert_action_group)r2rwrxrrrryszUIManager.insert_action_groupNrT)rT)rrrrvryrrrrrssrsc@seZdZeejjZdS)ComboBoxN)rrrrr rzZget_active_iterrrrrrzsrzc@seZdZeejjdedZdS)Box homogeneousspacing)r_r`N)r|r})rrrrr r{rarrrrrr{sr{c@s(eZdZeejjddejjie dZdS) SizeGroupmode)r_Zdeprecated_defaultsr`N)r) rrrrr r~raZ SizeGroupModeZVERTICALrrrrrr~s r~c@seZdZeejjdedZdS)MenuItemr\)r_r`N)r\)rrrrr rrarrrrrrsrc@s$eZdZddZddZddZdS)BuildercCs|jt|dS)aConnect signals specified by this builder to a name, handler mapping. Connect signal, name, and handler sets specified in the builder with the given mapping "obj_or_map". The handler/value aspect of the mapping can also contain a tuple in the form of (handler [,arg1 [,argN]]) allowing for extra arguments to be passed to the handler. For example: .. code-block:: python builder.connect_signals({'on_clicked': (on_clicked, arg1, arg2)}) N)Zconnect_signals_fullr-)r2r%rrrconnect_signalss zBuilder.connect_signalscCs*t|tstdt|}tjj|||S)Nzbuffer must be a string)rrtr#r"r radd_from_string)r2rwrxrrrrs zBuilder.add_from_stringcCs,t|tstdt|}tjj||||S)Nzbuffer must be a string)rrtr#r"r radd_objects_from_string)r2rwZ object_idsrxrrrrs zBuilder.add_objects_from_stringN)rrrrrrrrrrrsrc@seZdZeejjdedZdS)Windowtype)r_r`N)r)rrrrr rrarrrrrrsrc@s\eZdZdZeejjddddded Z d d Zd d Z e ddZ e ddZ ddZdS)Dialogtitleparentr+buttons_buttons_property transient_for add_buttons)rr)r_ignoredeprecated_aliasesr`cOs|j}tt|j|}|j|d}|jtkrF|jjtjkrF|d7}|jdd}|dk rt |t j  rt j dt|dd|kr|d=nd}|jdd}|rt j dt|d|t jj@rd |d <|t jj@rd |d <|j|||r|j|dS) NrrrzThe "buttons" argument must be a Gtk.ButtonsType enum value. Please use the "add_buttons" method for adding buttons. See: https://wiki.gnome.org/PyGObject/InitializerDeprecations) stacklevelr+rzThe "flags" argument for dialog construction is deprecated. Please use initializer keywords: modal=True and/or destroy_with_parent=True. See: https://wiki.gnome.org/PyGObject/InitializerDeprecationsTZmodalZdestroy_with_parent)copydictzip_old_arg_namesupdater4rrarrr Z ButtonsTypewarningswarnrZ DialogFlagsZMODALZDESTROY_WITH_PARENT_initr)r2r(rP new_kwargsZ old_kwargsrrr+rrrras0        zDialog.__init__cOs<t|j(ttjj|f||SQRXWdQRXdS)N)rZdestroyrr rrun)r2r(rPrrrr#s z Dialog.runcCs|jS)N)Zget_action_area)dialogrrr(szDialog.cCs|jS)N)Zget_content_area)rrrrr)sc GsPdd}y&x ||D]\}}|j||qWWntk rJtdYnXdS)a The add_buttons() method adds several buttons to the Gtk.Dialog using the button data passed as arguments to the method. This method is the same as calling the Gtk.Dialog.add_button() repeatedly. The button data pairs - button text (or stock ID) and a response ID integer are passed individually. For example: .. code-block:: python dialog.add_buttons(Gtk.STOCK_OPEN, 42, "Close", Gtk.ResponseType.CLOSE) will add "Open" and "Close" buttons to dialog. css4x.|r.|dd\}}|dd}||fVqWdS)Nrrr)btrrrr_button9s z#Dialog.add_buttons.._buttonz%Must pass an even number of argumentsN)Z add_button IndexErrorr#)r2r(rrVZresponserrrr+s zDialog.add_buttonsN)rrr+rr)rrr+rr)r+r)rrrrrr rrarrrpropertyZ action_areaZvboxrrrrrrs+  rc@s6eZdZeejjddddedZd d Zd d Z d S) MessageDialogrr+ message_typermessage_formatr)rVr)r_rr`cCs|jdd|jd|dS)Nzsecondary-use-markupFzsecondary-text) set_property)r2rrrrformat_secondary_textRs z#MessageDialog.format_secondary_textcCs|jdd|jd|dS)Nzsecondary-use-markupTzsecondary-text)r)r2rrrrformat_secondary_markupVs z%MessageDialog.format_secondary_markupN)rr+rrr) rrrrr rrarrrrrrrrJsrc@seZdZeejjdedZdS)ColorSelectionDialogr)r_r`N)r)rrrrr rrarrrrrr`src@seZdZeejjdedZdS)FileChooserDialogrrrhr)r_r`N)rrrhr)rrrrr rrarrrrrrisrc@seZdZeejjdedZdS)FontSelectionDialogr)r_r`N)r)rrrrr rrarrrrrrtsrc@s$eZdZeejjdddiedZdS) RecentChooserDialogrrrecent_managerrZmanager)r_rr`N)rrrr)rrrrr rrarrrrrr}src@sBeZdZeejjdedZeejj Z eejj Z eejj Z dS)IconViewmodel)r_r`N)r) rrrrr rrarrZget_item_at_posget_visible_rangeZget_dest_item_at_posrrrrrs   rc@seZdZeejjdedZdS) ToolButtonr^)r_r`N)r^)rrrrr rrarrrrrrsrc@seZdZeejjZdS) IMContextN)rrrrr rZget_surroundingrrrrrsrc@seZdZeejjZdS) RecentInfoN)rrrrr rZget_application_inforrrrrsrc@sfeZdZddZdddZdddZdd d Zdd d ZddZddZ dddZ e e j jfdZdS) TextBuffercCs&|j}|dkr"tj}|j||S)N) get_tag_tabler Z TextTagTableZ set_tag_table)r2tablerrr_get_or_create_tag_tables  z#TextBuffer._get_or_create_tag_tableNcKs&tjfd|i|}|jj||S)aCreates a tag and adds it to the tag table of the TextBuffer. :param str tag_name: Name of the new tag, or None :param **properties: Keyword list of properties and their values This is equivalent to creating a Gtk.TextTag and then adding the tag to the buffer's tag table. The returned tag is owned by the buffer's tag table. If ``tag_name`` is None, the tag is anonymous. If ``tag_name`` is not None, a tag called ``tag_name`` must not already exist in the tag table for this buffer. Properties are passed as a keyword list of names and values (e.g. foreground='DodgerBlue', weight=Pango.Weight.BOLD) :returns: A new tag. rI)r ZTextTagradd)r2Ztag_nameZ propertiestagrrr create_tagszTextBuffer.create_tagFcCstjj||||S)N)r r create_mark)r2Z mark_namewhereZ left_gravityrrrrszTextBuffer.create_markrcCstjj|||dS)N)r rset_text)r2rVrxrrrrszTextBuffer.set_textcCs0t|tstdt|tjj||||dS)Nztext must be a string, not %s)rrtr#rr rinsert)r2rDrVrxrrrrs zTextBuffer.insertcGsF|j}|j|||sdS|j|}x|D]}|j|||q,WdS)N)Z get_offsetrZget_iter_at_offsetZ apply_tag)r2rDrVtagsZ start_offsetstartrrrrinsert_with_tagss   zTextBuffer.insert_with_tagscGsPg}x4|D],}|jj|}|s,td||j|q W|j||f|dS)Nzunknown text tag: %s)rlookupr6rr)r2rDrVrZtag_objsrZtag_objrrrinsert_with_tags_by_names  z#TextBuffer.insert_with_tags_by_namecCs.t|tstdt|tjj|||dS)Nztext must be a string, not %s)rrtr#rr rinsert_at_cursor)r2rVrxrrrrs zTextBuffer.insert_at_cursor)rX)N)FrT)rTrT)rTrT)rT)rrrrrrrrrrrrr rrYrrrrrs      rc@s$eZdZeejjZeejjZdS)TextIterN)rrrrr rZforward_searchZbackward_searchrrrrrs rcseZdZddZddZeZddZddZd d Zd d Z d dZ ddZ e e jjZe e jjZe e jjZe e jjZe e jjedZfddZfddZfddZddZddZddZddZfd d!Zfd"d#Zfd$d%Zfd&d'Zfd(d)Z Z!S)* TreeModelcCs |jdS)N)Ziter_n_children)r2rrrrAszTreeModel.__len__cCsdS)NTr)r2rrrrFszTreeModel.__bool__c Cst|tjr|St|trv|dkrvt||}|dkrBtd|y|j|}Wn tk rptd|YnX|Sy|j|}Wn tk rtd|YnX|SdS)Nrzrow index is out of bounds: %dzcould not find tree path '%s')rr TreeIterintr"rget_iterr6)r2keyindexaiterrrr_getiters    zTreeModel._getitercCst|tjr|St|SdS)N)rr TreePath)r2pathrrr _coerce_path-s zTreeModel._coerce_pathcCs|j|}t||S)N)r TreeModelRow)r2rrrrr __getitem__3s zTreeModel.__getitem__cCs||}|j|j|dS)N)set_rowrD)r2rr<rowrrr __setitem__7szTreeModel.__setitem__cCs|j|}|j|dS)N)rremove)r2rrrrr __delitem__;s zTreeModel.__delitem__cCst||jS)N)TreeModelRowIterget_iter_first)r2rrrrE?szTreeModel.__iter__zinvalid tree pathcs2|j|}tt|j|\}}|s.td||S)Nzinvalid tree path '%s')rr0rrr6)r2rsuccessr)r4rrrIs   zTreeModel.get_itercs$|j}tt|j|}|r |SdS)N)rr0r iter_next)r2r next_iterr)r4rrrPszTreeModel.iter_nextcs$|j}tt|j|}|r |SdS)N)rr0r iter_previous)r2r prev_iterr)r4rrrVszTreeModel.iter_previouscCszt|trtd|j}t||kr.tdg}g}x:t|D].\}}|dkrRq@|j|j|||j|q@W||fS)Nz%Expected a list or tuple, but got strz1row sequence has the incorrect number of elements) rstrr# get_n_columnsr"r6 enumerater_convert_value)r2r n_columnsresultcolumnsZcur_colr<rrr _convert_row\s  zTreeModel._convert_rowcCs@|j|\}}x,|D]$}||}|dkr*q|j|||qWdS)N)r set_value)r2treeiterrZ converted_rowrcolumnr<rrrrps  zTreeModel.set_rowcCs"t|tjr|Stj|j||S)z5Convert value to a GObject.Value of the expected type)rrr7Zget_column_type)r2rr<rrrrys zTreeModel._convert_valuecGs^|j}g}xH|D]@}t|ts(td|dks8||kr@td|j|j||qWt|S)Nzcolumn numbers must be intsrzcolumn number is out of range)rrrr#r6rr:tuple)r2rrrvaluescolrrrrs  z TreeModel.getcstt|j|j||S)N)r0r row_changedr)r2rrD)r4rrrszTreeModel.row_changedcstt|j|j||S)N)r0r row_insertedr)r2rrD)r4rrrszTreeModel.row_insertedcstt|j|j||S)N)r0rrow_has_child_toggledr)r2rrD)r4rrrszTreeModel.row_has_child_toggledcstt|j|j|S)N)r0r row_deletedr)r2r)r4rrrszTreeModel.row_deletedcstt|j|j|||S)N)r0rrows_reorderedr)r2rrDZ new_order)r4rrrszTreeModel.rows_reordered)"rrrrArFrRrrrrrrErr rr iter_childrenZiter_nth_child iter_parentZget_iter_from_stringr6rrrrrrrrrrrrr>rr)r4rrs6            rcs<eZdZeejjddZdfdd Zd fdd ZZ S) TreeSortableN)rXcstt|j|||dS)N)r0r set_sort_func)r2Zsort_column_id sort_funcri)r4rrrszTreeSortable.set_sort_funccstt|j||dS)N)r0rset_default_sort_func)r2rri)r4rrrsz"TreeSortable.set_default_sort_func)NN)N)N) rrrrr rZget_sort_column_idrrr>rr)r4rrsrc@seZdZeejjdedZdS) TreeModelSortr)r_r`N)r)rrrrr rrarrrrrrsrc@s^eZdZddZddZdddZddd Zdd d Zdd d ZdddZ ddZ ddZ dS) ListStorecGstjj||j|dS)N)r rraset_column_types)r2 column_typesrrrras zListStore.__init__cCs8|dk r&|j|\}}|j|||}ntjj||}|S)N)rZinsert_with_valuesvr rr)r2rWrrrrrr _do_inserts zListStore._do_insertNcCs |r|jd|Stjj|SdS)NrrT)rr rr)r2rrrrrs zListStore.appendcCs |jd|S)Nr)r)r2rrrrprependszListStore.prependcCs |j||S)N)r)r2rWrrrrrszListStore.insertcCs&tjj||}|dk r"|j|||S)N)r r insert_beforer)r2siblingrrrrrrs zListStore.insert_beforecCs&tjj||}|dk r"|j|||S)N)r r insert_afterr)r2rrrrrrrs zListStore.insert_aftercCs"|j||}tjj||||dS)N)rr rr)r2rrr<rrrrs zListStore.set_valuecsfdd}|rt|dtr@||ddd|dddnlt|dttfrzt|dkrftd||d|dn2t|dtr|t|d|djntddS)Ncs|t|t|krtdg}g}xDt||D]6\}}t|tsFtd|j||jj||q,Wtjj ||dS)Nz7The number of columns do not match the number of valuesz0TypeError: Expected integer argument for column.) r"r#rrrrrr rset)colsvalsrrcol_numr<)r2rrr _set_listss  z!ListStore.set.._set_listsrrrzToo many argumentszArgument list must be in the form of (column, value, ...), ((columns,...), (values, ...)) or {column: value}. No -1 termination is needed.)rrrlistr"r#rr)r2rr(rr)r2rrrs  z ListStore.set)N)N)N)N)N) rrrrarrrrrrrrrrrrrs    rc@s|eZdZddZeddZeddZeddZed d Zd d Z d dZ ddZ ddZ ddZ ddZddZdS)rcCsht|tjstdt|j||_t|tjr>|j||_ n&t|tj rR||_ ntdt|jdS)Nz expected Gtk.TreeModel, %s foundz?expected Gtk.TreeIter or Gtk.TreePath, %s found) rr rr#rrrrrrDr)r2rZ iter_or_pathrrrras   zTreeModelRow.__init__cCs|jj|jS)N)rget_pathrD)r2rrrr&szTreeModelRow.pathcCs|jS)N)get_next)r2rrrnext*szTreeModelRow.nextcCs|jS)N) get_previous)r2rrrprevious.szTreeModelRow.previouscCs|jS)N) get_parent)r2rrrr2szTreeModelRow.parentcCs"|jj|j}|rt|j|SdS)N)rrrDr)r2rrrrr6szTreeModelRow.get_nextcCs"|jj|j}|rt|j|SdS)N)rrrDr)r2rrrrr ;szTreeModelRow.get_previouscCs"|jj|j}|rt|j|SdS)N)rrrDr)r2Z parent_iterrrrr @szTreeModelRow.get_parentcst|trH|jjkr&td|n|dkr8j|}jjj|St|tr|j jj\}}}g}x*t |||D]}|j jjj|qzW|St|t rfdd|DSt dt|jdS)Nz!column index is out of bounds: %drcsg|] }|qSrr)rHk)r2rrrJSsz,TreeModelRow.__getitem__..z0indices must be integers, slice or tuple, not %s)rrrrr_convert_negative_indexr:rDsliceindicesrangerrr#rr)r2rrstopstepZalistir)r2rrEs     zTreeModelRow.__getitem__c Cs>t|trL||jjkr&td|n|dkr8|j|}|jj|j||nt|tr|j |jj\}}}t |||}t |t |krt dt |t |fxt |D]\}}|jj|j|||qWnlt|tr(t |t |krt dt |t |fx4t||D]\} }||| <qWntdt|jdS)Nz!column index is out of bounds: %drz9attempt to assign sequence of size %d to slice of size %dzsz#TreePath.__new__..rz-could not parse subscript '%s' as a tree path) rrrrtjoinr"r#rZnew_from_string)clsrrrr__new__s      zTreePath.__new__cstt|jdS)N)r0rra)r2r(rP)r4rrraszTreePath.__init__cCs |jp dS)N)Z to_string)r2rrr__str__szTreePath.__str__cCs|dk o|j|dkS)Nr)compare)r2otherrrr__lt__szTreePath.__lt__cCs|dk o|j|dkS)Nr)r!)r2r"rrr__le__szTreePath.__le__cCs|dk o|j|dkS)Nr)r!)r2r"rrr__eq__szTreePath.__eq__cCs|dkp|j|dkS)Nr)r!)r2r"rrr__ne__szTreePath.__ne__cCs|dkp|j|dkS)Nr)r!)r2r"rrr__gt__szTreePath.__gt__cCs|dkp|j|dkS)Nr)r!)r2r"rrr__ge__szTreePath.__ge__cCs t|jS)N)rD get_indices)r2rrrrEszTreePath.__iter__cCs|jS)N)Z get_depth)r2rrrrAszTreePath.__len__cCs |j|S)N)r))r2rrrrrszTreePath.__getitem__)r)rrrrrar r#r$r%r&r'r(rErArr>rr)r4rrs rc@s^eZdZddZddZdddZddd Zdd d Zdd d ZdddZ ddZ ddZ dS) TreeStorecGstjj||j|dS)N)r r*rar)r2rrrrras zTreeStore.__init__cCs<|dk r(|j|\}}|j||||}ntjj|||}|S)N)rZinsert_with_valuesr r*r)r2rrWrrrrrrrs zTreeStore._do_insertNcCs|j|d|S)NrrT)r)r2rrrrrrszTreeStore.appendcCs|j|d|S)Nr)r)r2rrrrrrszTreeStore.prependcCs|j|||S)N)r)r2rrWrrrrrszTreeStore.insertcCs(tjj|||}|dk r$|j|||S)N)r r*rr)r2rrrrrrrrs zTreeStore.insert_beforecCs(tjj|||}|dk r$|j|||S)N)r r*rr)r2rrrrrrrrs zTreeStore.insert_aftercCs"|j||}tjj||||dS)N)rr r*r)r2rrr<rrrrs zTreeStore.set_valuecsfdd}|rt|dtr@||ddd|dddnlt|dttfrzt|dkrftd||d|dn2t|dtr||dj|djntddS)Ncs|t|t|krtdg}g}xDt||D]6\}}t|tsFtd|j||jj||q,Wtjj ||dS)Nz7The number of columns do not match the number of valuesz0TypeError: Expected integer argument for column.) r"r#rrrrrr r*r)rrrrrr<)r2rrrrs  z!TreeStore.set.._set_listsrrrzToo many argumentszArgument list must be in the form of (column, value, ...), ((columns,...), (values, ...)) or {column: value}. No -1 termination is needed.) rrrrr"r#rkeysr)r2rr(rr)r2rrrs  z TreeStore.set)N)N)N)N)N) rrrrarrrrrrrrrrrrr*s    r*cseZdZeejjdedZeejj Z eejj Z eejj Z fddZ fddZ dfd d Zdfd d Zdfdd ZddZZS)TreeViewr)r_r`cs t|}tt|j|||dS)N)rr0r,enable_model_drag_source)r2Zstart_button_maskractionsr)r4rrr-)s z!TreeView.enable_model_drag_sourcecst|}tt|j||dS)N)rr0r,enable_model_drag_dest)r2rr.r)r4rrr//s zTreeView.enable_model_drag_destNFcs0t|tjst|}tt|j|||||dS)N)rr rr0r,scroll_to_cell)r2rrZ use_alignZ row_alignZ col_align)r4rrr14s zTreeView.scroll_to_cellcs,t|tjst|}tt|j|||dS)N)rr rr0r, set_cursor)r2rrZ start_editing)r4rrr29s zTreeView.set_cursorcs&t|tjst|}tt|j||S)N)rr rr0r, get_cell_area)r2rr)r4rrr3>s zTreeView.get_cell_areacKs:t}|j||j|d|j|||j|f|dS)NF)TreeViewColumnZ set_title pack_startZ insert_columnset_attributes)r2rWrZcellrPrrrrinsert_column_with_attributesCs    z&TreeView.insert_column_with_attributes)r)NFr0r0)NF)N)rrrrr r,rarrZget_path_at_posrZget_dest_row_at_posr-r/r1r2r3r7r>rr)r4rr, s     r,cs<eZdZd ddZeejjZd fdd ZddZ Z S) r4rNcKsHtjj||d|r |j|dx"|jD]\}}|j|||q*WdS)N)rT)r r4rar5rN add_attribute)r2r cell_renderer attributesrIr<rrrraPs  zTreeViewColumn.__init__cstt|j|||dS)N)r0r4set_cell_data_func)r2r9funcZ func_data)r4rrr;\sz!TreeViewColumn.set_cell_data_funccKs:tjj||x&|jD]\}}tjj||||qWdS)N)r Z CellLayoutZclear_attributesrNr8)r2r9r:rIr<rrrr6_szTreeViewColumn.set_attributes)rN)N) rrrrarr r4Zcell_get_positionr;r6r>rr)r4rr4Os  r4cs4eZdZfddZfddZfddZZS) TreeSelectioncs(t|tjst|}tt|j|dS)N)rr rr0r= select_path)r2r)r4rrr>ls zTreeSelection.select_pathcs,tt|j\}}}|r ||fS|dfSdS)N)r0r= get_selected)r2rrr)r4rrr?qszTreeSelection.get_selectedcstt|j\}}||fS)N)r0r=get_selected_rows)r2rowsr)r4rrr@zszTreeSelection.get_selected_rows)rrrr>r?r@r>rr)r4rr=js  r=c@s*eZdZeejjd d eddZddZd S) Buttonr\stock use_stock use_underliner )r_rr`rcOsld|kr\|dr\tjdtdd|j}|d|d<d|d<d|d<|d=tjj|f|n |j||dS) NrCzKStock items are deprecated. Please use: Gtk.Button.new_with_mnemonic(label)r)rr\TrDrE)rrrrr rBrar)r2r(rPrrrrras  zButton.__init__N)r\rCrDrE)rC) rrrrr rBrarrrrrrrBs rBc@seZdZeejjdedZdS) LinkButtonurir\)r_r`N)rGr\)rrrrr rFrarrrrrrFsrFc@seZdZeejjdedZdS)Labelr\)r_r`N)r\)rrrrr rHrarrrrrrHsrHc@s0eZdZeejjdddd ed d Zd d ZdS) Adjustmentr<lowerupperstep_incrementpage_increment page_sizeZ page_incrZ step_incr)rMrLr )r_rr`rcOsB|j||d|kr$|j|dnt|dkr>|j|ddS)Nr<rr)rrr")r2r(rPrrrras   zAdjustment.__init__N)r<rJrKrLrMrN) rrrrr rIrarrrrrrrIsrIc@sPeZdZeejjd dddedZejj ejj Bejj ejj Bddfd d Z d S) Tablen_rowsrr|rAr)rPr)r_rr`rc Cs"tjj|||||||||| dS)N)r rOattach) r2rBZ left_attachZ right_attachZ top_attachZ bottom_attachZxoptionsZyoptionsZxpaddingZypaddingrrrrQsz Table.attachN)rPrr|) rrrrr rOrarZ AttachOptionsZEXPANDZFILLrQrrrrrOs rOc@seZdZeejjdedZdS)ScrolledWindow hadjustment vadjustment)r_r`N)rSrT)rrrrr rRrarrrrrrRsrRc@seZdZeejjdedZdS) HScrollbar adjustment)r_r`N)rV)rrrrr rUrarrrrrrUsrUc@seZdZeejjdedZdS) VScrollbarrV)r_r`N)rV)rrrrr rWrarrrrrrWsrWcs,eZdZdfdd Zdfdd ZZS) PanedFTcstt|j|||dS)N)r0rXpack1)r2rBresizeshrink)r4rrrYsz Paned.pack1cstt|j|||dS)N)r0rXpack2)r2rBrZr[)r4rrr\sz Paned.pack2)FT)TT)rrrrYr\r>rr)r4rrXsrXc@seZdZeejjdedZdS)Arrow arrow_type shadow_type)r_r`N)r^r_)rrrrr r]rarrrrrr]sr]cs&eZdZdddZfddZZS)IconSetNcCs6|dk r&tjdtddtjj|}n tjj|}|S)NzXGtk.IconSet(pixbuf) has been deprecated. Please use: Gtk.IconSet.new_from_pixbuf(pixbuf)r)r)rrrr r`Znew_from_pixbufr)rZpixbufZiconsetrrrrs   zIconSet.__new__cstt|jS)N)r0r`ra)r2r(rP)r4rrraszIconSet.__init__)N)rrrrrar>rr)r4rr` s r`c@seZdZeejjdedZdS)ViewportrSrT)r_r`N)rSrT)rrrrr rararrrrrrasracs&eZdZdfdd ZddZZS)TreeModelFilterNcstt|j||dS)N)r0rbset_visible_func)r2r<data)r4rrrc*sz TreeModelFilter.set_visible_funccCs |j|}|jj|||dS)N)Zconvert_iter_to_child_iterZ get_modelr)r2rDrr<rrrr-s zTreeModelFilter.set_value)N)rrrrcrr>rr)r4rrb)srbc@seZdZddZdS)MenucCs|jd||||||dS)N)Zpopup_for_device)r2Zparent_menu_shellZparent_menu_itemr<rdZbuttonZ activate_timerrrpopup8sz Menu.popupN)rrrrfrrrrre7srecGs tdS)N)_Gtk_main_quit)r(rrr main_quit@srhcOs2ttjt t||SQRXWdQRXdS)N)rr rhr _Gtk_main)r(rPrrrmainHs rj stock_lookupz4.0)r r)r rZ)r rZ)r rZ)r rZ)r rZ)r rZ)r rZ)[rsysrZ gi.repositoryrZ _ossighelperrrZ overridesrrrmoduler Zgir version_inforrtZ basestringr __all__Z_versionZwarn_msgrRuntimeWarningrrrr)r-r.r?rSr[rbrcrsrzr{r~rrrrrrrrrrrrrrrrrrrobjectrrrr*r,r4r=rBrFrHrIrOrRrUrWrXr]r`rarbrerhrgrjrirkZ init_checkargvZ initializedrrrrrs|          )     $          X              Q      S g  1 N +                            PK!CICI(__pycache__/GObject.cpython-36.opt-1.pycnu[3 <_e*@s~ddlZddlZddlmZddlZddlZddlmZmZddl m Z ddlm Z ddlm Z ddlmZddlmZejjd ZgZdd lmZeZx6dD].Zee eee<ed ed$eejeqWxXdD]PZej"ejdOe ee eee<WdQRXed ed$eejeqWxHdD]@Zejd\d]dZee eee<ed ed$eejeq0WxHdD]@Zejd\d]dZee eee<ed ed$eejeqzWejdpZ ejdqZ!ejdrZ"ejdsZ#ejdtZ$ejduZ%ejdvZ&ejdwZ'ejdxZ(ejdyZ)ejdzZ*ejd{Z+ejd|Z,ejd}Z-ejd~Z.ejdZ/ejdZ0ejdZ1ejdZ2ejdZ3ejd Z4ejdZ5ejdZ6ejdZ7ejdZ8ejdZ9ej:j;Zeee<ed edeejeqNWej>j?ej>j@BZAejdeBej>dred ddxLdD]DZejd\d]dZeejCeee<ed edeejeqWejDZDejEZEejFZFejGZGejHZHejIZIejJZJejKZKejLZLejMZMedd|d}drd dddddg 7ZejNZNejOZOejPZPejQZQe jRZRejSZSeddddddg7ZGddńdej:Z:ee:Z:ejdŃddDŽZejdǃddɄZTejdɃdd˄ZUdd̈́ZVejd̓ddτZWejdσddфZXejdуedddddddgZYdddڄZZejdڃGdd܄de[Z\ddބZ]ejdރddZ^ejdddZ_ejddddZ`ejddddZaejdejbZbejcZceddg7ZGddde[ZdddZeGdddejfZfeefZfefZHedd g7ZGdddejgZgeegZgejde jhZhejiZiejjZjehZked ddeddddg7ZdS(N) namedtuple)overridedeprecated_attr)GLib)PyGIDeprecationWarning)_propertyhelper) _signalhelper)_giGObject)_optionmarkup_escape_textget_application_nameset_application_name get_prgname set_prgname main_depthfilename_display_basenamefilename_display_namefilename_from_utf8uri_list_extract_urisMainLoop MainContextmain_context_default source_removeSourceIdleTimeoutPollFDidle_add timeout_addtimeout_add_seconds io_add_watchchild_watch_addget_current_time spawn_asynczGLib.PRIORITY_DEFAULTPRIORITY_DEFAULT_IDLE PRIORITY_HIGHPRIORITY_HIGH_IDLE PRIORITY_LOWIO_INIO_OUTIO_PRIIO_ERRIO_HUPIO_NVALIO_STATUS_ERRORIO_STATUS_NORMAL IO_STATUS_EOFIO_STATUS_AGAINIO_FLAG_APPENDIO_FLAG_NONBLOCKIO_FLAG_IS_READABLEIO_FLAG_IS_WRITEABLEIO_FLAG_IS_SEEKABLE IO_FLAG_MASKIO_FLAG_GET_MASKIO_FLAG_SET_MASKSPAWN_LEAVE_DESCRIPTORS_OPENSPAWN_DO_NOT_REAP_CHILDSPAWN_SEARCH_PATHSPAWN_STDOUT_TO_DEV_NULLSPAWN_STDERR_TO_DEV_NULLSPAWN_CHILD_INHERITS_STDINSPAWN_FILE_AND_ARGV_ZEROOPTION_FLAG_HIDDENOPTION_FLAG_IN_MAINOPTION_FLAG_REVERSEOPTION_FLAG_NO_ARGOPTION_FLAG_FILENAMEOPTION_FLAG_OPTIONAL_ARGOPTION_FLAG_NOALIASOPTION_ERROR_UNKNOWN_OPTIONOPTION_ERROR_BAD_VALUEOPTION_ERROR_FAILEDOPTION_REMAINING glib_versionignore G_MININT8 G_MAXINT8 G_MAXUINT8 G_MININT16 G_MAXINT16 G_MAXUINT16 G_MININT32 G_MAXINT32 G_MAXUINT32 G_MININT64 G_MAXINT64 G_MAXUINT64_ G_MINFLOAT G_MAXFLOAT G_MINDOUBLE G_MAXDOUBLE G_MINSHORT G_MAXSHORT G_MAXUSHORTG_MININTG_MAXINT G_MAXUINT G_MINLONG G_MAXLONG G_MAXULONG G_MAXSIZE G_MINSSIZE G_MAXSSIZE G_MINOFFSET G_MAXOFFSETZinvalidvoid GInterfaceZgcharZgucharZgbooleanZgintZguintZglongZgulongZgint64Zguint64GEnumGFlagsZgfloatZgdoubleZ gchararrayZgpointerGBoxedZGParamZPyObjectGTypeZGStrvZGVariantZGString TYPE_INVALID TYPE_NONETYPE_INTERFACE TYPE_CHAR TYPE_UCHAR TYPE_BOOLEANTYPE_INT TYPE_UINT TYPE_LONG TYPE_ULONG TYPE_INT64 TYPE_UINT64 TYPE_ENUM TYPE_FLAGS TYPE_FLOAT TYPE_DOUBLE TYPE_STRING TYPE_POINTER TYPE_BOXED TYPE_PARAM TYPE_OBJECT TYPE_PYOBJECT TYPE_GTYPE TYPE_STRV TYPE_VARIANT TYPE_GSTRING TYPE_UNICHAR TYPE_VALUEPidGError OptionGroup OptionContextPARAM_CONSTRUCTPARAM_CONSTRUCT_ONLYPARAM_LAX_VALIDATIONPARAM_READABLEPARAM_WRITABLEzGObject.ParamFlags.PARAM_READWRITEZ READWRITEz)GObject.ParamFlags.READWRITE (glib 2.42+) SIGNAL_ACTIONSIGNAL_DETAILEDSIGNAL_NO_HOOKSSIGNAL_NO_RECURSESIGNAL_RUN_CLEANUPSIGNAL_RUN_FIRSTSIGNAL_RUN_LASTzGObject.SignalFlags.GObjectWeakRef GParamSpecGPointerWarningfeatureslist_propertiesnewpygobject_version threads_init type_registercsNeZdZdddZfddZddZdd Zd d Zd d ZddZ Z S)ValueNcCs4tjj||dk r0|j||dk r0|j|dS)N) GObjectModuler__init__Zinit set_value)selfZ value_typepy_valuer/usr/lib64/python3.6/GObject.pyrs   zValue.__init__cs*|jr|jtkr|jtt|jdS)N)Z_free_on_deallocg_typervZunsetsuperr__del__)r) __class__rrrsz Value.__del__cCstj||dS)N)r Z _gvalue_set)rZboxedrrr set_boxedszValue.set_boxedcCs tj|S)N)r Z _gvalue_get)rrrr get_boxedszValue.get_boxedcCs|j}|tjkrtdnb|tkr2|j|nL|tkrH|j|n6|tkr^|j |n |t krt|j |n |t kr|j |n|tkr|j|n|tkr|j|n|tkr|j|n|tkr|j|n|tkr|j|n|tkr|j|nn|tkrt|tr0t|}nNtjdkrjt|trT|j d}nt!d|t"|fnt!d|t"|f|j#|n|t$kr|j%|n|j&t'r|j(|n|j&t)r|j*|n|j&t+r|j,|n|t-kr|j.|n|j&t/r|j0|nh|t1kr0|j t2|nN|t3krF|j4|n8|t5kr\|j6|n"|t7krr|j,|n td|dS) Nz+GObject.Value needs to be initialized firstrzUTF-8z'Expected string or unicode but got %s%szExpected string but got %s%szUnknown value type %s)rr)8rr rv TypeErrorr{Z set_booleanryZset_charrzZ set_ucharr|Zset_intr}Zset_uintr~Zset_longrZ set_ulongrZ set_int64rZ set_uint64rZ set_floatrZ set_doubler isinstancestrsys version_infoZunicodeencode ValueErrortypeZ set_stringrZ set_paramis_arZset_enumrZ set_flagsrrrZ set_pointerrZ set_objectrintrZ set_gtyperZ set_variantr)rrgtyperrrrsr                             zValue.set_valuecCs|j}|tkr|jS|tkr&|jS|tkr6|jS|tkrF|jS|t krV|j S|t krf|j S|t krv|jS|tkr|jS|tkr|jS|tkr|jS|tkr|jS|tkr|jS|tkr|jS|jtr|jS|jtr|jS|jt r|j!S|t"kr&|j#S|jt$r:|j%S|t&krL|j S|t'kr^|j(S|t)krp|j*S|t+kr|ndSdS)N),rr{Z get_booleanryZget_charrzZ get_ucharr|Zget_intr}Zget_uintr~Zget_longrZ get_ulongrZ get_int64rZ get_uint64rZ get_floatrZ get_doublerZ get_stringrZ get_paramrrZget_enumrZ get_flagsrrrZ get_pointerrZ get_objectrrZ get_gtyperZ get_variantr)rrrrr get_value-s\          zValue.get_valuecCsd|jj|jfS)Nz)rnamer)rrrr__repr___szValue.__repr__)NN) __name__ __module__ __qualname__rrrrrrr __classcell__rr)rrrs  A2rcCs"tj|}|tkrtd||S)Nzunknown type name: %s)rtype_from_namerv RuntimeError)rtype_rrrrgs  rcCstj|}|tkrtd|S)Nzno parent for type)r type_parentrvr)rparentrrrrqs rcCs4t|dr|j}|j r0|j r0td|dS)N __gtype__z1type must be instantiable or an interface, got %s)hasattrrZis_instantiatableZ is_interfacer)rrrr _validate_type_for_signal_method{s rcCst|tj|S)N)rrsignal_list_ids)rrrrrsrcCst|}tdd|DS)Ncss|]}tj|VqdS)N)r signal_name).0irrr sz$signal_list_names..)rtuple)rZidsrrrsignal_list_namessrcCst|tj||S)N)rr signal_lookup)rrrrrrsr SignalQuery signal_idritype signal_flags return_type param_typescCsX|dk rt||}tj|}|dkr(dS|jdkr6dSt|j|j|j|j|jt |j S)Nr) rr signal_queryrrrrrrrr)Z id_or_namerresrrrrs   rc@s$eZdZddZddZddZdS)_HandlerBlockManagercCs||_||_dS)N)obj handler_id)rrrrrrrsz_HandlerBlockManager.__init__cCsdS)Nr)rrrr __enter__sz_HandlerBlockManager.__enter__cCstj|j|jdS)N)rsignal_handler_unblockrr)rexc_type exc_value tracebackrrr__exit__sz_HandlerBlockManager.__exit__N)rrrrrrrrrrrsrcCstj||t||S)aBlocks the signal handler from being invoked until handler_unblock() is called. :param GObject.Object obj: Object instance to block handlers for. :param int handler_id: Id of signal to block. :returns: A context manager which optionally can be used to automatically unblock the handler: .. code-block:: python with GObject.signal_handler_block(obj, id): pass )rsignal_handler_blockr)rrrrrrs rcCs4tj|||\}}}|r ||fStd||fdS)a%Parse a detailed signal name into (signal_id, detail). :param str detailed_signal: Signal name which can include detail. For example: "notify:prop_name" :returns: Tuple of (signal_id, detail) :raises ValueError: If the given signal is unknown. z%s: unknown signal name: %sN)rsignal_parse_namer)detailed_signalrZforce_detail_quarkrrdetailrrrrs  rcCs t||d\}}tj||dS)NT)rrZsignal_remove_emission_hook)rrZhook_idrrrrrremove_emission_hooksrcCsd|fS)NFr)ihint return_accuhandler_return user_datarrrsignal_accumulator_first_winssrcCs | |fS)Nr)rrrrrrrsignal_accumulator_true_handledsradd_emission_hook signal_newc@s$eZdZddZddZddZdS)_FreezeNotifyManagercCs ||_dS)N)r)rrrrrrsz_FreezeNotifyManager.__init__cCsdS)Nr)rrrrrsz_FreezeNotifyManager.__enter__cCs|jjdS)N)rZ thaw_notify)rrrrrrrrsz_FreezeNotifyManager.__exit__N)rrrrrrrrrrrsrcstjjfdd}|S)Ncs ||S)Nr)argskwargs)funcrrmeth'sz_signalmethod..meth)giZ overrideswraps)rrr)rr _signalmethod#srcsjeZdZddZddZeZeZeZeZeZ eZ eZ eZ eZ eZeZeZeZeZeZejjZejjZejjZejjZeZeZeZeZejj Z ejj!Z!ejj"Z"ejj#Z#ejj$Z$ejj%Z%ejj&Z&ejj'Z'ejj(Z(ejj)Z)ejj*Z*ejj+Z+ejj,Z,ejj-Z-ejj.Z.ejj/Z/ejj0Z0fddZ1ddZ2e3Z4e5ej6Z7e5ej8Z9e5ej8Z:e5ej;Zd d Z?e?Z@ZAS) ObjectcOs tddS)Nz%This method is currently unsupported.)r)rrkargsrrr_unsupported_method.szObject._unsupported_methodcOs tddS)NzIData access methods are unsupported. Use normal Python attributes instead)r)rrrrrr_unsupported_data_method1szObject._unsupported_data_methodcstt|jt|S)aFreezes the object's property-changed notification queue. :returns: A context manager which optionally can be used to automatically thaw notifications. This will freeze the object so that "notify" signals are blocked until the thaw_notify() method is called. .. code-block:: python with obj.freeze_notify(): pass )rr freeze_notifyr)r)rrrriszObject.freeze_notifycst|jdd}|tjj@r"tjj}ntjj}|tjj@r^t |dkrPt d|gfdd}n}||||f|S)aConnect a callback to the given signal with optional user data. :param str detailed_signal: A detailed signal to connect to. :param callable handler: Callback handler to connect to the signal. :param *data: Variable data which is passed through to the signal handler. :param GObject.ConnectFlags connect_flags: Flags used for connection options. :returns: A signal id which can be used with disconnect. Z connect_flagsrr]zWUsing GObject.ConnectFlags.SWAPPED requires exactly one argument for user data, got: %scs(t|}|j}||g}|f|S)N)listpop)rrZswap)handlerrr new_handlers z(Object.connect_data..new_handler) getrZ ConnectFlagsZAFTERr r connect_afterconnectZSWAPPEDlenr)rrr datarflagsZ connect_funcr r)r r connect_data{s      zObject.connect_datacCstj|jjtdd|j|S)z-Deprecated, please use stop_emission_by_name.) stacklevel)warningswarn stop_emission__doc__rstop_emission_by_name)rrrrrrszObject.stop_emission)Brrrrrget_dataZ get_qdataset_dataZ steal_dataZ steal_qdataZ replace_dataZ replace_qdataZbind_property_fullZcompat_controlZinterface_find_propertyZinterface_install_propertyZinterface_list_propertiesZnotify_by_pspecZ run_disposeZ watch_closurerrrefZ_refZref_sinkZ _ref_sinkZunrefZ_unrefZforce_floatingZ_force_floatingr r Z get_propertyZget_propertiesZ set_propertyZset_propertiesZ bind_propertyrrZconnect_objectZconnect_object_afterZdisconnect_by_funcZhandler_block_by_funcZhandler_unblock_by_funcemitchainZweak_ref__copy__ __deepcopy__rrrZ handler_blockrrZhandler_unblockZsignal_handler_disconnectZ disconnectZhandler_disconnectZsignal_handler_is_connectedZhandler_is_connectedZsignal_stop_emission_by_namerrZemit_stop_by_namerrr)rrr-sh )     rcs$eZdZddZfddZZS)BindingcCstjdtdd|S)NzUsing parentheses (binding()) to retrieve the Binding object is no longer needed because the binding is returned directly from "bind_property.r)r)rrr)rrrr__call__s zBinding.__call__cs2t|drtdnt|ddtt|jdS)NZ_unboundz$binding has already been cleared outT)rrsetattrrr"unbind)r)rrrr%s   zBinding.unbind)rrrr#r%rrr)rrr"sr"propertyzGObject.PropertyPropertySignalSignalOverride)r r rrrrrrrrrrrrrrrrrrr r!r"r#r$)*r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrN) rPrQrRrSrTrUrVrWrXrYrZr[)r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnror*)rrrr)rrrrrr*)rrrrrrrr*)N)N)N)lrr collectionsrZ gi.overridesrZ gi.modulerrZ gi.repositoryrrrZpropertyhelperrZ signalhelperr moduleZget_introspection_moduler__all__r Zoptionrgetattrglobalsappendcatch_warnings simplefiltersplitnew_namerrvrwrxryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrZ ParamFlagsZREADABLEZWRITABLErrZ SignalFlagsrtrrrsrqr rrrrurrrrrrrrrrrrrrobjectrrrrrrrrrrrr"r'r(r)r&rrrrs                                                                    PK!?d(__pycache__/keysyms.cpython-36.opt-1.pycnu[3 <_@sddlZddlZddlmZedZejdeedZej eZ xPe eD]DZ e j drNe ddZedd kr|d eZeee Zee eeqNWd Zd Zd ZdZdZdZdZdZdZdZdZdS)N)get_introspection_moduleGdkz?keysyms has been deprecated. Please use Gdk.KEY_ instead.__name__ZKEY_ 0123456789_iiiiiiiiii)syswarningsmodulerrwarnRuntimeWarningglobalsZ_modnamemodulesZ_keysymsdirname startswithtargetgetattrvaluesetattrZArmenian_eternityZArmenian_section_signZArmenian_parenleftZArmenian_guillemotrightZArmenian_guillemotleftZArmenian_em_dashZ Armenian_dotZArmenian_mijaketZArmenian_commaZArmenian_en_dashZArmenian_ellipsisrr/usr/lib64/python3.6/keysyms.pys2       PK!U鶒--__pycache__/Gdk.cpython-36.pycnu[3 <__=@sddlZddlZddlmZmZddlmZddlmZm Z edZ gZ y e de j ddl mZeWneefk rYnXee d rGd d d e jZeeZe jd ee d rGd d d e jZeeZe jd e j d krGddde jZeeZe jdnNee ds:ddl mZejZe jdn$e jjZe jjZe jde jde j d krGddde jZeeZe jdn$Gddde jZeeZe jdee j de j _!ee j de j _"Gddde j#Z#ee#Z#e jde$dZ%ej&e%Zddddd d!d"d#d$d%d&d'd(d)d*d+d,d-gZ'e j d krJe'jd.ee d/r`e'jd/d0d1d2d3gZ(xe'D]Z)e*e)ee e)fiZ+xTe j#j,j-D]DZ.e.j/Z0ee j#e0Z1ee1d4e1Z1e0e(kree1Z1e2e+e0e1qWe2ee)e+e je)qrWGd5d6d6e j3Z3ee3Z3e jd6Gd7d8d8e j4Z4ee4Z4e jd8ee d9rdee j5Z5e jd9d:d;Z6dkre j;d?d@Ze jdEe j;dFd@Z?e jdGe j;dHd@Z@e jdIe j;dJd@ZAe jdKe j;dLd@ZBe jdMe j;dNd@ZCe jdOe j;dPd@ZDe jdQe j;dFd@ZEe jdRe j;dHd@ZFe jdSe j;dJd@ZGe jdTe j;dUd@ZHe jdVe j;dLd@ZIe jdWe j;dXd@ZJe jdYe j;dNd@ZKe jdZe j d[krddlZe jLejM\ZNZMdS)\N)overridestrip_boolean_result)get_introspection_module)PyGIDeprecationWarningrequire_versionGdkGdkX11)r Colorc@sxeZdZdZddZddZddZedd d d d Zed d d d d Z edd dd d Z ddZ e ddZ dS)r icCs"tjj|||_||_||_dS)N)rr __init__redgreenblue)selfr r rr/usr/lib64/python3.6/Gdk.pyr /s zColor.__init__cCs |j|S)N)equal)rotherrrr__eq__5sz Color.__eq__cCsd|j|j|jfS)Nz$Gdk.Color(red=%d, green=%d, blue=%d))r r r)rrrr__repr__8szColor.__repr__cCs|jt|jS)N)r float MAX_VALUE)rrrr;szColor.cCst|dt||jS)Nr )setattrintr)rvrrrr<s)fgetfsetcCs|jt|jS)N)r rr)rrrrr>scCst|dt||jS)Nr )rrr)rrrrrr?scCs|jt|jS)N)rrr)rrrrrAscCst|dt||jS)Nr)rrr)rrrrrrBscCs|j|j|jfS)z3Return (red_float, green_float, blue_float) triple.) red_float green_float blue_float)rrrr to_floatsDszColor.to_floatscCs*tt|tjt|tjt|tjS)zEReturn a new Color object from red/green/blue values from 0.0 to 1.0.)r rr)r r rrrr from_floatsIs zColor.from_floatsN)__name__ __module__ __qualname__rr rrpropertyrrr r! staticmethodr"rrrrr ,s   RGBAc@sBeZdZdddZddZddZdd Zd d Zed d Z dS)r(?cCs(tjj|||_||_||_||_dS)N)rr(r r r ralpha)rr r rr*rrrr Ws  z RGBA.__init__cCs |j|S)N)r)rrrrrr^sz RGBA.__eq__cCsd|j|j|j|jfS)Nz-Gdk.RGBA(red=%f, green=%f, blue=%f, alpha=%f))r r rr*)rrrrrasz RGBA.__repr__ccs$|jV|jV|jV|jVdS)z>Iterator which allows easy conversion to tuple and list types.N)r r rr*)rrrr__iter__dsz RGBA.__iter__cCs0tt|jtjt|jtjt|jtjS)z>Converts this RGBA into a Color instance which excludes alpha.)r rr rr r)rrrrto_colorlsz RGBA.to_colorcCs||j|j|jS)z3Returns a new RGBA instance given a Color instance.)rrr )clsZcolorrrr from_colorsszRGBA.from_colorN)r)r)r)r)) r#r$r%r rrr+r, classmethodr.rrrrr(Vs  2.0c@seZdZddZddZdS) RectanglecCs(tjj|||_||_||_||_dS)N)rr1r xywidthheight)rr2r3r4r5rrrr s  zRectangle.__init__cCsd|j|j|j|jfS)Nz.Gdk.Rectangle(x=%d, y=%d, width=%d, height=%d))r2r3r5r4)rrrrrszRectangle.__repr__N)r#r$r%r rrrrrr1}sr1)cairorectangle_intersectrectangle_unionc@seZdZddZdS)DrawablecCs tj|S)N)r cairo_create)rrrrr:szDrawable.cairo_createN)r#r$r%r:rrrrr9sr9c@s$eZdZddZddZddZdS)WindowcCstjj|||S)N)rr;new)r-parent attributesattributes_maskrrr__new__szWindow.__new__cCsdS)Nr)rr=r>r?rrrr szWindow.__init__cCs tj|S)N)rr:)rrrrr:szWindow.cairo_createN)r#r$r%r@r r:rrrrr;sr;Z 2BUTTON_PRESSZ 3BUTTON_PRESSc<@sheZdZejjdejjdejjdejjdejj dejj dejj dejj dejj dejjdejjdejjdejjdejjdejjdejjdejjd ejjd ejjd ejjd ejjd ejjd ejjd ejjd ejjd ejjd ejjd ejj d ejj!d ejj"diZ#ej$dkrde#ejj%<e&ejdrLe#j'ejj(dejj)dejj*dejj+diddZ,ddZ-ddZ.dS)EventanyZexposeZmotionZbuttonkeyZcrossingZ focus_changeZ configurer&Z selectionZ proximityZdndZclientZ visibilityz2.0Z no_expose TOUCH_BEGINZtouchcCs>t|dj|j}|r&tt|||Std|jj|fdS)N_UNION_MEMBERSz!'%s' object has no attribute '%s')getattrgettypeAttributeError __class__r#)rname real_eventrrr __getattr__szEvent.__getattr__cCs>t|dj|j}|r*tt||||ntjj|||dS)NrE)rFrGrHrrrA __setattr__)rrKvaluerLrrrrNszEvent.__setattr__cCs tjj|jd}d||jfS)Nz>)rrArstriprH)rZ base_reprrrrrszEvent.__repr__N)/r#r$r%r EventTypeZDELETEZDESTROYZEXPOSEZ MOTION_NOTIFYZ BUTTON_PRESS_2BUTTON_PRESS_3BUTTON_PRESSZBUTTON_RELEASEZ KEY_PRESSZ KEY_RELEASEZ ENTER_NOTIFYZ LEAVE_NOTIFYZ FOCUS_CHANGEZ CONFIGUREZMAPZUNMAPZPROPERTY_NOTIFYZSELECTION_CLEARZSELECTION_REQUESTZSELECTION_NOTIFYZ PROXIMITY_INZ PROXIMITY_OUTZ DRAG_ENTERZ DRAG_LEAVEZ DRAG_MOTIONZ DRAG_STATUSZ DROP_STARTZ DROP_FINISHEDZ CLIENT_EVENTZVISIBILITY_NOTIFYrE_versionZ NO_EXPOSEhasattrupdaterDZ TOUCH_UPDATEZ TOUCH_ENDZ TOUCH_CANCELrMrNrrrrrrAsR   rAr#ZEventAnyZ EventExposeZEventVisibilityZ EventMotionZ EventButtonZ EventScrollZEventKeyZ EventCrossingZ EventFocusZEventConfigureZ EventPropertyZEventSelectionZEventOwnerChangeZEventProximityZEventDNDZEventWindowStateZ EventSettingZEventGrabBrokenZ EventNoExposeZ EventTouchZ get_stateZget_axisZ get_coordsZget_root_coords__func__c@seZdZddZdS) DragContextcCstd}|j||||dS)NGtk)rZ drag_finish)rsuccessZdel_ZtimerYrrrfinish:szDragContext.finishN)r#r$r%r[rrrrrX9srXc@seZdZddZdS)CursorcOst|}t|}||}|dkr>tjdkr2td|j||S|dkr^tjdt|j||S|dkr~tjdt|j ||S|dkrtjd krtdtjd t|j ||StddS) Nz4.0zWrong number of parametersrzCalling "Gdk.Cursor(display, cursor_type)" has been deprecated. Please use Gdk.Cursor.new_for_display(display, cursor_type). See: https://wiki.gnome.org/PyGObject/InitializerDeprecationszCalling "Gdk.Cursor(display, pixbuf, x, y)" has been deprecated. Please use Gdk.Cursor.new_from_pixbuf(display, pixbuf, x, y). See: https://wiki.gnome.org/PyGObject/InitializerDeprecationsz2.0zCalling "Gdk.Cursor(source, mask, fg, bg, x, y)" has been deprecated. Please use Gdk.Cursor.new_from_pixmap(source, mask, fg, bg, x, y). See: https://wiki.gnome.org/PyGObject/InitializerDeprecations) lenrrT ValueErrorr<warningswarnrZnew_for_displayZnew_from_pixbufZnew_from_pixmap)r-argskwdsZarg_lenZkwd_lenZ total_lenrrrr@Es,      zCursor.__new__N)r#r$r%r@rrrrr\Csr\ color_parsecCs|j}|r|Sdt|S)Nz Gdk.Atom<%i>)rKhash)atomnrrr _gdk_atom_strzsrjcCs |j}|rd|Sdt|S)NzGdk.Atom.intern("%s", False)z)rKrg)rhrirrr_gdk_atom_reprsrk3.0ZPRIMARYTSELECTION_PRIMARYZ SECONDARYSELECTION_SECONDARYZ CLIPBOARDSELECTION_CLIPBOARDZBITMAP TARGET_BITMAPZCOLORMAPTARGET_COLORMAPZDRAWABLETARGET_DRAWABLEZPIXMAP TARGET_PIXMAPSTRING TARGET_STRINGZATOMSELECTION_TYPE_ATOMSELECTION_TYPE_BITMAPSELECTION_TYPE_COLORMAPSELECTION_TYPE_DRAWABLEZINTEGERSELECTION_TYPE_INTEGERSELECTION_TYPE_PIXMAPZWINDOWSELECTION_TYPE_WINDOWSELECTION_TYPE_STRING)r0rl)OsysrbZ overridesrrmodulerZgirrr__all__rTZ gi.repositoryr ra ImportErrorrUr appendr(r1r6Z_cairoZ RectangleIntZ intersectr7unionr8r9r;rFrQrRrSrAglobalsmodnamemodulesZevent_member_classesZgsuccess_mask_funcsZ event_classrHZoverride_classZ__info__Z get_methodsZ method_infoZget_namerKZ event_methodrrXr\rfrjrkZAtom__str__rZ atom_internrmrnrorprqrrrsrurvrwrxryrzr{r|r}Z init_checkargvZ initializedrrrrs    %  #             A             ,                                      PK!塟-__pycache__/GIMarshallingTests.cpython-36.pycnu[3 <_@s~ddlmZddlmZedZgZdZejdGdddejZeeZejdGdd d ej Z ee Z ejd d S) )override)get_introspection_moduleGIMarshallingTestsOVERRIDES_CONSTANTc@s$eZdZddZddZddZdS)OverridesStructcCs tjj|S)N)rr__new__)clslong_r */usr/lib64/python3.6/GIMarshallingTests.pyr"szOverridesStruct.__new__cCstjj|||_dS)N)rr__init__r )selfr r r r r %s zOverridesStruct.__init__cCstjj|dS)Nr)rrmethod)rr r r r)szOverridesStruct.methodN)__name__ __module__ __qualname__rr rr r r r r src@s0eZdZddZddZeddZddZd S) OverridesObjectcCs tjj|S)N)rrr)r r r r r r3szOverridesObject.__new__cCstjj|dS)N)rrr )rr r r r r 6szOverridesObject.__init__cCstjj}|S)N)rrnew)r r rr r r r;s zOverridesObject.newcCstjj|dS)zOverridden doc string.r)rrr)rr r r rBszOverridesObject.methodN)rrrrr classmethodrrr r r r r1s rN) Z overridesrmodulerr__all__rappendrrr r r r s     PK!E ++&__pycache__/Pango.cpython-36.opt-1.pycnu[3 <_@spddlmZddlmZedZgZGdddejZeeZejdGdddejZeeZejddS) )override)get_introspection_modulePangocs&eZdZdddZfddZZS)FontDescriptionNcCs"|dk rtj|Stjj|SdS)N)rZfont_description_from_stringr__new__)clsstringr /usr/lib64/python3.6/Pango.pyrs zFontDescription.__new__cstt|jS)N)superr__init__)selfargskwargs) __class__r r r %szFontDescription.__init__)N)__name__ __module__ __qualname__rr __classcell__r r )rr rs rcs&eZdZddZdfdd ZZS)LayoutcCs tjj|S)N)rrnew)rcontextr r r r/szLayout.__new__cstt|j||dS)N)r r set_markup)r textZlength)rr r r2szLayout.set_markup)r)rrrrrrr r )rr r-srN) Z overridesrmodulerr__all__rappendrr r r r s     PK!`̬{ee GObject.pynu[# -*- Mode: Python; py-indent-offset: 4 -*- # vim: tabstop=4 shiftwidth=4 expandtab # # Copyright (C) 2012 Canonical Ltd. # Author: Martin Pitt # Copyright (C) 2012-2013 Simon Feltman # Copyright (C) 2012 Bastian Winkler # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA import sys import warnings from collections import namedtuple import gi.overrides import gi.module from gi.overrides import override, deprecated_attr from gi.repository import GLib from gi import PyGIDeprecationWarning from gi import _propertyhelper as propertyhelper from gi import _signalhelper as signalhelper from gi import _gi GObjectModule = gi.module.get_introspection_module('GObject') __all__ = [] from gi import _option as option option = option # API aliases for backwards compatibility for name in ['markup_escape_text', 'get_application_name', 'set_application_name', 'get_prgname', 'set_prgname', 'main_depth', 'filename_display_basename', 'filename_display_name', 'filename_from_utf8', 'uri_list_extract_uris', 'MainLoop', 'MainContext', 'main_context_default', 'source_remove', 'Source', 'Idle', 'Timeout', 'PollFD', 'idle_add', 'timeout_add', 'timeout_add_seconds', 'io_add_watch', 'child_watch_add', 'get_current_time', 'spawn_async']: globals()[name] = getattr(GLib, name) deprecated_attr("GObject", name, "GLib." + name) __all__.append(name) # deprecated constants for name in ['PRIORITY_DEFAULT', 'PRIORITY_DEFAULT_IDLE', 'PRIORITY_HIGH', 'PRIORITY_HIGH_IDLE', 'PRIORITY_LOW', 'IO_IN', 'IO_OUT', 'IO_PRI', 'IO_ERR', 'IO_HUP', 'IO_NVAL', 'IO_STATUS_ERROR', 'IO_STATUS_NORMAL', 'IO_STATUS_EOF', 'IO_STATUS_AGAIN', 'IO_FLAG_APPEND', 'IO_FLAG_NONBLOCK', 'IO_FLAG_IS_READABLE', 'IO_FLAG_IS_WRITEABLE', 'IO_FLAG_IS_SEEKABLE', 'IO_FLAG_MASK', 'IO_FLAG_GET_MASK', 'IO_FLAG_SET_MASK', 'SPAWN_LEAVE_DESCRIPTORS_OPEN', 'SPAWN_DO_NOT_REAP_CHILD', 'SPAWN_SEARCH_PATH', 'SPAWN_STDOUT_TO_DEV_NULL', 'SPAWN_STDERR_TO_DEV_NULL', 'SPAWN_CHILD_INHERITS_STDIN', 'SPAWN_FILE_AND_ARGV_ZERO', 'OPTION_FLAG_HIDDEN', 'OPTION_FLAG_IN_MAIN', 'OPTION_FLAG_REVERSE', 'OPTION_FLAG_NO_ARG', 'OPTION_FLAG_FILENAME', 'OPTION_FLAG_OPTIONAL_ARG', 'OPTION_FLAG_NOALIAS', 'OPTION_ERROR_UNKNOWN_OPTION', 'OPTION_ERROR_BAD_VALUE', 'OPTION_ERROR_FAILED', 'OPTION_REMAINING', 'glib_version']: with warnings.catch_warnings(): # TODO: this uses deprecated Glib attributes, silence for now warnings.simplefilter('ignore', PyGIDeprecationWarning) globals()[name] = getattr(GLib, name) deprecated_attr("GObject", name, "GLib." + name) __all__.append(name) for name in ['G_MININT8', 'G_MAXINT8', 'G_MAXUINT8', 'G_MININT16', 'G_MAXINT16', 'G_MAXUINT16', 'G_MININT32', 'G_MAXINT32', 'G_MAXUINT32', 'G_MININT64', 'G_MAXINT64', 'G_MAXUINT64']: new_name = name.split("_", 1)[-1] globals()[name] = getattr(GLib, new_name) deprecated_attr("GObject", name, "GLib." + new_name) __all__.append(name) # these are not currently exported in GLib gir, presumably because they are # platform dependent; so get them from our static bindings for name in ['G_MINFLOAT', 'G_MAXFLOAT', 'G_MINDOUBLE', 'G_MAXDOUBLE', 'G_MINSHORT', 'G_MAXSHORT', 'G_MAXUSHORT', 'G_MININT', 'G_MAXINT', 'G_MAXUINT', 'G_MINLONG', 'G_MAXLONG', 'G_MAXULONG', 'G_MAXSIZE', 'G_MINSSIZE', 'G_MAXSSIZE', 'G_MINOFFSET', 'G_MAXOFFSET']: new_name = name.split("_", 1)[-1] globals()[name] = getattr(GLib, new_name) deprecated_attr("GObject", name, "GLib." + new_name) __all__.append(name) TYPE_INVALID = GObjectModule.type_from_name('invalid') TYPE_NONE = GObjectModule.type_from_name('void') TYPE_INTERFACE = GObjectModule.type_from_name('GInterface') TYPE_CHAR = GObjectModule.type_from_name('gchar') TYPE_UCHAR = GObjectModule.type_from_name('guchar') TYPE_BOOLEAN = GObjectModule.type_from_name('gboolean') TYPE_INT = GObjectModule.type_from_name('gint') TYPE_UINT = GObjectModule.type_from_name('guint') TYPE_LONG = GObjectModule.type_from_name('glong') TYPE_ULONG = GObjectModule.type_from_name('gulong') TYPE_INT64 = GObjectModule.type_from_name('gint64') TYPE_UINT64 = GObjectModule.type_from_name('guint64') TYPE_ENUM = GObjectModule.type_from_name('GEnum') TYPE_FLAGS = GObjectModule.type_from_name('GFlags') TYPE_FLOAT = GObjectModule.type_from_name('gfloat') TYPE_DOUBLE = GObjectModule.type_from_name('gdouble') TYPE_STRING = GObjectModule.type_from_name('gchararray') TYPE_POINTER = GObjectModule.type_from_name('gpointer') TYPE_BOXED = GObjectModule.type_from_name('GBoxed') TYPE_PARAM = GObjectModule.type_from_name('GParam') TYPE_OBJECT = GObjectModule.type_from_name('GObject') TYPE_PYOBJECT = GObjectModule.type_from_name('PyObject') TYPE_GTYPE = GObjectModule.type_from_name('GType') TYPE_STRV = GObjectModule.type_from_name('GStrv') TYPE_VARIANT = GObjectModule.type_from_name('GVariant') TYPE_GSTRING = GObjectModule.type_from_name('GString') TYPE_VALUE = GObjectModule.Value.__gtype__ TYPE_UNICHAR = TYPE_UINT __all__ += ['TYPE_INVALID', 'TYPE_NONE', 'TYPE_INTERFACE', 'TYPE_CHAR', 'TYPE_UCHAR', 'TYPE_BOOLEAN', 'TYPE_INT', 'TYPE_UINT', 'TYPE_LONG', 'TYPE_ULONG', 'TYPE_INT64', 'TYPE_UINT64', 'TYPE_ENUM', 'TYPE_FLAGS', 'TYPE_FLOAT', 'TYPE_DOUBLE', 'TYPE_STRING', 'TYPE_POINTER', 'TYPE_BOXED', 'TYPE_PARAM', 'TYPE_OBJECT', 'TYPE_PYOBJECT', 'TYPE_GTYPE', 'TYPE_STRV', 'TYPE_VARIANT', 'TYPE_GSTRING', 'TYPE_UNICHAR', 'TYPE_VALUE'] # Deprecated, use GLib directly for name in ['Pid', 'GError', 'OptionGroup', 'OptionContext']: globals()[name] = getattr(GLib, name) deprecated_attr("GObject", name, "GLib." + name) __all__.append(name) # Deprecated, use: GObject.ParamFlags.* directly for name in ['PARAM_CONSTRUCT', 'PARAM_CONSTRUCT_ONLY', 'PARAM_LAX_VALIDATION', 'PARAM_READABLE', 'PARAM_WRITABLE']: new_name = name.split("_", 1)[-1] globals()[name] = getattr(GObjectModule.ParamFlags, new_name) deprecated_attr("GObject", name, "GObject.ParamFlags." + new_name) __all__.append(name) # PARAM_READWRITE should come from the gi module but cannot due to: # https://bugzilla.gnome.org/show_bug.cgi?id=687615 PARAM_READWRITE = GObjectModule.ParamFlags.READABLE | \ GObjectModule.ParamFlags.WRITABLE __all__.append("PARAM_READWRITE") # READWRITE is part of ParamFlags since glib 2.42. Only mark PARAM_READWRITE as # deprecated in case ParamFlags.READWRITE is available. Also include the glib # version in the warning so it's clear that this needs a newer glib, unlike # the other ParamFlags related deprecations. # https://bugzilla.gnome.org/show_bug.cgi?id=726037 if hasattr(GObjectModule.ParamFlags, "READWRITE"): deprecated_attr("GObject", "PARAM_READWRITE", "GObject.ParamFlags.READWRITE (glib 2.42+)") # Deprecated, use: GObject.SignalFlags.* directly for name in ['SIGNAL_ACTION', 'SIGNAL_DETAILED', 'SIGNAL_NO_HOOKS', 'SIGNAL_NO_RECURSE', 'SIGNAL_RUN_CLEANUP', 'SIGNAL_RUN_FIRST', 'SIGNAL_RUN_LAST']: new_name = name.split("_", 1)[-1] globals()[name] = getattr(GObjectModule.SignalFlags, new_name) deprecated_attr("GObject", name, "GObject.SignalFlags." + new_name) __all__.append(name) # Static types GBoxed = _gi.GBoxed GEnum = _gi.GEnum GFlags = _gi.GFlags GInterface = _gi.GInterface GObject = _gi.GObject GObjectWeakRef = _gi.GObjectWeakRef GParamSpec = _gi.GParamSpec GPointer = _gi.GPointer GType = _gi.GType Warning = _gi.Warning __all__ += ['GBoxed', 'GEnum', 'GFlags', 'GInterface', 'GObject', 'GObjectWeakRef', 'GParamSpec', 'GPointer', 'GType', 'Warning'] features = _gi.features list_properties = _gi.list_properties new = _gi.new pygobject_version = _gi.pygobject_version threads_init = GLib.threads_init type_register = _gi.type_register __all__ += ['features', 'list_properties', 'new', 'pygobject_version', 'threads_init', 'type_register'] class Value(GObjectModule.Value): def __init__(self, value_type=None, py_value=None): GObjectModule.Value.__init__(self) if value_type is not None: self.init(value_type) if py_value is not None: self.set_value(py_value) def __del__(self): if self._free_on_dealloc and self.g_type != TYPE_INVALID: self.unset() # We must call base class __del__() after unset. super(Value, self).__del__() def set_boxed(self, boxed): # Workaround the introspection marshalers inability to know # these methods should be marshaling boxed types. This is because # the type information is stored on the GValue. _gi._gvalue_set(self, boxed) def get_boxed(self): return _gi._gvalue_get(self) def set_value(self, py_value): gtype = self.g_type if gtype == _gi.TYPE_INVALID: raise TypeError("GObject.Value needs to be initialized first") elif gtype == TYPE_BOOLEAN: self.set_boolean(py_value) elif gtype == TYPE_CHAR: self.set_char(py_value) elif gtype == TYPE_UCHAR: self.set_uchar(py_value) elif gtype == TYPE_INT: self.set_int(py_value) elif gtype == TYPE_UINT: self.set_uint(py_value) elif gtype == TYPE_LONG: self.set_long(py_value) elif gtype == TYPE_ULONG: self.set_ulong(py_value) elif gtype == TYPE_INT64: self.set_int64(py_value) elif gtype == TYPE_UINT64: self.set_uint64(py_value) elif gtype == TYPE_FLOAT: self.set_float(py_value) elif gtype == TYPE_DOUBLE: self.set_double(py_value) elif gtype == TYPE_STRING: if isinstance(py_value, str): py_value = str(py_value) elif sys.version_info < (3, 0): if isinstance(py_value, unicode): py_value = py_value.encode('UTF-8') else: raise ValueError("Expected string or unicode but got %s%s" % (py_value, type(py_value))) else: raise ValueError("Expected string but got %s%s" % (py_value, type(py_value))) self.set_string(py_value) elif gtype == TYPE_PARAM: self.set_param(py_value) elif gtype.is_a(TYPE_ENUM): self.set_enum(py_value) elif gtype.is_a(TYPE_FLAGS): self.set_flags(py_value) elif gtype.is_a(TYPE_BOXED): self.set_boxed(py_value) elif gtype == TYPE_POINTER: self.set_pointer(py_value) elif gtype.is_a(TYPE_OBJECT): self.set_object(py_value) elif gtype == TYPE_UNICHAR: self.set_uint(int(py_value)) # elif gtype == TYPE_OVERRIDE: # pass elif gtype == TYPE_GTYPE: self.set_gtype(py_value) elif gtype == TYPE_VARIANT: self.set_variant(py_value) elif gtype == TYPE_PYOBJECT: self.set_boxed(py_value) else: raise TypeError("Unknown value type %s" % gtype) def get_value(self): gtype = self.g_type if gtype == TYPE_BOOLEAN: return self.get_boolean() elif gtype == TYPE_CHAR: return self.get_char() elif gtype == TYPE_UCHAR: return self.get_uchar() elif gtype == TYPE_INT: return self.get_int() elif gtype == TYPE_UINT: return self.get_uint() elif gtype == TYPE_LONG: return self.get_long() elif gtype == TYPE_ULONG: return self.get_ulong() elif gtype == TYPE_INT64: return self.get_int64() elif gtype == TYPE_UINT64: return self.get_uint64() elif gtype == TYPE_FLOAT: return self.get_float() elif gtype == TYPE_DOUBLE: return self.get_double() elif gtype == TYPE_STRING: return self.get_string() elif gtype == TYPE_PARAM: return self.get_param() elif gtype.is_a(TYPE_ENUM): return self.get_enum() elif gtype.is_a(TYPE_FLAGS): return self.get_flags() elif gtype.is_a(TYPE_BOXED): return self.get_boxed() elif gtype == TYPE_POINTER: return self.get_pointer() elif gtype.is_a(TYPE_OBJECT): return self.get_object() elif gtype == TYPE_UNICHAR: return self.get_uint() elif gtype == TYPE_GTYPE: return self.get_gtype() elif gtype == TYPE_VARIANT: return self.get_variant() elif gtype == TYPE_PYOBJECT: pass else: return None def __repr__(self): return '' % (self.g_type.name, self.get_value()) Value = override(Value) __all__.append('Value') def type_from_name(name): type_ = GObjectModule.type_from_name(name) if type_ == TYPE_INVALID: raise RuntimeError('unknown type name: %s' % name) return type_ __all__.append('type_from_name') def type_parent(type_): parent = GObjectModule.type_parent(type_) if parent == TYPE_INVALID: raise RuntimeError('no parent for type') return parent __all__.append('type_parent') def _validate_type_for_signal_method(type_): if hasattr(type_, '__gtype__'): type_ = type_.__gtype__ if not type_.is_instantiatable() and not type_.is_interface(): raise TypeError('type must be instantiable or an interface, got %s' % type_) def signal_list_ids(type_): _validate_type_for_signal_method(type_) return GObjectModule.signal_list_ids(type_) __all__.append('signal_list_ids') def signal_list_names(type_): ids = signal_list_ids(type_) return tuple(GObjectModule.signal_name(i) for i in ids) __all__.append('signal_list_names') def signal_lookup(name, type_): _validate_type_for_signal_method(type_) return GObjectModule.signal_lookup(name, type_) __all__.append('signal_lookup') SignalQuery = namedtuple('SignalQuery', ['signal_id', 'signal_name', 'itype', 'signal_flags', 'return_type', # n_params', 'param_types']) def signal_query(id_or_name, type_=None): if type_ is not None: id_or_name = signal_lookup(id_or_name, type_) res = GObjectModule.signal_query(id_or_name) if res is None: return None if res.signal_id == 0: return None # Return a named tuple to allows indexing which is compatible with the # static bindings along with field like access of the gi struct. # Note however that the n_params was not returned from the static bindings # so we must skip over it. return SignalQuery(res.signal_id, res.signal_name, res.itype, res.signal_flags, res.return_type, tuple(res.param_types)) __all__.append('signal_query') class _HandlerBlockManager(object): def __init__(self, obj, handler_id): self.obj = obj self.handler_id = handler_id def __enter__(self): pass def __exit__(self, exc_type, exc_value, traceback): GObjectModule.signal_handler_unblock(self.obj, self.handler_id) def signal_handler_block(obj, handler_id): """Blocks the signal handler from being invoked until handler_unblock() is called. :param GObject.Object obj: Object instance to block handlers for. :param int handler_id: Id of signal to block. :returns: A context manager which optionally can be used to automatically unblock the handler: .. code-block:: python with GObject.signal_handler_block(obj, id): pass """ GObjectModule.signal_handler_block(obj, handler_id) return _HandlerBlockManager(obj, handler_id) __all__.append('signal_handler_block') def signal_parse_name(detailed_signal, itype, force_detail_quark): """Parse a detailed signal name into (signal_id, detail). :param str detailed_signal: Signal name which can include detail. For example: "notify:prop_name" :returns: Tuple of (signal_id, detail) :raises ValueError: If the given signal is unknown. """ res, signal_id, detail = GObjectModule.signal_parse_name(detailed_signal, itype, force_detail_quark) if res: return signal_id, detail else: raise ValueError('%s: unknown signal name: %s' % (itype, detailed_signal)) __all__.append('signal_parse_name') def remove_emission_hook(obj, detailed_signal, hook_id): signal_id, detail = signal_parse_name(detailed_signal, obj, True) GObjectModule.signal_remove_emission_hook(signal_id, hook_id) __all__.append('remove_emission_hook') # GObject accumulators with pure Python implementations # These return a tuple of (continue_emission, accumulation_result) def signal_accumulator_first_wins(ihint, return_accu, handler_return, user_data=None): # Stop emission but return the result of the last handler return (False, handler_return) __all__.append('signal_accumulator_first_wins') def signal_accumulator_true_handled(ihint, return_accu, handler_return, user_data=None): # Stop emission if the last handler returns True return (not handler_return, handler_return) __all__.append('signal_accumulator_true_handled') # Statically bound signal functions which need to clobber GI (for now) add_emission_hook = _gi.add_emission_hook signal_new = _gi.signal_new __all__ += ['add_emission_hook', 'signal_new'] class _FreezeNotifyManager(object): def __init__(self, obj): self.obj = obj def __enter__(self): pass def __exit__(self, exc_type, exc_value, traceback): self.obj.thaw_notify() def _signalmethod(func): # Function wrapper for signal functions used as instance methods. # This is needed when the signal functions come directly from GI. # (they are not already wrapped) @gi.overrides.wraps(func) def meth(*args, **kwargs): return func(*args, **kwargs) return meth class Object(GObjectModule.Object): def _unsupported_method(self, *args, **kargs): raise RuntimeError('This method is currently unsupported.') def _unsupported_data_method(self, *args, **kargs): raise RuntimeError('Data access methods are unsupported. ' 'Use normal Python attributes instead') # Generic data methods are not needed in python as it can be handled # with standard attribute access: https://bugzilla.gnome.org/show_bug.cgi?id=641944 get_data = _unsupported_data_method get_qdata = _unsupported_data_method set_data = _unsupported_data_method steal_data = _unsupported_data_method steal_qdata = _unsupported_data_method replace_data = _unsupported_data_method replace_qdata = _unsupported_data_method # The following methods as unsupported until we verify # they work as gi methods. bind_property_full = _unsupported_method compat_control = _unsupported_method interface_find_property = _unsupported_method interface_install_property = _unsupported_method interface_list_properties = _unsupported_method notify_by_pspec = _unsupported_method run_dispose = _unsupported_method watch_closure = _unsupported_method # Make all reference management methods private but still accessible. _ref = GObjectModule.Object.ref _ref_sink = GObjectModule.Object.ref_sink _unref = GObjectModule.Object.unref _force_floating = GObjectModule.Object.force_floating ref = _unsupported_method ref_sink = _unsupported_method unref = _unsupported_method force_floating = _unsupported_method # The following methods are static APIs which need to leap frog the # gi methods until we verify the gi methods can replace them. get_property = _gi.GObject.get_property get_properties = _gi.GObject.get_properties set_property = _gi.GObject.set_property set_properties = _gi.GObject.set_properties bind_property = _gi.GObject.bind_property connect = _gi.GObject.connect connect_after = _gi.GObject.connect_after connect_object = _gi.GObject.connect_object connect_object_after = _gi.GObject.connect_object_after disconnect_by_func = _gi.GObject.disconnect_by_func handler_block_by_func = _gi.GObject.handler_block_by_func handler_unblock_by_func = _gi.GObject.handler_unblock_by_func emit = _gi.GObject.emit chain = _gi.GObject.chain weak_ref = _gi.GObject.weak_ref __copy__ = _gi.GObject.__copy__ __deepcopy__ = _gi.GObject.__deepcopy__ def freeze_notify(self): """Freezes the object's property-changed notification queue. :returns: A context manager which optionally can be used to automatically thaw notifications. This will freeze the object so that "notify" signals are blocked until the thaw_notify() method is called. .. code-block:: python with obj.freeze_notify(): pass """ super(Object, self).freeze_notify() return _FreezeNotifyManager(self) def connect_data(self, detailed_signal, handler, *data, **kwargs): """Connect a callback to the given signal with optional user data. :param str detailed_signal: A detailed signal to connect to. :param callable handler: Callback handler to connect to the signal. :param *data: Variable data which is passed through to the signal handler. :param GObject.ConnectFlags connect_flags: Flags used for connection options. :returns: A signal id which can be used with disconnect. """ flags = kwargs.get('connect_flags', 0) if flags & GObjectModule.ConnectFlags.AFTER: connect_func = _gi.GObject.connect_after else: connect_func = _gi.GObject.connect if flags & GObjectModule.ConnectFlags.SWAPPED: if len(data) != 1: raise ValueError('Using GObject.ConnectFlags.SWAPPED requires exactly ' 'one argument for user data, got: %s' % [data]) def new_handler(obj, *args): # Swap obj with the last element in args which will be the user # data passed to the connect function. args = list(args) swap = args.pop() args = args + [obj] return handler(swap, *args) else: new_handler = handler return connect_func(self, detailed_signal, new_handler, *data) # # Aliases # handler_block = signal_handler_block handler_unblock = _signalmethod(GObjectModule.signal_handler_unblock) disconnect = _signalmethod(GObjectModule.signal_handler_disconnect) handler_disconnect = _signalmethod(GObjectModule.signal_handler_disconnect) handler_is_connected = _signalmethod(GObjectModule.signal_handler_is_connected) stop_emission_by_name = _signalmethod(GObjectModule.signal_stop_emission_by_name) # # Deprecated Methods # def stop_emission(self, detailed_signal): """Deprecated, please use stop_emission_by_name.""" warnings.warn(self.stop_emission.__doc__, PyGIDeprecationWarning, stacklevel=2) return self.stop_emission_by_name(detailed_signal) emit_stop_by_name = stop_emission Object = override(Object) GObject = Object __all__ += ['Object', 'GObject'] class Binding(GObjectModule.Binding): def __call__(self): warnings.warn('Using parentheses (binding()) to retrieve the Binding object is no ' 'longer needed because the binding is returned directly from "bind_property.', PyGIDeprecationWarning, stacklevel=2) return self def unbind(self): if hasattr(self, '_unbound'): raise ValueError('binding has already been cleared out') else: setattr(self, '_unbound', True) super(Binding, self).unbind() Binding = override(Binding) __all__.append('Binding') Property = propertyhelper.Property Signal = signalhelper.Signal SignalOverride = signalhelper.SignalOverride # Deprecated naming "property" available for backwards compatibility. # Keep this at the end of the file to avoid clobbering the builtin. property = Property deprecated_attr("GObject", "property", "GObject.Property") __all__ += ['Property', 'Signal', 'SignalOverride', 'property'] PK!x: keysyms.pynu[# -*- Mode: Python; py-indent-offset: 4 -*- # pygtk - Python bindings for the GTK toolkit. # Copyright (C) 1998-2003 James Henstridge # # gtk/keysyms.py: list of keysyms. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, see . import sys import warnings from ..module import get_introspection_module Gdk = get_introspection_module('Gdk') warnings.warn('keysyms has been deprecated. Please use Gdk.KEY_ instead.', RuntimeWarning) _modname = globals()['__name__'] _keysyms = sys.modules[_modname] for name in dir(Gdk): if name.startswith('KEY_'): target = name[4:] if target[0] in '0123456789': target = '_' + target value = getattr(Gdk, name) setattr(_keysyms, target, value) # Not found in Gdk but left for compatibility. Armenian_eternity = 0x14a1 Armenian_section_sign = 0x14a2 Armenian_parenleft = 0x14a5 Armenian_guillemotright = 0x14a6 Armenian_guillemotleft = 0x14a7 Armenian_em_dash = 0x14a8 Armenian_dot = 0x14a9 Armenian_mijaket = 0x14a9 Armenian_comma = 0x14ab Armenian_en_dash = 0x14ac Armenian_ellipsis = 0x14ae PK!9nGIMarshallingTests.pynu[# -*- Mode: Python; py-indent-offset: 4 -*- # vim: tabstop=4 shiftwidth=4 expandtab # # Copyright (C) 2010 Simon van der Linden # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA from ..overrides import override from ..module import get_introspection_module GIMarshallingTests = get_introspection_module('GIMarshallingTests') __all__ = [] OVERRIDES_CONSTANT = 7 __all__.append('OVERRIDES_CONSTANT') class OverridesStruct(GIMarshallingTests.OverridesStruct): def __new__(cls, long_): return GIMarshallingTests.OverridesStruct.__new__(cls) def __init__(self, long_): GIMarshallingTests.OverridesStruct.__init__(self) self.long_ = long_ def method(self): return GIMarshallingTests.OverridesStruct.method(self) / 7 OverridesStruct = override(OverridesStruct) __all__.append('OverridesStruct') class OverridesObject(GIMarshallingTests.OverridesObject): def __new__(cls, long_): return GIMarshallingTests.OverridesObject.__new__(cls) def __init__(self, long_): GIMarshallingTests.OverridesObject.__init__(self) # FIXME: doesn't work yet # self.long_ = long_ @classmethod def new(cls, long_): self = GIMarshallingTests.OverridesObject.new() # FIXME: doesn't work yet # self.long_ = long_ return self def method(self): """Overridden doc string.""" return GIMarshallingTests.OverridesObject.method(self) / 7 OverridesObject = override(OverridesObject) __all__.append('OverridesObject') PK!3*Pango.pynu[# -*- Mode: Python; py-indent-offset: 4 -*- # vim: tabstop=4 shiftwidth=4 expandtab # # Copyright (C) 2010 Paolo Borelli # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA from ..overrides import override from ..module import get_introspection_module Pango = get_introspection_module('Pango') __all__ = [] class FontDescription(Pango.FontDescription): def __new__(cls, string=None): if string is not None: return Pango.font_description_from_string(string) else: return Pango.FontDescription.__new__(cls) def __init__(self, *args, **kwargs): return super(FontDescription, self).__init__() FontDescription = override(FontDescription) __all__.append('FontDescription') class Layout(Pango.Layout): def __new__(cls, context): return Pango.Layout.new(context) def set_markup(self, text, length=-1): super(Layout, self).set_markup(text, length) Layout = override(Layout) __all__.append('Layout') PK!quuGLib.pynu[# -*- Mode: Python; py-indent-offset: 4 -*- # vim: tabstop=4 shiftwidth=4 expandtab # # Copyright (C) 2010 Tomeu Vizoso # Copyright (C) 2011, 2012 Canonical Ltd. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA import warnings import sys import socket from .._ossighelper import wakeup_on_signal, register_sigint_fallback from ..module import get_introspection_module from .._gi import (variant_type_from_string, source_new, source_set_callback, io_channel_read) from ..overrides import override, deprecated, deprecated_attr from gi import PyGIDeprecationWarning, version_info GLib = get_introspection_module('GLib') __all__ = [] from gi import _option as option option # pyflakes __all__.append('option') # Types and functions still needed from static bindings from gi import _gi from gi._error import GError Error = GError OptionContext = _gi.OptionContext OptionGroup = _gi.OptionGroup Pid = _gi.Pid spawn_async = _gi.spawn_async def threads_init(): warnings.warn('Since version 3.11, calling threads_init is no longer needed. ' 'See: https://wiki.gnome.org/PyGObject/Threading', PyGIDeprecationWarning, stacklevel=2) def gerror_matches(self, domain, code): # Handle cases where self.domain was set to an integer for compatibility # with the introspected GLib.Error. if isinstance(self.domain, str): self_domain_quark = GLib.quark_from_string(self.domain) else: self_domain_quark = self.domain return (self_domain_quark, self.code) == (domain, code) def gerror_new_literal(domain, message, code): domain_quark = GLib.quark_to_string(domain) return GError(message, domain_quark, code) # Monkey patch methods that rely on GLib introspection to be loaded at runtime. Error.__name__ = 'Error' Error.__module__ = 'GLib' Error.__gtype__ = GLib.Error.__gtype__ Error.matches = gerror_matches Error.new_literal = staticmethod(gerror_new_literal) __all__ += ['GError', 'Error', 'OptionContext', 'OptionGroup', 'Pid', 'spawn_async', 'threads_init'] class _VariantCreator(object): _LEAF_CONSTRUCTORS = { 'b': GLib.Variant.new_boolean, 'y': GLib.Variant.new_byte, 'n': GLib.Variant.new_int16, 'q': GLib.Variant.new_uint16, 'i': GLib.Variant.new_int32, 'u': GLib.Variant.new_uint32, 'x': GLib.Variant.new_int64, 't': GLib.Variant.new_uint64, 'h': GLib.Variant.new_handle, 'd': GLib.Variant.new_double, 's': GLib.Variant.new_string, 'o': GLib.Variant.new_object_path, 'g': GLib.Variant.new_signature, 'v': GLib.Variant.new_variant, } def _create(self, format, value): """Create a GVariant object from given format and a value that matches the format. This method recursively calls itself for complex structures (arrays, dictionaries, boxed). Returns the generated GVariant. If value is None it will generate an empty GVariant container type. """ gvtype = GLib.VariantType(format) if format in self._LEAF_CONSTRUCTORS: return self._LEAF_CONSTRUCTORS[format](value) # Since we discarded all leaf types, this must be a container builder = GLib.VariantBuilder.new(gvtype) if value is None: return builder.end() if gvtype.is_maybe(): builder.add_value(self._create(gvtype.element().dup_string(), value)) return builder.end() try: iter(value) except TypeError: raise TypeError("Could not create array, tuple or dictionary entry from non iterable value %s %s" % (format, value)) if gvtype.is_tuple() and gvtype.n_items() != len(value): raise TypeError("Tuple mismatches value's number of elements %s %s" % (format, value)) if gvtype.is_dict_entry() and len(value) != 2: raise TypeError("Dictionary entries must have two elements %s %s" % (format, value)) if gvtype.is_array(): element_type = gvtype.element().dup_string() if isinstance(value, dict): value = value.items() for i in value: builder.add_value(self._create(element_type, i)) else: remainer_format = format[1:] for i in value: dup = variant_type_from_string(remainer_format).dup_string() builder.add_value(self._create(dup, i)) remainer_format = remainer_format[len(dup):] return builder.end() class Variant(GLib.Variant): def __new__(cls, format_string, value): """Create a GVariant from a native Python object. format_string is a standard GVariant type signature, value is a Python object whose structure has to match the signature. Examples: GLib.Variant('i', 1) GLib.Variant('(is)', (1, 'hello')) GLib.Variant('(asa{sv})', ([], {'foo': GLib.Variant('b', True), 'bar': GLib.Variant('i', 2)})) """ if not GLib.VariantType.string_is_valid(format_string): raise TypeError("Invalid GVariant format string '%s'", format_string) creator = _VariantCreator() v = creator._create(format_string, value) v.format_string = format_string return v @staticmethod def new_tuple(*elements): return GLib.Variant.new_tuple(elements) def __del__(self): try: self.unref() except ImportError: # Calling unref will cause gi and gi.repository.GLib to be # imported. However, if the program is exiting, then these # modules have likely been removed from sys.modules and will # raise an exception. Assume that's the case for ImportError # and ignore the exception since everything will be cleaned # up, anyways. pass def __str__(self): return self.print_(True) def __repr__(self): if hasattr(self, 'format_string'): f = self.format_string else: f = self.get_type_string() return "GLib.Variant('%s', %s)" % (f, self.print_(False)) def __eq__(self, other): try: return self.equal(other) except TypeError: return False def __ne__(self, other): try: return not self.equal(other) except TypeError: return True def __hash__(self): # We're not using just hash(self.unpack()) because otherwise we'll have # hash collisions between the same content in different variant types, # which will cause a performance issue in set/dict/etc. return hash((self.get_type_string(), self.unpack())) def unpack(self): """Decompose a GVariant into a native Python object.""" LEAF_ACCESSORS = { 'b': self.get_boolean, 'y': self.get_byte, 'n': self.get_int16, 'q': self.get_uint16, 'i': self.get_int32, 'u': self.get_uint32, 'x': self.get_int64, 't': self.get_uint64, 'h': self.get_handle, 'd': self.get_double, 's': self.get_string, 'o': self.get_string, # object path 'g': self.get_string, # signature } # simple values la = LEAF_ACCESSORS.get(self.get_type_string()) if la: return la() # tuple if self.get_type_string().startswith('('): res = [self.get_child_value(i).unpack() for i in range(self.n_children())] return tuple(res) # dictionary if self.get_type_string().startswith('a{'): res = {} for i in range(self.n_children()): v = self.get_child_value(i) res[v.get_child_value(0).unpack()] = v.get_child_value(1).unpack() return res # array if self.get_type_string().startswith('a'): return [self.get_child_value(i).unpack() for i in range(self.n_children())] # variant (just unbox transparently) if self.get_type_string().startswith('v'): return self.get_variant().unpack() # maybe if self.get_type_string().startswith('m'): if not self.n_children(): return None return self.get_child_value(0).unpack() raise NotImplementedError('unsupported GVariant type ' + self.get_type_string()) @classmethod def split_signature(klass, signature): """Return a list of the element signatures of the topmost signature tuple. If the signature is not a tuple, it returns one element with the entire signature. If the signature is an empty tuple, the result is []. This is useful for e. g. iterating over method parameters which are passed as a single Variant. """ if signature == '()': return [] if not signature.startswith('('): return [signature] result = [] head = '' tail = signature[1:-1] # eat the surrounding () while tail: c = tail[0] head += c tail = tail[1:] if c in ('m', 'a'): # prefixes, keep collecting continue if c in ('(', '{'): # consume until corresponding )/} level = 1 up = c if up == '(': down = ')' else: down = '}' while level > 0: c = tail[0] head += c tail = tail[1:] if c == up: level += 1 elif c == down: level -= 1 # otherwise we have a simple type result.append(head) head = '' return result # # Pythonic iterators # def __len__(self): if self.get_type_string() in ['s', 'o', 'g']: return len(self.get_string()) # Array, dict, tuple if self.get_type_string().startswith('a') or self.get_type_string().startswith('('): return self.n_children() raise TypeError('GVariant type %s does not have a length' % self.get_type_string()) def __getitem__(self, key): # dict if self.get_type_string().startswith('a{'): try: val = self.lookup_value(key, variant_type_from_string('*')) if val is None: raise KeyError(key) return val.unpack() except TypeError: # lookup_value() only works for string keys, which is certainly # the common case; we have to do painful iteration for other # key types for i in range(self.n_children()): v = self.get_child_value(i) if v.get_child_value(0).unpack() == key: return v.get_child_value(1).unpack() raise KeyError(key) # array/tuple if self.get_type_string().startswith('a') or self.get_type_string().startswith('('): key = int(key) if key < 0: key = self.n_children() + key if key < 0 or key >= self.n_children(): raise IndexError('list index out of range') return self.get_child_value(key).unpack() # string if self.get_type_string() in ['s', 'o', 'g']: return self.get_string().__getitem__(key) raise TypeError('GVariant type %s is not a container' % self.get_type_string()) # # Pythonic bool operations # def __nonzero__(self): return self.__bool__() def __bool__(self): if self.get_type_string() in ['y', 'n', 'q', 'i', 'u', 'x', 't', 'h', 'd']: return self.unpack() != 0 if self.get_type_string() in ['b']: return self.get_boolean() if self.get_type_string() in ['s', 'o', 'g']: return len(self.get_string()) != 0 # Array, dict, tuple if self.get_type_string().startswith('a') or self.get_type_string().startswith('('): return self.n_children() != 0 if self.get_type_string() in ['v']: # unpack works recursively, hence bool also works recursively return bool(self.unpack()) # Everything else is True return True def keys(self): if not self.get_type_string().startswith('a{'): return TypeError, 'GVariant type %s is not a dictionary' % self.get_type_string() res = [] for i in range(self.n_children()): v = self.get_child_value(i) res.append(v.get_child_value(0).unpack()) return res def get_string(self): value, length = GLib.Variant.get_string(self) return value setattr(Variant, 'get_string', get_string) __all__.append('Variant') def markup_escape_text(text, length=-1): if isinstance(text, bytes): return GLib.markup_escape_text(text.decode('UTF-8'), length) else: return GLib.markup_escape_text(text, length) __all__.append('markup_escape_text') # backwards compatible names from old static bindings for n in ['DESKTOP', 'DOCUMENTS', 'DOWNLOAD', 'MUSIC', 'PICTURES', 'PUBLIC_SHARE', 'TEMPLATES', 'VIDEOS']: attr = 'USER_DIRECTORY_' + n deprecated_attr("GLib", attr, "GLib.UserDirectory.DIRECTORY_" + n) globals()[attr] = getattr(GLib.UserDirectory, 'DIRECTORY_' + n) __all__.append(attr) for n in ['ERR', 'HUP', 'IN', 'NVAL', 'OUT', 'PRI']: globals()['IO_' + n] = getattr(GLib.IOCondition, n) __all__.append('IO_' + n) for n in ['APPEND', 'GET_MASK', 'IS_READABLE', 'IS_SEEKABLE', 'MASK', 'NONBLOCK', 'SET_MASK']: attr = 'IO_FLAG_' + n deprecated_attr("GLib", attr, "GLib.IOFlags." + n) globals()[attr] = getattr(GLib.IOFlags, n) __all__.append(attr) # spelling for the win IO_FLAG_IS_WRITEABLE = GLib.IOFlags.IS_WRITABLE deprecated_attr("GLib", "IO_FLAG_IS_WRITEABLE", "GLib.IOFlags.IS_WRITABLE") __all__.append('IO_FLAG_IS_WRITEABLE') for n in ['AGAIN', 'EOF', 'ERROR', 'NORMAL']: attr = 'IO_STATUS_' + n globals()[attr] = getattr(GLib.IOStatus, n) deprecated_attr("GLib", attr, "GLib.IOStatus." + n) __all__.append(attr) for n in ['CHILD_INHERITS_STDIN', 'DO_NOT_REAP_CHILD', 'FILE_AND_ARGV_ZERO', 'LEAVE_DESCRIPTORS_OPEN', 'SEARCH_PATH', 'STDERR_TO_DEV_NULL', 'STDOUT_TO_DEV_NULL']: attr = 'SPAWN_' + n globals()[attr] = getattr(GLib.SpawnFlags, n) deprecated_attr("GLib", attr, "GLib.SpawnFlags." + n) __all__.append(attr) for n in ['HIDDEN', 'IN_MAIN', 'REVERSE', 'NO_ARG', 'FILENAME', 'OPTIONAL_ARG', 'NOALIAS']: attr = 'OPTION_FLAG_' + n globals()[attr] = getattr(GLib.OptionFlags, n) deprecated_attr("GLib", attr, "GLib.OptionFlags." + n) __all__.append(attr) for n in ['UNKNOWN_OPTION', 'BAD_VALUE', 'FAILED']: attr = 'OPTION_ERROR_' + n deprecated_attr("GLib", attr, "GLib.OptionError." + n) globals()[attr] = getattr(GLib.OptionError, n) __all__.append(attr) # these are not currently exported in GLib gir, presumably because they are # platform dependent; so get them from our static bindings for name in ['G_MINFLOAT', 'G_MAXFLOAT', 'G_MINDOUBLE', 'G_MAXDOUBLE', 'G_MINSHORT', 'G_MAXSHORT', 'G_MAXUSHORT', 'G_MININT', 'G_MAXINT', 'G_MAXUINT', 'G_MINLONG', 'G_MAXLONG', 'G_MAXULONG', 'G_MAXSIZE', 'G_MINSSIZE', 'G_MAXSSIZE', 'G_MINOFFSET', 'G_MAXOFFSET']: attr = name.split("_", 1)[-1] globals()[attr] = getattr(_gi, name) __all__.append(attr) class MainLoop(GLib.MainLoop): # Backwards compatible constructor API def __new__(cls, context=None): return GLib.MainLoop.new(context, False) def __init__(self, context=None): pass def run(self): with register_sigint_fallback(self.quit): with wakeup_on_signal(): super(MainLoop, self).run() MainLoop = override(MainLoop) __all__.append('MainLoop') class MainContext(GLib.MainContext): # Backwards compatible API with default value def iteration(self, may_block=True): return super(MainContext, self).iteration(may_block) MainContext = override(MainContext) __all__.append('MainContext') class Source(GLib.Source): def __new__(cls, *args, **kwargs): # use our custom pyg_source_new() here as g_source_new() is not # bindable source = source_new() source.__class__ = cls setattr(source, '__pygi_custom_source', True) return source def __init__(self, *args, **kwargs): return super(Source, self).__init__() def __del__(self): if hasattr(self, '__pygi_custom_source'): self.unref() def set_callback(self, fn, user_data=None): if hasattr(self, '__pygi_custom_source'): # use our custom pyg_source_set_callback() if for a GSource object # with custom functions source_set_callback(self, fn, user_data) else: # otherwise, for Idle and Timeout, use the standard method super(Source, self).set_callback(fn, user_data) def get_current_time(self): return GLib.get_real_time() * 0.000001 get_current_time = deprecated(get_current_time, 'GLib.Source.get_time() or GLib.get_real_time()') # as get/set_priority are introspected, we can't use the static # property(get_priority, ..) here def __get_priority(self): return self.get_priority() def __set_priority(self, value): self.set_priority(value) priority = property(__get_priority, __set_priority) def __get_can_recurse(self): return self.get_can_recurse() def __set_can_recurse(self, value): self.set_can_recurse(value) can_recurse = property(__get_can_recurse, __set_can_recurse) Source = override(Source) __all__.append('Source') class Idle(Source): def __new__(cls, priority=GLib.PRIORITY_DEFAULT): source = GLib.idle_source_new() source.__class__ = cls return source def __init__(self, priority=GLib.PRIORITY_DEFAULT): super(Source, self).__init__() if priority != GLib.PRIORITY_DEFAULT: self.set_priority(priority) __all__.append('Idle') class Timeout(Source): def __new__(cls, interval=0, priority=GLib.PRIORITY_DEFAULT): source = GLib.timeout_source_new(interval) source.__class__ = cls return source def __init__(self, interval=0, priority=GLib.PRIORITY_DEFAULT): if priority != GLib.PRIORITY_DEFAULT: self.set_priority(priority) __all__.append('Timeout') # backwards compatible API def idle_add(function, *user_data, **kwargs): priority = kwargs.get('priority', GLib.PRIORITY_DEFAULT_IDLE) return GLib.idle_add(priority, function, *user_data) __all__.append('idle_add') def timeout_add(interval, function, *user_data, **kwargs): priority = kwargs.get('priority', GLib.PRIORITY_DEFAULT) return GLib.timeout_add(priority, interval, function, *user_data) __all__.append('timeout_add') def timeout_add_seconds(interval, function, *user_data, **kwargs): priority = kwargs.get('priority', GLib.PRIORITY_DEFAULT) return GLib.timeout_add_seconds(priority, interval, function, *user_data) __all__.append('timeout_add_seconds') # The GI GLib API uses g_io_add_watch_full renamed to g_io_add_watch with # a signature of (channel, priority, condition, func, user_data). # Prior to PyGObject 3.8, this function was statically bound with an API closer to the # non-full version with a signature of: (fd, condition, func, *user_data) # We need to support this until we are okay with breaking API in a way which is # not backwards compatible. # # This needs to take into account several historical APIs: # - calling with an fd as first argument # - calling with a Python file object as first argument (we keep this one as # it's really convenient and does not change the number of arguments) # - calling without a priority as second argument def _io_add_watch_get_args(channel, priority_, condition, *cb_and_user_data, **kwargs): if not isinstance(priority_, int) or isinstance(priority_, GLib.IOCondition): warnings.warn('Calling io_add_watch without priority as second argument is deprecated', PyGIDeprecationWarning) # shift the arguments around user_data = cb_and_user_data callback = condition condition = priority_ if not callable(callback): raise TypeError('third argument must be callable') # backwards compatibility: Call with priority kwarg if 'priority' in kwargs: warnings.warn('Calling io_add_watch with priority keyword argument is deprecated, put it as second positional argument', PyGIDeprecationWarning) priority_ = kwargs['priority'] else: priority_ = GLib.PRIORITY_DEFAULT else: if len(cb_and_user_data) < 1 or not callable(cb_and_user_data[0]): raise TypeError('expecting callback as fourth argument') callback = cb_and_user_data[0] user_data = cb_and_user_data[1:] # backwards compatibility: Allow calling with fd if isinstance(channel, int): func_fdtransform = lambda _, cond, *data: callback(channel, cond, *data) real_channel = GLib.IOChannel.unix_new(channel) elif isinstance(channel, socket.socket) and sys.platform == 'win32': func_fdtransform = lambda _, cond, *data: callback(channel, cond, *data) real_channel = GLib.IOChannel.win32_new_socket(channel.fileno()) elif hasattr(channel, 'fileno'): # backwards compatibility: Allow calling with Python file func_fdtransform = lambda _, cond, *data: callback(channel, cond, *data) real_channel = GLib.IOChannel.unix_new(channel.fileno()) else: assert isinstance(channel, GLib.IOChannel) func_fdtransform = callback real_channel = channel return real_channel, priority_, condition, func_fdtransform, user_data __all__.append('_io_add_watch_get_args') def io_add_watch(*args, **kwargs): """io_add_watch(channel, priority, condition, func, *user_data) -> event_source_id""" channel, priority, condition, func, user_data = _io_add_watch_get_args(*args, **kwargs) return GLib.io_add_watch(channel, priority, condition, func, *user_data) __all__.append('io_add_watch') # backwards compatible API class IOChannel(GLib.IOChannel): def __new__(cls, filedes=None, filename=None, mode=None, hwnd=None): if filedes is not None: return GLib.IOChannel.unix_new(filedes) if filename is not None: return GLib.IOChannel.new_file(filename, mode or 'r') if hwnd is not None: return GLib.IOChannel.win32_new_fd(hwnd) raise TypeError('either a valid file descriptor, file name, or window handle must be supplied') def __init__(self, *args, **kwargs): return super(IOChannel, self).__init__() def read(self, max_count=-1): return io_channel_read(self, max_count) def readline(self, size_hint=-1): # note, size_hint is just to maintain backwards compatible API; the # old static binding did not actually use it (status, buf, length, terminator_pos) = self.read_line() if buf is None: return '' return buf def readlines(self, size_hint=-1): # note, size_hint is just to maintain backwards compatible API; # the old static binding did not actually use it lines = [] status = GLib.IOStatus.NORMAL while status == GLib.IOStatus.NORMAL: (status, buf, length, terminator_pos) = self.read_line() # note, this appends an empty line after EOF; this is # bug-compatible with the old static bindings if buf is None: buf = '' lines.append(buf) return lines def write(self, buf, buflen=-1): if not isinstance(buf, bytes): buf = buf.encode('UTF-8') if buflen == -1: buflen = len(buf) (status, written) = self.write_chars(buf, buflen) return written def writelines(self, lines): for line in lines: self.write(line) _whence_map = {0: GLib.SeekType.SET, 1: GLib.SeekType.CUR, 2: GLib.SeekType.END} def seek(self, offset, whence=0): try: w = self._whence_map[whence] except KeyError: raise ValueError("invalid 'whence' value") return self.seek_position(offset, w) def add_watch(self, condition, callback, *user_data, **kwargs): priority = kwargs.get('priority', GLib.PRIORITY_DEFAULT) return io_add_watch(self, priority, condition, callback, *user_data) add_watch = deprecated(add_watch, 'GLib.io_add_watch()') def __iter__(self): return self def __next__(self): (status, buf, length, terminator_pos) = self.read_line() if status == GLib.IOStatus.NORMAL: return buf raise StopIteration # Python 2.x compatibility next = __next__ IOChannel = override(IOChannel) __all__.append('IOChannel') class PollFD(GLib.PollFD): def __new__(cls, fd, events): pollfd = GLib.PollFD() pollfd.__class__ = cls return pollfd def __init__(self, fd, events): self.fd = fd self.events = events PollFD = override(PollFD) __all__.append('PollFD') # The GI GLib API uses g_child_watch_add_full renamed to g_child_watch_add with # a signature of (priority, pid, callback, data). # Prior to PyGObject 3.8, this function was statically bound with an API closer to the # non-full version with a signature of: (pid, callback, data=None, priority=GLib.PRIORITY_DEFAULT) # We need to support this until we are okay with breaking API in a way which is # not backwards compatible. def _child_watch_add_get_args(priority_or_pid, pid_or_callback, *args, **kwargs): user_data = [] if callable(pid_or_callback): warnings.warn('Calling child_watch_add without priority as first argument is deprecated', PyGIDeprecationWarning) pid = priority_or_pid callback = pid_or_callback if len(args) == 0: priority = kwargs.get('priority', GLib.PRIORITY_DEFAULT) elif len(args) == 1: user_data = args priority = kwargs.get('priority', GLib.PRIORITY_DEFAULT) elif len(args) == 2: user_data = [args[0]] priority = args[1] else: raise TypeError('expected at most 4 positional arguments') else: priority = priority_or_pid pid = pid_or_callback if 'function' in kwargs: callback = kwargs['function'] user_data = args elif len(args) > 0 and callable(args[0]): callback = args[0] user_data = args[1:] else: raise TypeError('expected callback as third argument') if 'data' in kwargs: if user_data: raise TypeError('got multiple values for "data" argument') user_data = [kwargs['data']] return priority, pid, callback, user_data # we need this to be accessible for unit testing __all__.append('_child_watch_add_get_args') def child_watch_add(*args, **kwargs): """child_watch_add(priority, pid, function, *data)""" priority, pid, function, data = _child_watch_add_get_args(*args, **kwargs) return GLib.child_watch_add(priority, pid, function, *data) __all__.append('child_watch_add') def get_current_time(): return GLib.get_real_time() * 0.000001 get_current_time = deprecated(get_current_time, 'GLib.get_real_time()') __all__.append('get_current_time') # backwards compatible API with default argument, and ignoring bytes_read # output argument def filename_from_utf8(utf8string, len=-1): return GLib.filename_from_utf8(utf8string, len)[0] __all__.append('filename_from_utf8') # backwards compatible API for renamed function if not hasattr(GLib, 'unix_signal_add_full'): def add_full_compat(*args): warnings.warn('GLib.unix_signal_add_full() was renamed to GLib.unix_signal_add()', PyGIDeprecationWarning) return GLib.unix_signal_add(*args) GLib.unix_signal_add_full = add_full_compat # obsolete constants for backwards compatibility glib_version = (GLib.MAJOR_VERSION, GLib.MINOR_VERSION, GLib.MICRO_VERSION) __all__.append('glib_version') deprecated_attr("GLib", "glib_version", "(GLib.MAJOR_VERSION, GLib.MINOR_VERSION, GLib.MICRO_VERSION)") pyglib_version = version_info __all__.append('pyglib_version') deprecated_attr("GLib", "pyglib_version", "gi.version_info") PK!11 __init__.pynu[PK!5a1Gtk.pynu[PK!78S~>#># Gio.pynu[PK!?HB_=_=9Gdk.pynu[PK!?d"w__pycache__/keysyms.cpython-36.pycnu[PK!CICI"z__pycache__/GObject.cpython-36.pycnu[PK!ass$__pycache__/Gio.cpython-36.opt-1.pycnu[PK! >&3Z3ZR__pycache__/GLib.cpython-36.pycnu[PK!@<__pycache__/Gio.cpython-36.pycnu[PK! $Z__pycache__/Gtk.cpython-36.opt-1.pycnu[PK!E ++ >)__pycache__/Pango.cpython-36.pycnu[PK!((#.__pycache__/__init__.cpython-36.pycnu[PK!^m(m()W__pycache__/__init__.cpython-36.opt-1.pycnu[PK!@ZZ%p__pycache__/GLib.cpython-36.opt-1.pycnu[PK!塟3__pycache__/GIMarshallingTests.cpython-36.opt-1.pycnu[PK!U鶒--$ __pycache__/Gdk.cpython-36.opt-1.pycnu[PK! `__pycache__/Gtk.cpython-36.pycnu[PK!CICI(__pycache__/GObject.cpython-36.opt-1.pycnu[PK!?d(U'__pycache__/keysyms.cpython-36.opt-1.pycnu[PK!U鶒--=+__pycache__/Gdk.cpython-36.pycnu[PK!塟-X__pycache__/GIMarshallingTests.cpython-36.pycnu[PK!E ++&___pycache__/Pango.cpython-36.opt-1.pycnu[PK!`̬{ee >eGObject.pynu[PK!x: -keysyms.pynu[PK!9nGIMarshallingTests.pynu[PK!3*Pango.pynu[PK!quuGLib.pynu[PK W