Esempio n. 1
0
    def __create_single_toggle_button(self,
                                      normal_name,
                                      callback,
                                      tip_msg=None):
        if normal_name == "karaoke":
            toggle_button = ToggleButton(
                app_theme.get_pixbuf("lyric/%s_press.png" % normal_name),
                app_theme.get_pixbuf("lyric/%s_normal.png" % normal_name),
                app_theme.get_pixbuf("lyric/%s_hover.png" % normal_name),
            )
        else:
            toggle_button = ToggleButton(
                app_theme.get_pixbuf("lyric/%s_normal.png" % normal_name),
                app_theme.get_pixbuf("lyric/%s_press.png" % normal_name),
                app_theme.get_pixbuf("lyric/%s_hover.png" % normal_name),
            )

        toggle_button.connect("toggled", callback)
        toggle_align = gtk.Alignment()
        toggle_align.set(0.5, 0.5, 0, 0)
        toggle_align.add(toggle_button)

        if tip_msg:
            Tooltip.text(toggle_button, tip_msg)
        return toggle_align, toggle_button
    def __init__(self, element, index, font_size, item_height,
                 padding_left, padding_middle, padding_right,
                 set_index, get_index, x_align=ALIGN_START):
        
        # Init.
        super(SimpleLabel, self).__init__()
        self.font_size = font_size
        self.index = index
        self.set_index = set_index
        self.get_index = get_index
        self.padding_left = padding_left
        self.padding_right = padding_right
        self.font_offset = padding_middle
        self.args = None
        if len(element) == 2:
            self.content, self.clicked_callback = element
        else:    
            self.content, self.clicked_callback = element[:2]
            self.args = element[2:]

        if self.content:
            Tooltip.text(self, self.content)
        self.x_align = x_align
        self.set_size_request(120, item_height)
        self.connect("expose-event", self.expose_simple_item)
        self.connect("clicked", lambda w: self.wrap_item_clicked_action())
 def __init__(self, element, index, font_size, item_height,
              padding_left, padding_middle, padding_right,
              set_index, get_index, x_align=ALIGN_START):
     
     # Init.
     super(SimpleItem, self).__init__()
     self.font_size = font_size
     self.index = index
     self.set_index = set_index
     self.get_index = get_index
     self.padding_left = padding_left
     self.padding_right = padding_right
     self.font_offset = padding_middle
     self.args = None
     if len(element) == 4:
         self.normal_dpixbuf, self.press_dpixbuf, self.content, self.clicked_callback = element
     else:    
         self.normal_dpixbuf, self.press_dpixbuf, self.content, self.clicked_callback = element[:4]
         self.args = element[4:]
         
     pixbuf_width = self.normal_dpixbuf.get_pixbuf().get_width()
     if self.content:
         Tooltip.text(self, self.content)
     self.font_offset += pixbuf_width
     self.x_align = x_align
     
     self.set_size_request(150, item_height)
     self.connect("expose-event", self.expose_simple_item)
     self.connect("clicked", lambda w: self.wrap_item_clicked_action())
Esempio n. 4
0
    def __init__(self,
                 element,
                 index,
                 font_size,
                 item_height,
                 padding_left,
                 padding_middle,
                 padding_right,
                 set_index,
                 get_index,
                 x_align=ALIGN_START):

        # Init.
        super(SimpleLabel, self).__init__()
        self.font_size = font_size
        self.index = index
        self.set_index = set_index
        self.get_index = get_index
        self.padding_left = padding_left
        self.padding_right = padding_right
        self.font_offset = padding_middle
        self.args = None
        if len(element) == 2:
            self.content, self.clicked_callback = element
        else:
            self.content, self.clicked_callback = element[:2]
            self.args = element[2:]

        if self.content:
            Tooltip.text(self, self.content)
        self.x_align = x_align
        self.set_size_request(120, item_height)
        self.connect("expose-event", self.expose_simple_item)
        self.connect("clicked", lambda w: self.wrap_item_clicked_action())
Esempio n. 5
0
 def set_infos(self, infos):
     temp_pixbuf, self.prompt_text = infos
     if temp_pixbuf:
         Tooltip.text(self, self.prompt_text)
         self.prompt_pixbuf = temp_pixbuf.scale_simple(
             16, 16, gtk.gdk.INTERP_BILINEAR)
         self.update_size()
 def __create_button(self, name, tip_msg=None):    
     button = ImageButton(
         app_theme.get_pixbuf("action/%s_normal.png" % name),
         app_theme.get_pixbuf("action/%s_hover.png" % name),
         app_theme.get_pixbuf("action/%s_press.png" % name),
         )
     button.connect("clicked", self.player_control, name)
     if tip_msg:
         Tooltip.text(button, tip_msg)
     return button
Esempio n. 7
0
 def __create_button(self, name, tip_msg=None):
     button = ImageButton(
         app_theme.get_pixbuf("action/%s_normal.png" % name),
         app_theme.get_pixbuf("action/%s_hover.png" % name),
         app_theme.get_pixbuf("action/%s_press.png" % name),
     )
     button.connect("clicked", self.player_control, name)
     if tip_msg:
         Tooltip.text(button, tip_msg)
     return button
Esempio n. 8
0
 def __create_simple_button(self, name, callback, tip_msg=""):        
     button = ImageButton(
         app_theme.get_pixbuf("toolbar/%s_normal.png" % name),
         app_theme.get_pixbuf("toolbar/%s_hover.png" % name),
         app_theme.get_pixbuf("toolbar/%s_press.png" % name),
         )
     button.connect("button-press-event", callback)
     if tip_msg:
         Tooltip.text(button, tip_msg)
         
     self.toolbar_box.pack_start(button, False, False)
     return button
Esempio n. 9
0
 def __create_simple_toggle_button(self, name, callback, tip_msg=""):        
     toggle_button = ToggleButton(
         app_theme.get_pixbuf("toolbar/%s_normal.png" % name),
         app_theme.get_pixbuf("toolbar/%s_press.png" % name),
         )
     toggle_button.connect("toggled", callback)
     
     if tip_msg:
         Tooltip.text(toggle_button, tip_msg)
         
     self.toolbar_box.pack_start(toggle_button, False, False)
     return toggle_button
