Пример #1
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()
    def activate(self, shell):
    # First lets see if we can add to the context menu
        self.db = shell.props.db
        self.entry_type = self.db.entry_register_type("VkontakteMyEntryType")
        group = rb.rb_source_group_get_by_name ("vkontakte")
        if not group:
            group = rb.rb_source_group_register ("vkontakte",
 							     _("Vkontakte"),
 							     rb.SOURCE_GROUP_CATEGORY_FIXED)

        self.vksource = gobject.new (MySource, shell=shell, name=_("My Music"), entry_type=self.entry_type,source_group=group)
        shell.register_entry_type_for_source(self.vksource, self.entry_type)
        shell.append_source(self.vksource, None)
	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)
Пример #4
0
  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)
Пример #5
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

		group = rb.rb_source_group_get_by_name(self.config.get("group"))
		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,
			source_group=group,
 			name=self.config.get("name"),
 			shell=shell,
		)

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

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

		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()
Пример #6
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)
	def activate(self, shell):
		self.shell = shell # so the source can update the progress bar
		self.db = shell.get_property("db")
		self.keyring = 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)

		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)

		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
		action = gtk.Action('MagnatunePurchaseAlbum', _('Purchase Album'),
				_("Purchase this album from Magnatune"),
				'gtk-save')
		action.connect('activate', lambda a: self.shell.get_property("selected-source").purchase_album())
		self.action_group = gtk.ActionGroup('MagnatunePluginActions')
		self.action_group.add_action(action)
		action = gtk.Action('MagnatunePurchaseCD', _('Purchase Physical CD'),
				_("Purchase a physical CD from Magnatune"),
				'gtk-cdrom')
		action.connect('activate', lambda a: self.shell.get_property("selected-source").buy_cd())
		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()