from Legacy 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)
from Legacy 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 ())
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 pyblio """, 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 ())
from Legacy import Config, Types from Legacy.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 ## """)
from Legacy import Config, Fields from Legacy.GnomeUI import Utils, Editor import gtk 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): h = Config.get ('base/fields').data for k, v in multi.items (): if not h.has_key (k): continue if v: h [k].widget = Editor.Text else: h [k].widget = Editor.Entry
from Legacy 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),
# -*- coding: 'utf-8' -*- from Legacy 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'],
from Legacy 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", }, )
import string from Legacy 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 pyblio should use braces (instead of quotes) to limit entries """, Config.Boolean ()) Config.define ('bibtex+/capitalize', """ A flag indicating if pyblio 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,