Пример #1
0
 def __init__(self, controls): 
     gtk.HBox.__init__(self, False)
     
     self.rlabel = EventLabel(text="S", func=lambda * a: self.on_random())
     self.olabel = EventLabel(text="R", func=lambda * a: self.on_order())
     
     self.pack_start(self.rlabel)
     self.pack_start(gtk.Label(" "))
     self.pack_start(self.olabel)
     
     self.pack_start(gtk.SeparatorToolItem())
Пример #2
0
    def __init__(self, controls):
        Gtk.HBox.__init__(self, False)

        self.toggle_buttons = OrderShuffleControls_ZAVLAB(controls)

        self.rlabel = EventLabel(text="S", func=lambda * a: self.on_random())
        self.olabel = EventLabel(text="R", func=lambda * a: self.on_order())

        self.pack_start(self.rlabel, False, False, 0)
        self.pack_start(Gtk.Label(" "), False, False, 0)
        self.pack_start(self.olabel, False, False, 0)
        self.pack_start(self.toggle_buttons, False, False, 0)

        self.pack_start(Gtk.SeparatorToolItem.new(), False, False, 0)
Пример #3
0
    def __init__(self, controls):
        gtk.HBox.__init__(self, False)

        self.toggle_buttons = OrderShuffleControls_ZAVLAB(controls)

        self.rlabel = EventLabel(text="S", func=lambda *a: self.on_random())
        self.olabel = EventLabel(text="R", func=lambda *a: self.on_order())

        self.pack_start(self.rlabel)
        self.pack_start(gtk.Label(" "))
        self.pack_start(self.olabel)
        self.pack_start(self.toggle_buttons)

        self.pack_start(gtk.SeparatorToolItem())
Пример #4
0
    def __init__(self, controls):
        Gtk.Box.__init__(self,
                         orientation=Gtk.Orientation.HORIZONTAL,
                         spacing=0)

        self.toggle_buttons = OrderShuffleControls_ZAVLAB(controls)

        self.rlabel = EventLabel(text="S", func=lambda *a: self.on_random())
        self.olabel = EventLabel(text="R", func=lambda *a: self.on_order())

        self.pack_start(self.rlabel, False, False, 0)
        self.pack_start(Gtk.Label.new(" "), False, False, 0)
        self.pack_start(self.olabel, False, False, 0)
        self.pack_start(self.toggle_buttons, False, False, 0)

        self.pack_start(Gtk.SeparatorToolItem.new(), False, False, 0)
Пример #5
0
    def __init__(self, controls):
        gtk.HBox.__init__(self, False, 0)
        FControl.__init__(self, controls)
        
        label_m = EventLabel(text="‒", func=self.volume_down)
        
        adjustment = gtk.Adjustment(value=1, lower=0, upper=self.MAX_VALUE, step_incr=0, page_incr=0, page_size=0)
        self.volume_scale = gtk.HScale(adjustment)
        self.volume_scale.connect("value-changed", self.on_value_changed)
        self.volume_scale.connect("scroll-event", self.on_scroll_event)
        self.volume_scale.connect("button-press-event", self.on_volume_change)
        #self.volume_scale.connect("motion-notify-event", self.on_volume_change1)
        self.volume_scale.set_size_request(200, -1)
        self.volume_scale.set_update_policy(gtk.UPDATE_CONTINUOUS)
        self.volume_scale.set_digits(1)        
        self.volume_scale.set_draw_value(False)

        label_p = EventLabel(text="+", func=self.volume_up)
        
        self.pack_start(label_m, False, False)
        self.pack_start(self.volume_scale, False, False)
        self.pack_start(label_p, False, False)
        
        self.show_all()
Пример #6
0
class OrderShuffleControls(FControl, Gtk.HBox, LoadSave):
    def __init__(self, controls):
        Gtk.HBox.__init__(self, False)

        self.toggle_buttons = OrderShuffleControls_ZAVLAB(controls)

        self.rlabel = EventLabel(text="S", func=lambda * a: self.on_random())
        self.olabel = EventLabel(text="R", func=lambda * a: self.on_order())

        self.pack_start(self.rlabel, False, False, 0)
        self.pack_start(Gtk.Label(" "), False, False, 0)
        self.pack_start(self.olabel, False, False, 0)
        self.pack_start(self.toggle_buttons, False, False, 0)

        self.pack_start(Gtk.SeparatorToolItem.new(), False, False, 0)

    def update(self):
        if FC().is_order_random:
            self.rlabel.set_markup("<b>S</b>")
            self.rlabel.set_tooltip_text(_("Shuffle on"))

        else:
            self.rlabel.set_markup("S")
            self.rlabel.set_tooltip_text(_("Shuffle off"))

        if FC().repeat_state == const.REPEAT_ALL:
            self.olabel.set_markup("<b>R</b>")
            self.olabel.set_tooltip_text(_("Repeat all"))
        elif FC().repeat_state == const.REPEAT_SINGLE:
            self.olabel.set_markup("<b>R1</b>")
            self.olabel.set_tooltip_text(_("Repeat single"))
        else:
            self.olabel.set_markup("R")
            self.olabel.set_tooltip_text(_("Repeat off"))

    def on_random(self, *a):
        FC().is_order_random = not FC().is_order_random
        self.update()

    def on_order(self):
        if FC().repeat_state == const.REPEAT_ALL:
            FC().repeat_state = const.REPEAT_SINGLE
        elif FC().repeat_state == const.REPEAT_SINGLE:
            FC().repeat_state = const.REPEAT_NO
        elif FC().repeat_state == const.REPEAT_NO:
            FC().repeat_state = const.REPEAT_ALL
        self.update()

    def on_load(self):
        if FC().order_repeat_style == "ToggleButtons":
            self.toggle_buttons.on_load()
            self.olabel.hide()
            self.rlabel.hide()
            self.toggle_buttons.show()
        else:
            self.update()
            self.toggle_buttons.hide()
            self.olabel.show()
            self.rlabel.show()

    def on_save(self): pass
