~ubuntu-branches/debian/jessie/bibus/jessie

« back to all changes in this revision

Viewing changes to BIBbase.py

  • Committer: Bazaar Package Importer
  • Author(s): Jan Beyer
  • Date: 2009-10-12 22:44:05 UTC
  • mfrom: (4.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20091012224405-edpoan0andy2kpmb
Tags: 1.5.0-1
* New upstream release
  - patch fix-BibTeXImport.patch dropped, as it is incorporated upstream
  - patch fix-finalizing-issue.patch dropped, as it is incorporated upstream
  - man-page debian/bibus.1 dropped, as it is incorporated upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
# -*- coding: utf-8 -*-
1
3
# Copyright 2004,2005 Pierre Martineau <pmartino@users.sourceforge.net>
2
4
# This file is part of Bibus, a bibliographic database that can
3
5
# work together with OpenOffice.org to generate bibliographic indexes.
17
19
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
18
20
#
19
21
import wx
 
22
MIN_WXVERSION = (2,8,6,0)   # we require version 2.8.6.0 since bibus 1.5
20
23
""" program constants
21
24
BIB= definition of the references in the db
22
25
BIBKEYS= KEYS for tree"""
23
26
 
 
27
# Debug
 
28
import logging
 
29
LEVEL = logging.DEBUG
 
30
 
24
31
# constants
25
 
BIBUS_VERSION = '1.4.3'
 
32
BIBUS_VERSION = "1.5.0"
 
33
BIBUS_AUTHOR = ['The Bibus Team',\
 
34
                'Pierre Martineau',\
 
35
                'Jan Beyer',\
 
36
                'Mounir',\
 
37
                'Bernd Lechner',\
 
38
                'akniss',\
 
39
                'Hilaire Elfunesto',\
 
40
                'Georges Schutz',\
 
41
                'Martijn Werts',\
 
42
                'Jere Kahanpää',\
 
43
                'Matt Neilson',\
 
44
                'Farkas Gergely',\
 
45
                'azure',\
 
46
                'Renaud G',\
 
47
                'Martin Srebotnjak']
 
48
                
 
49
BIBUS_TRANSLATORS = ["French\t\tPierre Martineau <pmartino@users.sf.net>",\
 
50
                    "Russian\t\tazure <azure@fast.net.ua>",\
 
51
                    "Spanish\t\t",\
 
52
                    "Brasilian\t\t",\
 
53
                    "Portuguese\t\t",\
 
54
                    "Czech\t\tDan Rajdl <rajdl@fnplzen.cz>",\
 
55
                    "Slovenian\t\tMartin Srebotnjak <miles@filmsi.net>",\
 
56
                    "Chinese\t\t欧阳宏 <max.ouyang@gmail.com>",\
 
57
                    "Hungarian\t\tFarkas Gergely <psziroot@yahoo.co.uk>",\
 
58
                    "German\t\tBernd Lechner <fritz_the_cat@users.sourceforge.net>"]
 
59
 
 
60
BIBUS_ICON = "bibus.xpm"
 
61
BIBUS_WEB = "http://bibus-biblio.sourceforge.net/"
 
62
 
26
63
CONFIG_VERSION = None
27
 
CONFIG = None   # config file
28
 
FIRST_START = True      # first startup of bibus if true => first time help
29
 
FILES = ''      # path to the directory containing the full text files (pdf, etc...)
30
 
AUTHORTOLONG = 30       # when an author is longer, we issue a warning because there is presumably a missing BIB.SEP (RefEditor)
 
64
CONFIG = None    # config file
 
65
FIRST_START = True    # first startup of bibus if true => first time help
 
66
FILES = ''    # path to the directory containing the full text files (pdf, etc...)
 
67
AUTHORTOLONG = 30    # when an author is longer, we issue a warning because there is presumably a missing BIB.SEP (RefEditor)
 
68
WILDCARD = "%s (*.pdf)|*.pdf|%s (*.odt)|*.odt|%s (*.doc)|*.doc|%s (*.*)|*.*"\
 
69
            %(_("Acrobat file"),\
 
70
            _("OpenOffice.org Text Document"),\
 
71
            _("Microsoft Word Document"),\
 
72
            _("All files"))                    # Wildcard used in files open for fulltext links
 
73
# Internet access
 
74
PUBMED = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils"
 
75
PUBMEDVIEW = "http://view.ncbi.nlm.nih.gov/pubmed"
 
76
PROXIES = None  # None => system proxy for windows and MacOS.
31
77
 
32
78
# keys
33
 
KEY_TAGGED = 't'        # keypress to tag a reference (without Ctrl)
34
 
KEY_SWITCH_DISPLAY = 'f'        # keypress to switch reference display (bottom-right panel)
 
79
KEY_TAGGED = 't'    # keypress to tag a reference (without Ctrl)
 
80
KEY_SWITCH_DISPLAY = 'f'    # keypress to switch reference display (bottom-right panel)
35
81
# Shortcuts
36
82
KEY_QUIT = 'Q'
37
83
KEY_NEW = 'N'
38
84
KEY_DEL = 'D'
39
85
KEY_TAG = 'T'
40
 
KEY_SEARCH = 'S'
 
86
KEY_SEARCH = 'F'    # We have changed the key to a standard Find
41
87
KEY_PUBMED = 'M'
42
88
KEY_COPY = 'C'
43
89
KEY_CUT = 'X'
44
90
KEY_PASTE = 'V'
 
91
KEY_COPYID = 'C'
45
92
KEY_SELECT_ALL = 'A'
46
93
KEY_PRINT = 'P'
47
94
KEY_OO_INSERT = 'I'
48
 
KEY_OO_FORMAT = 'F'
 
95
KEY_OO_FORMAT = 'U' # Because of the change for Search, we must change here from F to U == Update
49
96
KEY_OO_GOWRITER = 'G'
50
97
KEY_ETBLAST = 'B'
51
98
 
 
99
# Zotero plugin RPC server
 
100
ZOTEROPLUGIN = False
52
101
#
53
 
WP = 'OOo'                              # name of the Word Processor in which we insert refs. OOo / mswDoc / ''. This is the name of the module to import.
 
102
WP = 'OOo'                # name of the Word Processor in which we insert refs. OOo / mswDoc / Lyx / ''. This is the name of the module to import.
54
103
# Openoffice.org constants
55
 
bibOOo_cit_baseCharStyleName = 'bibus_cit_base'         # base style for citations
56
 
bibOOo_index_baseCharStyleName = 'bibus_index_base'     # base style for bibliography index
57
 
OO_CREATE_BIB = True    # True if we must create a bibliographic index if it does not exist
58
 
OO_AUTO_UPDATE = True   # True if index update on Insert
59
 
OO_HILIGHT = False              # True if citations are hilighted with a yellow background
60
 
OO_HILIGHT_COLOR = 0x00FFFF00   # hilight background color
61
 
OO_CON_TYPE = 1                 # connection type. 0=TCP/IP ; 1=pipe
62
 
OO_HOST = 'localhost'   # host on which OOo is running (TCP/IP)
63
 
OO_PORT = 8100                  # connection port
64
 
OO_PIPE = "OOo_pipe"    # pipe name for connection
 
104
bibOOo_cit_baseCharStyleName = 'bibus_cit_base'        # base style for citations
 
105
bibOOo_index_baseCharStyleName = 'bibus_index_base'    # base style for bibliography index
 
106
OO_CREATE_BIB = True    # True if we must create a bibliographic index if it does not exist
 
107
OO_AUTO_UPDATE = True    # True if index update on Insert
 
108
OO_HILIGHT = False        # True if citations are hilighted with a yellow background
 
109
OO_HILIGHT_COLOR = 0x00FFFF00    # hilight background color
 
110
OO_CON_TYPE = 1         # connection type. 0=TCP/IP ; 1=pipe
 
111
OO_HOST = 'localhost'    # host on which OOo is running (TCP/IP)
 
112
OO_PORT = 8100            # connection port
 
113
OO_PIPE = "OOo_pipe"     # pipe name for connection
 
114
LYX_PIPE = "~/.lyx/lyxpipe"  # Lyx pipe connection (linux only). We will convert to ~/.lyx/lyxpipe.in
65
115
BIB_FIELDS=('Id','Identifier', 'BibliographicType', 'Address', 'Annote', 'Author', 'Booktitle', 'Chapter', 'Edition', 'Editor', 'Howpublished', 'Institution', 'Journal', 'Month', 'Note', 'Number', 'Organizations', 'Pages', 'Publisher', 'School', 'Series', 'Title', 'Report_Type', 'Volume', 'Year', 'URL', 'Custom1', 'Custom2', 'Custom3', 'Custom4', 'Custom5', 'ISBN','Abstract')
66
116
BIB_TYPE=('ARTICLE','BOOK','BOOKLET','CONFERENCE','INBOOK','INCOLLECTION','INPROCEEDINGS','JOURNAL','MANUAL','MASTERTHESIS','MISC','PHDTHESIS','PROCEEDINGS','TECHREPORT','UNPUBLISHED','EMAIL','WWW','CUSTOM1','CUSTOM2','CUSTOM3','CUSTOM4','CUSTOM5')
67
117
BIBLIOGRAPHIC_FIELDS = {}
68
118
for i in range(len(BIB_FIELDS)):
69
 
        BIBLIOGRAPHIC_FIELDS[BIB_FIELDS[i]] = i
 
119
    BIBLIOGRAPHIC_FIELDS[BIB_FIELDS[i]] = i
70
120
#{'Id':0, 'Identifier':1, 'BibliographicType':2,...'ISBN':31, 'Abstract':32}
71
121
BIBLIOGRAPHIC_TYPE = {}
72
122
for i in range(len(BIB_TYPE)):
73
 
        BIBLIOGRAPHIC_TYPE[BIB_TYPE[i]] = i
 
123
    BIBLIOGRAPHIC_TYPE[BIB_TYPE[i]] = i
74
124
# BIBLIOGRAPHIC_TYPE = {'ARTICLE':'0','BOOK':'1','BOOKLET':'2','CONFERENCE':'3','INBOOK':'4','INCOLLECTION':'5','INPROCEEDINGS':'6','JOURNAL':'7','MANUAL':'8','MASTERTHESIS':'9','MISC':'10','PHDTHESIS':'11','PROCEEDINGS':'12','TECHREPORT':'13','UNPUBLISHED':'14','EMAIL':'15','WWW':'16','CUSTOM1':'17','CUSTOM2':'18','CUSTOM3':'19','CUSTOM4':'20','CUSTOM5':'21'}
75
125
# images for sort_icon in listRef
76
126
# images must be initialized after wx.App: This is done in bibus.py
80
130
# Image list for KeyTree
81
131
IMAGESKEY = None
82
132
# printing
83
 
PRINTER = None          # wx.HtmlEasyPrinting instance
84
 
HTML_FONT_SIZE = '',''  # size for HTML text. '','' = normal ; '<small>','</small>' = small ; etc.. ; small or '' is ok for linux ; '' better for Windows
85
 
PRINTER_USE_OOo_FORMAT = True   # if we use the OOo format for printing or the format defined by PRINTER_FORMAT
86
 
PRINTER_FORMAT = {}     # Define which fields are printed for each BibliographicType. See below for the default values.
87
 
PRINTER_COLORS = '000000','000000'      # colors of 'Field Name', 'Field Value' in HTML RVB
88
 
PRINTER_STYLE = (1,0,0),(0,0,0)         # (bold,italic,underline),(bold,italic,underline) of name,value
 
133
PRINTER = None        # wx.HtmlEasyPrinting instance
 
134
HTML_FONT_SIZE = '',''    # size for HTML text. '','' = normal ; '<small>','</small>' = small ; etc.. ; small or '' is ok for linux ; '' better for Windows
 
135
PRINTER_USE_OOo_FORMAT = True    # if we use the OOo format for printing or the format defined by PRINTER_FORMAT
 
136
PRINTER_FORMAT = {}    # Define which fields are printed for each BibliographicType. See below for the default values.
 
137
PRINTER_COLORS = '000000','000000'    # colors of 'Field Name', 'Field Value' in HTML RVB
 
138
PRINTER_STYLE = (1,0,0),(0,0,0)        # (bold,italic,underline),(bold,italic,underline) of name,value
89
139
# Databases
90
140
DB_TABLE_REF = 'bibref'
91
141
DB_TABLE_KEY = 'bibrefKey'
92
142
DB_TABLE_LINK = 'bibrefLink'
93
143
DB_TABLE_QUERY = 'bibquery'
94
144
DB_TABLE_MODIF = 'table_modif'
95
 
TMP_ONLINE = 'tmp_online'       # temporary table where online search are stored
96
 
TMP_IMPORT = 'tmp_import'       # temporary table where imported references are stored
97
 
SEP=';'                                 # list separator in database fields
98
 
DB_STARTUP = 0          # 0 = last used db used at startup. 1 = default db
 
145
DB_TABLE_FILE = 'file'
 
146
TMP_ONLINE = 'tmp_online'    # temporary table where online search are stored
 
147
TMP_IMPORT = 'tmp_import'    # temporary table where imported references are stored
 
148
SEP=';'                    # list separator in database fields
 
149
DB_STARTUP = 0        # 0 = last used db used at startup. 1 = default db
99
150
DB_TYPES = ['MySQL','SQLite']
100
 
DB_TYPE ='SQLite'       # type of database used 'MySQL','SQlite', etc... => modules dbBibMySQL,dbBibSQLite, etc...
101
 
DB_MODULE = None        # contains the module of the currently used connection
 
151
DB_TYPE ='SQLite'    # type of database used 'MySQL','SQlite', etc... => modules dbBibMySQL,dbBibSQLite, etc...
 
152
DB_MODULE = None    # contains the module of the currently used connection
102
153
# sqlite constants
103
154
SQLiteFile = ''
104
155
SQLiteUSER = ''
105
156
# MySQL constants
106
 
DB_NAME = 'Biblio_41'   # Default MySQL database name
 
157
DB_NAME = 'Biblio_41'    # Default MySQL database name
107
158
SOCKET = '/var/run/mysqld/mysqld.sock'
108
159
PORT = 3306
109
160
HOST = 'localhost'
110
161
USER = ''
111
162
PASSWORD = ''
112
 
STORE_PASSWD = False    # True if password saved in config file. Unsecure !
 
163
STORE_PASSWD = False    # True if password saved in config file. Unsecure !
113
164
# window sizes
114
 
TITLE = _("Database = None")    # main window title
115
 
WELCOME = _("Welcome to bibus") # welcome message in wx.StatusBar
 
165
TITLE = _("Database = None")    # main window title
 
166
WELCOME = _("Welcome to bibus")    # welcome message in wx.StatusBar
116
167
WIDTH = 620
117
168
HEIGHT = 380
118
169
SASH_KEYTREE = 150
119
170
SASH_LIST = 200
120
171
WX = -1
121
172
WY = -1
122
 
REF_Ed_X = -1           # refeditor x position
123
 
REF_Ed_Y = -1           # y position
124
 
REF_Ed_WIDTH = 500      # width. Height auto, depends on reference type
125
 
IMPORT_X = -1           # Import text window (ImportFrame.py)
 
173
REF_Ed_X = -1        # refeditor x position
 
174
REF_Ed_Y = -1        # y position
 
175
REF_Ed_WIDTH = 500    # width. Height auto, depends on reference type
 
176
IMPORT_X = -1        # Import text window (ImportFrame.py)
126
177
IMPORT_Y = -1
127
178
IMPORT_WIDTH = 388
128
179
IMPORT_HEIGHT = 392
129
 
IMPORT_FORMAT = 0       # Default format for text import (0=="PubMed", 1=="Refer", 2=="RIS")
130
 
SEARCH_X = -1           # Search window size
 
180
IMPORT_FORMAT = 0    # Default format for text import (0=="PubMed", 1=="Refer", 2=="RIS")
 
181
SEARCH_X = -1        # Search window size
131
182
SEARCH_Y = -1
132
183
SEARCH_WIDTH = -1
133
184
SEARCH_HEIGHT = -1
134
 
PUBMED_X = -1           # Search pubmed window size
 
185
PUBMED_X = -1        # Search pubmed window size
135
186
PUBMED_Y = -1
136
187
PUBMED_WIDTH = -1
137
188
PUBMED_HEIGHT = -1
138
 
PUBMED_NB = 20          # number of pubmed record to import (1..10000)
 
189
PUBMED_NB = 20        # number of pubmed record to import (1..10000)
 
190
#
 
191
MOVEAUTO = False    # Automatic rename of files and move them in BIB.FILES
139
192
#
140
193
ENCODING='utf-8'
141
194
ENC_ERRORS='strict'
142
195
#
143
 
LOCALEDIR = ''          # directory for gettext translation files. Value set in bibus.py at startup
144
 
SOURCEDIR = ''          # directory where the software is installed. Value set in bibus.py at startup
145
 
DOCPATH = ''            # path to the doc html root file. Value set in bibus.py at startup
146
 
LICENCEPATH = ''        # path to the Licence txt. Value set in bibus.py at startup
147
 
OOPATH = ''                     # path OOo/program directory. Value set in bibus.py at startup from bibus.cfg
148
 
#
149
 
FORMAT_DICO = None      # conversion dictionary for reference formatting. Must be given as a parameter to a Format.Converter object
150
 
FORMAT_CONV = None      # conversion dictionary for reference formatting. a Format.Converter object
151
 
STYLES = {}             # STYLES[menuId] = filename
152
 
STYLE_CURRENT = ''      # filename of the currently used style
153
 
STYLE_MENU = None       # the menu to which we must add the styles
154
 
#
155
 
ROOT='' # title of the root tree
156
 
ALL='All'               # name of the branch containing all the records
157
 
QUERY='Query'   # key branch of the queries
 
196
LOCALEDIR = ''        # directory for gettext translation files. Value set in bibus.py at startup
 
197
SOURCEDIR = ''        # directory where the software is installed. Value set in bibus.py at startup
 
198
DOCPATH = ''        # path to the doc html root file. Value set in bibus.py at startup
 
199
DOCWEBPAGE = "http://bibus-biblio.sourceforge.net/wiki/index.php/First_steps"   # Online doc
 
200
FAQWEBPAGE = "http://bibus-biblio.sourceforge.net/wiki/index.php/FAQ"
 
201
LICENCEPATH = ''    # path to the Licence txt. Value set in bibus.py at startup
 
202
OOPATH = ''            # path OOo/program directory. Value set in bibus.py at startup from bibus.cfg
 
203
#
 
204
FORMAT_DICO = None    # conversion dictionary for reference formatting. Must be given as a parameter to a Format.Converter object
 
205
FORMAT_CONV = None    # conversion dictionary for reference formatting. a Format.Converter object
 
206
STYLES = {}        # STYLES[menuId] = filename
 
207
STYLE_CURRENT = ''    # filename of the currently used style
 
208
STYLE_MENU = None    # the menu to which we must add the styles
 
209
#
 
210
ROOT=''    # title of the root tree
 
211
ALL='All'        # name of the branch containing all the records
 
212
QUERY='Query'    # key branch of the queries
158
213
IMPORT='Import'
159
214
ONLINE='Online'
160
215
REF='References'
161
216
CITED = 'Cited'
162
217
TAGGED = 'Tagged'
163
218
TRASH = 'Trash'
164
 
CATEGORIES=(ALL,REF,TAGGED,QUERY,ONLINE,IMPORT,CITED,TRASH)     # list of the item to add to root. Names in the db. Order is the order of the keys from top.
 
219
CATEGORIES=(ALL,REF,TAGGED,QUERY,ONLINE,IMPORT,CITED,TRASH)    # list of the item to add to root. Names in the db. Order is the order of the keys from top.
165
220
Q=_('Queries')
166
221
I=_('Import buffer')
167
222
A=_('All my references')
171
226
T=_('Tagged')
172
227
TR= _('Non-classified')
173
228
TRANSLATE={QUERY:Q,IMPORT:I,ALL:A,ONLINE:O,REF:R,CITED:C,TAGGED:T, TRASH:TR} # translation db_name -> tree-name
174
 
NEWKEY=_('NewKey')      # default name for inserted key
175
 
SEP_DUP=u'#'    # character to use in keytree when key duplicated
176
 
OPEN_CIT = u'[' # before citation for Drag & Drop
177
 
CLOSE_CIT = u']'        # after citation for Drag & Drop
 
229
NEWKEY=_('NewKey')    # default name for inserted key
 
230
SEP_DUP=u'#'    # character to use in keytree when key duplicated
 
231
OPEN_CIT = u'['    # before citation for Drag & Drop
 
232
CLOSE_CIT = u']'    # after citation for Drag & Drop
178
233
# list display
179
 
LIST_DISPLAY = ('Identifier','Year','Author','Title')   # Fields displayed in reflist wx.ListCtrl
180
 
LIST_COL_SIZE = (120, 55, 240, 440)     # column sizes if fixed
 
234
LIST_DISPLAY = ('Identifier','Year','Author','Title')    # Fields displayed in reflist wx.ListCtrl
 
235
LIST_COL_SIZE = (120, 55, 240, 440)    # column sizes if fixed
181
236
LIST_COL_SIZE_DEFAULT = 100
182
 
LIST_ORDER = 'Identifier'       # Display order in reflist
183
 
LIST_HOW = 'ASC'                        # How list are sorted by default 'Asc'ending or 'Desc'ending
184
 
LIST_SHORT = 50                         # We cut the field at this length for display => faster for long author list
185
 
LIST_FIELD_FORMAT={}            # this dico allows to format the fields for display/printing
 
237
LIST_ORDER = 'Identifier'    # Display order in reflist
 
238
LIST_HOW = 'ASC'            # How list are sorted by default 'Asc'ending or 'Desc'ending
 
239
LIST_SHORT = 50                # We cut the field at this length for display => faster for long author list
 
240
LIST_FIELD_FORMAT={}        # this dico allows to format the fields for display/printing
186
241
for field in BIB_FIELDS:
187
 
        LIST_FIELD_FORMAT[field] = lambda x:x   # do nothing
188
 
LIST_FIELD_FORMAT['Id'] = lambda x: str(x)      # we need a string to display
189
 
LIST_FIELD_FORMAT['BibliographicType'] = lambda x: NAME_TYPE[BIB_TYPE[int(x)]]  # convert number to BibliographicType name for display
 
242
    LIST_FIELD_FORMAT[field] = lambda x:x    # do nothing
 
243
LIST_FIELD_FORMAT['Id'] = lambda x: str(x)    # we need a string to display
 
244
LIST_FIELD_FORMAT['BibliographicType'] = lambda x: NAME_TYPE[BIB_TYPE[int(x)]]    # convert number to BibliographicType name for display
190
245
#
191
 
DISPLAY_FORMAT = 0              # Format in the bottom-right panel. Tab number. 0=OOo ; 1=Full ; 2=Keys ; ...
192
 
KEY_COLOR = wx.RED              # color display of keys (Title, AUthor, etc..) in textCtrl-1
193
 
TEXT_COLOR = wx.BLACK   # color display of text (Title, Author, etc..) in textCtrl-1
 
246
DISPLAY_FORMAT = 0        # Format in the bottom-right panel. Tab number. 0=OOo ; 1=Full ; 2=Keys ; ...
 
247
KEY_COLOR = wx.RED        # color display of keys (Title, AUthor, etc..) in textCtrl-1
 
248
TEXT_COLOR = wx.BLACK    # color display of text (Title, Author, etc..) in textCtrl-1
194
249
DnD_FORMAT = wx.CustomDataFormat('bibus/dnd') # the custom format for DnD
195
 
DnD_REF = 'bibus/ref'   # the custom format for DnD of references
196
 
DnD_KEY = 'bibus/key'   # the custom format for DnD of keys
 
250
DnD_REF = 'bibus/ref'    # the custom format for DnD of references
 
251
DnD_KEY = 'bibus/key'    # the custom format for DnD of keys
 
252
TEXT_CLIPBOARD = 'Refer'    # format of the text copied in clipboard. Must be an export filter name in Export directory EXCEPT 'html' which is already copied.
197
253
BIB_SEARCH_FIELDS=('Annote', 'Author', 'Booktitle', 'Journal', 'Note', 'Title', 'Year', 'Custom1', 'Custom2', 'Custom3', 'Custom4', 'Custom5', 'Abstract')
198
254
#
199
 
SHORTCUTS = [_("Author"),_("Journal"),_("Divers")]      # list of Shortcut categories
200
 
# SHORTFILE = []        # list of path to the files containing the pickle list of shortcuts
201
 
SHORT = {}              # dir of list of shorcuts for each category SHORT['Author']=['Martin','John',...]
202
 
SHORTCUT_DEFAULT = _('shortcut')        # default value for shortcuts
 
255
SHORTCUTS = [_("Author"),_("Journal"),_("Divers")]    # list of Shortcut categories
 
256
# SHORTFILE = []    # list of path to the files containing the pickle list of shortcuts
 
257
SHORT = {}        # dir of list of shorcuts for each category SHORT['Author']=['Martin','John',...]
 
258
SHORTCUT_DEFAULT = _('shortcut')    # default value for shortcuts
203
259
# constant to define allowed actions in menu. Use bit comparison
204
 
RENAME_OK = 2**0        # if possible to edit the name
205
 
DELETE_OK = 2**10       # if possible to delete the key
206
 
CHILD_OK = 2**1         # if menu add child ok
207
 
DRAG_OK = 2**2          # if the key can be dragged
208
 
DROP_OK = 2**3          # if a key can be dropped on it
209
 
SELECT_OK = 2**4        # if the key can be selected
210
 
REF_EDIT_OK = 2**5      # if a ref associated with this key can be edited
211
 
REF_DEL_OK = 2**6       # if a ref associated with this key can be deleted
212
 
REF_NEW_OK = 2**7       # if a ref associated with this key can be created
213
 
REF_DRAG_OK = 2**8      # if a ref associated with this key can be dragged to another key
214
 
REF_DROP_OK =2**9       # if a ref can be dropped on this key
215
 
OOo_INSERT_OK = 2**11   #  if a ref associated with this key can be inserted in OOo
216
 
EXPORT_OK = 2**12       # is it possible to export references associated with this key ?
217
 
REF_TAG_OK = 2**13      # if a ref associated with this key can be tagged
218
 
REF_PRINT_OK = 2**14    # if we can print the reference
219
 
REF_DUP_OK = 2**15      # if a ref associated with this key can be duplicated
 
260
RENAME_OK = 2**0    # if possible to edit the name
 
261
DELETE_OK = 2**10    # if possible to delete the key
 
262
CHILD_OK = 2**1        # if menu add child ok
 
263
DRAG_OK = 2**2        # if the key can be dragged
 
264
DROP_OK = 2**3        # if a key can be dropped on it
 
265
SELECT_OK = 2**4    # if the key can be selected
 
266
REF_EDIT_OK = 2**5    # if a ref associated with this key can be edited
 
267
REF_DEL_OK = 2**6    # if a ref associated with this key can be deleted
 
268
REF_NEW_OK = 2**7    # if a ref associated with this key can be created
 
269
REF_DRAG_OK = 2**8    # if a ref associated with this key can be dragged to another key
 
270
REF_DROP_OK =2**9    # if a ref can be dropped on this key
 
271
OOo_INSERT_OK = 2**11    #  if a ref associated with this key can be inserted in OOo
 
272
EXPORT_OK = 2**12    # is it possible to export references associated with this key ?
 
273
REF_TAG_OK = 2**13    # if a ref associated with this key can be tagged
 
274
REF_PRINT_OK = 2**14    # if we can print the reference
 
275
REF_DUP_OK = 2**15    # if a ref associated with this key can be duplicated
220
276
 
221
277
ALL_OK = -1
222
278
READ_ONLY = REF_DRAG_OK | SELECT_OK
227
283
ID_ONLINE_ROOT = 2**3
228
284
ID_IMPORT_ROOT = 2**4
229
285
ID_REF = 2**5
230
 
ID_REF_ALL = 2**6       # item ALL refs of key REF
 
286
ID_REF_ALL = 2**6    # item ALL refs of key REF
231
287
ID_QUERY = 2**7
232
288
ID_ONLINE = 2**8
233
289
ID_IMPORT = 2**9
234
 
ID_CITED = 2**10        # item 'Cited in current OOo doc'
 
290
ID_CITED = 2**10    # item 'Cited in current OOo doc'
235
291
ID_TAGGED = 2**11
236
292
ID_TRASH = 2**12
237
293
# The following directory: give the children type. Used when a children is created.
244
300
ALLOWED['rw']={}
245
301
ALLOWED['rw'][ID_ROOT]= 0
246
302
ALLOWED['rw'][ID_REF_ROOT]= CHILD_OK | DROP_OK | SELECT_OK | REF_EDIT_OK | REF_DEL_OK | REF_NEW_OK | REF_DRAG_OK | REF_DROP_OK | OOo_INSERT_OK | EXPORT_OK | REF_TAG_OK | REF_PRINT_OK | REF_DUP_OK
247
 
ALLOWED['rw'][ID_QUERY_ROOT] = READ_ONLY        #| EXPORT_OK | REF_PRINT_OK | REF_DUP_OK
 
303
ALLOWED['rw'][ID_QUERY_ROOT] = READ_ONLY     #| EXPORT_OK | REF_PRINT_OK | REF_DUP_OK
248
304
ALLOWED['rw'][ID_ONLINE_ROOT] = READ_ONLY
249
305
ALLOWED['rw'][ID_IMPORT_ROOT] = READ_ONLY
250
306
ALLOWED['rw'][ID_REF] = ALL_OK
259
315
ALLOWED['ro']={}
260
316
ALLOWED['ro'][ID_ROOT]= 0
261
317
ALLOWED['ro'][ID_REF_ROOT]= CHILD_OK | DROP_OK | SELECT_OK | REF_DEL_OK | REF_DRAG_OK | REF_DROP_OK | OOo_INSERT_OK | EXPORT_OK | REF_TAG_OK | REF_PRINT_OK
262
 
ALLOWED['ro'][ID_QUERY_ROOT] = READ_ONLY        #| EXPORT_OK | REF_PRINT_OK
 
318
ALLOWED['ro'][ID_QUERY_ROOT] = READ_ONLY     #| EXPORT_OK | REF_PRINT_OK
263
319
ALLOWED['ro'][ID_ONLINE_ROOT] = READ_ONLY
264
320
ALLOWED['ro'][ID_IMPORT_ROOT] = READ_ONLY
265
321
ALLOWED['ro'][ID_REF] = RENAME_OK| DELETE_OK | CHILD_OK | DROP_OK | SELECT_OK | REF_DEL_OK | REF_DRAG_OK | REF_DROP_OK | OOo_INSERT_OK | EXPORT_OK | REF_TAG_OK | REF_PRINT_OK
274
330
ALLOWED['rk']={}
275
331
ALLOWED['rk'][ID_ROOT]= 0
276
332
ALLOWED['rk'][ID_REF_ROOT]= READ_ONLY | OOo_INSERT_OK | EXPORT_OK | REF_PRINT_OK
277
 
ALLOWED['rk'][ID_QUERY_ROOT] = READ_ONLY        #| EXPORT_OK | REF_PRINT_OK
 
333
ALLOWED['rk'][ID_QUERY_ROOT] = READ_ONLY     #| EXPORT_OK | REF_PRINT_OK
278
334
ALLOWED['rk'][ID_ONLINE_ROOT] = READ_ONLY
279
335
ALLOWED['rk'][ID_IMPORT_ROOT] = READ_ONLY
280
336
ALLOWED['rk'][ID_REF] = READ_ONLY | OOo_INSERT_OK | EXPORT_OK | REF_PRINT_OK
289
345
ALLOWED['rr']={}
290
346
ALLOWED['rr'][ID_ROOT]= 0
291
347
ALLOWED['rr'][ID_REF_ROOT]= READ_ONLY | OOo_INSERT_OK | EXPORT_OK | REF_PRINT_OK
292
 
ALLOWED['rr'][ID_QUERY_ROOT] = READ_ONLY        #| EXPORT_OK | REF_PRINT_OK
 
348
ALLOWED['rr'][ID_QUERY_ROOT] = READ_ONLY     #| EXPORT_OK | REF_PRINT_OK
293
349
ALLOWED['rr'][ID_ONLINE_ROOT] = READ_ONLY
294
350
ALLOWED['rr'][ID_IMPORT_ROOT] = READ_ONLY
295
351
ALLOWED['rr'][ID_REF] = READ_ONLY | OOo_INSERT_OK | EXPORT_OK | REF_PRINT_OK
307
363
# () nobody can edit it, except 'Admin' when logged as 'Admin'
308
364
# ('*',) all users can edit it
309
365
# ('Admin','toto') 'Admin' and 'toto' can edit it
310
 
SHARED_DBNAME = "Admin"         # Administrator name in the database
311
 
SHARED_NAME = _("Shared")       # Name of the shared panel
 
366
SHARED_DBNAME = "Admin"        # Administrator name in the database
 
367
SHARED_NAME = _("Shared")    # Name of the shared panel
312
368
ADMIN = ('*',) # list of users that can edit this shared category. ('*',) = All users with write access, ie rw users; don't forget the comma if the list contains a single object
313
 
MULTI_USER = True                       # if we are in a multi_users environment => mutiple keytree
 
369
MULTI_USER = True            # if we are in a multi_users environment => mutiple keytree
314
370
 
315
371
# Database fields definition
316
372
# TABLE_REF='(\
380
436
# %s varchar(255) NOT NULL,\
381
437
# %s TEXT NOT NULL)' % BIB_QUERY
382
438
BIB_MODIF=('ref_Id','creator','date','user_modif','date_modif')
 
439
BIB_FILE = ('ref_Id','path')
383
440
 
384
441
# default value for : Fields displayed in the textCtrl when a ref is selected
385
442
BIB_PRINT_FIELD=('Author','Title','Year','Journal','Volume','Pages','Abstract')
431
488
TYPE_NAME = {} # see note above about FIELD_NAME
432
489
# Printing default
433
490
for articleType in BIB_TYPE:
434
 
        PRINTER_FORMAT[articleType] = ('Identifier','BibliographicType') + EDIT[articleType][0] + ("Abstract",)
 
491
    PRINTER_FORMAT[articleType] = ('Identifier','BibliographicType') + EDIT[articleType][0] + ("Abstract",)
435
492
 
436
493
# Duplicates. tuple of Fields tested to decide it 2 ref are identical or not.
437
 
DUPLICATES_TEST = True  # True if we want to test for duplicate entries
 
494
DUPLICATES_TEST = True    # True if we want to test for duplicate entries
438
495
DUPLICATES = ('BibliographicType', 'Author', 'Booktitle', 'Chapter', 'Edition', 'Journal', 'Pages', 'Series', 'Title', 'Volume', 'Year')
439
 
DUPLICATES_CASE = False # True == comparison is Case sensitive
440
 
DUPLICATES_KEEP_OLD = True      # True = in case of duplicate we keep the old ref, False = we keep the new
 
496
DUPLICATES_CASE = False    # True == comparison is Case sensitive
 
497
DUPLICATES_KEEP_OLD = True    # True = in case of duplicate we keep the old ref, False = we keep the new
441
498
 
442
499
# Journal abbreviations
443
 
# JOURNAL[MedAbbr] = MedAbbr,IsoAbbr,JournalTitle
444
 
JOURNAL_FILE = 'journals'
445
 
JOURNAL = {}
 
500
# JOURNAL[MedAbbr.upper()] = JOURNAL[MedAbbr.upper()] = JOURNAL[MedAbbr.upper()] = [MedAbbr,IsoAbbr,JournalTitle]
 
501
# JOURNAL_ALTERNATE[MedAbbr.upper()] = JOURNAL_ALTERNATE[MedAbbr.upper()] = JOURNAL_ALTERNATE[MedAbbr.upper()] = MedAbbr.upper()
 
502
JOURNAL_FILE = 'journals.csv'
 
503
JOURNAL = {}            # keys == PubMed.upper() => values PubMed, ISO, Full 
 
504
JOURNAL_ALTERNATE = {}  # keys == PubMed.upper() or ISO.upper() or Full.upper() => value == PubMed.upper()
 
505
                        # JOURNAL[ JOUNAL_ALTERNATE['journal'.upper()] ] = PubMed,Iso,Full
446
506
JOURNAL_MODIF = False
 
507
 
 
508
# The following function return a Pattern used for automatic search of fulltext files in $FILES
 
509
PATTERN = []
 
510
PATTERN.append( lambda ref: ".*%(Author)s.*%(Year)s.*" %{'Author': ref[BIBLIOGRAPHIC_FIELDS['Author']].split(SEP)[0].split(',')[0],'Year': ref[BIBLIOGRAPHIC_FIELDS['Year']]} )
 
511
PATTERN.append( lambda ref: ".*%(Identifier)s.*" %{'Identifier': ref[BIBLIOGRAPHIC_FIELDS['Identifier']] } )
 
512