Code Refactor
authorBogdan Cordier <bcord@hadaly.fr>
Fri, 25 May 2012 21:36:03 +0000 (23:36 +0200)
committerBogdan Cordier <bcord@hadaly.fr>
Fri, 25 May 2012 21:36:03 +0000 (23:36 +0200)
Added icons
Added cli support

17 files changed:
README
icons/hicolor/128x128/apps/kcnrtl.png [new file with mode: 0644]
icons/hicolor/16x16/apps/kcnrtl.png [new file with mode: 0644]
icons/hicolor/32x32/apps/kcnrtl.png [new file with mode: 0644]
icons/hicolor/64x64/apps/kcnrtl.png [new file with mode: 0644]
icons/kcnrtl.ico [new file with mode: 0644]
icons/pixmaps/kcnrtl.xpm [new file with mode: 0644]
kcnrtl.py [new file with mode: 0755]
kcnrtl/fetchparsebs.py [new file with mode: 0644]
kcnrtl/fetchparseqt.py [new file with mode: 0644]
kcnrtl/gui/Ui_kcnrtl.py
kcnrtl/gui/gui.py [new file with mode: 0755]
kcnrtl/kcnrtl.py [deleted file]
kcnrtl/main.py [new file with mode: 0755]
kcnrtl/models.py [new file with mode: 0644]
kcnrtl/resources/kcnrtl_icon.svg [new file with mode: 0644]
setup.py

diff --git a/README b/README
index 73a6e7a..55d5742 100644 (file)
--- a/README
+++ b/README
@@ -5,34 +5,34 @@ KCnrtl
 :Author: Bogdan Cordier <bcord@hadaly.fr>
 :Date: 2012-10-05
 :Copyright: GPLv3
-:Version: 0.3b
+:Version: 0.4b
 
 
 Description
 ===========
 
 KCnrtl is a simple Qt graphical client to access the CNRTL french linguistic resources.
-It offers the possibility to check the definitions, synonyms, antonyms of a given
-french word.
 
 Features:
 ---------
 
-    *Check the definitions, synomyms, antonyms of any given french word
-      For now the TLFi (Trésor de la Langue Française) is the only available dictionary.
+    *Check the synomyms, antonyms (CLI & GUI), definitions (GUI only) of any given french word
 
-    *The "AMAZING Clipboard mode" :
+    *Dictionaries available for now:
+        -TLFi (Trésor de la Langue Française informatisé)
+        -Dictionnaire de l'Académie Française 9th, 8th & 4th Edition
+
+    *Clipboard mode (GUI only) :
       With the "Clipboard mode" you can easily check for a synonym/antonym and replace it in your text.
       To do so, just check the "Clipboard mode" checkbox, copy in the clipboard any word, KCnrtl will do
       an automatic request to the CNRTL website and you can easily copy any synonym or antonym by
-      just clicking on them.
+      just clicking on them in the result list.
       Now you just have to paste it back in you text !
 
 Planned features:
 -----------------
 
