From: pierre Date: Tue, 19 Feb 2013 19:48:12 +0000 (+0100) Subject: locale under Mac OS X X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=commitdiff_plain;h=e033f9e84abb3c12d92f1580425877aa58e9af30 locale under Mac OS X --- diff --git a/PrintRScript.py b/PrintRScript.py index fd86a2c..6c102a0 100644 --- a/PrintRScript.py +++ b/PrintRScript.py @@ -545,6 +545,7 @@ def barplot(table, rownames, colnames, rgraph, tmpgraph, intxt = False) : # height = 400 rownames = 'c("' + '","'.join(rownames) + '")' colnames = 'c("' + '","'.join(colnames) + '")' + if not intxt : #FIXME txt = """ diff --git a/ProfList.py b/ProfList.py index 59bd0c7..7ac42c5 100644 --- a/ProfList.py +++ b/ProfList.py @@ -576,6 +576,12 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col nbcl = len(title) nbwords = len(words) txt = barplot(tableout, words, title, self.Source.parent.RscriptsPath['Rgraph'], tmpgraph) + #print 'ATTENTION TEST R' + #txt = """ + #sink('/Users/pierre/Desktop/qdfqsdfqsdfqsdf.txt') + #Sys.getlocale() + #sink() + #""" tmpscript = tempfile.mktemp(dir=self.Source.parent.TEMPDIR) file = open(tmpscript,'w') file.write(txt) diff --git a/checkinstall.py b/checkinstall.py index 93aa358..8fbf6d7 100644 --- a/checkinstall.py +++ b/checkinstall.py @@ -177,7 +177,7 @@ Sans ces bibliothèques, IRamuteq ne fonctionnera pas. - ou laisser IRamuteq les installer automatiquement en cliquant sur VALIDER . Les bibliothèques seront téléchargées depuis le site miroir de R %s. """ % (txt, self.pref.get('iramuteq','rmirror')) - dial = wx.MessageDialog(self, msg, u"Installation incomplète", wx.OK | wx.CANCEL | wx.NO_DEFAULT | wx.ICON_WARNING) + dial = wx.MessageDialog(self, msg, u"Installation incomplète", wx.OK | wx.CANCEL | wx.ICON_WARNING) dial.CenterOnParent() val = dial.ShowModal() if val == wx.ID_OK : diff --git a/dialog.py b/dialog.py index 86a3780..2e47598 100755 --- a/dialog.py +++ b/dialog.py @@ -1205,18 +1205,19 @@ class LexDialog( wx.Dialog ): class PrefUCECarac(wx.Dialog): def __init__(self, parent, *args, **kwds): kwds['style'] = wx.DEFAULT_DIALOG_STYLE - kwds['title'] = u"UCE caractéristiques" + kwds['title'] = u"Segments de texte caractéristiques" wx.Dialog.__init__(self, *args, **kwds) self.parent = parent first = wx.BoxSizer(wx.VERTICAL) sizer = wx.FlexGridSizer(0,2,0,0) self.label_type = wx.StaticText(self, -1, u"Score de classement") sizer.Add(self.label_type, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5) - self.radio_type = wx.RadioBox(self, -1, u"", choices=[u'absolu (somme des chi2 des formes marquées de l\'UCE)', u'relatif (moyenne des chi2 des formes marquées de l\'UCE)'], majorDimension=0, style=wx.RA_SPECIFY_ROWS) + self.radio_type = wx.RadioBox(self, -1, u"", choices=[u'absolu (somme des chi2 des formes marquées du segment)', u'relatif (moyenne des chi2 des formes marquées du segment)'], majorDimension=0, style=wx.RA_SPECIFY_ROWS) sizer.Add(self.radio_type, 0, wx.ALIGN_RIGHT, 5) - self.txt_eff = wx.StaticText(self, -1, u"Nombre d\'UCE maximum") + self.txt_eff = wx.StaticText(self, -1, u"Nombre maximum de segments de texte") sizer.Add(self.txt_eff, 0, wx.ALIGN_CENTRE, 5) self.spin_eff = wx.SpinCtrl(self, -1, '', size = (100, 30), min = 1, max = 100000, initial = 50) + self.spin_eff.SetValue(50) sizer.Add(self.spin_eff, 0, wx.ALIGN_CENTRE|wx.ALL, 5) first.Add(sizer, 0, wx.ALL, 5) btnsizer = wx.StdDialogButtonSizer() diff --git a/functions.py b/functions.py index 733eff9..e399776 100644 --- a/functions.py +++ b/functions.py @@ -519,7 +519,6 @@ def exec_rcode(rpath, rcode, wait = True, graph = False): if sys.platform == 'darwin' : try : macversion = platform.mac_ver()[0].split('.') - print macversion if int(macversion[1]) < 5 : needX11 = True else : @@ -528,18 +527,21 @@ def exec_rcode(rpath, rcode, wait = True, graph = False): needX11 = False rpath = rpath.replace('\\','\\\\') + env = os.environ.copy() + if sys.platform == 'darwin' and 'LC_ALL' not in env: + env['LC_ALL'] = 'en_US.UTF-8' if not graph : if wait : if sys.platform == 'win32': error = call(["%s" % rpath, "--vanilla","--slave","-f", "%s" % rcode]) else : - error = call([rpath, '--vanilla','--slave',"-f %s" % rcode, "--encoding=UTF-8"]) + error = call([rpath, '--slave', "--vanilla", "-f %s" % rcode, "--encoding=UTF-8"], env = env) return error else : if sys.platform == 'win32': pid = Popen(["%s" % rpath, '--vanilla','--slave','-f', "%s" % rcode]) else : - pid = Popen([rpath, '--vanilla','--slave',"-f %s" % rcode, "--encoding=UTF-8"], stderr = PIPE) + pid = Popen([rpath, '--slave', "--vanilla", "-f %s" % rcode, "--encoding=UTF-8"], stderr = PIPE, env = env) return pid else : if wait : @@ -547,18 +549,18 @@ def exec_rcode(rpath, rcode, wait = True, graph = False): error = call(["%s" % rpath, '--vanilla','--slave','-f', "%s" % rcode]) elif sys.platform == 'darwin' and needX11: os.environ['DISPLAY'] = ':0.0' - error = call([rpath, '--vanilla','--slave',"-f %s" % rcode, "--encoding=UTF-8"]) + error = call([rpath, '--vanilla','--slave',"-f %s" % rcode, "--encoding=UTF-8"], env = env) else : - error = call([rpath, '--vanilla','--slave',"-f %s" % rcode, "--encoding=UTF-8"]) + error = call([rpath, '--vanilla','--slave',"-f %s" % rcode, "--encoding=UTF-8"], env = env) return error else : if sys.platform == 'win32': pid = Popen(["%s" % rpath, '--vanilla','--slave','-f', "%s" % rcode]) elif sys.platform == 'darwin' and needX11: os.environ['DISPLAY'] = ':0.0' - pid = Popen([rpath, '--vanilla','--slave',"-f %s" % rcode, "--encoding=UTF-8"], stderr = PIPE) + pid = Popen([rpath, '--vanilla','--slave',"-f %s" % rcode, "--encoding=UTF-8"], stderr = PIPE, env = env) else : - pid = Popen([rpath, '--vanilla','--slave',"-f %s" % rcode, "--encoding=UTF-8"], stderr = PIPE) + pid = Popen([rpath, '--vanilla','--slave',"-f %s" % rcode, "--encoding=UTF-8"], stderr = PIPE, env = env) return pid def check_Rresult(parent, pid) : diff --git a/iramuteq.py b/iramuteq.py index f33bc90..1112acc 100644 --- a/iramuteq.py +++ b/iramuteq.py @@ -101,15 +101,13 @@ ID_SimiTxt = wx.NewId() ########################################################## #encodage if sys.platform == 'darwin' : - sys.setdefaultencoding('utf-8') - wx.SetDefaultPyEncoding('utf-8') + sys.setdefaultencoding('UTF-8') + wx.SetDefaultPyEncoding('UTF-8') else : sys.setdefaultencoding(locale.getpreferredencoding()) + #chemin de l'application -try : - AppliPath = sys._MEIPASS -except : - AppliPath = os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0]))) +AppliPath = os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0]))) #chemin des images ImagePath = os.path.join(AppliPath, 'images') #configuration generale diff --git a/setup.py b/setup.py index ce341f1..a298997 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ APP = ['iramuteq.py'] OPTIONS = {'argv_emulation': True, 'emulate_shell_environment': True, 'iconfile':('images/iraicone.icns'), - 'optimize': 1} + 'optimize': 2} setup( app=APP,