本文整理汇总了Python中quodlibet.util.connect_obj函数的典型用法代码示例。如果您正苦于以下问题:Python connect_obj函数的具体用法?Python connect_obj怎么用?Python connect_obj使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了connect_obj函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, library):
super(FileSystem, self).__init__()
sw = ScrolledWindow()
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
sw.set_shadow_type(Gtk.ShadowType.IN)
dt = MainDirectoryTree(folders=get_scan_dirs())
targets = [("text/x-quodlibet-songs", Gtk.TargetFlags.SAME_APP,
self.TARGET_QL),
("text/uri-list", 0, self.TARGET_EXT)]
targets = [Gtk.TargetEntry.new(*t) for t in targets]
dt.drag_source_set(Gdk.ModifierType.BUTTON1_MASK,
targets, Gdk.DragAction.COPY)
dt.connect('drag-data-get', self.__drag_data_get)
sel = dt.get_selection()
sel.unselect_all()
connect_obj(sel, 'changed', copool.add, self.__songs_selected, dt)
sel.connect("changed", self._on_selection_changed)
dt.connect('row-activated', lambda *a: self.songs_activated())
sw.add(dt)
self.pack_start(sw, True, True, 0)
self.show_all()
开发者ID:LudoBike,项目名称:quodlibet,代码行数:25,代码来源:filesystem.py
示例2: __init__
def __init__(self, player):
super(Volume, self).__init__(size=Gtk.IconSize.MENU, use_symbolic=True)
# https://bugzilla.gnome.org/show_bug.cgi?id=781605
scales = qltk.find_widgets(self.get_popup(), Gtk.Scale)
if scales:
scales[0].props.round_digits = -1
self.set_relief(Gtk.ReliefStyle.NORMAL)
self.set_adjustment(Gtk.Adjustment.new(0, 0, 1, 0.05, 0.1, 0))
popup = self.get_popup()
if hasattr(Gtk, "Popover") and isinstance(popup, Gtk.Popover):
popup.set_position(Gtk.PositionType.BOTTOM)
self._id = self.connect('value-changed', self.__volume_changed, player)
self._id2 = player.connect('notify::volume', self.__volume_notify)
self._id3 = player.connect('notify::mute', self.__mute_notify)
self._orig_icon_list = self.props.icons
player.notify("volume")
player.notify("mute")
self.connect("event", self._on_button_event, player)
replaygain_menu = VolumeMenu(player)
self.connect('popup-menu', self.__popup, replaygain_menu)
connect_obj(self, 'button-press-event', self.__volume_button_press,
replaygain_menu, player)
开发者ID:LudoBike,项目名称:quodlibet,代码行数:28,代码来源:controls.py
示例3: __init__
def __init__(self):
super(FilterCheckButton, self).__init__(self._label, self._section, self._key)
try:
self.set_active(config.getboolean(self._section, self._key))
except:
pass
connect_obj(self, "toggled", self.emit, "preview")
开发者ID:urielz,项目名称:quodlibet,代码行数:7,代码来源:_editutils.py
示例4: MenuItems
def MenuItems(marks, player, seekable):
sizes = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
items = []
if not marks or marks[0][0] != 0:
# Translators: Refers to the beginning of the playing song.
marks.insert(0, (0, _("Beginning")))
for time, mark in marks:
i = Gtk.MenuItem()
# older pygobject (~3.2) added a child on creation
if i.get_child():
i.remove(i.get_child())
connect_obj(i, 'activate', player.seek, time * 1000)
i.set_sensitive(time >= 0 and seekable)
hbox = Gtk.HBox(spacing=12)
i.add(hbox)
if time < 0:
l = Gtk.Label(label=_("N/A"))
else:
l = Gtk.Label(label=util.format_time(time))
l.set_alignment(0.0, 0.5)
sizes.add_widget(l)
hbox.pack_start(l, False, True, 0)
text = Gtk.Label(mark)
text.set_max_width_chars(80)
text.set_ellipsize(Pango.EllipsizeMode.END)
text.set_alignment(0.0, 0.5)
hbox.pack_start(text, True, True, 0)
i.show_all()
items.append(i)
return items
开发者ID:LudoBike,项目名称:quodlibet,代码行数:30,代码来源:bookmarks.py
示例5: __init__
def __init__(self, cbes, title, validator=None):
# Do this before calling parent constructor
self.cbes = cbes
super(CBESEditor, self).__init__(title, validator)
self.set_transient_for(qltk.get_top_parent(cbes))
connect_obj(self, 'destroy', self.__finish, cbes)
self.value.set_text(cbes.get_child().get_text())
开发者ID:mistotebe,项目名称:quodlibet,代码行数:7,代码来源:cbes.py
示例6: ClearButton
def ClearButton(entry=None):
clear = Gtk.Button()
clear.add(Gtk.Image.new_from_stock(Gtk.STOCK_CLEAR, Gtk.IconSize.MENU))
clear.set_tooltip_text(_("Clear search"))
if entry is not None:
connect_obj(clear, 'clicked', entry.set_text, '')
return clear
开发者ID:SimonLarsen,项目名称:quodlibet,代码行数:7,代码来源:x.py
示例7: Menu
def Menu(self, songs, library, items):
in_fav = False
in_all = False
for song in songs:
if song in self.__fav_stations:
in_fav = True
elif song in self.__stations:
in_all = True
if in_fav and in_all:
break
iradio_items = []
button = MenuItem(_("Add to Favorites"), Gtk.STOCK_ADD)
button.set_sensitive(in_all)
connect_obj(button, 'activate', self.__add_fav, songs)
iradio_items.append(button)
button = MenuItem(_("Remove from Favorites"), Gtk.STOCK_REMOVE)
button.set_sensitive(in_fav)
connect_obj(button, 'activate', self.__remove_fav, songs)
iradio_items.append(button)
items.append(iradio_items)
menu = SongsMenu(self.__librarian, songs, playlists=False, remove=True,
queue=False, devices=False, items=items)
return menu
开发者ID:brunob,项目名称:quodlibet,代码行数:25,代码来源:iradio.py
示例8: __init__
def __init__(self, app):
super(DockMenu, self).__init__()
player = app.player
play_item = MenuItem(_("_Play"), Icons.MEDIA_PLAYBACK_START)
play_item.connect("activate", self._on_play, player)
pause_item = MenuItem(_("P_ause"), Icons.MEDIA_PLAYBACK_PAUSE)
pause_item.connect("activate", self._on_pause, player)
self.append(play_item)
self.append(pause_item)
previous = MenuItem(_("Pre_vious"), Icons.MEDIA_SKIP_BACKWARD)
previous.connect("activate", lambda *args: player.previous())
self.append(previous)
next_ = MenuItem(_("_Next"), Icons.MEDIA_SKIP_FORWARD)
next_.connect("activate", lambda *args: player.next())
self.append(next_)
browse = qltk.MenuItem(_("_Browse Library"), Icons.EDIT_FIND)
browse_sub = Gtk.Menu()
for Kind in browsers.browsers:
if Kind.is_empty:
continue
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.append(SeparatorMenuItem())
self.append(browse)
self.show_all()
self.hide()
开发者ID:virtuald,项目名称:quodlibet,代码行数:35,代码来源:quodlibetwindow.py
示例9: connect
def connect(self, signal, callback, *args, **kwargs):
if self.get_submenu():
for item in self.get_submenu().get_children():
connect_obj(item, signal, callback, self, *args, **kwargs)
else:
super(EditTagsPlugin, self).connect(
signal, callback, *args, **kwargs)
开发者ID:ZDBioHazard,项目名称:quodlibet,代码行数:7,代码来源:editing.py
示例10: setUp
def setUp(self):
config.init()
config.set("player", "gst_pipeline", "fakesink")
config.set("settings", "xine_driver", "none")
module = player.init_backend(self.NAME)
lib = library.init()
self.player = module.init(lib.librarian)
source = PlaylistModel()
source.set(FILES)
self.events = []
def start_end_handler(player, song, *args):
self.events.append((args[-1], song))
self.player.connect("song-started", start_end_handler, "started")
self.player.connect("song-ended", start_end_handler, "ended")
self.player.setup(source, None, 0)
self.signals = []
def handler(type_, *args):
self.signals.append(type_)
connect_obj(self.player, "unpaused", handler, "unpaused")
connect_obj(self.player, "paused", handler, "paused")
开发者ID:LudoBike,项目名称:quodlibet,代码行数:26,代码来源:test_player.py
示例11: __init__
def __init__(self, filename=None, initial=[], count=5, id=None,
validator=None, title=_("Saved Values"),
edit_title=_(u"Edit saved values…")):
self.count = count
self.filename = filename
id = filename or id
try:
model = self.__models[id]
except KeyError:
model = type(self).__models[id] = Gtk.ListStore(str, str, str)
super(ComboBoxEntrySave, self).__init__(
model=model, entry_text_column=0, has_entry=True)
self.clear()
render = Gtk.CellRendererPixbuf()
self.pack_start(render, False)
self.add_attribute(render, 'icon-name', 2)
render = Gtk.CellRendererText()
self.pack_start(render, True)
self.add_attribute(render, 'text', 1)
self.set_row_separator_func(self.__separator_func, None)
if not len(model):
self.__fill(filename, initial, edit_title)
self.remove(self.get_child())
self.add(entry.ValidatingEntry(validator))
connect_obj(self, 'destroy', self.set_model, None)
connect_obj(self, 'changed', self.__changed, model,
validator, title)
开发者ID:vrasidas,项目名称:quodlibet,代码行数:35,代码来源:cbes.py
示例12: __popup_menu
def __popup_menu(self, view, library):
model, itr = view.get_selection().get_selected()
if itr is None:
return
songs = list(model[itr][0])
songs = filter(lambda s: isinstance(s, AudioFile), songs)
menu = SongsMenu(library, songs, playlists=False, remove=False, ratings=False)
menu.preseparate()
def _remove(model, itr):
playlist = model[itr][0]
dialog = ConfirmRemovePlaylistDialog(self, playlist)
if dialog.run() == Gtk.ResponseType.YES:
playlist.delete()
model.get_model().remove(model.convert_iter_to_child_iter(itr))
rem = MenuItem(_("_Delete"), Icons.EDIT_DELETE)
connect_obj(rem, "activate", _remove, model, itr)
menu.prepend(rem)
def _rename(path):
self.__render.set_property("editable", True)
view.set_cursor(path, view.get_columns()[0], start_editing=True)
ren = qltk.MenuItem(_("_Rename"), Icons.EDIT)
qltk.add_fake_accel(ren, "F2")
connect_obj(ren, "activate", _rename, model.get_path(itr))
menu.prepend(ren)
playlist = model[itr][0]
PLAYLIST_HANDLER.populate_menu(menu, library, self, [playlist])
menu.show_all()
return view.popup_menu(menu, 0, Gtk.get_current_event_time())
开发者ID:mistotebe,项目名称:quodlibet,代码行数:33,代码来源:main.py
示例13: __init__
def __init__(self, *args, **kwargs):
if type(self).__window:
return
else:
type(self).__window = self
super(_Unique, self).__init__(*args, **kwargs)
connect_obj(self, 'destroy', self.__destroy, self)
开发者ID:bossjones,项目名称:quodlibet,代码行数:7,代码来源:window.py
示例14: __connect_signals
def __connect_signals(self, view, library):
view.connect("row-activated", lambda *x: self.songs_activated())
view.connect("popup-menu", self.__popup_menu, library)
view.get_selection().connect("changed", self.activate)
model = view.get_model()
s = model.connect("row-changed", self.__check_current)
connect_obj(self, "destroy", model.disconnect, s)
self.connect("key-press-event", self.__key_pressed)
开发者ID:mistotebe,项目名称:quodlibet,代码行数:8,代码来源:main.py
示例15: __init__
def __init__(self):
super(ScanBox, self).__init__(spacing=6)
self.model = model = Gtk.ListStore(str)
view = RCMHintedTreeView(model=model)
view.set_fixed_height_mode(True)
view.set_headers_visible(False)
view.set_tooltip_text(_("Songs in the listed folders will be added "
"to the library during a library refresh"))
menu = Gtk.Menu()
remove_item = MenuItem(_("_Remove"), Icons.LIST_REMOVE)
menu.append(remove_item)
menu.show_all()
view.connect('popup-menu', self.__popup, menu)
connect_obj(remove_item, 'activate', self.__remove, view)
sw = Gtk.ScrolledWindow()
sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
sw.set_shadow_type(Gtk.ShadowType.IN)
sw.add(view)
sw.set_size_request(-1, max(sw.size_request().height, 80))
render = Gtk.CellRendererText()
render.set_property('ellipsize', Pango.EllipsizeMode.END)
def cdf(column, cell, model, iter, data):
row = model[iter]
cell.set_property('text', unexpand(row[0]))
column = Gtk.TreeViewColumn(None, render)
column.set_cell_data_func(render, cdf)
column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
view.append_column(column)
add = Button(_("_Add"), Icons.LIST_ADD)
add.connect("clicked", self.__add)
remove = Button(_("_Remove"), Icons.LIST_REMOVE)
selection = view.get_selection()
selection.set_mode(Gtk.SelectionMode.MULTIPLE)
selection.connect("changed", self.__select_changed, remove)
selection.emit("changed")
connect_obj(remove, "clicked", self.__remove, view)
vbox = Gtk.VBox(spacing=6)
vbox.pack_start(add, False, True, 0)
vbox.pack_start(remove, False, True, 0)
self.pack_start(sw, True, True, 0)
self.pack_start(vbox, False, True, 0)
paths = map(fsdecode, get_scan_dirs())
for path in paths:
model.append(row=[path])
for child in self.get_children():
child.show_all()
开发者ID:bernd-wechner,项目名称:quodlibet,代码行数:58,代码来源:scanbox.py
示例16: __init__
def __init__(self, parent, can_change, library):
super(AddTagDialog, self).__init__(
title=_("Add a Tag"), transient_for=qltk.get_top_parent(parent),
use_header_bar=True)
self.set_border_width(6)
self.set_resizable(False)
self.add_button(_("_Cancel"), Gtk.ResponseType.CANCEL)
add = self.add_icon_button(_("_Add"), Icons.LIST_ADD,
Gtk.ResponseType.OK)
self.vbox.set_spacing(6)
self.set_default_response(Gtk.ResponseType.OK)
table = Gtk.Table(n_rows=2, n_columns=2)
table.set_row_spacings(12)
table.set_col_spacings(6)
table.set_border_width(6)
self.__tag = (TagsComboBoxEntry() if can_change is True
else TagsComboBox(can_change))
label = Gtk.Label()
label.set_alignment(0.0, 0.5)
label.set_text(_("_Tag:"))
label.set_use_underline(True)
label.set_mnemonic_widget(self.__tag)
table.attach(label, 0, 1, 0, 1)
table.attach(self.__tag, 1, 2, 0, 1)
self.__val = Gtk.Entry()
self.__val.set_completion(LibraryValueCompletion("", library))
label = Gtk.Label()
label.set_text(_("_Value:"))
label.set_alignment(0.0, 0.5)
label.set_use_underline(True)
label.set_mnemonic_widget(self.__val)
valuebox = Gtk.EventBox()
table.attach(label, 0, 1, 1, 2)
table.attach(valuebox, 1, 2, 1, 2)
hbox = Gtk.HBox()
valuebox.add(hbox)
hbox.pack_start(self.__val, True, True, 0)
hbox.set_spacing(6)
invalid = Gtk.Image.new_from_icon_name(
Icons.DIALOG_WARNING, Gtk.IconSize.SMALL_TOOLBAR)
hbox.pack_start(invalid, True, True, 0)
self.vbox.pack_start(table, True, True, 0)
self.get_child().show_all()
invalid.hide()
for entry in [self.__tag, self.__val]:
entry.connect(
'changed', self.__validate, add, invalid, valuebox)
self.__tag.connect('changed', self.__set_value_completion, library)
self.__set_value_completion(self.__tag, library)
if can_change is True:
connect_obj(self.__tag.get_child(),
'activate', Gtk.Entry.grab_focus, self.__val)
开发者ID:piotrdrag,项目名称:quodlibet,代码行数:58,代码来源:edittags.py
示例17: enable_row_update
def enable_row_update(self, view, sw, column):
connect_obj(view, "draw", self.__update_visibility, view)
connect_destroy(sw.get_vadjustment(), "value-changed", self.__stop_update, view)
self.__pending_paths = []
self.__update_deferred = DeferredSignal(self.__update_visible_rows, timeout=50, priority=GLib.PRIORITY_LOW)
self.__column = column
self.__first_expose = True
开发者ID:mistotebe,项目名称:quodlibet,代码行数:9,代码来源:main.py
示例18: Menu
def Menu(self, songs, library, items):
model, iters = self.__get_selected_songs()
remove = qltk.MenuItem(_("_Remove from Playlist"), Icons.LIST_REMOVE)
qltk.add_fake_accel(remove, "Delete")
connect_obj(remove, 'activate', self.__remove, iters, model)
playlist_iter = self.__selected_playlists()[1]
remove.set_sensitive(bool(playlist_iter))
items.append([remove])
menu = super(PlaylistsBrowser, self).Menu(songs, library, items)
return menu
开发者ID:zsau,项目名称:quodlibet,代码行数:10,代码来源:main.py
示例19: __init__
def __init__(self, songs, library):
super(Menu, self).__init__()
for device in MediaDevices.devices():
i = Gtk.ImageMenuItem(device['name'])
i.set_image(
Gtk.Image.new_from_icon_name(device.icon, Gtk.IconSize.MENU))
i.set_sensitive(device.is_connected())
connect_obj(i,
'activate', self.__copy_to_device, device, songs, library)
self.append(i)
开发者ID:Tjorriemorrie,项目名称:quodlibet,代码行数:10,代码来源:media.py
示例20: Menu
def Menu(self, songs, library, items):
model, iters = self.__get_selected_songs()
item = qltk.MenuItem(_("_Remove from Playlist"), Icons.LIST_REMOVE)
qltk.add_fake_accel(item, "Delete")
connect_obj(item, 'activate', self.__remove, iters, model)
item.set_sensitive(bool(self.__view.get_selection().get_selected()[1]))
items.append([item])
menu = super(PlaylistsBrowser, self).Menu(songs, library, items)
return menu
开发者ID:michael-ball,项目名称:quodlibet,代码行数:10,代码来源:main.py
注:本文中的quodlibet.util.connect_obj函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论