当前位置: 首页>>代码示例>>Python>>正文


Python image.ImageBase类代码示例

本文整理汇总了Python中foobnix.helpers.image.ImageBase的典型用法代码示例。如果您正苦于以下问题:Python ImageBase类的具体用法?Python ImageBase怎么用?Python ImageBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ImageBase类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CoverLyricsPanel

class CoverLyricsPanel(Gtk.Frame):
    def __init__(self, controls):
        Gtk.Frame.__init__(self)

        self.controls = controls
        self.set_size_request(100, 200)
        self.album_title = Gtk.Label(_("Album title"))
        self.set_label_align(0.5, 0.5)
        self.image = ImageBase(ICON_BLANK_DISK, size=FC().info_panel_image_size)
        self.image.set_from_pixbuf(self.get_pixbuf())

        image_frame = FrameDecorator(_("Cover"), self.image, 0.5, 0.5)

        self.lyrics = TextArea()

        lyrics_frame = FrameDecorator(_("Lyric"), self.lyrics, 0.5, 0.5)

        vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 5)
        vbox.pack_start(image_frame, False, False, 0)
        vbox.pack_start(lyrics_frame, True, True, 0)

        self.add(vbox)
        self.set_label_widget(self.album_title)
        self.show_all()

    def get_pixbuf(self):
        return self.controls.perspectives.get_perspective('info').get_widget().image.pixbuf

    def set_cover(self):
        self.image.size = FC().info_panel_image_size
        self.image.set_from_pixbuf(self.get_pixbuf())
开发者ID:kagel,项目名称:foobnix,代码行数:31,代码来源:coverlyrics.py

示例2: append_image

 def append_image(self, url):
     if not url:
         return None
     enditer = self.buffer.get_end_iter()
     image = ImageBase(None)
     image.set_image_from_url(url)
     self.buffer.insert_pixbuf(enditer, image.get_pixbuf())
开发者ID:simokhov,项目名称:foobnix,代码行数:7,代码来源:textarea.py

示例3: CoverLyricsPanel

class CoverLyricsPanel(gtk.Frame):
    def __init__(self, controls):
        gtk.Frame.__init__(self)
        vbox = gtk.VBox(False, 5)
        self.controls = controls
        
        self.album_title = gtk.Label(_("Album title"))
        image_size = FC().main_window_size[2] - (FC().hpaned_right + 16)
        self.image = ImageBase(ICON_BLANK_DISK, size=image_size)
        image_frame = gtk.Frame()
        image_frame.add(self.image)
        image_frame.set_label_widget(gtk.Label(_("Cover:")))
        vbox.pack_start(image_frame, False)
        
        self.lyrics = TextArea()
        lyrics_frame = gtk.Frame()
        lyrics_frame.add(self.lyrics)
        lyrics_frame.set_label_widget(gtk.Label(_("Lyric:")))
        vbox.pack_start(lyrics_frame, True)
        
        self.add(vbox)
        self.set_label_widget(self.album_title) 
        self.show_all()
        
    def get_pixbuf(self):
        return self.controls.info_panel.image.pixbuf
        
    def set_cover(self):
        pixbuf = self.get_pixbuf()
        self.image.set_from_pixbuf(pixbuf)
开发者ID:matttbe,项目名称:foobnix,代码行数:30,代码来源:coverlyrics.py

示例4: __init__

    def __init__(self, controls):
        Gtk.Frame.__init__(self)

        self.controls = controls
        self.set_size_request(100, 200)
        self.album_title = Gtk.Label(_("Album title"))

        self.image = ImageBase(ICON_BLANK_DISK, size=FC().info_panel_image_size)
        self.image.set_from_pixbuf(self.get_pixbuf())

        image_frame = Gtk.Frame()
        image_frame.add(self.image)
        image_frame.set_label_widget(Gtk.Label(_("Cover:")))

        self.lyrics = TextArea()

        lyrics_frame = Gtk.Frame()
        lyrics_frame.add(self.lyrics)
        lyrics_frame.set_label_widget(Gtk.Label(_("Lyric:")))

        vbox = Gtk.VBox(False, 5)
        vbox.pack_start(image_frame, False, False, 0)
        vbox.pack_start(lyrics_frame, True, True, 0)

        self.add(vbox)
        self.set_label_widget(self.album_title)
        self.show_all()
