def create_play_box(self):
     main_table = gtk.Table(5, 2)
     main_table.set_row_spacings(CONTENT_ROW_SPACING)
     
     play_title_label = Label(_("Playback settings"))
     play_title_label.set_size_request(350, 12)
     
     fade_check_hbox = gtk.HBox()
     self.fade_check_button = CheckButton(_("Enable crossfade"))        
     fade_check_hbox.pack_start(self.fade_check_button, False, False)
     fade_check_hbox.pack_start(create_right_align(), True, True)
     self.album_check_button = CheckButton(_("Seamless switching between the same album"))
     album_check_hbox = gtk.HBox()
     album_check_hbox.pack_start(self.album_check_button, False, False)
     album_check_hbox.pack_start(create_right_align(), True, True)
     
     fade_label = Label("%s" % _("Crossfade"))
     self.fade_spin = SpinBox(200, 0, 900, 100)
     millisecond_lablel = Label(_(" ms"))        
     millisecond_lablel.set_size_request(50, 12)
     spin_hbox = gtk.HBox(spacing=3)
     spin_hbox.pack_start(fade_label, False, False)
     spin_hbox.pack_start(self.fade_spin, False, False)
     spin_hbox.pack_start(millisecond_lablel, False, False)
     
     main_table.attach(play_title_label, 0, 2, 0, 1, yoptions=gtk.FILL, xpadding=8)
     main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL)
     main_table.attach(fade_check_hbox, 0, 2, 2, 3, yoptions=gtk.FILL)
     main_table.attach(album_check_hbox, 0, 2, 3, 4, yoptions=gtk.FILL)
     main_table.attach(spin_hbox, 0, 1, 4, 5, yoptions=gtk.FILL, xpadding=8)
     return main_table
Exemplo n.º 2
0
    def __init__(self, song=None):
        super(InfoSetting, self).__init__()
        self.song = song
        main_align = gtk.Alignment()
        main_align.set_padding(40, 0, 100, 0)
        main_align.set(0, 0, 0.5, 0.5)
        self.main_table = gtk.Table(6, 3)
        self.main_table.set_col_spacings(10)
        self.main_table.set_row_spacings(10)

        self.title_entry = self.create_combo_entry(0, 1, _("Title"))
        self.artist_entry = self.create_combo_entry(1, 2, _("Artist"))
        self.album_entry = self.create_combo_entry(2, 3, _("Album"))
        self.genre_entry = self.create_combo_entry(3, 4, _("Genre"))
        self.date_entry = self.create_combo_entry(4, 5, _("Date"))

        main_align.add(self.main_table)

        # Update song
        if song:
            self.update_song(song)

        save_button = Button(_("Save"))
        save_button.connect("clicked", self.save_taginfo)
        block_box = gtk.EventBox()
        block_box.set_visible_window(False)
        block_box.set_size_request(90, -1)
        button_box = gtk.HBox()
        button_box.pack_start(create_right_align(), True, True)
        button_box.pack_start(save_button, False, False)
        button_box.pack_start(block_box, False, False)
        self.pack_start(main_align, False, True)
        self.pack_start(button_box, False, False)
Exemplo n.º 3
0
    def create_combo_entry(self,
                           top_attach,
                           bottom_attach,
                           label_text,
                           content_text=""):
        title_label_box = gtk.HBox()
        title_label = Label("%s:" % label_text)
        title_label_box.pack_start(create_right_align(), False, True)
        title_label_box.pack_start(title_label, False, True)

        content_entry = InputEntry(content_text)
        content_entry.set_size(260, 25)
        self.main_table.attach(title_label_box,
                               0,
                               1,
                               top_attach,
                               bottom_attach,
                               xoptions=gtk.FILL)
        self.main_table.attach(content_entry,
                               1,
                               2,
                               top_attach,
                               bottom_attach,
                               xoptions=gtk.FILL)
        return content_entry
Exemplo n.º 4
0
 def create_play_box(self):
     main_table = gtk.Table(4, 2)
     main_table.set_row_spacings(10)
     
     play_title_label = Label(_("Playing"))
     play_title_label.set_size_request(350, 12)
     
     fade_check_hbox = gtk.HBox()
     self.fade_check_button = CheckButton(_("Crossfade"))        
     fade_check_hbox.pack_start(self.fade_check_button, False, False)
     fade_check_hbox.pack_start(create_right_align(), True, True)
     self.album_check_button = CheckButton(_("Crossfade gapless album"))
     
     fade_label = Label(_("Fade timeout:"))
     self.fade_spin = SpinBox(300, 1, 1000, 100)
     millisecond_lablel = Label(_(" ms"))        
     millisecond_lablel.set_size_request(50, 12)
     spin_hbox = gtk.HBox(spacing=3)
     spin_hbox.pack_start(fade_label, False, False)
     spin_hbox.pack_start(self.fade_spin, False, False)
     spin_hbox.pack_start(millisecond_lablel, False, False)
     
     main_table.attach(play_title_label, 0, 2, 0, 1, yoptions=gtk.FILL, xpadding=8)
     main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL)
     main_table.attach(fade_check_hbox, 0, 1, 2, 3, yoptions=gtk.FILL)
     main_table.attach(self.album_check_button, 1, 2, 2, 3, yoptions=gtk.FILL)
     main_table.attach(spin_hbox, 0, 1, 3, 4, yoptions=gtk.FILL, xpadding=8)
     return main_table
