Esempio n. 1
0
File: db.py Progetto: philn/shuffler
 def __init__(self, bus, filename):
     log.Loggable.__init__(self)
     Object.__init__(self, bus, DB_PATH)
     DBusDB.__init__(self)
     self.tube = bus
     self.info("Loading db from %r", filename)
     self.filename = filename
    def __init__(self, am, path, display_name, parameters):
        Object.__init__(self, am.connection, path)
        self._am = am

        self._connection = dbus.ObjectPath('/')
        self._connection_status = Connection_Status_Disconnected
        self._connection_status_reason = Connection_Status_Reason_None_Specified
        self._connection_error = u''
        self._connection_error_details = dbus.Dictionary({}, signature='sv')
        self._service = u''
        self._display_name = display_name
        self._icon = u'bob.png'
        self._enabled = True
        self._nickname = u'Bob'
        self._parameters = parameters
        self._has_been_online = False
        self._connect_automatically = False
        self._normalized_name = u'bob'
        self._automatic_presence = dbus.Struct(
                (Connection_Presence_Type_Available, 'available', ''),
                signature='uss')
        self._current_presence = dbus.Struct(
                (Connection_Presence_Type_Offline, 'offline', ''),
                signature='uss')
        self._requested_presence = dbus.Struct(
                (Connection_Presence_Type_Offline, 'offline', ''),
                signature='uss')
        self._avatar = dbus.Struct(
                (dbus.ByteArray(''), 'image/png'),
                signature='ays')
        self._interfaces = [ACCOUNT_IFACE_AVATAR_IFACE,]
Esempio n. 3
0
    def __init__(self, am, path, display_name, parameters):
        Object.__init__(self, am.connection, path)
        self._am = am

        self._connection = dbus.ObjectPath('/')
        self._connection_status = Connection_Status_Disconnected
        self._connection_status_reason = Connection_Status_Reason_None_Specified
        self._connection_error = u''
        self._connection_error_details = dbus.Dictionary({}, signature='sv')
        self._service = u''
        self._display_name = display_name
        self._icon = u'bob.png'
        self._enabled = True
        self._nickname = u'Bob'
        self._parameters = parameters
        self._has_been_online = False
        self._connect_automatically = False
        self._normalized_name = u'bob'
        self._automatic_presence = dbus.Struct(
            (Connection_Presence_Type_Available, 'available', ''),
            signature='uss')
        self._current_presence = dbus.Struct(
            (Connection_Presence_Type_Offline, 'offline', ''), signature='uss')
        self._requested_presence = dbus.Struct(
            (Connection_Presence_Type_Offline, 'offline', ''), signature='uss')
        self._avatar = dbus.Struct((dbus.ByteArray(''), 'image/png'),
                                   signature='ays')
        self._interfaces = [
            ACCOUNT_IFACE_AVATAR_IFACE,
        ]
Esempio n. 4
0
    def __init__(self, am, path, display_name, parameters):
        Object.__init__(self, am.connection, path)
        self._am = am

        self._display_name = display_name
        self._icon = u'bob.png'
        self._enabled = True
        self._nickname = u'Bob'
        self._parameters = parameters
        self._connect_automatically = True
        self._normalized_name = u'bob'
        self._automatic_presence = dbus.Struct(
                (Connection_Presence_Type_Available, 'available', ''),
                signature='uss')
        self._current_presence = dbus.Struct(
                (Connection_Presence_Type_Offline, 'offline', ''),
                signature='uss')
        self._requested_presence = dbus.Struct(
                (Connection_Presence_Type_Offline, 'offline', ''),
                signature='uss')
        self._avatar = dbus.Struct(
                (dbus.ByteArray(''), 'image/png'),
                signature='ays')
        self._connection_status = Connection_Status_Disconnected
        self._connection_path = dbus.ObjectPath('/')
        self._interfaces = [ACCOUNT_IFACE_AVATAR_IFACE,]
Esempio n. 5
0
 def __init__(self, manager):
     from SCRIBES.Globals import session_bus as session
     from SCRIBES.Globals import SCRIBES_SAVE_PROCESS_DBUS_PATH
     bus_name = BusName(dbus_service, bus=session)
     Object.__init__(self, bus_name, SCRIBES_SAVE_PROCESS_DBUS_PATH)
     self.__manager = manager
     manager.connect("is-ready", self.__is_ready_cb)
     manager.connect("saved-data", self.__saved_data_cb)
     manager.connect("error", self.__error_cb)