开发者ID:NextGenIntelligence,项目名称:foobnix,代码行数:27,代码来源:coverlyrics.py

示例5: __init__

    def __init__(self, controls):
        FControl.__init__(self, controls)
        Gtk.StatusIcon.__init__(self)
        self.hide()
        ImageBase.__init__(self, ICON_FOOBNIX, 150)

        self.popup_menu = PopupMenuWindow(self.controls)
        self.popup_volume_contol = PopupVolumeWindow(self.controls, self.popup_menu)

        self.connect("activate", self.on_activate)
        self.connect("popup-menu", self.on_popup_menu)

        try:
            self.set_has_tooltip(True)
            #self.set_tooltip("Foobnix music player")
            self.connect("query-tooltip", self.on_query_tooltip)
            self.connect("button-press-event", self.on_button_press)
            self.connect("scroll-event", self.on_scroll)
        except Exception, e:
            logging.warn("Tooltip doesn't work " + str(e))
开发者ID:foobnix,项目名称:foobnix,代码行数:20,代码来源:tray_icon.py

示例6: __init__

    def __init__(self, controls):
        FControl.__init__(self, controls)
        gtk.StatusIcon.__init__(self)
        self.hide()
        
        ImageBase.__init__(self, ICON_FOOBNIX, 150)
        
        self.popup_menu = PopupWindowMenu(self.controls)
        
        self.connect("activate", self.on_activate)
        self.connect("popup-menu", self.on_popup_menu)

        try:
            self.set_has_tooltip(True)        
            self.tooltip = gtk.Tooltip()
            self.set_tooltip("Foobnix music player")
            self.connect("query-tooltip", self.on_query_tooltip)
            self.connect("button-press-event", self.on_button_press)
            self.connect("scroll-event", self.controls.volume.on_scroll_event)
        except Exception, e:
            logging.warn("On debian it doesn't work" + str(e))
开发者ID:fain182,项目名称:foobnix,代码行数:21,代码来源:tray_icon.py

示例7: CoverLyricsPanel

class CoverLyricsPanel(Gtk.Frame):
    def __init__(self, controls):
        Gtk.Frame.__init__(self)
        vbox = Gtk.VBox(False, 5)
        self.controls = controls
        self.set_size_request(100, 200)
        self.album_title = Gtk.Label(_("Album title"))
        image_size = FC().main_window_size[2] - (FC().hpaned_right + 16)
        self.image = ImageBase(ICON_BLANK_DISK, size=image_size)
        image_frame = Gtk.Frame()
        image_frame.add(self.image)
        image_frame.set_label_widget(Gtk.Label(_("Cover:")))
        vbox.pack_start(image_frame, False, False, 0)

        self.lyrics = TextArea()
        self.lyrics.connect("size-allocate", self.adapt_image)
        lyrics_frame = Gtk.Frame()
        lyrics_frame.add(self.lyrics)
        lyrics_frame.set_label_widget(Gtk.Label(_("Lyric:")))
        vbox.pack_start(lyrics_frame, True, True, 0)

        self.add(vbox)
        self.set_label_widget(self.album_title)
        self.show_all()


    def get_pixbuf(self):
        return self.controls.perspectives.get_perspective('info').get_widget().image.pixbuf

    def set_cover(self):
        pixbuf = self.get_pixbuf()
        self.image.size = FC().info_panel_image_size
        self.image.set_from_pixbuf(pixbuf)

    def adapt_image(self, *a):
        dif = self.lyrics.get_allocation().width - self.image.get_allocation().width
        if self.lyrics.get_property("visible") and dif < 2:
            self.image.size = self.lyrics.get_allocation().width - 20
            self.image.set_from_pixbuf(self.controls.coverlyrics.get_pixbuf())
开发者ID:Andresteve07,项目名称:foobnix,代码行数:39,代码来源:coverlyrics.py

