Package Pyblio :: Package Cite :: Package WP
[hide private]
[frames] | no frames]

Source Code for Package Pyblio.Cite.WP

 1  # -*- coding: utf-8 -*- 
 2  # This file is part of pybliographer 
 3  #  
 4  # Copyright (C) 1998-2006 Frederic GOBRY 
 5  # Email : gobry@pybliographer.org 
 6  #           
 7  # This program is free software; you can redistribute it and/or 
 8  # modify it under the terms of the GNU General Public License 
 9  # as published by the Free Software Foundation; either version 2  
10  # of the License, or (at your option) any later version. 
11  #    
12  # This program is distributed in the hope that it will be useful, 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
15  # GNU General Public License for more details.  
16  #  
17  # You should have received a copy of the GNU General Public License 
18  # along with this program; if not, write to the Free Software 
19  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
20   
21  """ 
22  This module contains bindings for specific Word Processors. Depending 
23  on the capabilities of the wp, some or all of the functions described 
24  in IWordProcessor are implemented. 
25  """ 
26   
27 -class CommunicationError(Exception):
28 """ Raised when an error occurs on the link between pyblio and the 29 word processor. After such an error, the IWordProcessor is 30 disconnected.""" 31 pass
32
33 -class OperationError(Exception):
34 """ Raised when the requested operation on the IWordProcessor 35 cannot be completed. The IWordProcessor is _not_ disconnected 36 after such an error.""" 37 pass
38
39 -class IWordProcessor:
40 """ Interface a WordProcessor object should provide """ 41
42 - def connect(self):
43 """ Establish a connection to the word processor. 44 45 This binds this object to a specific document in the word 46 processor. No other operation except is_connected can take 47 place before connection.""" 48 pass
49
50 - def disconnect(self):
51 """ Disconnect from the word processor. """ 52 pass
53
54 - def is_connected(self):
55 """ Check if the connection is still up. """ 56 pass
57
58 - def cite(self, keys):
59 """ Insert a list of references at the current position of the 60 document. 61 62 keys is a list of tuples (uid, key) where uid is the 63 identifier of the record in the database, and key is the key 64 to be shown to the user. 65 """ 66 pass
67
68 - def fetch(self):
69 """ Retrieve the list of (uid, key) tuples previously inserted 70 in the current document with self.cite(). 71 72 The tuples are ordered according to the position of the 73 references in the text. 74 75 If the WP does not support this operation, returns None (not 76 []). 77 """ 78 pass
79
80 - def update_keys(self, keymap):
81 """ Update the keys shown to the user. keymap is a dictionary 82 that provides, for each uid having changed, the new key to be 83 displayed.""" 84 pass
85
86 - def update_biblio(self):
87 """ Return a generate object ready to accept instructions to 88 rebuild the current bibliography list. An example of such a 89 generator is provided by 90 L{Pyblio.Format.OpenOffice.Generator}.""" 91 pass
92