Exemplo n.º 5
0
 def __init__(self, song=None):
     super(InfoSetting, self).__init__()
     self.song = song
     main_align = gtk.Alignment()
     main_align.set_padding(40, 0, 100, 0)
     main_align.set(0, 0, 0.5, 0.5)
     self.main_table = gtk.Table(6, 3)
     self.main_table.set_col_spacings(10)
     self.main_table.set_row_spacings(10)
     
     self.title_entry  = self.create_combo_entry(0, 1, _("Title:"))
     self.artist_entry = self.create_combo_entry(1, 2, _("Artist:"))
     self.album_entry  = self.create_combo_entry(2, 3, _("Album:"))
     self.genre_entry  = self.create_combo_entry(3, 4, _("Genre:"))
     self.date_entry   = self.create_combo_entry(4, 5, _("Date:"))
     
     main_align.add(self.main_table)
     
     # Update song
     if song:
         self.update_song(song)
         
     save_button = Button(_("Save"))    
     save_button.connect("clicked", self.save_taginfo)
     block_box = gtk.EventBox()
     block_box.set_visible_window(False)
     block_box.set_size_request(90, -1)
     button_box = gtk.HBox()
     button_box.pack_start(create_right_align(), True, True)
     button_box.pack_start(save_button, False, False)
     button_box.pack_start(block_box, False, False)
     self.pack_start(main_align, False, True)
     self.pack_start(button_box, False, False)
    def __init__(self, callback1=None, callback2=None):
        super(LoginBox, self).__init__()

        self.login_button = LoginButton("登陆网易帐号", callback1)
        self.sina_microblog_login_button = LoginButton("新浪微博登录", callback2)
        self.username_entry = gtk.Entry()
        self.username_entry.set_text('username or phone')
        self.password_entry = gtk.Entry()
        self.password_entry.set_text('password')
        self.password_entry.set_visibility(False)
        content_box = gtk.VBox()
        content_box.pack_start(create_bottom_align(), True, True)
        content_box.pack_start(self.username_entry, False, False)
        content_box.pack_start(self.password_entry, False, False)
        login_box = gtk.HButtonBox()
        login_box.pack_start(self.login_button, False, False, 16)
        content_box.pack_start(login_box, False, False, 16)
        sina_microblog_login_box = gtk.HButtonBox()
        sina_microblog_login_box.pack_start(
                self.sina_microblog_login_button, False, False, 16)
        content_box.pack_start(sina_microblog_login_box, False, False, 16)
        content_box.pack_start(create_upper_align(), True, True)

        self.pack_start(create_right_align(), True, True)
        self.pack_start(content_box, False, False)
        self.pack_start(create_left_align(), True, True)
        self.set_size_request(PLAYLIST_WIDTH, -1)
        self.connect("expose-event", self.on_loginbox_expose)
    def __init__(self, callback1=None, callback2=None):
        super(LoginBox, self).__init__()

        self.login_button = LoginButton("登陆网易帐号", callback1)
        self.sina_microblog_login_button = LoginButton("新浪微博登录", callback2)
        self.username_entry = gtk.Entry()
        self.username_entry.set_text('username or phone')
        self.password_entry = gtk.Entry()
        self.password_entry.set_text('password')
        self.password_entry.set_visibility(False)
        content_box = gtk.VBox()
        content_box.pack_start(create_bottom_align(), True, True)
        content_box.pack_start(self.username_entry, False, False)
        content_box.pack_start(self.password_entry, False, False)
        login_box = gtk.HButtonBox()
        login_box.pack_start(self.login_button, False, False, 16)
        content_box.pack_start(login_box, False, False, 16)
        sina_microblog_login_box = gtk.HButtonBox()
        sina_microblog_login_box.pack_start(
                self.sina_microblog_login_button, False, False, 16)
        content_box.pack_start(sina_microblog_login_box, False, False, 16)
        content_box.pack_start(create_upper_align(), True, True)

        self.pack_start(create_right_align(), True, True)
        self.pack_start(content_box, False, False)
        self.pack_start(create_left_align(), True, True)
        self.set_size_request(PLAYLIST_WIDTH, -1)
        self.connect("expose-event", self.on_loginbox_expose)
Exemplo n.º 8
0
    def create_jobs_box(self):    
        
        self.file_job_button = self.create_job_button("plus", _("Add Music"), self.song_view.recursion_add_dir)
        # self.file_job_button.connect("clicked", self.open_file_or_dir)

        self.job_box = gtk.EventBox()
        self.job_box.set_size_request(220, -1)
        targets = [("text/deepin-songs", gtk.TARGET_SAME_APP, 1), ("text/uri-list", 0, 2), ("text/plain", 0, 3)]
        self.job_box.drag_dest_set(gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_DROP,
                           targets, gtk.gdk.ACTION_COPY)
        self.job_box.set_visible_window(False)
        self.job_box.connect("drag-data-received", self.song_view.on_drag_data_received)
        
        # Content box. 
        
        content_box = gtk.VBox()
        content_box.pack_start(create_bottom_align(), True, True)
        # content_box.pack_start(ImageBox(app_theme.get_pixbuf("jobs/scan_tip.png")), False, False)
        content_box.pack_start(self.file_job_button, False, False)
        content_box.pack_start(create_upper_align(), True, True)
        
        # Rind box.
        rind_box = gtk.HBox()
        rind_box.pack_start(create_right_align(), True, True)
        rind_box.pack_start(content_box, False, False)
        rind_box.pack_start(create_left_align(), True, True)
        
        self.job_box.add(rind_box)
        self.jobs_align = gtk.Alignment()
        self.jobs_align.set(0.5, 0.5, 1, 1)
        self.jobs_align.add(self.job_box)
        self.jobs_align.connect("expose-event", self.draw_mask)
Exemplo n.º 9
0
 def create_double_combo_label(self, top_attach, bottom_attach, first_label, second_label, first_content="", second_content=""):
     first_label_box = gtk.HBox()
     first_title_label = Label(first_label)
     first_label_box.pack_start(create_right_align(), True, True)        
     first_label_box.pack_start(first_title_label, False, False)
     first_content_label = Label(first_content)
     
     second_label_box = gtk.HBox()
     second_title_label = Label(second_label)
     second_label_box.pack_start(create_right_align(), True, True)
     second_label_box.pack_start(second_title_label, False, False)
     second_content_label = Label(second_content)
     
     self.detail_table.attach(first_label_box, 0, 1, top_attach, bottom_attach)
     self.detail_table.attach(first_content_label, 1, 2, top_attach, bottom_attach, xpadding=5)
     self.detail_table.attach(second_label_box, 2, 3, top_attach, bottom_attach, xpadding=5)
     self.detail_table.attach(second_content_label, 3, 4, top_attach, bottom_attach)
     
     return first_content_label, second_content_label
Exemplo n.º 10
0
 def create_double_combo_label(self, top_attach, bottom_attach, first_label, second_label, first_content="", second_content=""):
     first_label_box = gtk.HBox()
     first_title_label = Label("%s:" % first_label)
     first_label_box.pack_start(create_right_align(), True, True)        
     first_label_box.pack_start(first_title_label, False, False)
     first_content_label = Label(first_content)
     
     second_label_box = gtk.HBox()
     second_title_label = Label(second_label)
     second_label_box.pack_start(create_right_align(), True, True)
     second_label_box.pack_start(second_title_label, False, False)
     second_content_label = Label(second_content)
     
     self.detail_table.attach(first_label_box, 0, 1, top_attach, bottom_attach)
     self.detail_table.attach(first_content_label, 1, 2, top_attach, bottom_attach, xpadding=5)
     self.detail_table.attach(second_label_box, 2, 3, top_attach, bottom_attach, xpadding=5)
     self.detail_table.attach(second_content_label, 3, 4, top_attach, bottom_attach)
     
     return first_content_label, second_content_label
