root/trunk/lib/meta.py

Revision 15, 3.0 kB (checked in by mjoc, 1 year ago)

Atnaujinti vertimai. Pridėti nauji copyright'ai. Pakeista konfigūracija.

Line 
1 #
2 # OpenDict
3 # Copyright (c) 2003-2006 Martynas Jocius <martynas.jocius@idiles.com>
4 # Copyright (c) 2007 IDILES SYSTEMS, UAB <support@idiles.com>
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your opinion) any later version.
10 #
11 # This program is distributed in the hope that will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MECHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more detals.
15 #
16 # You shoud have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 # 02111-1307 USA
20 #
21
22 """
23 Metaclasses
24 """
25
26 from lib import errortype
27
28
29 class SearchResult:
30     """Search result metaclass"""
31
32     def __init__(self):
33         """Set default values"""
34
35         self.error = errortype.OK
36         self.translation = ""
37         self.words = []
38
39
40     def setError(self, err):
41         """Set error object"""
42
43         self.error = err
44
45
46     def getError(self):
47         """Get error object"""
48
49         return self.error
50
51
52     def setTranslation(self, trans):
53         """Set translation string"""
54
55         self.translation = trans
56
57
58     def getTranslation(self):
59         """Get translation string"""
60
61         return self.translation
62
63
64     def setWordList(self, words):
65         """Set word list"""
66
67         self.words = words
68
69
70     def getWordList(self):
71         """Get word list"""
72
73         return self.words
74
75
76
77 class Dictionary:
78     """Dictionary interface"""
79
80     active = True
81
82
83     def start(self):
84         """Allocate resources"""
85
86         pass
87
88
89     def stop(self):
90         """Free resources"""
91
92         pass
93    
94
95     def getType(self):
96         """Return dictionary type"""
97
98         return None
99    
100
101     def getName(self):
102         """Return plugin name"""
103
104         return None
105
106
107     def getVersion(self):
108         """Return version"""
109
110         return None
111
112
113     def getSize(self):
114         """Return size in kylobites"""
115
116         return None
117
118
119     def getPath(self):
120         """Return ditionary path"""
121
122         pass
123
124
125     def getAuthors(self):
126         """Return list of authors"""
127
128         return None
129
130
131     def setEncoding(self, encoding):
132         """Set encoding"""
133
134         pass
135
136
137     def getEncoding(self):
138         """Return encoding used by dictionary"""
139
140         return None
141    
142
143     def getUsesWordList(self):
144         """Return boolean value of word list usage"""
145
146         return None
147
148
149     def getDescription(self):
150         """Returns description text"""
151        
152         return None
153
154
155     def getLicence(self):
156         """Return licence text"""
157
158         return None
159
160
161     def getActive(self):
162         return self.active
163
164
165     def setActive(self, active=True):
166         self.active = active
167    
168
169     def search(self, word):
170         """Lookup word"""
171
172         return None
Note: See TracBrowser for help on using the browser.