Esempio n. 10
0
    def __create_simple_toggle_button(self, name, callback, tip_msg=""):
        toggle_button = ToggleButton(
            app_theme.get_pixbuf("toolbar/%s_normal.png" % name),
            app_theme.get_pixbuf("toolbar/%s_press.png" % name),
            )
        toggle_button.connect("toggled", callback)

        if tip_msg:
            Tooltip.text(toggle_button, tip_msg)

        self.toolbar_box.pack_start(toggle_button, False, False)
        return toggle_button
Esempio n. 11
0
    def __create_simple_button(self, name, callback, tip_msg=""):
        button = ImageButton(
            app_theme.get_pixbuf("toolbar/%s_normal.png" % name),
            app_theme.get_pixbuf("toolbar/%s_hover.png" % name),
            app_theme.get_pixbuf("toolbar/%s_press.png" % name),
            )
        button.connect("button-press-event", callback)
        if tip_msg:
            Tooltip.text(button, tip_msg)

        self.toolbar_box.pack_start(button, False, False)
        return button
Esempio n. 12
0
 def __create_zoom_button(self, name, msg=None):
     button = ImageButton(
         app_theme.get_pixbuf("lyric/%s_normal.png" % name),
         app_theme.get_pixbuf("lyric/%s_hover.png" % name),
         app_theme.get_pixbuf("lyric/%s_press.png" % name))
     button.connect("clicked", self.change_font_size, name)
     if msg:
         Tooltip.text(button, msg)
     align = gtk.Alignment()
     align.set(0.5, 0.5, 0, 0)
     align.add(button)
     return align
 def __create_zoom_button(self, name, msg=None):    
     button = ImageButton(
         app_theme.get_pixbuf("lyric/%s_normal.png" % name),
         app_theme.get_pixbuf("lyric/%s_hover.png" % name),
         app_theme.get_pixbuf("lyric/%s_press.png" % name)
         )
     button.connect("clicked", self.change_font_size, name)
     if msg:
         Tooltip.text(button, msg)
     align = gtk.Alignment()
     align.set(0.5, 0.5, 0, 0)
     align.add(button)
     return align
Esempio n. 14
0
 def __init__(self, init_index=0):
     super(ComboMenuButton, self).__init__()
     self.current_index = init_index
     self.current_status = "artist"
     self.set_spacing(0)
     self.msg_content = _("By artist")
     
     self.list_button = ComboItem(
         (app_theme.get_pixbuf("combo/left_normal.png"),
          app_theme.get_pixbuf("combo/left_hover.png"),
          app_theme.get_pixbuf("combo/left_press.png")),
         (app_theme.get_pixbuf("combo/list_normal.png"),
          app_theme.get_pixbuf("combo/list_normal.png"),
          app_theme.get_pixbuf("combo/list_press.png")
          ), 0, self.set_index, self.get_index)
     
     Tooltip.text(self.list_button, _("List view"))
     
     # draw left_button.
     self.left_button = gtk.Button()
     self.left_button = ComboItem(
         (app_theme.get_pixbuf("combo/left_normal.png"),
          app_theme.get_pixbuf("combo/left_hover.png"),
          app_theme.get_pixbuf("combo/left_press.png")),
         (app_theme.get_pixbuf("combo/artist_normal.png"),
          app_theme.get_pixbuf("combo/artist_normal.png"),
          app_theme.get_pixbuf("combo/artist_press.png")
          ), 1, self.set_index, self.get_index)
     Tooltip.custom(self.left_button, self.get_msg_label).always_update(self.left_button, True)
     
     # draw right_button.
     self.right_button = ComboButton( 
         (app_theme.get_pixbuf("combo/right_normal.png"),
          app_theme.get_pixbuf("combo/right_hover.png"),
          app_theme.get_pixbuf("combo/right_hover.png")),
         (app_theme.get_pixbuf("combo/triangle_normal.png"),
          app_theme.get_pixbuf("combo/triangle_normal.png"),
          app_theme.get_pixbuf("combo/triangle_press.png")
          ))
     
     # signals.
     self.left_button.connect("clicked", lambda w: self.emit_combo_signal())
     self.right_button.connect("button-press-event", self.show_right_menu)
     self.list_button.connect("clicked", lambda w: self.emit_list_signal())
     
     # pack
     combo_box = gtk.HBox()
     combo_box.pack_start(self.left_button)
     combo_box.pack_start(self.right_button)
     self.pack_start(self.list_button)
     self.pack_start(combo_box)
Esempio n. 15
0
    def __init__(self, init_index=0):
        super(ComboMenuButton, self).__init__()
        self.current_index = init_index
        self.current_status = "artist"
        self.set_spacing(0)
        self.msg_content = _("By Artist")

        self.list_button = ComboItem(
            (app_theme.get_pixbuf("combo/left_normal.png"),
             app_theme.get_pixbuf("combo/left_hover.png"),
             app_theme.get_pixbuf("combo/left_press.png")),
            (app_theme.get_pixbuf("combo/list_normal.png"),
             app_theme.get_pixbuf("combo/list_normal.png"),
             app_theme.get_pixbuf("combo/list_press.png")), 0, self.set_index,
            self.get_index)

        Tooltip.text(self.list_button, _("List view"))

        # draw left_button.
        self.left_button = gtk.Button()
        self.left_button = ComboItem(
            (app_theme.get_pixbuf("combo/left_normal.png"),
             app_theme.get_pixbuf("combo/left_hover.png"),
             app_theme.get_pixbuf("combo/left_press.png")),
            (app_theme.get_pixbuf("combo/artist_normal.png"),
             app_theme.get_pixbuf("combo/artist_normal.png"),
             app_theme.get_pixbuf("combo/artist_press.png")), 1,
            self.set_index, self.get_index)
        Tooltip.custom(self.left_button, self.get_msg_label).always_update(
            self.left_button, True)

        # draw right_button.
        self.right_button = ComboButton(
            (app_theme.get_pixbuf("combo/right_normal.png"),
             app_theme.get_pixbuf("combo/right_hover.png"),
             app_theme.get_pixbuf("combo/right_hover.png")),
            (app_theme.get_pixbuf("combo/triangle_normal.png"),
             app_theme.get_pixbuf("combo/triangle_normal.png"),
             app_theme.get_pixbuf("combo/triangle_press.png")))

        # signals.
        self.left_button.connect("clicked", lambda w: self.emit_combo_signal())
        self.right_button.connect("button-press-event", self.show_right_menu)
        self.list_button.connect("clicked", lambda w: self.emit_list_signal())

        # pack
        combo_box = gtk.HBox()
        combo_box.pack_start(self.left_button)
        combo_box.pack_start(self.right_button)
        self.pack_start(self.list_button)
        self.pack_start(combo_box)
 def __create_single_toggle_button(self, normal_name, callback, tip_msg=None):
     toggle_button = ToggleButton(
         app_theme.get_pixbuf("lyric/%s_normal.png" % normal_name),
         app_theme.get_pixbuf("lyric/%s_press.png" % normal_name),            
         app_theme.get_pixbuf("lyric/%s_hover.png" % normal_name),
         )
     toggle_button.connect("toggled", callback)
     toggle_align = gtk.Alignment()
     toggle_align.set(0.5, 0.5, 0, 0)
     toggle_align.add(toggle_button)
     
     if tip_msg:
         Tooltip.text(toggle_button, tip_msg)
     return toggle_align, toggle_button