Esempio n. 6
0
	def __init__(self, manager):
		from SCRIBES.Globals import session_bus as session
		from SCRIBES.Globals import SCRIBES_SAVE_PROCESS_DBUS_PATH
		bus_name = BusName(dbus_service, bus=session)
		Object.__init__(self, bus_name, SCRIBES_SAVE_PROCESS_DBUS_PATH)
		self.__manager = manager
		manager.connect("is-ready", self.__is_ready_cb)
		manager.connect("saved-data", self.__saved_data_cb)
		manager.connect("error", self.__error_cb)
Esempio n. 7
0
 def __init__(self, bus, commands, winman):
     # type: (SessionBus, CommandRegistry, WindowManager) -> None
     """
     @param bus: The connection on which to export this object.
         See the C{dbus.service.Object} documentation for details.
     """
     Object.__init__(self, bus, '/com/ssokolow/QuickTile')
     self.commands = commands
     self.winman = winman
Esempio n. 8
0
	def __init__(self, manager):
		from SCRIBES.Globals import session_bus
		from dbus.exceptions import NameExistsException
		try:
			bus_name = BusName(DBUS_SERVICE, bus=session_bus, do_not_queue=True)
			Object.__init__(self, bus_name, DBUS_PATH)
			self.__manager = manager
		except NameExistsException:
			manager.quit()
Esempio n. 9
0
 def __init__(self, session_bus=None, object_path=None):
     if dbus:
         Object.__init__(self, session_bus, object_path)
     self.Version = __version__
     self.factura = None
     self.Exception = self.Traceback = ""
     self.LanzarExcepciones = False
     self.printer = None
     self.log = StringIO()
Esempio n. 10
0
	def __init__(self, manager):
		from SCRIBES.Globals import session_bus
		from dbus.exceptions import NameExistsException
		try:
			bus_name = BusName(DBUS_SERVICE, bus=session_bus, do_not_queue=True)
			Object.__init__(self, bus_name, DBUS_PATH)
			self.__manager = manager
		except NameExistsException:
			manager.quit()
Esempio n. 11
0
 def __init__(self, bus, commands, winman):
     # type: (SessionBus, CommandRegistry, WindowManager) -> None
     """
     @param bus: The connection on which to export this object.
         See the C{dbus.service.Object} documentation for details.
     """
     Object.__init__(self, bus, '/com/ssokolow/QuickTile')
     self.commands = commands
     self.winman = winman
Esempio n. 12
0
 def __init__(self, session_bus=None, object_path=None):
     if dbus:
         Object.__init__(self, session_bus, object_path)
     self.Version = __version__
     self.factura = None
     self.Exception = self.Traceback = ""
     self.LanzarExcepciones = False
     self.factura = {}
     self.printer = None
     self.log = StringIO()
Esempio n. 13
0
	def __init__(self, manager):
		from SCRIBES.Globals import session_bus
		from dbus.exceptions import NameExistsException
		try:
			bus_name = BusName(indexer_dbus_service, bus=session_bus, do_not_queue=True)
			Object.__init__(self, bus_name, indexer_dbus_path)
			self.__manager = manager
			manager.connect("finished", self.__finished_cb)
		except NameExistsException:
			manager.quit()
Esempio n. 14
0
 def __init__(self, manager):
     from SCRIBES.Globals import session_bus
     from dbus.exceptions import NameExistsException
     try:
         bus_name = BusName(indexer_dbus_service,
                            bus=session_bus,
                            do_not_queue=True)
         Object.__init__(self, bus_name, indexer_dbus_path)
         self.__manager = manager
         manager.connect("finished", self.__finished_cb)
     except NameExistsException:
         manager.quit()
Esempio n. 15
0
	def __init__(self, manager):
		from Globals import session_bus
		from dbus.exceptions import NameExistsException
		try:
			service_name = "net.sourceforge.Scribes"
			object_path = "/net/sourceforge/Scribes"
			bus_name = BusName(service_name, bus=session_bus, do_not_queue=True)
			Object.__init__(self, bus_name, object_path)
			self.__manager = manager
		except NameExistsException:
			print "ERROR! Another instances of Scribes is already running. Cannot run more than one instance of Scribes. Killing this instance!"
			manager.force_quit()
