本文整理汇总了Python中rb.find_plugin_file函数的典型用法代码示例。如果您正苦于以下问题:Python find_plugin_file函数的具体用法?Python find_plugin_file怎么用?Python find_plugin_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find_plugin_file函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, source, window):
super(ViewManager, self).__init__()
self.source = source
self.window = window
# initialize views
self._views = {}
ui = Gtk.Builder()
ui.add_from_file(rb.find_plugin_file(source.plugin,
'ui/coverart_iconview.ui'))
self._views[CoverIconView.name] = ui.get_object('covers_view')
self._views[CoverFlowView.name] = CoverFlowView()
self._views[ListView.name] = ListView()
ui.add_from_file(rb.find_plugin_file(source.plugin,
'ui/coverart_artistview.ui'))
self._views[ArtistView.name] = ui.get_object('artist_view')
self._lastview = None
self.controller = ViewController(source.shell, self)
# connect signal and properties
self._connect_signals()
self._connect_properties()
self._lastview = self.view_name
if self.current_view.use_plugin_window:
window.add(self.current_view.view)
window.show_all()
示例2: do_create_configure_widget
def do_create_configure_widget(self):
builder = Gtk.Builder()
print rb.find_plugin_file(self, "tab-prefs.ui")
builder.add_from_file(rb.find_plugin_file(self, "tab-prefs.ui"))
self.dialog = builder.get_object("preferences_dialog")
self.path_display = builder.get_object("path_display")
self.dialog.connect("response", self.dialog_response)
preferences = self.get_prefs()
site_box = builder.get_object("sites")
self.site_checks = {}
for s in tab_sites:
site_id = s['id']
checkbutton = Gtk.CheckButton(label = s['name'])
checkbutton.set_active(s['id'] in preferences['sites'])
self.site_checks[site_id] = checkbutton
site_box.pack_start(checkbutton, expand=False, fill=True, padding=0)
self.filechooser = builder.get_object('filechooser')
self.filechooser.set_current_folder(preferences['folder'])
self.preventAutoWebLookup_checkbutton = builder.get_object('preventAutoWebLookup_checkbutton')
self.preventAutoWebLookup_checkbutton.set_active(preferences['preventAutoWebLookup'])
self.default_folder_button = builder.get_object('default_folder_button')
self.default_folder_button.connect('clicked', self.set_folderchooser_to_default)
site_box.show_all()
示例3: do_create_configure_widget
def do_create_configure_widget(self):
def account_details_changed(entry, event):
username = builder.get_object('usernameEntry').get_text()
password = builder.get_object('passwordEntry').get_text()
gStatsUtil.save_account_info(username, password, self.plugin_info.get_data_dir())
return False
self.configure_callback_dic = {
"rb_google_sync_info_changed_cb" : account_details_changed,
}
builder = Gtk.Builder()
builder.add_from_file(rb.find_plugin_file(self, 'preferences.ui'))
dialog = builder.get_object('vbox1')
builder.connect_signals(self.configure_callback_dic)
account_file = rb.find_plugin_file(self, 'account.dat')
if account_file != None:
f = open(account_file)
builder.get_object('usernameEntry').set_text(f.readline().rstrip())
builder.get_object('passwordEntry').set_text(f.readline())
f.close()
return dialog
示例4: load_templates
def load_templates(self, plugin):
'''
Loads the templates and stylesheets to be used by the pane.
'''
# input_encoding='utf-8',
path = rb.find_plugin_file(plugin,
'tmpl/albumartsearch-tmpl.html')
self.template = Template(filename=path,
default_filters=['decode.utf8'],
module_directory='/tmp/',
encoding_errors='replace')
path = rb.find_plugin_file(plugin,
'tmpl/albumartsearchempty-tmpl.html')
self.empty_template = Template(filename=path,
default_filters=['decode.utf8'],
module_directory='/tmp/',
encoding_errors='replace')
path = rb.find_plugin_file(plugin,
'tmpl/artistartsearch-tmpl.html')
self.artist_template = Template(filename=path,
default_filters=['decode.utf8'],
module_directory='/tmp/',
encoding_errors='replace')
self.styles = rb.find_plugin_file(plugin, 'tmpl/main.css')
示例5: __init__
def __init__(self, plugin, sprite_name, size=None):
self.plugin = plugin
self.popups = rb.find_plugin_file(plugin, self.popups)
self.tree = ET.ElementTree(file=self.popups)
root = self.tree.getroot()
base = 'spritesheet[@name="' + sprite_name + '"]/'
image = rb.find_plugin_file(plugin, 'img/' +
root.findall(base + 'image')[0].text)
icon_width = int(root.findall(base + 'icon')[0].attrib['width'])
icon_height = int(root.findall(base + 'icon')[0].attrib['height'])
x_spacing = int(root.findall(base + 'spacing')[0].attrib['x'])
y_spacing = int(root.findall(base + 'spacing')[0].attrib['y'])
x_start = int(root.findall(base + 'start-position')[0].attrib['x'])
y_start = int(root.findall(base + 'start-position')[0].attrib['y'])
try:
alpha_color = map(int,
root.findall(base + 'alpha')[0].text.split(' '))
except:
alpha_color = None
self.names = []
for elem in root.findall(sprite_name + '/' + sprite_name +
'[@spritesheet="' + sprite_name + '"]'):
self.names.append(elem.attrib['name'])
self._sheet = SpriteSheet(image, icon_width, icon_height, x_spacing,
y_spacing, x_start, y_start, alpha_color, size)
示例6: __init__
def __init__(self, plugin, sprite_name, size=None):
super(GenreConfiguredSpriteSheet, self).__init__(plugin, sprite_name,
size)
self.genre_alternate = {} # contains GenreType tuples
self._alt_icons = {}
self._sprite_name = sprite_name
self._size = size
popups = rb.find_plugin_file(plugin, 'img/popups.xml')
root = ET.parse(open(popups)).getroot()
self._parse_popups(plugin, root, self.GENRE_SYSTEM)
try:
self._user_popups = rb.find_plugin_file(plugin, 'img/usericons/popups.xml')
root = ET.parse(open(self._user_popups)).getroot()
self._parse_popups(plugin, root, self.GENRE_USER)
elem = root.xpath(self._sprite_name + '/index')
curr_index = long(elem[0].text)
for index in range(0,curr_index+1):
key = RB.ExtDBKey.create_lookup('icon', str(index))
icon_location = self._genre_db.lookup(key)
sprite = GdkPixbuf.Pixbuf.new_from_file(icon_location)
if self._size:
sprite = sprite.scale_simple(self._size[0], self._size[1],
GdkPixbuf.InterpType.BILINEAR)
self._alt_icons[str(index)] = sprite
self.names.append(str(index))
except:
pass
示例7: do_activate
def do_activate(self):
'''
Called by Rhythmbox when the plugin is activated. It creates the
plugin's source and connects signals to manage the plugin's
preferences.
'''
print("CoverArtBrowser DEBUG - do_activate")
self.shell = self.object
self.db = self.shell.props.db
try:
entry_type = CoverArtBrowserEntryType()
self.db.register_entry_type(entry_type)
except NotImplementedError:
entry_type = self.db.entry_register_type(
'CoverArtBrowserEntryType')
cl = CoverLocale()
cl.switch_locale(cl.Locale.LOCALE_DOMAIN)
entry_type.category = RB.RhythmDBEntryCategory.NORMAL
group = RB.DisplayPageGroup.get_by_id('library')
# load plugin icon
theme = Gtk.IconTheme.get_default()
rb.append_plugin_source_path(theme, '/icons')
# lets assume that python3 versions of RB only has the new icon attribute in the source
if rb3compat.PYVER >=3:
iconfile = Gio.File.new_for_path(
rb.find_plugin_file(self, 'img/' + Theme(self).current\
+ '/covermgr.png'))
self.source = CoverArtBrowserSource(
shell=self.shell,
name=_("CoverArt"),
entry_type=entry_type,
plugin=self,
icon=Gio.FileIcon.new(iconfile),
query_model=self.shell.props.library_source.props.base_query_model)
else:
what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
pxbf = GdkPixbuf.Pixbuf.new_from_file_at_size(
rb.find_plugin_file(self, 'img/' + Theme(self).current\
+ '/covermgr.png'), width, height)
self.source = CoverArtBrowserSource(
shell=self.shell,
name=_("CoverArt"), entry_type=entry_type,
plugin=self, pixbuf=pxbf,
query_model=self.shell.props.library_source.props.base_query_model)
self.shell.register_entry_type_for_source(self.source, entry_type)
self.shell.append_display_page(self.source, group)
self.source.props.query_model.connect('complete', self.load_complete)
print("CoverArtBrowser DEBUG - end do_activate")
示例8: load_tmpl
def load_tmpl (self):
self.path = rb.find_plugin_file(self.plugin, 'tmpl/lyrics-tmpl.html')
self.loading_path = rb.find_plugin_file (self.plugin, 'tmpl/loading.html')
self.template = Template (filename = self.path,
module_directory = '/tmp/context/')
self.loading_template = Template (filename = self.loading_path,
module_directory = '/tmp/context')
self.styles = self.basepath + '/tmpl/main.css'
示例9: load_tmpl
def load_tmpl (self):
path = rb.find_plugin_file (self.plugin, 'tmpl/album-tmpl.html')
empty_path = rb.find_plugin_file (self.plugin, 'tmpl/album_empty-tmpl.html')
self.loading_path = rb.find_plugin_file (self.plugin, 'tmpl/loading.html')
self.album_template = Template (filename = path)
self.loading_template = Template (filename = self.loading_path)
self.empty_template = Template (filename = empty_path)
self.styles = self.basepath + '/tmpl/artistmain.css'
示例10: load_tmpl
def load_tmpl (self):
self.path = rb.find_plugin_file (self.plugin, 'tmpl/album-tmpl.html')
self.loading_path = rb.find_plugin_file (self.plugin, 'tmpl/loading.html')
self.album_template = Template (filename = self.path,
module_directory = self.plugin.tempdir)
self.loading_template = Template (filename = self.loading_path,
module_directory = self.plugin.tempdir)
self.styles = self.basepath + '/tmpl/main.css'
示例11: do_activate
def do_activate (self):
ui = Gtk.Builder()
ui.add_from_file(rb.find_plugin_file(self,
'desktop-art.ui'))
window = ui.get_object('window')
window.set_app_paintable(True)
screen = window.get_screen()
visual = screen.get_rgba_visual()
self.composited = window.is_composited()
if visual !=None and self.composited:
window.set_visual(visual)
self.shell = self.object
player = self.shell.props.shell_player
window.stick()
window.set_keep_below(True)
desktop_control = DesktopControl(icons, self.shell, player,
rb.find_plugin_file(self,'configure-art.ui'), self)
cover_manager = CoverManager(player.props.db)
#player.props.db.connect_after("entry-extra-metadata-notify::rb:coverArt-uri", self.notify_metadata)
gc = GConf.Client.get_default()
gc.add_dir(GConf_plugin_path, GConf.ClientPreloadType.PRELOAD_NONE)
window_props = self.get_GConf_window_props(gc)
self.gc_notify_ids = [gc.notify_add(self.GConf_path('window_x'), self.GConf_cb, window_props),
gc.notify_add(self.GConf_path('window_y'), self.GConf_cb, window_props),
gc.notify_add(self.GConf_path('window_w'), self.GConf_cb, window_props),
gc.notify_add(self.GConf_path('window_h'), self.GConf_cb, window_props)]
window.add(desktop_control)
self.player = player
self.cb = player.connect('playing-changed', self.playing_changed, desktop_control, cover_manager)
self.playing_changed(player, player.get_playing(), desktop_control, cover_manager)
self.gc = gc
self.window = window
self.window_props = window_props
self.desktop_control = desktop_control
self.cover_manager = cover_manager
print("Adding timeout")
ret = GObject.timeout_add(POLL_TIMEOUT, self.poll_for_coverart)
print("integer id returned: " + str(ret))
self.position_window(self.window_props)
self.window.show_all()
else:
# We don't have compositing manager
md = Gtk.MessageDialog(type=Gtk.MessageType.ERROR,
buttons=Gtk.ButtonsType.OK,
message_format='You are not running under a composited desktop-environment. The Desktop Art Plugin cannot work without one.')
md.run()
md.destroy()
示例12: load_tmpl
def load_tmpl(self):
cl = CoverLocale()
# cl.switch_locale(cl.Locale.LOCALE_DOMAIN)
path = rb.find_plugin_file(self.plugin, "tmpl/album-tmpl.html")
empty_path = rb.find_plugin_file(self.plugin, "tmpl/album_empty-tmpl.html")
self.loading_path = rb.find_plugin_file(self.plugin, "tmpl/loading.html")
self.album_template = Template(filename=path)
self.loading_template = Template(filename=self.loading_path)
self.empty_template = Template(filename=empty_path)
self.styles = self.basepath + "/tmpl/artistmain.css"
示例13: __init__
def __init__(self, db, player, plugin):
RB.EntryView.__init__(self, db=db, shell_player=player)
self.db = db
self.plugin = plugin
self.pixs = [GdkPixbuf.Pixbuf.new_from_file(rb.find_plugin_file(self.plugin, 'pandora/widgets/star-off.png')),
GdkPixbuf.Pixbuf.new_from_file(rb.find_plugin_file(self.plugin, 'pandora/widgets/star-on.png'))]
player.connect_after('playing-changed', self.playing_changed)
self.load_columns()
示例14: initialise
def initialise(self, plugin, callback, sort_order):
'''
set up the images we will use for this widget
'''
self.image_display = sort_order
self.set_tooltip(self.image_display)
if not self.is_initialised:
image1 = Gtk.Image.new_from_file(rb.find_plugin_file(plugin,
'img/arrow_up.png'))
image2 = Gtk.Image.new_from_file(rb.find_plugin_file(plugin,
'img/arrow_down.png'))
super(SortOrderButton, self).initialise(callback,
image1, image2)
示例15: _create_display_contents
def _create_display_contents(self, plugin):
print("DEBUG - create_display_contents")
# create the ui
self._first_run = True
builder = Gtk.Builder()
builder.add_from_file(rb.find_plugin_file(plugin,
'ui/spectrum_prefs.ui'))
builder.connect_signals(self)
gs = GSetting()
# bind the toggles to the settings
self.position = self.settings[gs.PluginKey.POSITION]
self.sidebar_position_radiobutton = builder.get_object('sidebar_position_radiobutton')
self.bottom_position_radiobutton = builder.get_object('bottom_position_radiobutton')
if self.position == 1:
self.sidebar_position_radiobutton.set_active(True)
else:
self.bottom_position_radiobutton.set_active(True)
self.builder = builder
# return the dialog
self._first_run = False
print("end create dialog contents")
return builder.get_object('main_grid')