当前位置: 首页>>代码示例>>Python>>正文


Python event_manager.emit函数代码示例

本文整理汇总了Python中netease_events.event_manager.emit函数的典型用法代码示例。如果您正苦于以下问题:Python emit函数的具体用法?Python emit怎么用?Python emit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了emit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle_login_dialog_status

    def handle_login_dialog_status(self, *kwargs):
        # When load finished
        if str(self.webview.get_load_status()) == "<enum WEBKIT_LOAD_FINISHED of type WebKitLoadStatus>":
            # Show current URL in terminal
            url = self.webview.get_property('uri')
            print "current url>>> ", url

            # Hide an element
            if 'https://api.weibo.com/oauth2/authorize' in url:
                self.webview.execute_script('document.getElementsByClassName("WB_btn_pass")[0].style.display="None"')

            elif 'http://music.163.com/back/weibo?error' in url:
                self.close()
            elif 'http://music.163.com/back/weibo?state=' in url:
                # load cookie
                cookie = {}
                with open(get_cookie_file(), 'r') as f:
                    for line in f.readlines():
                        if "music.163.com" in line:
                            line = line.split()
                            cookie[line[5]] = line[6]
                nplayer.cookies = cookie
                nplayer.save_cookie(cookie)
                print 'login-success emit from LoginDialog'
                event_manager.emit("login-success")
                self.close()
开发者ID:legendtang,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:26,代码来源:netease_music_browser.py

示例2: delete_from_list

 def delete_from_list(self, sids, playlist_id=0):
     if playlist_id and nplayer.delete_from_onlinelist(sids, playlist_id):
         event_manager.emit('refresh-online-list', playlist_id)
     elif not playlist_id:
         self.delete_items([item for item in self.items
             if item.get_song()['id'] in sids])
         event_manager.emit('save-playing-status')
开发者ID:C2python,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:7,代码来源:netease_music_view.py

示例3: add_to_list

 def add_to_list(self, sids, playlist_id=0):
     if playlist_id and nplayer.add_to_onlinelist(sids, playlist_id):
         event_manager.emit("refresh-online-list", playlist_id)
     elif not playlist_id:
         event_manager.emit(
             "add-songs-to-playing-list", ([song for song in self.get_songs() if song["id"] in sids], False)
         )
开发者ID:jinagko,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:7,代码来源:netease_music_view.py

示例4: add_songs

    def add_songs(self, songs, pos=None, sort=False, play=False):
        if not songs:
            return

        try:
            song_items = [
                SongItem(song)
                for song in songs
                if song["id"] not in [exists_song["id"] for exists_song in self.get_songs()]
            ]
        except:
            song_items = [
                SongItem(Song(song))
                for song in songs
                if song not in [exists_song["id"] for exists_song in self.get_songs()]
            ]

        if song_items:
            if not self.items:
                self.emit_add_signal()
            self.add_items(song_items, pos, False)
            event_manager.emit("save-playing-status")

        if len(songs) >= 1 and play:
            song = songs[0]
            self.request_song(song, play=True)
开发者ID:jinagko,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:26,代码来源:netease_music_view.py

示例5: SetLoginStatus

 def SetLoginStatus(self, cookie, username, uid):
     print "login_type"
     self.cookie = cookie
     self.username = username
     self.uid = uid
     if self.cookie:
         event_manager.emit("login-success")
     self.save()
开发者ID:legendtang,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:8,代码来源:netease_music_player.py

示例6: render_onlinelist_songs

    def render_onlinelist_songs(self, songs, thread_id):
        if songs and self.view_type == self.FAVORITE_LIST_TYPE:
            event_manager.emit("favorite-list-refreshed", songs)
        if self.onlinelist_thread_id != thread_id:
            return

        if songs:
            self.add_songs([Song(song) for song in songs])
开发者ID:jinagko,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:8,代码来源:netease_music_view.py

示例7: fm_trash

 def fm_trash(self, current_item):
     if nplayer.fm_trash(current_item.get_song()["id"]):
         event_manager.emit("refresh-favorite-list")
         if self.highlight_item == current_item:
             next_song = self.get_next_song()
             self.delete_items([current_item])
             self.request_song(next_song)
         else:
             self.delete_items([current_item])
             self.pre_fetch_fm_songs()
开发者ID:jinagko,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:10,代码来源:netease_music_view.py

