Код: Выделить всё
olej@R420:~$ python
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import Geoclue
<stdin>:1: PyGIWarning: Geoclue was imported without specifying a version first. Use gi.require_version('Geoclue', '2.0') before import to ensure that the right version gets loaded.
>>> dir(Geoclue);
['AccuracyLevel', 'Client', 'ClientIface', 'ClientProxy', 'ClientProxyClass', 'ClientProxyCreateFlags', 'ClientProxyPrivate', 'ClientSkeleton', 'ClientSkeletonClass', 'ClientSkeletonPrivate', 'Location', 'LocationIface', 'LocationProxy', 'LocationProxyClass', 'LocationProxyPrivate', 'LocationSkeleton', 'LocationSkeletonClass', 'LocationSkeletonPrivate', 'Manager', 'ManagerIface', 'ManagerProxy', 'ManagerProxyClass', 'ManagerProxyPrivate', 'ManagerSkeleton', 'ManagerSkeletonClass', 'ManagerSkeletonPrivate', 'Simple', 'SimpleClass', 'SimplePrivate', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__file__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__loader__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__package__', '__path__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__spec__', '__str__', '__subclasshook__', '__weakref__', '_namespace', '_version', 'client_interface_info', 'client_override_properties', 'location_interface_info', 'location_override_properties', 'manager_interface_info', 'manager_override_properties']
>>> dir(Geoclue.Simple)
['__class__', '__copy__', '__deepcopy__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__gdoc__', '__ge__', '__getattribute__', '__gpointer__', '__grefcount__', '__gsignals__', '__gt__', '__gtype__', '__hash__', '__info__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_force_floating', '_ref', '_ref_sink', '_unref', '_unsupported_data_method', '_unsupported_method', 'bind_property', 'bind_property_full', 'chain', 'compat_control', 'connect', 'connect_after', 'connect_data', 'connect_object', 'connect_object_after', 'disconnect', 'disconnect_by_func', 'emit', 'emit_stop_by_name', 'find_property', 'force_floating', 'freeze_notify', 'g_type_instance', 'get_client', 'get_data', 'get_location', 'get_properties', 'get_property', 'get_qdata', 'getv', 'handler_block', 'handler_block_by_func', 'handler_disconnect', 'handler_is_connected', 'handler_unblock', 'handler_unblock_by_func', 'init_async', 'init_finish', 'install_properties', 'install_property', 'interface_find_property', 'interface_install_property', 'interface_list_properties', 'is_floating', 'list_properties', 'new', 'new_finish', 'new_sync', 'newv', 'newv_async', 'notify', 'notify_by_pspec', 'override_property', 'parent', 'priv', 'props', 'qdata', 'ref', 'ref_count', 'ref_sink', 'replace_data', 'replace_qdata', 'run_dispose', 'set_data', 'set_properties', 'set_property', 'steal_data', 'steal_qdata', 'stop_emission', 'stop_emission_by_name', 'thaw_notify', 'unref', 'watch_closure', 'weak_ref']
>>>
>>> clue = Geoclue.Simple.new_sync('something',Geoclue.AccuracyLevel.NEIGHBORHOOD,None)
>>> location = clue.get_location()
>>> print(location.get_property('latitude'), location.get_property('longitude'))
49.99099928005759 36.2566
>>>