def create_button(name, callback=None, tip_msg=None, parent=None, no_hover=False):        
    hover = "press" if no_hover else "hover"
    button = ImageButton(
        app_theme.get_pixbuf("%s_normal.png" % name),
        app_theme.get_pixbuf("%s_%s.png" % (name, hover)),
        app_theme.get_pixbuf("%s_press.png" % name),
        )
    if callback:
        button.connect("button-press-event", callback)
    if tip_msg:
        Tooltip.text(button, tip_msg)
        
    if parent:    
        parent.pack_start(button, False, False)
    return button
def create_toggle_button(name, callback=None, tip_msg=None, parent=False):        
    toggle_button = ToggleButton(
        app_theme.get_pixbuf("%s_normal.png" % name),
        app_theme.get_pixbuf("%s_press.png" % name),
        )
    
    if callback:
        toggle_button.connect("toggled", callback)
        
    if tip_msg:
        Tooltip.text(toggle_button, tip_msg)
        
    if parent:    
        parent.pack_start(toggle_button, False, False)
    return toggle_button
Esempio n. 19
0
def create_toggle_button(name, callback=None, tip_msg=None, parent=False):
    toggle_button = ToggleButton(
        app_theme.get_pixbuf("%s_normal.png" % name),
        app_theme.get_pixbuf("%s_press.png" % name),
    )

    if callback:
        toggle_button.connect("toggled", callback)

    if tip_msg:
        Tooltip.text(toggle_button, tip_msg)

    if parent:
        parent.pack_start(toggle_button, False, False)
    return toggle_button
 def __create_simple_button(self, name, callback, tip_msg=None, has_event=False):    
     button = ImageButton(
         app_theme.get_pixbuf("lyric/%s_normal.png" % name),
         app_theme.get_pixbuf("lyric/%s_hover.png" % name),
         app_theme.get_pixbuf("lyric/%s_press.png" % name)
         )
     if has_event:
         button.connect("button-press-event", callback)
     else:    
         button.connect("clicked", callback)
         
     if tip_msg:    
         Tooltip.text(button, tip_msg)
         
     button_align = gtk.Alignment()
     button_align.set(0.5, 0.5, 0, 0)
     button_align.add(button)
     return button_align
Esempio n. 21
0
def create_button(name,
                  callback=None,
                  tip_msg=None,
                  parent=None,
                  no_hover=False):
    hover = "press" if no_hover else "hover"
    button = ImageButton(
        app_theme.get_pixbuf("%s_normal.png" % name),
        app_theme.get_pixbuf("%s_%s.png" % (name, hover)),
        app_theme.get_pixbuf("%s_press.png" % name),
    )
    if callback:
        button.connect("button-press-event", callback)
    if tip_msg:
        Tooltip.text(button, tip_msg)

    if parent:
        parent.pack_start(button, False, False)
    return button
Esempio n. 22
0
    def __create_simple_button(self,
                               name,
                               callback,
                               tip_msg=None,
                               has_event=False):
        button = ImageButton(
            app_theme.get_pixbuf("lyric/%s_normal.png" % name),
            app_theme.get_pixbuf("lyric/%s_hover.png" % name),
            app_theme.get_pixbuf("lyric/%s_press.png" % name))
        if has_event:
            button.connect("button-press-event", callback)
        else:
            button.connect("clicked", callback)

        if tip_msg:
            Tooltip.text(button, tip_msg)

        button_align = gtk.Alignment()
        button_align.set(0.5, 0.5, 0, 0)
        button_align.add(button)
        return button_align
Esempio n. 23
0
    def __init__(self,
                 element,
                 index,
                 font_size,
                 item_height,
                 padding_left,
                 padding_middle,
                 padding_right,
                 set_index,
                 get_index,
                 x_align=ALIGN_START):

        # Init.
        super(SimpleItem, self).__init__()
        self.font_size = font_size
        self.index = index
        self.set_index = set_index
        self.get_index = get_index
        self.padding_left = padding_left
        self.padding_right = padding_right
        self.font_offset = padding_middle
        self.args = None
        if len(element) == 4:
            self.normal_dpixbuf, self.press_dpixbuf, self.content, self.clicked_callback = element
        else:
            self.normal_dpixbuf, self.press_dpixbuf, self.content, self.clicked_callback = element[:
                                                                                                   4]
            self.args = element[4:]

        pixbuf_width = self.normal_dpixbuf.get_pixbuf().get_width()
        if self.content:
            Tooltip.text(self, self.content)
        self.font_offset += pixbuf_width
        self.x_align = x_align

        self.set_size_request(150, item_height)
        self.connect("expose-event", self.expose_simple_item)
        self.connect("clicked", lambda w: self.wrap_item_clicked_action())
