File: Resource.py

package info (click to toggle)
pybliographer 1.2.12-4squeeze1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 3,560 kB
  • ctags: 1,413
  • sloc: python: 9,817; xml: 2,560; sh: 813; makefile: 621
file content (34 lines) | stat: -rw-r--r-- 1,113 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# -*- 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'],
	     ['text/html', 'konqueror'],
	     ])