Browse Source

Code Refactor

Added icons
Added cli support
Bogdan Cordier 6 years ago
parent
commit
0dd2d8b15a

+ 15
- 11
README View File

@@ -5,34 +5,34 @@ KCnrtl
5 5
 :Author: Bogdan Cordier <bcord@hadaly.fr>
6 6
 :Date: 2012-10-05
7 7
 :Copyright: GPLv3
8
-:Version: 0.3b
8
+:Version: 0.4b
9 9
 
10 10
 
11 11
 Description
12 12
 ===========
13 13
 
14 14
 KCnrtl is a simple Qt graphical client to access the CNRTL french linguistic resources.
15
-It offers the possibility to check the definitions, synonyms, antonyms of a given
16
-french word.
17 15
 
18 16
 Features:
19 17
 ---------
20 18
 
21
-    *Check the definitions, synomyms, antonyms of any given french word
22
-      For now the TLFi (Trésor de la Langue Française) is the only available dictionary.
19
+    *Check the synomyms, antonyms (CLI & GUI), definitions (GUI only) of any given french word
23 20
 
24
-    *The "AMAZING Clipboard mode" :
21
+    *Dictionaries available for now:
22
+        -TLFi (Trésor de la Langue Française informatisé)
23
+        -Dictionnaire de l'Académie Française 9th, 8th & 4th Edition
24
+
25
+    *Clipboard mode (GUI only) :
25 26
       With the "Clipboard mode" you can easily check for a synonym/antonym and replace it in your text.
26 27
       To do so, just check the "Clipboard mode" checkbox, copy in the clipboard any word, KCnrtl will do
27 28
       an automatic request to the CNRTL website and you can easily copy any synonym or antonym by
28
-      just clicking on them.
29
+      just clicking on them in the result list.
29 30
       Now you just have to paste it back in you text !
30 31
 
31 32
 Planned features:
32 33
 -----------------
33 34
 