Esempio n. 24
0
    def __init__(self):
        '''Init.'''
        gtk.VBox.__init__(self)

        # Init catagory list.
        self.category_list = CategoryView()
        setattr(self.category_list, "save_to_library", self.save_to_library)
        self.category_list.draw_mask = self.draw_category_list_mask
        self.category_list.connect("single-click-item", self.on_category_single_click)
        self.category_list.connect("right-press-items", self.on_category_right_press)
        self.category_list.set_size_request(CATEGROYLIST_WIDTH, -1)

        del self.category_list.keymap["Delete"]

        # Init SearchEntry.
        self.entry_box = SearchEntry("")
        self.entry_box.entry.connect("changed", self.search_cb)
        self.entry_box.set_no_show_all(True)
        entry_align = gtk.Alignment()
        entry_align.set(0, 0, 1, 1)
        entry_align.set_padding(2, 0, 10, 10)
        entry_align.add(self.entry_box)
        entry_align.connect("expose-event", self.expose_entry_mask)

        # Init toolbar.
        self.toolbar_box = gtk.HBox(spacing=45)
        self.search_button = self.__create_simple_toggle_button("search", self.show_text_entry,
                                                                _("Search in Current Playlist"))

        self.__create_simple_button("list", self.popup_list_menu, _("Playlist Operations"))
        self.__create_simple_button("add", self.popup_add_menu, _("Add"))

        self.playmode_button = PlaymodeButton(config.get("setting", "loop_mode", "list_mode").split("_")[0])
        Tooltip.text(self.playmode_button, _("Playback mode"))
        self.playmode_button.connect("button-press-event", self.popup_sort_menu)
        self.toolbar_box.pack_start(self.playmode_button, False, False)
        self.__create_simple_button("delete", self.popup_delete_menu, _("Delete"))
        toolbar_align = gtk.Alignment()
        toolbar_align.set_padding(6, 6, 28, 0)
        toolbar_align.add(self.toolbar_box)
        toolbar_align.connect("expose-event", self.expose_toolbar_mask)

        self.right_box = gtk.VBox()
        self.right_box.connect("size-allocate", self.on_right_box_size_allocate)
        self.list_paned = HPaned(handle_color=app_theme.get_color("panedHandler"), enable_drag=True)
        self.list_paned.pack1(self.category_list, True, True)
        self.list_paned.pack2(self.right_box, True, False)
        bottom_box = gtk.VBox()
        bottom_box.set_size_request(-1, 22)
        self.pack_start(self.list_paned, True, True)
        self.pack_start(entry_align, False, False)
        self.pack_start(toolbar_align, False, True)

        # Current
        self.current_playlist = None
        self.search_time_source = 0
        self.current_item = None
        self.search_flag = False
        self.cache_items = None
        self.delete_source_id = None
        self.drag_source_id = None
        self.menu_source_id = None
        self.song_notify_id = None
        self.detail_menu = None
        self.save_flag = False

        if MediaDB.isloaded():
            self.__on_db_loaded(MediaDB)
        else:
            MediaDB.connect("loaded", self.__on_db_loaded)

        Player.connect("loaded", self.__on_player_loaded)
        Dispatcher.connect("play-song", self.__play_and_add)
        Dispatcher.connect("add-songs", self.__add_songs_to_list)
        Dispatcher.connect("new-cd-playlist", self.__new_audiocd_playlist)
        Dispatcher.connect("del-cd-playlist", self.delete_audiocd_list)
        Dispatcher.connect("save-current-list", self.save_current_playlist)
        config.connect("config-changed", self.on_config_changed)
Esempio n. 25
0
    def __init__(self):
        '''Init.'''
        gtk.VBox.__init__(self)

        # Init catagory list.
        self.category_list = CategoryView()
        setattr(self.category_list, "save_to_library", self.save_to_library)        
        self.category_list.draw_mask = self.draw_category_list_mask
        self.category_list.connect("single-click-item", self.on_category_single_click)
        self.category_list.connect("right-press-items", self.on_category_right_press)
        self.category_list.set_size_request(CATEGROYLIST_WIDTH, -1)

        del self.category_list.keymap["Delete"]
        
        # Init SearchEntry.
        self.entry_box = SearchEntry("")
        self.entry_box.entry.connect("changed", self.search_cb)
        self.entry_box.set_no_show_all(True)
        entry_align = gtk.Alignment()
        entry_align.set(0, 0, 1, 1)
        entry_align.set_padding(2, 0, 10, 10)
        entry_align.add(self.entry_box)
        entry_align.connect("expose-event", self.expose_entry_mask)
        
        # Init toolbar.
        self.toolbar_box = gtk.HBox(spacing=45)
        self.search_button = self.__create_simple_toggle_button("search", self.show_text_entry, 
                                                                _("Search in Current Playlist"))
        
        self.__create_simple_button("list", self.popup_list_menu, _("Playlist Operations"))
        self.__create_simple_button("add", self.popup_add_menu, _("Add"))
        
        self.playmode_button = PlaymodeButton(config.get("setting", "loop_mode", "list_mode").split("_")[0])
        Tooltip.text(self.playmode_button, _("Playback Order"))
        self.playmode_button.connect("button-press-event", self.popup_sort_menu)
        self.toolbar_box.pack_start(self.playmode_button, False, False)
        self.__create_simple_button("delete", self.popup_delete_menu, _("Delete"))
        toolbar_align = gtk.Alignment()
        toolbar_align.set_padding(6, 6, 28, 0)
        toolbar_align.add(self.toolbar_box)
        toolbar_align.connect("expose-event", self.expose_toolbar_mask)
                
        self.right_box = gtk.VBox()
        self.right_box.connect("size-allocate", self.on_right_box_size_allocate)
        self.list_paned = HPaned(handle_color=app_theme.get_color("panedHandler"), enable_drag=True)
        self.list_paned.pack1(self.category_list, True, True)
        self.list_paned.pack2(self.right_box, True, False)
        bottom_box = gtk.VBox()
        bottom_box.set_size_request(-1, 22)
        self.pack_start(self.list_paned, True, True)            
        self.pack_start(entry_align, False, False)            
        self.pack_start(toolbar_align, False, True)            
        
        # Current
        self.current_playlist = None
        self.search_time_source = 0        
        self.current_item = None
        self.search_flag = False
        self.cache_items = None
        self.delete_source_id = None
        self.drag_source_id = None
        self.menu_source_id = None
        self.song_notify_id = None
        self.detail_menu = None
        self.save_flag = False
        
        if MediaDB.isloaded():
            self.__on_db_loaded(MediaDB)
        else:    
            MediaDB.connect("loaded", self.__on_db_loaded)
            
        Player.connect("loaded", self.__on_player_loaded)    
        Dispatcher.connect("play-song", self.__play_and_add)
        Dispatcher.connect("add-songs", self.__add_songs_to_list)
        Dispatcher.connect("new-cd-playlist", self.__new_audiocd_playlist)
        Dispatcher.connect("del-cd-playlist", self.delete_audiocd_list)
        Dispatcher.connect("save-current-list", self.save_current_playlist)
        config.connect("config-changed", self.on_config_changed)