示例8: __init__

 def __init__(self, controls):
     gtk.Frame.__init__(self)
     vbox = gtk.VBox(False, 5)
     self.controls = controls
     
     self.album_title = gtk.Label(_("Album title"))
     image_size = FC().main_window_size[2] - (FC().hpaned_right + 16)
     self.image = ImageBase(ICON_BLANK_DISK, size=image_size)
     image_frame = gtk.Frame()
     image_frame.add(self.image)
     image_frame.set_label_widget(gtk.Label(_("Cover:")))
     vbox.pack_start(image_frame, False)
     
     self.lyrics = TextArea()
     lyrics_frame = gtk.Frame()
     lyrics_frame.add(self.lyrics)
     lyrics_frame.set_label_widget(gtk.Label(_("Lyric:")))
     vbox.pack_start(lyrics_frame, True)
     
     self.add(vbox)
     self.set_label_widget(self.album_title) 
     self.show_all()
开发者ID:matttbe,项目名称:foobnix,代码行数:22,代码来源:coverlyrics.py

示例9: __init__

    def __init__(self, controls):
        Gtk.Frame.__init__(self)
        FControl.__init__(self, controls)

        self.album_label = Gtk.Label()
        self.album_label.set_line_wrap(True)
        self.album_label.set_markup("<b></b>")
        self.set_label_widget(self.album_label)

        self.empty = TextArea()

        self.best_songs = SimpleTreeControl(_("Best Songs"), controls)
        self.best_songs.line_title = EventLabel(self.best_songs.get_title(), func=self.show_current,
                                                arg=self.best_songs, func1=self.show_best_songs)

        self.artists = SimpleTreeControl(_("Similar Artists"), controls)
        self.artists.line_title = EventLabel(self.artists.get_title(), func=self.show_current,
                                             arg=self.artists, func1=self.show_similar_artists)

        self.tracks = SimpleTreeControl(_("Similar Songs"), controls)
        self.tracks.line_title = EventLabel(self.tracks.get_title(), func=self.show_current,
                                            arg=self.tracks, func1=self.show_similar_tracks)

        self.tags = SimpleTreeControl(_("Similar Tags"), controls)
        self.tags.line_title = EventLabel(self.tags.get_title(), func=self.show_current,
                                          arg=self.tags, func1=self.show_similar_tags)

        self.lyrics = TextArea()
        lyric_title = _("Lyrics")
        self.lyrics.set_text("", lyric_title)
        self.lyrics.line_title = EventLabel(lyric_title, func=self.show_current,
                                            arg=self.lyrics, func1=self.show_similar_lyrics)

        """wiki"""
        wBox = Gtk.VBox()
        wiki_title = _("About Artist")
        self.wiki = TextArea()

        wBox.line_title = EventLabel(wiki_title, func=self.show_current, arg=wBox, func1=self.show_wiki_info)

        """info"""
        self.last_fm_label = Gtk.LinkButton("http://www.last.fm", "Last.Fm")
        self.wiki_label = Gtk.LinkButton("http://www.wikipedia.org", "Wikipedia")
        info_line = HBoxDecoratorTrue(self.last_fm_label, self.wiki_label)
        info_frame = FrameDecorator(_("Info"), info_line, 0.5, 0.5)

        """downloads"""
        self.exua_label = Gtk.LinkButton("http://www.ex.ua", "EX.ua")
        self.rutracker_label = Gtk.LinkButton("http://rutracker.org", "Rutracker")
        dm_line = HBoxDecoratorTrue(self.exua_label, self.rutracker_label)
        dm_frame = FrameDecorator(_("Downloads"), dm_line, 0.5, 0.5)

        self.wiki = TextArea()
        self.wiki.set_text("", wiki_title)

        wBox.pack_start(HBoxDecoratorTrue(info_frame, dm_frame), False, False, 0)
        wBox.pack_start(self.wiki, True, True, 0)

        wBox.scroll = wBox

        self.vpaned_small = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)

        """image and similar artists"""
        ibox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
        self.image = ImageBase(ICON_BLANK_DISK, FC().info_panel_image_size)

        lbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)

        self.left_widget = [wBox, self.artists, self.tracks, self.tags, self.lyrics, self.best_songs]

        for l_widget in self.left_widget:
            lbox.pack_start(l_widget.line_title, True, True, 0)

        ibox.pack_start(self.image, False, False, 0)
        ibox.pack_start(lbox, True, True, 0)

        """image and similar artists"""
        sbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)

        for l_widget in self.left_widget:
            sbox.pack_start(l_widget.scroll, True, True, 0)

        sbox.pack_end(self.empty.scroll, True, True, 0)

        self.vpaned_small.pack_start(ibox, False, False, 0)
        self.vpaned_small.pack_start(sbox, True, True, 0)

        self.add(self.vpaned_small)

        self.bean = None
        self.info_cache = InfoCache()
        self.update_lock = threading.Lock()
        self.clear()