-    *cli client
-    *access to other dictionary offered by the CNRTL (Dictionnaire de l'Académie française 9e, etc)
+    *access to other dictionaries offered by the CNRTL (Dictionnaire du Moyen Français, etc)
 
 Installation
 ============
@@ -44,6 +44,10 @@ TODO!!
 Requirements
 ============
 
-*Python:2.7
-*PyQT4
+*Python: 2.7
+*PyQt4: >= 4.6
+
+Optional if you don't use command-line:
+*BeautifulSoup4
+*Httplib2
 
diff --git a/icons/hicolor/128x128/apps/kcnrtl.png b/icons/hicolor/128x128/apps/kcnrtl.png
new file mode 100644 (file)
index 0000000..6e4f103
Binary files /dev/null and b/icons/hicolor/128x128/apps/kcnrtl.png differ
diff --git a/icons/hicolor/16x16/apps/kcnrtl.png b/icons/hicolor/16x16/apps/kcnrtl.png
new file mode 100644 (file)
index 0000000..5b84db9
Binary files /dev/null and b/icons/hicolor/16x16/apps/kcnrtl.png differ
diff --git a/icons/hicolor/32x32/apps/kcnrtl.png b/icons/hicolor/32x32/apps/kcnrtl.png
new file mode 100644 (file)
index 0000000..aae2bcc
Binary files /dev/null and b/icons/hicolor/32x32/apps/kcnrtl.png differ
diff --git a/icons/hicolor/64x64/apps/kcnrtl.png b/icons/hicolor/64x64/apps/kcnrtl.png
new file mode 100644 (file)
index 0000000..36dbf94
Binary files /dev/null and b/icons/hicolor/64x64/apps/kcnrtl.png differ
diff --git a/icons/kcnrtl.ico b/icons/kcnrtl.ico
new file mode 100644 (file)
index 0000000..a4e03ff
Binary files /dev/null and b/icons/kcnrtl.ico differ
diff --git a/icons/pixmaps/kcnrtl.xpm b/icons/pixmaps/kcnrtl.xpm
new file mode 100644 (file)
index 0000000..45eb0a2
--- /dev/null
@@ -0,0 +1,305 @@
+/* XPM */
+static char *kcnrtl[] = {
+/* columns rows colors chars-per-pixel */
+"56 56 243 2 ",
+"   c #55F522530015",
+".  c #5C1A24B10032",
+"X  c #5F5F2F2F0F0F",
+"o  c #61E426D10000",
+"O  c #65CC28A60038",
+"+  c #6BF02AEA000C",
+"@  c #63632E2E0C0C",
+"#  c #73FA2E190002",
+"$  c #68E731300C8C",
+"%  c #7BFE315E0002",
+"&  c #7575343408B3",
+"*  c #66E63838199A",
+"=  c #78223B9013BE",
+"-  c #72723DE81B1B",
+";  c #7DFD41C01A9B",
+":  c #727242422323",
+">  c #75754C4B3030",
+",  c #797950503434",
+"<  c #840034840009",
+"1  c #8A0A36CD0000",
+"2  c #8DFF38960010",
+"3  c #85853B3B0B0B",
+"4  c #93F93AE60007",
+"5  c #9BA83DF50006",
+"6  c #82823F3F1515",
+"7  c #FFFF00BF00BF",
+"8  c #FFFF0CB70CB7",
+"9  c #FFFF14471447",
+"0  c #FFFF1AD21AD2",
+"q  c #F6F622222222",
+"w  c #FFFF23E423E4",
+"e  c #FFFF2AC42AC4",
+"r  c #FFA933893389",
+"t  c #FFCB3B6E3B6E",
+"y  c #9E9E40EB0202",
+"u  c #931242820D4D",
+"i  c #9AEF44440AB5",
+"p  c #8B8B44441494",
+"a  c #8CE249F41D1D",
+"s  c #97164ACA17D8",
+"d  c #A3914135001E",
+"f  c #A7A746C70606",
+"g  c #ABAB44A00025",
+"h  c #B1DC471C002B",
+"j  c #B49448E90141",
+"k  c #BBF44AF50000",
+"l  c #B8B851510C0C",
+"z  c #A34D4CF71414",
+"x  c #A4A44DCE1515",
+"c  c #B73755D61494",
+"v  c #88324B4B22CD",
+"b  c #90904D4D2020",
+"n  c #9E1E54D42323",
+"m  c #92E755552C2C",
+"M  c #9B9B55D62828",
+"N  c #9A1A58D82D2D",
+"B  c #91915ADA3636",
+"V  c #9E1E5EDE34B4",
+"C  c #A1A156AC24CF",
+"Z  c #A3A35D072E2E",
+"A  c #A2A25EDF32B3",
+"S  c #BBBB61B72626",
+"D  c #B86264642BD6",
+"F  c #ABEB63233272",
+"G  c #A33C64973BA2",
+"H  c #ACAC68683A90",
+"J  c #B6B66A6A36B7",
+"K  c #B9B96D6D3B3B",
+"L  c #BDBD71713DBE",
+"P  c #C1C14E4E0181",
+"I  c #CC4B521200E1",
+"U  c #C5C456560C0C",
+"Y  c #D3AB55550129",
+"T  c #D3D25B5B0B8B",
+"R  c #C0BF59581515",
+"E  c #C7C760601A1A",
+"W  c #D5D462B7166C",
+"Q  c #DBDA5C5C2C2B",
+"!  c #C0C066E72B2B",
+"~  c #D7D76D6D2E2E",
+"^  c #C8C76E6D3131",
+"/  c #C4C470703838",
+"(  c #83835E5E4545",
+")  c #8E8E67674D4D",
+"_  c #9C1B6AEB4A4A",
+"`  c #8E8E6D6C5656",
+"'  c #94936E6E5555",
+"]  c #97D773335ADA",
+"[  c #A471699C4310",
+"{  c #AC006D1743EE",
+"}  c #A34D6C1647F2",
+"|  c #B0B06F6F4444",
+" . c #AD57731D4C4C",
+".. c #BE3E73734242",
+"X. c #B58276424C7F",
+"o. c #B9B976B64ACB",
+"O. c #AC5675CB51A7",
+"+. c #AB2A7BFC5CDC",
+"@. c #B4B47C7C5757",
+"#. c #BBBB7C2651FC",
+"$. c #8F8F7C7C6F6F",
+"%. c #9A447B2566BC",
+"&. c #A2A27F7F6868",
+"*. c #D2D25A5A5A5A",
+"=. c #E0E04D4D4D4D",
+"-. c #F1F144444444",
+";. c #FFFF43434343",
+":. c #FFFF4DCD4DCD",
+">. c #E0E058585858",
+",. c #F6F650505050",
+"<. c #FF3E53135313",
+"1. c #FF295BDB5B5B",
+"2. c #C646797945C5",
+"3. c #C71B7A2446F1",
+"4. c #CD4D7E7E4ACA",
+"5. c #EEEE60604A4A",
+"6. c #F5F562625F5F",
+"7. c #FD7D686864E5",
+"8. c #FFFF6BFE6BFE",
+"9. c #FFFF75F575F5",
+"0. c #FFFF7CFC7CFC",
+"q. c #BD6782D75CB2",
+"w. c #959583837777",
+"e. c #A6FC84DA6E18",
+"r. c #BB1085DB63B9",
+"t. c #A62589897777",
+"y. c #ACAC92117F7F",
+"u. c #DADA82824848",
+"i. c #DEDE87074CCC",
+"p. c #CD2285855555",
+"a. c #C46E85DB5CB2",
+"s. c #CBCB88885C5C",
+"d. c #D757898955D6",
+"f. c #D4D4894957D8",
+"g. c #EB6B900F5353",
+"h. c #EDED96965D5D",
+"j. c #C645898960E0",
+"k. c #C4438E8E6B6B",
+"l. c #D0D08C8C6060",
+"z. c #CDCD922B6A9D",
+"x. c #DC3194EA65BB",
+"c. c #D8D895956913",
+"v. c #DFDF9B9B6DC3",
+"b. c #C7C79696760F",
+"n. c #E53A964062B8",
+"m. c #E58F99436666",
+"M. c #E6E69B9B6A6A",
+"N. c #F6F69D9D6262",
+"B. c #F2F29F1F68E8",
+"V. c #E5E59F9F7070",
+"C. c #DCDCA12078F8",
+"Z. c #FEFEA0A06262",
+"A. c #FD3CA6A66D6D",
+"S. c #EABFA7517AFA",
+"D. c #FDFDABEB75B5",
+"F. c #F6F6AD137C49",
+"G. c #FEA8B1067D7D",
+"H. c #84EB84B7849E",
+"J. c #8CBB8CBB8CBB",
+"K. c #9431941D941D",
+"L. c #9B9B97979595",
+"P. c #9C409C409C40",
+"I. c #B7368B8B8B8B",
+"U. c #AD0295EB8731",
+"Y. c #B1B19A198A8A",
+"T. c #A3229A199414",
+"R. c #B4339C1C9494",
+"E. c #B6B6A4A49999",
+"W. c #A38EA38EA38E",
+"Q. c #ABABA8A8A7A7",
+"!. c #ABCBABABABAB",
+"~. c #BCBCAFAFA6A6",
+"^. c #B535B535B535",
+"/. c #B8B8B7B7B7B7",
+"(. c #BCCABCCABCCA",
+"). c #C4C49F9F8686",
+"_. c #C0C096969696",
+"`. c #FFFF853C853C",
+"'. c #FFFF8AF88AF8",
+"]. c #FFFF94609460",
+"[. c #FFFF9BCE9BCE",
+"{. c #DF5FA9A98585",
+"}. c #DADAABAB8C8C",
+"|. c #C544A7A79494",
+" X c #D1D1AAAA9191",
+".X c #EC41AE58852F",
+"XX c #E9E9B2B28E8E",
+"oX c #F4F4B2078585",
+"OX c #FECBB4E7841D",
+"+X c #F635B6368B4B",
+"@X c #FF47BA4C8C8C",
+"#X c #E867B7379615",
+"$X c #ED42BABA9999",
+"%X c #F348B9639393",
+"&X c #FE46BE2B936E",
+"*X c #C1C1AF2FA2A2",
+"=X c #CA49B5B5A827",
+"-X c #D3D3BB3AAB2A",
+";X c #CCCCBCBCB2B2",
+":X c #FFFFA40AA40A",
+">X c #FFFFAB86AB86",
+",X c #FFFFB2F2B2F2",
+"<X c #FFFEBD8ABD8A",
+"1X c #FFFFC1409717",
+"2X c #FE9BC39B9C74",
+"3X c #D353C140B534",
+"4X c #D47EC3C3B862",
+"5X c #E7E7C4C4ACAC",
+"6X c #FEFEC760A26F",
+"7X c #FEFEC996A572",
+"8X c #FF98CBFEA9DC",
+"9X c #E6E6C9C9B635",
+"0X c #ECECD0D0BDBD",
+"qX c #C419C419C419",
+"wX c #CBE1CBCBCBC0",
+"eX c #D454CACAC443",
+"rX c #DADACF4FC7C7",
+"tX c #D400D3E9D3D3",
+"yX c #DC00DBEDDBED",
+"uX c #FFFFC29DC29D",
+"iX c #FFFFCB75CB75",
+"pX c #EC96D680C81D",
+"aX c #E1E1D4D4CC4B",
+"sX c #F5F5D958C646",
+"dX c #F5F5DCDCCC4C",
+"fX c #E8E8DEDED7D7",
+"gX c #FFFFD554D554",
+"hX c #F1F1DDDDD0D0",
+"jX c #EC2BE2A2DB9B",
+"kX c #F6F6E7E7DE5E",
+"lX c #F9F9E6E6D9D9",
+"zX c #E322E2E2E2E2",
+"xX c #EF6FE767E1E1",
+"cX c #EFEFE9E9E5E5",
+"vX c #FFFFE564E564",
+"bX c #F372EB6AE5E5",
+"nX c #F348EE18EAEA",
+"mX c #FCFCEE6EEAEA",
+"MX c #F736F1B1EEAE",
+"NX c #FBFBF0F0E8E8",
+"BX c #F8F8F59FF3F3",
+"VX c #FCD7F599F418",
+"CX c #FFF9FFEDFFE9",
+/* pixels */
+"CXCXCXCXCXU.rXCXCXCXCXCXCXCX4XBXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCXCXCX>   Y.CXCXCXCXCXMX  * U.nXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCXCXBX      ` BXCXCXMX*X      @ e.cXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCXCXeX        $ A A.2.V i.M . . . o ] fXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCXCXY.          o a i.h.F 2.h.a o o o O ] fXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCXCX`           .   a J Z.4.N h.d.= O O O + _ aXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCXCX:         . . . o 6 M h.N.F ..A.2.# O O O # B 4XCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCXcX        . . . . o o & Z 2.A.d.A n.B.F # # + # # m -XCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCX;X        . . . o o o O + F A B.A.H { D.n.b # # % % # m =XCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCXt.      . . . . o o o O O O n H d.D.n.V m.G.p.6 % % % % < b |.BXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCX(       . . . o o o O O O O + p o.H D.D.o.| G.F...< % % < % < a b.MXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCXX     . . . . o o o O O + + + # & 4.A m.D.M.A x.OXS.F < < < < 1 1 u b.MXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXfX      . . o o o o O O + O + + + # # 2.o.o.G.G.#.| OXOXv.s 1 1 1 1 2 2 s r.bXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"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",
+"CXCX%.  . . . . o o o O O + + + + + # # # # % p M.| s.OXOXa.{ oX@X+X..2 4 2 4 4 4 4 5 X.pXCXCXCXCXCXCXCXCXCXCXCX",
+"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",
+"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",
+"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",
+"CXR.. . . o o o O O O + + # + # # # # % # % % < < < < < u V.S.[ .X&X2XC.} XX6X6X%X2.d d d g g g g g z.CXCXCXCXCX",
+"CX] . . . o o O O O O + + + + # # # # # % % % % % < < < 1 3 4.&X@.@.2X2X2X@.r.6X8X8X.XS d d g g g g kXCXCXCXCXCX",
+"CX: . . o o o O O O + + + # # + # # # % % % % % % < < < 1 1 1 J @XC.} %X6X6X{._ XX8X8X8XM.c g g g s.CXCXCXCXCXCX",
+"nX. . o o o o O + + + + + + # # # % # % % % < % < < 1 < 1 1 2 2 C +X%XO.z.6X6X7Xr.r.8X8X#X{.j g h hXCXCXCXCXCXCX",
+"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",
+"y.o . o O O O O + + + + + # # # % % % % < % < < < 1 1 1 2 2 2 2 2 4 M.6X$X X=XyXyXzXzXyXzXD h h 0XCXCXCXCXCXCXCX",
+") . o o O O O O + + # # + # # % % % % % < % < < < 1 1 1 2 2 2 4 4 4 3XtXtXtXyXyXyXyXyXyX-Xh h / CXCXCXCXCXCXCXCX",
+"- o o O O O + + + + + # # # # % # % % % % < < < 1 1 1 2 2 2 4 4 4 n tXtXtXtXtXtXyXyXyXyX2.h j 5XCXCXCXCXCXCXCXCX",
+"@ o O o O O O + + # + # # % # # % % % < < < < < 1 1 1 2 2 2 4 4 5 O.wXwXtXtXtXtXtXtXyX4Xh j ! CXCXCXCXCXCXCXCXCX",
+"- o O O O + O # + + # # # # % % % % < % < < < 1 < 1 1 2 2 2 4 4 5 Y.wXwXwXwXtXtXtXtXtXa.j j #XCXCXCXCXCXCXCXCXCX",
+"&.O O O + O + # # # # # # % % % % % < < < 1 < 1 1 1 2 2 4 4 4 4 4 ~.wXwXwXwXwXwXtXtXeXl j R VXCXCXCXCXCXCXCXCXCX",
+"nX- O O + + + + + # # # # # % % % < % < < < 1 1 1 2 2 2 4 4 4 4 z qXqXqXwXwXwXwXwXwXb.k k {.CXCXCXCXCXCXCXCXCXCX",
+"CXaX= O + + # # # # # # % % % % % < < < < 1 1 1 2 2 4 4 4 4 5 4 { qXqXqXqXqXwXwXwXwXc k U BXCXCXCXCXCXCXCXCXCXCX",
+"CXCXfX= + O # + # # # % # % % % < < < < < 1 1 2 2 2 4 4 4 4 4 5 e.qX(.qXqXqXqXqXwX).k k C.CXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCXfX; + # # # # # % % % % < < < < 1 < 1 1 2 2 2 4 4 4 5 5 5 E.(.(.qXqXqXqXqXqXD k U NXCXCXCXCXCXCX0.CXCXCXCX",
+"CXCXCXCXjX; + # # # # % % % < % % < < 1 1 1 2 2 2 4 4 4 4 4 4 i /.(.(.(.(.(.(.qX*Xk k x.CXCXCXCXCXCXCXw `.CXCXCX",
+"CXCXCXCXCXjXv # % # % % % % % < < 1 < 1 1 1 2 2 4 4 4 4 5 5 5 A ^././.(.(.(.(.(.2.P P kXCXCXCXCXCXCXCXe 7 uXCXCX",
+"CXCXCXCXCXCXxXv # % % % % % < < < < 1 1 1 1 2 4 4 4 4 4 4 5 5 +.^.^.^./.(.(.(.~.k P d.CXCXCXCXCXuX'.`.0 7 e VXCX",
+"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",
+"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",
+"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",
+"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 <.",
+"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 ",
+"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 ",
+"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 ",
+"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 <.",
+"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",
+"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",
+"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",
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXVX#.5 5 5 5 d 5 d d A J.K.K.K.L.+.I T NXCXCXCXCXVX>X8.1.:.;.t ;.1.>XVXCXCXCX",
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXq.5 5 5 5 d d d ' J.J.K.K.K.E Y n.CXCXCXCXCXCXCXCXVXVXVXCXCXCXCXCXCXCXCX",
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXVXq.5 d d d d d $.J.J.J.J.e.Y Y lXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXBXj.d d d d f H.J.J.J.J.D Y g.CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXa.d d d z H.H.H.J.w.I Y dXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXz.d d z H.H.H.H.J Y u.CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXz.g h ] H.H.%.Y Y sXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX}.g I S S Y Y %XCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX",
+"CXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXpX^ W W i.sXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCXCX"
+};
diff --git a/kcnrtl.py b/kcnrtl.py
new file mode 100755 (executable)
index 0000000..b331e95
--- /dev/null
+++ b/kcnrtl.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python
+
+from kcnrtl.main import main
+
+if __name__ == '__main__':
+    main()
\ No newline at end of file
diff --git a/kcnrtl/fetchparsebs.py b/kcnrtl/fetchparsebs.py
new file mode 100644 (file)
index 0000000..609c2b6
--- /dev/null
@@ -0,0 +1,38 @@
+#-*- coding: utf-8 -*-
+
+########################################################################
+# This file is part of KCnrtl                                          #
+#                                                                      #
+#                                                                      #
+# Copyright (C) 2012 Bogdan Cordier                                    #
+#                                                                      #
+# KCnrtl is free software: you can redistribute it and/or modify       #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or    #
+# (at your option) any later version.                                  #
+#                                                                      #
+# KCnrtl is distributed in the hope that it will be useful,            #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of       #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        #
+# GNU General Public License for more details.                         #
+#                                                                      #
+# You should have received a copy of the GNU General Public License    #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.#
+########################################################################
+
+import httplib2
+from bs4 import BeautifulSoup
+
+def getSynoAnto(text, form):
+    conn = httplib2.Http(".cache")
+    htmlSource = conn.request("http://www.cnrtl.fr/%s/%s" %
+                                  (form, text), "GET")
+    soup = BeautifulSoup(htmlSource[1], "lxml")
+    tagy = soup.find_all('td', "%s_format" % (form[:4]))
+    i = 0
+    while i < len(tagy):
+        tag_a = tagy[i]
+        i += 1
+        print tag_a.text
+
+
diff --git a/kcnrtl/fetchparseqt.py b/kcnrtl/fetchparseqt.py
new file mode 100644 (file)
index 0000000..6711772
--- /dev/null
@@ -0,0 +1,107 @@
+#-*- coding: utf-8 -*-
+
+########################################################################
+# This file is part of KCnrtl                                          #
+#                                                                      #
+#                                                                      #
+# Copyright (C) 2012 Bogdan Cordier                                    #
+#                                                                      #
+# KCnrtl is free software: you can redistribute it and/or modify       #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or    #
+# (at your option) any later version.                                  #
+#                                                                      #
+# KCnrtl is distributed in the hope that it will be useful,            #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of       #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        #
+# GNU General Public License for more details.                         #
+#                                                                      #
+# You should have received a copy of the GNU General Public License    #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.#
+########################################################################
+
+
+from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest
+from PyQt4.QtWebKit import QWebPage
+from PyQt4.QtCore import QEventLoop, QUrl
+
+
+class FetchParse:
+    def __init__(self, word, dico, combo1_index, combo2_index, combo2_text, wordclass):
+        self.word = word
+        self.dico = dico
+        self.combo1_index = combo1_index
+        self.combo2_index = combo2_index
+        self.combo2_text = combo2_text
+        self.wordclass = wordclass
+        self.manager = QNetworkAccessManager()
+        self.manager.finished.connect(self.replyFinished)
+        self.loop = QEventLoop()
+        self.manager.finished.connect(self.loop.quit)
+        self._reply = ""
+
+    def _get_reply(self):
+        self.fetch(self.dico)
+        return self._reply
+
+    reply = property(_get_reply)
+
+    def fetch(self, dico):
+        if dico == "Lexi":
+            if not self.combo2_index:
+                url = ("http://www.cnrtl.fr/definition/%s//%s" %
+                       (self.word, self.combo1_index))
+            if self.combo2_index > 0:
+                acad = unicode(self.combo2_text)
+                acadnum = filter(lambda x: x.isdigit(), acad)
+                acadnumf = "academie" + str(acadnum)
+                url = ("http://www.cnrtl.fr/definition/%s/%s//%s" %
+                       (acadnumf, self.word, self.combo1_index))
+        if dico == "Syno":
+            url = ("http://www.cnrtl.fr/synonymie/%s" %
+                   (self.word))
+        if dico == "Anto":
+            url = ("http://www.cnrtl.fr/antonymie/%s"  %
+                   (self.word))
+        self.manager.get(QNetworkRequest(QUrl(url)))
+        self.loop.exec_()
+
+    def replyFinished(self, datareply):
+        data = datareply.readAll()
+        page = QWebPage()
+        page.mainFrame().setContent(data)
+        webpage = page.mainFrame().documentElement()
+        if self.wordclass == "definition":
+            result = webpage.findAll("div#contentbox")
+            a = ""
+            if not self.combo2_index:
+                a = "div.tlf_cvedette"
+            if 1 <= self.combo2_index <= 3:
+                a = "span.tlf_cvedette"
+            result_to_remove = webpage.findAll(a)
+            string_to_remove = result_to_remove.first().toInnerXml()
+            final_page = result.first().toInnerXml()
+            resultf = final_page.replace(string_to_remove, '')
+
+            result_box = webpage.findFirst('div#vtoolbar')
+            result_test = result_box.findAll("a[href]")
+            self.formtype = []
+            i = 0
+            while i < len(result_test):
+                multdef_a = unicode(result_test.at(i).toPlainText())
+                # Delete digits in definition title
+                multdef_clean = ''.join(c for c in
+                    multdef_a if not c.isdigit())
+                self.formtype.append(multdef_clean)
+                i += 1
+            self._reply = resultf, self.formtype
+        if self.wordclass == "synonyme" or self.wordclass == "antonyme":
+            self._reply = []
+            result = webpage.findAll("td." + self.wordclass[:4] + "_format")
+            tag = []
+            i = 0
+            while i < len(result):
+                tag.append(result.at(i).firstChild().toPlainText())
+                i += 1
+            self._reply = tag
+
index b95ea43..7942fef 100644 (file)
@@ -93,7 +93,7 @@ class Ui_MainWindow(object):
         self.checkBox.setText(QtGui.QApplication.translate("MainWindow", "Clipboard Mode", None, QtGui.QApplication.UnicodeUTF8))
 
 from PyQt4 import QtWebKit
