コード例 #1
0
    def do_activate(self):
        print "CoverArtBrowser DEBUG - do_activate"
        self.shell = self.object
        self.db = self.shell.props.db
        
        try:
            entry_type = CoverArtBrowserEntryType()
            self.db.register_entry_type(entry_type)
        except NotImplementedError:
            entry_type = db.entry_register_type("CoverArtBrowserEntryType")

        entry_type.category = RB.RhythmDBEntryCategory.NORMAL

        # load plugin icon
        theme = Gtk.IconTheme.get_default()
        rb.append_plugin_source_path(theme, "/icons")

        what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
        pxbf = GdkPixbuf.Pixbuf.new_from_file_at_size(rb.find_plugin_file(self, "covermgr.png"), width, height)

        group = RB.DisplayPageGroup.get_by_id ("library")

        self.source = GObject.new ( CoverArtBrowserSource,
                                    shell=self.shell,
                                    name=_("CoverArt"),
                                    entry_type=entry_type,
                                    plugin=self,
                                    pixbuf=pxbf)

        self.shell.register_entry_type_for_source(self.source, entry_type)
        self.shell.append_display_page(self.source, group)
        
        print "CoverArtBrowser DEBUG - end do_activate"
コード例 #2
0
    def do_activate(self):
        '''
        Called by Rhythmbox when the plugin is activated. It creates the
        plugin's source and connects signals to manage the plugin's
        preferences.
        '''

        print("CoverArtBrowser DEBUG - do_activate")
        self.shell = self.object
        self.db = self.shell.props.db

        try:
            entry_type = CoverArtBrowserEntryType()
            self.db.register_entry_type(entry_type)
        except NotImplementedError:
            entry_type = self.db.entry_register_type(
                'CoverArtBrowserEntryType')

        cl = CoverLocale()
        cl.switch_locale(cl.Locale.LOCALE_DOMAIN)

        entry_type.category = RB.RhythmDBEntryCategory.NORMAL
        
        group = RB.DisplayPageGroup.get_by_id('library')
        # load plugin icon
        theme = Gtk.IconTheme.get_default()
        rb.append_plugin_source_path(theme, '/icons')

        # lets assume that python3 versions of RB only has the new icon attribute in the source
        if rb3compat.PYVER >=3:
                iconfile = Gio.File.new_for_path(
                    rb.find_plugin_file(self, 'img/' + Theme(self).current\
                    + '/covermgr.png'))
                    
                self.source = CoverArtBrowserSource(
                        shell=self.shell,
                        name=_("CoverArt"), 
                        entry_type=entry_type,
                        plugin=self,
                        icon=Gio.FileIcon.new(iconfile), 
                        query_model=self.shell.props.library_source.props.base_query_model)
        else:
                what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
                pxbf = GdkPixbuf.Pixbuf.new_from_file_at_size(
                    rb.find_plugin_file(self, 'img/' + Theme(self).current\
                    + '/covermgr.png'), width, height)

                self.source = CoverArtBrowserSource(
                        shell=self.shell,
                        name=_("CoverArt"), entry_type=entry_type,
                        plugin=self, pixbuf=pxbf,
                        query_model=self.shell.props.library_source.props.base_query_model)
                    
        self.shell.register_entry_type_for_source(self.source, entry_type)
        self.shell.append_display_page(self.source, group)

        self.source.props.query_model.connect('complete', self.load_complete)

        print("CoverArtBrowser DEBUG - end do_activate")
コード例 #3
0
	def activate(self, shell):
		self.db = shell.props.db

		self.entry_type = AmpacheEntryType()
		self.entry_type.can_sync_metadata = True
		self.entry_type.sync_metadata = None
		self.entry_type.category = rhythmdb.ENTRY_STREAM

		theme = gtk.icon_theme_get_default()
		rb.append_plugin_source_path(theme, "/icons/")
		width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
		#icon = rb.try_load_icon(theme, "ampache", width, 0)
		group = rb.rb_display_page_group_get_by_id ("shared")
		if not group:
			group = rb.rb_source_group_register (
				"ampache",
				self.config.get("group"),
				rb.SOURCE_GROUP_CATEGORY_FIXED,
			)


		self.source = gobject.new (
			AmpacheBrowser,
 			entry_type=self.entry_type,
			plugin=self,
 			name=self.config.get("name"),
 			shell=shell,
		)

		self.config.set("icon_filename", self.find_file(self.config.get("icon")))

		#icon = rb.try_load_icon(theme, "ampache", width, 0)
		icon = gtk.gdk.pixbuf_new_from_file_at_size(self.config.get("icon_filename"), width, height)

		self.source = gobject.new (AmpacheBrowser,
								   shell=shell,
								   entry_type=self.entry_type,
								   plugin=self,
								   name=self.config.get("name"),
								   pixbuf=icon)

		self.source.activate(self.config)

		shell.register_entry_type_for_source(self.source, self.entry_type)
		shell.append_display_page(self.source, group)

		ui_manager = shell.get_ui_manager()
		action = gtk.Action('RefetchAmpache', 
				    _('_Re-fetch Ampache Library'), 
				    _('Update the local ampache library'), "")
		action.connect ('activate', self.refetch_ampache, shell)
		action_group = gtk.ActionGroup ('RefetchAmpacheGroup')
		action_group.add_action(action)
		ui_manager.insert_action_group(action_group, -1)
		self.uid = ui_manager.add_ui_from_string(ui_str)
		ui_manager.ensure_update()