Esempio n. 16
0
 def __init__(self, service):
     self.svc = service
     path = DBUS_PATH(service.get_name(), self.dbus_path)
     ns = DBUS_NS(service.get_name(), self.dbus_path)
     self.dbus_ns = ns
     self.dbus_path = path
     Object.__init__(self, BUS_NAME, path)
     self.config_match = BUS.add_signal_receiver(
                             self.on_config_changed, 'CONFIG_CHANGED',
                             ns, None, path, sender_keyword='sender')
     self.config_extra_match = BUS.add_signal_receiver(
                             self.on_config_changed_extra,
                             'CONFIG_EXTRA_CHANGED',
                             ns, None, path, sender_keyword='sender')
Esempio n. 17
0
    def __init__(self, bus=None):
        #: map from object path to Account
        self._valid_accounts = {}
        #: map from object path to Account
        self._invalid_accounts = {}

        if bus is None:
            bus = dbus.SessionBus()

        ret = bus.request_name(AM_BUS_NAME, NAME_FLAG_DO_NOT_QUEUE)
        if ret == REQUEST_NAME_REPLY_EXISTS:
            raise dbus.NameExistsException(AM_BUS_NAME)

        Object.__init__(self, bus, AM_OBJECT_PATH)
Esempio n. 18
0
    def __init__(self, bus=None):
        #: map from object path to Account
        self._valid_accounts = {}
        #: map from object path to Account
        self._invalid_accounts = {}

        if bus is None:
            bus = dbus.SessionBus()

        ret = bus.request_name(AM_BUS_NAME, NAME_FLAG_DO_NOT_QUEUE)
        if ret == REQUEST_NAME_REPLY_EXISTS:
            raise dbus.NameExistsException(AM_BUS_NAME)

        Object.__init__(self, bus, AM_OBJECT_PATH)
Esempio n. 19
0
 def __init__(self, manager):
     from Globals import session_bus
     from dbus.exceptions import NameExistsException
     try:
         service_name = "net.sourceforge.Scribes"
         object_path = "/net/sourceforge/Scribes"
         bus_name = BusName(service_name,
                            bus=session_bus,
                            do_not_queue=True)
         Object.__init__(self, bus_name, object_path)
         self.__manager = manager
     except NameExistsException:
         print "ERROR! Another instances of Scribes is already running. Cannot run more than one instance of Scribes. Killing this instance!"
         manager.force_quit()
    def __init__(self, am, path, display_name, parameters):
        Object.__init__(self, am.connection, path)
        self._am = am

        self._display_name = display_name
        self._icon = u"bob.png"
        self._enabled = True
        self._nickname = u"Bob"
        self._parameters = parameters
        self._connect_automatically = True
        self._normalized_name = u"bob"
        self._automatic_presence = dbus.Struct((Connection_Presence_Type_Available, "available", ""), signature="uss")
        self._current_presence = dbus.Struct((Connection_Presence_Type_Offline, "offline", ""), signature="uss")
        self._requested_presence = dbus.Struct((Connection_Presence_Type_Offline, "offline", ""), signature="uss")
        self._avatar = dbus.Struct((dbus.ByteArray(""), "image/png"), signature="ays")
        self._interfaces = [ACCOUNT_IFACE_AVATAR_IFACE]
Esempio n. 21
0
 def __init__(self, conn=None, object_path=None, bus_name=None, idle=None, enforce=True):
     """
     Fire up this service as well as all of the paths for individual jobs.
     """
     DBusObject.__init__(self, conn, object_path, bus_name)
     
     self.idle = idle
     self.policy = Policy(enforce)
     self.proxy = ServiceProxy()
     self.jobs = []
     
     allsvcs = self.proxy.get_all_services()
     for job in allsvcs:
         self.jobs.append(SingleJobService(conn,
             '/'.join((DBUS_PATH, dbus_safe_name(job))),
             name=job, root=self
         ))
     
     log.info('Ready')
