本文整理汇总了Python中foobnix.helpers.menu.Popup.add_item方法的典型用法代码示例。如果您正苦于以下问题:Python Popup.add_item方法的具体用法?Python Popup.add_item怎么用?Python Popup.add_item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类foobnix.helpers.menu.Popup
的用法示例。
在下文中一共展示了Popup.add_item方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from foobnix.helpers.menu import Popup [as 别名]
# 或者: from foobnix.helpers.menu.Popup import add_item [as 别名]
def __init__(self, controls):
FControl.__init__(self, controls)
gtk.HBox.__init__(self, False, 0)
self.old_menu = MenuBarWidget(controls)
self.pack_start(self.old_menu.widget, False, False)
self.new_menu_button = ImageButton(gtk.STOCK_PREFERENCES)
self.new_menu_button.connect("button-press-event", self.on_button_press)
self.pack_start(self.new_menu_button, False, False)
self.pack_start(controls.playback, False, False)
self.pack_start(controls.os, False, False)
self.pack_start(controls.volume, False, False)
self.pack_start(gtk.SeparatorToolItem(), False, False)
self.pack_start(controls.seek_bar, True, True)
self.show_all()
"""menu init"""
menu = Popup()
decorator = MenuStyleDecorator()
MenuBarWidget(self.controls, menu)
menu.add_separator()
menu.add_item(_("Preferences"), gtk.STOCK_PREFERENCES, self.controls.show_preferences)
menu.add_separator()
menu.add_item(_("Quit"), gtk.STOCK_QUIT, self.controls.quit)
decorator.apply(menu)
self.menu = menu
示例2: on_button_press
# 需要导入模块: from foobnix.helpers.menu import Popup [as 别名]
# 或者: from foobnix.helpers.menu.Popup import add_item [as 别名]
def on_button_press(self, w, e):
if is_empty_click(w, e):
w.get_selection().unselect_all()
if is_double_left_click(e):
selected = self.get_selected_bean()
beans = self.get_all_child_beans_by_selected()
self.controls.notetabs._append_tab(selected.text, [selected] + beans, optimization=True)
self.controls.play_first_file_in_playlist()
if is_rigth_click(e):
right_click_optimization_for_trees(w, e)
menu = Popup()
menu.add_item(_("Add playlist"), gtk.STOCK_ADD, self.create_playlist, None)
bean = self.get_selected_bean()
if bean:
if bean.is_file:
menu.add_item(_("Rename"), gtk.STOCK_EDIT, self.rename_selected, None)
menu.add_item(_("Delete"), gtk.STOCK_DELETE, self.delete_selected, None)
else:
menu.add_item(_("Rename playlist"), gtk.STOCK_EDIT, self.rename_selected, None)
menu.add_item(_("Delete playlist"), gtk.STOCK_DELETE, self.delete_selected, None)
#menu.add_item(_("Save as"), gtk.STOCK_SAVE_AS, None, None)
#menu.add_item(_("Open as"), gtk.STOCK_OPEN, None, None)
menu.show(e)
示例3: on_button_press
# 需要导入模块: from foobnix.helpers.menu import Popup [as 别名]
# 或者: from foobnix.helpers.menu.Popup import add_item [as 别名]
def on_button_press(self, w, e):
if is_empty_click(w, e):
w.get_selection().unselect_all()
active = self.get_selected_bean()
if active:
active.type = FTYPE_NOT_UPDATE_INFO_PANEL
else:
return None
if is_left_click(e):
if active.get_status():
if active.get_status() == DOWNLOAD_STATUS_ALL:
self.controls.dm.filter(None, FTreeModel().status[0])
else:
self.controls.dm.filter(active.get_status(), FTreeModel().status[0])
if is_double_left_click(e):
self.controls.play(active)
if is_rigth_click(e):
right_click_optimization_for_trees(w, e)
menu = Popup()
menu.add_item('Play', gtk.STOCK_MEDIA_PLAY, self.controls.play, active)
menu.add_item('Copy to Search Line', gtk.STOCK_COPY, self.controls.searchPanel.set_search_text, active.text)
menu.show(e)
示例4: on_button_press
# 需要导入模块: from foobnix.helpers.menu import Popup [as 别名]
# 或者: from foobnix.helpers.menu.Popup import add_item [as 别名]
def on_button_press(self, w, e):
active = self.get_selected_bean()
if is_rigth_click(e):
menu = Popup()
menu.add_item(_('Play'), gtk.STOCK_MEDIA_PLAY, self.controls.play, active)
menu.add_item(_('Copy to Search Line'), gtk.STOCK_COPY, self.controls.searchPanel.set_search_text, active.text)
menu.show(e)
示例5: __init__
# 需要导入模块: from foobnix.helpers.menu import Popup [as 别名]
# 或者: from foobnix.helpers.menu.Popup import add_item [as 别名]
def __init__(self, controls):
FControl.__init__(self, controls)
Gtk.HBox.__init__(self, False, 0)
self.old_menu = MenuBarWidget(controls)
self.pack_start(self.old_menu.widget, False, False, 0)
self.new_menu_button = ImageButton("preferences-system", tooltip_text=_("Settings"))
self.new_menu_button.connect("button-press-event", self.on_button_press)
self.pack_start(self.new_menu_button, False, False, 0)
self.pack_start(controls.playback, False, False, 0)
self.pack_start(controls.os, False, False, 0)
self.pack_start(controls.volume, False, False, 0)
self.pack_start(Gtk.SeparatorToolItem.new(), False, False, 0)
self.pack_start(controls.record, False, False, 0)
self.pack_start(controls.seek_bar, True, True, 0)
"""menu init"""
menu = Popup()
decorator = MenuStyleDecorator()
MenuBarWidget(self.controls, menu)
menu.add_separator()
menu.add_item(_("Preferences"), "preferences-system", self.controls.show_preferences)
menu.add_separator()
menu.add_item(_("Quit"), "application-exit", self.controls.quit)
decorator.apply(menu)
self.menu = menu
示例6: LastFmIntegrationControls
# 需要导入模块: from foobnix.helpers.menu import Popup [as 别名]
# 或者: from foobnix.helpers.menu.Popup import add_item [as 别名]
class LastFmIntegrationControls(CommonTreeControl):
def __init__(self, controls):
CommonTreeControl.__init__(self, controls)
"""column config"""
column = Gtk.TreeViewColumn(_("Lasm.fm Integration ") + FCBase().lfm_login,
self.ellipsize_render, text=self.text[0], font=self.font[0])
column.set_resizable(True)
self.set_headers_visible(True)
self.append_column(column)
self.tree_menu = Popup()
self.configure_send_drag()
self.configure_recive_drag()
self.set_type_tree()
self.services = {_("My recommendations"): self.controls.lastfm_service.get_recommended_artists,
_("My loved tracks"): self.controls.lastfm_service.get_loved_tracks,
_("My top tracks"): self.controls.lastfm_service.get_top_tracks,
_("My recent tracks"): self.controls.lastfm_service.get_recent_tracks,
_("My top artists"): self.controls.lastfm_service.get_top_artists,
_("My events"): self.controls.lastfm_service.get_events,
_("My friends"): self.controls.lastfm_service.get_friends,
_("My neighbours"): self.controls.lastfm_service.get_neighbours
}
for name in self.services:
parent = FModel(name)
bean = FDModel(_("loading...")).parent(parent).add_is_file(True)
self.append(parent)
self.append(bean)
def on_button_press(self, w, e):
if is_empty_click(w, e):
w.get_selection().unselect_all()
if is_rigth_click(e):
right_click_optimization_for_trees(w, e)
active = self.get_selected_bean()
self.tree_menu.clear()
self.tree_menu.add_item(_('Play'), "media-playback-start", self.controls.play, active)
self.tree_menu.add_item(_('Copy to Search Line'), "edit-copy",
self.controls.searchPanel.set_search_text, active.text)
self.tree_menu.show(e)
def on_bean_expanded(self, parent):
logging.debug("expanded %s" % parent)
def task():
old_iters = self.get_child_iters_by_parent(self.model, self.get_iter_from_bean(parent))
childs = self.services[parent.text](FCBase().lfm_login, str(int(FC().search_limit)))
update_parent_for_beans(childs, parent)
self.append_all(childs)
GLib.idle_add(self.remove_iters, old_iters)
self.controls.in_thread.run_with_spinner(task)
示例7: on_button_press
# 需要导入模块: from foobnix.helpers.menu import Popup [as 别名]
# 或者: from foobnix.helpers.menu.Popup import add_item [as 别名]
def on_button_press(self, w, e):
if is_empty_click(w, e):
w.get_selection().unselect_all()
if is_rigth_click(e):
right_click_optimization_for_trees(w, e)
active = self.get_selected_bean()
menu = Popup()
menu.add_item(_('Play'), gtk.STOCK_MEDIA_PLAY, self.controls.play, active)
menu.add_item(_('Copy to Search Line'), gtk.STOCK_COPY, self.controls.searchPanel.set_search_text, active.text)
menu.show(e)
示例8: on_button_press
# 需要导入模块: from foobnix.helpers.menu import Popup [as 别名]
# 或者: from foobnix.helpers.menu.Popup import add_item [as 别名]
def on_button_press(self, w, e):
logging.debug("on dm button release")
if is_rigth_click(e):
menu = Popup()
try:
if self.get_selected_bean():
menu.add_item(_("Open in file manager"), None, open_in_filemanager, self.get_selected_bean().path)
else:
menu.add_item(_("Open in file manager"), None, open_in_filemanager, FC().online_save_to_folder)
except Exception, e:
logging.error(e)
menu.show(e)
示例9: on_button_press
# 需要导入模块: from foobnix.helpers.menu import Popup [as 别名]
# 或者: from foobnix.helpers.menu.Popup import add_item [as 别名]
def on_button_press(self, w, e):
logging.debug("on dm button press")
if is_empty_click(w, e):
w.get_selection().unselect_all()
if is_rigth_click(e):
right_click_optimization_for_trees(w, e)
try:
menu = Popup()
if self.get_selected_bean():
menu.add_item(_("Open in file manager"), None, open_in_filemanager, self.get_selected_bean().path)
else:
menu.add_item(_("Open in file manager"), None, open_in_filemanager, FC().online_save_to_folder)
menu.show(e)
except Exception, e:
logging.error(e)
示例10: on_button_press
# 需要导入模块: from foobnix.helpers.menu import Popup [as 别名]
# 或者: from foobnix.helpers.menu.Popup import add_item [as 别名]
def on_button_press(self, w, e):
active = self.get_selected_bean()
if active and is_rigth_click(e):
menu = Popup()
menu.add_item(_('Play'), gtk.STOCK_MEDIA_PLAY, self.controls.play, active)
menu.add_item(_('Copy to Search Line'), gtk.STOCK_COPY, self.controls.searchPanel.set_search_text, active.text)
menu.show(e)
if is_double_left_click(e):
selected = self.get_selected_bean()
beans = self.get_all_child_beans_by_selected()
self.controls.notetabs._append_tab(selected.text, [selected] + beans, optimization=True)
"run radio channel"
self.controls.play_first_file_in_playlist()
示例11: on_button_press
# 需要导入模块: from foobnix.helpers.menu import Popup [as 别名]
# 或者: from foobnix.helpers.menu.Popup import add_item [as 别名]
def on_button_press(self, w, e):
self.controls.notetabs.set_active_tree(self)
if is_double_left_click(e):
self.controls.play_selected_song()
if is_rigth_click(e):
menu = Popup()
menu.add_item(_("Play"), gtk.STOCK_MEDIA_PLAY, self.controls.play_selected_song, None)
menu.add_item(_("Download"), gtk.STOCK_ADD, self.controls.dm.append_tasks, self.get_all_selected_beans())
# menu.add_item('Save as', gtk.STOCK_SAVE_AS, self.controls.save_beans_to, self.get_all_selected_beans())
menu.add_separator()
path = self.get_selected_bean().path
menu.add_item(_("Edit tags"), gtk.STOCK_EDIT, edit_tags, path)
text = self.get_selected_bean().text
menu.add_item(_("Copy to Search Line"), gtk.STOCK_COPY, self.controls.searchPanel.set_search_text, text)
menu.show(e)
示例12: __init__
# 需要导入模块: from foobnix.helpers.menu import Popup [as 别名]
# 或者: from foobnix.helpers.menu.Popup import add_item [as 别名]
def __init__(self, controls):
FControl.__init__(self, controls)
Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
self.old_menu = MenuBarWidget(controls)
self.pack_start(self.old_menu.widget, False, False, 0)
menu_icon = "open-menu"
if not icon_exists("open-menu"):
menu_icon = "open-menu-symbolic"
if not icon_exists("open-menu-symbolic"):
menu_icon = "application-menu"
self.new_menu_button = ImageButton(menu_icon, tooltip_text=_("Menu"))
self.new_menu_button.connect("button-press-event", self.on_button_press)
self.pack_start(self.new_menu_button, False, False, 0)
self.pack_start(controls.playback, False, False, 0)
self.pack_start(controls.os, False, False, 0)
self.pack_start(controls.volume, False, False, 0)
self.pack_start(Gtk.SeparatorToolItem.new(), False, False, 0)
self.pack_start(controls.record, False, False, 0)
self.pack_start(controls.seek_bar, True, True, 0)
"""menu init"""
menu = Popup()
decorator = MenuStyleDecorator()
MenuBarWidget(self.controls, menu)
menu.add_separator()
pref_icon = "gtk-preferences" if icon_exists("gtk-preferences") else "preferences-system"
menu.add_item(_("Preferences"), pref_icon, self.controls.show_preferences)
menu.add_separator()
menu.add_item(_("Quit"), "application-exit", self.controls.quit)
decorator.apply(menu)
self.menu = menu
示例13: on_button_press
# 需要导入模块: from foobnix.helpers.menu import Popup [as 别名]
# 或者: from foobnix.helpers.menu.Popup import add_item [as 别名]
def on_button_press(self, w, e):
if is_double_left_click(e):
selected = self.get_selected_bean()
beans = self.get_all_child_beans_by_selected()
self.controls.append_to_new_notebook(selected.text, [selected] + beans)
"run radio channel"
self.controls.play_first_file_in_playlist()
if is_rigth_click(e):
menu = Popup()
menu.add_item(_("Add Station"), gtk.STOCK_ADD, self.on_add_station, None)
menu.add_item(_("Delete Station"), gtk.STOCK_DELETE, self.on_delete_station, None)
menu.add_item(_("Edit Radio"), gtk.STOCK_EDIT, self.on_edit_radio, None)
menu.add_separator()
menu.add_item(_("Reload radio folder"), gtk.STOCK_REFRESH, self.update_radio_tree, None)
menu.show(e)
示例14: on_button_press
# 需要导入模块: from foobnix.helpers.menu import Popup [as 别名]
# 或者: from foobnix.helpers.menu.Popup import add_item [as 别名]
def on_button_press(self, w, e):
if is_double_left_click(e):
selected = self.get_selected_bean()
beans = self.get_all_child_beans_by_selected()
self.controls.notetabs._append_tab(selected.text, [selected] + beans, optimization=True)
"run radio channel"
self.controls.play_first_file_in_playlist()
if is_rigth_click(e):
right_click_optimization_for_trees(w, e)
menu = Popup()
bean = self.get_selected_bean()
if bean:
if self.get_selected_bean().is_file:
menu.add_item(_("Edit Station"), gtk.STOCK_EDIT, self.on_edit_radio, None)
menu.add_item(_("Delete Station"), gtk.STOCK_DELETE, self.delete_selected, None)
else:
menu.add_item(_("Rename Group"), gtk.STOCK_EDIT, self.on_rename_group, None)
menu.add_item(_("Delete Group"), gtk.STOCK_DELETE, self.delete_selected, None)
menu.add_separator()
menu.add_item(_("Reload radio folder"), gtk.STOCK_REFRESH, self.update_radio_tree, None)
menu.show(e)
示例15: on_button_press
# 需要导入模块: from foobnix.helpers.menu import Popup [as 别名]
# 或者: from foobnix.helpers.menu.Popup import add_item [as 别名]
def on_button_press(self, w, e):
if is_double_left_click(e):
selected = self.get_selected_bean()
beans = self.get_all_child_beans_by_selected()
self.controls.append_to_new_notebook(selected.text, [selected] + beans)
if is_rigth_click(e):
menu = Popup()
menu.add_item(_("Add playlist"), gtk.STOCK_ADD, self.create_playlist, None)
menu.add_item(_("Rename playlist"), gtk.STOCK_EDIT, self.rename_playlist, None)
menu.add_item(_("Delete playlist"), gtk.STOCK_DELETE, self.delete_playlist, None)
#menu.add_item(_("Save as"), gtk.STOCK_SAVE_AS, None, None)
#menu.add_item(_("Open as"), gtk.STOCK_OPEN, None, None)
menu.show(e)