Пример #7
0
    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()
Пример #8
0
    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"""
        info_frame = Gtk.Frame(label=_("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.add(info_line)

        """downloads"""
        dm_frame = Gtk.Frame(label=_("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.add(dm_line)

        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.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, True, True, 0)

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

        """image and similar artists"""
        sbox = Gtk.VBox(False, 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()
Пример #9
0
class OrderShuffleControls(FControl, gtk.HBox, LoadSave):
    def __init__(self, controls): 
        gtk.HBox.__init__(self, False)
        
        self.rlabel = EventLabel(text="S", func=lambda * a: self.on_random())
        self.olabel = EventLabel(text="R", func=lambda * a: self.on_order())
        
        self.pack_start(self.rlabel)
        self.pack_start(gtk.Label(" "))
        self.pack_start(self.olabel)
        
        self.pack_start(gtk.SeparatorToolItem())
    
    def update(self):
        if FC().is_order_random:
            self.rlabel.set_markup("<b>S</b>")
            self.rlabel.set_tooltip_text(_("Shuffle on"))
            
        else:
            self.rlabel.set_markup("S")
            self.rlabel.set_tooltip_text(_("Shuffle off"))
            
        if FC().repeat_state == const.REPEAT_ALL:
            self.olabel.set_markup("<b>R</b>")
            self.olabel.set_tooltip_text(_("Repeat all"))            
        elif FC().repeat_state == const.REPEAT_SINGLE:
            self.olabel.set_markup("<b>R1</b>")
            self.olabel.set_tooltip_text(_("Repeat single"))
        else:
            self.olabel.set_markup("R")
            self.olabel.set_tooltip_text(_("Repeat off"))
        
    def on_random(self, *a):
        FC().is_order_random = not FC().is_order_random
        self.update()
    
    def on_order(self):
        if FC().repeat_state == const.REPEAT_ALL:
            FC().repeat_state = const.REPEAT_SINGLE
        elif FC().repeat_state == const.REPEAT_SINGLE:
            FC().repeat_state = const.REPEAT_NO
        elif FC().repeat_state == const.REPEAT_NO:
            FC().repeat_state = const.REPEAT_ALL
        self.update()
            
    def on_load(self): 
        self.update()
        
    def on_save(self): pass        
Пример #10
0
class OrderShuffleControls(FControl, Gtk.Box, LoadSave):
    def __init__(self, controls):
        Gtk.Box.__init__(self,
                         orientation=Gtk.Orientation.HORIZONTAL,
                         spacing=0)

        self.toggle_buttons = OrderShuffleControls_ZAVLAB(controls)

        self.rlabel = EventLabel(text="S", func=lambda *a: self.on_random())
        self.olabel = EventLabel(text="R", func=lambda *a: self.on_order())

        self.pack_start(self.rlabel, False, False, 0)
        self.pack_start(Gtk.Label.new(" "), False, False, 0)
        self.pack_start(self.olabel, False, False, 0)
        self.pack_start(self.toggle_buttons, False, False, 0)

        self.pack_start(Gtk.SeparatorToolItem.new(), False, False, 0)

    def update(self):
        if FC().is_order_random:
            self.rlabel.set_markup("<b>S</b>")
            self.rlabel.set_tooltip_text(_("Shuffle on"))

        else:
            self.rlabel.set_markup("S")
            self.rlabel.set_tooltip_text(_("Shuffle off"))

        if FC().repeat_state == const.REPEAT_ALL:
            self.olabel.set_markup("<b>R</b>")
            self.olabel.set_tooltip_text(_("Repeat all"))
        elif FC().repeat_state == const.REPEAT_SINGLE:
            self.olabel.set_markup("<b>R1</b>")
            self.olabel.set_tooltip_text(_("Repeat single"))
        else:
            self.olabel.set_markup("R")
            self.olabel.set_tooltip_text(_("Repeat off"))

    def on_random(self, *a):
        FC().is_order_random = not FC().is_order_random
        self.update()

    def on_order(self):
        if FC().repeat_state == const.REPEAT_ALL:
            FC().repeat_state = const.REPEAT_SINGLE
        elif FC().repeat_state == const.REPEAT_SINGLE:
            FC().repeat_state = const.REPEAT_NO
        elif FC().repeat_state == const.REPEAT_NO:
            FC().repeat_state = const.REPEAT_ALL
        self.update()

    def on_load(self):
        if FC().order_repeat_style == "ToggleButtons":
            self.toggle_buttons.on_load()
            self.olabel.hide()
            self.rlabel.hide()
            self.toggle_buttons.show()
        else:
            self.update()
            self.toggle_buttons.hide()
            self.olabel.show()
            self.rlabel.show()

    def on_save(self):
        pass