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)
예제 #3
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)
    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)
예제 #6
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