Exemplo n.º 11
0
 def create_combo_entry(self, top_attach, bottom_attach, label_text, content_text=""):   
     title_label_box = gtk.HBox()
     title_label = Label(label_text)
     title_label_box.pack_start(create_right_align(), False, True)
     title_label_box.pack_start(title_label, False, True)
     
     content_entry = InputEntry(content_text)
     content_entry.set_size(260, 25)
     self.main_table.attach(title_label_box, 0, 1, top_attach, bottom_attach, xoptions=gtk.FILL)
     self.main_table.attach(content_entry, 1, 2, top_attach, bottom_attach, xoptions=gtk.FILL)
     return content_entry
Exemplo n.º 12
0
    def create_start_box(self):    
        main_table = gtk.Table(4, 2)
        main_table.set_row_spacings(CONTENT_ROW_SPACING)
        start_title_label = Label(_("On starting the player"))
        start_title_label.set_size_request(350, 12)
        label_align = gtk.Alignment()
        label_align.set_padding(20, 0, 0, 0)
        label_align.add(start_title_label)
        
        # splash check_button
        self.splash_check_button = CheckButton(_("Display splash-screen"))
        splash_hbox = gtk.HBox()
        splash_hbox.pack_start(self.splash_check_button, False, False)
        splash_hbox.pack_start(create_right_align(), True, True)        
        
        # open_lyrics_check_button.
        open_lyrics_hbox = gtk.HBox()
        self.open_lyrics_check_button = CheckButton(_("Show lyrics"))
        open_lyrics_hbox.pack_start(self.open_lyrics_check_button, False, False)

        
        # startup_check_button.
        self.auto_play_check_button = CheckButton(_("Start playback automatically"))
        auto_play_hbox = gtk.HBox()
        auto_play_hbox.pack_start(self.auto_play_check_button, False, False)
        auto_play_hbox.pack_start(create_right_align(), True, True)                
        
        # resume last check_button.
        self.resume_last_check_button = CheckButton(_("Resume playback"))
        resume_hbox = gtk.HBox()
        resume_hbox.pack_start(self.resume_last_check_button, False, False)
        
        main_table.attach(label_align, 0, 2, 0, 1, yoptions=gtk.FILL, xpadding=8)
        main_table.attach(create_separator_box(), 0, 2, 1, 2, gtk.FILL)
        #main_table.attach(splash_hbox, 0, 1, 2, 3)
        main_table.attach(open_lyrics_hbox, 0, 1, 2, 3)
        main_table.attach(auto_play_hbox, 1, 2, 2, 3, yoptions=gtk.EXPAND)
        main_table.attach(resume_hbox, 0, 1, 3, 4)
        return main_table
    def __init__(self, callback=None):
        super(LoginBox, self).__init__()

        self.login_button = LoginButton(callback)
        content_box = gtk.VBox()
        content_box.pack_start(create_bottom_align(), True, True)
        content_box.pack_start(self.login_button, False, False)
        content_box.pack_start(create_upper_align(), True, True)

        self.pack_start(create_right_align(), True, True)
        self.pack_start(content_box, False, False)
        self.pack_start(create_left_align(), True, True)
        self.set_size_request(PLAYLIST_WIDTH, -1)
        self.connect("expose-event", self.on_loginbox_expose)
 def __init__(self, callback=None):
     super(LoginBox, self).__init__()
     
     self.login_button = LoginButton(callback)
     content_box = gtk.VBox()
     content_box.pack_start(create_bottom_align(), True, True)
     content_box.pack_start(self.login_button, False, False)
     content_box.pack_start(create_upper_align(), True, True)
     
     self.pack_start(create_right_align(), True, True)
     self.pack_start(content_box, False, False)
     self.pack_start(create_left_align(), True, True)    
     self.set_size_request(PLAYLIST_WIDTH, -1)
     self.connect("expose-event", self.on_loginbox_expose)
Exemplo n.º 15
0
    def create_hotkey_box(self):    
        hotkey_title_label = Label(_("Hotkeys"))
        hotkey_title_label.set_size_request(350, 12)
        label_align = gtk.Alignment()
        label_align.set_padding(20, 0, 0, 0)
        label_align.add(hotkey_title_label)
        self.main_table.attach(label_align, 0, 2, 0, 1, yoptions=gtk.FILL, xpadding=8)
        self.main_table.attach(create_separator_box(), 0, 2, 1, 2, yoptions=gtk.FILL)
        
        # using check button.
        using_hbox = gtk.HBox()
        self.using_check_button = CheckButton(_("Enable hotkeys"))

        using_hbox.pack_start(self.using_check_button, False, False)
        using_hbox.pack_start(create_right_align(), False, True)
        self.main_table.attach(using_hbox, 0, 2, 2, 3, yoptions=gtk.FILL)
        
        self.toggle_window_entry = self.create_combo_entry(3, 4, _("Minimize/Show window"),
                                                           config.get("globalkey", "toggle_window"))
        self.toggle_lyrics_status_entry = self.create_combo_entry(4, 5, _("Show/Hide lyrics"),
                                                                  config.get("globalkey", "toggle_lyrics_status"))
        self.toggle_lyrics_lock_entry = self.create_combo_entry(5, 6, _("Lock/Unlock lyrics"),
                                                                config.get("globalkey", "toggle_lyrics_lock"))
        self.playpause_entry = self.create_combo_entry(6, 7, _("Play/Pause"), config.get("globalkey", "playpause"))
        self.previous_entry = self.create_combo_entry(7, 8, _("Previous"), config.get("globalkey", "previous"))        
        self.next_entry = self.create_combo_entry(8, 9, _("Next"), config.get("globalkey", "next"))
        self.increase_vol_entry = self.create_combo_entry(9, 10, _("Volume Up"), config.get("globalkey", "increase_vol"))
        self.decrease_vol_entry = self.create_combo_entry(10, 11, _("Volume Down"), config.get("globalkey", "decrease_vol"))
        
        # Button.
        default_button = Button(_("Reset"))
        default_button.connect("clicked", self.restore_to_default)
        button_hbox = gtk.HBox()
        button_hbox.pack_start(create_right_align(), True, True)
        button_hbox.pack_start(default_button, False, False)
        self.main_table.attach(button_hbox, 0, 2, 11, 12, xpadding=10)