34
-    *cli client
35
-    *access to other dictionary offered by the CNRTL (Dictionnaire de l'Académie française 9e, etc)
35
+    *access to other dictionaries offered by the CNRTL (Dictionnaire du Moyen Français, etc)
36 36
 
37 37
 Installation
38 38
 ============
@@ -44,6 +44,10 @@ TODO!!
44 44
 Requirements
45 45
 ============
46 46
 
47
-*Python:2.7
48
-*PyQT4
47
+*Python: 2.7
48
+*PyQt4: >= 4.6
49
+
50
+Optional if you don't use command-line:
51
+*BeautifulSoup4
52
+*Httplib2
49 53
 

BIN
icons/hicolor/128x128/apps/kcnrtl.png View File


BIN
icons/hicolor/16x16/apps/kcnrtl.png View File


BIN
icons/hicolor/32x32/apps/kcnrtl.png View File


BIN
icons/hicolor/64x64/apps/kcnrtl.png View File


BIN
icons/kcnrtl.ico View File


+ 305
- 0
icons/pixmaps/kcnrtl.xpm View File

@@ -0,0 +1,305 @@
1
+/* XPM */
2
+static char *kcnrtl[] = {
3
+/* columns rows colors chars-per-pixel */
4
+"56 56 243 2 ",
5
+"   c #55F522530015",
6
+".  c #5C1A24B10032",
7
+"X  c #5F5F2F2F0F0F",
8
+"o  c #61E426D10000",
9
+"O  c #65CC28A60038",
10
+"+  c #6BF02AEA000C",
11
+"@  c #63632E2E0C0C",
12
+"#  c #73FA2E190002",
13
+"$  c #68E731300C8C",
14
+"%  c #7BFE315E0002",
15
+"&  c #7575343408B3",
16
+"*  c #66E63838199A",
17
+"=  c #78223B9013BE",
18
+"-  c #72723DE81B1B",
19
+";  c #7DFD41C01A9B",
20
+":  c #727242422323",
21
+">  c #75754C4B3030",
22
+",  c #797950503434",
23
+"<  c #840034840009",
24
+"1  c #8A0A36CD0000",
25
+"2  c #8DFF38960010",
26
+"3  c #85853B3B0B0B",
27
+"4  c #93F93AE60007",
28
+"5  c #9BA83DF50006",
29
+"6  c #82823F3F1515",
30
+"7  c #FFFF00BF00BF",
31
+"8  c #FFFF0CB70CB7",
32
+"9  c #FFFF14471447",
33
+"0  c #FFFF1AD21AD2",
34
+"q  c #F6F622222222",
35
+"w  c #FFFF23E423E4",
36
+"e  c #FFFF2AC42AC4",
37
+"r  c #FFA933893389",
38
+"t  c #FFCB3B6E3B6E",
39
+"y  c #9E9E40EB0202",
40
+"u  c #931242820D4D",
41
+"i  c #9AEF44440AB5",
42
+"p  c #8B8B44441494",
43
+"a  c #8CE249F41D1D",
44
+"s  c #97164ACA17D8",
45
+"d  c #A3914135001E",
46
+"f  c #A7A746C70606",
47
+"g  c #ABAB44A00025",
48
+"h  c #B1DC471C002B",
49
+"j  c #B49448E90141",
50
+"k  c #BBF44AF50000",
51
+"l  c #B8B851510C0C",
52
+"z  c #A34D4CF71414",
53
+"x  c #A4A44DCE1515",
54
+"c  c #B73755D61494",
55
+"v  c #88324B4B22CD",
56
+"b  c #90904D4D2020",
57
+"n  c #9E1E54D42323",
58
+"m  c #92E755552C2C",
59
+"M  c #9B9B55D62828",
60
+"N  c #9A1A58D82D2D",
61
+"B  c #91915ADA3636",
62
+"V  c #9E1E5EDE34B4",
63
+"C  c #A1A156AC24CF",
64
+"Z  c #A3A35D072E2E",
65
+"A  c #A2A25EDF32B3",
66
+"S  c #BBBB61B72626",
67
+"D  c #B86264642BD6",
68
+"F  c #ABEB63233272",
69
+"G  c #A33C64973BA2",
70
+"H  c #ACAC68683A90",
71
+"J  c #B6B66A6A36B7",
72
+"K  c #B9B96D6D3B3B",
73
+"L  c #BDBD71713DBE",
74
+"P  c #C1C14E4E0181",
75
+"I  c #CC4B521200E1",
76
+"U  c #C5C456560C0C",
77
+"Y  c #D3AB55550129",
78
+"T  c #D3D25B5B0B8B",
79
+"R  c #C0BF59581515",
80
+"E  c #C7C760601A1A",
81
+"W  c #D5D462B7166C",
82
+"Q  c #DBDA5C5C2C2B",
83
+"!  c #C0C066E72B2B",
84
+"~  c #D7D76D6D2E2E",
85
+"^  c #C8C76E6D3131",
86
+"/  c #C4C470703838",
87
+"(  c #83835E5E4545",
88
+")  c #8E8E67674D4D",
89
+"_  c #9C1B6AEB4A4A",
90
+"`  c #8E8E6D6C5656",
91
+"'  c #94936E6E5555",
92
+"]  c #97D773335ADA",
93
+"[  c #A471699C4310",
94
+"{  c #AC006D1743EE",
95
+"}  c #A34D6C1647F2",
96
+"|  c #B0B06F6F4444",
97
+" . c #AD57731D4C4C",
98
+".. c #BE3E73734242",
99
+"X. c #B58276424C7F",
100
+"o. c #B9B976B64ACB",
101
+"O. c #AC5675CB51A7",
102
+"+. c #AB2A7BFC5CDC",
103
+"@. c #B4B47C7C5757",
104
+"#. c #BBBB7C2651FC",
105
+"$. c #8F8F7C7C6F6F",
106
+"%. c #9A447B2566BC",
107
+"&. c #A2A27F7F6868",
108
+"*. c #D2D25A5A5A5A",
109
+"=. c #E0E04D4D4D4D",
110
+"-. c #F1F144444444",
111
+";. c #FFFF43434343",
112
+":. c #FFFF4DCD4DCD",
113
+">. c #E0E058585858",
114
+",. c #F6F650505050",
115
+"<. c #FF3E53135313",
116
+"1. c #FF295BDB5B5B",
117
+"2. c #C646797945C5",
118
+"3. c #C71B7A2446F1",
119
+"4. c #CD4D7E7E4ACA",
120
+"5. c #EEEE60604A4A",
121
+"6. c #F5F562625F5F",
122
+"7. c #FD7D686864E5",
123
+"8. c #FFFF6BFE6BFE",
124
+"9. c #FFFF75F575F5",
125
+"0. c #FFFF7CFC7CFC",
126
+"q. c #BD6782D75CB2",
127
+"w. c #959583837777",
128
+"e. c #A6FC84DA6E18",
129
+"r. c #BB1085DB63B9",
130
+"t. c #A62589897777",
131
+"y. c #ACAC92117F7F",
132
+"u. c #DADA82824848",
133
+"i. c #DEDE87074CCC",
134
+"p. c #CD2285855555",
135
+"a. c #C46E85DB5CB2",
136
+"s. c #CBCB88885C5C",
137
+"d. c #D757898955D6",
138
+"f. c #D4D4894957D8",
139
+"g. c #EB6B900F5353",
140
+"h. c #EDED96965D5D",
141
+"j. c #C645898960E0",
142
+"k. c #C4438E8E6B6B",
143
+"l. c #D0D08C8C6060",
144
+"z. c #CDCD922B6A9D",
145
+"x. c #DC3194EA65BB",
146
+"c. c #D8D895956913",
147
+"v. c #DFDF9B9B6DC3",
148
+"b. c #C7C79696760F",
149
+"n. c #E53A964062B8",
150
+"m. c #E58F99436666",
151
+"M. c #E6E69B9B6A6A",
152
+"N. c #F6F69D9D6262",
153
+"B. c #F2F29F1F68E8",
154
+"V. c #E5E59F9F7070",
155
+"C. c #DCDCA12078F8",
156
+"Z. c #FEFEA0A06262",
157
+"A. c #FD3CA6A66D6D",
158
+"S. c #EABFA7517AFA",
159
+"D. c #FDFDABEB75B5",
160
+"F. c #F6F6AD137C49",
161
+"G. c #FEA8B1067D7D",
162
+"H. c #84EB84B7849E",
163
+"J. c #8CBB8CBB8CBB",
164
+"K. c #9431941D941D",
165
+"L. c #9B9B97979595",
166
+"P. c #9C409C409C40",
167
+"I. c #B7368B8B8B8B",
168
+"U. c #AD0295EB8731",
169
+"Y. c #B1B19A198A8A",
170
+"T. c #A3229A199414",
171
+"R. c #B4339C1C9494",
172
+"E. c #B6B6A4A49999",
173
+"W. c #A38EA38EA38E",
174
+"Q. c #ABABA8A8A7A7",
175
+"!. c #ABCBABABABAB",
176
+"~. c #BCBCAFAFA6A6",
177
+"^. c #B535B535B535",
178
+"/. c #B8B8B7B7B7B7",
179
+"(. c #BCCABCCABCCA",
180
+"). c #C4C49F9F8686",
181
+"_. c #C0C096969696",
182
+"`. c #FFFF853C853C",
183
+"'. c #FFFF8AF88AF8",
184
+"]. c #FFFF94609460",
185
+"[. c #FFFF9BCE9BCE",
186
+"{. c #DF5FA9A98585",
187
+"}. c #DADAABAB8C8C",
188
+"|. c #C544A7A79494",
189
+" X c #D1D1AAAA9191",
190
+".X c #EC41AE58852F",
191
+"XX c #E9E9B2B28E8E",
192
+"oX c #F4F4B2078585",
193
+"OX c #FECBB4E7841D",
194
+"+X c #F635B6368B4B",
195
+"@X c #FF47BA4C8C8C",
196
+"#X c #E867B7379615",
197
+"$X c #ED42BABA9999",
198
+"%X c #F348B9639393",
199
+"&X c #FE46BE2B936E",
200
+"*X c #C1C1AF2FA2A2",
201
+"=X c #CA49B5B5A827",
202
+"-X c #D3D3BB3AAB2A",
203
+";X c #CCCCBCBCB2B2",
204
+":X c #FFFFA40AA40A",
205
+">X c #FFFFAB86AB86",
206
+",X c #FFFFB2F2B2F2",
207
+"<X c #FFFEBD8ABD8A",
208
+"1X c #FFFFC1409717",
209
+"2X c #FE9BC39B9C74",
210
+"3X c #D353C140B534",
211
+"4X c #D47EC3C3B862",
212
+"5X c #E7E7C4C4ACAC",
213
+"6X c #FEFEC760A26F",
214
+"7X c #FEFEC996A572",
215
+"8X c #FF98CBFEA9DC",
216
+"9X c #E6E6C9C9B635",
217
+"0X c #ECECD0D0BDBD",
218
+"qX c #C419C419C419",
219
+"wX c #CBE1CBCBCBC0",
220
+"eX c #D454CACAC443",
221
+"rX c #DADACF4FC7C7",
222
+"tX c #D400D3E9D3D3",
223
+"yX c #DC00DBEDDBED",
224
+"uX c #FFFFC29DC29D",
225
+"iX c #FFFFCB75CB75",
226
+"pX c #EC96D680C81D",
227
+"aX c #E1E1D4D4CC4B",
228
+"sX c #F5F5D958C646",
229
+"dX c #F5F5DCDCCC4C",
230
+"fX c #E8E8DEDED7D7",
231
+"gX c #FFFFD554D554",
232
+"hX c #F1F1DDDDD0D0",
233
+"jX c #EC2BE2A2DB9B",
234
+"kX c #F6F6E7E7DE5E",
235
+"lX c #F9F9E6E6D9D9",
236
+"zX c #E322E2E2E2E2",
237
+"xX c #EF6FE767E1E1",
238
+"cX c #EFEFE9E9E5E5",
239
+"vX c #FFFFE564E564",
240
+"bX c #F372EB6AE5E5",
241
+"nX c #F348EE18EAEA",
242
+"mX c #FCFCEE6EEAEA",
243
+"MX c #F736F1B1EEAE",
244
+"NX c #FBFBF0F0E8E8",
245
+"BX c #F8F8F59FF3F3",
246
+"VX c #FCD7F599F418",
247
+"CX c #FFF9FFEDFFE9",
248
+/* pixels */
249
+"CXCXCXCXCXU.rXCXCXCXCXCXCXCX4XBXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
250
+"CXCXCXCXCX>   Y.CXCXCXCXCXMX  * U.nXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
251
+"CXCXCXCXBX      ` BXCXCXMX*X      @ e.cXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
252
+"CXCXCXCXeX        $ A A.2.V i.M . . . o ] fXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
253
+"CXCXCXCXY.          o a i.h.F 2.h.a o o o O ] fXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
254
+"CXCXCXCX`           .   a J Z.4.N h.d.= O O O + _ aXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
255
+"CXCXCXCX:         . . . o 6 M h.N.F ..A.2.# O O O # B 4XCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
256
+"CXCXCXcX        . . . . o o & Z 2.A.d.A n.B.F # # + # # m -XCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
257
+"CXCXCX;X        . . . o o o O + F A B.A.H { D.n.b # # % % # m =XCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
258
+"CXCXCXt.      . . . . o o o O O O n H d.D.n.V m.G.p.6 % % % % < b |.BXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
259
+"CXCXCX(       . . . o o o O O O O + p o.H D.D.o.| G.F...< % % < % < a b.MXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
260
+"CXCXCXX     . . . . o o o O O + + + # & 4.A m.D.M.A x.OXS.F < < < < 1 1 u b.MXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
261
+"CXCXfX      . . o o o o O O + O + + + # # 2.o.o.G.G.#.| OXOXv.s 1 1 1 1 2 2 s r.bXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
262
+"CXCX*X    . . . . o o o O + O + + # + # # # n x.G S.OXS.G z.@X@Xf.u 1 1 2 2 4 4 5 q.jXCXCXCXCXCXCXCXCXCXCXCXCXCX",
263
+"CXCX%.  . . . . o o o O O + + + + + # # # # % p M.| s.OXOXa.{ oX@X+X..2 4 2 4 4 4 4 5 X.pXCXCXCXCXCXCXCXCXCXCXCX",
264
+"CXCX,   . . . o o o o O + O + + # + # # # # % % 3 f.l.[ oX@XoX .z.1X&X.XD 4 4 5 4 5 5 y y o.pXCXCXCXCXCXCXCXCXCX",
265
+"CXVX.   . . o o o O O O + + O # + # # # # % % % % % J F.[ c.&X&Xz.[ +X2X2XM.z 5 5 5 5 y y y d K 9XCXCXCXCXCXCXCX",
266
+"CXrX. . . o o o o o + O O + + + # # # # # % % % % < < C .Xs. .@X&X+XO.k.2X2X2Xl.i d 5 d d y d d g L 9XCXCXCXCXCX",
267
+"CXR.. . . o o o O O O + + # + # # # # % # % % < < < < < u V.S.[ .X&X2XC.} XX6X6X%X2.d d d g g g g g z.CXCXCXCXCX",
268
+"CX] . . . o o O O O O + + + + # # # # # % % % % % < < < 1 3 4.&X@.@.2X2X2X@.r.6X8X8X.XS d d g g g g kXCXCXCXCXCX",
269
+"CX: . . o o o O O O + + + # # + # # # % % % % % % < < < 1 1 1 J @XC.} %X6X6X{._ XX8X8X8XM.c g g g s.CXCXCXCXCXCX",
270
+"nX. . o o o o O + + + + + + # # # % # % % % < % < < 1 < 1 1 2 2 C +X%XO.z.6X6X7Xr.r.8X8X#X{.j g h hXCXCXCXCXCXCX",
271
+"4X. o o o O O O O + + # # # # # # # % % % % < < < < 1 1 1 2 2 2 4 i .X6Xb.O.&X6X#X).=XzXzX Xh h 2.CXCXCXCXCXCXCX",
272
+"y.o . o O O O O + + + + + # # # % % % % < % < < < 1 1 1 2 2 2 2 2 4 M.6X$X X=XyXyXzXzXyXzXD h h 0XCXCXCXCXCXCXCX",
273
+") . o o O O O O + + # # + # # % % % % % < % < < < 1 1 1 2 2 2 4 4 4 3XtXtXtXyXyXyXyXyXyX-Xh h / CXCXCXCXCXCXCXCX",
274
+"- o o O O O + + + + + # # # # % # % % % % < < < 1 1 1 2 2 2 4 4 4 n tXtXtXtXtXtXyXyXyXyX2.h j 5XCXCXCXCXCXCXCXCX",
275
+"@ o O o O O O + + # + # # % # # % % % < < < < < 1 1 1 2 2 2 4 4 5 O.wXwXtXtXtXtXtXtXyX4Xh j ! CXCXCXCXCXCXCXCXCX",
276
+"- o O O O + O # + + # # # # % % % % < % < < < 1 < 1 1 2 2 2 4 4 5 Y.wXwXwXwXtXtXtXtXtXa.j j #XCXCXCXCXCXCXCXCXCX",
277
+"&.O O O + O + # # # # # # % % % % % < < < 1 < 1 1 1 2 2 4 4 4 4 4 ~.wXwXwXwXwXwXtXtXeXl j R VXCXCXCXCXCXCXCXCXCX",
278
+"nX- O O + + + + + # # # # # % % % < % < < < 1 1 1 2 2 2 4 4 4 4 z qXqXqXwXwXwXwXwXwXb.k k {.CXCXCXCXCXCXCXCXCXCX",
279
+"CXaX= O + + # # # # # # % % % % % < < < < 1 1 1 2 2 4 4 4 4 5 4 { qXqXqXqXqXwXwXwXwXc k U BXCXCXCXCXCXCXCXCXCXCX",
280
+"CXCXfX= + O # + # # # % # % % % < < < < < 1 1 2 2 2 4 4 4 4 4 5 e.qX(.qXqXqXqXqXwX).k k C.CXCXCXCXCXCXCXCXCXCXCX",
281
+"CXCXCXfX; + # # # # # % % % % < < < < 1 < 1 1 2 2 2 4 4 4 5 5 5 E.(.(.qXqXqXqXqXqXD k U NXCXCXCXCXCXCX0.CXCXCXCX",
282
+"CXCXCXCXjX; + # # # # % % % < % % < < 1 1 1 2 2 2 4 4 4 4 4 4 i /.(.(.(.(.(.(.qX*Xk k x.CXCXCXCXCXCXCXw `.CXCXCX",
283
+"CXCXCXCXCXjXv # % # % % % % % < < 1 < 1 1 1 2 2 4 4 4 4 5 5 5 A ^././.(.(.(.(.(.2.P P kXCXCXCXCXCXCXCXe 7 uXCXCX",
284
+"CXCXCXCXCXCXxXv # % % % % % < < < < 1 1 1 1 2 4 4 4 4 4 4 5 5 +.^.^.^./.(.(.(.~.k P d.CXCXCXCXCXuX'.`.0 7 e VXCX",
285
+"CXCXCXCXCXCXCXxXv % % % < < < < < 1 1 1 1 2 2 2 4 4 4 5 5 5 5 U.!.^._.>.-.t :.1.5.Q dXCXCXCXCXCXVX8.0 7 7 7 '.CX",
286
+"CXCXCXCXCXCXCXCXnXm % < % < < < < 1 1 1 2 2 4 4 4 4 4 5 5 5 y Q.!.!.=.w r ;.<.8.9.0.[.mXCXCXCXCXCXVX;.8 7 7 9 VX",
287
+"CXCXCXCXCXCXCXCXCXnXm % % < < 1 1 1 1 2 2 4 4 4 4 4 5 5 5 5 C !.!.!.q e t :.7.9.`.].].>XCXCXCXCXCXCXuX8 7 7 7 :X",
288
+"CXCXCXCXCXCXCXCXCXCXnXN < < < < 1 1 2 2 2 2 4 4 4 5 4 5 5 5 } !.!.I.0 e ;.<.8.0.].:X>X>XvXCXCXCXCXCXCXt 7 7 7 <.",
289
+"CXCXCXCXCXCXCXCXCXCXCXMXV < 1 1 1 1 2 2 2 4 4 4 4 5 5 5 5 5 t.W.W.*.0 r ,.6.8.`.[.>X<X<XgXCXCXCXCXCXCX`.7 7 7 0 ",
290
+"CXCXCXCXCXCXCXCXCXCXCXCXMXG 1 1 1 1 2 4 4 4 4 5 5 5 5 5 d d L.W.W.I.T.Q.!.D I ~ <X,XiXiXiXCXCXCXCXCXCX:X7 7 7 8 ",
291
+"CXCXCXCXCXCXCXCXCXCXCXCXCXMXG 1 2 2 2 4 4 4 4 4 5 5 5 5 d x P.W.W.W.W.W.Y.I I $XCX,X<X<X<XCXCXCXCXCXCX`.8 7 7 0 ",
292
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXBX[ 2 2 2 4 4 4 4 5 5 5 5 d 5 _ P.P.P.W.W.W.L I W VXCX<X,X,X:XvXCXCXCXVX>Xw 7 7 7 <.",
293
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXBX{ 2 2 4 4 4 5 5 5 5 d d d %.L.P.P.P.W.T.I I XXCXCXuX[.:X[.'.].'.8.;.e 9 7 7 7 uX",
294
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXX.4 4 4 5 4 5 5 5 d 5 d w.L.P.L.P.P.#.Y T VXCXCXgX'.'.`.0.8.1.;.t w 8 7 7 0.CX",
295
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXVXX.2 5 4 5 5 5 5 d d z K.K.L.P.L.L.U I V.CXCXCXCX].9.9.8.1.<.t e 0 7 9 :XCXCX",
296
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXVX#.5 5 5 5 d 5 d d A J.K.K.K.L.+.I T NXCXCXCXCXVX>X8.1.:.;.t ;.1.>XVXCXCXCX",
297
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXq.5 5 5 5 d d d ' J.J.K.K.K.E Y n.CXCXCXCXCXCXCXCXVXVXVXCXCXCXCXCXCXCXCX",
298
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXVXq.5 d d d d d $.J.J.J.J.e.Y Y lXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
299
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXBXj.d d d d f H.J.J.J.J.D Y g.CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
300
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXa.d d d z H.H.H.J.w.I Y dXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
301
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXz.d d z H.H.H.H.J Y u.CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
302
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXz.g h ] H.H.%.Y Y sXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
303
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX}.g I S S Y Y %XCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
304
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXpX^ W W i.sXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX"
305
+};

+ 6
- 0
kcnrtl.py View File

@@ -0,0 +1,6 @@
1
+#!/usr/bin/env python
2
+
3
+from kcnrtl.main import main
4
+
5
+if __name__ == '__main__':
6
+    main()

+ 38
- 0
kcnrtl/fetchparsebs.py View File

@@ -0,0 +1,38 @@
1
+#-*- coding: utf-8 -*-
2
+
3
+########################################################################
4
+# This file is part of KCnrtl                                          #
5
+#                                                                      #
6
+#                                                                      #
7
+# Copyright (C) 2012 Bogdan Cordier                                    #
8
+#                                                                      #
9
+# KCnrtl is free software: you can redistribute it and/or modify       #
10
+# it under the terms of the GNU General Public License as published by #
11
+# the Free Software Foundation, either version 3 of the License, or    #
12
+# (at your option) any later version.                                  #
13
+#                                                                      #
14
+# KCnrtl is distributed in the hope that it will be useful,            #
15
+# but WITHOUT ANY WARRANTY; without even the implied warranty of       #
16
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        #
17
+# GNU General Public License for more details.                         #
18
+#                                                                      #
19
+# You should have received a copy of the GNU General Public License    #
20
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.#
21
+########################################################################
22
+
23
+import httplib2
24
+from bs4 import BeautifulSoup
25
+
26
+def getSynoAnto(text, form):
27
+    conn = httplib2.Http(".cache")
28
+    htmlSource = conn.request("http://www.cnrtl.fr/%s/%s" %
29
+                                  (form, text), "GET")
30
+    soup = BeautifulSoup(htmlSource[1], "lxml")
31
+    tagy = soup.find_all('td', "%s_format" % (form[:4]))
32
+    i = 0
33
+    while i < len(tagy):
34
+        tag_a = tagy[i]
35
+        i += 1
36
+        print tag_a.text
37
+
38
+

+ 107
- 0
kcnrtl/fetchparseqt.py View File

@@ -0,0 +1,107 @@
1
+#-*- coding: utf-8 -*-
2
+
3
+########################################################################
4
+# This file is part of KCnrtl                                          #
5
+#                                                                      #
6
+#                                                                      #
7
+# Copyright (C) 2012 Bogdan Cordier                                    #
8
+#                                                                      #
9
+# KCnrtl is free software: you can redistribute it and/or modify       #
10
+# it under the terms of the GNU General Public License as published by #
11
+# the Free Software Foundation, either version 3 of the License, or    #
12
+# (at your option) any later version.                                  #
13
+#                                                                      #
14
+# KCnrtl is distributed in the hope that it will be useful,            #
15
+# but WITHOUT ANY WARRANTY; without even the implied warranty of       #
16
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        #
17
+# GNU General Public License for more details.                         #
18
+#                                                                      #
19
+# You should have received a copy of the GNU General Public License    #
20
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.#
21
+########################################################################
22
+
23
+
24
+from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest
25
+from PyQt4.QtWebKit import QWebPage
26
+from PyQt4.QtCore import QEventLoop, QUrl
27
+
28
+
29
+class FetchParse:
30
+    def __init__(self, word, dico, combo1_index, combo2_index, combo2_text, wordclass):
31
+        self.word = word
32
+        self.dico = dico
33
+        self.combo1_index = combo1_index
34
+        self.combo2_index = combo2_index
35
+        self.combo2_text = combo2_text
36
+        self.wordclass = wordclass
37
+        self.manager = QNetworkAccessManager()
38
+        self.manager.finished.connect(self.replyFinished)
39
+        self.loop = QEventLoop()
40
+        self.manager.finished.connect(self.loop.quit)
41
+        self._reply = ""
42
+
43
+    def _get_reply(self):
44
+        self.fetch(self.dico)
45
+        return self._reply
46
+
47
+    reply = property(_get_reply)
48
+
49
+    def fetch(self, dico):
50
+        if dico == "Lexi":
51
+            if not self.combo2_index:
52
+                url = ("http://www.cnrtl.fr/definition/%s//%s" %
53
+                       (self.word, self.combo1_index))
54
+            if self.combo2_index > 0:
55
+                acad = unicode(self.combo2_text)
56
+                acadnum = filter(lambda x: x.isdigit(), acad)
57
+                acadnumf = "academie" + str(acadnum)
58
+                url = ("http://www.cnrtl.fr/definition/%s/%s//%s" %
59
+                       (acadnumf, self.word, self.combo1_index))
60
+        if dico == "Syno":
61
+            url = ("http://www.cnrtl.fr/synonymie/%s" %
62
+                   (self.word))
63
+        if dico == "Anto":
64
+            url = ("http://www.cnrtl.fr/antonymie/%s"  %
65
+                   (self.word))
66
+        self.manager.get(QNetworkRequest(QUrl(url)))
67
+        self.loop.exec_()
68
+
69
+    def replyFinished(self, datareply):
70
+        data = datareply.readAll()
71
+        page = QWebPage()
72
+        page.mainFrame().setContent(data)
73
+        webpage = page.mainFrame().documentElement()
74
+        if self.wordclass == "definition":
75
+            result = webpage.findAll("div#contentbox")
76
+            a = ""
77
+            if not self.combo2_index:
78
+                a = "div.tlf_cvedette"
79
+            if 1 <= self.combo2_index <= 3:
80
+                a = "span.tlf_cvedette"
81
+            result_to_remove = webpage.findAll(a)
82
+            string_to_remove = result_to_remove.first().toInnerXml()
83
+            final_page = result.first().toInnerXml()
84
+            resultf = final_page.replace(string_to_remove, '')
85
+
86
+            result_box = webpage.findFirst('div#vtoolbar')
87
+            result_test = result_box.findAll("a[href]")
88
+            self.formtype = []
89
+            i = 0
90
+            while i < len(result_test):
91
+                multdef_a = unicode(result_test.at(i).toPlainText())
92
+                # Delete digits in definition title
93
+                multdef_clean = ''.join(c for c in
94
+                    multdef_a if not c.isdigit())
95
+                self.formtype.append(multdef_clean)
96
+                i += 1
97
+            self._reply = resultf, self.formtype
98
+        if self.wordclass == "synonyme" or self.wordclass == "antonyme":
99
+            self._reply = []
100
+            result = webpage.findAll("td." + self.wordclass[:4] + "_format")
101
+            tag = []
102
+            i = 0
103
+            while i < len(result):
104
+                tag.append(result.at(i).firstChild().toPlainText())
105
+                i += 1
106
+            self._reply = tag
107
+

+ 1
- 1
kcnrtl/gui/Ui_kcnrtl.py View File

@@ -93,7 +93,7 @@ class Ui_MainWindow(object):
93 93
         self.checkBox.setText(QtGui.QApplication.translate("MainWindow", "Clipboard Mode", None, QtGui.QApplication.UnicodeUTF8))
94 94
 
95 95
 from PyQt4 import QtWebKit
96
-import resources.kcnrtl_rc
96
+from kcnrtl.resources import kcnrtl_rc
97 97
 
98 98
 if __name__ == "__main__":
99 99
     import sys

+ 124
- 0
kcnrtl/gui/gui.py View File

@@ -0,0 +1,124 @@
1
+#!/usr/bin/python
2
+#-*- coding: utf-8 -*-
3
+
4
+########################################################################
5
+# This file is part of KCnrtl                                          #
6
+#                                                                      #
7
+#                                                                      #
8
+# Copyright (C) 2012 Bogdan Cordier                                    #
9
+#                                                                      #
10
+# KCnrtl is free software: you can redistribute it and/or modify       #
11
+# it under the terms of the GNU General Public License as published by #
12
+# the Free Software Foundation, either version 3 of the License, or    #
13
+# (at your option) any later version.                                  #
14
+#                                                                      #
15
+# KCnrtl is distributed in the hope that it will be useful,            #
16
+# but WITHOUT ANY WARRANTY; without even the implied warranty of       #
17
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        #
18
+# GNU General Public License for more details.                         #
19
+#                                                                      #
20
+# You should have received a copy of the GNU General Public License    #
21
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.#
22
+########################################################################
23
+
24
+import sys
25
+from PyQt4.QtCore import QUrl, Qt
26
+from PyQt4.QtGui import  QApplication, QMainWindow, QWidget
27
+from kcnrtl.fetchparseqt import FetchParse
28
+from kcnrtl.models import ListModel
29
+from Ui_kcnrtl import Ui_MainWindow
30
+
31
+
32
+def main():
33
+    app = QApplication(sys.argv)
34
+    myapp = Main()
35
+    myapp.show()
36
+    sys.exit(app.exec_())
37
+
38
+
39
+class Main(QMainWindow):
40
+    def __init__(self, parent=None):
41
+        super(QWidget, self).__init__(parent)
42
+        
43
+        self.ui = Ui_MainWindow()
44
+
45
+        self.ui.setupUi(self)
46
+
47
+        self.ui.lineEdit.selectAll()
48
+
49
+        self.ui.lineEdit.setFocus()
50
+
51
+        self.ui.comboBox.setCurrentIndex(0)
52
+
53
+        self.ui.checkBox.setChecked(False)
54
+
55
+
56
+        self.dictionaries = [str("TLFi").decode("utf-8", "strict"),
57
+                             str("Académie 9e Ed.").decode("utf-8", "strict"),
58
+                             str("Académie 8e Ed.").decode("utf-8", "strict"),
59
+                             str("Académie 4e Ed.").decode("utf-8", "strict"),
60
+                                ]
61
+        self.ui.comboBox_2.addItems(self.dictionaries)
62
+        
63
+        self.clipboard = QApplication.clipboard()
64
+
65
+        self.ui.lineEdit.returnPressed.connect(self.updateUi)
66
+
67
+        self.ui.comboBox.activated.connect(self.on_combo_change)
68
+        
69
+        self.ui.webView.settings().setUserStyleSheetUrl(
70
+                                               QUrl.fromLocalFile(':/lexi.css'))
71
+
72
+        self.ui.listView.clicked.connect(self.on_row_clicked)
73
+
74
+        self.clipboard.dataChanged.connect(self.get_from_clipboard)
75
+
76
+
77
+
78
+    def updateUi(self):
79
+        # Check if input text is a word
80
+        if len(unicode(self.ui.lineEdit.text()).split()) <= 1:
81
+             wordclass = "definition"
82
+             dico = "Lexi"
83
+             lexi = FetchParse(self.ui.lineEdit.text(),dico, self.ui.comboBox.currentIndex(),
84
+                                self.ui.comboBox_2.currentIndex(), self.ui.comboBox_2.currentText(), wordclass)
85
+             result_lexi = lexi.reply
86
+             self.ui.webView.setHtml(result_lexi[0])
87
+             self.ui.comboBox.clear()
88
+             self.ui.comboBox.addItems(result_lexi[1])
89
+             wordclass = "synonyme"
90
+             dico = "Syno"
91
+             syno = FetchParse(self.ui.lineEdit.text(),dico, self.ui.comboBox.currentIndex(),
92
+                                self.ui.comboBox_2.currentIndex(), self.ui.comboBox_2.currentText(), wordclass)
93
+             model = ListModel(syno.reply, self)
94
+             self.ui.listView.setModel(model)
95
+             wordclass = "antonyme"
96
+             dico = "Anto"
97
+             anto = FetchParse(self.ui.lineEdit.text(),dico, self.ui.comboBox.currentIndex(),
98
+                                self.ui.comboBox_2.currentIndex(), self.ui.comboBox_2.currentText(), wordclass)
99
+             model = ListModel(anto.reply, self)
100
+             self.ui.listView_2.setModel(model)
101
+
102
+        else:
103
+            self.ui.lineEdit.setText("Veuillez entrer UN mot")
104
+
105
+    # Copy selected item in list to the clipboard
106
+    def on_row_clicked(self, qmodelindex):
107
+        item = qmodelindex.data(Qt.DisplayRole).toString()
108
+        self.clipboard.setText(item)
109
+#
110
+    def get_from_clipboard(self):
111
+        if self.ui.checkBox.isChecked():
112
+            self.ui.lineEdit.setText(unicode(self.clipboard.text()))
113
+            self.updateUi()
114
+#
115
+    def on_combo_change(self):
116
+        wordclass = "definition"
117
+        dico = "Lexi"
118
+        lexi = FetchParse(self.ui.lineEdit.text(),dico, self.ui.comboBox.currentIndex(),
119
+            self.ui.comboBox_2.currentIndex(), self.ui.comboBox_2.currentText(), wordclass)
120
+        result_lexi = lexi.reply
121
+        self.ui.webView.setHtml(result_lexi[0])
122
+
123
+if __name__ == "__main__":
124
+    main()

+ 0
- 191
kcnrtl/kcnrtl.py View File

@@ -1,191 +0,0 @@
1
-#!/usr/bin/python
2
-#-*- coding: utf-8 -*-
3
-
4
-########################################################################
5
-# KCnrtl - A simple Qt graphical client to access the CNRTL            #
6
-# french linguistic resources.                                         #
7
-#                                                                      #
8
-# Copyright (C) 2012 Bogdan Cordier                                    #
9
-#                                                                      #
10
-# This program is free software: you can redistribute it and/or modify #
11
-# it under the terms of the GNU General Public License as published by #
12
-# the Free Software Foundation, either version 3 of the License, or    #
13
-# (at your option) any later version.                                  #
14
-#                                                                      #
15
-# This program is distributed in the hope that it will be useful,      #
16
-# but WITHOUT ANY WARRANTY; without even the implied warranty of       #
17
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        #
18
-# GNU General Public License for more details.                         #
19
-#                                                                      #
20
-# You should have received a copy of the GNU General Public License    #
21
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.#
22
-########################################################################
23
-
24
-import sys
25
-from PyQt4.QtCore import QEventLoop, QUrl, QAbstractListModel, QModelIndex, QVariant, Qt
26
-from PyQt4.QtGui import  QApplication, QMainWindow, QWidget
27
-from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest
28
-from PyQt4.QtWebKit import QWebPage
29
-from gui.Ui_kcnrtl import Ui_MainWindow
30
-
31
-
32
-def main():
33
-    app = QApplication(sys.argv)
34
-    myapp = Main()
35
-    myapp.show()
36
-    sys.exit(app.exec_())
37
-
38
-
39
-class Main(QMainWindow):
40
-    def __init__(self, parent=None):
41
-        super(QWidget, self).__init__(parent)
42
-        
43
-        self.ui = Ui_MainWindow()
44
-
45
-        self.ui.setupUi(self)
46
-
47
-        self.ui.lineEdit.selectAll()
48
-
49
-        self.ui.lineEdit.setFocus()
50
-
51
-        self.ui.comboBox.setCurrentIndex(0)
52
-
53
-        self.ui.checkBox.setChecked(False)
54
-
55
-        self.manager = QNetworkAccessManager()
56
-                
57
-        self.dictionaries = [str("TLFi").decode("utf-8", "strict"),
58
-                             str("Académie 9e Ed.").decode("utf-8", "strict"),
59
-                             str("Académie 8e Ed.").decode("utf-8", "strict"),
60
-                             str("Académie 4e Ed.").decode("utf-8", "strict"),
61
-                                ]
62
-        self.ui.comboBox_2.addItems(self.dictionaries)
63
-        
64
-        self.clipboard = QApplication.clipboard()
65
-
66
-        self.ui.lineEdit.returnPressed.connect(self.updateUi)
67
-
68
-        self.ui.comboBox.activated.connect(self.on_combo_change)
69
-        
70
-        self.ui.webView.settings().setUserStyleSheetUrl(
71
-                                               QUrl.fromLocalFile(':/lexi.css'))
72
-
73
-        self.ui.listView.clicked.connect(self.on_row_clicked)
74
-
75
-        self.clipboard.dataChanged.connect(self.get_from_clipboard)
76
-
77
-        self.manager.finished.connect(self.replyFinished)
78
-
79
-        self.loop = QEventLoop()
80
-
81
-        self.manager.finished.connect(self.loop.quit)
82
-
83
-        self.tagform = []
84
-
85
-    def updateUi(self):
86
-        # Check if input text is a word
87
-        if len(unicode(self.ui.lineEdit.text()).split()) <= 1:
88
-            self.formtype = "definition"
89
-            self.fetch("Lexi")
90
-            self.ui.comboBox.clear()
91
-            self.ui.comboBox.addItems(self.tagform)
92
-            self.formtype = "synonyme"
93
-            self.fetch("Syno")
94
-            self.formtype = "antonyme"
95
-            self.fetch("Anto")
96
-        else:
97
-            self.ui.lineEdit.setText("Veuillez entrer UN mot")
98
-
99
-    # Copy selected item in list to the clipboard
100
-    def on_row_clicked(self, qmodelindex):
101
-        item = qmodelindex.data(Qt.DisplayRole).toString()
102
-        self.clipboard.setText(item)
103
-#
104
-    def get_from_clipboard(self):
105
-        if self.ui.checkBox.isChecked():
106
-            self.ui.lineEdit.setText(unicode(self.clipboard.text()))
107
-            self.updateUi()
108
-#
109
-    def on_combo_change(self):
110
-        self.formtype = "definition"
111
-        self.fetch("Lexi")
112
-
113
-
114
-    def fetch(self, dico):
115
-        if dico == "Lexi":
116
-            if not self.ui.comboBox_2.currentIndex():
117
-                url = ("http://www.cnrtl.fr/definition/%s//%s" %
118
-                       (self.ui.lineEdit.text(), self.ui.comboBox.currentIndex()))
119
-            if self.ui.comboBox_2.currentIndex() > 0:
120
-                acad = unicode(self.ui.comboBox_2.currentText())
121
-                acadnum = filter(lambda x: x.isdigit(), acad)
122
-                acadnumf = "academie" + str(acadnum)
123
-                url = ("http://www.cnrtl.fr/definition/%s/%s//%s" %
124
-                       (acadnumf, self.ui.lineEdit.text(), self.ui.comboBox.currentIndex()))
125
-        if dico == "Syno":
126
-            url = ("http://www.cnrtl.fr/synonymie/%s" %
127
-                   (self.ui.lineEdit.text()))
128
-        if dico == "Anto":
129
-            url = ("http://www.cnrtl.fr/antonymie/%s"  %
130
-                   (self.ui.lineEdit.text()))
131
-        self.manager.get(QNetworkRequest(QUrl(url)))
132
-        self.loop.exec_()
133
-
134
-    def replyFinished(self, reply):
135
-        data = reply.readAll()
136
-        page = QWebPage()
137
-        page.mainFrame().setContent(data)
138
-        webpage = page.mainFrame().documentElement()
139
-        if self.formtype == "definition":
140
-            result = webpage.findAll("div#contentbox")
141
-            if not self.ui.comboBox_2.currentIndex():
142
-                result_to_remove = webpage.findAll("div.tlf_cvedette")
143
-            if 1 <= self.ui.comboBox_2.currentIndex() <= 3:
144
-                result_to_remove = webpage.findAll("span.tlf_cvedette")
145
-            string_to_remove = result_to_remove.first().toInnerXml()
146
-            final_page = result.first().toInnerXml()
147
-            resultf = final_page.replace(string_to_remove, '')
148
-            self.ui.webView.setHtml(resultf)
149
-
150
-            result_box = webpage.findFirst('div#vtoolbar')
151
-            result_test = result_box.findAll("a[href]")
152
-            self.tagform = []
153
-            i = 0
154
-            while i < len(result_test):
155
-                multdef_a = unicode(result_test.at(i).toPlainText())
156
-                # Delete digits in definition title
157
-                multdef_clean = ''.join(c for c in
158
-                    multdef_a if not c.isdigit())
159
-                self.tagform.append(multdef_clean)
160
-                i += 1
161
-        if self.formtype == "synonyme" or "antonyme":
162
-            result = webpage.findAll("td." + self.formtype[:4] + "_format")
163
-            tag = []
164
-            i = 0
165
-            while i < len(result):
166
-                tag.append(result.at(i).firstChild().toPlainText())
167
-                i += 1
168
-            model = ListModel(tag, self)
169
-            if self.formtype == "synonyme":
170
-                self.ui.listView.setModel(model)
171
-            if self.formtype == "antonyme":
172
-                self.ui.listView_2.setModel(model)
173
-
174
-class ListModel(QAbstractListModel):
175
-    def __init__(self, datain, parent=None, *args):
176
-        """ datain: a list where each item is a row
177
-        """
178
-        QAbstractListModel.__init__(self, parent, *args)
179
-        self.listdata = datain
180
-
181
-    def rowCount(self, parent=QModelIndex()):
182
-        return len(self.listdata)
183
-
184
-    def data(self, index, role):
185
-        if index.isValid() and role == Qt.DisplayRole:
186
-            return QVariant(self.listdata[index.row()])
187
-        else:
188
-            return QVariant()
189
-
190
-if __name__ == "__main__":
191
-    main()

+ 57
- 0
kcnrtl/main.py View File

@@ -0,0 +1,57 @@
1
+#!/usr/bin/python
2
+#-*- coding: utf-8 -*-
3
+
4
+########################################################################
5
+# This file is part of KCnrtl                                          #
6
+#                                                                      #
7
+#                                                                      #
8
+# Copyright (C) 2012 Bogdan Cordier                                    #
9
+#                                                                      #
10
+# KCnrtl is free software: you can redistribute it and/or modify       #
11
+# it under the terms of the GNU General Public License as published by #
12
+# the Free Software Foundation, either version 3 of the License, or    #
13
+# (at your option) any later version.                                  #
14
+#                                                                      #
15
+# KCnrtl is distributed in the hope that it will be useful,            #
16
+# but WITHOUT ANY WARRANTY; without even the implied warranty of       #
17
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        #
18
+# GNU General Public License for more details.                         #
19
+#                                                                      #
20
+# You should have received a copy of the GNU General Public License    #
21
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.#
22
+########################################################################
23
+
24
+
25
+import argparse
26
+import sys
27
+
28
+def main():
29
+    cmd = argparse.ArgumentParser(description="Check for synonyms or antonyms",
30
+        prog='kcnrtl', usage='%(prog)s --help [options] word')
31
+
32
+    cmd.add_argument('word', default="", nargs='?',
33
+        help="The word to look for")
34
+
35
+    cmd.add_argument('-s', '--synonym', action="store_true",
36
+        help="Display synonyms of any word")
37
+
38
+    cmd.add_argument('-a', '--antonym', action="store_true",
39
+        help="Display antonyms of any word")
40
+
41
+    args = cmd.parse_args()
42
+
43
+    if 'word' in args:
44
+        wordset = args.word
45
+
46
+    if len(sys.argv) < 2:
47
+        from gui.gui import main
48
+        exit(main())
49
+    else:
50
+        from fetchparsebs import getSynoAnto
51
+        if args.synonym:
52
+            getSynoAnto(wordset, "synonymie")
53
+        if args.antonym:
54
+            getSynoAnto(wordset, "antonymie")
55
+
56
+if __name__ == '__main__':
57
+    main()

+ 17
- 0
kcnrtl/models.py View File

@@ -0,0 +1,17 @@
1
+from PyQt4.QtCore import QModelIndex, QVariant, Qt, QAbstractListModel
2
+
3
+class ListModel(QAbstractListModel):
4
+    def __init__(self, datain, parent=None, *args):
5
+        """ datain: a list where each item is a row
6
+        """
7
+        QAbstractListModel.__init__(self, parent, *args)
8
+        self.listdata = datain
9
+
10
+    def rowCount(self, parent=QModelIndex()):
11
+        return len(self.listdata)
12
+
13
+    def data(self, index, role):
14
+        if index.isValid() and role == Qt.DisplayRole:
15
+            return QVariant(self.listdata[index.row()])
16
+        else:
17
+            return QVariant()

+ 223
- 0
kcnrtl/resources/kcnrtl_icon.svg View File

@@ -0,0 +1,223 @@
1
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
+
4
+<svg
5
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
6
+   xmlns:cc="http://creativecommons.org/ns#"
7
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
+   xmlns:svg="http://www.w3.org/2000/svg"
9
+   xmlns="http://www.w3.org/2000/svg"
10
+   xmlns:xlink="http://www.w3.org/1999/xlink"
11
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
12
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
13
+   width="55.989033"
14
+   height="55.990002"
15
+   id="svg2"
16
+   sodipodi:version="0.32"
17
+   inkscape:version="0.48.3.1 r9886"
18
+   sodipodi:docname="kcnrtl_icon.svg"
19
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
20
+   inkscape:export-filename="/home/bogdan/Documents/Programmation/projets/kcnrtl/icons/hicolor/16x16/apps/kcnrtl.png"
21
+   inkscape:export-xdpi="25.719999"
22
+   inkscape:export-ydpi="25.719999"
23
+   version="1.0">
24
+  <defs
25
+     id="defs4">
26
+    <linearGradient
27
+       inkscape:collect="always"
28
+       id="linearGradient3215">
29
+      <stop
30
+         style="stop-color:#ffd5d5;stop-opacity:1"
31
+         offset="0"
32
+         id="stop3217" />
33
+      <stop
34
+         style="stop-color:#ff0000;stop-opacity:1"
35
+         offset="1"
36
+         id="stop3219" />
37
+    </linearGradient>
38
+    <linearGradient
39
+       inkscape:collect="always"
40
+       id="linearGradient3205">
41
+      <stop
42
+         style="stop-color:#552200;stop-opacity:1"
43
+         offset="0"
44
+         id="stop3207" />
45
+      <stop
46
+         style="stop-color:#aa4400;stop-opacity:1"
47
+         offset="1"
48
+         id="stop3209" />
49
+    </linearGradient>
50
+    <linearGradient
51
+       inkscape:collect="always"
52
+       id="linearGradient3175">
53
+      <stop
54
+         style="stop-color:#ff9955;stop-opacity:1;"
55
+         offset="0"
56
+         id="stop3177" />
57
+      <stop
58
+         style="stop-color:#ffccaa;stop-opacity:1"
59
+         offset="1"
60
+         id="stop3179" />
61
+    </linearGradient>
62
+    <linearGradient
63
+       inkscape:collect="always"
64
+       id="linearGradient3165">
65
+      <stop
66
+         style="stop-color:#808080;stop-opacity:1"
67
+         offset="0"
68
+         id="stop3167" />
69
+      <stop
70
+         style="stop-color:#e6e6e6;stop-opacity:1"
71
+         offset="1"
72
+         id="stop3169" />
73
+    </linearGradient>
74
+    <linearGradient
75
+       inkscape:collect="always"
76
+       id="linearGradient3155">
77
+      <stop
78
+         style="stop-color:#552200;stop-opacity:1;"
79
+         offset="0"
80
+         id="stop3157" />
81
+      <stop
82
+         style="stop-color:#d45500;stop-opacity:1"
83
+         offset="1"
84
+         id="stop3159" />
85
+    </linearGradient>
86
+    <inkscape:perspective
87
+       sodipodi:type="inkscape:persp3d"
88
+       inkscape:vp_x="0 : 526.18109 : 1"
89
+       inkscape:vp_y="0 : 1000 : 0"
90
+       inkscape:vp_z="744.09448 : 526.18109 : 1"
91
+       inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
92
+       id="perspective10" />
93
+    <linearGradient
94
+       inkscape:collect="always"
95
+       xlink:href="#linearGradient3155"
96
+       id="linearGradient3161"
97
+       x1="297.67511"
98
+       y1="178.7702"
99
+       x2="468.16641"
100
+       y2="437.44653"
101
+       gradientUnits="userSpaceOnUse" />
102
+    <linearGradient
103
+       inkscape:collect="always"
104
+       xlink:href="#linearGradient3165"
105
+       id="linearGradient3171"
106
+       x1="417.34094"
107
+       y1="478.75085"
108
+       x2="505.17892"
109
+       y2="284.89575"
110
+       gradientUnits="userSpaceOnUse" />
111
+    <linearGradient
112
+       inkscape:collect="always"
113
+       xlink:href="#linearGradient3175"
114
+       id="linearGradient3181"
115
+       x1="275.07126"
116
+       y1="176.01337"
117
+       x2="487.98697"
118
+       y2="291.72845"
119
+       gradientUnits="userSpaceOnUse" />
120
+    <linearGradient
121
+       inkscape:collect="always"
122
+       xlink:href="#linearGradient3205"
123
+       id="linearGradient3211"
124
+       x1="238.73965"
125
+       y1="231.3362"
126
+       x2="460.21536"
127
+       y2="392.67606"
128
+       gradientUnits="userSpaceOnUse" />
129
+    <radialGradient
130
+       inkscape:collect="always"
131
+       xlink:href="#linearGradient3215"
132
+       id="radialGradient3221"
133
+       cx="525.54358"
134
+       cy="407.12192"
135
+       fx="525.54358"
136
+       fy="407.12192"
137
+       r="75.093948"
138
+       gradientTransform="matrix(0.8448317,-0.1285871,0.1338057,0.8791184,6.1580993,113.75734)"
139
+       gradientUnits="userSpaceOnUse" />
140
+  </defs>
141
+  <sodipodi:namedview
142
+     id="base"
143
+     pagecolor="#ffffff"
144
+     bordercolor="#666666"
145
+     borderopacity="1.0"
146
+     inkscape:pageopacity="0.0"
147
+     inkscape:pageshadow="2"
148
+     inkscape:zoom="2.2861619"
149
+     inkscape:cx="185.13784"
150
+     inkscape:cy="164.76537"
151
+     inkscape:document-units="px"
152
+     inkscape:current-layer="layer1"
153
+     showgrid="false"
154
+     inkscape:window-width="1680"
155
+     inkscape:window-height="1003"
156
+     inkscape:window-x="0"
157
+     inkscape:window-y="-3"
158
+     inkscape:window-maximized="1" />
159
+  <metadata
160
+     id="metadata7">
161
+    <rdf:RDF>
162
+      <cc:Work
163
+         rdf:about="">
164
+        <dc:format>image/svg+xml</dc:format>
165
+        <dc:type
166
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
167
+        <dc:title></dc:title>
168
+      </cc:Work>
169
+    </rdf:RDF>
170
+  </metadata>
171
+  <g
172
+     inkscape:label="Capa 1"
173
+     inkscape:groupmode="layer"
174
+     id="layer1"
175
+     transform="translate(0.1071386,-996.5428)">
176
+    <g
177
+       id="g3223"
178
+       transform="matrix(0.1511216,0,0,0.16972945,-33.368447,969.58714)">
179
+      <path
180
+         sodipodi:nodetypes="cccssc"
181
+         id="path2383"
182
+         d="m 253.76402,330.56162 60.92654,-168.98338 242.12203,102.53336 -108.356,207.1822 c -8.87102,16.96183 -34.74107,22.90987 -45.79993,11.59585 L 253.76402,330.56162 z"
183
+         style="fill:url(#linearGradient3161);fill-opacity:1;fill-rule:evenodd;stroke:none"
184
+         inkscape:connector-curvature="0" />
185
+      <path
186
+         sodipodi:nodetypes="csccc"
187
+         id="path3163"
188
+         d="m 399.3823,463.86839 c 8.81639,19.39605 27.3308,19.39605 33.94309,7.05311 6.61229,-12.34294 92.13124,-186.02576 92.13124,-186.02576 l -86.40058,16.31032 c 0,0 -55.54325,149.43775 -39.67375,162.66233 z"
189
+         style="fill:url(#linearGradient3171);fill-opacity:1;fill-rule:evenodd;stroke:none"
190
+         inkscape:connector-curvature="0" />
191
+      <path
192
+         sodipodi:nodetypes="ccccc"
193
+         id="path3173"
194
+         d="M 525.45663,284.89574 316.9491,176.89501 l -64.80045,0.44082 181.17674,127.8376 92.13124,-20.27769 z"
195
+         style="fill:url(#linearGradient3181);fill-opacity:1;fill-rule:evenodd;stroke:none"
196
+         inkscape:connector-curvature="0" />
197
+      <path
198
+         sodipodi:nodetypes="ccc"
199
+         id="path3183"
200
+         d="m 301.96123,176.45419 197.04624,113.73139 0.88164,0.44082"
201
+         style="fill:#552200;fill-rule:evenodd;stroke:#552200;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
202
+         inkscape:connector-curvature="0" />
203
+      <path
204
+         sodipodi:nodetypes="ccc"
205
+         style="fill:#552200;fill-rule:evenodd;stroke:#552200;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
206
+         d="m 283.25106,177.13173 189.55231,118.5804 0.88164,0.44082"
207
+         id="path3185"
208
+         inkscape:connector-curvature="0" />
209
+      <path
210
+         sodipodi:nodetypes="csccsscc"
211
+         id="path3187"
212
+         d="m 414.37016,487.23181 c -11.02048,-6.61228 -13.6654,-14.10622 -7.93475,-36.14718 5.73066,-22.04097 41.87784,-158.25414 41.87784,-158.25414 L 256.55684,158.82142 222.61376,300.76524 c -3.31262,13.85274 -6.11752,23.82237 10.57967,38.35128 l 154.56468,134.49316 c 15.04215,12.14071 18.31386,12.94962 26.61205,13.62213 z"
213
+         style="fill:url(#linearGradient3211);fill-opacity:1;fill-rule:evenodd;stroke:none"
214
+         inkscape:connector-curvature="0" />
215
+      <path
216
+         sodipodi:nodetypes="ccssscccsssc"
217
+         id="path3213"
218
+         d="m 440.39838,402.00644 8.96159,-27.31153 c 0,0 28.16501,-9.81508 52.0626,2.56046 23.89759,12.37554 5.12091,42.67426 28.16501,42.67426 23.0441,0 39.26032,-4.69417 29.44524,-27.73827 -9.81508,-23.0441 -21.76387,-23.0441 -21.76387,-23.0441 0,0 14.08251,-3.41394 21.33713,-0.42674 1.21957,-5.46187 -0.88365,-22.25127 -0.88365,-22.25127 0,0 22.34298,19.6272 30.09496,42.24165 8.16795,23.82795 0.46949,50.77284 -53.20508,53.5129 -39.80237,2.03188 -39.54799,-14.48413 -42.53519,-32.40732 -2.9872,-17.92319 -50.82526,-6.95655 -51.67874,-7.81004 z"
219
+         style="fill:url(#radialGradient3221);fill-opacity:1;fill-rule:evenodd;stroke:none"
220
+         inkscape:connector-curvature="0" />
221
+    </g>
222
+  </g>
223
+</svg>

+ 4
- 2
setup.py View File

@@ -7,7 +7,7 @@ def read(fname):
7 7
     return open(os.path.join(os.path.dirname(__file__), fname)).read()
8 8
 
9 9
 setup(name='KCnrtl',
10
-      version='0.3b',
10
+      version='0.4b',
11 11
       description='Qt graphical client for the CNRTL french linguistic resources',
12 12
       license = "GPLv3", 
13 13
       author="Bogdan Cordier",
@@ -15,10 +15,12 @@ setup(name='KCnrtl',
15 15
       url="http://code.lm7.fr/p/kcnrtl/",
16 16
       download_url="http://code.lm7.fr/p/kcnrtl/downloads/", 
17 17
       packages=['kcnrtl'],
18
+      requires=['BeautifulSoup4','httplib2'],
18 19
       long_description=read('README'),
19 20
       classifiers=[
20 21
         "Development Status :: 4 - Beta",
21
-        "Environment :: X11 Applications :: Qt"
22
+        "Environment :: X11 Applications :: Qt",
23
+        "Environment :: Console",
22 24
         "Topic :: Utilities",
23 25
         "Natural Language :: French",
24 26
         "Intended Audience :: Education"

Loading…
Cancel
Save