开发者ID:kagel,项目名称:foobnix,代码行数:93,代码来源:infopanel.py

示例10: InfoPanelWidget

class InfoPanelWidget(Gtk.Frame, LoadSave, FControl):
    def __init__(self, controls):
        Gtk.Frame.__init__(self)
        FControl.__init__(self, controls)

        self.album_label = Gtk.Label()
        self.album_label.set_line_wrap(True)
        self.album_label.set_markup("<b></b>")
        self.set_label_widget(self.album_label)

        self.empty = TextArea()

        self.best_songs = SimpleTreeControl(_("Best Songs"), controls)
        self.best_songs.line_title = EventLabel(self.best_songs.get_title(), func=self.show_current,
                                                arg=self.best_songs, func1=self.show_best_songs)

        self.artists = SimpleTreeControl(_("Similar Artists"), controls)
        self.artists.line_title = EventLabel(self.artists.get_title(), func=self.show_current,
                                             arg=self.artists, func1=self.show_similar_artists)

        self.tracks = SimpleTreeControl(_("Similar Songs"), controls)
        self.tracks.line_title = EventLabel(self.tracks.get_title(), func=self.show_current,
                                            arg=self.tracks, func1=self.show_similar_tracks)

        self.tags = SimpleTreeControl(_("Similar Tags"), controls)
        self.tags.line_title = EventLabel(self.tags.get_title(), func=self.show_current,
                                          arg=self.tags, func1=self.show_similar_tags)

        self.lyrics = TextArea()
        lyric_title = _("Lyrics")
        self.lyrics.set_text("", lyric_title)
        self.lyrics.line_title = EventLabel(lyric_title, func=self.show_current,
                                            arg=self.lyrics, func1=self.show_similar_lyrics)

        """wiki"""
        wBox = Gtk.VBox()
        wiki_title = _("About Artist")
        self.wiki = TextArea()

        wBox.line_title = EventLabel(wiki_title, func=self.show_current, arg=wBox, func1=self.show_wiki_info)

        """info"""
        self.last_fm_label = Gtk.LinkButton("http://www.last.fm", "Last.Fm")
        self.wiki_label = Gtk.LinkButton("http://www.wikipedia.org", "Wikipedia")
        info_line = HBoxDecoratorTrue(self.last_fm_label, self.wiki_label)
        info_frame = FrameDecorator(_("Info"), info_line, 0.5, 0.5)

        """downloads"""
        self.exua_label = Gtk.LinkButton("http://www.ex.ua", "EX.ua")
        self.rutracker_label = Gtk.LinkButton("http://rutracker.org", "Rutracker")
        dm_line = HBoxDecoratorTrue(self.exua_label, self.rutracker_label)
        dm_frame = FrameDecorator(_("Downloads"), dm_line, 0.5, 0.5)

        self.wiki = TextArea()
        self.wiki.set_text("", wiki_title)

        wBox.pack_start(HBoxDecoratorTrue(info_frame, dm_frame), False, False, 0)
        wBox.pack_start(self.wiki, True, True, 0)

        wBox.scroll = wBox

        self.vpaned_small = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)

        """image and similar artists"""
        ibox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
        self.image = ImageBase(ICON_BLANK_DISK, FC().info_panel_image_size)

        lbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)

        self.left_widget = [wBox, self.artists, self.tracks, self.tags, self.lyrics, self.best_songs]

        for l_widget in self.left_widget:
            lbox.pack_start(l_widget.line_title, True, True, 0)

        ibox.pack_start(self.image, False, False, 0)
        ibox.pack_start(lbox, True, True, 0)

        """image and similar artists"""
        sbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)

        for l_widget in self.left_widget:
            sbox.pack_start(l_widget.scroll, True, True, 0)

        sbox.pack_end(self.empty.scroll, True, True, 0)

        self.vpaned_small.pack_start(ibox, False, False, 0)
        self.vpaned_small.pack_start(sbox, True, True, 0)

        self.add(self.vpaned_small)

        self.bean = None
        self.info_cache = InfoCache()
        self.update_lock = threading.Lock()
        self.clear()

    @idle_task
    def show_current(self, widget):
        if not self.controls.net_wrapper.is_internet():
            return

