本文整理汇总了Python中Pyblio.Autoload.get_by_name方法的典型用法代码示例。如果您正苦于以下问题:Python Autoload.get_by_name方法的具体用法?Python Autoload.get_by_name怎么用?Python Autoload.get_by_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pyblio.Autoload
的用法示例。
在下文中一共展示了Autoload.get_by_name方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_by_name
# 需要导入模块: from Pyblio import Autoload [as 别名]
# 或者: from Pyblio.Autoload import get_by_name [as 别名]
def get_by_name (entity, method):
''' returns a specific field of the given entity '''
meth = Autoload.get_by_name ("format", entity)
if meth and meth.data.has_key (method):
return meth.data [method]
return None
示例2: _on_validate
# 需要导入模块: from Pyblio import Autoload [as 别名]
# 或者: from Pyblio.Autoload import get_by_name [as 别名]
def _on_validate (self, * arg):
style = self._w_style_entry.get_full_path (False)
output = self._w_output_entry.get_full_path (False)
FormatDialog.style = style
FormatDialog.output = output
format = Autoload.get_by_name ('output', self.menu_item).data
if style is None or output is None: return
self._w_format.destroy ()
self.issue ('format-query', style, format, output)
return
示例3: format
# 需要导入模块: from Pyblio import Autoload [as 别名]
# 或者: from Pyblio.Autoload import get_by_name [as 别名]
def format (database, style, output, file = sys.stdout, id = 'Bibliography'):
output = Autoload.get_by_name ("output", output).data
url = None
style = os.path.splitext (style) [0]
if os.path.exists (style + '.xml'):
url = Fields.URL (style + '.xml')
else:
from Pyblio import version
full = os.path.join (version.pybdir, 'Styles', style)
full = full + '.xml'
if os.path.exists (full): url = Fields.URL (full)
Utils.generate (url, output, database, database.keys (), file)
return
示例4: _on_validate
# 需要导入模块: from Pyblio import Autoload [as 别名]
# 或者: from Pyblio.Autoload import get_by_name [as 别名]
def _on_validate(self, *arg):
style = self._w_style.get_filename()
output = self._w_output.get_filename()
FormatDialog.style = style
FormatDialog.output = output
format = Autoload.get_by_name ('output', self.menu_item).data
# FIXME: We can't use GtkFileChooserButton for saving a file
# So, now we are not saving anything
if output is None:
import inspect
fname, lineno, funcname = inspect.getframeinfo(inspect.currentframe())[:3]
print 'FIXME: Data not saved. %s:%d (%s)' % (fname, lineno, funcname)
if style is None or output is None: return
self._w_format.destroy ()
self.issue ('format-query', style, format, output)
示例5: configure
# 需要导入模块: from Pyblio import Autoload [as 别名]
# 或者: from Pyblio.Autoload import get_by_name [as 别名]
def configure (self):
fmeth = {}
module = None
for mod in self.config:
module = Autoload.get_by_name ('style', mod.module).data
if module is None:
raise RuntimeError, "unknown module `%s'" % mod.module
for item in mod.data:
if item.att.has_key ('method'):
meth = item.att ['method']
if module.has_key (item.data):
self.methods [meth] = module [item.data]
continue
if item.att.has_key ('field'):
field = item.att ['field']
if module.has_key (item.data):
fmeth [field] = module [item.data]
continue
self.format.meth = fmeth
return
示例6: _
# 需要导入模块: from Pyblio import Autoload [as 别名]
# 或者: from Pyblio.Autoload import get_by_name [as 别名]
if missing:
# warn the user that some entries were not found
print _("pybliotex: warning: the following keys were not resolved").encode (charset)
print ' ' + string.join (missing, '\n ') + '\n'
if style is None:
# If the LaTeX document declares no style...
error (_("no style defined"))
# --------------------------------------------------
# generate the latex bibliography
# --------------------------------------------------
# Create a formatter that writes in the .bbl file
formatter = Autoload.get_by_name ('output', 'LaTeX').data
# Search style in local path and standard installation
url = None
if os.path.exists (style + '.xml'):
url = Fields.URL (style + '.xml')
else:
from Pyblio import version
full = os.path.join (version.pybdir, 'Styles', style)
full = full + '.xml'
if os.path.exists (full): url = Fields.URL (full)
if not url:
error (_("can't find style `%s'") % style)
示例7: generate_key
# 需要导入模块: from Pyblio import Autoload [as 别名]
# 或者: from Pyblio.Autoload import get_by_name [as 别名]
def generate_key(self, entry):
# call a key generator
keytype = Config.get('base/keyformat').data
return Autoload.get_by_name('key', keytype).data(entry, self)
示例8: error
# 需要导入模块: from Pyblio import Autoload [as 别名]
# 或者: from Pyblio.Autoload import get_by_name [as 别名]
# adjust parameters to the chosen style
if spstyle == 'abbrvau':
sep = '; '
format = 'textau'
elif spstyle == 'abbrvnum':
sep = ', '
format = 'textnum'
else:
sep = ', '
format = 'text'
# get the specified output
output = Autoload.get_by_name ('output', format)
if output is None:
error (_("unknown output format `%s'") % format)
reffile = outfile + '.ref'
if os.path.exists(outfile):
error (_("File already exists: `%s'") % outfile)
if os.path.exists(reffile):
error (_("A file with the same name already exists: `%s'") % reffile)
textfile = args [0]
示例9: bibopen
# 需要导入模块: from Pyblio import Autoload [as 别名]
# 或者: from Pyblio.Autoload import get_by_name [as 别名]
from Pyblio import Fields, Autoload
from Pyblio.Style import Utils
import sys
db = bibopen (sys.argv [2])
keys = db.keys ()
keys.sort ()
url = Fields.URL (sys.argv [3])
Utils.generate (url, Autoload.get_by_name ('output', sys.argv [4]).data,
db, keys, sys.stdout)