Esempio n. 26
0
    def __init__(
        self,
        button_mask=["theme", "menu", "max", "min", "close"],
        icon_path=None,
        app_name=None,
        title=None,
        add_separator=False,
        height=26,
        show_title=True,
        enable_gaussian=True,
        name_size=DEFAULT_FONT_SIZE,
        title_size=DEFAULT_FONT_SIZE,
    ):
        # Init.
        EventBox.__init__(self)
        self.set_size_request(-1, height)
        self.v_layout_box = gtk.VBox()
        self.h_layout_box = gtk.HBox()
        self.add(self.v_layout_box)
        self.v_layout_box.pack_start(self.h_layout_box, True, True)

        # Init separator.
        if add_separator:
            self.separator = gtk.HBox()
            self.separator.set_size_request(-1, 1)
            self.separator.connect("expose-event",
                                   self.expose_titlebar_separator)
            self.v_layout_box.pack_start(self.separator, True, True)

        # Add drag event box.
        self.drag_box = EventBox()
        self.h_layout_box.pack_start(self.drag_box, True, True)

        # Init left box to contain icon and title.
        self.left_box = gtk.HBox()
        self.drag_box.add(self.left_box)

        if show_title:
            # Add icon.
            if icon_path != None:
                self.icon_image_box = gtk.image_new_from_pixbuf(
                    gtk.gdk.pixbuf_new_from_file(icon_path))
                self.icon_align = gtk.Alignment()
                self.icon_align.set(0.5, 0.5, 0.0, 0.0)
                self.icon_align.set_padding(5, 5, 5, 0)
                self.icon_align.add(self.icon_image_box)
                self.left_box.pack_start(self.icon_align, False, False)

            # Add app name.
            if app_name == None:
                app_name_label = ""
            else:
                app_name_label = app_name
            self.app_name_box = Label(app_name_label,
                                      enable_gaussian=enable_gaussian,
                                      text_size=name_size)
            self.app_name_align = gtk.Alignment()
            self.app_name_align.set(0.5, 0.5, 0.0, 0.0)
            self.app_name_align.set_padding(2, 0, 5, 0)
            self.app_name_align.add(self.app_name_box)
            self.left_box.pack_start(self.app_name_align, False, False)

            # Add title.
            if title == None:
                title_label = ""
            else:
                title_label = title
            self.title_box = Label(
                title_label,
                enable_gaussian=enable_gaussian,
                text_x_align=pango.ALIGN_CENTER,
                text_size=title_size,
            )
            self.title_align = gtk.Alignment()
            self.title_align.set(0.5, 0.5, 0.0, 0.0)
            self.title_align.set_padding(2, 0, 30, 30)
            self.title_align.add(self.title_box)
            self.left_box.pack_start(self.title_align, True, True)

        # Add button box.
        self.button_box = gtk.HBox()
        self.button_align = gtk.Alignment()
        self.button_align.set(1.0, 0.0, 0.0, 0.0)
        self.button_align.set_padding(0, 0, 0, 0)
        self.button_align.add(self.button_box)
        self.right_box = gtk.VBox()
        self.right_box.pack_start(self.button_align, False, False)
        self.h_layout_box.pack_start(self.right_box, False, False)

        # Add buttons.
        for mask in button_mask:
            setattr(self, titlebar_button_dict[mask][0],
                    titlebar_button_dict[mask][1]())
            button = getattr(self, titlebar_button_dict[mask][0])
            self.button_box.pack_start(button, False, False)
            Tooltip.text(button, titlebar_button_dict[mask][2]).show_delay(
                button, 2000)

        # Show.
        self.show_all()
Esempio n. 27
0
 def show_tooltip(self, widget, event, text):
     '''Create help tooltip.'''
     Tooltip.text(widget, text)
