本文整理汇总了Python中quodlibet.qltk.x.MenuItem.set_visible方法的典型用法代码示例。如果您正苦于以下问题:Python MenuItem.set_visible方法的具体用法?Python MenuItem.set_visible怎么用?Python MenuItem.set_visible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quodlibet.qltk.x.MenuItem
的用法示例。
在下文中一共展示了MenuItem.set_visible方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: IndicatorMenu
# 需要导入模块: from quodlibet.qltk.x import MenuItem [as 别名]
# 或者: from quodlibet.qltk.x.MenuItem import set_visible [as 别名]
#.........这里部分代码省略.........
browse = qltk.MenuItem(_("Open _Browser"), Icons.EDIT_FIND)
browse_sub = Gtk.Menu()
for Kind in browsers.browsers:
i = Gtk.MenuItem(label=Kind.accelerated_name, use_underline=True)
connect_obj(i,
'activate', LibraryBrowser.open, Kind, app.library, app.player)
browse_sub.append(i)
browse.set_submenu(browse_sub)
self._props = qltk.MenuItem(_("Edit _Tags"), Icons.DOCUMENT_PROPERTIES)
def on_properties(*args):
song = player.song
window = SongProperties(app.librarian, [song])
window.show()
self._props.connect('activate', on_properties)
self._info = MenuItem(_("_Information"), Icons.DIALOG_INFORMATION)
def on_information(*args):
song = player.song
window = Information(app.librarian, [song])
window.show()
self._info.connect('activate', on_information)
def set_rating(value):
song = player.song
song["~#rating"] = value
app.librarian.changed([song])
self._rating_item = rating = RatingsMenuItem([], app.library)
quit = MenuItem(_("_Quit"), Icons.APPLICATION_EXIT)
quit.connect('activate', lambda *x: app.quit())
if not show_item_bottom and show_item:
self.append(show_item)
self.append(SeparatorMenuItem())
self.append(self._play_item)
self.append(self._pause_item)
self.append(previous)
self.append(next)
self.append(SeparatorMenuItem())
self.append(shuffle)
self.append(repeat)
self.append(safter)
self.append(SeparatorMenuItem())
self.append(rating)
self.append(self._props)
self.append(self._info)
self.append(SeparatorMenuItem())
self.append(browse)
self.append(SeparatorMenuItem())
self.append(quit)
if show_item_bottom and show_item:
self.append(SeparatorMenuItem())
self.append(show_item)
self.show_all()
self.set_paused(True)
self.set_song(None)
def get_action_item(self):
"""Returns the 'Play' or 'Pause' action menu item (used for unity).
'action-item-changed' gets emitted if this changes.
"""
return self._action_item
def set_paused(self, paused):
"""Update the menu based on the player paused state"""
self._play_item.set_visible(paused)
self._pause_item.set_visible(not paused)
self._action_item = self._play_item if paused else self._pause_item
self.emit("action-item-changed")
def set_song(self, song):
"""Update the menu based on the passed song. Can be None.
This should be the persistent song and not a stream/info one.
"""
self._rating_item.set_sensitive(song is not None)
self._info.set_sensitive(song is not None)
self._props.set_sensitive(song is not None)
self._rating_item.set_songs([song])
def _on_play_pause(self, menuitem, player):
if player.song:
player.paused ^= True
else:
player.reset()