X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=blobdiff_plain;f=iramuteq.py;h=479278dff4e691c500b81e0978e1160071e90072;hp=91cf8f07f69152a2ca4110cb71a2801bcbf3ede1;hb=9bde3d55d2131f1a33234a43c0de8b200ddb8f9a;hpb=5d8a0a0e99d9075adc28f2525fe0aba8e14c2b0a diff --git a/iramuteq.py b/iramuteq.py index 91cf8f0..479278d 100644 --- a/iramuteq.py +++ b/iramuteq.py @@ -54,16 +54,17 @@ from analysetxt import Alceste from textdist import PamTxt from textstat import Stat from textaslexico import Lexico -from textsimi import SimiTxt +from textsimi import SimiTxt, SimiFromCluster from textwordcloud import WordCloud from profile_segment import ProfileSegment from textcheckcorpus import checkcorpus from openanalyse import OpenAnalyse from corpusNG import BuildFromAlceste, Builder from sheet import MySheet -from checkinstall import CreateIraDirectory, CheckRPath, FindRPAthWin32, FindRPathNix, CheckRapp, CheckRPackages, IsNew, UpgradeConf, CopyConf, RLibsAreInstalled +from checkinstall import CreateIraDirectory, CheckRPath, FindRPAthWin32, FindRPathNix, CheckRPackages, IsNew, UpgradeConf, CopyConf, RLibsAreInstalled from chemins import ConstructRscriptsPath, ConstructConfigPath, ConstructDicoPath, ConstructGlobalPath, PathOut from parse_factiva_xml import ImportFactiva + from tree import LeftTree ########################################################## ID_OpenData = wx.NewId() @@ -127,6 +128,13 @@ fh.setFormatter(formatter) log.addHandler(ch) log.addHandler(fh) log.setLevel(logging.INFO) + + +class writer(object): + def write(self, data): + if data.strip() != '' : + log.info('BUG : %s' % data) +sys.stderr = writer() ConfigPath = ConstructConfigPath(UserConfigPath) ##################################################################### @@ -142,10 +150,13 @@ class IraFrame(wx.Frame): self.images_path = os.path.join(AppliPath,'images') self.UserConfigPath = UserConfigPath self.RscriptsPath = ConstructRscriptsPath(AppliPath) - self.DictPath = ConstructDicoPath(AppliPath) + #self.DictPath = ConstructDicoPath(AppliPath) + self.DictPath = ConstructDicoPath(UserConfigPath) self.ConfigGlob = ConfigGlob self.ConfigPath = ConstructConfigPath(UserConfigPath) self.pref = RawConfigParser() + #workaround for import problem + self.SimiFromCluster = SimiFromCluster #langues mylocale = wx.Locale(wx.LANGUAGE_FRENCH) mylocale.AddCatalogLookupPathPrefix(os.path.join(AppliPath,'locale')) @@ -177,9 +188,16 @@ class IraFrame(wx.Frame): item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN)) file_menu.AppendItem(item) - item1 = wx.MenuItem(file_menu, ID_Import, _(u"Import a factiva corpora..."), _("Import a factiva corpora...")) - item1.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_TIP)) - file_menu.AppendItem(item1) + + menuFactiva = wx.Menu() + fact_from_xml = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from xml")) + fact_from_mail = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from mail")) + fact_from_txt = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from copy/paste")) + menuFactiva.AppendItem(fact_from_xml) + menuFactiva.AppendItem(fact_from_mail) + menuFactiva.AppendItem(fact_from_txt) + + file_menu.AppendMenu(-1, _(u"Import from factiva"), menuFactiva) #item1.Enable(True) item = wx.MenuItem(file_menu, ID_SaveTab, _(u"Save tab as..."), _(u"Save tab as...")) @@ -322,7 +340,9 @@ class IraFrame(wx.Frame): self.Bind(wx.EVT_MENU, self.OnOpenData, id=ID_OpenData) self.Bind(wx.EVT_MENU, self.OnOpenText, id=ID_OpenText) self.Bind(wx.EVT_MENU, self.OnOpenAnalyse, id=ID_OnOpenAnalyse) - self.Bind(wx.EVT_MENU, self.import_factiva, id= ID_Import) + self.Bind(wx.EVT_MENU, self.import_factiva_xml, fact_from_xml) + self.Bind(wx.EVT_MENU, self.import_factiva_mail, fact_from_mail) + self.Bind(wx.EVT_MENU, self.import_factiva_txt, fact_from_txt) self.Bind(wx.EVT_MENU, self.OnFreq, id=ID_Freq) self.Bind(wx.EVT_MENU, self.OnChi2, id=ID_Chi2) self.Bind(wx.EVT_MENU, self.OnStudent, id=ID_Student) @@ -419,17 +439,13 @@ class IraFrame(wx.Frame): Le chemin de l'executable de R n'a pas été trouvé. Si R n'est pas installé, vous devez l'installer (http://www.r-project.org/). Si R n'est pas installé dans le répertoire par défaut -(C:\Program Files\R\R-2.x.x\R.exe sous windows ou /usr/bin/R sous linux ou Mac Os X) +(souvent C:\Program Files\R\R-2.x.x\R.exe sous windows ou /usr/bin/R sous linux ou Mac Os X) vous devez signaler le chemin de l'éxecutable de R dans les préférences.""" dlg = wx.MessageDialog(self, msg, u"Problème de configuration", wx.OK | wx.NO_DEFAULT | wx.ICON_WARNING) dlg.CenterOnParent() if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]: evt.Veto() - else : - print 'ok' - if sys.platform == 'darwin': - self.Rapp = self.PathPath.get('PATHS', 'rapp') - RappOk = CheckRapp(self.Rapp) + dlg.Destroy() self.DataPop = False self.DataTxt = False self.Text = '' @@ -814,18 +830,22 @@ Voulez-vous fermer quand même ?""" BugReport(self) def OnSimiTxt(self, evt, corpus = None) : - print 'PLUS DE BUG SUR SIMITXT' - #try : + # print 'PLUS DE BUG SUR SIMITXT' + try : #self.Text = SimiTxt(self) + if corpus is None : + corpus = self.tree.getcorpus() self.Text = SimiTxt(self, corpus, parametres = {'type': 'simitxt'}, dlg = progressbar(self, 3)) if self.Text.val == wx.ID_OK : PlaySound(self) - #except : - # BugReport(self) + except : + BugReport(self) def OnWordCloud(self, evt, corpus = None) : # print 'PLUS DE BUG SUR WORDCLOUD' try : + if corpus is None : + corpus = self.tree.getcorpus() self.Text = WordCloud(self, corpus, parametres = {'type' : 'wordcloud'}, dlg = progressbar(self, 3)) if self.Text.val == wx.ID_OK : PlaySound(self) @@ -848,6 +868,8 @@ Voulez-vous fermer quand même ?""" def OnTextStat(self, event, corpus = None): print 'PAS DE BUG SUR TEXT STAT' #try: + if corpus is None : + corpus = self.tree.getcorpus() self.Text = Stat(self, corpus, parametres = {'type': 'stat'}, dlg = progressbar(self, 7)) if self.Text.val == wx.ID_OK : @@ -859,6 +881,8 @@ Voulez-vous fermer quand même ?""" #try: #self.Text = AsLexico(self) print('ATTENTION : PLUS DE BUG SUR LEXICO') + if corpus is None : + corpus = self.tree.getcorpus() self.Text = Lexico(self, corpus, parametres = {'type' : 'spec'}, dlg = progressbar(self, 3)) if self.Text.val == wx.ID_OK : PlaySound(self) @@ -872,23 +896,35 @@ Voulez-vous fermer quand même ?""" except: BugReport(self) - def import_factiva(self,event): + def import_factiva_xml(self,event): + try : + ImportFactiva(self, 'xml') + except : + BugReport(self) + + def import_factiva_mail(self, evt) : + try : + ImportFactiva(self, 'mail') + except : + BugReport(self) + + def import_factiva_txt(self, evt) : try : - ImportFactiva(self) + ImportFactiva(self, 'txt') except : BugReport(self) def OnTextAlceste(self, event, corpus = None): - #try: - print('ATTENTION : PLUS DE BUG SUR ALCESTE') + try: + #print('ATTENTION : PLUS DE BUG SUR ALCESTE') #RunAnalyse(self, corpus, Alceste, OptAlceste) + if corpus is None : + corpus = self.tree.getcorpus() self.Text = Alceste(self, corpus, parametres = {'type': 'alceste'}, dlg = progressbar(self,6)) - #self.history.addtab(self.Text.parametres) - #OpenAnalyse(self, self.Text.parametres['ira']) if self.Text.val == wx.ID_OK: PlaySound(self) - #except: - # BugReport(self) + except: + BugReport(self) def OnPamSimple(self, event): try: