From 372ee0f5bcdf1a55e6772b84868047e2ed64bc00 Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Thu, 14 Dec 2017 16:56:59 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BA=D0=BE=D0=B4=20=D0=B4=D0=BB=D1=8F=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BF=D1=83=D1=81=D0=BA=D0=B0=20=D1=81=D0=B5=D1=80=D0=B2=D0=B8?= =?UTF-8?q?=D1=81=D0=B0=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20dbus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/calculate/lib/utils/dbus_tools.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pym/calculate/lib/utils/dbus_tools.py b/pym/calculate/lib/utils/dbus_tools.py index 1d79b51..172f466 100644 --- a/pym/calculate/lib/utils/dbus_tools.py +++ b/pym/calculate/lib/utils/dbus_tools.py @@ -41,3 +41,20 @@ def get_dbus_path_tree(bus_name, bus=None): yield x except dbus.DBusException: pass + +def run_dbus_core(hostname, port): + if hostname in ("127.0.0.1", "localhost"): + try: + from ip import check_port + if not check_port(hostname, port): + bus = dbus.SystemBus() + DBUS_INTERFACE="org.calculate.CoreInterface" + DBUS_NAME="org.calculate.Core" + DBUS_OBJECT="/Core" + try: + remote_object = bus.get_object(DBUS_NAME, DBUS_OBJECT) + remote_object.Start(port) + except dbus.DBusException: + pass + except ImportError: + pass