本文整理汇总了Python中foobnix.helpers.menu.Popup类的典型用法代码示例。如果您正苦于以下问题:Python Popup类的具体用法?Python Popup怎么用?Python Popup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Popup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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: __init__
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
示例3: __init__
def __init__(self, navigation):
self.navigation = navigation
CommonTreeControl.__init__(self, None)
self.set_reorderable(False)
self.set_headers_visible(True)
self.tree_menu = Popup()
"""column config"""
column = Gtk.TreeViewColumn(_("Name"), self.ellipsize_render, text=self.text[0])
column.set_resizable(True)
self.append_column(column)
"""column config"""
column = Gtk.TreeViewColumn(_("Progress"), Gtk.CellRendererProgress(), text=self.persent[0], value=self.persent[0])
column.set_resizable(True)
self.append_column(column)
"""column config"""
column = Gtk.TreeViewColumn(_("Size"), self.ellipsize_render, text=self.size[0])
column.set_resizable(True)
self.append_column(column)
"""status"""
column = Gtk.TreeViewColumn(_("Status"), self.ellipsize_render, text=self.status[0])
column.set_resizable(True)
self.append_column(column)
"""column config"""
column = Gtk.TreeViewColumn(_("Path"), self.ellipsize_render, text=self.save_to[0])
column.set_resizable(True)
column.set_expand(True)
self.append_column(column)
self.set_type_plain()
示例4: __init__
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 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)
示例5: LastFmIntegrationControls
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)
示例6: on_button_press
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)
示例7: on_button_press
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)
示例8: on_button_press
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)
示例9: on_button_press
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)
示例10: on_button_press
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)
示例11: __init__
def __init__(self, controls):
CommonTreeControl.__init__(self, controls)
self.set_reorderable(False)
self.switcher_label = _("My channels")
self.tree_menu = Popup()
"""column config"""
column = Gtk.TreeViewColumn(_("Radio Stations"), Gtk.CellRendererText(), text=self.text[0], font=self.font[0])
column.set_resizable(True)
self.set_headers_visible(True)
self.append_column(column)
self.configure_send_drag()
self.configure_recive_drag()
self.set_type_tree()
示例12: __init__
def __init__(self, controls):
CommonTreeControl.__init__(self, controls)
"""column config"""
column = Gtk.TreeViewColumn(_("Storage"), 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()
示例13: on_button_press
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)
示例14: on_button_press
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()
示例15: __init__
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