Esempio n. 28
0
    def __init__(self):
        super(FullHeaderBar, self).__init__()
        self.set_visible_window(False)
        
        # init.
        self.cover_box = PlayerCoverButton()
        self.cover_box.show_all()
        
        # Main table
        main_table = gtk.Table(2, 3)
        # swap played status handler
        Player.connect("played", self.__swap_play_status, True)
        Player.connect("paused", self.__swap_play_status, False)
        Player.connect("stopped", self.__swap_play_status, False)
        Player.connect("play-end", self.__swap_play_status, False)
        
        # play button
        play_normal_pixbuf = app_theme.get_pixbuf("action/play_large_normal.png")
        pause_normal_pixbuf = app_theme.get_pixbuf("action/pause_large_normal.png")
        play_hover_pixbuf = app_theme.get_pixbuf("action/play_large_hover.png")
        pause_hover_pixbuf = app_theme.get_pixbuf("action/pause_large_hover.png")
        play_press_pixbuf = app_theme.get_pixbuf("action/play_large_press.png")
        pause_press_pixbuf = app_theme.get_pixbuf("action/pause_large_press.png")
       
        self.__play = ToggleButton(play_normal_pixbuf, pause_normal_pixbuf,
                                   play_hover_pixbuf, pause_hover_pixbuf,
                                   play_press_pixbuf, pause_press_pixbuf,
                                   )
        Tooltip.text(self.__play, _("Play/Pause"))
        
        self.__play.show_all()

        self.__id_signal_play = self.__play.connect("toggled", lambda w: Player.playpause())
        
        prev_button = self.__create_button("previous_large", _("Previous track"))
        next_button = self.__create_button("next_large", _("Next track"))
        
        self.vol = VolumeSlider()
        song_timer = SongTimer()
        
        mainbtn = gtk.HBox(spacing=3)
        prev_align = gtk.Alignment()
        prev_align.set(0.5, 0.5, 0, 0)
        prev_align.add(prev_button)
        
        next_align = gtk.Alignment()
        next_align.set(0.5, 0.5, 0, 0)
        next_align.add(next_button)
        
        # button group.
        mainbtn.pack_start(prev_align, False, False)
        mainbtn.pack_start(self.__play, False, False)
        mainbtn.pack_start(next_align, False, False)
         
        mainbtn_align = gtk.Alignment()
        mainbtn_align.set_padding(10, 0, 0, 0)
        mainbtn_align.add(mainbtn)
        
        mainbtn_box = gtk.HBox()
        mainbtn_box.pack_start(mainbtn_align, False, False)
        mainbtn_box.pack_start(create_left_align(), True, True)
        
        # time box.
        self.lyrics_button = self.__create_simple_toggle_button("lyrics", self.change_lyrics_status)        
        Tooltip.text(self.lyrics_button, _("Lyrics on/off"))
        
        plug_box = gtk.HBox(spacing=12)       
        lyrics_button_align = gtk.Alignment()
        lyrics_button_align.set_padding(1, 0, 0, 0)
        lyrics_button_align.add(self.lyrics_button)
        plug_box.pack_start(lyrics_button_align, False, False)
        vol_align = gtk.Alignment()
        vol_align.set_padding(2, 0, 0, 0)
        vol_align.add(self.vol)
        plug_box.pack_start(vol_align, False, False)        
        
        timer_align = gtk.Alignment()
        timer_align.set(0, 0, 0, 1)
        timer_box = gtk.HBox()
        timer_box.pack_start(timer_align, True, True)
        timer_box.pack_start(song_timer.get_label(), False, False)
        
        main_table.attach(PlayInfo(), 0, 1, 0, 1, xoptions=gtk.FILL)
        main_table.attach(plug_box, 0, 1, 1, 2, xoptions=gtk.FILL)
        main_table.attach(mainbtn_box, 1, 2, 0, 2, xoptions=gtk.FILL, xpadding=25)
        main_table.attach(timer_box, 2, 3, 1, 2, xpadding=17)
        
        cover_main_box = gtk.HBox(spacing=5)
        cover_main_box.pack_start(self.cover_box, False, False)
        cover_main_box.pack_start(main_table, True, True)
        cover_main_align = gtk.Alignment()
        cover_main_align.set_padding(5, 0, 12, 5)
        cover_main_align.set(1, 1, 1, 1)
        cover_main_align.add(cover_main_box)
        
        main_box = gtk.VBox(spacing=9)
        main_box.pack_start(cover_main_align, True, True)
        main_box.pack_start(ProgressBox(song_timer), True, True)
        
        self.add(main_box)
        
        # right click
        self.connect("button-press-event", self.right_click_cb)
        # foreach_recursive(self, lambda w: w.connect("button-press-event", self.right_click_cb))
        Dispatcher.connect("close-lyrics", lambda w : self.lyrics_button.set_active(False))
        Dispatcher.connect("show-lyrics", lambda w: self.lyrics_button.set_active(True))
 
        self.signal_auto = False        
        if config.getboolean("lyrics", "status"):
            self.lyrics_button.set_active(True)
        self.signal_auto = True    
Esempio n. 29
0
    def __init__(self):
        gtk.EventBox.__init__(self)
        self.set_visible_window(False)

        # init.
        self.cover_box = PlayerCoverButton()
        self.cover_box.show_all()

        # play button
        play_normal_pixbuf = app_theme.get_pixbuf("action/play_normal.png")
        pause_normal_pixbuf = app_theme.get_pixbuf("action/pause_normal.png")
        play_hover_pixbuf = app_theme.get_pixbuf("action/play_hover.png")
        pause_hover_pixbuf = app_theme.get_pixbuf("action/pause_hover.png")
        play_press_pixbuf = app_theme.get_pixbuf("action/play_press.png")
        pause_press_pixbuf = app_theme.get_pixbuf("action/pause_press.png")

        self.__play = ToggleButton(
            play_normal_pixbuf,
            pause_normal_pixbuf,
            play_hover_pixbuf,
            pause_hover_pixbuf,
            play_press_pixbuf,
            pause_press_pixbuf,
        )
        Tooltip.text(self.__play, _("Play/Pause"))
        # swap played status handler
        Player.connect("played", self.__swap_play_status, True)
        Player.connect("paused", self.__swap_play_status, False)
        Player.connect("stopped", self.__swap_play_status, False)
        Player.connect("play-end", self.__swap_play_status, False)

        self.__id_signal_play = self.__play.connect("toggled",
                                                    self.on_player_playpause)
        prev_button = self.__create_button("previous", _("Previous"))
        next_button = self.__create_button("next", _("Next"))

        # lyrics button
        self.lyrics_button = self.__create_simple_toggle_button(
            "lyrics", self.change_lyrics_status)
        Tooltip.text(self.lyrics_button, _("Show/Hide Lyrics"))

        lyrics_button_align = gtk.Alignment()
        lyrics_button_align.set_padding(0, 0, 0, 10)
        lyrics_button_align.set(0.5, 0.5, 0, 0)
        lyrics_button_align.add(self.lyrics_button)

        volume_button_align = gtk.Alignment()
        volume_button_align.set_padding(0, 0, 10, 0)
        volume_button_align.set(0.5, 0.5, 0, 0)
        self.volume_slider = VolumeSlider()
        volume_button_align.add(self.volume_slider)
        # volume_button_align.add(VolumeButton())

        # action_box
        action_box = gtk.HBox()
        action_box.pack_start(lyrics_button_align, False, False)
        action_box.pack_start(set_widget_vcenter(prev_button), False, False)
        action_box.pack_start(set_widget_vcenter(self.__play), False, False)
        action_box.pack_start(set_widget_vcenter(next_button), False, False)
        action_box.pack_start(volume_button_align, False, False)

        # combo_box
        playinfo_align = gtk.Alignment()
        playinfo_align.set_padding(0, 0, 12, 0)
        playinfo_align.add(PlayInfo(200))

        self.action_box_align = gtk.Alignment()
        self.action_box_align.set_padding(6, 0, 6, 0)
        self.action_box_align.add(action_box)
        self.action_box_align.connect("expose-event", self.on_expose_event)

        self.timer_label = "00:00"
        self.song_timer = SongTimer(self.draw_timer_label)

        combo_vbox = gtk.VBox(spacing=5)
        combo_vbox.pack_start(playinfo_align, False, False)
        combo_vbox.pack_start(self.action_box_align, False, False)

        cover_box_align = gtk.Alignment()
        cover_box_align.set_padding(0, 0, 10, 0)
        cover_box_align.add(self.cover_box)

        cover_main_box = gtk.HBox()
        cover_main_box.pack_start(cover_box_align, False, False)
        cover_main_box.pack_start(combo_vbox, False, False)

        body_vbox = gtk.VBox(spacing=6)
        body_vbox.pack_start(cover_main_box, False, True)
        body_vbox.pack_start(self.song_timer, False, True)
        # progressbar_align = gtk.Alignment()
        # progressbar_align.add(ProgressBar())
        # progressbar_align.set(1, 1, 1, 1)
        # progressbar_align.set_padding(0, 0, 2, 2)
        # body_vbox.pack_start(progressbar_align, False, True)

        self.add(body_vbox)

        # right click
        self.connect("button-press-event", self.right_click_cb)
        Dispatcher.connect("close-lyrics",
                           lambda w: self.lyrics_button.set_active(False))
        Dispatcher.connect("show-lyrics",
                           lambda w: self.lyrics_button.set_active(True))

        self.signal_auto = False
        if config.getboolean("lyrics", "status"):
            self.lyrics_button.set_active(True)
        self.signal_auto = True