#.........这里部分代码省略.........
开发者ID:kagel,项目名称:foobnix,代码行数:101,代码来源:infopanel.py

示例11: __init__

    def __init__(self, controls): 
        gtk.Frame.__init__(self)
        FControl.__init__(self, controls)
        self.album_label = gtk.Label()
        self.album_label.set_line_wrap(True)
        self.album_label.set_markup("<b></b>")
        self.set_label_widget(self.album_label)                                
        
        self.best_songs = SimpleTreeControl(_("Best Songs"), controls)
        self.best_songs.line_title = EventLabel(self.best_songs.get_title(), func=self.show_current, arg=self.best_songs, func1=self.show_best_songs)
        
        self.artists = SimpleTreeControl(_("Similar Artists"), controls)
        self.artists.line_title = EventLabel(self.artists.get_title(), func=self.show_current, arg=self.artists, func1=self.show_similar_artists)
        
        self.tracks = SimpleTreeControl(_("Similar Songs"), controls)
        self.tracks.line_title = EventLabel(self.tracks.get_title(), func=self.show_current, arg=self.tracks, func1=self.show_similar_tracks)
                
        self.tags = SimpleTreeControl(_("Similar Tags"), controls)
        self.tags.line_title = EventLabel(self.tags.get_title(), func=self.show_current, arg=self.tags, func1=self.show_similar_tags)
        
        
        self.lyrics = TextArea()
        lyric_title = _("Lyrics")
        self.lyrics.set_text("", lyric_title)
        self.lyrics.line_title = EventLabel(lyric_title, func=self.show_current, arg=self.lyrics, func1=self.show_similar_lyrics)
        
        
        """wiki"""
        wBox = gtk.VBox()
        wiki_title = _("Biography")
        self.wiki = TextArea()
        
        wBox.line_title = EventLabel(wiki_title, func=self.show_current, arg=wBox, func1=self.show_wiki_info)
        
        self.last_fm_label = gtk.LinkButton("http://www.last.fm", "last.fm")
        self.wiki_label = gtk.LinkButton("http://www.wikipedia.org", "wikipedia")
        
        self.wiki = TextArea()
        self.wiki.set_text("", wiki_title)
        
        wBox.pack_start(HBoxDecorator(self.last_fm_label, self.wiki_label), False, False)
        wBox.pack_start(self.wiki, True, True)
        
        wBox.scroll = wBox
        
        self.vpaned_small = gtk.VBox(False, 0)
        
        """image and similar artists"""
        ibox = gtk.HBox(False, 0)
        self.image = ImageBase(ICON_BLANK_DISK, FC().info_panel_image_size)
        
        
        lbox = gtk.VBox(False, 0)
        
        
        self.left_widget = [wBox, self.artists, self.tracks, self.tags, self.lyrics, self.best_songs]
        
        for l_widget in self.left_widget:        
            lbox.pack_start(l_widget.line_title)
        

        
        ibox.pack_start(self.image, False, False)
        ibox.pack_start(lbox, True, True)
        
        
        """image and similar artists"""
        sbox = gtk.VBox(False, 0)
        
        for l_widget in self.left_widget:        
            sbox.pack_start(l_widget.scroll, True, True)
        
        self.vpaned_small.pack_start(ibox, False, False)
        self.vpaned_small.pack_start(sbox, True, True)
                
        self.add(self.vpaned_small)
        
        self.hide_all()
        
        self.bean = None
        self.info_cache = InfoCache()
