remove prints
[iramuteq] / dialog.py
index 93fd3e4..edefe21 100755 (executable)
--- a/dialog.py
+++ b/dialog.py
@@ -190,9 +190,9 @@ class FileOptionDialog(wx.Dialog):
             grid_sizer.Add(label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
             self.spin1 = wx.SpinCtrl(self, -1, '',size = wx.DefaultSize, min=1, max=500)
             grid_sizer.Add(self.spin1, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
-        sizer.Add(grid_sizer, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
+        sizer.Add(grid_sizer, 0, wx.GROW | wx.ALL, 5)
         line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
-        sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)
+        sizer.Add(line, 0, wx.GROW | wx.RIGHT | wx.TOP, 5)
         btnsizer = wx.StdDialogButtonSizer()
         if wx.Platform != "__WXMSW__":
             btn = wx.ContextHelpButton(self)
@@ -203,7 +203,7 @@ class FileOptionDialog(wx.Dialog):
         btn = wx.Button(self, wx.ID_CANCEL)
         btnsizer.AddButton(btn)
         btnsizer.Realize()
-        sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5)
+        sizer.Add(btnsizer, 0,  wx.ALIGN_CENTER_HORIZONTAL, 5)
         self.SetSizer(sizer)
         sizer.Fit(self)
 
@@ -559,11 +559,11 @@ memory for R""")
             parent.pref.set('iramuteq', 'libsvdc', 'false')
         parent.pref.set('iramuteq', 'libsvdc_path', self.fbb.GetValue())
         self.parent.pref.set('iramuteq', 'rmirror', self.mirror_value.GetValue())
-        file = open(parent.ConfigPath['preferences'], 'w')
+        file = open(parent.ConfigPath['preferences'], 'w', encoding='utf8')
         parent.pref.write(file)
         file.close()
         self.parent.PathPath.set('PATHS', 'rpath', self.Rpath_value.GetValue())
-        with open(self.parent.ConfigPath['path'], 'w') as f:
+        with open(self.parent.ConfigPath['path'], 'w', encoding='utf8') as f:
             self.parent.PathPath.write(f)
         self.Close()
 
@@ -1231,7 +1231,7 @@ class PrefSegProf(wx.Dialog) :
         bSizer1 = wx.BoxSizer( wx.VERTICAL )
         txt = _("Be carefull : computation of repeated segments profiles can be very long on large corpus")
         self.label = wx.StaticText( self, wx.ID_ANY, txt, wx.DefaultPosition, wx.DefaultSize, 0 )
-        bSizer1.Add( self.label, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5 )
+        bSizer1.Add( self.label, 0, wx.ALL, 5 )
         fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
         fgSizer1.SetFlexibleDirection( wx.BOTH )
         fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
@@ -1269,7 +1269,7 @@ class PrefSegProf(wx.Dialog) :
         btn_ok.SetDefault()
         btnsizer.AddButton(btn_ok)
         btnsizer.Realize()
-        bSizer1.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
+        bSizer1.Add(btnsizer, 0, wx.ALIGN_RIGHT, 5)
         self.SetSizer( bSizer1 )
         self.Layout()
         bSizer1.Fit( self )
@@ -2434,6 +2434,7 @@ class ConcordList(wx.html.HtmlListBox):
         self.concord = concord
         #self.script_status = dict()
         wx.html.HtmlListBox.__init__(self, parent, -1, size = (900, 600))
+        #self.SetFont(wx.Font(30,wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
         self.SetItemCount(len(concord))
         #self.Bind(wx.EVT_LISTBOX, self.RefreshMe)
         #self.Bind(wx.EVT_LISTBOX_DCLICK, self.Download)
@@ -2455,6 +2456,7 @@ class message(wx.Frame):
         #self.HtmlPage=wx.html.HtmlWindow(self, -1)
         self.panel = wx.Panel(self, wx.ID_ANY)
         self.HtmlPage = ConcordList(self.panel, items)
+        #self.HtmlPage.SetFonts("","",self.ira.fontsize)
         #self.HtmlPage.SetMinSize( size )
         #if "gtk2" in wx.PlatformInfo:
         #    self.HtmlPage.SetStandardFonts()
@@ -2499,7 +2501,7 @@ class message(wx.Frame):
         self.html = '<br>'.join([self.items[i] for i in range(0,len(self.items))])
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()
-            with open(path, 'w') as f :
+            with open(path, 'w', encoding='utf8') as f :
                 f.write(self.html)
 
     def OnLink(self, evt):
@@ -3024,7 +3026,7 @@ class BarFrame :
                 parametres['tree'] = tree
             txt = barplot(table, parametres)
             tmpscript = tempfile.mktemp(dir=ira.TEMPDIR)
-            with open(tmpscript,'w') as f :
+            with open(tmpscript,'w', encoding='utf8') as f :
                 f.write(txt)
             exec_rcode(ira.RPath, tmpscript, wait = True)
             win = ImageViewer(ira, parametres, _("Graphic"), size=(700, 500))
@@ -3311,12 +3313,12 @@ class MergeClusterFrame ( wx.Dialog ):
                 for analyse in corpus['analyses'] :
                     if analyse['type'] == 'alceste' :
                         if corpus['uuid'] not in self.intree :
-                            child = self.tree.Append(self.tree.root, corpus['corpus_name'])
+                            child = self.tree.AppendItem(self.tree.root, corpus['corpus_name'])
                             self.tree.SetItemImage(child, self.ild['corpus'], wx.TreeItemIcon_Normal)
                             self.tree.SetItemImage(child, self.ild['corpus'], wx.TreeItemIcon_Expanded)
                             self.tree.SetPyData(child, corpus)
                             self.intree[corpus['uuid']] = corpus
-                        last = self.tree.Append(child, analyse['name'])
+                        last = self.tree.AppendItem(child, analyse['name'])
                         self.tree.SetItemImage(last, self.ild['reinert'], wx.TreeItemIcon_Normal)
                         self.tree.SetItemImage(last, self.ild['reinert'], wx.TreeItemIcon_Expanded)
 
@@ -3325,7 +3327,7 @@ class MergeClusterFrame ( wx.Dialog ):
                             parametres = DoConf(analyse['ira']).getoptions()
                             clnb = int(parametres['clnb'])
                             for i in range(clnb) :
-                                cl = self.tree.Append(last, 'classe %i' % (i+1))
+                                cl = self.tree.AppendItem(last, 'classe %i' % (i+1))
                                 self.tree.SetItemImage(cl, self.ild['wordcloud'], wx.TreeItemIcon_Normal)
                                 self.tree.SetItemImage(cl, self.ild['wordcloud'], wx.TreeItemIcon_Expanded)
                                 self.tree.SetPyData(cl, {'type' : 'cluster', 'analyse': analyse['uuid'], 'number': i+1, 'corpus': analyse['corpus'], 'ira':analyse['ira']})