Esempio n. 30
0
def tooltip_text(widget, text):
    Tooltip.text(widget, text)
Esempio n. 31
0
    def __init__(self, 
                 button_mask=["theme", "menu", "max", "min", "close"],
                 icon_path=None,
                 app_name=None,
                 title=None,
                 add_separator=False,
                 height=26,
                 show_title=True,
                 enable_gaussian=True,
                 name_size=DEFAULT_FONT_SIZE,
                 title_size=DEFAULT_FONT_SIZE,
                 ):
        # Init.
        EventBox.__init__(self)
        self.set_size_request(-1, height)
        self.v_layout_box = gtk.VBox()
        self.h_layout_box = gtk.HBox()
        self.add(self.v_layout_box)
        self.v_layout_box.pack_start(self.h_layout_box, True, True)
        
        # Init separator.
        if add_separator:
            self.separator = gtk.HBox()
            self.separator.set_size_request(-1, 1)
            self.separator.connect("expose-event", self.expose_titlebar_separator)
            self.v_layout_box.pack_start(self.separator, True, True)
        
        # Add drag event box.
        self.drag_box = EventBox()
        self.h_layout_box.pack_start(self.drag_box, True, True)
        
        # Init left box to contain icon and title.
        self.left_box = gtk.HBox()
        self.drag_box.add(self.left_box)
        
        if show_title:
            # Add icon.
            if icon_path != None:
                self.icon_image_box = gtk.image_new_from_pixbuf(gtk.gdk.pixbuf_new_from_file(icon_path))
                self.icon_align = gtk.Alignment()
                self.icon_align.set(0.5, 0.5, 0.0, 0.0)
                self.icon_align.set_padding(5, 5, 5, 0)
                self.icon_align.add(self.icon_image_box)
                self.left_box.pack_start(self.icon_align, False, False)
                        
            # Add app name.
            if app_name == None:
                app_name_label = ""
            else:
                app_name_label = app_name
            self.app_name_box = Label(app_name_label, enable_gaussian=enable_gaussian, text_size=name_size)
            self.app_name_align = gtk.Alignment()
            self.app_name_align.set(0.5, 0.5, 0.0, 0.0)
            self.app_name_align.set_padding(2, 0, 5, 0)
            self.app_name_align.add(self.app_name_box)
            self.left_box.pack_start(self.app_name_align, False, False)
            
            # Add title.
            if title == None:
                title_label = ""
            else:
                title_label = title
            self.title_box = Label(
                title_label, enable_gaussian=enable_gaussian, 
                text_x_align=pango.ALIGN_CENTER,
                text_size=title_size,
                )
            self.title_align = gtk.Alignment()
            self.title_align.set(0.5, 0.5, 0.0, 0.0)
            self.title_align.set_padding(2, 0, 30, 30)
            self.title_align.add(self.title_box)
            self.left_box.pack_start(self.title_align, True, True)
            
        # Add button box.
        self.button_box = gtk.HBox()
        self.button_align = gtk.Alignment()
        self.button_align.set(1.0, 0.0, 0.0, 0.0)
        self.button_align.set_padding(0, 0, 0, 0)
        self.button_align.add(self.button_box)
        self.right_box = gtk.VBox()
        self.right_box.pack_start(self.button_align, False, False)
        self.h_layout_box.pack_start(self.right_box, False, False)
        
        # Add buttons.
        for mask in button_mask:
            setattr(self, titlebar_button_dict[mask][0], titlebar_button_dict[mask][1]())
            button = getattr(self, titlebar_button_dict[mask][0])
            self.button_box.pack_start(button, False, False)
            Tooltip.text(button, titlebar_button_dict[mask][2]).show_delay(button, 2000)

        # Show.
        self.show_all()
Esempio n. 32
0
 def _show_tooltip(self, widget, event, text):
     '''the button enter-notify-event callback. Create help tooltip.'''
     #widget.set_has_tooltip(True)
     #widget.set_tooltip_text(text)
     #widget.trigger_tooltip_query()
     Tooltip.text(widget, text)
 def on_folders_view_motion_notify(self, widget, item, x, y):
     Tooltip.text(widget, item.value_name)
 def __on_text(self, name, obj, argv):
     disable(self, False)
     text(self, argv)
