当前位置: 首页>>代码示例>>Python>>正文


Python Config.define方法代码示例

本文整理汇总了Python中Pyblio.Config.define方法的典型用法代码示例。如果您正苦于以下问题:Python Config.define方法的具体用法?Python Config.define怎么用?Python Config.define使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pyblio.Config的用法示例。


在下文中一共展示了Config.define方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: columns_checker

# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import define [as 别名]
from Pyblio import Config

def columns_checker (obj, value, userdata):
    """Only allow column names that display correctly.
    Return True if OK."""
##  print '>>>>>>>>>>>>>>>>>>>>', obj, value, userdata
    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)
开发者ID:GNOME,项目名称:pybliographer,代码行数:32,代码来源:Gnome.py

示例2: _get_fields

# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import define [as 别名]
# -*- coding: 'utf-8' -*-
from Pyblio import Config, Fields

def _get_fields ():
    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'],
开发者ID:GNOME,项目名称:pybliographer,代码行数:33,代码来源:Resource.py

示例3:

# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import define [as 别名]
from Pyblio import Config

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),
开发者ID:GNOME,项目名称:pybliographer,代码行数:33,代码来源:Refer.py

示例4: _get_elements

# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import define [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
##     """)
开发者ID:ice-pice,项目名称:pybliographer,代码行数:32,代码来源:Ovid.py

示例5: _check_default

# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import define [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


Config.define ('base/advertise', """ Specify wether or not the program should add a message
saying that the output files are generated by pybliographer """,
               vtype = Config.Boolean ())

Config.define ('base/autosave', """ Autosave files """,
               vtype = Config.Boolean ())

Config.define ('base/autosave interval', """ Time in minutes. It specifies the time interval between autosave operations. """,
               vtype = Config.Integer (min = 1))

Config.define ('base/backup', """ Create a backup copy of files before saving """,
               vtype = Config.Boolean ())

Config.define ('base/directsave', """ Direct save. It is an optional saving method
               which doesn't break links. WARNING: the risk of data loss is
               higher with this method, use only if you really need it! """,
               vtype = Config.Boolean ())
开发者ID:ice-pice,项目名称:pybliographer,代码行数:33,代码来源:Base.py

示例6: macros

# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import define [as 别名]
from Pyblio import Config

# ==================================================

Config.define ('bibtex/keep-preamble',
	       """A boolean requesting that a @preamble in the
	       BibTeX file be kept""",
	       Config.Boolean ())

Config.define ('bibtex/strict',
               """ A boolean indicating the strictness of the parsing """,
               Config.Boolean ())

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)
开发者ID:GNOME,项目名称:pybliographer,代码行数:33,代码来源:BibTeX.py

示例7: _get_text_ent

# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import define [as 别名]
import string
from Pyblio import Config, Fields

def _get_text_ent ():
    return map (lambda x: string.lower (x.name),
                filter (lambda x: x.type is Fields.Text,
                        Config.get ('base/fields').data.values ()))

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,
开发者ID:GNOME,项目名称:pybliographer,代码行数:33,代码来源:BibTeX+.py

示例8: _text_get

# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import define [as 别名]
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#

import gtk

from Pyblio import Config, Fields
from Pyblio.GnomeUI import  Editor

Config.define ('gnomeui/default', """ Graphical description of the
default field. """)

Config.define ('gnomeui/monospaced', """ A monospaced font, for native edition """)

def _text_get ():

    v = Config.get ('base/fields').data

    fields = [ x.name.lower() for x in v.values() if
               x.type is Fields.Text or x.type is Fields.LongText ]
    fields.sort ()

    return fields

def _on_multiline_select (item, multi, user):
开发者ID:GNOME,项目名称:pybliographer,代码行数:33,代码来源:GnomeUI.py

示例9:

# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import define [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',
    })
开发者ID:ice-pice,项目名称:pybliographer,代码行数:24,代码来源:Medline.py

示例10: columns_checker

# 需要导入模块: from Pyblio import Config [as 别名]
# 或者: from Pyblio.Config import define [as 别名]
from Pyblio import Config

def columns_checker (obj, value, userdata):
    """Only allow column names that display correctly.
    Return True if OK."""
##  print '>>>>>>>>>>>>>>>>>>>>', obj, value, userdata
    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/tooltips', """ A boolean indicating if
tooltips are enabled """, Config.Boolean ())

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 ())
开发者ID:ice-pice,项目名称:pybliographer,代码行数:32,代码来源:Gnome.py


注:本文中的Pyblio.Config.define方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。