-import resources.kcnrtl_rc
+from kcnrtl.resources import kcnrtl_rc
 
 if __name__ == "__main__":
     import sys
diff --git a/kcnrtl/gui/gui.py b/kcnrtl/gui/gui.py
new file mode 100755 (executable)
index 0000000..6bf0e19
--- /dev/null
@@ -0,0 +1,124 @@
+#!/usr/bin/python
+#-*- coding: utf-8 -*-
+
+########################################################################
+# This file is part of KCnrtl                                          #
+#                                                                      #
+#                                                                      #
+# Copyright (C) 2012 Bogdan Cordier                                    #
+#                                                                      #
+# KCnrtl is free software: you can redistribute it and/or modify       #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or    #
+# (at your option) any later version.                                  #
+#                                                                      #
+# KCnrtl is distributed in the hope that it will be useful,            #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of       #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        #
+# GNU General Public License for more details.                         #
+#                                                                      #
+# You should have received a copy of the GNU General Public License    #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.#
+########################################################################
+
+import sys
+from PyQt4.QtCore import QUrl, Qt
+from PyQt4.QtGui import  QApplication, QMainWindow, QWidget
+from kcnrtl.fetchparseqt import FetchParse
+from kcnrtl.models import ListModel
+from Ui_kcnrtl import Ui_MainWindow
+
+
+def main():
+    app = QApplication(sys.argv)
+    myapp = Main()
+    myapp.show()
+    sys.exit(app.exec_())
+
+
+class Main(QMainWindow):
+    def __init__(self, parent=None):
+        super(QWidget, self).__init__(parent)
+        
+        self.ui = Ui_MainWindow()
+
+        self.ui.setupUi(self)
+
+        self.ui.lineEdit.selectAll()
+
+        self.ui.lineEdit.setFocus()
+
+        self.ui.comboBox.setCurrentIndex(0)
+
+        self.ui.checkBox.setChecked(False)
+
+
+        self.dictionaries = [str("TLFi").decode("utf-8", "strict"),
+                             str("Académie 9e Ed.").decode("utf-8", "strict"),
+                             str("Académie 8e Ed.").decode("utf-8", "strict"),
+                             str("Académie 4e Ed.").decode("utf-8", "strict"),
+                                ]
+        self.ui.comboBox_2.addItems(self.dictionaries)
+        
+        self.clipboard = QApplication.clipboard()
+
+        self.ui.lineEdit.returnPressed.connect(self.updateUi)
+
+        self.ui.comboBox.activated.connect(self.on_combo_change)
+        
+        self.ui.webView.settings().setUserStyleSheetUrl(
+                                               QUrl.fromLocalFile(':/lexi.css'))
+
+        self.ui.listView.clicked.connect(self.on_row_clicked)
+
+        self.clipboard.dataChanged.connect(self.get_from_clipboard)
+
+
+
+    def updateUi(self):
+        # Check if input text is a word
+        if len(unicode(self.ui.lineEdit.text()).split()) <= 1:
+             wordclass = "definition"
+             dico = "Lexi"
+             lexi = FetchParse(self.ui.lineEdit.text(),dico, self.ui.comboBox.currentIndex(),
+                                self.ui.comboBox_2.currentIndex(), self.ui.comboBox_2.currentText(), wordclass)
+             result_lexi = lexi.reply
+             self.ui.webView.setHtml(result_lexi[0])
+             self.ui.comboBox.clear()
+             self.ui.comboBox.addItems(result_lexi[1])
+             wordclass = "synonyme"
+             dico = "Syno"
+             syno = FetchParse(self.ui.lineEdit.text(),dico, self.ui.comboBox.currentIndex(),
+                                self.ui.comboBox_2.currentIndex(), self.ui.comboBox_2.currentText(), wordclass)
+             model = ListModel(syno.reply, self)
+             self.ui.listView.setModel(model)
+             wordclass = "antonyme"
+             dico = "Anto"
+             anto = FetchParse(self.ui.lineEdit.text(),dico, self.ui.comboBox.currentIndex(),
+                                self.ui.comboBox_2.currentIndex(), self.ui.comboBox_2.currentText(), wordclass)
+             model = ListModel(anto.reply, self)
+             self.ui.listView_2.setModel(model)
+
+        else:
+            self.ui.lineEdit.setText("Veuillez entrer UN mot")
+
+    # Copy selected item in list to the clipboard
+    def on_row_clicked(self, qmodelindex):
+        item = qmodelindex.data(Qt.DisplayRole).toString()
+        self.clipboard.setText(item)
+#
+    def get_from_clipboard(self):
+        if self.ui.checkBox.isChecked():
+            self.ui.lineEdit.setText(unicode(self.clipboard.text()))
+            self.updateUi()
+#
+    def on_combo_change(self):
+        wordclass = "definition"
+        dico = "Lexi"
+        lexi = FetchParse(self.ui.lineEdit.text(),dico, self.ui.comboBox.currentIndex(),
+            self.ui.comboBox_2.currentIndex(), self.ui.comboBox_2.currentText(), wordclass)
+        result_lexi = lexi.reply
+        self.ui.webView.setHtml(result_lexi[0])
+
+if __name__ == "__main__":
+    main()
diff --git a/kcnrtl/kcnrtl.py b/kcnrtl/kcnrtl.py
deleted file mode 100755 (executable)
index 30c77c7..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-#!/usr/bin/python
-#-*- coding: utf-8 -*-
-
-########################################################################
-# KCnrtl - A simple Qt graphical client to access the CNRTL            #
-# french linguistic resources.                                         #
-#                                                                      #
-# Copyright (C) 2012 Bogdan Cordier                                    #
-#                                                                      #
-# This program is free software: you can redistribute it and/or modify #
-# it under the terms of the GNU General Public License as published by #
-# the Free Software Foundation, either version 3 of the License, or    #
-# (at your option) any later version.                                  #
-#                                                                      #
-# This program is distributed in the hope that it will be useful,      #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of       #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        #
-# GNU General Public License for more details.                         #
-#                                                                      #
-# You should have received a copy of the GNU General Public License    #
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.#
-########################################################################
-
-import sys
-from PyQt4.QtCore import QEventLoop, QUrl, QAbstractListModel, QModelIndex, QVariant, Qt
-from PyQt4.QtGui import  QApplication, QMainWindow, QWidget
-from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest
-from PyQt4.QtWebKit import QWebPage
-from gui.Ui_kcnrtl import Ui_MainWindow
-
-
-def main():
-    app = QApplication(sys.argv)
-    myapp = Main()
-    myapp.show()
-    sys.exit(app.exec_())
-
-
-class Main(QMainWindow):
-    def __init__(self, parent=None):
-        super(QWidget, self).__init__(parent)
-        
-        self.ui = Ui_MainWindow()
-
-        self.ui.setupUi(self)
-
-        self.ui.lineEdit.selectAll()
-
-        self.ui.lineEdit.setFocus()
-
-        self.ui.comboBox.setCurrentIndex(0)
-
-        self.ui.checkBox.setChecked(False)
-
-        self.manager = QNetworkAccessManager()
-                
-        self.dictionaries = [str("TLFi").decode("utf-8", "strict"),
-                             str("Académie 9e Ed.").decode("utf-8", "strict"),
-                             str("Académie 8e Ed.").decode("utf-8", "strict"),
-                             str("Académie 4e Ed.").decode("utf-8", "strict"),
-                                ]
-        self.ui.comboBox_2.addItems(self.dictionaries)
-        
-        self.clipboard = QApplication.clipboard()
-
-        self.ui.lineEdit.returnPressed.connect(self.updateUi)
-
-        self.ui.comboBox.activated.connect(self.on_combo_change)
-        
-        self.ui.webView.settings().setUserStyleSheetUrl(
-                                               QUrl.fromLocalFile(':/lexi.css'))
-
-        self.ui.listView.clicked.connect(self.on_row_clicked)
-
-        self.clipboard.dataChanged.connect(self.get_from_clipboard)
-
-        self.manager.finished.connect(self.replyFinished)
-
-        self.loop = QEventLoop()
-
-        self.manager.finished.connect(self.loop.quit)
-
-        self.tagform = []
-
-    def updateUi(self):
-        # Check if input text is a word
-        if len(unicode(self.ui.lineEdit.text()).split()) <= 1:
-            self.formtype = "definition"
-            self.fetch("Lexi")
-            self.ui.comboBox.clear()
-            self.ui.comboBox.addItems(self.tagform)
-            self.formtype = "synonyme"
-            self.fetch("Syno")
-            self.formtype = "antonyme"
-            self.fetch("Anto")
-        else:
-            self.ui.lineEdit.setText("Veuillez entrer UN mot")
-
-    # Copy selected item in list to the clipboard
-    def on_row_clicked(self, qmodelindex):
-        item = qmodelindex.data(Qt.DisplayRole).toString()
-        self.clipboard.setText(item)
-#
-    def get_from_clipboard(self):
-        if self.ui.checkBox.isChecked():
-            self.ui.lineEdit.setText(unicode(self.clipboard.text()))
-            self.updateUi()
-#
-    def on_combo_change(self):
-        self.formtype = "definition"
-        self.fetch("Lexi")
-
-
-    def fetch(self, dico):
-        if dico == "Lexi":
-            if not self.ui.comboBox_2.currentIndex():
-                url = ("http://www.cnrtl.fr/definition/%s//%s" %
-                       (self.ui.lineEdit.text(), self.ui.comboBox.currentIndex()))
-            if self.ui.comboBox_2.currentIndex() > 0:
-                acad = unicode(self.ui.comboBox_2.currentText())
-                acadnum = filter(lambda x: x.isdigit(), acad)
-                acadnumf = "academie" + str(acadnum)
-                url = ("http://www.cnrtl.fr/definition/%s/%s//%s" %
-                       (acadnumf, self.ui.lineEdit.text(), self.ui.comboBox.currentIndex()))
-        if dico == "Syno":
-            url = ("http://www.cnrtl.fr/synonymie/%s" %
-                   (self.ui.lineEdit.text()))
-        if dico == "Anto":
-            url = ("http://www.cnrtl.fr/antonymie/%s"  %
-                   (self.ui.lineEdit.text()))
-        self.manager.get(QNetworkRequest(QUrl(url)))
-        self.loop.exec_()
-
-    def replyFinished(self, reply):
-        data = reply.readAll()
-        page = QWebPage()
-        page.mainFrame().setContent(data)
-        webpage = page.mainFrame().documentElement()
-        if self.formtype == "definition":
-            result = webpage.findAll("div#contentbox")
-            if not self.ui.comboBox_2.currentIndex():
-                result_to_remove = webpage.findAll("div.tlf_cvedette")
-            if 1 <= self.ui.comboBox_2.currentIndex() <= 3:
-                result_to_remove = webpage.findAll("span.tlf_cvedette")
-            string_to_remove = result_to_remove.first().toInnerXml()
-            final_page = result.first().toInnerXml()
-            resultf = final_page.replace(string_to_remove, '')
-            self.ui.webView.setHtml(resultf)
-
-            result_box = webpage.findFirst('div#vtoolbar')
-            result_test = result_box.findAll("a[href]")
-            self.tagform = []
-            i = 0
-            while i < len(result_test):
-                multdef_a = unicode(result_test.at(i).toPlainText())
-                # Delete digits in definition title
-                multdef_clean = ''.join(c for c in
-                    multdef_a if not c.isdigit())
-                self.tagform.append(multdef_clean)
-                i += 1
-        if self.formtype == "synonyme" or "antonyme":
-            result = webpage.findAll("td." + self.formtype[:4] + "_format")
-            tag = []
-            i = 0
-            while i < len(result):
-                tag.append(result.at(i).firstChild().toPlainText())
-                i += 1
-            model = ListModel(tag, self)
-            if self.formtype == "synonyme":
-                self.ui.listView.setModel(model)
-            if self.formtype == "antonyme":
-                self.ui.listView_2.setModel(model)
-
-class ListModel(QAbstractListModel):
-    def __init__(self, datain, parent=None, *args):
-        """ datain: a list where each item is a row
-        """
-        QAbstractListModel.__init__(self, parent, *args)
-        self.listdata = datain
-
-    def rowCount(self, parent=QModelIndex()):
-        return len(self.listdata)
-
-    def data(self, index, role):
-        if index.isValid() and role == Qt.DisplayRole:
-            return QVariant(self.listdata[index.row()])
-        else:
-            return QVariant()
-
-if __name__ == "__main__":
-    main()
diff --git a/kcnrtl/main.py b/kcnrtl/main.py
new file mode 100755 (executable)
index 0000000..b234a19
--- /dev/null
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+#-*- coding: utf-8 -*-
+
+########################################################################
+# This file is part of KCnrtl                                          #
+#                                                                      #
+#                                                                      #
+# Copyright (C) 2012 Bogdan Cordier                                    #
+#                                                                      #
+# KCnrtl is free software: you can redistribute it and/or modify       #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or    #
+# (at your option) any later version.                                  #
+#                                                                      #
+# KCnrtl is distributed in the hope that it will be useful,            #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of       #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        #
+# GNU General Public License for more details.                         #
+#                                                                      #
+# You should have received a copy of the GNU General Public License    #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.#
+########################################################################
+
+
+import argparse
+import sys
+
+def main():
+    cmd = argparse.ArgumentParser(description="Check for synonyms or antonyms",
+        prog='kcnrtl', usage='%(prog)s --help [options] word')
+
+    cmd.add_argument('word', default="", nargs='?',
+        help="The word to look for")
+
+    cmd.add_argument('-s', '--synonym', action="store_true",
+        help="Display synonyms of any word")
+
+    cmd.add_argument('-a', '--antonym', action="store_true",
+        help="Display antonyms of any word")
+
+    args = cmd.parse_args()
+
+    if 'word' in args:
+        wordset = args.word
+
+    if len(sys.argv) < 2:
+        from gui.gui import main
+        exit(main())
+    else:
+        from fetchparsebs import getSynoAnto
+        if args.synonym:
+            getSynoAnto(wordset, "synonymie")
+        if args.antonym:
+            getSynoAnto(wordset, "antonymie")
+
+if __name__ == '__main__':
+    main()
diff --git a/kcnrtl/models.py b/kcnrtl/models.py
new file mode 100644 (file)
index 0000000..c233407
--- /dev/null
@@ -0,0 +1,17 @@
+from PyQt4.QtCore import QModelIndex, QVariant, Qt, QAbstractListModel
+
+class ListModel(QAbstractListModel):
+    def __init__(self, datain, parent=None, *args):
+        """ datain: a list where each item is a row
+        """
+        QAbstractListModel.__init__(self, parent, *args)
+        self.listdata = datain
+
+    def rowCount(self, parent=QModelIndex()):
+        return len(self.listdata)
+
+    def data(self, index, role):
+        if index.isValid() and role == Qt.DisplayRole:
+            return QVariant(self.listdata[index.row()])
+        else:
+            return QVariant()
\ No newline at end of file
diff --git a/kcnrtl/resources/kcnrtl_icon.svg b/kcnrtl/resources/kcnrtl_icon.svg
new file mode 100644 (file)
index 0000000..5e3a7b4
--- /dev/null
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="55.989033"
+   height="55.990002"
+   id="svg2"
+   sodipodi:version="0.32"
+   inkscape:version="0.48.3.1 r9886"
+   sodipodi:docname="kcnrtl_icon.svg"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   inkscape:export-filename="/home/bogdan/Documents/Programmation/projets/kcnrtl/icons/hicolor/16x16/apps/kcnrtl.png"
+   inkscape:export-xdpi="25.719999"
+   inkscape:export-ydpi="25.719999"
+   version="1.0">
+  <defs
+     id="defs4">
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient3215">
+      <stop
+         style="stop-color:#ffd5d5;stop-opacity:1"
+         offset="0"
+         id="stop3217" />
+      <stop
+         style="stop-color:#ff0000;stop-opacity:1"
+         offset="1"
+         id="stop3219" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient3205">
+      <stop
+         style="stop-color:#552200;stop-opacity:1"
+         offset="0"
+         id="stop3207" />
+      <stop
+         style="stop-color:#aa4400;stop-opacity:1"
+         offset="1"
+         id="stop3209" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient3175">
+      <stop
+         style="stop-color:#ff9955;stop-opacity:1;"
+         offset="0"
+         id="stop3177" />
+      <stop
+         style="stop-color:#ffccaa;stop-opacity:1"
+         offset="1"
+         id="stop3179" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient3165">
+      <stop
+         style="stop-color:#808080;stop-opacity:1"
+         offset="0"
+         id="stop3167" />
+      <stop
+         style="stop-color:#e6e6e6;stop-opacity:1"
+         offset="1"
+         id="stop3169" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient3155">
+      <stop
+         style="stop-color:#552200;stop-opacity:1;"
+         offset="0"
+         id="stop3157" />
+      <stop
+         style="stop-color:#d45500;stop-opacity:1"
+         offset="1"
+         id="stop3159" />
+    </linearGradient>
+    <inkscape:perspective
+       sodipodi:type="inkscape:persp3d"
+       inkscape:vp_x="0 : 526.18109 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_z="744.09448 : 526.18109 : 1"
+       inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+       id="perspective10" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3155"
+       id="linearGradient3161"
+       x1="297.67511"
+       y1="178.7702"
+       x2="468.16641"
+       y2="437.44653"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3165"
+       id="linearGradient3171"
+       x1="417.34094"
+       y1="478.75085"
+       x2="505.17892"
+       y2="284.89575"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3175"
+       id="linearGradient3181"
+       x1="275.07126"
+       y1="176.01337"
+       x2="487.98697"
+       y2="291.72845"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3205"
+       id="linearGradient3211"
+       x1="238.73965"
+       y1="231.3362"
+       x2="460.21536"
+       y2="392.67606"
+       gradientUnits="userSpaceOnUse" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3215"
+       id="radialGradient3221"
+       cx="525.54358"
+       cy="407.12192"
+       fx="525.54358"
+       fy="407.12192"
+       r="75.093948"
+       gradientTransform="matrix(0.8448317,-0.1285871,0.1338057,0.8791184,6.1580993,113.75734)"
+       gradientUnits="userSpaceOnUse" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="2.2861619"
+     inkscape:cx="185.13784"
+     inkscape:cy="164.76537"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1680"
+     inkscape:window-height="1003"
+     inkscape:window-x="0"
+     inkscape:window-y="-3"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Capa 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0.1071386,-996.5428)">
+    <g
+       id="g3223"
+       transform="matrix(0.1511216,0,0,0.16972945,-33.368447,969.58714)">
+      <path
+         sodipodi:nodetypes="cccssc"
+         id="path2383"
+         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"
+         style="fill:url(#linearGradient3161);fill-opacity:1;fill-rule:evenodd;stroke:none"
+         inkscape:connector-curvature="0" />
+      <path
+         sodipodi:nodetypes="csccc"
+         id="path3163"
+         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"
+         style="fill:url(#linearGradient3171);fill-opacity:1;fill-rule:evenodd;stroke:none"
+         inkscape:connector-curvature="0" />
+      <path
+         sodipodi:nodetypes="ccccc"
+         id="path3173"
+         d="M 525.45663,284.89574 316.9491,176.89501 l -64.80045,0.44082 181.17674,127.8376 92.13124,-20.27769 z"
+         style="fill:url(#linearGradient3181);fill-opacity:1;fill-rule:evenodd;stroke:none"
+         inkscape:connector-curvature="0" />
+      <path
+         sodipodi:nodetypes="ccc"
+         id="path3183"
+         d="m 301.96123,176.45419 197.04624,113.73139 0.88164,0.44082"
+         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"
+         inkscape:connector-curvature="0" />
+      <path
+         sodipodi:nodetypes="ccc"
+         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"
+         d="m 283.25106,177.13173 189.55231,118.5804 0.88164,0.44082"
+         id="path3185"
+         inkscape:connector-curvature="0" />
+      <path
+         sodipodi:nodetypes="csccsscc"
+         id="path3187"
+         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"
+         style="fill:url(#linearGradient3211);fill-opacity:1;fill-rule:evenodd;stroke:none"
+         inkscape:connector-curvature="0" />
+      <path
+         sodipodi:nodetypes="ccssscccsssc"
+         id="path3213"
+         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"
+         style="fill:url(#radialGradient3221);fill-opacity:1;fill-rule:evenodd;stroke:none"
+         inkscape:connector-curvature="0" />
+    </g>
+  </g>
+</svg>
index acf3639..76bdf12 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ def read(fname):
     return open(os.path.join(os.path.dirname(__file__), fname)).read()
 
 setup(name='KCnrtl',
-      version='0.3b',
+      version='0.4b',
       description='Qt graphical client for the CNRTL french linguistic resources',
       license = "GPLv3", 
       author="Bogdan Cordier",
@@ -15,10 +15,12 @@ setup(name='KCnrtl',
       url="http://code.lm7.fr/p/kcnrtl/",
       download_url="http://code.lm7.fr/p/kcnrtl/downloads/", 
       packages=['kcnrtl'],
+      requires=['BeautifulSoup4','httplib2'],
       long_description=read('README'),
       classifiers=[
         "Development Status :: 4 - Beta",
-        "Environment :: X11 Applications :: Qt"
+        "Environment :: X11 Applications :: Qt",
+        "Environment :: Console",
         "Topic :: Utilities",
         "Natural Language :: French",
         "Intended Audience :: Education"