def SetLoginStatus2(self, infos):
     self.bduss = infos.get("bduss", "")
     self.uid = str(infos.get("user_id", ""))
     self.username = infos.get("user_name", "")
     self.flag = infos.get("auto_login", 1)
     self.level = infos.get("vip_level", 0)
     if self.bduss:
         event_manager.emit("login-success")
     self.save()
 def SetLoginStatus(self, bduss, username, uid, flag, level):    
     self.bduss = bduss
     self.username = username
     self.uid = uid
     self.flag = flag
     self.level = level
     if self.bduss:
         event_manager.emit("login-success")
     self.save()    
 def SetLoginStatus2(self, infos):
     self.bduss = infos.get("bduss", "")
     self.uid = str(infos.get("user_id", ""))
     self.username = infos.get("user_name", "")
     self.flag = infos.get("auto_login", 1)
     self.level = infos.get("vip_level", 0)
     if self.bduss:
         event_manager.emit("login-success")
     self.save()
 def update_listview(self, widget, state):
     if state == "bottom":
         if self.page_index < self.page_count - 1:
             self.page_index = self.page_index + 1
             
             items = self.paged_items[self.page_index]
             self.listview.add_items(items)
             
             event_manager.emit("listview-items-added", items)
 def SetLoginStatus(self, bduss, username, uid, flag, level):
     print "login_type"
     self.bduss = bduss
     self.username = username
     self.uid = uid
     self.flag = flag
     self.level = level
     if self.bduss:
         event_manager.emit("login-success")
     self.save()
    def __init__(self, data_or_title, list_type, has_separator=False):
        TreeItem.__init__(self)

        self.column_index = 0
        self.side_padding = 5
        self.is_highlight = False
        self.padding_y = 0
        self.padding_x = 8
        self.list_type = list_type

        if isinstance(data_or_title, basestring):
            self.title = data_or_title
            self.data = dict()
        else:
            self.title = data_or_title.get("title", "")
            self.data = data_or_title

        self.data = data_or_title
        self.has_separator = has_separator
        self.separator_height = 4
        self.item_width = CATEGROYLIST_WIDTH
        self.item_height = 26 + self.separator_height if has_separator else 26
        self.init_pixbufs()

        self.song_view = MusicView(view_type=list_type, data=self.data)
        # self.song_view.connect("begin-add-items", self.on_songview_begin_add_items)
        # self.song_view.connect("empty-items", self.on_songview_empty_items)
        self.song_view.set_size_request(PLAYLIST_WIDTH, -1)

        event_manager.connect("login-success", self.on_event_login_success)

        self.login_box = LoginBox(
            lambda w: event_manager.emit("login-dialog-run"))
        self.main_box = gtk.VBox()
    def __init__(self, data_or_title, list_type, has_separator=False):
        TreeItem.__init__(self)
        
        self.column_index = 0
        self.side_padding = 5
        self.is_highlight = False        
        self.padding_y = 0
        self.padding_x = 8
        self.list_type = list_type        
        
        if isinstance(data_or_title, basestring):
            self.title = data_or_title
            self.data = dict()
        else:    
            self.title = data_or_title.get("title", "")
            self.data = data_or_title
            
        self.data = data_or_title
        self.has_separator = has_separator        
        self.separator_height = 4
        self.item_width = CATEGROYLIST_WIDTH
        self.item_height = 26 + self.separator_height if has_separator else 26
        self.init_pixbufs()

        self.song_view = MusicView(view_type=list_type, data=self.data)
        # self.song_view.connect("begin-add-items", self.on_songview_begin_add_items)
        # self.song_view.connect("empty-items", self.on_songview_empty_items)
        self.song_view.set_size_request(PLAYLIST_WIDTH, -1)
        
        event_manager.connect("login-success", self.on_event_login_success)
        
        self.login_box = LoginBox(lambda w: event_manager.emit("login-dialog-run"))
        self.main_box = gtk.VBox()
Esempio n. 8
0
 def on_music_view_delete_select_items(self, widget, items):        
     if not items:
         return
     
     sids = self.get_sids(items)
     
     if self.view_type == self.COLLECT_TYPE:
         bplayer.del_collect_song(sids)
             
     elif self.view_type == self.PLAYLIST_TYPE:        
         bplayer.del_list_song(self.list_id, sids)
         
     elif self.view_type == self.DEFAULT_TYPE:
         self.save()    
         
     elif self.view_type == self.LOCAL_TYPE:    
         event_manager.emit("save-listen-lists")
    def init_listview(self):
        '''
        docs
        '''
        items = self.paged_items[self.page_index]

        self.listview = TreeView(items)
        self.listview.draw_mask = self.on_listview_draw_mask
        self.listview.set_expand_column(0)
        
        if self.owner == "detail":
            self.listview.set_column_titles([_("Content of messages"), _("Time")],
                                            [self.sort_by_content, self.sort_by_time])
        
        self.listview.draw_area.connect_after("button-press-event", self.on_listview_button_pressed, self.listview)
        self.listview.draw_area.connect_after("motion-notify-event", self.on_listview_motion_notify, self.listview)
        self.listview.connect("right-press-items", self.on_listview_right_press_items)
        self.listview.scrolled_window.connect("vscrollbar-state-changed", self.update_listview)
        
        event_manager.emit("listview-items-added", items)
