home *** CD-ROM | disk | FTP | other *** search
/ Freelog 116 / FreelogNo116-JuilletSeptembre2013.iso / Bureautique / gImageReader / gimagereader_0.9-1_win32.exe / bin / gobject / __init__.pyc (.txt) next >
Python Compiled Bytecode  |  2011-03-24  |  5KB  |  69 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.7)
  3.  
  4. import sys
  5. from glib import spawn_async, idle_add, timeout_add, timeout_add_seconds, io_add_watch, source_remove, child_watch_add, markup_escape_text, get_current_time, filename_display_name, filename_display_basename, filename_from_utf8, get_application_name, set_application_name, get_prgname, set_prgname, main_depth, Pid, GError, glib_version, MainLoop, MainContext, main_context_default, IOChannel, Source, Idle, Timeout, PollFD, OptionGroup, OptionContext, option, uri_list_extract_uris
  6. from glib import 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, PRIORITY_HIGH, PRIORITY_DEFAULT, PRIORITY_HIGH_IDLE, PRIORITY_DEFAULT_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, 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, OPTION_ERROR
  7. from gobject.constants import *
  8. from gobject._gobject import *
  9. _PyGObject_API = _gobject._PyGObject_API
  10. from gobject.propertyhelper import property
  11. sys.modules['gobject.option'] = option
  12.  
  13. class GObjectMeta(type):
  14.     '''Metaclass for automatically registering GObject classes'''
  15.     
  16.     def __init__(cls, name, bases, dict_):
  17.         type.__init__(cls, name, bases, dict_)
  18.         cls._install_properties()
  19.         cls._type_register(cls.__dict__)
  20.  
  21.     
  22.     def _install_properties(cls):
  23.         gproperties = getattr(cls, '__gproperties__', { })
  24.         props = []
  25.         for name, prop in cls.__dict__.items():
  26.             if isinstance(prop, property) or name in gproperties:
  27.                 raise ValueError
  28.             prop.name = name
  29.             gproperties[name] = prop.get_pspec_args()
  30.             props.append(prop)
  31.             continue
  32.         
  33.         if not props:
  34.             return None
  35.         cls.__gproperties__ = None
  36.         if 'do_get_property' in cls.__dict__ or 'do_set_property' in cls.__dict__:
  37.             for prop in props:
  38.                 if not prop.getter != prop._default_getter:
  39.                     if prop.setter != prop._default_setter:
  40.                         raise TypeError('GObject subclass %r defines do_get/set_property and it also uses a property which a custom setter or getter. This is not allowed' % (cls.__name__,))
  41.         
  42.         def obj_get_property(self, pspec):
  43.             name = pspec.name.replace('-', '_')
  44.             prop = getattr(cls, name, None)
  45.             if prop:
  46.                 return prop.getter(self)
  47.  
  48.         cls.do_get_property = obj_get_property
  49.         
  50.         def obj_set_property(self, pspec, value):
  51.             name = pspec.name.replace('-', '_')
  52.             prop = getattr(cls, name, None)
  53.             if prop:
  54.                 prop.setter(self, value)
  55.  
  56.         cls.do_set_property = obj_set_property
  57.  
  58.     
  59.     def _type_register(cls, namespace):
  60.         if '__gtype__' in namespace:
  61.             return None
  62.         if not None in namespace and '__gsignals__' in namespace or '__gtype_name__' in namespace:
  63.             return None
  64.         None(cls, namespace.get('__gtype_name__'))
  65.  
  66.  
  67. _gobject._install_metaclass(GObjectMeta)
  68. del _gobject
  69.