コード例 #1
0
    def __init__ (self, plugin, shell, buttons, ds, view):
        GObject.GObject.__init__ (self)
        self.shell      = shell
        self.sp         = shell.props.shell_player
        self.db         = shell.props.db
        self.buttons    = buttons

        self.button     = PixbufButton()
        self.button.set_image(create_button_image(plugin, self.button_image))
        self.ds = ds
        self.view       = view
        self.album_title= None
        self.artist     = None
        self.active     = False

        self.button.show()
        self.button.set_relief (Gtk.ReliefStyle.NONE)
        self.button.set_focus_on_click(False)
        self.button.connect ('clicked', 
            lambda button : self.emit('switch-tab', self.button_name))
        buttons.pack_start (self.button, False, True, 0)
コード例 #2
0
    def setup_source(self):

        colour = self.viewmgr.get_selection_colour()
        self.cover_search_pane = CoverSearchPane(self.plugin, colour)

        self.stack.add_titled(self.cover_search_pane, "notebook_covers", _("Covers"))

        # define entry-view toolbar
        self.stars = ReactiveStar()
        self.stars.set_rating(0)
        self.stars.connect('changed', self.rating_changed_callback)
        self.stars.props.valign = Gtk.Align.CENTER
        self.entry_view_grid.attach(self.stars, 1, 1, 1, 1)
        stack_switcher = Gtk.StackSwitcher()
        stack_switcher.set_stack(self.stack)
        self.entry_view_grid.attach(stack_switcher, 0, 1, 1, 1)
        viewtoggle = PixbufButton()
        viewtoggle.set_image(create_button_image(self.plugin, "entryview.png"))
        self.viewtoggle_id = None

        setting = self.gs.get_setting(self.gs.Path.PLUGIN)
        viewtoggle.set_active(not setting[self.gs.PluginKey.ENTRY_VIEW_MODE])
        self.entry_view_toggled(viewtoggle, True)
        viewtoggle.connect('toggled', self.entry_view_toggled)

        smallwindowbutton = PixbufButton()
        smallwindowbutton.set_image(create_button_image(self.plugin, "view-restore.png"))
        smallwindowbutton.connect('toggled', self.smallwindowbutton_callback)

        self.smallwindowext = ExternalPlugin()
        self.smallwindowext.appendattribute('plugin_name', 'smallwindow')
        self.smallwindowext.appendattribute('action_group_name', 'small window actions')
        self.smallwindowext.appendattribute('action_name', 'SmallWindow')
        self.smallwindowext.appendattribute('action_type', 'app')

        whatsplayingtoggle = PixbufButton()
        whatsplayingtoggle.set_image(create_button_image(self.plugin, "whatsplaying.png"))
        whatsplayingtoggle.connect('toggled', self.whatsplayingtoggle_callback)

        rightgrid = Gtk.Grid()
        rightgrid.props.halign = Gtk.Align.END

        # rightgrid.attach(whatsplayingtoggle, 0, 0, 1, 1)
        rightgrid.attach(viewtoggle, 1, 0, 1, 1)
        rightgrid.attach(smallwindowbutton, 2, 0, 1, 1)

        self.entry_view_grid.attach_next_to(rightgrid, self.stars, Gtk.PositionType.RIGHT, 1, 1)
        self.stack.set_visible_child(self.entry_view_results)
        self.stack.connect('notify::visible-child-name', self.notebook_switch_page_callback)

        self.entry_view_grid.show_all()
        smallwindowbutton.set_visible(self.smallwindowext.is_activated())
コード例 #3
0
class ArtistInfoTab (GObject.GObject):
    
    __gsignals__ = {
        'switch-tab' : (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE,
                                (GObject.TYPE_STRING,))
    }
    
    button_image = "microphone.png"
    button_name  = "artist"

    def __init__ (self, plugin, shell, buttons, ds, view):
        GObject.GObject.__init__ (self)
        self.shell      = shell
        self.sp         = shell.props.shell_player
        self.db         = shell.props.db
        self.buttons    = buttons

        self.button     = PixbufButton()
        self.button.set_image(create_button_image(plugin, self.button_image))
        self.ds = ds
        self.view       = view
        self.album_title= None
        self.artist     = None
        self.active     = False

        self.button.show()
        self.button.set_relief (Gtk.ReliefStyle.NONE)
        self.button.set_focus_on_click(False)
        self.button.connect ('clicked', 
            lambda button : self.emit('switch-tab', self.button_name))
        buttons.pack_start (self.button, False, True, 0)

    def activate (self, artist=None, album_title=None):
        print("activating Artist Tab")
        self.button.set_active(True)
        self.active = True
        self.reload (artist, album_title)

    def deactivate (self):
        print("deactivating Artist Tab")
        self.button.set_active(False)
        self.active = False

    def reload (self, artist, album_title):
        if not artist:
            return
        
        if self.active and artist_exceptions(artist):
            print ("blank")
            self.view.blank_view()
            return
            
        if self.active and (   (not self.artist or self.artist != artist) 
                            or (not self.album_title or self.album_title != album_title)
                           ):
            print ("now loading")
            self.view.loading (artist, album_title)
            print ("active")
            self.ds.fetch_artist_data (artist)
        else:
            print ("load_view")
            self.view.load_view()

        self.album_title = album_title
        self.artist = artist
コード例 #4
0
class AlbumInfoTab (GObject.GObject):

    __gsignals__ = {
        'switch-tab' : (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE,
                                (GObject.TYPE_STRING,))
    }
    
    def __init__ (self, plugin, shell, buttons, ds, view):
        GObject.GObject.__init__ (self)
        self.shell      = shell
        self.sp         = shell.props.shell_player
        self.db         = shell.props.db
        self.buttons    = buttons

        #self.button     = Gtk.ToggleButton (label=_("Albums"))
        self.button     = PixbufButton()
        self.button.set_image(create_button_image(plugin, "covermgr.png"))
        self.ds         = ds
        self.view       = view
        self.album_title= None
        self.artist     = None
        self.active     = False
        
        self.button.show()
        self.button.set_relief (Gtk.ReliefStyle.NONE)
        self.button.set_focus_on_click(False)
        self.button.connect ('clicked', 
            lambda button: self.emit ('switch-tab', 'album'))
        buttons.pack_start (self.button, False, True, 0)

    def activate (self, artist, album_title):
        self.button.set_active(True)
        self.active = True
        self.reload (artist, album_title)

    def deactivate (self):
        self.button.set_active(False)
        self.active = False

    def reload (self, artist, album_title):
        if not artist:
            return
            
        if self.active and artist_exceptions(artist):
            print ("blank")
            self.view.blank_view()
            return
            
        if self.active and (not self.artist or artist != self.artist):
            self.view.loading(artist, album_title)
            self.ds.fetch_album_list (artist)
        else:
            self.view.load_view()

        self.album_title = album_title
        self.artist = artist