Exemplo n.º 16
0
    def __init__(self):
        gtk.VBox.__init__(self)
        main_box = gtk.VBox(spacing=15)
        logo_image = gtk.image_new_from_pixbuf(gtk.gdk.pixbuf_new_from_file(os.path.join(get_parent_dir(__file__, 3), "image", "logo1.png")))
        light_color = app_theme.get_color("labelText")
        logo_name = Label(PROGRAM_NAME_LONG, text_size=10)
        logo_box = gtk.HBox(spacing=2)
        logo_box.pack_start(logo_image, False, False)
        logo_box.pack_start(logo_name, False, False)
        
        version_label = Label("%s" % _("Version"))
        version_content = Label(PROGRAM_VERSION, light_color)
        # publish_label = Label(_("Release date:"))
        # publish_content = Label("2012.07.12", light_color)
        info_box = gtk.HBox(spacing=5)
        info_box.pack_start(version_label, False, False)
        info_box.pack_start(version_content, False, False)
        # info_box.pack_start(publish_label, False, False)
        # info_box.pack_start(publish_content, False, False)
        
        title_box = gtk.HBox()
        title_box.pack_start(logo_box, False, False)
        title_box.pack_start(create_right_align(), True, True)
        title_box.pack_start(info_box, False, False)
        
        describe = _("Deepin Music is a music application designed for Linux "
                     "users. It's characterized with lyrics searching, desktop "
                     "lyrics display,album cover downloading, resume playing, "
                     "music management and skin selection.\n"
                     "\n"
                     "Deepin Music is free software licensed under GNU GPLv3.")

        describe_label = Label(describe, enable_select=False, wrap_width=400, text_size=10)
        main_box.pack_start(title_box, False, False)
        main_box.pack_start(create_separator_box(), False, True)
        main_box.pack_start(describe_label, False, False)
        
        main_align = gtk.Alignment()
        main_align.set_padding(25, 0, 0, 0)
        main_align.set(0, 0, 1, 1)
        main_align.add(main_box)
        
        self.add(main_align)
Exemplo n.º 17
0
 def __init__(self, song=None):
     super(CoverSetting, self).__init__()
     
     cover_box = gtk.VBox()
     cover_image_align =  gtk.Alignment()
     cover_image_align.set(0.5, 0.5, 0.5, 0.5)
     self.cover_image = gtk.Image()
     self.cover_image.set_size_request(300, 180)
     
     
     cover_image_align.add(self.cover_image)
     cover_box.add(cover_image_align)
     cover_box.set_size_request(400, 220)
     
     cover_box_align = gtk.Alignment()
     cover_box_align.set_padding(20, 20, 10, 10)
     cover_box_align.set(0.5, 0.5, 0.5, 0.5)
     cover_box_align.add(cover_box)
     
     button_box = gtk.HBox(spacing=10)
     button_box_align = gtk.Alignment()
     button_box_align.set_padding(0, 0, 0, 30)
     button_box_align.set(0, 0, 1.0, 1.0)
     button_box_align.add(button_box)
     change_button = Button(_("Change"))
     change_button.connect("clicked", self.change_cover_image)
     
     fetch_button = Button(_("Retrieve from the Internet"))
     fetch_button.connect("clicked", self.fetch_cover_image)
     
     delete_button = Button(_("Reset"))
     delete_button.connect("clicked", self.delete_cover_image)
     button_box.pack_start(create_right_align(), True, True)
     button_box.pack_start(change_button, False, False)
     button_box.pack_start(delete_button, False, False)
     button_box.pack_start(fetch_button, False, False)        
     
     self.pack_start(cover_box_align, False, True)
     self.pack_start(button_box_align, False, True)
     
     if song:
         self.update_song(song)
Exemplo n.º 18
0
 def __init__(self, song=None):
     super(CoverSetting, self).__init__()
     
     cover_box = gtk.VBox()
     cover_image_align =  gtk.Alignment()
     cover_image_align.set(0.5, 0.5, 0.5, 0.5)
     self.cover_image = gtk.Image()
     self.cover_image.set_size_request(300, 180)
     
     
     cover_image_align.add(self.cover_image)
     cover_box.add(cover_image_align)
     cover_box.set_size_request(400, 220)
     
     cover_box_align = gtk.Alignment()
     cover_box_align.set_padding(20, 20, 10, 10)
     cover_box_align.set(0.5, 0.5, 0.5, 0.5)
     cover_box_align.add(cover_box)
     
     button_box = gtk.HBox(spacing=10)
     button_box_align = gtk.Alignment()
     button_box_align.set_padding(0, 0, 0, 30)
     button_box_align.set(0, 0, 1.0, 1.0)
     button_box_align.add(button_box)
     change_button = Button(_("Change"))
     change_button.connect("clicked", self.change_cover_image)
     
     fetch_button = Button(_("Retrieve from the Internet"))
     fetch_button.connect("clicked", self.fetch_cover_image)
     
     delete_button = Button(_("Reset"))
     delete_button.connect("clicked", self.delete_cover_image)
     button_box.pack_start(create_right_align(), True, True)
     button_box.pack_start(change_button, False, False)
     button_box.pack_start(delete_button, False, False)
     button_box.pack_start(fetch_button, False, False)        
     
     self.pack_start(cover_box_align, False, True)
     self.pack_start(button_box_align, False, True)
     
     if song:
         self.update_song(song)
Exemplo n.º 19
0
 def create_combo_entry(self, top_attach, bottom_attach, label_content, hotkey_content):    
     combo_hbox = gtk.HBox(spacing=5)
     combo_hbox.pack_start(create_right_align(), True, True)
     
     # single_hotkey_label
     hotkey_label = Label(label_content)
     combo_hbox.pack_start(hotkey_label, False, False)
     
     # Hotkey entry.
     hotkey_entry = ShortcutKeyEntry(hotkey_content)
     hotkey_entry.set_size(170, 24)
     hotkey_entry_align = gtk.Alignment()
     hotkey_entry_align.set_padding(0, 0, 0, 50)
     hotkey_entry_align.add(hotkey_entry)
     combo_hbox.pack_start(hotkey_entry_align, False, False)
     
     self.main_table.attach(combo_hbox, 0, 2, top_attach, bottom_attach, xpadding=5)
     # self.main_table.attach(combo_hbox, 0, 1, top_attach, bottom_attach, xpadding=5)
     # self.main_table.attach(hotkey_entry, 1, 2, top_attach, bottom_attach, xoptions=gtk.FILL)
     
     return hotkey_entry
Exemplo n.º 20
0
 def __init__(self):
     gtk.VBox.__init__(self)
     main_box = gtk.VBox(spacing=15)
     logo_image = ImageBox(app_theme.get_pixbuf("skin/logo1.png"))
     light_color = app_theme.get_color("labelText")
     logo_name = Label(_("Deepin Music Player"), text_size=10)
     logo_box = gtk.HBox(spacing=2)
     logo_box.pack_start(logo_image, False, False)
     logo_box.pack_start(logo_name, False, False)
     
     version_label = Label(_("Version:"))
     version_content = Label("V1.0", light_color)
     # publish_label = Label(_("Release date:"))
     # publish_content = Label("2012.07.12", light_color)
     info_box = gtk.HBox(spacing=5)
     info_box.pack_start(version_label, False, False)
     info_box.pack_start(version_content, False, False)
     # info_box.pack_start(publish_label, False, False)
     # info_box.pack_start(publish_content, False, False)
     
     title_box = gtk.HBox()
     title_box.pack_start(logo_box, False, False)
     title_box.pack_start(create_right_align(), True, True)
     title_box.pack_start(info_box, False, False)
     
     describe = _("        Deepin Music Player is a music application designed for Linux users.It features lyrics searching and downloading, desktop lyrics display,album cover downloading, resume playing, music management and skin selection.\n\nDeepin Music Player is free software licensed under GNU GPLv3.")
     
     describe_label = Label(describe, enable_select=False, wrap_width=400, text_size=10)
     main_box.pack_start(title_box, False, False)
     main_box.pack_start(create_separator_box(), False, True)
     main_box.pack_start(describe_label, False, False)
     
     main_align = gtk.Alignment()
     main_align.set_padding(25, 0, 0, 0)
     main_align.set(0, 0, 1, 1)
     main_align.add(main_box)
     
     self.add(main_align)
