...
[iramuteq] / layout.py
index f22ef5f..0d4cac8 100644 (file)
--- a/layout.py
+++ b/layout.py
@@ -548,7 +548,7 @@ class OpenCHDS():
             dial.Destroy()
             self.corpus.get_stat_by_cluster(fileout)
             msg = u"Fini !"
-            dlg = wx.MessageDialog(self.parent, msg, _(u"Stat by cluster").decode('utf8'), wx.OK | wx.NO_DEFAULT | wx.ICON_INFORMATION)
+            dlg = wx.MessageDialog(self.parent, msg, _(u"Stat by cluster").decode('utf8'), wx.OK | wx.ICON_INFORMATION)
             dlg.CenterOnParent()
             if dlg.ShowModal() == wx.ID_OK :
                 dlg.Destroy()
@@ -569,33 +569,33 @@ def PrintRapport(self, corpus, parametres, istxt = True):
 """ % datetime.datetime.now().ctime()
     if istxt :
         totocc = corpus.gettotocc()
-        txt += ': '.join([_(u'Number of texts'),  u'%i%s' % (corpus.getucinb(), sep)])
-        txt += ': '.join([_(u'Number of text segments'),  '%i%s' % (corpus.getucenb(), sep)])
-        txt += ': '.join([_(u'Number of forms'), '%i%s' % (len(corpus.formes), sep)])
-        txt += ': '.join([_(u'Number of occurrences'), '%i%s' % (totocc, sep)])
+        txt += ': '.join([_(u'Number of texts').decode('utf8'),  u'%i%s' % (corpus.getucinb(), sep)])
+        txt += ': '.join([_(u'Number of text segments').decode('utf8'),  '%i%s' % (corpus.getucenb(), sep)])
+        txt += ': '.join([_(u'Number of forms').decode('utf8'), '%i%s' % (len(corpus.formes), sep)])
+        txt += ': '.join([_(u'Number of occurrences').decode('utf8'), '%i%s' % (totocc, sep)])
         #txt += u'moyenne d\'occurrences par forme: %f%s' % (float(totocc) / float(len(self.corpus.formes)), sep)
-        txt += ': '.join([_(u'Number of lemmas'), '%i%s' % (len(corpus.lems), sep)])
-        txt += ': '.join([_(u'Number of active forms'), '%i%s' % (corpus.getactivesnb(1), sep)])
-        txt += ': '.join([_(u'Number of supplementary forms'), '%i%s' % (corpus.getactivesnb(2), sep)])
-        txt += ' >= '.join([_(u'Number of active forms with a frequency'), '%i: %i%s' % (parametres['eff_min_forme'], parametres['nbactives'], sep)])
-        txt += ': '.join([_(u'Mean of forms by segment'), '%f%s' % (float(totocc) / float(corpus.getucenb()), sep)])
+        txt += ': '.join([_(u'Number of lemmas').decode('utf8'), '%i%s' % (len(corpus.lems), sep)])
+        txt += ': '.join([_(u'Number of active forms').decode('utf8'), '%i%s' % (corpus.getactivesnb(1), sep)])
+        txt += ': '.join([_(u'Number of supplementary forms').decode('utf8'), '%i%s' % (corpus.getactivesnb(2), sep)])
+        txt += ' >= '.join([_(u'Number of active forms with a frequency').decode('utf8'), '%i: %i%s' % (parametres['eff_min_forme'], parametres['nbactives'], sep)])
+        txt += ': '.join([_(u'Mean of forms by segment').decode('utf8'), '%f%s' % (float(totocc) / float(corpus.getucenb()), sep)])
         if 'tailleuc1' in parametres :
             if parametres['classif_mode'] == 0 :
-                txt += ': '.join([_(u'Size of rst1 / rst2'), '%i / %i - %i / %i%s' % (parametres['tailleuc1'], parametres['tailleuc2'], parametres['lenuc1'], parametres['lenuc2'], sep)])
+                txt += ': '.join([_(u'Size of rst1 / rst2').decode('utf8'), '%i / %i - %i / %i%s' % (parametres['tailleuc1'], parametres['tailleuc2'], parametres['lenuc1'], parametres['lenuc2'], sep)])
     else :
         self.Ucenb = self.nbind
-        txt += ': '.join([_(u'Number of lines'), '%i%s' % (self.nbind, sep)])
-        txt += ': '.join([_(u'Number of clusters'), '%i%s' % (self.clnb, sep)])
+        txt += ': '.join([_(u'Number of lines').decode('utf8'), '%i%s' % (self.nbind, sep)])
+        txt += ': '.join([_(u'Number of clusters').decode('utf8'), '%i%s' % (self.clnb, sep)])
     if istxt :
-        txt += ': '.join([_(u'Number of clusters'), '%i%s' % (parametres['clnb'], sep)])
+        txt += ': '.join([_(u'Number of clusters').decode('utf8'), '%i%s' % (parametres['clnb'], sep)])
         if parametres['classif_mode'] == 0 or parametres['classif_mode'] == 1 :
-            txt += ' '.join(['%i' % sum([len(cl) for cl in corpus.lc]), u'segments classified on', '%i (%.2f%%)%s' % (corpus.getucenb(), (float(sum([len(cl) for cl in corpus.lc])) / float(corpus.getucenb())) * 100, sep)])
+            txt += ' '.join(['%i' % sum([len(cl) for cl in corpus.lc]), _(u'segments classified on').decode('utf8'), '%i (%.2f%%)%s' % (corpus.getucenb(), (float(sum([len(cl) for cl in corpus.lc])) / float(corpus.getucenb())) * 100, sep)])
         elif self.parametres['classif_mode'] == 2 :
-            txt += ' '.join([u'%i' % sum([len(cl) for cl in corpus.lc]), 'texts classified on', '%i (%.2f%%)%s' % (corpus.getucinb(), (float(sum([len(cl) for cl in corpus.lc]))) / float(corpus.getucinb()) * 100, sep)])
+            txt += ' '.join([u'%i' % sum([len(cl) for cl in corpus.lc]), _(u'texts classified on').decode('utf8'), '%i (%.2f%%)%s' % (corpus.getucinb(), (float(sum([len(cl) for cl in corpus.lc]))) / float(corpus.getucinb()) * 100, sep)])
     else :
-        txt += ' '.join(['%i' % self.ucecla, 'line classified on', '%i (%.2f%%)%s' % (self.Ucenb, (float(self.ucecla) / float(self.Ucenb)) * 100, sep)])
+        txt += ' '.join(['%i' % self.ucecla, _(u'line classified on').decode('utf8'), '%i (%.2f%%)%s' % (self.Ucenb, (float(self.ucecla) / float(self.Ucenb)) * 100, sep)])
  
-    txt += ''.join([sep, u'###########################', sep, _(u'time'), ' : %s' % parametres.get('time', ''), sep, u'###########################', sep])
+    txt += ''.join([sep, u'###########################', sep, _(u'time').decode('utf8'), ' : %s' % parametres.get('time', ''), sep, u'###########################', sep])
 
     with open(self.pathout['pre_rapport'], 'w') as f :
         f.write(txt)
@@ -870,10 +870,11 @@ class GraphPanelDendro(wx.Panel):
         self.param['width'] = dial.m_spinCtrl2.GetValue()
         self.param['height'] = dial.m_spinCtrl1.GetValue()
         self.param['type_dendro'] = dial.m_choice1.GetSelection()
-        self.param['color_nb'] = dial.m_radioBox1.GetSelection()
-        self.param['taille_classe'] = dial.m_checkBox1.GetValue()
-        self.param['type_tclasse'] = dial.m_radioBox2.GetSelection()
         self.param['svg'] = dial.choice_format.GetSelection()
+        if self.param['typedendro'] == 'classique' :
+            self.param['color_nb'] = dial.m_radioBox1.GetSelection()
+            self.param['taille_classe'] = dial.m_checkBox1.GetValue()
+            self.param['type_tclasse'] = dial.m_radioBox2.GetSelection()
 
     def make_dendro(self, dendro = 'simple') :
         if self.param['svg'] :
@@ -961,6 +962,7 @@ class GraphPanelDendro(wx.Panel):
 
 
     def ondendro(self, evt):
+        self.param['typedendro'] = 'classique'
         dial = PrefDendro(self.ira, self.param)
         val = dial.ShowModal()
         if val == wx.ID_OK :
@@ -968,6 +970,7 @@ class GraphPanelDendro(wx.Panel):
             self.make_dendro()
     
     def ondendrotexte(self, evt):
+        self.param['typedendro'] = 'texte'
         dial = PrefDendro(self.ira, self.param)
         val = dial.ShowModal()
         if val == wx.ID_OK :
@@ -975,6 +978,7 @@ class GraphPanelDendro(wx.Panel):
             self.make_dendro(dendro = 'texte')
 
     def ondendrocloud(self, evt):
+        self.param['typedendro'] = 'cloud'
         dial = PrefDendro(self.ira, self.param)
         val = dial.ShowModal()
         if val == wx.ID_OK :
@@ -1210,7 +1214,7 @@ class SimiLayout(DefaultTextLayout) :
         E(graph)$weight <- graph.simi$we.width
         write.graph(graph, fileout, format = 'graphml')
         #saveAsGEXF(graph, filepath = fileout)
-        """ % (self.pathout['RData.RData'], self.parent.RscriptsPath['simi'], fileout)
+        """ % (ffr(self.pathout['RData.RData']), ffr(self.parent.RscriptsPath['simi']), fileout)
         filetmp = tempfile.mktemp()
         with open(filetmp, 'w') as f :
             f.write(txt)
@@ -1453,7 +1457,7 @@ class SimiMatLayout(DefaultMatLayout) :
         E(graph)$weight <- graph.simi$we.width
         write.graph(graph, fileout, format = 'graphml')
         #saveAsGEXF(graph, filepath = fileout)
-        """ % (self.pathout['RData.RData'], self.parent.RscriptsPath['simi'], fileout)
+        """ % (ffr(self.pathout['RData.RData']), ffr(self.parent.RscriptsPath['simi']), fileout)
         filetmp = tempfile.mktemp()
         with open(filetmp, 'w') as f :
             f.write(txt)