コード例 #4
0
ファイル: magnatune.py プロジェクト: bilboed/rhythmbox
	def do_activate(self):
		shell = self.object
		self.db = shell.props.db

		self.entry_type = MagnatuneEntryType()
		self.db.register_entry_type(self.entry_type)

		self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.magnatune")

		theme = Gtk.IconTheme.get_default()
		rb.append_plugin_source_path(theme, "/icons")

		what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
		icon = rb.try_load_icon(theme, "magnatune", width, 0)

		group = RB.DisplayPageGroup.get_by_id ("stores")
		settings = Gio.Settings("org.gnome.rhythmbox.plugins.magnatune")
		self.source = GObject.new(MagnatuneSource,
					  shell=shell,
					  entry_type=self.entry_type,
					  pixbuf=icon,
					  plugin=self,
					  settings=settings.get_child("source"),
					  name=_("Magnatune"),
					  toolbar_path="/MagnatuneToolBar")

		shell.register_entry_type_for_source(self.source, self.entry_type)
		shell.append_display_page(self.source, group)

		manager = shell.props.ui_manager
		# Add the popup menu actions
		self.action_group = Gtk.ActionGroup(name='MagnatunePluginActions')

		action = Gtk.Action(name='MagnatuneDownloadAlbum', label=_("Download Album"),
				tooltip=_("Download this album from Magnatune"),
				stock_id='gtk-save')
		action.connect('activate', lambda a: shell.props.selected_page.download_album())
		self.action_group.add_action(action)
		action = Gtk.Action(name='MagnatuneArtistInfo', label=_("Artist Information"),
				tooltip=_("Get information about this artist"),
				stock_id='gtk-info')
		action.connect('activate', lambda a: shell.props.selected_page.display_artist_info())
		self.action_group.add_action(action)
		action = Gtk.Action(name='MagnatuneCancelDownload', label=_("Cancel Downloads"),
				tooltip=_("Stop album downloads"),
				stock_id='gtk-stop')
		action.connect('activate', lambda a: shell.props.selected_page.cancel_downloads())
		action.set_sensitive(False)
		self.action_group.add_action(action)

		manager.insert_action_group(self.action_group, 0)
		self.ui_id = manager.add_ui_from_string(popup_ui)

		self.pec_id = shell.props.shell_player.connect('playing-song-changed', self.playing_entry_changed)
		manager.ensure_update()
コード例 #5
0
ファイル: __init__.py プロジェクト: AdamZ/rhythmbox-magnatune
	def activate(self, shell):
		self.shell = shell # so the source can update the progress bar
		self.db = shell.get_property("db")

		self.entry_type = self.db.entry_register_type("MagnatuneEntryType")
		# allow changes which don't do anything
		self.entry_type.can_sync_metadata = True
		self.entry_type.sync_metadata = None

		theme = gtk.icon_theme_get_default()
		rb.append_plugin_source_path(theme, "/icons")

		width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
		icon = rb.try_load_icon(theme, "magnatune", width, 0)

		group = rb.rb_source_group_get_by_name("stores")
		self.source = gobject.new(MagnatuneSource,
					  shell=shell,
					  entry_type=self.entry_type,
					  source_group=group,
					  icon=icon,
					  plugin=self)

		shell.register_entry_type_for_source(self.source, self.entry_type)
		shell.append_source(self.source, None) # Add the source to the list

		manager = shell.get_player().get_property('ui-manager')
		# Add the popup menu actions
		self.action_group = gtk.ActionGroup('MagnatunePluginActions')

		action = gtk.Action('MagnatuneDownloadAlbum', _('Download Album'),
				_("Download this album from Magnatune"),
				'gtk-save')
		action.connect('activate', lambda a: self.shell.get_property("selected-source").download_album())
		self.action_group.add_action(action)
		action = gtk.Action('MagnatuneArtistInfo', _('Artist Information'),
				_("Get information about this artist"),
				'gtk-info')
		action.connect('activate', lambda a: self.shell.get_property("selected-source").display_artist_info())
		self.action_group.add_action(action)
		action = gtk.Action('MagnatuneCancelDownload', _('Cancel Downloads'),
				_("Stop downloading purchased albums"),
				'gtk-stop')
		action.connect('activate', lambda a: self.shell.get_property("selected-source").cancel_downloads())
		action.set_sensitive(False)
		self.action_group.add_action(action)

		manager.insert_action_group(self.action_group, 0)
		self.ui_id = manager.add_ui_from_string(popup_ui)

		self.pec_id = shell.get_player().connect('playing-song-changed', self.playing_entry_changed)
		manager.ensure_update()