Exemplo n.º 21
0
    def __init__(self, db_query):
        
        # Init.
        gtk.VBox.__init__(self)
        SignalContainer.__init__(self)
        
        self.__db_query = db_query
        self.update_interval = 3000 # 3000 millisecond.
        self.reload_flag = False
        self.search_flag = False
        self.cache_search_list = []
        self.cache_search_view = []
        self.__selected_tag = {"album": [], "artist": [], "genre": []}
        Dispatcher.connect("reload-browser", self.on_dispatcher_reload_browser)
        gobject.timeout_add(self.update_interval, self.on_interval_loaded_view)
        
        # The saving song Classification presented to the user.
        self.artists_view, self.artists_sw  = self.get_icon_view(14)
        self.albums_view,  self.albums_sw   = self.get_icon_view(14)
        self.genres_view,  self.genres_sw   = self.get_icon_view(14)
        self.folders_view, self.folders_sw  = self.get_icon_view(20)
        self.folders_view.connect("motion-notify-item", self.on_folders_view_motion_notify)
        
        # Song list for temporarily storing
        # self.songs_view, self.songs_view_sw = self.get_song_view()
        self.songs_view = self.get_song_view()
        
        # Classification navigation bar.
        self.filterbar = OptionBar(
            [(app_theme.get_pixbuf("filter/artist_normal.png"), app_theme.get_pixbuf("filter/artist_press.png"),
              _("Artist"), lambda : self.switch_filter_view("artist")),
             (app_theme.get_pixbuf("filter/album_normal.png"), app_theme.get_pixbuf("filter/album_press.png"),
              _("Album"), lambda : self.switch_filter_view("album")),
             (app_theme.get_pixbuf("filter/genre_normal.png"), app_theme.get_pixbuf("filter/genre_press.png"),
              _("Genre"), lambda : self.switch_filter_view("genre")),
             (app_theme.get_pixbuf("filter/local_normal.png"), app_theme.get_pixbuf("filter/local_press.png"),
              _("Folder"), lambda : self.switch_filter_view("folder"))
             ])
        
        # Manage the media library (import, refresh)
        self.importbar = SongImportBar()
        self.importbar.reload_items(
            [
             (_("Quick Scan"), lambda : ImportFolderJob([os.path.expanduser("~")])),                
             (_("Scan"), lambda : ImportFolderJob()),
             (_("Refresh"), lambda : ReloadDBJob())
             ])
        
        # Left box
        invailed_box = gtk.VBox()
        invailed_box.set_size_request(-1, 10)
        left_vbox = gtk.VBox(spacing=10)
        left_vbox.set_size_request(121, -1)
        # left_vbox.pack_start(invailed_box, False, True)
        left_vbox.pack_start(self.filterbar, False, False)
        left_vbox.pack_start(create_separator_box(), False, False)
        left_vbox.pack_start(self.importbar, False, False)
        
        # Used to switch songs category view, in the right side of the layout.
        self.switch_view_box = gtk.VBox()
        self.switch_view_box.add(self.artists_sw)
        # self.switch_view_box.add(TaskView())

        
        # Control back on a view.
        self.back_hbox = gtk.HBox()
        self.back_hbox.set_size_request(-1, 26)
        self.back_hbox.set_no_show_all(True)
        self.back_button = BackButton()
        self.back_button.connect("clicked", self.on_back_button_clicked)
        self.prompt_button = PromptButton()
        self.back_hbox.pack_start(self.back_button, False, False, 5)
        self.back_hbox.pack_start(self.prompt_button, False, False)
        
        # searchbar 
        self.search_entry, search_align = self.get_search_entry()
        search_hbox = gtk.HBox()
        search_hbox.pack_start(self.back_hbox, False, False)
        search_hbox.pack_start(create_right_align(), True, True)
        # search_hbox.pack_start(search_align, False, False)
        search_hbox_align = gtk.Alignment()
        search_hbox_align.set_padding(5, 0, 0, 0)
        search_hbox_align.set(0, 0, 1, 1)
        search_hbox_align.add(search_hbox)
        
        # Layout on the right.
        content_box = gtk.VBox(spacing=5)
        content_box.pack_start(search_hbox_align, False, False)
        content_box.pack_start(self.switch_view_box, True, True)
        
        body_paned = HPaned(handle_color=app_theme.get_color("panedHandler"), enable_drag=True)
        body_paned.add1(left_vbox)
        body_paned.add2(content_box)
        
        self.pack_start(body_paned, True, True)