开发者ID:Lomir,项目名称:foobnix,代码行数:81,代码来源:infopanel.py

示例12: InfoPanelWidget

class InfoPanelWidget(gtk.Frame, LoadSave, FControl):   
    def __init__(self, controls): 
        gtk.Frame.__init__(self)
        FControl.__init__(self, controls)
        self.album_label = gtk.Label()
        self.album_label.set_line_wrap(True)
        self.album_label.set_markup("<b></b>")
        self.set_label_widget(self.album_label)                                
        
        self.best_songs = SimpleTreeControl(_("Best Songs"), controls)
        self.best_songs.line_title = EventLabel(self.best_songs.get_title(), func=self.show_current, arg=self.best_songs, func1=self.show_best_songs)
        
        self.artists = SimpleTreeControl(_("Similar Artists"), controls)
        self.artists.line_title = EventLabel(self.artists.get_title(), func=self.show_current, arg=self.artists, func1=self.show_similar_artists)
        
        self.tracks = SimpleTreeControl(_("Similar Songs"), controls)
        self.tracks.line_title = EventLabel(self.tracks.get_title(), func=self.show_current, arg=self.tracks, func1=self.show_similar_tracks)
                
        self.tags = SimpleTreeControl(_("Similar Tags"), controls)
        self.tags.line_title = EventLabel(self.tags.get_title(), func=self.show_current, arg=self.tags, func1=self.show_similar_tags)
        
        
        self.lyrics = TextArea()
        lyric_title = _("Lyrics")
        self.lyrics.set_text("", lyric_title)
        self.lyrics.line_title = EventLabel(lyric_title, func=self.show_current, arg=self.lyrics, func1=self.show_similar_lyrics)
        
        
        """wiki"""
        wBox = gtk.VBox()
        wiki_title = _("Biography")
        self.wiki = TextArea()
        
        wBox.line_title = EventLabel(wiki_title, func=self.show_current, arg=wBox, func1=self.show_wiki_info)
        
        self.last_fm_label = gtk.LinkButton("http://www.last.fm", "last.fm")
        self.wiki_label = gtk.LinkButton("http://www.wikipedia.org", "wikipedia")
        
        self.wiki = TextArea()
        self.wiki.set_text("", wiki_title)
        
        wBox.pack_start(HBoxDecorator(self.last_fm_label, self.wiki_label), False, False)
        wBox.pack_start(self.wiki, True, True)
        
        wBox.scroll = wBox
        
        self.vpaned_small = gtk.VBox(False, 0)
        
        """image and similar artists"""
        ibox = gtk.HBox(False, 0)
        self.image = ImageBase(ICON_BLANK_DISK, FC().info_panel_image_size)
        
        
        lbox = gtk.VBox(False, 0)
        
        
        self.left_widget = [wBox, self.artists, self.tracks, self.tags, self.lyrics, self.best_songs]
        
        for l_widget in self.left_widget:        
            lbox.pack_start(l_widget.line_title)
        

        
        ibox.pack_start(self.image, False, False)
        ibox.pack_start(lbox, True, True)
        
        
        """image and similar artists"""
        sbox = gtk.VBox(False, 0)
        
        for l_widget in self.left_widget:        
            sbox.pack_start(l_widget.scroll, True, True)
        
        self.vpaned_small.pack_start(ibox, False, False)
        self.vpaned_small.pack_start(sbox, True, True)
                
        self.add(self.vpaned_small)
        
        self.hide_all()
        
        self.bean = None
        self.info_cache = InfoCache()
    
    def activate_perspective(self):
        FC().left_perspective = LEFT_PERSPECTIVE_INFO
    
    def show_current(self, widget):
        for w in self.left_widget:
            w.scroll.hide()
            w.line_title.set_not_active()
            
        widget.scroll.show_all()
        widget.line_title.set_active()
        
        self.info_cache.active_method = widget.line_title.func1
        self.controls.in_thread.run_with_progressbar(widget.line_title.func1)
        
    
    def clear(self):
        self.image.set_no_image()
#.........这里部分代码省略.........
开发者ID:Lomir,项目名称:foobnix,代码行数:101,代码来源:infopanel.py

