Commit graph

64 commits

Author SHA1 Message Date
John (J5) Palmieri
ce84a7761a * python/__init__.py: Version updated (0, 43, 0)
* python/dbus_bindings.pyx:
	- Fixed type objects to have self passed into __init__
	- Added the Variant type
	- Add the ability to specify types or signatures for Array, Variant and Dictionary
	- (Connection::send_with_reply_handlers): return a PendingCall object
	- (_pending_call_notification): handle the case when an error is returned
	without an error message in the body
	- (MessageIter::get_boolean): return True or False instead of an integer
	- (MessageIter::python_value_to_dbus_sig): add direct checking of types and
	add checks for objects with embeded signatures or types (Array, Variant and
	Dictionary)
	- (MessageIter::append_byte): handle case when the value is a dbus.Byte
	- (MessageIter::append_dict): handle embeded types or signatures
	- (MessageIter::append_array): handle embeded types or signatures
	- (MessageIter::append_variant): new method

	* python/proxies.py:
	- (DeferedMethod): New. Dummy executable object used when queuing calls blocking on
	introspection data
	- (ProxyMethod::__call__): add the timeout keyword for specifying longer or
	shorter timeouts for method calls
	- (ProxyObject): Add first pass at an introspection state machine
	- (ProxyObject::__init__): Add introspect keyword for turing off an on
	introspection.
	- (ProxyObject::_Introspect): Internal Introspect call that bypasses the usual
	mechanisms for sending messages.  This is to avoid a deadlock where the Intospect
	call would be queued waiting for the Introspect call to finish ;-)
	- (ProxyObject::_introspect_reply_handler): New.  This method is called when
	introspection returns with no error
	- (ProxyObject::_introspect_error_handler): New.  This method is called when
	introspection encounters an error
	- (ProxyObject::__getattr__): Code to handle different introspection states.
	Queue async calls or block blocking calls if we are introspecting.  Pass through
	as normal if we are not or are done with introspecting.

	* python/service.py: Import signal and method from decorators.py

	* python/types.py: Add Variant type