コード例 #6
0
	def activate(self, shell):
		self.db = shell.get_property("db")

		self.entry_type = self.db.entry_register_type("JamendoEntryType")
		# allow changes which don't do anything
		self.entry_type.can_sync_metadata = True
		self.entry_type.sync_metadata = None

		group = rb.rb_source_group_get_by_name ("stores")
 		if not group:
 			group = rb.rb_source_group_register ("stores",
 							     _("Stores"),
 							     rb.SOURCE_GROUP_CATEGORY_FIXED)

		theme = gtk.icon_theme_get_default()
		rb.append_plugin_source_path(theme, "/icons/")

		width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
		icon = rb.try_load_icon(theme, "jamendo", width, 0)

		self.source = gobject.new (JamendoSource,
					   shell=shell,
					   entry_type=self.entry_type,
					   plugin=self,
					   icon=icon,
					   source_group=group)
		shell.register_entry_type_for_source(self.source, self.entry_type)
		shell.append_source(self.source, None) # Add the source to the list

		# Add button
		manager = shell.get_player().get_property('ui-manager')
		action = gtk.Action('JamendoDownloadAlbum', _('_Download Album'),
				_("Download this album using BitTorrent"),
				'gtk-save')
		action.connect('activate', lambda a: shell.get_property("selected-source").download_album())
		self.action_group = gtk.ActionGroup('JamendoPluginActions')
		self.action_group.add_action(action)
		
		# Add Button for Donate
		action = gtk.Action('JamendoDonateArtist', _('_Donate to Artist'),
				_("Donate Money to this Artist"),
				'gtk-jump-to')
		action.connect('activate', lambda a: shell.get_property("selected-source").launch_donate())
		self.action_group.add_action(action)

		manager.insert_action_group(self.action_group, 0)
		self.ui_id = manager.add_ui_from_string(popup_ui)
		manager.ensure_update()

		self.pec_id = shell.get_player().connect('playing-song-changed', self.playing_entry_changed)
コード例 #7
0
    def do_activate(self):
        '''
        Called by Rhythmbox when the plugin is activated. It creates the
        plugin's source and connects signals to manage the plugin's
        preferences.
        '''

        # define .plugin text strings used for translation
        plugin = _('CoverArt Browser')
        desc = _('Browse and play your albums through their covers')

        print("CoverArtBrowser DEBUG - do_activate")
        self.shell = self.object
        self.db = self.shell.props.db

        try:
            entry_type = CoverArtBrowserEntryType()
            self.db.register_entry_type(entry_type)
        except NotImplementedError:
            entry_type = self.db.entry_register_type(
                'CoverArtBrowserEntryType')

        cl = CoverLocale()
        cl.switch_locale(cl.Locale.LOCALE_DOMAIN)

        entry_type.category = RB.RhythmDBEntryCategory.NORMAL

        # load plugin icon
        theme = Gtk.IconTheme.get_default()
        rb.append_plugin_source_path(theme, '/icons')

        what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
        pxbf = GdkPixbuf.Pixbuf.new_from_file_at_size(
            rb.find_plugin_file(self, 'img/' + Theme(self).current\
            + '/covermgr.png'), width, height)

        group = RB.DisplayPageGroup.get_by_id('library')

        self.source = CoverArtBrowserSource(shell=self.shell,
            name=_("CoverArt"), entry_type=entry_type,
            plugin=self, pixbuf=pxbf,
            query_model=self.shell.props.library_source.props.base_query_model)

        self.shell.register_entry_type_for_source(self.source, entry_type)
        self.shell.append_display_page(self.source, group)

        self.source.props.query_model.connect('complete', self.load_complete)

        print("CoverArtBrowser DEBUG - end do_activate")
