(self)
Ensure we are populated
Ensure we are populated
Ensure we are populated
def prepare_attributes(self):
        """Ensure we are populated"""
        if not self.bus_name:
            dbg('Checking for bus name availability: %s' % BUS_NAME)
            try:
                bus = dbus.SessionBus()
            except Exception as e:
                err('Unable to connect to DBUS Server, proceeding as standalone')
                raise ImportError
            proxy = bus.get_object('org.freedesktop.DBus',
                                   '/org/freedesktop/DBus')
            flags = 1 | 4 # allow replacement | do not queue
            if not proxy.RequestName(BUS_NAME, dbus.UInt32(flags)) in (1, 4):
                dbg('bus name unavailable: %s' % BUS_NAME)
                raise dbus.exceptions.DBusException(
                    "Couldn't get DBus name %s: Name exists" % BUS_NAME)
            self.bus_name = dbus.service.BusName(BUS_NAME,
                                                 bus=dbus.SessionBus())
        if not self.bus_path:
            self.bus_path = BUS_PATH
        if not self.terminator:
            self.terminator = Terminator()
def prepare_attributes ( self ) : if not self . bus_name : dbg ( 'Checking for bus name availability: %s' % BUS_NAME ) try : bus = dbus . SessionBus ( ) except Exception as e : err ( 'Unable to connect to DBUS Server, proceeding as standalone' ) raise ImportError proxy = bus . get_object ( 'org.freedesktop.DBus' , '/org/freedesktop/DBus' ) flags = 1 | 4 # allow replacement | do not queue if not proxy . RequestName ( BUS_NAME , dbus . UInt32 ( flags ) ) in ( 1 , 4 ) : dbg ( 'bus name unavailable: %s' % BUS_NAME ) raise dbus . exceptions . DBusException ( "Couldn't get DBus name %s: Name exists" % BUS_NAME ) self . bus_name = dbus . service . BusName ( BUS_NAME , bus = dbus . SessionBus ( ) ) if not self . bus_path : self . bus_path = BUS_PATH if not self . terminator : self . terminator = Terminator ( )