示例8: add_fm

    def add_fm(self, songs, pos=None, sort=False, play=False):
        song_items = [SongItem(song) for song in songs]
        if song_items:
            if not self.items:
                self.emit_add_signal()
            self.add_items(song_items, pos, False)
            event_manager.emit("save-playing-status")

        if len(songs) >= 1 and play:
            song = songs[0]
            self.request_song(song, play=True)
开发者ID:jinagko,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:11,代码来源:netease_music_view.py

示例9: play_song

    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
开发者ID:quyf,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:22,代码来源:netease_music_view.py

示例10: __init__

    def __init__(self, list_data, is_online_list=False, is_login_item=False):
        TreeItem.__init__(self)

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

        if isinstance(list_data, basestring):
            self.title = list_data
            self.data = dict()
            self.list_type = self.PLAYING_LIST_TYPE
        else:
            self.title = list_data.get("name", "")
            self.data = list_data
            #self.list_id = list_data.get('id', '')

        self.data = list_data
        if is_online_list:
            if self.data['specialType'] == 5:
                self.list_type = self.FAVORITE_LIST_TYPE
            elif self.data['subscribed']:
                self.list_type = self.COLLECTED_LIST_TYPE
            else:
                self.list_type = self.CREATED_LIST_TYPE
        else:
            self.list_type = self.PLAYING_LIST_TYPE
        if is_login_item:
            self.list_type = self.LOGIN_LIST_TYPE
        self.has_separator = 1
        self.separator_height = 4
        self.item_width = CATEGROYLIST_WIDTH
        self.item_height = 26 + self.separator_height if self.has_separator else 26
        self.init_pixbufs()

        self.song_view = MusicView(data=self.data, view_type=self.list_type)
        self.song_view.set_size_request(PLAYLIST_WIDTH, -1)

        if is_login_item:
            self.login_box = LoginBox(lambda w:
                    event_manager.emit("login"))

            event_manager.connect("login", self.login)

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

        self.main_box = gtk.VBox()
开发者ID:Holdlen2DH,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:48,代码来源:netease_music_list_item.py

示例11: __init__

    def __init__(self, list_data, list_type, is_online_list=False,
            has_separator=True):
        TreeItem.__init__(self)

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

        if list_type and list_type in [self.PLAYING_LIST_TYPE,
                self.PERSONAL_FM_ITEM, self.LOGIN_LIST_TYPE]:
            self.title = list_data
        else:
            self.title = list_data.get("name", "")
        self.data = list_data
        self.list_type= list_type

        if is_online_list:
            if self.data['specialType'] == 5:
                self.list_type = self.FAVORITE_LIST_TYPE
            elif self.data['subscribed']:
                self.list_type = self.COLLECTED_LIST_TYPE
            else:
                self.list_type = self.CREATED_LIST_TYPE

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

        self.song_view = MusicView(data=self.data, view_type=self.list_type)
        self.song_view.set_size_request(PLAYLIST_WIDTH, -1)

        if self.list_type == self.LOGIN_LIST_TYPE:
            self.login_box = LoginBox(lambda w:
                    event_manager.emit("login"))

            event_manager.connect("login", self.login)

        self.main_box = gtk.VBox()
开发者ID:slimbloody,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:42,代码来源:netease_music_list_item.py

示例12: AddSongs

 def AddSongs(self, songs):
     if songs:
         event_manager.emit("add-songs", songs)
开发者ID:wu-nerd,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:3,代码来源:netease_music_player.py

示例13: add_to_list

 def add_to_list(self, sids, playlist_id=0):
     if playlist_id and nplayer.add_to_onlinelist(sids, playlist_id):
         event_manager.emit('refresh-online-list', playlist_id)
     elif not playlist_id:
         event_manager.emit('add-songs-to-playing-list',
                 (nplayer.songs_detail(sids), False))
开发者ID:EightWarning,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:6,代码来源:netease_music_browser.py

示例14: add_play_emit

 def add_play_emit(self, sids):
     songs = nplayer.songs_detail(sids)
     songs = [Song(song) for song in songs]
     event_manager.emit('add-songs-to-playing-list', (songs, True))
开发者ID:EightWarning,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:4,代码来源:netease_music_browser.py

示例15: subscribe_playlist

 def subscribe_playlist(self, current_item):
     if nplayer.subscribe_playlist(current_item.get_playlist_id):
         event_manager.emit('refresh-online-lists')
开发者ID:EightWarning,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:3,代码来源:netease_music_browser.py


注:本文中的netease_events.event_manager.emit函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。