コード例 #8
0
ファイル: __init__.py プロジェクト: phrock/misc
  def activate(self, shell):
    self.db = shell.props.db

    group = rb.rb_source_group_get_by_name ("online")
    if not group:
        group = rb.rb_source_group_register ("online",
                             _("Online"),
                             rb.SOURCE_GROUP_CATEGORY_FIXED)

    self.entry_type = self.db.entry_register_type("GoogleMusic")
    self.entry_type.get_playback_uri=self.get_playback_uri
    theme = gtk.icon_theme_get_default()
    theme.append_search_path(os.path.join(self.__get_plugins_dir(), "icons"))
    rb.append_plugin_source_path(theme, "/icons")

    width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
    icon = rb.try_load_icon(theme, "googlemusic", width, 0)

    self.source = gobject.new (OnlineMusicSource,
                   shell=shell,
                   entry_type=self.entry_type,
                   source_group=group,
                   name = _("Google Music"),
                   icon=icon,
                   plugin=self)

    shell.register_entry_type_for_source(self.source, self.entry_type)
    shell.append_source(self.source, None)

    # First lets see if we can add to the context menu
    ui = shell.get_ui_manager()

    # Group and it's actions
    self.action_group = gtk.ActionGroup ('TestActions')

    # Create Actions for the plugin
    action = gtk.Action ('ReloadMusic', _('Reload music'),
                         _('Reload music'),
                         'gtk-refresh')
    activate_id = action.connect ('activate', lambda a: self.source.onlineMusic.reloadMusic())#self.source.onlineMusic.activate()
    self.action_group.add_action (action)
    action = gtk.Action ('SwitchList', _('Switch List'),
                         _('Switch List'),
                         'gtk-properties')#gtk-preferences
    activate_id = action.connect ('activate', lambda a: self.switch_list())
    self.action_group.add_action (action)

    ui.insert_action_group(self.action_group, -1)
コード例 #9
0
ファイル: jamendo.py プロジェクト: wangd/rhythmbox
	def do_activate(self):
		shell = self.object
		self.db = shell.props.db

		self.entry_type = JamendoEntryType()
		self.db.register_entry_type(self.entry_type)

		theme = Gtk.IconTheme.get_default()
		rb.append_plugin_source_path(theme, "/icons/")

		what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
		icon = rb.try_load_icon(theme, "jamendo", width, 0)

		group = RB.DisplayPageGroup.get_by_id ("stores")
		settings = Gio.Settings("org.gnome.rhythmbox.plugins.jamendo")
		self.source = gobject.new (JamendoSource,
					   shell=shell,
					   entry_type=self.entry_type,
					   plugin=self,
					   pixbuf=icon,
					   settings=settings.get_child("source"))
		shell.register_entry_type_for_source(self.source, self.entry_type)
		shell.append_display_page(self.source, group)

		# Add button
		manager = shell.props.ui_manager
		action = Gtk.Action(name='JamendoDownloadAlbum', label=_('_Download Album'),
				tooltip=_("Download this album using BitTorrent"),
				stock_id='gtk-save')
		action.connect('activate', lambda a: shell.props.selected_page.download_album())
		self.action_group = Gtk.ActionGroup('JamendoPluginActions')
		self.action_group.add_action(action)
		
		# Add Button for Donate
		action = Gtk.Action(name='JamendoDonateArtist', label=_('_Donate to Artist'),
				tooltip=_("Donate Money to this Artist"),
				stock_id='gtk-jump-to')
		action.connect('activate', lambda a: shell.props.selected_page.launch_donate())
		self.action_group.add_action(action)

		manager.insert_action_group(self.action_group, 0)
		self.ui_id = manager.add_ui_from_string(popup_ui)
		manager.ensure_update()

		self.pec_id = shell.props.shell_player.connect('playing-song-changed', self.playing_entry_changed)
コード例 #10
0
    def do_activate(self):
        '''
        Called by Rhythmbox when the plugin is activated. It creates the
        plugin's source and connects signals to manage the plugin's
        preferences.
        '''

        print("CoverArtBrowser DEBUG - do_activate")
        self.shell = self.object
        self.db = self.shell.props.db

        self.entry_type = CoverArtBrowserEntryType()
        self.db.register_entry_type(self.entry_type)

        cl = CoverLocale()
        cl.switch_locale(cl.Locale.LOCALE_DOMAIN)

        self.entry_type.category = RB.RhythmDBEntryCategory.NORMAL

        group = RB.DisplayPageGroup.get_by_id('library')

        # load plugin icon
        theme = Gtk.IconTheme.get_default()
        rb.append_plugin_source_path(theme, '/icons')

        iconfile = Gio.File.new_for_path(
            rb.find_plugin_file(self, 'img/covermgr_rb3.png'))

        self.source = CoverArtBrowserSource(
            shell=self.shell,
            name=_("CoverArt"),
            entry_type=self.entry_type,
            plugin=self,
            icon=Gio.FileIcon.new(iconfile),
            query_model=self.shell.props.library_source.props.base_query_model)

        self.shell.register_entry_type_for_source(self.source, self.entry_type)
        self.shell.append_display_page(self.source, group)

        self.source.props.query_model.connect('complete', self.load_complete)
        self._externalmenu = ExternalPluginMenu(self)

        cl.switch_locale(cl.Locale.RB)
        print("CoverArtBrowser DEBUG - end do_activate")