Exemplo n.º 22
0
    def __init__(self, db_query):

        # Init.
        gtk.VBox.__init__(self)
        SignalContainer.__init__(self)

        self.__db_query = db_query
        self.update_interval = 3000  # 3000 millisecond.
        self.reload_flag = False
        self.search_flag = False
        self.cache_search_list = []
        self.cache_search_view = []
        self.__selected_tag = {"album": [], "artist": [], "genre": []}
        Dispatcher.connect("reload-browser", self.on_dispatcher_reload_browser)
        gobject.timeout_add(self.update_interval, self.on_interval_loaded_view)

        # The saving song Classification presented to the user.
        self.artists_view, self.artists_sw = self.get_icon_view(14)
        self.albums_view, self.albums_sw = self.get_icon_view(14)
        self.genres_view, self.genres_sw = self.get_icon_view(14)
        self.folders_view, self.folders_sw = self.get_icon_view(20)
        self.folders_view.connect("motion-notify-item",
                                  self.on_folders_view_motion_notify)

        # Song list for temporarily storing
        # self.songs_view, self.songs_view_sw = self.get_song_view()
        self.songs_view = self.get_song_view()

        # Classification navigation bar.
        self.filterbar = OptionBar([
            (app_theme.get_pixbuf("filter/artist_normal.png"),
             app_theme.get_pixbuf("filter/artist_press.png"), _("Artist"),
             lambda: self.switch_filter_view("artist")),
            (app_theme.get_pixbuf("filter/album_normal.png"),
             app_theme.get_pixbuf("filter/album_press.png"), _("Album"),
             lambda: self.switch_filter_view("album")),
            (app_theme.get_pixbuf("filter/genre_normal.png"),
             app_theme.get_pixbuf("filter/genre_press.png"), _("Genre"),
             lambda: self.switch_filter_view("genre")),
            (app_theme.get_pixbuf("filter/local_normal.png"),
             app_theme.get_pixbuf("filter/local_press.png"), _("Folder"),
             lambda: self.switch_filter_view("folder"))
        ])

        # Manage the media library (import, refresh)
        self.importbar = SongImportBar()
        self.importbar.reload_items([
            (_("Quick Scan"),
             lambda: ImportFolderJob([os.path.expanduser("~")])),
            (_("Scan"), lambda: ImportFolderJob()),
            (_("Refresh"), lambda: ReloadDBJob())
        ])

        # Left box
        invailed_box = gtk.VBox()
        invailed_box.set_size_request(-1, 10)
        left_vbox = gtk.VBox(spacing=10)
        left_vbox.set_size_request(121, -1)
        # left_vbox.pack_start(invailed_box, False, True)
        left_vbox.pack_start(self.filterbar, False, False)
        left_vbox.pack_start(create_separator_box(), False, False)
        left_vbox.pack_start(self.importbar, False, False)

        # Used to switch songs category view, in the right side of the layout.
        self.switch_view_box = gtk.VBox()
        self.switch_view_box.add(self.artists_sw)
        # self.switch_view_box.add(TaskView())

        # Control back on a view.
        self.back_hbox = gtk.HBox()
        self.back_hbox.set_size_request(-1, 26)
        self.back_hbox.set_no_show_all(True)
        self.back_button = BackButton()
        self.back_button.connect("clicked", self.on_back_button_clicked)
        self.prompt_button = PromptButton()
        self.back_hbox.pack_start(self.back_button, False, False, 5)
        self.back_hbox.pack_start(self.prompt_button, False, False)

        # searchbar
        self.search_entry, search_align = self.get_search_entry()
        search_hbox = gtk.HBox()
        search_hbox.pack_start(self.back_hbox, False, False)
        search_hbox.pack_start(create_right_align(), True, True)
        # search_hbox.pack_start(search_align, False, False)
        search_hbox_align = gtk.Alignment()
        search_hbox_align.set_padding(5, 0, 0, 0)
        search_hbox_align.set(0, 0, 1, 1)
        search_hbox_align.add(search_hbox)

        # Layout on the right.
        content_box = gtk.VBox(spacing=5)
        content_box.pack_start(search_hbox_align, False, False)
        content_box.pack_start(self.switch_view_box, True, True)

        body_paned = HPaned(handle_color=app_theme.get_color("panedHandler"),
                            enable_drag=True)
        body_paned.add1(left_vbox)
        body_paned.add2(content_box)

        self.pack_start(body_paned, True, True)
Exemplo n.º 23
0
    def __init__(self):
        gobject.GObject.__init__(self)
        image_dir = os.path.join(get_parent_dir(__file__, 3), "image")
        application = Application("DMuisc", resizable=False)
        application.close_callback = self.prompt_quit
        application.set_icon(os.path.join(image_dir, "logo.ico"))
        application.set_skin_preview(os.path.join(image_dir, "frame.png"))
        application.add_titlebar(["theme", "menu", "min", "close"],
                                 os.path.join(image_dir, "logo1.png"),
                                 _("DMusic"))
        application.titlebar.menu_button.connect("button-press-event",
                                                 self.menu_button_press)
        application.titlebar.connect("button-press-event", self.right_click_cb)

        # Window mode change.
        self.revert_toggle_button = self.create_revert_button()
        self.revert_toggle_button.connect("toggled", self.change_view)

        application.titlebar.button_box.pack_start(self.revert_toggle_button)
        application.titlebar.button_box.reorder_child(
            self.revert_toggle_button, 1)
        self.window = application.window
        self.window.is_disable_window_maximized = self.is_disable_window_maximized
        utils.set_main_window(self)

        self.plugins = plugins.PluginsManager(self, False)
        self.browser_manager = BrowserMananger()
        self.tray_icon = TrayIcon(self)
        self.lyrics_display = LyricsModule()
        self.list_manager = ListManager()
        self.simple_header_bar = SimpleHeadbar()
        self.preference_dialog = PreferenceDialog()
        self.equalizer_win = EqualizerWindow()
        self.mmkeys = MMKeys()
        self.audiocd = AudioCDSource()
        self.playlist_ui = playlist_ui

        self.mini_window = MiniWindow()

        self.window.add_move_event(self.simple_header_bar)

        bottom_box = gtk.HBox()
        self.browser_align = gtk.Alignment()
        self.browser_align.set_padding(0, 0, 0, 0)
        self.browser_align.set(0.5, 0.5, 1, 1)

        list_manager_align = gtk.Alignment()
        list_manager_align.set_padding(0, 0, 0, 0)
        list_manager_align.set(1, 1, 1, 1)
        list_manager_align.add(self.list_manager)

        self.browser_align.add(self.browser_manager)
        bottom_box.pack_start(list_manager_align, False, False)
        bottom_box.pack_start(self.browser_align, True, True)
        self.browser_align.set_no_show_all(True)

        main_box = gtk.VBox()
        self.header_box = gtk.VBox()
        self.header_box.add(self.simple_header_bar)
        main_box.pack_start(self.header_box, False)
        main_box.pack_start(bottom_box, True)

        self.link_box = gtk.HBox()
        self.link_box.pack_start(create_right_align(), True, True)
        self.link_box.pack_start(
            LinkButton(_("Join us"), "http://www.linuxdeepin.com/joinus/job"),
            False, False)

        status_box = gtk.HBox(spacing=5)
        status_box.pack_start(jobs_manager)
        status_box.pack_start(self.link_box, padding=5)

        status_bar = gtk.EventBox()
        status_bar.set_visible_window(False)
        status_bar.set_size_request(-1, 22)
        status_bar.add(status_box)

        application.main_box.pack_start(main_box)
        application.main_box.pack_start(status_bar, False, True)

        # if config.get("globalkey", "enable", "false") == "true":
        # global_hotkeys.start_bind()

        if config.get("setting", "window_mode") == "simple":
            self.revert_toggle_button.set_active(False)
        else:
            self.revert_toggle_button.set_active(True)

        self.change_view(self.revert_toggle_button)

        if config.get("window", "x") == "-1":
            self.window.set_position(gtk.WIN_POS_CENTER)
        else:
            self.window.move(int(config.get("window", "x")),
                             int(config.get("window", "y")))

        # try:
        #     self.window.resize(int(config.get("window","width")),int(config.get("window","height")))
        # except:
        #     pass

        # window_state = config.get("window", "state")
        # if window_state == "maximized":
        #     self.window.maximize()
        # elif window_state == "normal":
        #     self.window.unmaximize()

        self.window.connect("delete-event", self.quit)
        self.window.connect("configure-event", self.on_configure_event)
        self.window.connect("destroy", self.quit)

        Dispatcher.connect("quit", self.force_quit)
        Dispatcher.connect("show-main-menu", self.show_instance_menu)
        Dispatcher.connect("show-setting",
                           lambda w: self.preference_dialog.show_all())
        Dispatcher.connect(
            "show-desktop-page",
            lambda w: self.preference_dialog.show_desktop_lyrics_page())
        Dispatcher.connect(
            "show-scroll-page",
            lambda w: self.preference_dialog.show_scroll_lyrics_page())
        Dispatcher.connect("show-job", self.hide_link_box)
        Dispatcher.connect("hide-job", self.show_link_box)

        gobject.idle_add(self.ready)