Esempio n. 35
0
 def _show_tooltip(self, widget, event, text):
     '''the button enter-notify-event callback. Create help tooltip.'''
     #widget.set_has_tooltip(True)
     #widget.set_tooltip_text(text)
     #widget.trigger_tooltip_query()
     Tooltip.text(widget, text)
    def __init__(self):
        gtk.EventBox.__init__(self)
        self.set_visible_window(False)
        
        # init.
        self.cover_box = PlayerCoverButton()
        self.cover_box.show_all()
        
        
        # play button
        play_normal_pixbuf = app_theme.get_pixbuf("action/play_normal.png")
        pause_normal_pixbuf = app_theme.get_pixbuf("action/pause_normal.png")
        play_hover_pixbuf = app_theme.get_pixbuf("action/play_hover.png")
        pause_hover_pixbuf = app_theme.get_pixbuf("action/pause_hover.png")
        play_press_pixbuf = app_theme.get_pixbuf("action/play_press.png")
        pause_press_pixbuf = app_theme.get_pixbuf("action/pause_press.png")
       
        self.__play = ToggleButton(play_normal_pixbuf, pause_normal_pixbuf,
                                   play_hover_pixbuf, pause_hover_pixbuf,
                                   play_press_pixbuf, pause_press_pixbuf,
                                   )
        Tooltip.text(self.__play, _("Play/Pause"))
        # swap played status handler
        Player.connect("played", self.__swap_play_status, True)
        Player.connect("paused", self.__swap_play_status, False)
        Player.connect("stopped", self.__swap_play_status, False)
        Player.connect("play-end", self.__swap_play_status, False)
        
        self.__id_signal_play = self.__play.connect("toggled", self.on_player_playpause)
        prev_button = self.__create_button("previous", _("Previous"))
        next_button = self.__create_button("next", _("Next"))
        
        
        # lyrics button
        self.lyrics_button = self.__create_simple_toggle_button("lyrics", self.change_lyrics_status)        
        Tooltip.text(self.lyrics_button, _("Show/Hide Lyrics"))
        
        
        lyrics_button_align = gtk.Alignment()
        lyrics_button_align.set_padding(0, 0, 0, 10)
        lyrics_button_align.set(0.5, 0.5, 0, 0)
        lyrics_button_align.add(self.lyrics_button)
        
        volume_button_align = gtk.Alignment()
        volume_button_align.set_padding(0, 0, 10, 0)
        volume_button_align.set(0.5, 0.5, 0, 0)
        self.volume_slider = VolumeSlider()
        volume_button_align.add(self.volume_slider)
        # volume_button_align.add(VolumeButton())
        
        # action_box
        action_box = gtk.HBox()
        action_box.pack_start(lyrics_button_align, False, False)
        action_box.pack_start(set_widget_vcenter(prev_button), False, False)
        action_box.pack_start(set_widget_vcenter(self.__play), False, False)
        action_box.pack_start(set_widget_vcenter(next_button), False, False)
        action_box.pack_start(volume_button_align, False, False)
         
        # combo_box
        playinfo_align = gtk.Alignment()
        playinfo_align.set_padding(0, 0, 12, 0)
        playinfo_align.add(PlayInfo(200))
        
        self.action_box_align = gtk.Alignment()
        self.action_box_align.set_padding(6, 0, 6, 0)
        self.action_box_align.add(action_box)
        self.action_box_align.connect("expose-event", self.on_expose_event)
        
        self.timer_label = "00:00"
        self.song_timer = SongTimer(self.draw_timer_label)
        
        combo_vbox = gtk.VBox(spacing=5)
        combo_vbox.pack_start(playinfo_align, False, False)
        combo_vbox.pack_start(self.action_box_align, False, False)
        
        cover_box_align = gtk.Alignment()
        cover_box_align.set_padding(0, 0, 10, 0)
        cover_box_align.add(self.cover_box)
        
        cover_main_box = gtk.HBox()
        cover_main_box.pack_start(cover_box_align, False, False)
        cover_main_box.pack_start(combo_vbox, False, False)
        
        body_vbox = gtk.VBox(spacing=6)
        body_vbox.pack_start(cover_main_box, False, True)
        body_vbox.pack_start(self.song_timer, False, True)
        # progressbar_align = gtk.Alignment()
        # progressbar_align.add(ProgressBar())
        # progressbar_align.set(1, 1, 1, 1)
        # progressbar_align.set_padding(0, 0, 2, 2)
        # body_vbox.pack_start(progressbar_align, False, True)
        
        
        
        self.add(body_vbox)

        # right click
        self.connect("button-press-event", self.right_click_cb)
        Dispatcher.connect("close-lyrics", lambda w : self.lyrics_button.set_active(False))
        Dispatcher.connect("show-lyrics", lambda w: self.lyrics_button.set_active(True))
 
        self.signal_auto = False        
        if config.getboolean("lyrics", "status"):
            self.lyrics_button.set_active(True)
        self.signal_auto = True    
Esempio n. 37
0
def tooltip_text(widget, text):
    Tooltip.text(widget, text)
Esempio n. 38
0
 def show_tooltip(self, widget, event, text):
     '''Create help tooltip.'''
     #widget.set_has_tooltip(True)
     #widget.set_tooltip_text(text)
     #widget.trigger_tooltip_query()
     Tooltip.text(widget, text)
 def __on_text(self, name, obj, argv):
     disable(self, False)
     text(self, argv)
Esempio n. 40
0
 def on_folders_view_motion_notify(self, widget, item, x, y):
     Tooltip.text(widget, item.value_name)
Esempio n. 41
0
 def set_text(self, text):
     self.prompt_text = text
     Tooltip.text(self, self.prompt_text)
     self.update_size()
Esempio n. 42
0
 def show_tooltip(self, widget, event, text):
     '''Create help tooltip.'''
     Tooltip.text(widget, text)
Esempio n. 43
0
 def show_tooltip(self, widget, event, text):
     '''Create help tooltip.'''
     #widget.set_has_tooltip(True)
     #widget.set_tooltip_text(text)
     #widget.trigger_tooltip_query()
     Tooltip.text(widget, text)