コード例 #11
0
ファイル: magnatune.py プロジェクト: arnaudlecam/rhythmbox
	def do_activate(self):
		shell = self.object
		self.db = shell.props.db

		rb.append_plugin_source_path(self, "icons")

		self.entry_type = MagnatuneEntryType()
		self.db.register_entry_type(self.entry_type)

		self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.magnatune")

		app = Gio.Application.get_default()
		action = Gio.SimpleAction(name="magnatune-album-download")
		action.connect("activate", self.download_album_action_cb)
		app.add_action(action)

		action = Gio.SimpleAction(name="magnatune-artist-info")
		action.connect("activate", self.artist_info_action_cb)
		app.add_action(action)

		builder = Gtk.Builder()
		builder.add_from_file(rb.find_plugin_file(self, "magnatune-toolbar.ui"))
		toolbar = builder.get_object("magnatune-toolbar")
		app.link_shared_menus(toolbar)

		group = RB.DisplayPageGroup.get_by_id ("stores")
		settings = Gio.Settings("org.gnome.rhythmbox.plugins.magnatune")
		self.source = GObject.new(MagnatuneSource,
					  shell=shell,
					  entry_type=self.entry_type,
					  icon=Gio.ThemedIcon.new("magnatune-symbolic"),
					  plugin=self,
					  settings=settings.get_child("source"),
					  name=_("Magnatune"),
					  toolbar_menu=toolbar)

		shell.register_entry_type_for_source(self.source, self.entry_type)
		shell.append_display_page(self.source, group)

		self.pec_id = shell.props.shell_player.connect('playing-song-changed', self.playing_entry_changed)
コード例 #12
0
ファイル: __init__.py プロジェクト: dignan/control
    def activate(self, shell):
        self.db = shell.get_property("db")

        self.entry_type = JamendoEntryType()
        self.db.register_entry_type(self.entry_type)

        theme = gtk.icon_theme_get_default()
        rb.append_plugin_source_path(theme, "/icons/")

        width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
        icon = rb.try_load_icon(theme, "jamendo", width, 0)

        group = rb.rb_source_group_get_by_name("stores")
        self.source = gobject.new(
            JamendoSource, shell=shell, entry_type=self.entry_type, plugin=self, icon=icon, source_group=group
        )
        shell.register_entry_type_for_source(self.source, self.entry_type)
        shell.append_source(self.source, None)  # Add the source to the list

        # Add button
        manager = shell.get_player().get_property("ui-manager")
        action = gtk.Action(
            "JamendoDownloadAlbum", _("_Download Album"), _("Download this album using BitTorrent"), "gtk-save"
        )
        action.connect("activate", lambda a: shell.get_property("selected-source").download_album())
        self.action_group = gtk.ActionGroup("JamendoPluginActions")
        self.action_group.add_action(action)

        # Add Button for Donate
        action = gtk.Action(
            "JamendoDonateArtist", _("_Donate to Artist"), _("Donate Money to this Artist"), "gtk-jump-to"
        )
        action.connect("activate", lambda a: shell.get_property("selected-source").launch_donate())
        self.action_group.add_action(action)

        manager.insert_action_group(self.action_group, 0)
        self.ui_id = manager.add_ui_from_string(popup_ui)
        manager.ensure_update()

        self.pec_id = shell.get_player().connect("playing-song-changed", self.playing_entry_changed)
コード例 #13
0
ファイル: soundcloud.py プロジェクト: oddmutou/rhythmbox
	def do_activate(self):
		shell = self.object

		rb.append_plugin_source_path(self, "icons")

		db = shell.props.db

		self.entry_type = SoundCloudEntryType()
		db.register_entry_type(self.entry_type)

		model = RB.RhythmDBQueryModel.new_empty(db)
		self.source = GObject.new (SoundCloudSource,
					   shell=shell,
					   name=_("SoundCloud"),
					   plugin=self,
					   query_model=model,
					   entry_type=self.entry_type,
					   icon=Gio.ThemedIcon.new("soundcloud-symbolic"))
		shell.register_entry_type_for_source(self.source, self.entry_type)
		self.source.setup()
		group = RB.DisplayPageGroup.get_by_id ("shared")
		shell.append_display_page(self.source, group)
