from mac
authorpierre <pierre@MacBook-Pro-de-pierre-ratinaud.local>
Sun, 3 Feb 2013 23:51:51 +0000 (00:51 +0100)
committerpierre <pierre@MacBook-Pro-de-pierre-ratinaud.local>
Sun, 3 Feb 2013 23:51:51 +0000 (00:51 +0100)
KeyFrame.py
dialog.py
guifunct.py
iramuteq.py
openanalyse.py
setup.py
textwordcloud.py

index ffa625b..ddaecf2 100755 (executable)
@@ -66,7 +66,7 @@ class AlcOptFrame(wx.Dialog):
             self.listcle.append(cle)
             
 
             self.listcle.append(cle)
             
 
-        self.button_val = wx.Button(self,wx.ID_APPLY)
+        self.button_val = wx.Button(self,wx.ID_OK)
         
         for button in self.listbutton :
             self.Bind(wx.EVT_BUTTON,self.OnShowList,button)
         
         for button in self.listbutton :
             self.Bind(wx.EVT_BUTTON,self.OnShowList,button)
@@ -135,7 +135,8 @@ class AlcOptFrame(wx.Dialog):
         for i in range(0,len(self.listlabel)):
             self.keys[self.listcle[i]] = self.listspin[i].GetValue()
         DoConf().makeoptions(['KEY'], [self.keys], outfile = self.parent.parent.ira.ConfigPath['key'])
         for i in range(0,len(self.listlabel)):
             self.keys[self.listcle[i]] = self.listspin[i].GetValue()
         DoConf().makeoptions(['KEY'], [self.keys], outfile = self.parent.parent.ira.ConfigPath['key'])
-        self.Destroy()
+        self.Disable()
+        return
 
 
 class ListView(wx.Dialog):
 
 
 class ListView(wx.Dialog):
index 78352ec..e21c0f6 100755 (executable)
--- a/dialog.py
+++ b/dialog.py
@@ -84,7 +84,10 @@ class FileOptionDialog(wx.Dialog):
             if locale.getpreferredencoding().lower() == 'mac-roman' :
                 enc = self.le.index('macroman')
             else :
             if locale.getpreferredencoding().lower() == 'mac-roman' :
                 enc = self.le.index('macroman')
             else :