Esempio n. 10
0
    def on_button_press_event(self, widget, event):
        if is_in_rect((event.x, event.y),
                      (self.close_rect.x, self.close_rect.y,
                       self.close_rect.width, self.close_rect.height)):
            gobject.source_remove(self.timeout_id)
            self.destroy()
            event_manager.emit("manual-cancelled", self)
            return

        for index, rect in enumerate(self.pointer_hand_rectangles):
            if is_in_rect((event.x, event.y), rect):
                action = self.notification["hints"]["x-deepin-hyperlinks"][index]
                if action.has_key("href"):
                    webbrowser.open_new_tab(action.get("href"))
                return

        for index, rect in enumerate(self.action_button_areas):
            if is_in_rect((event.x, event.y), rect):
                for i, action_key in enumerate(self.action_dict):
                    if i == index:
                        event_manager.emit("action-invoked", (self.notification.id, action_key))
                        gobject.source_remove(self.timeout_id)
                        self.destroy()
                        event_manager.emit("manual-cancelled", self)
                        return

        rect = widget.allocation
        if is_in_rect((event.x, event.y),
                      (rect.x, rect.y, APP_ICON_WIDTH, self.window_height)):
            self.open_source_software()
Esempio n. 11
0
 def play_song(self, song, play=False):    
     if not song: return None        
     
     # update song info
     self.update_songitem(song)
     
     # clear current select status
     del self.select_rows[:]
     self.queue_draw()
         
     # set item highlight
     self.set_highlight_song(song)
     
     if play:
         # play song now
         Player.play_new(song)
         
         # set self as current global playlist
         self.set_current_source()
         
         event_manager.emit("save-playlist-status")
     return song    
Esempio n. 12
0
 def add_songs(self, songs, pos=None, sort=False, play=False):    
     if not songs:
         return
     
     if not isinstance(songs, (list, tuple, set)):
         songs = [ songs ]
         
     song_items = [ SongItem(song) for song in songs if song not in self.get_songs() ]
     
     if song_items:
         if not self.items:
             self.emit_add_signal()
         self.add_items(song_items, pos, False)
         
         # save songs
         if self.view_type == self.DEFAULT_TYPE:
             self.save()
         if self.view_type == self.LOCAL_TYPE:    
             event_manager.emit("save-listen-lists")
         
     if len(songs) >= 1 and play:
         song = songs[0]
         self.request_song(song, play=True)
 def PlayMVs(self, e):
     self.mv_songs = e
     #print "MV 数据: " + e
     event_manager.emit("play-mv", e)
 def FavoriteSongs(self, dummy_songs):
     songs = self.parse_dummy_songs(dummy_songs)
     if songs:
         event_manager.emit("collect-songs", songs)
 def PlaySongs(self, dummy_songs):
     songs = self.parse_dummy_songs(dummy_songs)
     if songs:
         event_manager.emit("play-songs", songs)
 def AddSongs(self, dummy_songs):
     ''' '''
     songs = self.parse_dummy_songs(dummy_songs)
     if songs:
         event_manager.emit("add-songs", songs)
 def AddSongs(self, dummy_songs):
     ''' '''
     songs = self.parse_dummy_songs(dummy_songs)
     if songs:
         event_manager.emit("add-songs", songs)
 def Login(self):
     event_manager.emit("login-dialog-run")
 def PlaySongs(self, dummy_songs):
     songs = self.parse_dummy_songs(dummy_songs)
     if songs:
         event_manager.emit("play-songs", songs)
 def inner(*args, **kwargs):
     if bplayer.is_login:
         return func(*args, **kwargs)
     else:
         event_manager.emit("login-dialog-run")
Esempio n. 21
0
 def destroy_animation_complete(self, source):
     event_manager.emit("bubble-destroy", self)
 def FavoriteSongs(self, dummy_songs):
     songs = self.parse_dummy_songs(dummy_songs)
     if songs:
         event_manager.emit("collect-songs", songs)
 def inner(*args, **kwargs):
     if bplayer.is_login:
         return func(*args, **kwargs)
     else:
         event_manager.emit("login-dialog-run")
 def Login(self):
     event_manager.emit("login-dialog-run")