コード例 #14
0
ファイル: Avahi.py プロジェクト: Harper04/dacp-rapp
	def run(self,rbshell,rbplugin):
		print "Avahi THINGS !!!!!!!!!!!!!!"
		self.shell=rbshell
		self.rbplugin=rbplugin

		#GUI allgemein vorbereiten
		self.db = self.shell.get_property("db")
		self.entry_type = self.db.entry_register_type("RemoteEntryType")
		self.entry_type.can_sync_metadata = True
                self.entry_type.sync_metadata = None
                theme = gtk.icon_theme_get_default()
                rb.append_plugin_source_path(theme, "/icons/")
                width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
                self.icon = rb.try_load_icon(theme, "jamendo", width, 0)
                self.group = rb.rb_source_group_get_by_name ("stores")

		#DBUS lauschen auf remotes
		bus=dbus.SystemBus()#mainloop=loop)
		self.server = dbus.Interface(bus.get_object('org.freedesktop.Avahi','/'),"org.freedesktop.Avahi.Server")
		b = dbus.Interface(bus.get_object(avahi.DBUS_NAME,self.server.ServiceBrowserNew(avahi.IF_UNSPEC,avahi.PROTO_UNSPEC,"_touch-remote._tcp", 'local', dbus.UInt32(0))),avahi.DBUS_INTERFACE_SERVICE_BROWSER)
		b.connect_to_signal("ItemNew",self.newRemote)
		b.connect_to_signal("ItemRemove",self.RemoteRemoved)
コード例 #15
0
ファイル: soundcloud.py プロジェクト: ehlomedia/rhythmbox
    def do_activate(self):
        shell = self.object

        rb.append_plugin_source_path(self, "icons")

        db = shell.props.db

        self.entry_type = SoundCloudEntryType()
        db.register_entry_type(self.entry_type)

        model = RB.RhythmDBQueryModel.new_empty(db)
        self.source = GObject.new(
            SoundCloudSource,
            shell=shell,
            name=_("SoundCloud"),
            plugin=self,
            query_model=model,
            entry_type=self.entry_type,
            icon=Gio.ThemedIcon.new("soundcloud-symbolic"))
        shell.register_entry_type_for_source(self.source, self.entry_type)
        self.source.setup()
        group = RB.DisplayPageGroup.get_by_id("shared")
        shell.append_display_page(self.source, group)
コード例 #16
0
    def activate(self, shell):
        self.db = shell.get_property("db")
        self.entry_type = BlofeldEntryType()
        self.db.register_entry_type(self.entry_type)
        model = self.db.query_model_new_empty()
        group = rb.rb_source_group_get_by_name ("library")
        if not group:
            group = rb.rb_source_group_register ("library",
                _("Library"),
                rb.SOURCE_GROUP_CATEGORY_FIXED)
        theme = gtk.icon_theme_get_default()
        rb.append_plugin_source_path(theme, "/icons")

        width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_LARGE_TOOLBAR)
        icon = rb.try_load_icon(theme, "network-server", width, 0)
        self.source = gobject.new (BlofeldSource,
                        shell=shell,
                        entry_type=self.entry_type,
                        source_group=group,
                        icon=icon,
                        plugin=self)
        shell.register_entry_type_for_source(self.source, self.entry_type)
        shell.append_source(self.source, None) # Add the source to the list
        self.pec_id = shell.get_player().connect('playing-song-changed', self.playing_entry_changed)
コード例 #17
0
    def do_activate(self):

        # Get the translation file
        install('radio-browser')

        self.shell = self.object
        # register this source in rhythmbox
        db = self.shell.props.db
        try:
            entry_type = RadioBrowserEntryType()
            db.register_entry_type(entry_type)
        except NotImplementedError:
            entry_type = db.entry_register_type("RadioBrowserEntryType")

        entry_type.category = RB.RhythmDBEntryCategory.STREAM

        # load plugin icon
        theme = Gtk.IconTheme.get_default()
        rb.append_plugin_source_path(theme, "/icons")

        what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
        pxbf = GdkPixbuf.Pixbuf.new_from_file_at_size(rb.find_plugin_file(self, "radio-browser.png"), width, height)

        group = RB.DisplayPageGroup.get_by_id ("library")

        self.source = GObject.new (RadioBrowserSource, 
                       shell=self.shell, 
                       name=_("Radio browser"), 
                       entry_type=entry_type,
                       plugin=self,
                       pixbuf=pxbf)

        self.shell.register_entry_type_for_source(self.source, entry_type)
        self.shell.append_display_page(self.source, group)

#       GObject.type_register(RadioBrowserSource)



        self.actiongroup = Gtk.ActionGroup('RadioBrowserActionGroup')

        # add "update-all" action to the toolbar
        action = Gtk.Action('UpdateList', None, _("Update radio station list"), Gtk.STOCK_GO_DOWN)
        action.connect('activate', lambda a: action_update_list())
        self.actiongroup.add_action(action)

        action = Gtk.Action('ClearIconCache', None, _("Clear icon cache"), Gtk.STOCK_CLEAR)
        action.connect('activate', lambda a: action_remove_images())
        self.actiongroup.add_action(action)

        uim = self.shell.props.ui_manager
        uim.insert_action_group (self.actiongroup)
        uim.ensure_update()

        # try reading gconf entries and set default values if not readable
        self.download_trys = self.gconf.get_string(gconf_keys['download_trys'])
