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


Python qltk.get_menu_item_top_parent函数代码示例

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


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

示例1: test_get_menu_item_top_parent

 def test_get_menu_item_top_parent(self):
     item = Gtk.MenuItem()
     menu = Gtk.Menu()
     menu.append(item)
     window = Gtk.Window()
     menu.attach_to_widget(window, None)
     self.assertEqual(qltk.get_menu_item_top_parent(item), window)
开发者ID:Konzertheld,项目名称:quodlibet,代码行数:7,代码来源:test_qltk___init__.py

示例2: _on_new_playlist_activate

 def _on_new_playlist_activate(self, item, songs):
     parent = get_menu_item_top_parent(item)
     title = Playlist.suggested_name_for(songs)
     title = GetPlaylistName(qltk.get_top_parent(parent)).run(title)
     if title is None:
         return
     playlist = FileBackedPlaylist.new(PLAYLISTS, title)
     playlist.extend(songs)
     PlaylistsBrowser.changed(playlist)
开发者ID:achadwick,项目名称:quodlibet,代码行数:9,代码来源:menu.py

示例3: _on_new_playlist_activate

 def _on_new_playlist_activate(self, item, songs):
     parent = get_menu_item_top_parent(item)
     title = Playlist.suggested_name_for(songs)
     title = self._get_new_name(parent, title)
     if title is None:
         return
     playlist = FileBackedPlaylist.new(PLAYLISTS, title,
                                       library=self.librarian)
     playlist.extend(songs)
     self._emit_new(playlist)
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:10,代码来源:menu.py

示例4: set_rating

 def set_rating(self, value, songs, librarian):
     count = len(songs)
     if (count > 1 and
             config.getboolean("browsers", "rating_confirm_multiple")):
         parent = qltk.get_menu_item_top_parent(self)
         dialog = ConfirmRateMultipleDialog(
             parent, _("Change _Rating"), count, value)
         if dialog.run() != Gtk.ResponseType.YES:
             return
     for song in songs:
         song["~#rating"] = value
     librarian.changed(songs)
开发者ID:hongquan,项目名称:quodlibet,代码行数:12,代码来源:ratingsmenu.py

示例5: remove_rating

 def remove_rating(self, songs, librarian):
     count = len(songs)
     if (count > 1 and
             config.getboolean("browsers", "rating_confirm_multiple")):
         parent = qltk.get_menu_item_top_parent(self)
         dialog = ConfirmRateMultipleDialog(
             parent, _("_Remove Rating"), count, None)
         if dialog.run() != Gtk.ResponseType.YES:
             return
     reset = []
     for song in songs:
         if "~#rating" in song:
             del song["~#rating"]
             reset.append(song)
     librarian.changed(reset)
开发者ID:hongquan,项目名称:quodlibet,代码行数:15,代码来源:ratingsmenu.py

示例6: _on_toggle_playlist_activate

    def _on_toggle_playlist_activate(self, item, playlist, songs):
        parent = get_menu_item_top_parent(item)

        has_some, has_all = playlist.has_songs(songs)
        if has_all:
            playlist.remove_songs(songs)
        elif has_some:
            resp = ConfirmMultipleSongsAction(parent, playlist, songs).run()
            if resp == ConfirmMultipleSongsAction.REMOVE:
                playlist.remove_songs(songs)
            elif resp == ConfirmMultipleSongsAction.ADD:
                playlist.extend(songs)
            return
        else:
            playlist.extend(songs)
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:15,代码来源:menu.py

示例7: _on_new_playlist_activate

    def _on_new_playlist_activate(self, item, songs):
        parent = get_menu_item_top_parent(item)

        if len(songs) == 1:
            title = songs[0].comma("title")
        else:
            title = ngettext(
                "%(title)s and %(count)d more",
                "%(title)s and %(count)d more",
                len(songs) - 1) % {
                    'title': songs[0].comma("title"),
                    'count': len(songs) - 1
                }
        title = GetPlaylistName(qltk.get_top_parent(parent)).run(title)
        if title is None:
            return
        playlist = Playlist.new(PLAYLISTS, title)
        playlist.extend(songs)
        PlaylistsBrowser.changed(playlist)
开发者ID:mistotebe,项目名称:quodlibet,代码行数:19,代码来源:menu.py

示例8: __on_activate

 def __on_activate(self, item, plugin, library, browser, playlists):
     parent = get_menu_item_top_parent(item)
     self.__handle(plugin, library, browser, playlists, parent)
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:3,代码来源:playlist.py

示例9: information_cb

 def information_cb(menu_item):
     parent = get_menu_item_top_parent(menu_item)
     window = Information(librarian, songs, parent)
     window.show()
开发者ID:bp0,项目名称:quodlibet,代码行数:4,代码来源:songsmenu.py

示例10: song_properties_cb

 def song_properties_cb(menu_item):
     parent = get_menu_item_top_parent(menu_item)
     window = SongProperties(librarian, songs, parent)
     window.show()
开发者ID:bp0,项目名称:quodlibet,代码行数:4,代码来源:songsmenu.py

示例11: trash_cb

 def trash_cb(item):
     parent = get_menu_item_top_parent(item)
     trash_songs(parent, songs, librarian)
开发者ID:bp0,项目名称:quodlibet,代码行数:3,代码来源:songsmenu.py

示例12: __on_activate

 def __on_activate(self, item, plugin, library, songs):
     parent = get_menu_item_top_parent(item)
     self.__handle(item, plugin, library, songs, parent)
开发者ID:bp0,项目名称:quodlibet,代码行数:3,代码来源:songsmenu.py

示例13: test_get_menu_item_top_parent_unattached

 def test_get_menu_item_top_parent_unattached(self):
     item = Gtk.MenuItem()
     menu = Gtk.Menu()
     menu.append(item)
     self.assertTrue(qltk.get_menu_item_top_parent(item) is None)
开发者ID:Konzertheld,项目名称:quodlibet,代码行数:5,代码来源:test_qltk___init__.py

示例14: plugin_window

 def plugin_window(self):
     return get_menu_item_top_parent(self)
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:2,代码来源:gui.py

示例15: remove_cb

 def remove_cb(item, songs, library):
     parent = get_menu_item_top_parent(item)
     if self._confirm_song_removal(parent, songs):
         library.remove(songs)
开发者ID:zsau,项目名称:quodlibet,代码行数:4,代码来源:songsmenu.py


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