Exemplo n.º 24
0
    def __init__(self):
        gobject.GObject.__init__(self)
        image_dir = os.path.join(get_parent_dir(__file__, 3), "image")
        application = Application("DMuisc", resizable=False)
        application.close_callback = self.prompt_quit
        application.set_icon(os.path.join(image_dir, "logo.ico"))
        application.set_skin_preview(os.path.join(image_dir, "frame.png"))
        application.add_titlebar(
            ["theme", "menu", "min", "close"],
            os.path.join(image_dir, "logo1.png"),
            _("DMusic")
            )
        application.titlebar.menu_button.connect("button-press-event", self.menu_button_press)        
        application.titlebar.connect("button-press-event", self.right_click_cb)
        
        # Window mode change.
        self.revert_toggle_button = self.create_revert_button()
        self.revert_toggle_button.connect("toggled", self.change_view) 

        application.titlebar.button_box.pack_start(self.revert_toggle_button)
        application.titlebar.button_box.reorder_child(self.revert_toggle_button, 1)
        self.window = application.window
        self.window.is_disable_window_maximized = self.is_disable_window_maximized
        utils.set_main_window(self)
        
        self.plugins = plugins.PluginsManager(self, False)        
        self.browser_manager = BrowserMananger()        
        self.tray_icon = TrayIcon(self)        
        self.lyrics_display = LyricsModule()
        self.list_manager = ListManager()
        self.simple_header_bar = SimpleHeadbar()
        self.preference_dialog = PreferenceDialog()
        self.equalizer_win = EqualizerWindow()
        self.mmkeys = MMKeys()
        self.audiocd = AudioCDSource()
        self.playlist_ui = playlist_ui

        self.mini_window = MiniWindow()
        
        self.window.add_move_event(self.simple_header_bar)

        bottom_box = gtk.HBox()
        self.browser_align = gtk.Alignment()
        self.browser_align.set_padding(0, 0, 0, 0)
        self.browser_align.set(0.5, 0.5, 1, 1)
        
        list_manager_align = gtk.Alignment()
        list_manager_align.set_padding(0, 0, 0, 0)
        list_manager_align.set(1, 1, 1, 1)
        list_manager_align.add(self.list_manager)
        
        self.browser_align.add(self.browser_manager)
        bottom_box.pack_start(list_manager_align, False, False)        
        bottom_box.pack_start(self.browser_align, True, True)
        self.browser_align.set_no_show_all(True)
        
        main_box = gtk.VBox()
        self.header_box = gtk.VBox()
        self.header_box.add(self.simple_header_bar)
        main_box.pack_start(self.header_box, False)
        main_box.pack_start(bottom_box, True)
        
        self.link_box = gtk.HBox()
        self.link_box.pack_start(create_right_align(), True, True)
        self.link_box.pack_start(LinkButton(_("Join us"), "http://www.linuxdeepin.com/joinus/job"), False, False)
        
        status_box = gtk.HBox(spacing=5)
        status_box.pack_start(jobs_manager)
        status_box.pack_start(self.link_box, padding=5)
        
        status_bar = gtk.EventBox()
        status_bar.set_visible_window(False)
        status_bar.set_size_request(-1, 22)
        status_bar.add(status_box)
        
        application.main_box.pack_start(main_box)        
        application.main_box.pack_start(status_bar, False, True)
        
        # if config.get("globalkey", "enable", "false") == "true":
            # global_hotkeys.start_bind()
        
        if config.get("setting", "window_mode") == "simple":
            self.revert_toggle_button.set_active(False)
        else:    
            self.revert_toggle_button.set_active(True)
                
        self.change_view(self.revert_toggle_button)    
            
        if config.get("window", "x") == "-1":
            self.window.set_position(gtk.WIN_POS_CENTER)
        else:    
            self.window.move(int(config.get("window","x")),int(config.get("window","y")))
            
        # try:    
        #     self.window.resize(int(config.get("window","width")),int(config.get("window","height")))
        # except:    
        #     pass
        
        # window_state = config.get("window", "state")
        # if window_state == "maximized":
        #     self.window.maximize()
        # elif window_state == "normal":    
        #     self.window.unmaximize()
        
        self.window.connect("delete-event", self.quit)
        self.window.connect("configure-event", self.on_configure_event)
        self.window.connect("destroy", self.quit)
        
        Dispatcher.connect("quit",self.force_quit)
        Dispatcher.connect("show-main-menu", self.show_instance_menu)
        Dispatcher.connect("show-setting", lambda w : self.preference_dialog.show_all())
        Dispatcher.connect("show-desktop-page", lambda w: self.preference_dialog.show_desktop_lyrics_page())
        Dispatcher.connect("show-scroll-page", lambda w: self.preference_dialog.show_scroll_lyrics_page())
        Dispatcher.connect("show-job", self.hide_link_box)
        Dispatcher.connect("hide-job", self.show_link_box)
        
        gobject.idle_add(self.ready)
Exemplo n.º 25
0
    def __init__(self):
        super(SimpleHeadber, self).__init__()
        self.set_visible_window(False)
        
        # init.
        self.cover_box = PlayerCoverButton()
        self.cover_box.show_all()
        
        # Main table
        main_table = gtk.Table(2, 2)
        self.move_box = gtk.EventBox()
        self.move_box.set_visible_window(False)
                
        # 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_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"))
        self.__play.show_all()

        self.__id_signal_play = self.__play.connect("toggled", lambda w: Player.playpause())
        
        prev_button = self.__create_button("previous", _("Previous track"))
        next_button = self.__create_button("next", _("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(0, 0, 0, 10)
        mainbtn_align.add(mainbtn)
        
        mainbtn_box = gtk.HBox()
        mainbtn_box.pack_start(create_right_align(), True, True)
        mainbtn_box.pack_start(mainbtn_align, False, False)
        
        # 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)       
        vol_align = gtk.Alignment()
        vol_align.set_padding(2, 0, 0, 0)
        vol_align.add(self.vol)
        
        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)
        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_label_align = gtk.Alignment()
        timer_label_align.set_padding(2, 0, 0, 0)
        timer_label_align.add(song_timer.get_label())
        timer_box.pack_start(timer_label_align, False, False)
        
        main_table.attach(PlayInfo(110), 0, 1, 0, 1, xoptions=gtk.FILL)
        main_table.attach(mainbtn_box, 1, 2, 0, 1,xoptions=gtk.FILL, xpadding=5)        
        main_table.attach(plug_box, 0, 1, 1, 2, xoptions=gtk.FILL)
        main_table.attach(timer_box, 1, 2, 1, 2, xoptions=gtk.FILL, xpadding=15)
        
        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, False, False)
        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    