#       self.download_trys = None
        if not self.download_trys:
            self.download_trys = "3"
        self.gconf.set_string(gconf_keys['download_trys'], self.download_trys)

        self.recently_played_purge_days = self.gconf.get_string(gconf_keys['recently_played_purge_days'])
#       self.recently_played_purge_days = None
        if not self.recently_played_purge_days:
            self.recently_played_purge_days = "3"
        self.gconf.set_string(gconf_keys['recently_played_purge_days'], self.recently_played_purge_days)

        # set the output path of recorded music to xdg standard directory for music
        self.outputpath = self.gconf.get_string(gconf_keys['outputpath'])
#       self.outputpath = None
        if not self.outputpath:
            self.outputpath = os.path.expanduser("~")
            # try to read xdg music dir
            try:
                f = open(self.outputpath+"/.config/user-dirs.dirs","r")
            except IOError:
                print "xdg user dir file not found"
            else:
                for line in f:
                    if line.startswith("XDG_MUSIC_DIR"):
                        self.outputpath = os.path.expandvars(line.split("=")[1].strip().strip('"'))
                        print self.outputpath
                f.close()
        self.gconf.set_string(gconf_keys['outputpath'], self.outputpath)
コード例 #18
0
    def do_activate(self):

        # Get the translation file
        install('radio-browser')

        self.shell = self.object
        # register this source in rhythmbox
        db = self.shell.props.db
        try:
            entry_type = RadioBrowserEntryType()
            db.register_entry_type(entry_type)
        except NotImplementedError:
            entry_type = db.entry_register_type("RadioBrowserEntryType")

        entry_type.category = RB.RhythmDBEntryCategory.STREAM

        # load plugin icon
        theme = Gtk.IconTheme.get_default()
        rb.append_plugin_source_path(theme, "/icons")

        what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
        pxbf = GdkPixbuf.Pixbuf.new_from_file_at_size(
            rb.find_plugin_file(self, "radio-browser.png"), width, height)

        group = RB.DisplayPageGroup.get_by_id("library")

        self.source = GObject.new(RadioBrowserSource,
                                  shell=self.shell,
                                  name=_("Radio browser"),
                                  entry_type=entry_type,
                                  plugin=self,
                                  pixbuf=pxbf)

        self.shell.register_entry_type_for_source(self.source, entry_type)
        self.shell.append_display_page(self.source, group)

        #       GObject.type_register(RadioBrowserSource)

        #self.actiongroup = Gtk.ActionGroup('RadioBrowserActionGroup')

        # add "update-all" action to the toolbar
        #action = Gtk.Action('UpdateList', None, _("Update radio station list"), Gtk.STOCK_GO_DOWN)
        #action.connect('activate', lambda a: action_update_list())
        #self.actiongroup.add_action(action)

        #action = Gtk.Action('ClearIconCache', None, _("Clear icon cache"), Gtk.STOCK_CLEAR)
        #action.connect('activate', lambda a: action_remove_images())
        #self.actiongroup.add_action(action)

        #uim = self.shell.props.ui_manager
        #uim.insert_action_group (self.actiongroup)
        #uim.ensure_update()

        # try reading gconf entries and set default values if not readable
        self.download_trys = self.gconf.get_string(gconf_keys['download_trys'])
        #       self.download_trys = None
        if not self.download_trys:
            self.download_trys = "3"
        self.gconf.set_string(gconf_keys['download_trys'], self.download_trys)

        self.recently_played_purge_days = self.gconf.get_string(
            gconf_keys['recently_played_purge_days'])
        #       self.recently_played_purge_days = None
        if not self.recently_played_purge_days:
            self.recently_played_purge_days = "3"
        self.gconf.set_string(gconf_keys['recently_played_purge_days'],
                              self.recently_played_purge_days)

        # set the output path of recorded music to xdg standard directory for music
        self.outputpath = self.gconf.get_string(gconf_keys['outputpath'])
        #       self.outputpath = None
        if not self.outputpath:
            self.outputpath = os.path.expanduser("~")
            # try to read xdg music dir
            try:
                f = open(self.outputpath + "/.config/user-dirs.dirs", "r")
            except IOError:
                print "xdg user dir file not found"
            else:
                for line in f:
                    if line.startswith("XDG_MUSIC_DIR"):
                        self.outputpath = os.path.expandvars(
                            line.split("=")[1].strip().strip('"'))
                        print self.outputpath
                f.close()
        self.gconf.set_string(gconf_keys['outputpath'], self.outputpath)
