X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=blobdiff_plain;f=iramuteq.py;h=8896308931ef14acbc7f0fa31450f0b624d89a76;hp=ccc28f83087e0bbd34255ba138740ceb7bebcd24;hb=15c5b10dbd8f0846d17794fe4fb7c670f19f0c43;hpb=bef848ac11a8f9a21b431fc014b35711b0fe82b1 diff --git a/iramuteq.py b/iramuteq.py index ccc28f8..8896308 100644 --- a/iramuteq.py +++ b/iramuteq.py @@ -5,40 +5,37 @@ #License: GNU GPL from optparse import OptionParser +from wx import BusyCursor parser = OptionParser() parser.add_option("-f", "--file", dest="filename", help="open FILE", metavar="FILE", default=False) (options, args) = parser.parse_args() -#print args -#print options import sys reload(sys) import locale import tempfile import codecs import os -import shutil from random import randint -from ConfigParser import * +from ConfigParser import ConfigParser, RawConfigParser import webbrowser import gettext import logging #------------------------------------ import wx -#import wx.aui import wx.lib.agw.aui as aui import wx.html import wx.grid import wx.lib.hyperlink as hl #------------------------------------ -from functions import BugReport, PlaySound, ReadLexique, History, DoConf, ReadDicoAsDico, progressbar +from functions import BugReport, PlaySound, History from checkversion import NewVersion from guifunct import * from tableau import Tableau -from dialog import PrefDialog, CorpusPref -from tabfrequence import Frequences +from dialog import PrefDialog +from tabfrequence import Frequences, FreqMultiple from tabchi2 import ChiSquare #from tabstudent import MakeStudent from tabchddist import ChdCluster @@ -48,18 +45,15 @@ from tabsimi import DoSimi from tabrsimple import InputText from tabverges import Prototypical from tabsplitvar import SplitMatrixFromVar -#from textafcuci import AfcUci -from textdist import AnalysePam +#from textdist import AnalysePam from textstat import Stat from textaslexico import Lexico from textsimi import SimiTxt, SimiFromCluster from textwordcloud import WordCloud, ClusterCloud from textreinert import Reinert -#from profile_segment import ProfileSegment #from textcheckcorpus import checkcorpus from openanalyse import OpenAnalyse from corpus import Builder, SubBuilder -#from sheet import MySheet from checkinstall import CreateIraDirectory, CheckRPath, FindRPAthWin32, FindRPathNix, CheckRPackages, IsNew, UpgradeConf, CopyConf, RLibsAreInstalled from chemins import RscriptsPath, ConstructConfigPath, ConstructDicoPath, ConstructGlobalPath, PathOut from parse_factiva_xml import ImportFactiva @@ -95,6 +89,7 @@ ID_HTMLcontent = wx.NewId() ID_SimiTxt = wx.NewId() ID_proto = wx.NewId() ID_ImportTXM = wx.NewId() +ID_FreqMulti = wx.NewId() ########################################################## #elements de configuration ########################################################## @@ -113,6 +108,8 @@ ImagePath = os.path.join(AppliPath, 'images') DictConfigPath = ConstructGlobalPath(AppliPath) ConfigGlob = ConfigParser() ConfigGlob.read(DictConfigPath['global']) +DefaultConf = ConfigParser() +DefaultConf.read(DictConfigPath['preferences']) #repertoire de l'utilisateur if os.getenv('HOME') != None: user_home = os.getenv('HOME') @@ -149,17 +146,18 @@ sys.stdout = printer() ConfigPath = ConstructConfigPath(UserConfigPath) langues = {'french' : wx.LANGUAGE_FRENCH, - 'english' : wx.LANGUAGE_ENGLISH, - 'portuguese' : wx.LANGUAGE_PORTUGUESE, - 'italian' : wx.LANGUAGE_ITALIAN, - 'spanish' : wx.LANGUAGE_SPANISH} + 'english' : wx.LANGUAGE_ENGLISH, + 'portuguese' : wx.LANGUAGE_PORTUGUESE, + 'italian' : wx.LANGUAGE_ITALIAN, + 'spanish' : wx.LANGUAGE_SPANISH + } code_langues = {'french' : 'fr_FR', - 'english' : 'en', - 'portuguese' : 'pt_PT', - 'italian' : 'it_IT', - 'spanish' : 'es_ES' - } + 'english' : 'en', + 'portuguese' : 'pt_PT', + 'italian' : 'it_IT', + 'spanish' : 'es_ES' + } ##################################################################### class IraFrame(wx.Frame): @@ -191,10 +189,9 @@ class IraFrame(wx.Frame): self.preslangue = {} for langue in code_langues : self.preslangue[langue] = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=[code_langues[langue]]) - + self.setlangue() #self.presLan_fr = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=['fr_FR']) #self.presLan_en = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=['en']) - self.setlangue() # tell FrameManager to manage this frame #self._mgr = wx.aui.AuiManager() self._mgr = aui.AuiManager() @@ -251,7 +248,7 @@ class IraFrame(wx.Frame): file_menu.Append(wx.ID_EXIT, _(u"Exit").decode('utf8')) edit_menu = wx.Menu() - edit_menu.Append(wx.ID_PREFERENCES, '', _(u'Preferences').decode('utf8')) + edit_menu.Append(wx.ID_PREFERENCES, _(u'Preferences').decode('utf8')) view_menu = wx.Menu() view_menu.Append(ID_ACCEUIL, _(u"Home page").decode('utf8')) @@ -260,6 +257,7 @@ class IraFrame(wx.Frame): #view_menu.AppendSeparator() matrix_menu = wx.Menu() matrix_menu.Append(ID_Freq, _(u"Frequencies").decode('utf8')) + matrix_menu.Append(ID_FreqMulti, _(u'Multiple frequencies').decode('utf8')) matrix_menu.Append(ID_Chi2, _(u"Chi2").decode('utf8')) #matrix_menu.Append(ID_Student, u"t de Student") menu_classif = wx.Menu() @@ -307,8 +305,8 @@ class IraFrame(wx.Frame): #-------------------------------------------------------------------- self.statusbar = self.CreateStatusBar(2, wx.ST_SIZEGRIP) self.statusbar.SetStatusWidths([-2, -3]) - self.statusbar.SetStatusText(u"Prêt", 0) - self.statusbar.SetStatusText(u"Bienvenue", 1) + self.statusbar.SetStatusText(_(u"Ready").decode('utf8'), 0) + self.statusbar.SetStatusText(_(u"Welcome").decode('utf8'), 1) # min size for the frame itself isn't completely done. # see the end up FrameManager::Update() for the test @@ -342,7 +340,7 @@ class IraFrame(wx.Frame): # f.write('') self.history = History(os.path.join(UserConfigPath, 'history.db')) self.tree = LeftTree(self) - self._mgr.AddPane(self.tree, aui.AuiPaneInfo().Name("lefttree").Caption(_(u"Navigator").decode('utf8')). + self._mgr.AddPane(self.tree, aui.AuiPaneInfo().Name("lefttree").Caption(_(u"Historic").decode('utf8')). Left().MinSize(wx.Size(200,500)).Layer(1).Position(1).CloseButton(False).MaximizeButton(True). MinimizeButton(True)) @@ -397,6 +395,7 @@ class IraFrame(wx.Frame): self.Bind(wx.EVT_MENU, self.ExtractTools, extractmod) self.Bind(wx.EVT_MENU, self.ExtractTools, extractthem) self.Bind(wx.EVT_MENU, self.OnFreq, id=ID_Freq) + self.Bind(wx.EVT_MENU, self.OnFreqMulti, id=ID_FreqMulti) self.Bind(wx.EVT_MENU, self.OnChi2, id=ID_Chi2) self.Bind(wx.EVT_MENU, self.OnStudent, id=ID_Student) self.Bind(wx.EVT_MENU, self.OnCHDSIM, id=ID_CHDSIM) @@ -525,7 +524,10 @@ vous devez signaler le chemin de l'éxecutable de R dans les préférences.""" def setlangue(self) : self.pref.read(self.ConfigPath['preferences']) - guilangue = self.pref.get('iramuteq', 'guilanguage') + try : + guilangue = self.pref.get('iramuteq', 'guilanguage') + except : + guilangue = DefaultConf.get('iramuteq', 'guilanguage') self.preslangue.get(guilangue, 'english').install() def OnVerif(self, evt) : @@ -576,9 +578,16 @@ vous devez signaler le chemin de l'éxecutable de R dans les préférences.""" self.tableau = Tableau(self,os.path.abspath(self.input_path[0])) val = get_table_param(self, self.input_path[0]) if val == wx.ID_OK : - self.tableau.make_content() - OpenAnalyse(self, self.tableau.parametres) - self.tree.OnItemAppend(self.tableau.parametres) + busy = wx.BusyInfo(_("Please wait...").decode('utf8'), self) + wx.SafeYield() + try : + self.tableau.make_content() + OpenAnalyse(self, self.tableau.parametres) + self.tree.OnItemAppend(self.tableau.parametres) + del busy + except : + del busy + BugReport(self) #self.tableau.show_tab() def OnOpenAnalyse(self, event): @@ -785,6 +794,9 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, États-Unis.""" def OnFreq(self, event, matrix = None): self.analyse_matrix(Frequences, analyse_type = 'freq', matrix = matrix, dlgnb = 3) + + def OnFreqMulti(self, event, matrix = None): + self.analyse_matrix(FreqMultiple, analyse_type = 'freqmulti', matrix = matrix, dlgnb = 3) def OnChi2(self, event, matrix = None): self.analyse_matrix(ChiSquare, matrix = matrix, analyse_type = 'chi2', dlgnb = 3) @@ -955,8 +967,8 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, États-Unis.""" except: BugReport(self) - def SimiCluster(self, parametres = {}, fromprof = False, pathout = '', listactives = [], actives = [], tableau = None) : - DoSimi(self, param = parametres, fromprof = fromprof, listactives = listactives, actives = actives, tableau = tableau) + def SimiCluster(self, parametres = {}, fromprof = False, tableau = None) : + self.analyse_matrix(DoSimi, parametres = parametres, analyse_type = 'simiclustermatrix', matrix = tableau, dlgnb = 5) # def OnSimi(self,evt): # try :