本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例9: information_cb
def information_cb(menu_item):
parent = get_menu_item_top_parent(menu_item)
window = Information(librarian, songs, parent)
window.show()
示例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()
示例11: trash_cb
def trash_cb(item):
parent = get_menu_item_top_parent(item)
trash_songs(parent, songs, librarian)
示例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)
示例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)
示例14: plugin_window
def plugin_window(self):
return get_menu_item_top_parent(self)
示例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)