Esempio n. 22
0
    def __init__(self, app_id: str, name: str, window: QTWSMainWindow,
                 web: QTWSWebView):
        global qtws_app_id
        self.bus = dbus.SessionBus()
        self.service_name = "org.mpris.MediaPlayer2.qtws_" + name + str(
            random.randint(0, 9999))
        bus_name = dbus.service.BusName(self.service_name, bus=self.bus)

        super().__init__(bus_name, "/org/mpris/MediaPlayer2")
        self.window = window
        self.web = web

        self.track_path = "/it/datasound/mpris/" + str(random.randint(0, 9999))
        self.track = Object(bus_name, self.track_path)

        self.properties = dict()
        self.properties[self.MPRIS_INTERFACE] = dict()
        self.properties[self.MPRIS_INTERFACE]["CanQuit"] = True
        self.properties[self.MPRIS_INTERFACE]["CanRaise"] = False
        self.properties[self.MPRIS_INTERFACE]["HasTrackList"] = False
        self.properties[self.MPRIS_INTERFACE]["Identity"] = name

        self.properties[
            self.MPRIS_INTERFACE]["DesktopEntry"] = "silos-" + app_id
        self.properties[
            self.MPRIS_INTERFACE]["SupportedUriSchemes"] = dbus.Array(
                [], signature="s")
        self.properties[
            self.MPRIS_INTERFACE]["SupportedMimeTypes"] = dbus.Array(
                [], signature="s")
        self.PropertiesChanged(self.MPRIS_INTERFACE,
                               self.properties[self.MPRIS_INTERFACE], [])

        self.properties[self.MPRIS_PLAYER_INTERFACE] = dict()
        self.properties[
            self.MPRIS_PLAYER_INTERFACE]["PlaybackStatus"] = "Stopped"
        self.properties[self.MPRIS_PLAYER_INTERFACE]["LoopStatus"] = "None"
        self.properties[self.MPRIS_PLAYER_INTERFACE]["Shuffle"] = False
        self.properties[self.MPRIS_PLAYER_INTERFACE]["Volume"] = 1.0
        self.properties[self.MPRIS_PLAYER_INTERFACE]["Rate"] = 1.0
        self.properties[self.MPRIS_PLAYER_INTERFACE]["MinimumRate"] = 0.01
        self.properties[self.MPRIS_PLAYER_INTERFACE]["MaximumRate"] = 32.0
        self.properties[self.MPRIS_PLAYER_INTERFACE]["Position"] = 0
        self.properties[self.MPRIS_PLAYER_INTERFACE]["CanGoNext"] = False
        self.properties[self.MPRIS_PLAYER_INTERFACE]["CanGoPrevious"] = False
        self.properties[self.MPRIS_PLAYER_INTERFACE]["CanPlay"] = True
        self.properties[self.MPRIS_PLAYER_INTERFACE]["CanPause"] = True
        self.properties[self.MPRIS_PLAYER_INTERFACE]["CanSeek"] = True
        self.properties[self.MPRIS_PLAYER_INTERFACE]["CanControl"] = True
        self.PropertiesChanged(self.MPRIS_PLAYER_INTERFACE,
                               self.properties[self.MPRIS_PLAYER_INTERFACE],
                               [])
Esempio n. 23
0
 def __init__(self, service):
     self.svc = service
     path = DBUS_PATH(service.get_name())
     ns = DBUS_NS(service.get_name())
     self.dbus_ns = ns
     Object.__init__(self, BUS_NAME, path)
Esempio n. 24
0
 def __init__(self, tboplayer_instance):
     self.tboplayer_instance = tboplayer_instance
     dbus_loop = DBusGMainLoop(set_as_default=True)
     bus_name = dbus.service.BusName(
         TBOPLAYER_DBUS_OBJECT, bus=dbus.SessionBus(mainloop=dbus_loop))
     Object.__init__(self, bus_name, TBOPLAYER_DBUS_PATH)
Esempio n. 25
0
 def __init__(self, bus):
     Object.__init__(self, bus, '/bz/UFWProfiles')
Esempio n. 26
0
 def __init__(self, manager):
     from SCRIBES.Globals import session_bus
     bus_name = BusName(indexer_dbus_service, bus=session_bus)
     Object.__init__(self, bus_name, indexer_dbus_path)
     self.__manager = manager
     manager.connect("finished", self.__finished_cb)
