本文整理汇总了Python中Pyblio.Config.set方法的典型用法代码示例。如果您正苦于以下问题:Python Config.set方法的具体用法?Python Config.set怎么用?Python Config.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pyblio.Config
的用法示例。
在下文中一共展示了Config.set方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _check_default
# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import set [as 别名]
def _check_default (item, value, user):
""" If the entries are updated, update the default type with the new entry """
dfl = Config.get ('base/defaulttype').data
if dfl is None: return 1
value = value [string.lower (dfl.name)]
if dfl == value:
Config.set ('base/defaulttype', value)
return 1
示例2: _set_entries
# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import set [as 别名]
def _set_entries (entries):
desc = Config.get ('base/fields').data
ent = {}
for e in entries.keys ():
d = Types.EntryDescription (e)
d.mandatory = \
map (lambda x, desc=desc: desc [x], entries [e] [0])
d.optional = \
map (lambda x, desc=desc: desc [x], entries [e] [1])
ent [string.lower (e)] = d
Config.set ('base/entries', ent)
return
示例3: len
# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import set [as 别名]
return len (value) > 0
Config.define ('gnome/columns', """ A list of the fields displayed
on the main screen of the interface """,
Config.List (Config.String ()))
Config.define ('gnome/native-as-default', """ Should we edit the
entries in their native format by default ? """, Config.Boolean ())
Config.define ('gnome/searched', """ List of searchable fields """,
Config.List (Config.String ()))
Config.define ('gnome/history', """ Size of the history file """,
Config.Integer (min = 1))
Config.define ('gnome/paste-key', """ Paste key instead of entry content """,
Config.Boolean ())
# --------------------------------------------------
Config.set ('gnome/searched', ['Author', 'Title', 'Abstract', 'Date'])
Config.set ('gnome/native-as-default', 0)
Config.set ('gnome/columns', ('Author', 'Date', 'Title'))
Config.set ('gnome/history', 10)
Config.set ('gnome/paste-key', 1)
示例4:
# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import set [as 别名]
Config.define ('refer/mapping',
""" A hash table containing field names
correspondances. The boolean flag specifies if the
mapping should be reversible. """,
vtype = Config.Dict (Config.String (),
Config.Tuple ((Config.String (),
Config.Boolean ()))))
Config.set ('refer/mapping', {
'U' : ('url', 1),
'A' : ('author', 1),
'Q' : ('author', 0),
'T' : ('title', 1),
'S' : ('series', 1),
'J' : ('journal', 1),
'B' : ('booktitle', 1),
'R' : ('type', 1),
'V' : ('volume', 1),
'N' : ('number', 1),
'E' : ('editor', 1),
'D' : ('date', 1),
'P' : ('pages', 1),
'I' : ('publisher', 1),
'C' : ('address', 1),
'K' : ('keywords', 1),
'X' : ('abstract', 1),
'W' : ('location', 1),
'F' : ('label', 1),
'O' : ('note', 1),
})
示例5: _get_url_fields
# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import set [as 别名]
return Config.get ('base/fields').data.keys ()
def _get_url_fields ():
fields = Config.get ('base/fields').data
return [ k for (k, v) in fields.items() if v.type is Fields.URL]
Config.define ('resource/viewable-fields',
"""A list of fieldnames referring to
viewable resources (with URL or otherwise).""",
Config.List (Config.Element (_get_fields)))
Config.define ('resource/viewers',
"""A list of mime type, viewer application name tuples. """,
Config.List (Config.Tuple ((Config.String(), Config.String ()))))
Config.set('resource/viewable-fields', _get_url_fields())
Config.set ('resource/viewers',
[['application/pdf', 'acroread'],
['application/pdf', 'evince'],
['application/x-dvi', 'xdvi'],
['application/x-dvi', 'evince'],
['application/postscript', 'evince'],
['application/gzpostscript', 'evince'],
['image/vnd.djvu', 'djview'],
['image/vnd.djvu', 'evince'],
['text/html', 'mozilla'],
['text/html', 'konqueror'],
])
示例6: len
# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import set [as 别名]
import os, sys, string
from Pyblio import Config, Exceptions
import locale
charset = locale.getlocale () [1] or 'ascii'
# check the arguments
if len (sys.argv) < 3:
print _("usage: pybliocheck <file | directory>...").encode (charset)
sys.exit (1)
# list containing the broken entries
broken = []
# set the strictness for bibtex files
Config.set ("bibtex/strict", 1)
# we go over all the specified files
for dir in sys.argv [2:]:
# eventually expand directories to their content
if os.path.isdir (dir):
files = map (lambda x, dir = dir: \
os.path.join (dir, x), os.listdir (dir))
# in the case of a directory, use only .bib extension...
files = filter (lambda f: os.path.splitext (f) [1] == '.bib',
files)
else:
files = [dir]
示例7: _get_elements
# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import set [as 别名]
from Pyblio import Config, Types
from Pyblio.Format.OvidLike import SimpleField, AuthorField, SourceField, KeywordField
def _get_elements ():
return [SimpleField, AuthorField, SourceField, KeywordField]
Config.define ('ovid/deftype', """ Default type for an Ovid entry """,
Config.Element (lambda Config = Config:
Config.get ('base/entries').data.values ()))
Config.set ('ovid/deftype',
Config.get ('base/entries').data ['article'])
## Config.define ('ovid/sourceregexp',
## """A regexp used to parse the source and abbreviated
## source input fields. This is a raw and verbose Python
## regular expression""",
## Config.String())
## Config.set ('ovid/sourceregexp',
## r"""
## (?P<journal>.*)\.\ +
## (?P<volume>\d+)
## (?:\((?P<number>.*)\))?
## (?::(?P<pages>.*?(?:-+.*?)?)
## (?:;\ *(?P<other>.*))?)
## (?:,\ *(?P<year>\d\d\d\d))\ *
## (?P<month>.*)
## \.\Z
## """)
示例8: name
# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import set [as 别名]
table, with the entry name (lower case) as key, and a
instance of Types.EntryDescription as value. """,
hook = _check_default)
Config.define ('base/defaulttype', """ Default type for a newly created entry """,
vtype = Config.Element (_get_entries))
Config.define ('base/lyxpipe', """ Path to the LyX server """,
vtype = Config.String ())
Config.define ('base/keyformat', """ Style of generated keys """,
vtype = Config.Element (_get_keytypes))
# --------------------------------------------------
Config.set ('base/keyformat', 'Default')
# Available fields
fields = [ 'CrossRef', 'Key', 'Author', 'Address_1', 'Address_2',
'Title', 'SpecificTitle', 'Journal', 'Special', 'Type', 'BookTitle',
'Subject', 'Ownership', 'Series', 'Editor', 'Edition', 'Volume',
'Number', 'Chapter', 'Pages', 'School', 'Organization', 'Location',
'Dates', 'Institution', 'Publisher', 'Address', 'Format',
'Date', 'NoSeries', 'ConfPlace', 'Cote', 'IEEECN', 'Annotate',
'Quote', 'LoCN', 'ISBN', 'ISSN', 'Note', 'Language', 'HowPublished',
'To_Appear', 'From', 'Received', 'Owner', 'Keywords', 'Abstract',
'Remarks', 'URL', 'Beigabevermerk' ]
entries = {
'Article' : (('author', 'title', 'journal', 'date'),
示例9: macros
# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import set [as 别名]
Config.define ('bibtex/macros', """ A dictionnary defining the BibTeX
macros (@String{} macros). Each entry of the dictionnary is a 2-uple :
the first field is the expansion of the macro, the second is a boolean
indicating if this macro definition has to be saved in the .bib files """,
Config.Dict (Config.String (),
Config.Tuple ((Config.String (), Config.Boolean ()))))
Config.define ('bibtex/datefield', """ A hash table linking a `real'
date field to the two bibtex fields that compose it """)
Config.define ('bibtex/months', """ A hash table linking month names to their
values """)
# ==================================================
Config.set ('bibtex/keep-preamble', 1)
Config.set ('bibtex/strict', 0)
Config.set ('bibtex/macros',
{'jan' : ("January", 0),
'feb' : ("February", 0),
'mar' : ("March", 0),
'apr' : ("April", 0),
'may' : ("May", 0),
'jun' : ("June", 0),
'jul' : ("July", 0),
'aug' : ("August", 0),
'sep' : ("September", 0),
'oct' : ("October", 0),
示例10: braces
# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import set [as 别名]
Config.define ('bibtex+/braces',
""" A boolean specifying if pybliographic should use
braces (instead of quotes) to limit entries """,
Config.Boolean ())
Config.define ('bibtex+/capitalize', """ A flag indicating if
pybliographer should handle automatic capitalization in the bibtex
output """, vtype = Config.Dict (Config.Element (_get_text_ent),
Config.Boolean ()))
Config.define ('bibtex+/override', """ A boolean indicating if the
macro definitions provided here should override the ones given in a
file """, Config.Boolean ())
Config.define ('bibtex+/dateformat', """ A template used for date formatting """,
Config.String ())
Config.set ('bibtex+/braces', 1)
Config.set ('bibtex+/capitalize', {
'title' : 1,
'booktitle' : 1,
})
Config.set ('bibtex+/override', 0)
Config.set ('bibtex+/dateformat', "{%(day)d } # %(month)s")
示例11: in
# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import set [as 别名]
Config.define ('gnomeui/multiline',
""" Fields displayed in a multi-line widget """,
Config.Dict (Config.Element (_text_get),
Config.Boolean ()),
hook = _on_multiline_select)
# --------------------------------------------------
Config.set ('gnomeui/monospaced',
gtk.gdk.Font ('-*-*-*-r-normal-*-*-*-*-*-c-*-iso8859-1'))
h = Config.get ('base/fields').data
Fields.AuthorGroup.widget = Editor.AuthorGroup
Fields.Text.widget = Editor.Entry
Fields.URL.widget = Editor.URL
Fields.Reference.widget = Editor.Reference
Fields.Date.widget = Editor.Date
Fields.Date.justification = gtk.JUSTIFY_RIGHT
for f, w in (('author', 150),
('editor', 150),
示例12:
# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import set [as 别名]
from Pyblio import Config
Config.define ('medline/mapping',
""" A hash table containing field names correspondances """,
Config.Dict (Config.String (), Config.String ()))
Config.set ('medline/mapping', {
'UI' : 'medlineref',
'AU' : 'author',
'DP' : 'date',
'TI' : 'title',
'LA' : 'language',
'MH' : 'keywords',
'AD' : 'affiliation',
'AB' : 'abstract',
'AD' : 'authoraddress',
'TA' : 'journal',
'CY' : 'country',
'PG' : 'pages',
'IP' : 'number',
'VI' : 'volume',
})
示例13:
# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import set [as 别名]
Config.define ('gnome/native-as-default', """ Should we edit the
entries in their native format by default ? """, Config.Boolean ())
Config.define ('gnome/old-confirmation-dialog',
""" Should we use the old dialog when closing, and ask for permission to skip saving? """, Config.Boolean ())
Config.define ('gnome/searched', """ List of searchable fields """,
Config.List (Config.String ()))
Config.define ('gnome/history', """ Size of the history file """,
Config.Integer (min = 1))
Config.define ('gnome/paste-key', """ Paste key instead of entry content """,
Config.Boolean ())
# --------------------------------------------------
Config.set ('gnome/searched', ['Author', 'Title', 'Abstract', 'Date'])
Config.set ('gnome/tooltips', 1)
Config.set ('gnome/native-as-default', 0)
Config.set ('gnome/old-confirmation-dialog', 0)
Config.set ('gnome/columns', ('Author', 'Date', 'Title'))
Config.set ('gnome/history', 10)
Config.set ('gnome/paste-key', 1)