コード例 #19
0
    def do_activate(self):
        '''
        Called by Rhythmbox when the plugin is activated. It creates the
        plugin's source and connects signals to manage the plugin's
        preferences.
        '''

        print("CoverArtBrowser DEBUG - do_activate")
        self.shell = self.object
        self.db = self.shell.props.db

        try:
            entry_type = CoverArtBrowserEntryType()
            self.db.register_entry_type(entry_type)
        except NotImplementedError:
            entry_type = self.db.entry_register_type(
                'CoverArtBrowserEntryType')

        cl = CoverLocale()
        cl.switch_locale(cl.Locale.LOCALE_DOMAIN)

        entry_type.category = RB.RhythmDBEntryCategory.NORMAL
        
        group = RB.DisplayPageGroup.get_by_id('library')
        # load plugin icon
        theme = Gtk.IconTheme.get_default()
        rb.append_plugin_source_path(theme, '/icons')

        # lets assume that python3 versions of RB only has the new icon attribute in the source
        if rb3compat.PYVER >=3:
                iconfile = Gio.File.new_for_path(
                    rb.find_plugin_file(self, 'img/covermgr_rb3.png'))
                    
                self.source = CoverArtBrowserSource(
                        shell=self.shell,
                        name=_("CoverArt"), 
                        entry_type=entry_type,
                        plugin=self,
                        icon=Gio.FileIcon.new(iconfile), 
                        query_model=self.shell.props.library_source.props.base_query_model)
        else:
                what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
                pxbf = GdkPixbuf.Pixbuf.new_from_file_at_size(
                    rb.find_plugin_file(self, 'img/covermgr.png'), width, height)

                self.source = CoverArtBrowserSource(
                        shell=self.shell,
                        name=_("CoverArt"), entry_type=entry_type,
                        plugin=self, pixbuf=pxbf,
                        query_model=self.shell.props.library_source.props.base_query_model)
                    
        self.shell.register_entry_type_for_source(self.source, entry_type)
        self.shell.append_display_page(self.source, group)

        self.source.props.query_model.connect('complete', self.load_complete)
        if rb3compat.PYVER >=3:
            self._externalmenu = ExternalPluginMenu(self)
        else:
            self._externalmenu = None
                
        cl.switch_locale(cl.Locale.RB)
        print("CoverArtBrowser DEBUG - end do_activate")
コード例 #20
0
    def do_activate(self):
        shell = self.object
        self.db = shell.props.db

        self.entry_type = MagnatuneEntryType()
        self.db.register_entry_type(self.entry_type)

        self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.magnatune")

        theme = Gtk.IconTheme.get_default()
        rb.append_plugin_source_path(theme, "/icons")

        what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
        icon = rb.try_load_icon(theme, "magnatune", width, 0)

        group = RB.DisplayPageGroup.get_by_id("stores")
        settings = Gio.Settings("org.gnome.rhythmbox.plugins.magnatune")
        self.source = GObject.new(MagnatuneSource,
                                  shell=shell,
                                  entry_type=self.entry_type,
                                  pixbuf=icon,
                                  plugin=self,
                                  settings=settings.get_child("source"),
                                  name=_("Magnatune"),
                                  toolbar_path="/MagnatuneToolBar")

        shell.register_entry_type_for_source(self.source, self.entry_type)
        shell.append_display_page(self.source, group)

        manager = shell.props.ui_manager
        # Add the popup menu actions
        self.action_group = Gtk.ActionGroup(name='MagnatunePluginActions')

        action = Gtk.Action(name='MagnatuneDownloadAlbum',
                            label=_("Download Album"),
                            tooltip=_("Download this album from Magnatune"),
                            stock_id='gtk-save')
        action.connect('activate',
                       lambda a: shell.props.selected_page.download_album())
        self.action_group.add_action(action)
        action = Gtk.Action(name='MagnatuneArtistInfo',
                            label=_("Artist Information"),
                            tooltip=_("Get information about this artist"),
                            stock_id='gtk-info')
        action.connect(
            'activate',
            lambda a: shell.props.selected_page.display_artist_info())
        self.action_group.add_action(action)
        action = Gtk.Action(name='MagnatuneCancelDownload',
                            label=_("Cancel Downloads"),
                            tooltip=_("Stop album downloads"),
                            stock_id='gtk-stop')
        action.connect('activate',
                       lambda a: shell.props.selected_page.cancel_downloads())
        action.set_sensitive(False)
        self.action_group.add_action(action)

        manager.insert_action_group(self.action_group, 0)
        self.ui_id = manager.add_ui_from_string(popup_ui)

        self.pec_id = shell.props.shell_player.connect(
            'playing-song-changed', self.playing_entry_changed)
        manager.ensure_update()