示例13: InfoPanelWidget

class InfoPanelWidget(gtk.Frame, LoadSave, FControl):   
    def __init__(self, controls): 
        gtk.Frame.__init__(self)
        FControl.__init__(self, controls)
        
        self.album_label = gtk.Label()
        self.album_label.set_line_wrap(True)
        self.album_label.set_markup("<b></b>")
        self.set_label_widget(self.album_label)                                
        
        self.empty = TextArea()
        
        self.best_songs = SimpleTreeControl(_("Best Songs"), controls)
        self.best_songs.line_title = EventLabel(self.best_songs.get_title(), func=self.show_current, arg=self.best_songs, func1=self.show_best_songs)
        
        self.artists = SimpleTreeControl(_("Similar Artists"), controls)
        self.artists.line_title = EventLabel(self.artists.get_title(), func=self.show_current, arg=self.artists, func1=self.show_similar_artists)
        
        self.tracks = SimpleTreeControl(_("Similar Songs"), controls)
        self.tracks.line_title = EventLabel(self.tracks.get_title(), func=self.show_current, arg=self.tracks, func1=self.show_similar_tracks)
                
        self.tags = SimpleTreeControl(_("Similar Tags"), controls)
        self.tags.line_title = EventLabel(self.tags.get_title(), func=self.show_current, arg=self.tags, func1=self.show_similar_tags)
        
        
        self.lyrics = TextArea()
        lyric_title = _("Lyrics")
        self.lyrics.set_text("", lyric_title)
        self.lyrics.line_title = EventLabel(lyric_title, func=self.show_current, arg=self.lyrics, func1=self.show_similar_lyrics)
        
        
        """wiki"""
        wBox = gtk.VBox()
        wiki_title = _("About Artist")
        self.wiki = TextArea()
        
        wBox.line_title = EventLabel(wiki_title, func=self.show_current, arg=wBox, func1=self.show_wiki_info)
        
        self.last_fm_label = gtk.LinkButton("http://www.last.fm", "last.fm")
        self.wiki_label = gtk.LinkButton("http://www.wikipedia.org", "wikipedia")
        
        self.wiki = TextArea()
        self.wiki.set_text("", wiki_title)
        
        wBox.pack_start(HBoxDecorator(self.last_fm_label, self.wiki_label), False, False)
        wBox.pack_start(self.wiki, True, True)
        
        wBox.scroll = wBox
        
        self.vpaned_small = gtk.VBox(False, 0)
        
        """image and similar artists"""
        ibox = gtk.HBox(False, 0)
        self.image = ImageBase(ICON_BLANK_DISK, FC().info_panel_image_size)
        
        
        lbox = gtk.VBox(False, 0)
        
        
        self.left_widget = [wBox, self.artists, self.tracks, self.tags, self.lyrics, self.best_songs]
        
        for l_widget in self.left_widget:        
            lbox.pack_start(l_widget.line_title)
                
        ibox.pack_start(self.image, False, False)
        ibox.pack_start(lbox, True, True)
                
        """image and similar artists"""
        sbox = gtk.VBox(False, 0)
        
        for l_widget in self.left_widget:        
            sbox.pack_start(l_widget.scroll, True, True)
        
        sbox.pack_end(self.empty.scroll, True, True)
        
        self.vpaned_small.pack_start(ibox, False, False)
        self.vpaned_small.pack_start(sbox, True, True)
                
        self.add(self.vpaned_small)
        
        self.hide_all()
        
        self.bean = None
        self.info_cache = InfoCache()
    
    def activate_perspective(self):
        FC().left_perspective = LEFT_PERSPECTIVE_INFO
    
    def show_current(self, widget):
        self.empty.hide()
        if widget.line_title.selected:
            widget.scroll.hide()
            self.empty.show()
            widget.line_title.set_not_active()
            self.info_cache.active_method
            return
        
        for w in self.left_widget:
            w.scroll.hide()
            w.line_title.set_not_active()
#.........这里部分代码省略.........
开发者ID:matttbe,项目名称:foobnix,代码行数:101,代码来源:infopanel.py


注:本文中的foobnix.helpers.image.ImageBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。