2005-08-16 22:54:04 +00:00
John (J5) Palmieri
de689235e9 * python/_dbus.py, _util.py, decorators.py, extract.py, matchrules.py.
proxies.py, service.py: Cleanup of code after running it through the
  pyflakes code checker mostly dealing with undefined names.
  (Bug #3828, Patch from Anthony Baxter <anthony@interlink.com.au>)
2005-07-20 14:15:08 +00:00
John (J5) Palmieri
afc504f848 * Merge DBUS_0_35_2 branch into HEAD
2005-07-17  John (J5) Palmieri  <johnp@redhat.com>

        * NEWS: Update to 0.35.2

2005-07-17  John (J5) Palmieri  <johnp@redhat.com>

        * python/_dbus.py: Remove import of the dbus.services
        module as it no longer exists (patch from Dimitur Kirov)

        * python/service.py (Object::__init__): Fixed typo
        s/name/bus_name (patch from Dimitur Kirov)

        * python/examples/example-signal-emitter.py: import dbus.glib
        to get the main loop and use glib mainloop instead of gtk so
        X doesn't have to be running.

        * python/examples/example-signal-recipient.py: import dbus.glib
        to get the main loop and use glib mainloop instead of gtk so
        X doesn't have to be running. Import the decorators module
        directly.

        * test/glib/Makefile.am:  Added DIST_EXTRA files that distcheck
        didn't pick up on but are needed to build

        * configure.in: upped version to 0.35.2

        * bus/driver.c, bus/selinux.c, bus/selinux.h, dbus/dbus-protocol.h:
        added Colin Walters' SELinux API rename patch from head
        s/unix sercurity context/selinux security context/

2005-07-16  John (J5) Palmieri  <johnp@redhat.com>

        * python/Makefile.am: dbus_binding.pxd.in should be included
        in EXTRA_DIST not dbus_binding.pxd
        fix up $(srcdir) hopefully for the last time

        * NEWS: Update to 0.35.1
2005-07-17 21:02:56 +00:00
John (J5) Palmieri
0a04060376 * glib/Makefile.am: Add make-dbus-glib-error-switch.sh to EXTRA_DIST
so distcheck doesn't fail

* glib/examples/Makefile.am: Add example-service.xml and
  example-signal-emitter.xml to EXTRA_DIST so distcheck doesn't fail

* glib/examples/statemachine/Makefile.am: Add statemachine.xml and
  statemachine-server.xml to EXTRA_DIST so distcheck doesn't fail

* python/Makefile.am: Preprend $(srcdir)/ to source files so the
  compiler looks in the right places during distcheck
2005-07-15 20:28:05 +00:00
John (J5) Palmieri
a89b13dd19 * python/examples/example-service.py,
python/examples/example-signal-emitter.py: Fixed up examples
  for API changes
2005-07-15 18:09:59 +00:00
John (J5) Palmieri
5cd694d5fb * python/__init__.py: Upped to version (0,42,0) because of
the API change
2005-07-15 17:33:17 +00:00
John (J5) Palmieri
a7595655fb * bus/dispatch.c, test/test-service.c: Add testcase
for sending messages to oneself (TODO item).

* python/service.py (class Object): Swap ordering of bus_name
  and object_path parameters to better support inheritance.

* doc/dbus-tutorial.xml: change Python docs to reflect change
  in parameter ordering and fix the inheritance section.

* doc/TODO: remove sending message to oneself TODO item
2005-07-15 15:21:43 +00:00
John (J5) Palmieri
dc4d80e567 * python/_dbus.py (Bus::remove_signal_receiver):
don't add a callback to the match if none has been passed in

* python/matchrules.py (SignalMatchTree::remove): if the rule
  being matched does not have a callback treat it as a wildcard
  fix matching logic

* doc/dbus-tutorial.xml: Add Python tutorial
2005-07-15 02:15:08 +00:00
John (J5) Palmieri
075945f611 Checking in Rodrigo's patch along with my fixes to the patch
2005-07-14  John (J5) Palmieri  <johnp@redhat.com>

	* bus/activation.c: clean up all tabs to be 8 spaces
	(bus_activation_activate_service): make sure we clean up
	if activation fails

	* bus/dispatch.c: clean up all tabs to be 8 spaces
	(check_shell_fail_service_auto_start): New function
	tests to make sure we get fail properly when trying to auto start a service
	with a faulty command line
	(check_shell_service_success_auto_start): New function tests to make sure
	auto started services get the arguments on the command line

	* test/test-shell-service.c: Added service for testing auto-starting with
	command line arguments

	* test/data/valid-service-files/debug-shell-echo-fail.service.in,
	test/data/valid-service-files/debug-shell-echo-success.service.in:
	Added service files for testing auto-starting with command line arguments

	* */.cvsignore: added a bunch of generated files to various .cvsignore files

2005-07-14  Rodrigo Moya  <rodrigo@novell.com>

	* dbus/dbus-shell.[ch]: copy/pasted code from GLib.

	* dbus/Makefile.am: added new files to build.

	* bus/activation.c (bus_activation_activate_service): support
	activation commands with parameters.

	* test/shell-test.c: added test program for the shell parsing
	code.
2005-07-14 20:44:15 +00:00
John (J5) Palmieri
2c413bf281 * python/.cvsignore: remove dbus_bindings.pyx, add dbus_bindings.pxd
* python/service.py (class Name): renamed BusName to make it clearer
  what the object is for (a name on the bus)

* python/examples/example-service.py,
  python/examples/example-signal-emitter.py: change the Name object to
  BusName
2005-07-13 18:22:35 +00:00
John (J5) Palmieri
d06bfe528b * python/dbus_bindings.pyx.in: removed
* python/dbus_bindings.pyx: Added.
	- Fixed some memleaks (patch from
	  Sean Meiners <sean.meiners@linspireinc.com>)
	- Broke out the #include "dbus_h_wrapper.h" and put it in its
	  own pxd file (Pyrex definition)
	- Broke out glib dependancies into its own pyx module

* python/dbus_bindings.pdx: Added.
	- Defines C class Connection for exporting to other modules

* python/dbus_glib_bindings.pyx: Added.
	- New module to handle lowlevel dbus-glib mainloop integration

* python/glib.py: Added.
	- Registers the glib mainloop when you import this module

* python/services.py: Removed (renamed to service.py)

* python/service.py: Added.
	- (class Server): renamed Name

* python/__init__.py: Bump ro version (0,41,0)
	- don't import the decorators or service module
   	  by default.  These now reside in the dbus.service namespace

* python/_dbus.py (Bus::__init__): Add code run the main loop
  setup function on creation

* python/examples/example-service.py,
  python/examples/example-signal-emitter.py: update examples

* python/examples/gconf-proxy-service.py,
  python/examples/gconf-proxy-service2.py: TODO fix these up

* doc/TODO: Addition
	- Added a Python Bindings 1.0 section
	- added "Add match on args or match on details to match rules"
2005-07-12 18:16:07 +00:00
John (J5) Palmieri
a3406a8279 * python/dbus_bindings.pyx.in (cunregister_function_handler,
cmessage_function_handler): Patch from
  Anthony Baxter <anthony@interlink.com.au> fixes threading problems
  by using the Py_GILState_Ensure/Release to synchronize with the
  python runtime.
2005-06-28 19:36:51 +00:00
Colin Walters
ddce490e79 2005-06-16 Colin Walters <walters@verbum.org>
* python/dbus_bindings.pyx.in: Import size_t,
	__int64_t, __uint64_t, and __signed.

	* dbus/dbus-sysdeps.c <HAVE_CMSGCRED> (write_credentials_byte):
	Define cmsg struct, output it.
	(_dbus_read_credentials_unix_socket):
	Use cmsg struct.

	Patch from Joe Markus Clarke for FreeBSD support.
2005-06-16 05:51:46 +00:00
Colin Walters
beb9cd2eb2 2005-06-12 Colin Walters <walters@verbum.org>
Async signals and various bugfixes and testing by
	Ross Burton <ross@burtonini.com>.

	* glib/dbus-gvalue.h: (struct DBusBasicGValue): Delete.
	(dbus_gvalue_genmarshal_name_from_type)
	(dbus_gvalue_ctype_from_type): Moved to dbus-binding-tool-glib.c.
	(dbus_gtype_to_dbus_type): Renamed to dbus_gtype_from_signature.
	(dbus_g_value_types_init, dbus_gtype_from_signature)
	(dbus_gtype_from_signature_iter, dbus_gtype_to_signature)
	(dbus_gtypes_from_arg_signature): New function prototypes.
	(dbus_gvalue_demarshal): Take context and error arguments.
	(dbus_gvalue_demarshal_variant): New function.
	(dbus_gvalue_demarshal_message): New function.
	(dbus_gvalue_store): Delete.

	* glib/dbus-gvalue.c:

	File has been almost entirely rewritten; now we special-case
	more types such as DBUS_TYPE_SIGNATURE, handle arrays and
	hash tables correctly, etc.  Full support for recursive values
	is not yet complete.

	* glib/dbus-gproxy.c (dbus_g_proxy_class_init): Change last
	argument of signal to G_TYPE_POINTER since we now pass a
	structure.
	(lookup_g_marshaller): Delete in favor of
	_dbus_gobject_lookup_marshaller.
	(marshal_dbus_message_to_g_marshaller): Use
	_dbus_gobject_lookup_marshaller and dbus_gvalue_demarshal_message
	to handle remote signal callbacks.
	(dbus_g_proxy_new_from_proxy): New function; creates a new
	DBusGProxy by copying an existing one.
	(dbus_g_proxy_get_interface, dbus_g_proxy_set_interface)
	(dbus_g_proxy_get_path): New functions.
	(dbus_g_proxy_marshal_args_to_message): New function;
	factored out of existing code.
	(DBUS_G_VALUE_ARRAY_COLLECT_ALL): Collect all arguments
	from a varargs array.
	(dbus_g_proxy_begin_call_internal): New function.
	(dbus_g_proxy_end_call_internal): New function.
	(dbus_g_proxy_begin_call): Take GTypes instead of DBus types
	as arguments; simply invoke dbus_g_proxy_begin_call_internal
	after collecting args into value array.
	(dbus_g_proxy_end_call): Take GTypes instead of DBus types;
	invoke dbus_g_proxy_end_call_internal.
	(dbus_g_proxy_invoke): Simply invoke begin_call_interanl and
	end_call_internal.
	(dbus_g_proxy_call_no_reply): Take GTypes instead of DBus
	types.
	(array_free_all): New function.
	(dbus_g_proxy_add_signal): Take GTypes.

	* glib/dbus-gobject.h:
	(_dbus_glib_marshal_dbus_message_to_gvalue_array): Delete.
	(_dbus_gobject_get_path, _dbus_gobject_lookup_marshaller):
	Prototype.

	* glib/dbus-gobject.c: Add a global marshal_table hash which
	stores mappings from type signatures to marshallers.  Change lots
	of invocations of dbus_gtype_to_dbus_type to
	dbus_gtype_to_signature.
	(_dbus_glib_marshal_dbus_message_to_gvalue_array): Delete.
	(introspect_signals): Fix test for query.return_type.
	(set_object_property): Update invocation of dbus_gvalue_demarshal.
	(invoke_object_method): Many changes.  Handle asynchronous
	invocations.  Convert arguments with
	dbus_gvalue_demarshal_message.  Handle errors.  Use
	DBusSignatureIter instead of strlen on args. Handle all arguments
	generically.  Special-case variants.
	(dbus_g_method_return, dbus_g_method_return_error): New function.
	(DBusGSignalClosure): New structure, closes over signal
	information.
	(dbus_g_signal_closure_new): New function.
	(dbus_g_signal_closure_finalize): New function.
	(signal_emitter_marshaller): New function; is special marshaller
	which emits signals on bus.
	(export_signals): New function; introspects object signals and
	connects to them.
	(dbus_g_object_type_install_info): Take GType instead of
	GObjectClass.
	(dbus_g_connection_register_g_object): Invoke export_signals.
	(dbus_g_connection_lookup_g_object): New function.
	(DBusGFuncSignature) New structure; used for mapping type
	signatures to marshallers.
	(funcsig_hash): New function; hashes DBusGFuncSignature.
	(funcsig_equal): New function; compares DBusGFuncSignature.
	(_dbus_gobject_lookup_marshaller): New function.
	(dbus_g_object_register_marshaller): New function; used to
	register a marshaller at runtime for a particular signature.

	* glib/dbus-gmain.c (_dbus_gmain_test): Add various tests.

	* glib/dbus-binding-tool-glib.h: Add DBUS_GLIB_ANNOTATION_ASYNC
	which notes a server method implementation should be
	asynchronous.

	* glib/dbus-binding-tool-glib.c
	(dbus_binding_tool_output_glib_server): Call
	dbus_g_value_types_init.
	(write_formal_parameters): Use dbus_gtype_from_signature.  Handle
	variants specially.
	(dbus_g_type_get_lookup_function): Turn GType into an invocation
	of a lookup function.
	(write_args_for_direction): Use dbus_g_type_get_lookup_function.
	(write_untyped_out_args): New method; write output arguments.
	(write_formal_declarations_for_direction): Function for
	writing prototypes.
	(write_formal_parameters_for_direction): Function for
	writing implementations.
	(write_typed_args_for_direction): Function for writing
	arguments prefixed with GTypes.
	(write_async_method_client): Write out async version
	of method.

	* glib/dbus-binding-tool-glib.c: Include dbus-gvalue-utils.h.
	(dbus_g_type_get_marshal_name): Move mapping from GType
	to marshal name into here.
	(dbus_g_type_get_c_name): Move into here.
	(compute_marshaller): Convert signature to type with
	dbus_gtype_from_signature, use dbus_g_type_get_marshal_name.
	(compute_marshaller_name): Ditto.
	(compute_marshaller): Handle async signal annotations.
	(gather_marshallers): Return if we don't have a known
	prefix.
	(generate_glue): Collect introspection blob here, and
	write all of the blob at the end.  This allows an object
	with multiple interfaces to work.
	Mark async methods in introspection blob.

	* glib/Makefile.am (libdbus_glib_1_la_SOURCES): Add
	dbus-gtype-specialized.c, dbus-gtype-specialized.h,
	dbus-gvalue-utils.h, dbus-gvalue-utils.c.

	* dbus/dbus-glib.h: Don't include dbus-protocol.h; this
	avoids people accidentally using DBUS_TYPE_* which should
	not be necessary anymore.
	Do include dbus-gtype-specialized.h, which are utilities
	for GLib container types.
	Add various #defines for types such as
	DBUS_TYPE_G_BOOLEAN_ARRAY.
	(DBusGValueIterator, DBusGValue): Define, not fully used
	yet.
	(dbus_g_value_get_g_type): Type for recursive value.
	(dbus_g_value_open, dbus_g_value_iterator_get_value)
	(dbus_g_value_iterator_get_values, dbus_g_value_iterator_recurse)
	(dbus_g_value_free): Prototypes.
	(dbus_g_object_register_marshaller, dbus_g_proxy_new_from_proxy): Prototype.
	(dbus_g_proxy_set_interface): Prototype.
	(dbus_g_proxy_begin_call, dbus_g_proxy_end_call)
	(dbus_g_proxy_call_no_reply): Take GLib types instead of DBus
	types.
	(dbus_g_proxy_get_path, dbus_g_proxy_get_interface):
	Accessors.
	(DBusGAsyncData, DBusGMethodInvocation): Structures for
	doing async invocations.
	(dbus_g_method_return, dbus_g_method_return_error):
	Prototypes.
	* doc/dbus-tutorial.xml: Update GLib section.

	* tools/dbus-viewer.c (load_child_nodes): Update
	for new invocation type of dbus_g_proxy_end_call.
	(load_from_service_thread_func): Ditto.

	* tools/print-introspect.c (main): Ditto.

	* tools/dbus-names-model.c (have_names_notify)
	(names_model_reload, names_model_set_connection)
	Use GTypes.

	* python/Makefile.am (INCLUDES): Define DBUS_COMPILATION,
	needed since Python bindings use GLib bindings.

	* test/glib/Makefile.am (INCLUDES): Define DBUS_COMPILATION.
	Add --prefix argument.

	* tools/Makefile.am: Define DBUS_COMPILATION.  Remove
	unneeded --ignore-unsupported arg.

	* test/glib/test-service-glib.c:
	* test/glib/test-service-glib.xml:
	* test/glib/test-dbus-glib.c: Add many more tests.
2005-06-13 03:01:30 +00:00
John (J5) Palmieri
29c49bce41 * python/__init__.py: Python bindings deserve a minor version
update.  Upped to (0, 40, 2)
2005-05-24 16:34:38 +00:00
John (J5) Palmieri
982e34a1ec * python/decorators.py: add explicitly_pass_message decorator
for passing in the dbus message as keyword for edge case signal
  handling

* python/matchrules.py (SignalMatchRule.__repr__): fix output
  to conform with what dbus expects for match rules
  (SignalMatchRule.execute): add the dbus message as a keyword
  if the signal handler has requested it

* python/examples/example/signal-recipient.py: added some more
  examples on how to hook up to signals

* python/proxies.py: minor formatting changes
2005-05-24 16:30:51 +00:00
John (J5) Palmieri
e43a353d27 * python/decorators.py: import dbus_bindings
* python/matchrules.py (SignalMatchRule, SignalMatchTree,
  SignalMatchNode): new classes that implement wildcard signal
  callback matching using a tree lookup. Heavily modified from a
  patch sent by Celso Pinto (fd.o bug #3241)

* _dbus.py (add_signal_receiver, remove_signal_receiver, _signal_func):
  use new match classes to handle signals.
2005-05-24 00:21:07 +00:00
John (J5) Palmieri
8af9f11e54 - s/TYPE_PATH/TYPE_OBJECT_PATH 2005-05-19 20:27:19 +00:00
John (J5) Palmieri
63ac302bab * glib/dbus-gmain.c (io_handler_dispatch): fix deadlock
when using recursive g_main_loops

* python/_dbus.py (class Bus): add the ProxyObjectClass
  alias for ProxyObject to make it easier for the Twisted
  networking framework to integrate dbus.

* python/proxies.py (class ProxyObject): add the ProxyMethodClass
  alias for ProxyMethod to make it easier for the Twisted
  networking framework to integrate dbus.
2005-05-16 21:27:04 +00:00
John (J5) Palmieri
b4b85685f1 * Fix my name in previous changelog ;)
* python/proxies.py (ProxyObject.__getattr__): add further patch
  from Anthony Baxter to throw an AttributeError when python
  __special__ functions are called instead of marshling them over
  the bus (Bug#1685 comment 3).
2005-05-05 18:27:34 +00:00
John (J5) Palmieri
425257ddf9 * python/Makefile.am: changed to use pyexecdir for the binding
shared libraries (Bug#2494)

* python/exceptions.py: bring exceptions over from the bindings
  so they can be used in applications (Bug#2036)
  Make all exceptions derive from DBusException

* python/_dbus.py, python/proxies.py: implement __repr__ in a couple
  of classes so that print obj doesn't throw an exception (Bug #1685)
2005-05-05 18:01:45 +00:00
John (J5) Palmieri
ac3b8d0a70 * python/dbus_bindings.pyx.in:
- added new type classes for hinting to the marashaler what type
to send over the wire
- added int16 and uint16 marshalers
- Fixed a bug in the type constants that caused int32 to go out
as uint16 over the wire
* python/dbus.py: split up into different files and renamed _dbus.py
* python/__init__.py, python/_util.py, python/decorators.py,
python/exceptions.py, python/proxies.py, python/services.py,
python/types.py: new files split off from dbus.py
* python/Makefile.am: Add new files, remove dbus.py and
install all python files to <python module dir>/dbus
* python/examples/*: Added #!/usr/bin/env python to the top of
every example.  Patch provided by Tatavarty Kalyan
2005-05-01 19:34:58 +00:00
John (J5) Palmieri
8d40569d8a * python/dbus_bindings.pyx.in (send_with_reply_handlers): New send
method for doing async calls
(_pending_call_notification): New C function for handling pendning call
callbacks
(set_notify): New method for setting pending call notification

* python/dbus.py: new version tuple "version" is set at (0, 40, 0)
Async capabilities added to remote method calls
(Sender): class removed
(RemoteService): class removed
(ObjectTree): class removed for now
(RemoteObject): Renamed to ProxyObject
(RemoteMethod): Renamed to ProxyMethod
(method): Decorator added for decorating python methods as dbus methods
(signal): Decorator added for decorating python methods as signal emitters
(ObjectType): Metaclass added for generating introspection data and the
method callback vtable
(Interface): Wrapper class added to wrap objects in a dbus interface
(Object): Uses ObjectType as its metaclass and exports Introspect
of the org.freedesktop.DBus.Introspectable interface
(ValidationException, UnknownMethodException): new exceptions

* python/examples/*: Modified to fit with the new bindings
2005-04-25 22:54:28 +00:00
John (J5) Palmieri
8f5a88e1e2 * python/lvalue_cast_post_process.py - removed. Patch has been
submitted to Pyrex maintainers that fixes gcc4.0 error

* python/Makefile.am: removed refrences to lvalue_cast_post_process.py
2005-03-29 17:01:43 +00:00
John (J5) Palmieri
11519c46c4 * python/lvalue_cast_post_process.py - added post processor to fix Pyrex
code so that it compiles with gcc4.0

* python/Makefile.am: Added lvalue_cast_post_process.py to EXTRA_DIST
  run dbus_bindings.c through lvalue_cast_post_process.py and copy the
  results back to dbus_binding.c
2005-03-21 21:13:56 +00:00
John (J5) Palmieri
d3f1b8bc89 python/dbus_bindings.pyx.in (PendingCall::get_reply):
s/dbus_pending_call_get_reply/dbus_pending_call_steal_reply
2005-02-23 19:36:24 +00:00
John (J5) Palmieri
38dad64ace * python/dbus.py (class Sender): added to support dbus signals better
(Bus::add_signal_receiver): added expand_args parameter which defaults
to True.  When expand args is True the signal handler will pass the
message arguments as parameters to the signal handler.  If False
revert to previous behavior where the signal handler must get the
argument list from the message.  This is to help port applications
like HAL that have a tendancy to send variable length argument lists.
self._match_rule_to_receivers is now a dict of dicts.
(Bus::remove_signal_receiver): pop handler off the dict intead of
removing it from a list
(Bus::_signal_func): change signal handlers so that interface,
signal_name, service, path and message are packed into a Sender
object and that is passed to the handler.  If expand_args is True
extract the args list from the message and append it to the parameter
list

* python/dbus_bindings.pyx.in (class Signature): added to support
signiature types
(MessageIter::__init__): changed iteration limit to match D-BUS
(MessageIter::get*): added INT16, UINT16, SIGNATURE, DICT_ENTRY,
STRUCT and VARIENT type support
(MessageIter::python_value_to_dbus_sig): made recursive to support
recursive types
(MessageIter::append*): added Signature, dict, tuple
support

* python/examples/example-client.py: added examples of getting tuples
and dicts

* python/examples/example-service.py: added examples of sending tuples
and dicts

* python/examples/example-signal-recipient.py: Fixed to handle new
signal callback format
2005-02-11 19:51:18 +00:00
John (J5) Palmieri
216fa619f3 * python/dbus_bindings.pyx.in: Updated to handle new D-BUS type system
- BUS_ACTIVATION -> BUS_STARTER
	- DBUS_BUS_ACTIVATION -> DBUS_BUS_STARTER
	- class MessageIter (__init__): Added recursion checking
	so we throw a nice error instead of just disconnecting from the
	bus.
	(get): Added arg_type parameter for recursion.
	Removed the nil type
	Added signiture type placeholder (not implemented)
	Added struct type placeholder (not implemented)
	Added varient type placeholder (not implemented)
	Commented out dict type for now
	(get_element_type): renamed from get_array_type
	(get_*): changed to use the dbus_message_iter_get_basic API
	(get_*_array): removed in favor of recursive get_array method
	(get_array): new recursive method which calls get to marshal
        the elements of the array
	(value_to_dbus_sig): New method returns the corrasponding
	dbus signiture to a python value
	(append): Comment out dict handling for now
	Handle lists with the new recursive API
	Comment out None handling for now
	(append_nil): removed
	(append_*): changed to use dbus_message_iter_append_basic API
	(append_*_array): removed in favor of recursive append_array
	method
	(__str__): Make it easier to print out recursive iterators
	for debugging
	- class Message (__str__): moved type inspection to the
	MessageIter class' __str__ method
	(get_iter): Added an append parameter wich defaults to False
	If True use the new API's to create an append iterator

* python/dbus.py: Update to use new bindings API
	- TYPE_ACTIVATION -> TYPE_STARTER
	- class Bus (_get_match_rule): GetServiceOwner -> GetNameOwner
	- class ActivationBus -> class StarterBus
	- class RemoteObject (__call__): get an append iterator
	- (_dispatch_dbus_method_call): get an append iterator
	- class Object (emit_signal): get an append iterator

* python/examples/: Fixed up the examples to work with the new API
2005-01-28 19:09:55 +00:00
John (J5) Palmieri
f4d4d5ace5 * python/dbus_bindings.pyx.in: Rename of methods and bindings
- get_base_service->get_unique_name
	- bus_get_base_service->bus_get_unique_name
	- dbus_bus_get_base_service -> dbus_bus_get_unique_name
	- ACTIVATION_REPLY_ACTIVATED -> DBUS_START_REPLY_SUCCESS
	- ACTIVATION_REPLY_ALREADY_ACTIVE -> DBUS_START_REPLY_ALREADY_RUNNING
	- bus_activate_service -> bus_start_service_by_name
	- dbus_bus_activate_service -> dbus_bus_start_service_by_name
	- bus_acquire_service -> bus_request_name
	- dbus_bus_acquire_service -> dbus_bus_request_name
	- bus_service_exists -> bus_name_has_owner
	- dbus_bus_service_exists -> dbus_bus_name_has_owner

* python/dbus.py: Rename of methods
	- activate_service -> start_service_by_name
	- bus_acquire_service -> bus_request_name
	- ACTIVATION_REPLY_ACTIVATED -> START_REPLY_SUCCESS
	- ACTIVATION_REPLY_ALREADY_ACTIVE -> START_REPLY_ALREADY_RUNNING
2005-01-25 19:06:53 +00:00
John (J5) Palmieri
7da3315f8c 2004-12-30 John (J5) Palmieri <johnp@redhat.com>
* python/dbus.py: s/ACTIVATION_REPLY_ACTIVE/ACTIVATION_REPLY_ACTIVATED
2004-12-30 18:28:03 +00:00
John (J5) Palmieri
63586e48f4 2004-12-30 John (J5) Palmieri <johnp@redhat.com>
* python/dbus_bindings.pyx.in: Change DBUS_ACTIVATION_REPLY_ACTIVATED
        and DBUS_ACTIVATION_REPLY_ALREADY_ACTIVE to match the values in
        dbus-protocol.h.  Because they are defines and not enums they are not
        autogenerated.
2004-12-30 14:19:54 +00:00
John (J5) Palmieri
a11bbc91a7 2004-12-26 John (J5) Palmieri <johnp@redhat.com>
* python/dbus_bindings.pyx.in (bus_activate_service): Bind
	dbus_bus_activate_service

	* python/dbus.py (Bus.activate_service): activate a service on the
	bus.
2004-12-27 16:01:13 +00:00
John (J5) Palmieri
f06f148871 * patch from Rob Taylor <robtaylor@fastmail.fm>
- wrap bus_get_unix_user method in low level bindings
	- add get_unix_user method to the Bus class
	- fix extract.py so it can handle unsigned long return types
2004-12-23 00:50:37 +00:00
David Zeuthen
31b1e75289 2004-09-16 David Zeuthen <david@fubar.dk>
* python/dbus_bindings.pyx.in: Add support for int64 and uint64
2004-09-16 19:56:26 +00:00
Anders Carlsson
b72fe8c67d 2004-07-28 Anders Carlsson <andersca@gnome.org>
* python/dbus.py:
	* python/dbus_bindings.pyx.in:
	Add dbus.init_gthreads (), allow emit_signal to pass
	arguments to the signal.
2004-07-28 18:14:55 +00:00
Seth Nickell
5d0ed9c704 2004-07-18 Seth Nickell <seth@gnome.org>
* python/dbus.py:
	* python/dbus_bindings.pyx.in:
	* python/tests/test-client.py:

	Add dbus.ByteArray and dbus_bindings.ByteArray
	types so that byte streams can be passed back.

	Give jdahlin the heaps of credit that are so
	rightfully his.
2004-07-18 21:44:37 +00:00
Seth Nickell
5afe4265ea 2004-07-12 Seth Nickell <seth@gnome.org>
* python/dbus.py:

	Add message argument to the default object_method_handler
	function.

	* python/dbus_bindings.pyx.in:

	Automatically return NIL when passed an empty list
	(we can't pass back a list since lists are typed
	and we don't have any idea what type the the client
	intended the list to be... :-( )
2004-07-12 06:29:00 +00:00
Seth Nickell
dd4ff748c1 2004-07-10 Seth Nickell <seth@gnome.org>
* python/examples/Makefile.am:

	Fix distcheck breakage caused by new examples.
2004-07-11 03:09:03 +00:00
Seth Nickell
233f8d0e33 2004-07-10 Seth Nickell <seth@gnome.org>
* python/dbus.py:

	Add "message" argument to service-side dbus.Object
	methods. This will break existing services written
	using the python bindings, but will allow extraction
	of all the message information (e.g. who its from).

	Add improved "object oriented" signal handling/emission.

	* python/examples/example-service.py:

	Nix this example.

	* python/examples/example-signal-emitter.py:
	* python/examples/example-signal-recipient.py:

	Two new examples that show how to emit and receive
	signals using the new APIs.

	* python/examples/example-signals.py:
	* python/examples/gconf-proxy-service.py:
	* python/examples/gconf-proxy-service2.py:

	Add "message" argument to service methods.
2004-07-11 03:02:14 +00:00
John (J5) Palmieri
5d58a04018 * switched include directory from glib/ to dbus/
since dbus-glib.h moved
2004-06-23 14:59:44 +00:00
Owen Fraser-Green
e7ec62bcb0 Fixed typo for python/examples make 2004-06-10 12:13:39 +00:00
John (J5) Palmieri
118f72cd0c * Python bindings are updated to reflect C API changes which now
accept plain path strings instead of an array of path elements.
2004-06-08 02:35:44 +00:00
Seth Nickell
241878cded Update .cvsignore files 2004-06-01 06:16:13 +00:00
Seth Nickell
736f76ba97 2004-06-01 Seth Nickell <seth@gnome.org>
* python/dbus_bindings.pyx.in:
	* python/tests/test-client.py:

	Round off basic type support. Add dicts (yay!), and
	remaining array types.

	Make MessageIter more general so it works for dicts too.

	Mark all loop variables as C integers.
2004-06-01 06:13:31 +00:00
Seth Nickell
23e9d3d504 * python/dbus_bindings.pyx.in:
* python/tests/test-client.py:

	Test Suite: 1
	Python Bindings: 0

	(fix string array memory trashing bug... oops)
2004-06-01 01:20:59 +00:00
Seth Nickell
d027c99375 2004-05-30 Seth Nickell <seth@gnome.org>
* python/dbus.py:

	Add a nicer-but-less-flexible alternate API for handling
	calls to virtual objects in dbus.ObjectTree.

	Screw up the argument order to the dbus.Object constructor
	for consistency with dbus.ObjectTree (and to make dbus_methods
	optional for future extension)

	* python/examples/Makefile.am:
	* python/examples/gconf-proxy-service.py:
	* python/examples/gconf-proxy-service2.py:

	Alternate implementation of gconf-proxy-service using the
	nicer dbus.ObjectTree API.

	* python/examples/example-service.py:
	* python/tests/test-server.py

	Reverse the argument order to deal with dbus.Object constructor
	changes.
2004-05-30 08:20:58 +00:00
Seth Nickell
7dc64ab60a 2004-05-30 Seth Nickell <seth@gnome.org>
* python/examples/example-client.py:
	* python/examples/example-service.py:

	Take it back. Lists seem to work but they're broken
	in the test suite. Make the base examples use
	lists (works fine).
2004-05-30 06:26:24 +00:00
Seth Nickell
8a10d91cc0 2004-05-30 Seth Nickell <seth@gnome.org>
* python/dbus_bindings.pyx.in:
	* python/tests/test-client.py:

	Add some more tests and fix errors that crop up.
	Unfortunately, currently it seems like marshalling
	and unmarshalling of lists is completely broken :-(
2004-05-30 06:21:00 +00:00
Seth Nickell
26c937cb30 2004-05-30 Seth Nickell <seth@gnome.org>
* python/dbus_bindings.pyx.in:

	Add support for ObjectPath type.

	* python/dbus.py:

	Refactor message handling code to a common function.

	* python/tests/test-client.py:
	* python/tests/test-server.py:

	Add tests that check to make sure values of all types
	can be echoed from a service w/o mangling.
2004-05-30 05:30:09 +00:00
Seth Nickell
2e8a06bb8f 2004-05-29 Seth Nickell <seth@gnome.org>
* python/dbus.py:

	Add ObjectTree class which allows implementation
	of trees of "virtual" objects. Basically the python
	wrapper for "register_fallback".

	* python/examples/Makefile.am
	* python/examples/gconf-proxy-client.py:
	* python/examples/gconf-proxy-service.py:

	Implement a simple GConf proxy service that supports
	get/set on string and int GConf keys using the ObjectTree.
2004-05-30 02:26:48 +00:00