コード例 #1
0
    def power_adapter(self):
        adapter = self.get_adapter()

        adapter_props = dbus.Interface(
            dbus.get_object(BLUEZ_SERVICE_NAME, adapter),
            "org.freedesktop.DBus.Properties")
        adapter_props.Set("org.bluez.Adapter1", "Powered", dbus.Boolean(1))
コード例 #2
0
def have_dbus_notification_service():
    # type: () -> bool
    try:
        import dbus
        dbus = dbus.SessionBus(private=True)
        proxy = dbus.get_object('org.freedesktop.Notifications', '/org/freedesktop/Notifications')
    except NameExistsException as e:
        logger.error(u"WARNING: dbus notification service not available, eduVPN client functionality limited")
        dbus.close()
        return False
    except Exception as e:
        logger.error(u"WARNING: dbus daemon not running, eduVPN client functionality limited")
        return False
    else:
        dbus.close()
        return True
コード例 #3
0
    def __init__(self, parent, dbus):
	self.values = dict(zip(['pdop','hdop','vdop'],[None]))
        """ contains items['name']=value mapping)"""
        self.value_labels = {}
        """ contains items['signal']=valuelabel mapping """
        self.satdetails = None # widget that displays sat details

        self.gypsy = dbus.get_object('org.freedesktop.Gypsy', '/org/freedesktop/Gypsy')
        super(GpsInfoBox, self).__init__(parent)
    
        # create a 'caption' and a 'value' label for all values in table cells
        for (i, item) in enumerate(GpsInfoBox.items):
            # put caption label in cell
            cap_l = elementary.Label(self)
            cap_l.size_hint_align_set(-1.0, 0.0)
            cap_l.text_set(item['cap'] + ':')
            (row, col) = divmod(i,2)
            self.pack(cap_l, col*2, row, 1, 1)
            cap_l.show()

            # put value label in cell
            val_l = elementary.Label(self)
            val_l.size_hint_align_set(-1.0, 0.0)
            cap_l.size_hint_weight_set(1.0, -1.0)
            val_l.text_set('<i>unknown</i>')
            val_l.show()
            self.pack(val_l, col*2 +1, row, 1, 1)
            self.value_labels[item['signal']] = val_l

        row = len(GpsInfoBox.items) // 2 + 1
        sat_details_bt = elementary.Button(self)
        sat_details_bt.text_set(_("Satellite details"))
        sat_details_bt.size_hint_weight_set(-1.0, 0.0)
        sat_details_bt.size_hint_align_set(-1.0, 0.0)
        sat_details_bt.show()
        sat_details_bt._callback_add('clicked', self.cb_show_sat_details)
        self.pack(sat_details_bt, 0, row, 4, 1)
        
        # catch all gypsy signals and udate values            
        self.sigMatch = dbus.add_signal_receiver(self.on_gypsy_signal, bus_name='org.freedesktop.Gypsy', interface_keyword='iface', member_keyword='signal')
コード例 #4
0
ファイル: dbus_client.py プロジェクト: Andvari/dbus_client
'''
Created on Oct 25, 2012

@author: nemo
'''

import dbus


dbus = dbus.SessionBus()
my_dbus_proxy = dbus.get_object('home.nemo.my_dbus', '/home/nemo/my_dbus')

for i in range(10):
    my_dbus_proxy.print_num(i)