Esempio n. 27
0
	def __init__(self, manager):
		from SCRIBES.Globals import session_bus
		bus_name = BusName(indexer_dbus_service, bus=session_bus)
		Object.__init__(self, bus_name, indexer_dbus_path)
		self.__manager = manager
		manager.connect("finished", self.__finished_cb)
Esempio n. 28
0
	def __init__(self, conn, object_path='/'):
		Object.__init__(self, conn, object_path)
Esempio n. 29
0
 def __init__(self, service):
     self.svc = service
     path = DBUS_PATH(service.get_name())
     ns = DBUS_NS(service.get_name())
     self.dbus_ns = ns
     Object.__init__(self, BUS_NAME, path)
    def __init__(self, bluemindo, bus):
        self.bluemindo = bluemindo
        dbusobj.__init__(self, bus, '/org/mpris/MediaPlayer2')

        self.properties = [
            # Main
            'CanQuit',
            # Player
            'CanControl',
            'CanPause',
            'CanPlay',
            'CanSeek',
            'CanGoNext',
            'CanGoPrevious',
            'LoopStatus',
            'PlaybackStatus',
            'Metadata'
        ]

        self.playing = 'Stopped'
        self.song = None
        self.widgets = None

        def update_data(song):
            self.song = song
            self.playing = 'Playing'
            self.launch_dbus_signal(INTERFACE_P_NAME, ['PlaybackStatus',
                                                       'Metadata'])

        def play_pressed():
            if self.playing == 'Playing':
                self.playing = 'Paused'
            elif self.playing == 'Paused':
                self.playing = 'Playing'
            elif self.playing == 'Stopped':
                self.playing = 'Playing'

            self.launch_dbus_signal(INTERFACE_P_NAME, ['PlaybackStatus'])

        def stop_pressed():
            self.playing = 'Stopped'

            self.launch_dbus_signal(INTERFACE_P_NAME, ['PlaybackStatus'])

        def prevnext_pressed():
            self.playing = 'Playing'

            self.launch_dbus_signal(INTERFACE_P_NAME, ['PlaybackStatus'])

        def bluemindo_started(widgets):
            self.widgets = widgets

            self.launch_dbus_signal(INTERFACE_P_NAME, ['PlaybackStatus'])
            self.launch_dbus_signal(INTERFACE_NAME, ['CanQuit'])

        extensions.connect('HasStartedSong', update_data)
        extensions.connect('OnPlayPressed', play_pressed)
        extensions.connect('OnStopPressed', stop_pressed)
        extensions.connect('OnAbortPlayback', stop_pressed)
        extensions.connect('OnPreviousPressed', prevnext_pressed)
        extensions.connect('OnNextPressed', prevnext_pressed)
        extensions.connect('OnBluemindoStarted', bluemindo_started)
Esempio n. 31
0
 def __init__(self, bus: SessionBus, commands: CommandRegistry,
              winman: WindowManager) -> None:
     Object.__init__(self, bus, '/com/ssokolow/QuickTile')
     self.commands = commands
     self.winman = winman
Esempio n. 32
0
 def __init__(self, processor):
     from Globals import session_bus as session
     bus_name = BusName(dbus_service, bus=session)
     Object.__init__(self, bus_name, dbus_path)
     self.__processor = processor
	def __init__(self, processor):
		from Globals import session_bus as session
		bus_name = BusName(dbus_service, bus=session)
		Object.__init__(self, bus_name, dbus_path)
		self.__processor = processor
Esempio n. 34
0
 def __init__( self, wind_obj ):
     self.wind_obj = wind_obj
     self.bus_name = BusName( SERVICE_NAME, bus=SessionBus() )
     dbusServiceObject.__init__( self, self.bus_name, '/alive' )
Esempio n. 35
0
 def __init__(self, tboplayer_instance):
     self.tboplayer_instance = tboplayer_instance
     dbus_loop = DBusGMainLoop(set_as_default=True)
     bus_name = dbus.service.BusName(TBOPLAYER_DBUS_OBJECT, bus = dbus.SessionBus(mainloop = dbus_loop))
     Object.__init__(self, bus_name, TBOPLAYER_DBUS_PATH)