-                enc = self.le.index(locale.getpreferredencoding().lower())
+                try :
+                    enc = self.le.index(sys.getdefaultencoding().lower())
+                except ValueError:
+                    enc = self.le.index('utf-8')
             self.list_encodages.SetSelection(enc)
             grid_sizer.Add(self.list_encodages, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
         elif sheet :
             self.list_encodages.SetSelection(enc)
             grid_sizer.Add(self.list_encodages, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
         elif sheet :
@@ -1148,7 +1151,9 @@ class StatDialog(wx.Dialog):
     def OnKeys(self, evt):
         dial = AlcOptFrame(self, self.parent.parent)
         dial.CenterOnParent()
     def OnKeys(self, evt):
         dial = AlcOptFrame(self, self.parent.parent)
         dial.CenterOnParent()
-        val = dial.ShowModal()
+        dial.ShowModal()
+       dial.Destroy()
+        print 'zerazer'
 
 class LexDialog( wx.Dialog ):
     
 
 class LexDialog( wx.Dialog ):
     
@@ -1694,13 +1699,13 @@ def UnSelectList(liste) :
 
 
 class OptLexi(wx.Dialog):
 
 
 class OptLexi(wx.Dialog):
-    def __init__(self, *args, **kwds):
+    def __init__(self, parent, force_chi = False):
         # begin wxGlade: MyDialog.__init__
         # begin wxGlade: MyDialog.__init__
-        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
-        wx.Dialog.__init__(self, *args, **kwds)
-        self.param = kwds
+        #kwds["style"] = wx.DEFAULT_DIALOG_STYLE
+        wx.Dialog.__init__(self, parent, style = wx.DEFAULT_DIALOG_STYLE)
         self.listet = None
         self.variables = None
         self.listet = None
         self.variables = None
+        self.force_chi = force_chi
         #self.labellem =  wx.StaticText(self, -1, u"Lemmatisation : ")
         #self.checklem = wx.CheckBox(self, -1)
         self.label_var =  wx.StaticText(self, -1, u"Sélection par :")
         #self.labellem =  wx.StaticText(self, -1, u"Lemmatisation : ")
         #self.checklem = wx.CheckBox(self, -1)
         self.label_var =  wx.StaticText(self, -1, u"Sélection par :")
@@ -1709,13 +1714,13 @@ class OptLexi(wx.Dialog):
         self.list_box_1 = wx.ListBox(self, -1, choices=[],  size = wx.Size( 150,200 ), style=wx.LB_EXTENDED | wx.LB_HSCROLL)
         self.button_2 = wx.Button(self, wx.ID_CANCEL, "")
         self.button_1 = wx.Button(self, wx.ID_OK, "")
         self.list_box_1 = wx.ListBox(self, -1, choices=[],  size = wx.Size( 150,200 ), style=wx.LB_EXTENDED | wx.LB_HSCROLL)
         self.button_2 = wx.Button(self, wx.ID_CANCEL, "")
         self.button_1 = wx.Button(self, wx.ID_OK, "")
-        if not kwds.get('force_chi', False) :
+        if not self.force_chi :
             indices = [u'loi hypergéométique', u'chi2']
         else :
             indices = [u'chi2']
         self.label_indice =  wx.StaticText(self, -1, u"indice")
         self.choice_indice =  wx.Choice(self, -1, (100,50), choices = indices)
             indices = [u'loi hypergéométique', u'chi2']
         else :
             indices = [u'chi2']
         self.label_indice =  wx.StaticText(self, -1, u"indice")
         self.choice_indice =  wx.Choice(self, -1, (100,50), choices = indices)
-        if not kwds.get('force_chi', False) :
+        if not self.force_chi :
             self.label = wx.StaticText(self, -1, u"effectif minimum")
             self.spin = wx.SpinCtrl(self, -1, min = 1, max = 10000)
         self.Bind(wx.EVT_CHOICE, self.onselect, self.choice)
             self.label = wx.StaticText(self, -1, u"effectif minimum")
             self.spin = wx.SpinCtrl(self, -1, min = 1, max = 10000)
         self.Bind(wx.EVT_CHOICE, self.onselect, self.choice)
@@ -1726,7 +1731,8 @@ class OptLexi(wx.Dialog):
     def __set_properties(self):
         # begin wxGlade: MyDialog.__set_properties
         self.SetTitle("Choix des variables")
     def __set_properties(self):
         # begin wxGlade: MyDialog.__set_properties
         self.SetTitle("Choix des variables")
-        self.spin.SetValue(10)
+        if not self.force_chi :
+            self.spin.SetValue(10)
         self.choice.SetSelection(0)
         #self.SetMinSize(wx.Size(300, 400))
         # end wxGlade
         self.choice.SetSelection(0)
         #self.SetMinSize(wx.Size(300, 400))
         # end wxGlade
@@ -1746,7 +1752,7 @@ class OptLexi(wx.Dialog):
         sizer_3.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
         sizer_2.Add(self.label_indice, 0, wx.ALIGN_CENTER_VERTICAL, 3)
         sizer_2.Add(self.choice_indice, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
         sizer_3.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
         sizer_2.Add(self.label_indice, 0, wx.ALIGN_CENTER_VERTICAL, 3)
         sizer_2.Add(self.choice_indice, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
-        if not self.param.get('force_chi', False) :
+        if not self.force_chi :
             sizer_2.Add(self.label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
             sizer_2.Add(self.spin, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
         sizer_1.Add(sizer_2, 0, wx.ALIGN_CENTER_HORIZONTAL, 3)
             sizer_2.Add(self.label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3)
             sizer_2.Add(self.spin, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
         sizer_1.Add(sizer_2, 0, wx.ALIGN_CENTER_HORIZONTAL, 3)
@@ -2401,7 +2407,10 @@ class CorpusPref ( wx.Dialog ):
         if  locale.getpreferredencoding().lower() == 'mac-roman' :
             enc = self.encodages.index('macroman')
         else :
         if  locale.getpreferredencoding().lower() == 'mac-roman' :
             enc = self.encodages.index('macroman')
         else :
-            enc = self.encodages.index(locale.getpreferredencoding().lower())
+            try :
+                enc = self.encodages.index(locale.getpreferredencoding().lower())
+            except ValueError :
+                enc = self.encodages.index('utf-8')
         self.encodage_choices.SetSelection(enc)
         self.lang_choices.SetSelection(0)
         self.repout_choices.SetValue(parametres['pathout'])
         self.encodage_choices.SetSelection(enc)
         self.lang_choices.SetSelection(0)
         self.repout_choices.SetValue(parametres['pathout'])
index 31f8c20..8ee4879 100644 (file)
@@ -877,7 +877,7 @@ class PrepSimi :
             if 'bystar' in self.parametres :
                 if self.dial.check_bystar.GetValue() :
                     variables = treat_var_mod(self.parametres['stars'])
             if 'bystar' in self.parametres :
                 if self.dial.check_bystar.GetValue() :
                     variables = treat_var_mod(self.parametres['stars'])
-                    vardial = dialog.OptLexi(parent, **{'force_chi' : True}
+                    vardial = dialog.OptLexi(parent, force_chi = True
                     vardial.listet = self.parametres['stars']
                     vardial.variables = [v for v in variables]
                     for et in vardial.variables :
                     vardial.listet = self.parametres['stars']
                     vardial.variables = [v for v in variables]
                     for et in vardial.variables :
index 9fe152e..90212a7 100644 (file)
@@ -508,7 +508,7 @@ vous devez signaler le chemin de l'éxecutable de R dans les préférences."""
     def OnVerif(self, evt) :
         pack = CheckRPackages(self)
         if pack :
     def OnVerif(self, evt) :
         pack = CheckRPackages(self)
         if pack :
-            dlg = wx.MessageDialog(self, u"Installation OK", u"Installation", wx.OK | wx.NO_DEFAULT | wx.ICON_INFORMATION)
+            dlg = wx.MessageDialog(self, u"Installation OK", u"Installation", wx.OK | wx.ICON_INFORMATION)
             dlg.CenterOnParent()
             if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
                  evt.Veto()
             dlg.CenterOnParent()
             if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
                  evt.Veto()
index 38ea023..32702f7 100644 (file)
@@ -79,11 +79,11 @@ class OpenAnalyse():
             log.info('corpus is already opened')
             self.doopen(self.parent.history.openedcorpus[self.conf['uuid']])
         else :
             log.info('corpus is already opened')
             self.doopen(self.parent.history.openedcorpus[self.conf['uuid']])
         else :
-            dial = progressbar(self, 2)
-            dial.Update(1, 'Ouverture du corpus')
+            #dial = progressbar(2)
+            #dial.Update(1, 'Ouverture du corpus')
             corpus = Corpus(self, parametres = self.conf, read = self.parent.history.history[self.parent.history.ordercorpus[self.conf['uuid']]]['ira'])
             corpus = Corpus(self, parametres = self.conf, read = self.parent.history.history[self.parent.history.ordercorpus[self.conf['uuid']]]['ira'])
-            dial.Update(2, 'Fini')
-            dial.Destroy()
+            #dial.Update(2, 'Fini')
+            #dial.Destroy()
             self.parent.history.openedcorpus[self.conf['uuid']] = corpus
             self.opencorpus_analyses()
             self.doopen(corpus)
             self.parent.history.openedcorpus[self.conf['uuid']] = corpus
             self.opencorpus_analyses()
             self.doopen(corpus)
index 077ebd0..b91f510 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ Usage:
 
 from setuptools import setup
 import os
 
 from setuptools import setup
 import os
-DATA_FILES=['configuration','Rscripts','images','dictionnaires','locale', 'Rlib','son_fin.wav']
+DATA_FILES=['configuration','Rscripts','images','dictionnaires','locale', 'Rlib','son_fin.wav', 'gpl-2.0.txt', 'gpl-2.0-fr.txt']
 APP = ['iramuteq.py']
 OPTIONS = {'argv_emulation': True,
        'iconfile':('images/iraicone.icns')}
 APP = ['iramuteq.py']
 OPTIONS = {'argv_emulation': True,
        'iconfile':('images/iraicone.icns')}
index b220d9e..c7ca3f1 100644 (file)
@@ -25,20 +25,23 @@ class WordCloud(AnalyseText):
         self.parametres['type'] = 'wordcloud'
         #FIXME
         limit = 3
         self.parametres['type'] = 'wordcloud'
         #FIXME
         limit = 3
-        self.make_option()
-        if self.parametres['mode'] == 2 :
-            self.actives = self.corpus.make_actives_limit(limit, 1)
-            self.actives += self.corpus.make_actives_limit(limit, 2)
-        elif self.parametres['mode'] == 0 :
-            self.actives = self.corpus.make_actives_limit(limit, 1)
-        elif self.parametres['mode'] == 1 :
-            self.actives = self.corpus.make_actives_limit(limit, 2)
-        dictcol = dict([[i, [act, self.corpus.getlemeff(act)]] for i, act in enumerate(self.actives)]) 
-        SelectColumn(self.ira, dictcol, self.actives, self.pathout['selected.csv'], dlg = True)
-        self.make_wordcloud()
-        script = WordCloudRScript(self)
-        script.make_script()
-        self.doR(script.scriptout, dlg = self.dlg, message = 'R...')
+        res = self.make_option()
+        if res == wx.ID_OK :
+            if self.parametres['mode'] == 2 :
+                self.actives = self.corpus.make_actives_limit(limit, 1)
+                self.actives += self.corpus.make_actives_limit(limit, 2)
+            elif self.parametres['mode'] == 0 :
+                self.actives = self.corpus.make_actives_limit(limit, 1)
+            elif self.parametres['mode'] == 1 :
+                self.actives = self.corpus.make_actives_limit(limit, 2)
+            dictcol = dict([[i, [act, self.corpus.getlemeff(act)]] for i, act in enumerate(self.actives)]) 
+            SelectColumn(self.ira, dictcol, self.actives, self.pathout['selected.csv'], dlg = True)
+            self.make_wordcloud()
+            script = WordCloudRScript(self)
+            script.make_script()
+            self.doR(script.scriptout, dlg = self.dlg, message = 'R...')
+        else :
+            return 'NOK'
     
     def make_option(self) :
         dial = PrefWordCloud(self.ira)
     
     def make_option(self) :
         dial = PrefWordCloud(self.ira)
@@ -59,6 +62,7 @@ class WordCloud(AnalyseText):
                 nb += 1
             self.parametres['graphout'] = outgraph + str(nb) + '.png'
         dial.Destroy()
                 nb += 1
             self.parametres['graphout'] = outgraph + str(nb) + '.png'
         dial.Destroy()
+        return res
 
 
     def make_wordcloud(self) :
 
 
     def make_wordcloud(self) :