root/trunk/lib/dicttype.py

Revision 15, 2.7 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 Dictionary types
24 """
25
26 from lib import newplugin
27
28
29 class DictionaryType:
30     """Dictionary type interface"""
31
32     dictClass = None
33     fileExtentions = None
34     name = None
35     shortIdName = None
36  
37
38     def getClass(self):
39         """Return dictionary class"""
40
41         return self.dictClass
42    
43
44     def getFileExtentions(self):
45         """Return file extention"""
46
47         return self.fileExtentions
48
49
50     def getName(self):
51         """Return type name"""
52
53         return self.name
54
55
56     def getIdName(self):
57         """Return short ID name"""
58
59         return self.shortIdName
60
61
62 class TypePlugin(DictionaryType):
63     """Dictionary plugin"""
64
65     dictClass = newplugin.DictionaryPlugin
66     fileExtentions = ('zip',)
67     name = "OpenDict dictionary plugin"
68
69
70
71 class TypeSlowo(DictionaryType):
72     """Slowo dictionary format"""
73
74     import parser
75
76     dictClass = parser.SlowoParser
77     fileExtentions = ('dwa',)
78     name = "Slowo dictionary"
79     shortIdName = "slowo"
80
81
82
83 class TypeMova(DictionaryType):
84     """Mova dictionary format"""
85
86     import parser
87
88     dictClass = parser.MovaParser
89     fileExtentions = ('mova',)
90     name = "Mova dictionary"
91     shortIdName = "mova"
92
93    
94
95 class TypeTMX(DictionaryType):
96     """TMX dictionary format"""
97
98     import parser
99
100     dictClass = parser.TMXParser
101     fileExtentions = ('tmx',)
102     name = "TMX dictionary"
103     shortIdName = "tmx"
104
105
106
107 class TypeDict(DictionaryType):
108     """DICT dictionary type"""
109
110     import parser
111
112     dictClass = parser.DictParser
113     fileExtentions = ('dict', 'dz',)
114     name = "DICT dictionary"
115     shortIdName = "dict"
116
117
118
119 # Constant instances
120 PLUGIN = TypePlugin()
121 SLOWO = TypeSlowo()
122 MOVA = TypeMova()
123 #TMX = TypeTMX()
124 DICT = TypeDict()
125
126 # Supported types tuple
127 supportedTypes = (PLUGIN, SLOWO, MOVA, DICT)
128
129 # Plain dictionary types (data file)
130 plainTypes = (SLOWO, MOVA, DICT)
131
132 # Types for which index table is made
133 indexableTypes = (SLOWO, MOVA)
Note: See TracBrowser for help on using the browser.