Exemplo n.º 26
0
 def __init__(self, db_query):
     
     gtk.VBox.__init__(self)
     SignalContainer.__init__(self)
     
     self.__db_query = db_query
     self._tree = {}
     self.__selected_tag = {"album": [], "artist": [], "genre": []}
     self.view_mode = ICON_VIEW_MODE
     self.__search_flag = False
     self.__song_cache_items = []
     self.__cover_cache_items = []
     
     # init widget.
     self.entry_box = SearchEntry("")
     self.entry_box.set_size(155, 22)
     self.entry_box.entry.connect("changed", self.__search_cb)
     
     # upper box.
     self.back_button = self.__create_simple_button("back", self.__switch_to_filter_view)
     self.back_button.set_no_show_all(True)
     back_align = gtk.Alignment()
     back_align.set(0.5, 0.5, 0, 0)
     back_align.set_padding(0, 0, 0, 10)
     back_align.add(self.back_button)
     
     # path control
     self.path_combo_box = ComboMenuButton()
     self.path_combo_box.connect("list-actived", lambda w: self.update_path_list_view())
     self.path_combo_box.connect("combo-actived", lambda w, k : self.update_path_filter_view(k))
     path_combo_align = gtk.Alignment()
     path_combo_align.set_padding(0, 0, 10, 0)
     path_combo_align.add(self.path_combo_box)
     self.path_combo_box.set_no_show_all(True)
     
     upper_box = gtk.HBox(spacing=5)
     upper_box.pack_start(path_combo_align, False, False)
     upper_box.pack_start(create_right_align(), True, True)
     upper_box.pack_start(back_align, False, False)
     entry_box_align = gtk.Alignment()
     entry_box_align.set(0.5, 0.5, 0, 0)
     entry_box_align.set_padding(1, 0, 0, 0)
     entry_box_align.add(self.entry_box)
     upper_box.pack_start(entry_box_align, False, False)
     
     upper_box_align = gtk.Alignment()
     upper_box_align.set_padding(0, 10, 0, 10)
     upper_box_align.set(0.5, 0.5, 1, 1)
     upper_box_align.connect("expose-event", self.expose_upper_box_mask)
     upper_box_align.add(upper_box)
     
     self.categorybar_status = "artist"
     self.filter_categorybar = OptionBar(
         [(app_theme.get_pixbuf("filter/artist_normal.png"), app_theme.get_pixbuf("filter/artist_press.png"),
           _("By artist"), lambda : self.reload_filter_view("artist", True)),
          (app_theme.get_pixbuf("filter/album_normal.png"), app_theme.get_pixbuf("filter/album_press.png"),
           _("By album"), lambda : self.reload_filter_view("album", True)),
          (app_theme.get_pixbuf("filter/genre_normal.png"), app_theme.get_pixbuf("filter/genre_press.png"),
           _("By genre"), lambda : self.reload_filter_view("genre", True)),]
                                         )
     
     # Song path bar.
     self.__current_path = None
     self.current_icon_item = None
     self.reload_path_flag = True
     self.path_categorybar = SongPathBar(_("Local"))
     self.path_categorybar.set_size_request(-1, 205)
     
     # Song import bar.
     self.import_categorybar = SongImportBar()
     self.import_categorybar.reload_items(
         [
          (_("Scan Home dir"), lambda : ImportFolderJob([os.path.expanduser("~")])),                
          (_("Select dir to scan"), lambda : ImportFolderJob()),
          (_("Refresh library"), lambda : ReloadDBJob())]
         )
     
     # iconview.
     self.filter_view = IconView(10, 10)
     targets = [("text/deepin-songs", gtk.TARGET_SAME_APP, 1), ("text/uri-list", 0, 2)]
     self.filter_view.drag_source_set(gtk.gdk.BUTTON1_MASK, targets, gtk.gdk.ACTION_COPY)
     self.filter_view.connect("drag-data-get", self.__on_drag_data_get) 
     self.filter_view.connect("double-click-item", self.__on_double_click_item)
     self.filter_view.connect("single-click-item", self.__on_single_click_item)
     self.filter_view.draw_mask  = self.draw_filter_view_mask
     self.filter_scrolled_window = ScrolledWindow()
     self.filter_scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
     self.filter_scrolled_window.add_child(self.filter_view)
     
     # songs_view
     self.songs_view = MultiDragSongView()
     self.songs_view.add_titles([_("Title"), _("Artist"), _("Album"), _("Added time")])
     self.songs_scrolled_window = ScrolledWindow(0, 0)
     self.songs_scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
     self.songs_scrolled_window.add_child(self.songs_view)
     
     # left_vbox
     align = gtk.Alignment()
     align.set(0, 1, 0, 0)
     left_box = gtk.VBox(spacing=10)
     left_box.set_size_request(140, -1)
     left_box.pack_start(self.filter_categorybar, False, False)
     left_box.pack_start(self.create_separator_box(), False, False)
     left_box.pack_start(self.path_categorybar, False, False)
     left_box.pack_start(self.create_separator_box(), False, False)
     left_box.pack_start(self.import_categorybar, False, False)
     left_box.pack_start(align, True, True)
     left_box.connect("expose-event", self.expose_left_box_mask)
     
     # right_box.
     self.right_box = gtk.VBox()
     self.right_box.add(self.filter_scrolled_window)
     
     # swith_box
     right_box_align = gtk.Alignment()
     right_box_align.set_padding(0, 0, 0, 2)
     right_box_align.set(1, 1, 1, 1)
     right_box_align.add(self.right_box)
     browser_box = gtk.VBox()
     browser_box.pack_start(upper_box_align,  False, False)
     browser_box.pack_start(right_box_align, True, True)
     
     body_box = gtk.HBox()
     body_box.pack_start(left_box, False, False)
     body_box.pack_start(browser_box, True, True)
     self.pack_start(body_box, True, True)
     
     self.reload_flag = False
     Dispatcher.connect("reload-browser", self.reload_browser)
     gobject.timeout_add(5000, self.interval_reload_browser)