예제 #1
0
파일: server-sdk.py 프로젝트: jusa/utils
 def register_follower(self, name):
     IFACE = "org.sailfish.sdk.client"
     PATH = "/org/sailfish/sdk/client"
     bus = dbus.SessionBus()
     service = bus.get_object(name, PATH)
     method_write = service.get_dbus_method("Write", IFACE)
     method_quit = service.get_dbus_method("Quit", IFACE)
     if self._state in (Task.CREATED, Task.STARTING, Task.RUNNING):
         self._followers.append((method_write, method_quit, name))
     else:
         GLib.idle_add(self._quit_follower, method_quit)
예제 #2
0
def check_existing_processes(configfile):
    # Append the configuration file to the well-known name, not just to the
    # service name, because in the latter case it would seem to work with 2
    # processes, but it wouldn't work as expected with 3 or more processes
    # Add "C" because a digit cannot follow a dot
    wkname = 'org.Kynikos.Outspline.C' + hashlib.md5(configfile).hexdigest()
    DBUS_SERVICE_NAME = "/Main"

    # This class must be defined here because dbus.service.method has to get
    # the right well-known-name
    class DbusService(dbus.service.Object):
        def __init__(self):
            busname = dbus.service.BusName(wkname, bus=bus)
            super(DbusService, self).__init__(busname, DBUS_SERVICE_NAME)

        @dbus.service.method(wkname)
        def nudge(self):
            external_nudge_event.signal()

    try:
        # DBusGMainLoop must be instantiated *before* SessionBus
        DBusGMainLoop(set_as_default=True)
        bus = dbus.SessionBus()
    except dbus.exceptions.DBusException as err:
        # D-Bus may be installed but not started
        sys.exit("DBusException: " + err.message)
    else:
        try:
            service = bus.get_object(wkname, DBUS_SERVICE_NAME)
        except dbus.exceptions.DBusException:
            service = DbusService()
        else:
            nudge_existing_process = service.get_dbus_method('nudge', wkname)
            nudge_existing_process()
            sys.exit("Another instance of Outspline is using " + configfile)
예제 #3
0
def make_visible():
    """Get and call the unhide method of the running Touchpad-indicator."""

    bus = dbus.SessionBus()
    service = bus.get_object('es.atareao.TouchpadIndicator',
                             '/es/atareao/TouchpadIndicator')
    unhide = service.get_dbus_method('unhide', 'es.atareao.TouchpadIndicator')
    unhide()
예제 #4
0
파일: sdk.py 프로젝트: jusa/utils
def sdk_method(method_name):
    bus = dbus.SessionBus()
    try:
        service = bus.get_object(SERVER_NAME, SERVER_PATH)
    except dbus.exceptions.DBusException as e:
        print("Cannot reach server: {}".format(e))
        sys.exit(255)
    return service.get_dbus_method(method_name, SERVER_NAME)
예제 #5
0
def make_visible():
	"""Get and call the unhide method of the running Touchpad-indicator."""

	bus = dbus.SessionBus()
	service = bus.get_object('es.atareao.TouchpadIndicator',\
									'/es/atareao/TouchpadIndicator')
	unhide = service.get_dbus_method('unhide',\
									'es.atareao.TouchpadIndicator')
	unhide()
예제 #6
0
파일: remote.py 프로젝트: ecb-eng/poco
 def stop_running_instance(self):
     if self.bus.name_has_owner(SERVICE_NAME):
         service = self.bus.get_object(SERVICE_NAME, SERVICE_OBJECT_PATH)
         quit_function = service.get_dbus_method('stop_poco',
                                                 'io.github.poco.Service')
         quit_function()
         print("Remote instance were stopped")
     else:
         print("poco is not running")
예제 #7
0
def change_status():
	"""Get and call the change_state method of the running
		Touchpad-indicator."""

	bus = dbus.SessionBus()
	service = bus.get_object('es.atareao.TouchpadIndicator',\
									'/es/atareao/TouchpadIndicator')
	change_state = service.get_dbus_method('change_state',\
									'es.atareao.TouchpadIndicator')
	change_state()
def change_status():
    """Get and call the change_state method of the running
		Touchpad-indicator."""

    bus = dbus.SessionBus()
    service = bus.get_object('es.atareao.TouchpadIndicator',\
            '/es/atareao/TouchpadIndicator')
    change_state = service.get_dbus_method('change_state',\
            'es.atareao.TouchpadIndicator')
    change_state()
예제 #9
0
 def call_running_instance(self, pageid):
     bus = dbus.SessionBus()
     service = bus.get_object('org.freyja.utt', '/org/freyja/utt')
     service.get_dbus_method('switch_to_page', 'org.freyja.utt')(pageid)
예제 #10
0
파일: remote.py 프로젝트: ecb-eng/poco
 def get_running_instance_id(self):
     service = self.bus.get_object(SERVICE_NAME, SERVICE_OBJECT_PATH)
     get_remote_id = service.get_dbus_method('get_id',
                                             'io.github.poco.Service')
     return get_remote_id()
예제 #11
0
 def call_running_instance(self, pageid):
     bus = dbus.SessionBus()
     service = bus.get_object('org.freyja.utt', '/org/freyja/utt')
     service.get_dbus_method('switch_to_page', 'org.freyja.utt')(pageid)
예제 #12
0
파일: sdk.py 프로젝트: jusa/utils
 def _m(self, method_name):
     bus = dbus.SessionBus()
     service = bus.get_object(SERVER_NAME, SERVER_PATH)
     return service.get_dbus_method(method_name, SERVER_NAME)
예제 #13
0
 def call_show_main_window():
     bus = dbus.SessionBus()
     service = bus.get_object(BUS_NAME, OBJECT_PATH)
     show = service.get_dbus_method('show', TGCM_IFACE)
     show()