diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:36:13 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2017-07-12 08:36:14 +0900 |
commit | d3b61d1e80a91482c2fc844810627064b1087280 (patch) | |
tree | 31e43590946ac70b8a14429f488f1e4f01956293 /gi | |
parent | 385fb5df2f7c3ec197b954e8a8ddac5297fe4043 (diff) | |
download | pygobject2-d3b61d1e80a91482c2fc844810627064b1087280.tar.gz pygobject2-d3b61d1e80a91482c2fc844810627064b1087280.tar.bz2 pygobject2-d3b61d1e80a91482c2fc844810627064b1087280.zip |
Imported Upstream version 2.28.1
Change-Id: Ib2dc5ea9bbd21a07cf091b6a5352485ef15f637a
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'gi')
-rw-r--r-- | gi/Makefile.am | 4 | ||||
-rw-r--r-- | gi/Makefile.in | 9 | ||||
-rw-r--r-- | gi/overrides/Gio.py | 21 | ||||
-rw-r--r-- | gi/overrides/Gtk.py | 12 | ||||
-rw-r--r-- | gi/overrides/Makefile.in | 1 | ||||
-rw-r--r-- | gi/pygi-argument.c | 15 | ||||
-rw-r--r-- | gi/repository/Makefile.in | 1 |
7 files changed, 41 insertions, 22 deletions
diff --git a/gi/Makefile.am b/gi/Makefile.am index 28825ab..31f6c79 100644 --- a/gi/Makefile.am +++ b/gi/Makefile.am @@ -25,7 +25,6 @@ _gi_la_LDFLAGS = \ -export-symbols-regex "init_gi|PyInit__gi" _gi_la_LIBADD = \ $(GI_LIBS) \ - $(PYTHON_LIBS) \ $(top_builddir)/glib/libpyglib-2.0-@PYTHON_BASENAME@.la _gi_la_SOURCES = \ pygi-repository.c \ @@ -69,8 +68,7 @@ _gi_cairo_la_LDFLAGS = \ -export-symbols-regex "init_gi_cairo|PyInit__gi_cairo" _gi_cairo_la_LIBADD = \ $(GI_LIBS) \ - $(PYCAIRO_LIBS) \ - $(PYTHON_LIBS) + $(PYCAIRO_LIBS) _gi_cairo_la_SOURCES = pygi-foreign-cairo.c diff --git a/gi/Makefile.in b/gi/Makefile.in index a5ccc12..3015b22 100644 --- a/gi/Makefile.in +++ b/gi/Makefile.in @@ -73,7 +73,7 @@ am__base_list = \ am__installdirs = "$(DESTDIR)$(pygidir)" "$(DESTDIR)$(pygidir)" LTLIBRARIES = $(pygi_LTLIBRARIES) am__DEPENDENCIES_1 = -_gi_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ +_gi_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(top_builddir)/glib/libpyglib-2.0-@PYTHON_BASENAME@.la am__gi_la_OBJECTS = _gi_la-pygi-repository.lo _gi_la-pygi-info.lo \ _gi_la-pygi-invoke.lo _gi_la-pygi-foreign.lo \ @@ -90,7 +90,7 @@ _gi_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(_gi_la_CFLAGS) $(CFLAGS) \ $(_gi_la_LDFLAGS) $(LDFLAGS) -o $@ _gi_cairo_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) + $(am__DEPENDENCIES_1) am__gi_cairo_la_OBJECTS = _gi_cairo_la-pygi-foreign-cairo.lo _gi_cairo_la_OBJECTS = $(am__gi_cairo_la_OBJECTS) _gi_cairo_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -258,7 +258,6 @@ PYTHON = @PYTHON@ PYTHON_BASENAME = @PYTHON_BASENAME@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ @@ -351,7 +350,6 @@ _gi_la_LDFLAGS = \ _gi_la_LIBADD = \ $(GI_LIBS) \ - $(PYTHON_LIBS) \ $(top_builddir)/glib/libpyglib-2.0-@PYTHON_BASENAME@.la _gi_la_SOURCES = \ @@ -398,8 +396,7 @@ _gi_cairo_la_LDFLAGS = \ _gi_cairo_la_LIBADD = \ $(GI_LIBS) \ - $(PYCAIRO_LIBS) \ - $(PYTHON_LIBS) + $(PYCAIRO_LIBS) _gi_cairo_la_SOURCES = pygi-foreign-cairo.c pygi_LTLIBRARIES = _gi.la $(am__append_1) diff --git a/gi/overrides/Gio.py b/gi/overrides/Gio.py index 20343a2..20adf0c 100644 --- a/gi/overrides/Gio.py +++ b/gi/overrides/Gio.py @@ -23,6 +23,8 @@ from ..importer import modules from gi.repository import GLib +import sys + Gio = modules['Gio']._introspection_module __all__ = [] @@ -109,7 +111,8 @@ class _DBusProxyMethodCall: (result_callback, error_callback, real_user_data) = user_data try: ret = obj.call_finish(result) - except Exception as e: + except Exception: + etype, e = sys.exc_info()[:2] # return exception as value if error_callback: error_callback(obj, e, real_user_data) @@ -119,7 +122,17 @@ class _DBusProxyMethodCall: result_callback(obj, self._unpack_result(ret), real_user_data) - def __call__(self, signature, *args, **kwargs): + 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: @@ -163,6 +176,10 @@ class DBusProxy(Gio.DBusProxy): 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) diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py index 55d139e..30e883c 100644 --- a/gi/overrides/Gtk.py +++ b/gi/overrides/Gtk.py @@ -410,6 +410,7 @@ class MessageDialog(Gtk.MessageDialog, Dialog): kwds['text'] = message_format Gtk.MessageDialog.__init__(self, _buttons_property=buttons, + message_type=type, **kwds) Dialog.__init__(self, parent=parent, flags=flags) @@ -731,9 +732,7 @@ class TreeModel(Gtk.TreeModel): # we may need to convert to a basic type type_ = self.get_column_type(column) - if type_ == GObject.TYPE_PYOBJECT: - pass # short-circut branching - elif type_ == GObject.TYPE_STRING: + if type_ == GObject.TYPE_STRING: if isinstance(value, str): value = str(value) elif sys.version_info < (3, 0): @@ -773,7 +772,10 @@ class TreeModel(Gtk.TreeModel): # so we don't have to do it here value_container = GObject.Value() value_container.init(type_) - if type_ == GObject.TYPE_CHAR: + if type_ == GObject.TYPE_PYOBJECT: + value_container.set_boxed(value) + value = value_container + elif type_ == GObject.TYPE_CHAR: value_container.set_char(value) value = value_container elif type_ == GObject.TYPE_UCHAR: @@ -1116,6 +1118,8 @@ class TreeViewColumn(Gtk.TreeViewColumn): if success: return (start_pos, width,) + def set_cell_data_func(self, cell_renderer, func, func_data=None): + super(TreeViewColumn, self).set_cell_data_func(cell_renderer, func, func_data) TreeViewColumn = override(TreeViewColumn) __all__.append('TreeViewColumn') diff --git a/gi/overrides/Makefile.in b/gi/overrides/Makefile.in index 7ba6f5e..96ce126 100644 --- a/gi/overrides/Makefile.in +++ b/gi/overrides/Makefile.in @@ -170,7 +170,6 @@ PYTHON = @PYTHON@ PYTHON_BASENAME = @PYTHON_BASENAME@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c index 1b31387..6519e5c 100644 --- a/gi/pygi-argument.c +++ b/gi/pygi-argument.c @@ -224,7 +224,8 @@ _pygi_g_type_interface_check_object (GIBaseInfo *info, /* Handle special cases. */ type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info); if (g_type_is_a (type, G_TYPE_CLOSURE)) { - if (!PyCallable_Check (object)) { + if (!(PyCallable_Check (object) || + pyg_type_from_object_strict (object, FALSE) == G_TYPE_CLOSURE)) { PyErr_Format (PyExc_TypeError, "Must be callable, not %s", object->ob_type->tp_name); retval = 0; @@ -1072,10 +1073,14 @@ array_success: } else if (g_type_is_a (type, G_TYPE_CLOSURE)) { GClosure *closure; - closure = pyg_closure_new (object, NULL, NULL); - if (closure == NULL) { - PyErr_SetString (PyExc_RuntimeError, "PyObject conversion to GClosure failed"); - break; + if (pyg_type_from_object_strict (object, FALSE) == G_TYPE_CLOSURE) { + closure = (GClosure *)pyg_boxed_get (object, void); + } else { + closure = pyg_closure_new (object, NULL, NULL); + if (closure == NULL) { + PyErr_SetString (PyExc_RuntimeError, "PyObject conversion to GClosure failed"); + break; + } } arg.v_pointer = closure; diff --git a/gi/repository/Makefile.in b/gi/repository/Makefile.in index cb6de2a..7da2e99 100644 --- a/gi/repository/Makefile.in +++ b/gi/repository/Makefile.in @@ -170,7 +170,6 @@ PYTHON = @PYTHON@ PYTHON_BASENAME = @PYTHON_BASENAME@ PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ PYTHON_INCLUDES = @PYTHON_INCLUDES@ -PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_PLATFORM = @PYTHON_PLATFORM@ PYTHON_PREFIX = @PYTHON_PREFIX@ PYTHON_VERSION = @PYTHON_VERSION@ |