correction tgens
[iramuteq] / iramuteq.py
1 #!/bin/env python
2 # -*- coding: utf-8 -*-
3 #Author: Pierre Ratinaud
4 #Copyright (c) 2008-2012, Pierre Ratinaud
5 #License: GNU GPL
6
7 from optparse import OptionParser
8
9 parser = OptionParser()
10 parser.add_option("-f", "--file", dest="filename",
11                   help="open FILE", metavar="FILE", default=False)
12 (options, args) = parser.parse_args()
13
14 import sys
15 reload(sys)
16 import locale
17 import tempfile
18 import codecs
19 import os
20 from random import randint
21 from ConfigParser import ConfigParser, RawConfigParser
22 import webbrowser
23 import gettext
24 import logging
25 #------------------------------------
26 import wx
27 import wx.lib.agw.aui as aui
28 import wx.html
29 import wx.grid
30 import wx.lib.hyperlink as hl
31 #------------------------------------
32 from functions import BugReport, PlaySound, History, progressbar
33 from checkversion import NewVersion
34 from guifunct import *
35 from tableau import Tableau
36 from dialog import PrefDialog
37 from tabfrequence import Frequences, FreqMultiple
38 from tabchi2 import ChiSquare
39 #from tabstudent import MakeStudent
40 from tabchddist import ChdCluster
41 from tabafcm import DoAFCM
42 from tabchdalc import AnalyseQuest
43 from tabsimi import DoSimi
44 from tabrsimple import InputText
45 from tabverges import Prototypical
46 from tabsplitvar import SplitMatrixFromVar
47 #from textdist import AnalysePam
48 from textstat import Stat
49 from textaslexico import Lexico
50 from textsimi import SimiTxt, SimiFromCluster
51 from textwordcloud import WordCloud, ClusterCloud
52 from textreinert import Reinert
53 #from textcheckcorpus import checkcorpus
54 from openanalyse import OpenAnalyse
55 from corpus import Builder, SubBuilder
56 from checkinstall import CreateIraDirectory, CheckRPath, FindRPAthWin32, FindRPathNix, CheckRPackages, IsNew, UpgradeConf, CopyConf, RLibsAreInstalled
57 from chemins import RscriptsPath, ConstructConfigPath, ConstructDicoPath, ConstructGlobalPath, PathOut
58 from parse_factiva_xml import ImportFactiva
59 from parse_dmi import ImportDMI
60 from tools import Extract
61 from analyse_merge import AnalyseMerge
62
63 from tree import LeftTree
64 ##########################################################
65 ID_OpenData = wx.NewId()
66 ID_Import = wx.NewId()
67 ID_OpenText = wx.NewId()
68 ID_OnOpenAnalyse = wx.NewId()
69 ID_Freq = wx.NewId()
70 ID_Chi2 = wx.NewId()
71 ID_Student = wx.NewId()
72 ID_CHDSIM = wx.NewId()
73 ID_CHDReinert = wx.NewId()
74 ID_TEXTAFCM = wx.NewId()
75 ID_TEXTSTAT = wx.NewId()
76 ID_ASLEX = wx.NewId()
77 ID_TEXTREINERT = wx.NewId()
78 ID_TEXTPAM = wx.NewId()
79 ID_CHECKCORPUS = wx.NewId()
80 ID_Tabcontent = wx.NewId()
81 ID_AFCM = wx.NewId()
82 ID_SIMI = wx.NewId()
83 ID_CloseTab = wx.NewId()
84 ID_SaveTab = wx.NewId()
85 ID_CreateText = wx.NewId()
86 ID_ACCEUIL = wx.NewId()
87 ID_RESULT = wx.NewId()
88 ID_HTMLcontent = wx.NewId()
89 ID_SimiTxt = wx.NewId()
90 ID_proto = wx.NewId()
91 ID_ImportTXM = wx.NewId()
92 ID_FreqMulti = wx.NewId()
93 ID_Splitfromvar = wx.NewId()
94 ID_Subtxtfrommeta = wx.NewId()
95 ID_Subtxtfromthem = wx.NewId()
96 ID_WC = wx.NewId()
97 ID_ImportEuro = wx.NewId()
98 ID_Fact_xml = wx.NewId()
99 ID_Fact_mail = wx.NewId()
100 ID_Fact_copy = wx.NewId()
101 ID_exportmeta = wx.NewId()
102 ID_importdmi = wx.NewId()
103 ID_merge = wx.NewId()
104 ##########################################################
105 #elements de configuration
106 ##########################################################
107 #encodage
108 if sys.platform == 'darwin' :
109     sys.setdefaultencoding('UTF-8')
110     wx.SetDefaultPyEncoding('UTF-8')
111 else :
112     sys.setdefaultencoding(locale.getpreferredencoding())
113
114 #chemin de l'application
115 AppliPath = os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0])))
116 #chemin des images
117 ImagePath = os.path.join(AppliPath, 'images')
118 #configuration generale
119 DictConfigPath = ConstructGlobalPath(AppliPath)
120 ConfigGlob = ConfigParser()
121 ConfigGlob.read(DictConfigPath['global'])
122 DefaultConf = ConfigParser()
123 DefaultConf.read(DictConfigPath['preferences'])
124 #repertoire de l'utilisateur
125 user_home = os.getenv('HOME')
126 if user_home is None :
127     user_home = os.path.expanduser('~')
128
129 UserConfigPath = os.path.abspath(os.path.join(user_home, '.iramuteq'))
130 #Si pas de fichiers de config utilisateur, on cree le repertoire
131 CreateIraDirectory(UserConfigPath, AppliPath)
132 #fichiers log pour windows (py2exe)
133 log = logging.getLogger('iramuteq')
134 fh = logging.FileHandler(os.path.join(UserConfigPath,'stdout.log'))
135 formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
136 fh.setFormatter(formatter)
137 log.addHandler(fh)
138 if sys.platform != 'win32' and sys.platform != 'darwin':
139     ch = logging.StreamHandler()
140     ch.setFormatter(formatter)
141     log.addHandler(ch)
142 log.setLevel(logging.INFO)
143
144 class writer(object):
145     def write(self, data):
146         if data.strip() != '' :
147             log.info('ERROR : %s' % data)
148
149 class printer(object) :
150     def write(self, data) :
151         if data.strip() != '' :
152             log.info('Print : %s' % data)
153
154 sys.stderr = writer()
155 sys.stdout = printer()
156
157 ConfigPath = ConstructConfigPath(UserConfigPath)
158
159 langues = {'french' : wx.LANGUAGE_FRENCH,
160            'english' : wx.LANGUAGE_ENGLISH,
161            'portuguese' : wx.LANGUAGE_PORTUGUESE,
162            'italian' : wx.LANGUAGE_ITALIAN,
163            'spanish' : wx.LANGUAGE_SPANISH
164            }
165
166 code_langues = {'french' : 'fr_FR',
167                 'english' : 'en',
168                 'portuguese' : 'pt_PT',
169                 'italian' : 'it_IT',
170                 'spanish' : 'es_ES'
171                }
172
173 images_analyses = {
174         'textroot' : 'textroot.png',
175         'alceste' : 'reinert.png',
176         'corpus' : 'textcorpus.png',
177         'wordcloud' :'wordcloud.png',
178         'stat' :'stats.png',
179         'simitxt' : 'simitxt.png',
180         'clustersimitxt' :'clustersimitxt.png',
181         'clustercloud' : 'clustercloud.png',
182         'spec' : 'spec.png',
183         'matroot' : 'matroot.png',
184         'matrix' : 'matrix.png',
185         'freq' : 'frequences.png',
186         'freqmulti' : 'frequences.png',
187         'chi2' : 'chi2.png',
188         'reinertmatrix' : 'reinertmatrix.png',
189         'simimatrix' : 'simimatrix.png',
190         'simiclustermatrix' : 'simimatrix.png',
191         'proto' : 'proto.png',
192         'TXM' : 'TXM.png',
193         'europress' : 'europress.png',
194         'factiva_xml' : 'factiva_xml.png',
195         'factiva_copy' : 'factiva_copy.png',
196         'factiva_mail': 'factiva_mail.png',
197         'iramuteq' : 'iraicone.png',
198         'subcorpusmeta' : 'subcorpusmeta.png',
199         'subcorpusthema' : 'subcorpusthema.png',
200         'preferences' : 'preferences.png',
201         'exportmetatable' : 'exportmetatable.png',
202         'importdmi' : 'twitter.png'
203          }
204 #####################################################################
205
206 class IraFrame(wx.Frame):
207     def __init__(self, parent, id= -1, title="", pos=wx.DefaultPosition,
208                  size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE | 
209                                             wx.SUNKEN_BORDER | 
210                                             wx.CLIP_CHILDREN):
211         log.info('Starting... ' )
212         log.info('version : %s' % ConfigGlob.get('DEFAULT', 'version'))
213         wx.Frame.__init__(self, parent, id, title, pos, size, style)
214         #configuration
215         self.AppliPath = AppliPath
216         self.images_path = os.path.join(AppliPath,'images')
217         self.UserConfigPath = UserConfigPath
218         #self.RscriptsPath = ConstructRscriptsPath(AppliPath)
219         self.RscriptsPath = PathOut(dirout=os.path.join(AppliPath, 'Rscripts'))
220         self.RscriptsPath.basefiles(RscriptsPath)
221         #self.DictPath = ConstructDicoPath(AppliPath)
222         self.DictPath = ConstructDicoPath(UserConfigPath)
223         self.ConfigGlob = ConfigGlob
224         self.ConfigPath = ConstructConfigPath(UserConfigPath)
225         self.pref = RawConfigParser()
226         #workaround for import problem
227         self.SimiFromCluster = SimiFromCluster
228         #langues
229         gettext.install('iramuteq',  os.path.join(AppliPath,'locale'), unicode=True)
230         #langues = ['fr_FR', 'en', 'pt_PT']
231         #for l in langues :
232         #    pass
233         self.preslangue = {}
234         for langue in code_langues :
235             self.preslangue[langue] = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=[code_langues[langue]])
236         self.setlangue()
237         #self.presLan_fr = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=['fr_FR'])
238         #self.presLan_en = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=['en'])
239         # tell FrameManager to manage this frame        
240         #self._mgr = wx.aui.AuiManager()
241         self._mgr = aui.AuiManager()
242         self._mgr.SetManagedWindow(self)
243         self.x = 0
244         # create menu
245 #--------------------------------------------------------------------------------
246         self.images_analyses = images_analyses
247         for img in images_analyses :
248             self.images_analyses[img] = wx.Image(os.path.join(self.images_path, self.images_analyses[img]), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap()
249         self.mb = wx.MenuBar()
250
251         file_menu = wx.Menu()
252         item = wx.MenuItem(file_menu, ID_OpenData, _(u"Open a matrix").decode('utf8'), _(u"Open a matrix").decode('utf8'))
253         #item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
254         item.SetBitmap(self.images_analyses['matroot'])
255         file_menu.AppendItem(item)
256         
257         item = wx.MenuItem(file_menu, ID_OpenText, _(u"Open a text corpus").decode('utf8'), _(u"Open a text corpus").decode('utf8'))
258         item.SetBitmap(self.images_analyses['textroot'])
259         file_menu.AppendItem(item)
260         
261         item = wx.MenuItem(file_menu, ID_OnOpenAnalyse, _(u"Open an analysis").decode('utf8'), _(u"Open an analysis").decode('utf8'))
262         item.SetBitmap(self.images_analyses['iramuteq'])
263         file_menu.AppendItem(item)
264
265         item = wx.MenuItem(file_menu, ID_ImportTXM, _(u"Import from TXM").decode('utf8'), _(u"Import from TXM").decode('utf8'))
266         item.SetBitmap(self.images_analyses['TXM'])
267         file_menu.AppendItem(item)
268         
269         item = wx.MenuItem(file_menu, ID_ImportEuro, _(u"Import from Europress").decode('utf8'), _(u"Import from Europress").decode('utf8'))
270         item.SetBitmap(self.images_analyses['europress'])
271         file_menu.AppendItem(item)        
272         
273         item = wx.MenuItem(file_menu, ID_importdmi, _(u"Import from DMI-TCAT (exp.)").decode('utf8'), _(u"Import from DMI-TCAT (exp.)").decode('utf8'))
274         item.SetBitmap(self.images_analyses['importdmi'])
275         file_menu.AppendItem(item)        
276         
277         item = wx.MenuItem(file_menu, ID_merge, _(u'Merge graphs').decode('utf8'), _(u'Merge graphs').decode('utf8'))
278         file_menu.AppendItem(item)
279         
280         menuFactiva = wx.Menu()
281         fact_from_xml = wx.MenuItem(menuFactiva, ID_Fact_xml, _(u"from xml").decode('utf8'))
282         fact_from_xml.SetBitmap(self.images_analyses['factiva_xml'])
283         fact_from_mail = wx.MenuItem(menuFactiva, ID_Fact_mail, _(u"from mail").decode('utf8'))
284         fact_from_mail.SetBitmap(self.images_analyses['factiva_mail'])
285         fact_from_txt = wx.MenuItem(menuFactiva, ID_Fact_copy, _(u"from copy/paste").decode('utf8'))
286         fact_from_txt.SetBitmap(self.images_analyses['factiva_copy'])
287         menuFactiva.AppendItem(fact_from_xml)
288         menuFactiva.AppendItem(fact_from_mail)
289         menuFactiva.AppendItem(fact_from_txt)
290         file_menu.AppendMenu(-1, _(u"Import from factiva").decode('utf8'), menuFactiva)
291
292         menuTools = wx.Menu()
293         splitvar = wx.MenuItem(menuTools, wx.ID_ANY, _(u"Split from variable").decode('utf8'))
294         extractmod = wx.MenuItem(menuTools, wx.ID_ANY, _(u"Extract mods").decode('utf8'))
295         extractthem = wx.MenuItem(menuTools, wx.ID_ANY, _(u"Extract thematics").decode('utf8'))
296         menuTools.AppendItem(splitvar)
297         menuTools.AppendItem(extractmod)
298         menuTools.AppendItem(extractthem)
299         self.ID_splitvar = splitvar.GetId()
300         self.ID_extractmod = extractmod.GetId()
301         self.ID_extractthem = extractthem.GetId()
302         file_menu.AppendMenu(-1, _(u"Tools").decode('utf8'), menuTools)
303
304                
305         #item = wx.MenuItem(file_menu, ID_SaveTab, _(u"Save tab as...").decode('utf8'), _(u"Save tab as...").decode('utf8'))
306         #item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_SAVE_AS))
307         #file_menu.AppendItem(item)
308         
309         file_menu.Append(wx.ID_EXIT, _(u"Exit").decode('utf8'))
310         
311         edit_menu = wx.Menu()
312         pref = wx.MenuItem(edit_menu, wx.ID_PREFERENCES, _(u'Preferences').decode('utf8'))
313         pref.SetBitmap(self.images_analyses['preferences'])
314         edit_menu.AppendItem(pref)
315         #edit_menu.Append(wx.ID_PREFERENCES, _(u'Preferences').decode('utf8'))
316         
317         view_menu = wx.Menu()
318         home = wx.MenuItem(view_menu, ID_ACCEUIL, _(u"Home page").decode('utf8'))
319         home.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_GO_HOME, size = (16,16)))
320         view_menu.AppendItem(home)
321         #view_menu.Append(ID_ACCEUIL, _(u"Home page").decode('utf8'))
322         results = wx.MenuItem(view_menu, ID_RESULT, _(u'Show results').decode('utf8'))
323         results.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_LIST_VIEW, size = (16,16)))
324         view_menu.AppendItem(results)
325         #view_menu.Append(ID_RESULT, _(u'Show results').decode('utf8'))
326         #view_menu.AppendSeparator()
327         matrix_menu = wx.Menu()
328         matanalyses = [[ID_Freq, _(u"Frequencies").decode('utf8'), 'freq'],
329                        [ID_FreqMulti, _(u"Multiple  Frequencies").decode('utf8'), 'freqmulti'],
330                        [ID_Chi2, _(u"Chi2").decode('utf8'), 'chi2'],
331                        {'name' : _(u"Clustering").decode('utf8'),
332                         'content' : [[ID_CHDReinert, _(u"Reinert's Method").decode('utf8'), 'reinertmatrix']]},
333                        [ID_SIMI, _(u"Similarities Analysis").decode('utf8'), 'simimatrix'],
334                        [ID_proto, _(u"Prototypical Analysis").decode('utf8'), 'proto'],
335                        [ID_Splitfromvar, _(u"Split from variable").decode('utf8'), 'subcorpusmeta'],
336                         ]
337         
338         for analyse in matanalyses :
339             if not isinstance(analyse, dict) :
340                 item = wx.MenuItem(matrix_menu, analyse[0], analyse[1])
341                 item.SetBitmap(self.images_analyses.get(analyse[2], wx.EmptyBitmap(16,16)))
342                 matrix_menu.AppendItem(item)
343             else :
344                 nmenu = wx.Menu()
345                 for subana in analyse['content'] :
346                     item = wx.MenuItem(nmenu, subana[0], subana[1])
347                     item.SetBitmap(self.images_analyses.get(subana[2], wx.EmptyBitmap(16,16)))
348                     nmenu.AppendItem(item)
349                 matrix_menu.AppendMenu(-1, analyse['name'], nmenu)
350         #item = wx.MenuItem(matrix_menu, ID_Freq, _(u"Frequencies").decode('utf8'))
351         #item.SetBitmap(self.images_analyses['freq'])
352         #matrix_menu.AppendItem(item)
353         #matrix_menu.Append(ID_Freq, _(u"Frequencies").decode('utf8'))
354         #item = wx.MenuItem(matrix_menu, ID_Freq, _(u"Multiple  Frequencies").decode('utf8'))
355         #item.SetBitmap(self.images_analyses['freqmulti'])
356         #matrix_menu.Append(ID_FreqMulti, _(u'Multiple frequencies').decode('utf8'))
357         #matrix_menu.AppendItem(item)
358         #matrix_menu.Append(ID_Chi2, _(u"Chi2").decode('utf8'))
359         #matrix_menu.Append(ID_Student, u"t de Student")
360         #menu_classif = wx.Menu()
361         #menu_classif.Append(ID_CHDReinert, _(u"Reinert's Method").decode('utf8'))
362         #menu_classif.Append(ID_CHDSIM, u"Par matrice des distances")
363         #matrix_menu.AppendMenu(-1, _(u"Clustering").decode('utf8'), menu_classif)
364         #matrix_menu.Append(ID_AFCM, u"AFCM")
365         #matrix_menu.Append(ID_SIMI, _(u"Similarities Analysis").decode('utf8'))
366         #matrix_menu.Append(ID_proto, _(u"Prototypical Analysis").decode('utf8'))
367         ID_RCODE = wx.NewId()
368         #matrix_menu.Append(ID_RCODE, u"Code R...") 
369         #menu_splittab = wx.Menu()
370         #ID_SPLITVAR = wx.NewId()
371         #splitvar = wx.MenuItem(menu_splittab, ID_SPLITVAR, _(u"Split from variable").decode('utf8'))
372         #menu_splittab.AppendItem(splitvar)
373         #matrix_menu.AppendMenu(-1, _(u"Split matrix").decode('utf8'), menu_splittab)
374         self.matrix_menu = matrix_menu
375         
376         text_menu = wx.Menu()
377         analyses_text = [[ID_TEXTSTAT, _(u"Statistics").decode('utf8'), 'stat'],
378                          [ID_ASLEX, _(u"Specificities and CA").decode('utf8'), 'spec'],
379                          {'name' : _(u"Clustering").decode('utf8'),
380                           'content' : [[ID_TEXTREINERT, _(u"Reinert's Method").decode('utf8'), 'alceste']]},
381                          [ID_SimiTxt, _(u"Similarities Analysis").decode('utf8'), 'simitxt'],
382                          [ID_WC, _(u"WordCloud").decode('utf8'), 'wordcloud'],
383                          {'name' : _(u"Sub corpus").decode('utf8'),
384                           'content' : [[ID_Subtxtfrommeta, _(u'Sub corpus from metadata').decode('utf8'), 'subcorpusmeta'],
385                                        [ID_Subtxtfromthem, _(u'Sub corpus from thematic').decode('utf8'), 'subcorpusthema']]},
386                          [ID_exportmeta, _(u"Export metadata table").decode('utf8'), 'exportmetatable'],
387                          ]
388         
389         for analyse in analyses_text :
390             if not isinstance(analyse, dict) :
391                 item = wx.MenuItem(text_menu, analyse[0], analyse[1])
392                 item.SetBitmap(self.images_analyses.get(analyse[2], wx.EmptyBitmap(16,16)))
393                 text_menu.AppendItem(item)
394             else :
395                 nmenu = wx.Menu()
396                 for subana in analyse['content'] :
397                     item = wx.MenuItem(nmenu, subana[0], subana[1])
398                     item.SetBitmap(self.images_analyses.get(subana[2], wx.EmptyBitmap(16,16)))
399                     nmenu.AppendItem(item)
400                 text_menu.AppendMenu(-1, analyse['name'], nmenu)
401         #text_menu.Append(ID_CHECKCORPUS, u"Vérifier le corpus")
402 #         text_menu.Append(ID_TEXTSTAT, _(u"Statistics").decode('utf8'))
403 #         text_menu.Append(ID_ASLEX, _(u"Specificities and CA").decode('utf8'))
404 #         #text_menu.Append(ID_TEXTAFCM, u"AFC sur UCI / Vocabulaire")
405 #         menu_classiftxt = wx.Menu()
406 #         menu_classiftxt.Append(ID_TEXTREINERT, _(u"Reinert's Method").decode('utf8'))
407 #         #menu_classiftxt.Append(ID_TEXTPAM, u"Par matrice des distances")
408 #         text_menu.AppendMenu(-1, _(u"Clustering").decode('utf8'), menu_classiftxt)
409 #         text_menu.Append(ID_SimiTxt, _(u"Similarities Analysis").decode('utf8')) 
410 #         
411 #         text_menu.Append(ID_WC, _(u"WordCloud").decode('utf8'))
412         self.text_menu = text_menu
413         
414         help_menu = wx.Menu()
415         about = wx.MenuItem(help_menu, wx.ID_ABOUT, _(u"About...").decode('utf8'))
416         about.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_INFORMATION, size = (16,16)))
417         help_menu.AppendItem(about)
418         #help_menu.Append(wx.ID_ABOUT, _(u"About...").decode('utf8'))
419         help = wx.MenuItem(help_menu, wx.ID_HELP, _(u"Online help...").decode('utf8'))
420         help.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_HELP, size = (16,16)))
421         help_menu.AppendItem(help)
422         #help_menu.Append(wx.ID_HELP, _(u"Online help...").decode('utf8'))
423         
424         self.mb.Append(file_menu, _(u"File").decode('utf8'))
425         self.mb.Append(edit_menu, _(u"Edition").decode('utf8'))
426         self.mb.Append(view_menu, _(u"View").decode('utf8'))
427         self.mb.Append(matrix_menu, _(u"Matrix analysis").decode('utf8'))
428         self.mb.Append(text_menu, _(u"Text analysis").decode('utf8'))
429         self.mb.Append(help_menu, _(u"Help").decode('utf8'))
430         
431         self.SetMenuBar(self.mb)
432 #--------------------------------------------------------------------
433         self.statusbar = self.CreateStatusBar(2, wx.ST_SIZEGRIP)
434         self.statusbar.SetStatusWidths([-2, -3])
435         self.statusbar.SetStatusText(_(u"Ready").decode('utf8'), 0)
436         self.statusbar.SetStatusText(_(u"Welcome").decode('utf8'), 1)
437
438         # min size for the frame itself isn't completely done.
439         # see the end up FrameManager::Update() for the test
440         # code. For now, just hard code a frame minimum size
441         self.SetMinSize(wx.Size(400, 400))
442
443         # create some toolbars
444         tb1 = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize,
445                          wx.TB_FLAT | wx.TB_NODIVIDER)
446         tb1.SetToolBitmapSize(wx.Size(16, 16))
447         tb1.AddLabelTool(ID_OpenData, "OpenData", self.images_analyses['matroot'], shortHelp=_(u"Matrix").decode('utf8'), longHelp=_(u"Open a matrix").decode('utf8'))
448         tb1.AddSeparator()
449         tb1.AddLabelTool(ID_OpenText, "OpenText", self.images_analyses['textroot'], shortHelp=_(u"Text").decode('utf8'), longHelp=_(u"Open a text corpus").decode('utf8'))
450         tb1.AddSeparator()
451         tb1.AddLabelTool(ID_OnOpenAnalyse, "OpenAnalyse", self.images_analyses['iramuteq'], shortHelp= _(u"Open an analysis").decode('utf8'), longHelp=_(u"Open an analysis").decode('utf8'))
452         tb1.AddSeparator()
453         tb1.AddLabelTool(ID_ImportTXM, "ImportTXM", self.images_analyses['TXM'], shortHelp= _(u"Import from TXM").decode('utf8'), longHelp=_(u"Import from TXM").decode('utf8'))
454         tb1.AddSeparator()
455         tb1.AddLabelTool(ID_ImportEuro, "ImportEuro", self.images_analyses['europress'], shortHelp= _(u"Import from Europress").decode('utf8'), longHelp=_(u"Import from Europress").decode('utf8'))
456         tb1.AddSeparator()
457         tb1.AddLabelTool(ID_importdmi, "ImportDMI", self.images_analyses['importdmi'], shortHelp= _(u"Import from DMI-TCAT (exp.)").decode('utf8'), longHelp=_(u"Import from DMI-TCAT (exp.)").decode('utf8'))
458         tb1.AddSeparator()        
459         tb1.AddLabelTool(ID_Fact_xml, "ImportFactxml", self.images_analyses['factiva_xml'], shortHelp= _(u"Factiva from xml").decode('utf8'), longHelp=_(u"Factiva from xml").decode('utf8'))
460         tb1.AddLabelTool(ID_Fact_mail, "ImportFactmail", self.images_analyses['factiva_mail'], shortHelp= _(u"Factiva from mail").decode('utf8'), longHelp=_(u"Factiva from mail").decode('utf8'))
461         tb1.AddLabelTool(ID_Fact_copy, "ImportFactcopy", self.images_analyses['factiva_copy'], shortHelp= _(u"Factiva from copy/paste").decode('utf8'), longHelp=_(u"Factiva from copy/paste").decode('utf8'))
462         tb1.AddSeparator()
463         tb1.AddLabelTool(wx.ID_PREFERENCES, "Preferences", self.images_analyses['preferences'], shortHelp= _(u"Preferences").decode('utf8'), longHelp=_(u"Preferences").decode('utf8'))
464         tb1.AddSeparator()
465         tb1.AddLabelTool(ID_ACCEUIL, "Home", wx.ArtProvider_GetBitmap(wx.ART_GO_HOME, size = (16,16)), shortHelp= _(u"Home page").decode('utf8'), longHelp=_(u"Home page").decode('utf8'))
466         tb1.AddLabelTool(ID_RESULT, "Results", wx.ArtProvider_GetBitmap(wx.ART_LIST_VIEW, size = (16,16)), shortHelp= _(u'Show results').decode('utf8'), longHelp=_(u'Show results').decode('utf8'))
467         tb1.Realize()
468         
469         tb_text = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize,
470                          wx.TB_FLAT | wx.TB_NODIVIDER)
471         for analyse in analyses_text :
472             if not isinstance(analyse, dict) :
473                 tb_text.AddLabelTool(analyse[0], analyse[1], self.images_analyses.get(analyse[2], wx.EmptyBitmap(16,16)), shortHelp = analyse[1], longHelp = analyse[1])
474             else :
475                 for subana in analyse['content'] :
476                     tb_text.AddLabelTool(subana[0], subana[1], self.images_analyses.get(subana[2], wx.EmptyBitmap(16,16)), shortHelp = subana[1], longHelp = subana[1])
477         tb_text.Realize()
478         
479         tb_mat = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize,
480                          wx.TB_FLAT | wx.TB_NODIVIDER)
481         for analyse in matanalyses :
482             if not isinstance(analyse, dict) :
483                 tb_mat.AddLabelTool(analyse[0], analyse[1], self.images_analyses.get(analyse[2], wx.EmptyBitmap(16,16)), shortHelp = analyse[1], longHelp = analyse[1])
484             else :
485                 for subana in analyse['content'] :
486                     tb_mat.AddLabelTool(subana[0], subana[1], self.images_analyses.get(subana[2], wx.EmptyBitmap(16,16)), shortHelp = subana[1], longHelp = subana[1])        
487         tb_mat.Realize()
488         
489         tb_help = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize,
490                          wx.TB_FLAT | wx.TB_NODIVIDER)
491         tb_help.AddLabelTool(wx.ID_ABOUT, "About", wx.ArtProvider_GetBitmap(wx.ART_INFORMATION, size=(16,16)), shortHelp=_(u"About...").decode('utf8'), longHelp=_(u"About...").decode('utf8'))
492         tb_help.AddLabelTool(wx.ID_HELP, "Help", wx.ArtProvider_GetBitmap(wx.ART_HELP, size=(16,16)), shortHelp=_(u"Online help...").decode('utf8'), longHelp=_(u"Online help...").decode('utf8'))
493         tb_help.Realize()
494 #------------------------------------------------------------------------------------------------
495
496         self.text_ctrl_txt = wx.TextCtrl(self, -1, "", wx.Point(0, 0), wx.Size(200, 200), wx.NO_BORDER | wx.TE_MULTILINE | wx.TE_RICH2 | wx.TE_READONLY)
497                       
498         #self._mgr.AddPane(self.text_ctrl_txt, wx.aui.AuiPaneInfo().
499         #                  Name("Text").CenterPane())                      
500         self._mgr.AddPane(self.text_ctrl_txt, aui.AuiPaneInfo().
501                           Name("Text").CenterPane())
502         #self._mgr.AddPane(IntroPanel(self), wx.aui.AuiPaneInfo().Name("Intro_Text").
503         #                  CenterPane())
504         self._mgr.AddPane(IntroPanel(self), aui.AuiPaneInfo().Name("Intro_Text").
505                           CenterPane())
506         #if not os.path.exists(os.path.join(UserConfigPath, 'history.db')) :
507         #    with open(os.path.join(UserConfigPath, 'history.db'), 'w') as f :
508         #        f.write('')
509         self.history = History(os.path.join(UserConfigPath, 'history.db'))
510         self.tree = LeftTree(self)
511         self._mgr.AddPane(self.tree, aui.AuiPaneInfo().Name("lefttree").Caption(_(u"Historic").decode('utf8')).
512                           Left().MinSize(wx.Size(200,500)).Layer(1).Position(1).CloseButton(False).MaximizeButton(True).
513                           MinimizeButton(True))
514         
515         #self.nb = wx.aui.AuiNotebook(self, -1, wx.DefaultPosition, wx.DefaultSize, wx.aui.AUI_NB_DEFAULT_STYLE | wx.aui.AUI_NB_TAB_EXTERNAL_MOVE | wx.aui.AUI_NB_TAB_MOVE | wx.aui.AUI_NB_TAB_FLOAT| wx.NO_BORDER)
516         self.nb = aui.AuiNotebook(self, -1, wx.DefaultPosition, wx.DefaultSize, aui.AUI_NB_DEFAULT_STYLE | aui.AUI_NB_TAB_EXTERNAL_MOVE | aui.AUI_NB_TAB_MOVE | aui.AUI_NB_TAB_FLOAT| wx.NO_BORDER)
517         notebook_flags =  aui.AUI_NB_DEFAULT_STYLE | aui.AUI_NB_TAB_EXTERNAL_MOVE | aui.AUI_NB_TAB_MOVE | aui.AUI_NB_TAB_FLOAT| wx.NO_BORDER
518         self.nb.SetAGWWindowStyleFlag(notebook_flags)
519         self.nb.SetArtProvider(aui.ChromeTabArt())
520         #self.nb.SetArtProvider(aui.VC8TabArt())
521         #self.nb.parent = self
522         #self._notebook_style = aui.AUI_NB_DEFAULT_STYLE | aui.AUI_NB_TAB_EXTERNAL_MOVE | wx.NO_BORDER
523         #self._mgr.AddPane(self.nb, wx.aui.AuiPaneInfo().
524         #                      Name("Tab_content").
525         #                      CenterPane())
526         self._mgr.AddPane(self.nb, aui.AuiPaneInfo().
527                               Name("Tab_content").
528                               CenterPane())        
529         
530         #self._mgr.AddPane(self.Sheet, wx.aui.AuiPaneInfo().Name("Data").CenterPane())
531         #self._mgr.AddPane(self.Sheet, aui.AuiPaneInfo().Name("Data").CenterPane())
532         self.nb.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.OnCloseTab)
533         self.nb.Bind(aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
534         # add the toolbars to the manager
535                         
536         #self._mgr.AddPane(tb1, wx.aui.AuiPaneInfo().
537         #                  Name("tb1").Caption("Fichiers").
538         #                  ToolbarPane().Top().
539         #                  LeftDockable(False).RightDockable(False))
540         self._mgr.AddPane(tb1, aui.AuiPaneInfo().
541                           Name("tb1").Caption("Fichiers").
542                           ToolbarPane().Top().
543                           LeftDockable(True).RightDockable(False))
544         
545         self._mgr.AddPane(tb_text, aui.AuiPaneInfo().
546                           Name("tb_text").Caption("analyse_text").
547                           ToolbarPane().Top().
548                           LeftDockable(True).RightDockable(False))
549         
550         self._mgr.AddPane(tb_mat, aui.AuiPaneInfo().
551                           Name("tb_mat").Caption("analyse_matrix").
552                           ToolbarPane().Top().
553                           LeftDockable(True).RightDockable(False))
554                 
555         self._mgr.AddPane(tb_help, aui.AuiPaneInfo().
556                           Name("tb_help").Caption("help").
557                           ToolbarPane().Top().
558                           LeftDockable(True).RightDockable(False))
559                 
560         self._mgr.GetPane('tb_text').Hide()
561         self._mgr.GetPane('tb_mat').Hide()
562         
563         self.ShowAPane("Intro_Text")
564         self._mgr.GetPane("lefttree").Show()
565         self._mgr.GetPane("classif_tb").Hide()
566         # "commit" all changes made to FrameManager   
567         self._mgr.Update()
568
569         # Show How To Use The Closing Panes Event
570 ##################################################################        
571         self.Bind(wx.EVT_MENU, self.OnAcceuil, id=ID_ACCEUIL)
572         self.Bind(wx.EVT_MENU, self.ShowTab, id=ID_RESULT)
573         self.Bind(wx.EVT_MENU, self.OnOpenData, id=ID_OpenData)
574         self.Bind(wx.EVT_MENU, self.OnOpenText, id=ID_OpenText)
575         self.Bind(wx.EVT_MENU, self.OnOpenAnalyse, id=ID_OnOpenAnalyse)
576         self.Bind(wx.EVT_MENU, self.import_factiva_xml, fact_from_xml)
577         self.Bind(wx.EVT_MENU, self.import_factiva_mail, fact_from_mail)
578         self.Bind(wx.EVT_MENU, self.import_factiva_txt, fact_from_txt)
579         self.Bind(wx.EVT_MENU, self.ExtractTools, splitvar)
580         self.Bind(wx.EVT_MENU, self.ExtractTools, extractmod)
581         self.Bind(wx.EVT_MENU, self.ExtractTools, extractthem)
582         self.Bind(wx.EVT_MENU, self.OnFreq, id=ID_Freq)
583         self.Bind(wx.EVT_MENU, self.OnFreqMulti, id=ID_FreqMulti)
584         self.Bind(wx.EVT_MENU, self.OnChi2, id=ID_Chi2)
585         self.Bind(wx.EVT_MENU, self.OnStudent, id=ID_Student)
586         self.Bind(wx.EVT_MENU, self.OnCHDSIM, id=ID_CHDSIM)
587         self.Bind(wx.EVT_MENU, self.OnCHDReinert, id=ID_CHDReinert)
588         self.Bind(wx.EVT_MENU, self.OnAFCM, id=ID_AFCM)
589         self.Bind(wx.EVT_MENU, self.OnProto, id=ID_proto)
590         self.Bind(wx.EVT_MENU, self.OnSplitVar, id = ID_Splitfromvar)
591         #self.Bind(wx.EVT_MENU, self.OnRCode, id=ID_RCODE)
592         #self.Bind(wx.EVT_MENU, self.OnSplitVar, id=ID_SPLITVAR)
593         #self.Bind(wx.EVT_MENU, self.OnCheckcorpus, id = ID_CHECKCORPUS)
594         self.Bind(wx.EVT_MENU, self.OnTextStat, id=ID_TEXTSTAT)
595         self.Bind(wx.EVT_MENU, self.OnTextSpec, id=ID_ASLEX)
596         self.Bind(wx.EVT_MENU, self.OnTextAfcm, id=ID_TEXTAFCM)
597         self.Bind(wx.EVT_MENU, self.OnTextReinert, id=ID_TEXTREINERT)
598         self.Bind(wx.EVT_MENU, self.OnPamSimple, id=ID_TEXTPAM)
599         self.Bind(wx.EVT_MENU, self.OnSimiTxt, id=ID_SimiTxt)
600         self.Bind(wx.EVT_MENU, self.OnWordCloud, id=ID_WC)
601         self.Bind(wx.EVT_MENU, self.OnSubText, id = ID_Subtxtfrommeta)
602         self.Bind(wx.EVT_MENU, self.OnSubText, id = ID_Subtxtfromthem)
603         self.Bind(wx.EVT_MENU, self.OnSimiTab, id=ID_SIMI)
604         self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT)
605         #self.Bind(wx.EVT_MENU, self.OnSaveTabAs, id=ID_SaveTab)
606         self.Bind(wx.EVT_MENU, self.OnAbout, id=wx.ID_ABOUT)
607         self.Bind(wx.EVT_MENU, self.OnHelp, id=wx.ID_HELP)
608         self.Bind(wx.EVT_MENU, self.OnPref, id=wx.ID_PREFERENCES)
609         self.Bind(wx.EVT_MENU, self.OnImportTXM, id=ID_ImportTXM)
610         self.Bind(wx.EVT_MENU, self.OnImportEuropress, id=ID_ImportEuro)
611         self.Bind(wx.EVT_MENU, self.OnImportDMI, id=ID_importdmi)
612         self.Bind(wx.EVT_MENU, self.OnExportMeta, id=ID_exportmeta)
613         self.Bind(wx.EVT_MENU, self.OnMergeGraph, id = ID_merge)
614         self.Bind(wx.EVT_CLOSE, self.OnClose)
615 ##################################################################
616         flags = self._mgr.GetAGWFlags()
617         #flags &= ~wx.aui.AUI_MGR_TRANSPARENT_HINT
618         #flags &= ~wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT
619         #flags &= ~wx.aui.AUI_MGR_RECTANGLE_HINT
620         flags &= ~(aui.AUI_MGR_RECTANGLE_HINT | aui.AUI_MGR_ALLOW_FLOATING)
621         self._mgr.SetAGWFlags(self._mgr.GetAGWFlags() ^ (aui.AUI_MGR_RECTANGLE_HINT | aui.AUI_MGR_ALLOW_FLOATING))
622         self._mgr.GetArtProvider().SetMetric(aui.AUI_DOCKART_GRADIENT_TYPE, aui.AUI_GRADIENT_HORIZONTAL)
623         self.GetDockArt().SetColor(aui.AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR, "#00FFF9")
624         self.DoUpdate()
625
626         self._icon = wx.Icon(os.path.join(ImagePath, "iraicone.ico"), wx.BITMAP_TYPE_ICO)
627         self.SetIcon(self._icon)
628 ##########################
629         self.ctrl = ""
630         self.input_path = [False]
631         self.TEMPDIR = tempfile.mkdtemp('iramuteq')
632         self.FileTabList = []
633         self.listbar=[]
634         self.DictTab = {}
635         self.FreqNum = 0
636         self.colsep = ''
637         self.txtsep = ''
638         self.g_header = False
639         self.g_id = False
640         self.table = ''
641         self.fileforR = ''
642         self.filename = ''
643         self.nastrings = ''
644         self.encode = ''
645         self.SysEncoding = sys.getdefaultencoding()
646         self.syscoding = sys.getdefaultencoding()
647         #print 'SysEncoding',self.SysEncoding
648         if self.SysEncoding == 'mac-roman' : self.SysEncoding = 'MacRoman'
649         self.type = ''
650
651 ##############################################################@
652         self.ShowMenu('view', True)
653         self.ShowMenu('matrix', False)
654         self.ShowMenu('text', False)
655    
656         self._mgr.Update()
657
658         self.DataPop = False
659         self.DataTxt = False
660         self.Text = ''
661
662         self.lexique = None
663         self.corpus = None
664
665     def finish_init(self) :
666         try :
667             self.pref.read(self.ConfigPath['preferences'])
668             if IsNew(self) :
669                 UpgradeConf(self)
670                 self.pref.read(self.ConfigPath['preferences'])
671                 New = True
672             else :
673                 CopyConf(self)
674                 New = False
675         except :
676             UpgradeConf(self)
677             self.pref.read(self.ConfigPath['preferences'])
678             New = True
679         self.sound = self.pref.getboolean('iramuteq', 'sound')
680         self.check_update = self.pref.getboolean('iramuteq', 'checkupdate')
681         self.version = ConfigGlob.get('DEFAULT', 'version')
682         #configuration des chemins de R
683         self.PathPath = ConfigParser()
684         self.PathPath.read(ConfigPath['path'])
685         BestRPath = False
686         if not CheckRPath(self.PathPath) :
687             if sys.platform == 'win32':
688                 BestRPath = FindRPAthWin32()
689             else:
690                 BestRPath = FindRPathNix()
691             if BestRPath:
692                 self.PathPath.set('PATHS', 'rpath', BestRPath)
693                 with open(ConfigPath['path'], 'w') as f :
694                     self.PathPath.write(f)
695         else:
696             BestRPath = True 
697         if BestRPath :
698             self.RPath = self.PathPath.get('PATHS', 'rpath')
699             if New :
700                 CheckRPackages(self)
701             if not RLibsAreInstalled(self) :
702                 CheckRPackages(self)
703         else :
704             msg = '\n'.join([_(u"Can't find R executable").decode('utf8'), _(u"If R is not installed, get it from http://www.r-project.org.").decode('utf8'),
705                              _(u"If R is installed, report its path in Preferences.").decode('utf8'),
706                              _(u"IRaMuTeQ does not work without R.").decode('utf8')])
707             dlg = wx.MessageDialog(self, msg, _(u"Problem").decode('utf8'), wx.OK | wx.ICON_WARNING)
708             dlg.CenterOnParent()
709             if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
710                 pass
711             dlg.Destroy()
712
713     def setlangue(self) :
714         self.pref.read(self.ConfigPath['preferences'])
715         try :
716             guilangue = self.pref.get('iramuteq', 'guilanguage')
717         except :
718             guilangue = DefaultConf.get('iramuteq', 'guilanguage')
719         self.preslangue.get(guilangue, 'english').install()
720
721     def OnVerif(self, evt) :
722         pack = CheckRPackages(self)
723         if pack :
724             dlg = wx.MessageDialog(self, _(u"Installation OK").decode('utf8'), _(u"Installation").decode('utf8'), wx.OK | wx.ICON_INFORMATION | wx.STAY_ON_TOP)
725             dlg.CenterOnParent()
726             if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
727                 evt.Veto()
728
729     def ShowMenu(self, menu, Show=True):
730         if menu == 'text' :
731             menu_pos = 4
732             if Show :
733                 self._mgr.GetPane('tb_text').Show()
734             else :
735                 self._mgr.GetPane('tb_text').Hide()   
736         elif menu == 'matrix' :
737             menu_pos = 3
738             if Show :
739                 self._mgr.GetPane('tb_mat').Show()
740             else :
741                 self._mgr.GetPane('tb_mat').Hide()           
742         elif menu == 'view' :
743             menu_pos = 2
744         else :
745             menu_pos = None
746             
747         #menu_pos = self.mb.FindMenu(menu)
748         if not menu_pos is None :
749             self.mb.EnableTop(menu_pos, Show)
750             self.mb.UpdateMenus()
751         self._mgr.Update()
752
753 #--------------------------------------------------------------------
754     def OnClose(self, event):
755         print 'onclose'
756         with open(self.ConfigPath['path'], 'w') as f :
757             self.PathPath.write(f)
758         self._mgr.UnInit()
759         del self._mgr
760         self.Destroy()
761
762     def OnOpenData(self, event):
763         inputname, self.input_path = OnOpen(self, "Data")
764         if inputname:
765             #filename = self.input_path[0]
766             self.tableau = Tableau(self,os.path.abspath(self.input_path[0]))
767             val = get_table_param(self, self.input_path[0])
768             if val == wx.ID_OK :
769                 busy = wx.BusyInfo(_("Please wait...").decode('utf8'), self)
770                 wx.SafeYield()
771                 try :
772                     self.tableau.make_content()
773                     OpenAnalyse(self, self.tableau.parametres)
774                     self.tree.OnItemAppend(self.tableau.parametres)
775                     del busy 
776                 except :
777                     del busy
778                     BugReport(self)
779                 #self.tableau.show_tab()
780
781     def OnOpenAnalyse(self, event):
782         self.AnalysePath = OnOpen(self, "Analyse")
783         if self.AnalysePath :
784             OpenAnalyse(self, self.AnalysePath[1][0], True)
785             self.ShowMenu('view')
786
787     def OnOpenText(self, event):
788         inputname, self.input_path = OnOpen(self, "Texte")
789         self.filename = self.input_path[0]
790         if inputname:
791             self.OpenText()
792    
793     def OnSubText(self, evt, corpus = None, parametres = None):
794         if corpus is None :
795             corpus = self.tree.getcorpus()
796         if evt.GetId() == ID_Subtxtfrommeta :
797             parametres = {'frommeta' : True}
798         elif evt.GetId() == ID_Subtxtfromthem :
799             parametres = {'fromtheme' : True}
800         builder = SubBuilder(self, corpus, parametres)
801         if builder.res == wx.ID_OK :
802             busy = wx.BusyInfo(_("Please wait...").decode('utf8'), self)
803             wx.SafeYield()
804             corpus = builder.doanalyse()
805             self.history.add(corpus.parametres)
806             OpenAnalyse(self, corpus.parametres)
807             self.tree.OnItemAppend(corpus.parametres)
808             del busy
809             
810     def OpenText(self):
811         builder =  Builder(self, 5)
812         if builder.res == wx.ID_OK :
813             try :
814                 corpus = builder.doanalyse()
815                 self.history.add(corpus.parametres)
816                 self.tree.OnItemAppend(corpus.parametres)
817                 OpenAnalyse(self, corpus.parametres)
818             except :
819                 builder.dlg.Destroy()
820                 BugReport(self)
821             else :
822                 count = 1
823                 keepGoing = builder.dlg.Update(count, u"Lecture du fichier")
824                 self.ShowMenu('view')
825                 self.ShowMenu('text')
826                 self.ShowMenu('matrix', False)
827                 self.type = "Texte"
828                 self.DataTxt = False
829                 self.Text = ''
830                 count += 1
831                 keepGoing = builder.dlg.Update(count, u"Chargement du dictionnaire")
832                 builder.dlg.Destroy()
833         
834     def OnExit(self, event):
835         self.Close()
836
837     def OnAbout(self, event):
838         info = wx.AboutDialogInfo()
839         info.Name = ConfigGlob.get('DEFAULT', 'name')
840         info.Version = ConfigGlob.get('DEFAULT', 'version')
841         info.Copyright = ConfigGlob.get('DEFAULT', 'copyright')
842         info.Translators = ConfigGlob.get('DEFAULT', 'translators').decode('utf8').split(';')
843         info.Description = u"""
844 Interface de R pour les Analyses Multidimensionnelles 
845 de Textes et de Questionnaires
846
847 Un logiciel libre
848 construit avec des logiciels libres.
849
850 Laboratoire LERASS
851
852 REPERE
853 """
854         info.WebSite = ("http://www.iramuteq.org", u"Site web IRaMuTeQ")
855         dev = ConfigGlob.get('DEFAULT', 'dev').decode('utf8').split(';')
856         info.Developers = dev
857         info.License = u"""Iramuteq est un logiciel libre ; vous pouvez le diffuser et/ou le modifier 
858 suivant les termes de la Licence Publique Générale GNU telle que publiée 
859 par la Free Software Foundation ; soit la version 2 de cette licence, 
860 soit (à votre convenance) une version ultérieure.
861
862 Iramuteq est diffusé dans l'espoir qu'il sera utile, 
863 mais SANS AUCUNE GARANTIE ; sans même une garantie implicite 
864 de COMMERCIALISATION ou d'ADÉQUATION Ã€ UN USAGE PARTICULIER. 
865 Voyez la Licence Publique Générale GNU pour plus de détails.
866
867 Vous devriez avoir reçu une copie de la Licence Publique Générale GNU
868 avec Iramuteq ; sinon, veuillez Ã©crire Ã  la Free Software Foundation,
869 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, Ã‰tats-Unis."""
870         wx.AboutBox(info)
871
872     def GetDockArt(self):
873         return self._mgr.GetArtProvider()
874
875     def DoUpdate(self):
876         self._mgr.Update()
877
878     def OnPageChanged(self, event) :
879         new = event.GetSelection()
880         nobject = event.GetEventObject()
881         parent = nobject.GetParent()
882         if isinstance(parent, IraFrame) :
883             npage = self.nb.GetPage(new)
884             if 'parametres' in dir(npage) :
885                 self.tree.GiveFocus(uuid=npage.parametres['uuid'])
886                 if npage.parametres.get('matrix', False) :
887                     self.ShowMenu('text', False)
888                     self.ShowMenu('matrix', True)
889                 elif npage.parametres.get('corpus', False) :
890                     self.ShowMenu('text')
891                     self.ShowMenu('matrix', False)
892
893     def OnCloseTab(self, evt):
894         #log.info('Closing tab %s' % str(evt.GetEventObject()))
895         ctrl = evt.GetEventObject()
896         if isinstance(ctrl.GetParent(), aui.AuiNotebook) or isinstance(ctrl.GetParent(), wx.Panel):
897             notebook = True
898         else :
899             notebook = False
900         page = self.nb.GetPage(self.nb.GetSelection())
901         if 'parametres' in dir(page) and isinstance(ctrl.GetParent(), IraFrame) :
902             self.history.rmtab(page.parametres)
903             self.tree.CloseItem(uuid = page.parametres['uuid'])
904         TabTitle = self.nb.GetPageText(self.nb.GetSelection())
905
906         if self.nb.GetPageCount() == 1 and not notebook :
907             self.LastTabClose()
908     
909     def LastTabClose(self) :
910         if self.nb.GetPageCount() == 1 :
911             if self.DataTxt :
912                 self.ShowAPane("Text")
913             elif self.DataPop :
914                 self.ShowAPane("Data")
915             else :
916                 self.ShowAPane("Intro_Text")
917
918     def GetStartPosition(self):
919
920         self.x = self.x + 20
921         x = self.x
922         pt = self.ClientToScreen(wx.Point(0, 0))
923         
924         return wx.Point(pt.x + x, pt.y + x)
925     
926     def ShowAPane(self, panel):
927         for pane in self._mgr.GetAllPanes() :
928             if not pane.IsToolbar() and pane.name != 'lefttree': 
929                 pane.Hide()
930         self._mgr.GetPane(panel).Show()
931         self._mgr.Update()
932         
933     def OnAcceuil(self, event):
934         self.ShowAPane(u"Intro_Text")
935         event.Skip()
936     
937     def CreateHTMLCtrl(self):
938         ctrl = wx.html.HtmlWindow(self, -1, wx.DefaultPosition, wx.Size(400, 300))
939         if "gtk2" in wx.PlatformInfo:
940             ctrl.SetStandardFonts()
941         ctrl.SetPage(u"text")        
942         return ctrl
943
944     def ShowTab(self, evt):
945         self.ShowAPane("Tab_content")
946
947 ################################################################
948 #debut des analyses
949 ################################################################
950     def analyse_matrix(self, analyse, analyse_type = '', matrix = None, parametres = None, dlgnb = 1):
951         if matrix is None :
952             matrix = self.tree.getmatrix()
953         if parametres is not None :
954             parametres['type'] = analyse_type
955         else :
956             parametres = {'type' : analyse_type}
957         try :
958         #print 'plus de bug@@@@@@@@@@@@@@@@@@@@@@'
959             analyse(self, matrix, parametres = parametres, dlg = dlgnb)
960         except:
961             BugReport(self)           
962
963     def OnFreq(self, event, matrix = None):
964         self.analyse_matrix(Frequences, analyse_type = 'freq', matrix = matrix, dlgnb = 3)
965     
966     def OnFreqMulti(self, event, matrix = None):
967         self.analyse_matrix(FreqMultiple, analyse_type = 'freqmulti', matrix = matrix, dlgnb = 3)
968
969     def OnChi2(self, event, matrix = None):
970         self.analyse_matrix(ChiSquare, matrix = matrix, analyse_type = 'chi2', dlgnb = 3) 
971
972     def OnSimiTab(self, event, matrix = None):
973         self.analyse_matrix(DoSimi, matrix = matrix, analyse_type = 'simimatrix', dlgnb = 5)
974
975     def OnCHDReinert(self, event, matrix = None):
976         #if matrix is None :
977         #    matrix = self.tree.getmatrix()
978         #AnalyseQuest(self, matrix, parametres = {'type' : 'reinertmatrix'}, dlg = 3)
979         self.analyse_matrix(AnalyseQuest, matrix = matrix, analyse_type = 'reinertmatrix', dlgnb = 5)
980             
981     def OnStudent(self, event):
982         try:
983             MakeStudent(self) 
984         except:
985             BugReport(self)
986
987     def OnRCode(self, event):
988         try:
989             InputText(self)
990         except:
991             BugReport(self)
992
993     def OnCHDSIM(self, event):
994         try:
995         #    print 'ATTENTION!!!!'
996             chdsim = ChdCluster(self)
997             if chdsim.val == wx.ID_OK:
998                 PlaySound(self)
999         except:
1000             BugReport(self)
1001  
1002 #     def OnCHDReinert(self, event):
1003 #         try:
1004 #          #   print('PLUS DE BUG SUR ALCESTE QUESTIONNAIRE')
1005 #             self.quest = AnalyseQuest(self)
1006 #             if self.quest.val == wx.ID_OK:
1007 #                 PlaySound(self)
1008 #         except:
1009 #             BugReport(self)
1010     def OnMergeGraph(self, evt):
1011         #FIXME
1012         AnalyseMerge(self, {'type': 'merge', 'fileout' : '/tmp/test.txt'}, dlg = 5)
1013     
1014     def OnProto(self, evt, matrix = None) :
1015         self.analyse_matrix(Prototypical, matrix = matrix, analyse_type = 'proto', dlgnb = 3) 
1016         #Prototypical(self, {'type' : 'proto'})
1017     
1018     def OnSplitVar(self, evt, matrix = None):
1019         if matrix is None :
1020             matrix = self.tree.getmatrix()
1021         self.analyse_matrix(SplitMatrixFromVar, matrix = matrix, analyse_type = 'splitvar', parametres = {'pathout': matrix.pathout.dirout}, dlgnb = 3)
1022         #matrix = self.tree.getmatrix()
1023         
1024
1025     def OnSimiTxt(self, evt, corpus = None) :
1026         #    print 'PLUS DE BUG SUR SIMITXT'
1027         try :
1028             #self.Text = SimiTxt(self)
1029             if corpus is None :
1030                 corpus = self.tree.getcorpus()            
1031             self.Text = SimiTxt(self, corpus, parametres = {'type': 'simitxt'}, dlg = 3)
1032             if self.Text.val == wx.ID_OK :
1033                 PlaySound(self)
1034         except :
1035             BugReport(self)
1036     
1037     def OnWordCloud(self, evt, corpus = None) :
1038         #    print 'PLUS DE BUG SUR WORDCLOUD'
1039         try :
1040             if corpus is None :
1041                 corpus = self.tree.getcorpus()            
1042             self.Text = WordCloud(self, corpus, parametres = {'type' : 'wordcloud'}, dlg = 3)
1043             if self.Text.val == wx.ID_OK :
1044                 PlaySound(self)
1045         except :
1046             BugReport(self)
1047
1048     def OnClusterCloud(self, corpus, parametres = None) :
1049         self.Text = ClusterCloud(self, corpus, parametres = parametres, dlg = 3)
1050
1051     def OnAFCM(self, event):
1052         try:
1053             DoAFCM(self)
1054         except:
1055             BugReport(self)
1056
1057     def OnTextStat(self, event, corpus = None):
1058             #print 'PAS DE BUG SUR TEXT STAT'
1059         try:
1060             if corpus is None :
1061                 corpus = self.tree.getcorpus()
1062             self.Text = Stat(self, corpus, parametres = {'type': 'stat'}, dlg = 7)
1063             
1064             if self.Text.val == wx.ID_OK :
1065                 PlaySound(self)
1066         except:
1067             BugReport(self)
1068         
1069     def OnTextSpec(self, event, corpus = None):  
1070         try:
1071             #self.Text = AsLexico(self)
1072             #print('ATTENTION : PLUS DE BUG SUR LEXICO')
1073             if corpus is None :
1074                 corpus = self.tree.getcorpus()
1075             self.Text = Lexico(self, corpus, parametres = {'type' : 'spec'}, dlg = 3)
1076             if self.Text.val == wx.ID_OK :
1077                 PlaySound(self)
1078         except:
1079             BugReport(self)
1080     
1081     def OnTextAfcm(self, event):
1082         try:
1083             AfcUci(self)
1084             PlaySound(self)
1085         except:
1086             BugReport(self)
1087
1088     def import_factiva_xml(self,event):
1089         try :
1090             ImportFactiva(self, 'xml')
1091         except :
1092             BugReport(self)
1093
1094     def import_factiva_mail(self, evt) :
1095         try :
1096             ImportFactiva(self, 'mail')
1097         except :
1098             BugReport(self)
1099
1100     def import_factiva_txt(self, evt) :
1101         try :
1102             ImportFactiva(self, 'txt')
1103         except :
1104             BugReport(self)
1105
1106     def OnImportTXM(self, evt) :
1107         try :
1108             ImportFactiva(self, 'txm')
1109         except :
1110             BugReport(self)
1111     
1112     def OnImportEuropress(self, evt) :
1113         try :
1114             ImportFactiva(self, 'euro')
1115         except :
1116             BugReport(self)
1117     
1118     def OnImportDMI(self, evt):
1119         ImportDMI(self, {})
1120     
1121     def OnExportMeta(self, evt, corpus = None):
1122         if corpus is None :
1123             corpus = self.tree.getcorpus()
1124         try :
1125             ExportMetaTable(self, corpus)
1126         except :
1127             BugReport(self) 
1128
1129     def ExtractTools(self, evt) :
1130         ID = evt.GetId()
1131         if ID == self.ID_splitvar :
1132             Extract(self, 'splitvar')
1133         elif ID == self.ID_extractmod :
1134             Extract(self, 'mods')
1135         elif ID == self.ID_extractthem :
1136             Extract(self, 'them')
1137
1138     def OnTextReinert(self, event, corpus = None):
1139         try:
1140             #print('ATTENTION : PLUS DE BUG SUR ALCESTE')
1141             #RunAnalyse(self, corpus, Alceste, OptAlceste)
1142             if corpus is None :
1143                 corpus = self.tree.getcorpus()            
1144             self.Text = Reinert(self, corpus, parametres = {'type': 'alceste'}, dlg = 6)
1145             if self.Text.val == wx.ID_OK:
1146                 PlaySound(self)
1147         except:
1148             BugReport(self)
1149
1150     def OnPamSimple(self, event, corpus = None):
1151         try:
1152             if corpus is None :
1153                 corpus = self.tree.getcorpus()
1154             self.Text = AnalysePam(self, corpus, parametres = {'type' : 'pamtxt'}, dlg = 6)
1155             if self.Text.val == wx.ID_OK:
1156                 PlaySound(self)
1157         except:
1158             BugReport(self)
1159
1160     def SimiCluster(self, parametres = {}, fromprof = False, tableau = None) :
1161         self.analyse_matrix(DoSimi, parametres = parametres, analyse_type = 'simiclustermatrix', matrix = tableau, dlgnb = 5)
1162     
1163 #    def OnSimi(self,evt):
1164 #        try :
1165             #print 'ATTENTION !!!! VERGES'
1166             #print 'PLUS DE BUG SUR SIMI'
1167 #            self.res = DoSimi(self, param = None)
1168             #self.res = Verges(self)
1169 #            if self.res.val == wx.ID_OK :
1170 #                PlaySound(self)
1171 #        except :
1172 #            BugReport(self)
1173 #################################################################
1174
1175     def OnHelp(self, event):
1176         webbrowser.open('http://www.iramuteq.org/documentation')
1177     
1178     def OnPref(self, event):
1179         dlg = PrefDialog(self)
1180         dlg.CenterOnParent()
1181         self.val = dlg.ShowModal()
1182         dlg.Destroy()
1183
1184     def Upgrade(self) :
1185         if self.check_update:
1186             NewVersion(self)
1187         else:
1188             print 'pas de verif'    
1189         #IsNew(self)
1190         #CheckRPackages(self)
1191
1192     def OnOpenFromCmdl(self):
1193         truepath = True
1194         if options.filename :
1195             if os.path.exists(options.filename):
1196                 self.filename = os.path.abspath(options.filename)
1197             else:
1198                 truepath = False
1199         elif args :
1200             if os.path.exists(os.path.realpath(args[0])):
1201                 self.filename = os.path.abspath(os.path.realpath(args[0]))
1202             else:
1203                 truepath = False
1204         else:
1205             return
1206         if truepath :
1207             if os.path.splitext(self.filename)[1] in ['.csv', '.xls', '.ods']:
1208                 self.tableau = Tableau(self, self.filename)
1209                 val = get_table_param(self, self.filename)
1210                 if val == wx.ID_OK :
1211                     self.tableau.make_content()
1212                     OpenAnalyse(self, self.tableau.parametres)
1213                     self.tree.OnItemAppend(self.tableau.parametres)
1214                 #get_table_param(self, self.filename)
1215                 #self.tableau.make_content()
1216                 #self.tableau.show_tab()
1217                 #open_data(self, self.filename)
1218             elif os.path.splitext(self.filename)[1] == '.txt':
1219                 self.OpenText()
1220             elif os.path.splitext(self.filename)[1] == '.ira' :
1221                 #self.corpus = Corpus(self)
1222                 #self.Text = OpenAnalyse(self, self.filename)
1223                 OpenAnalyse(self, self.filename)
1224         if not truepath:
1225             print 'This file does not exist'
1226             
1227         
1228
1229 class IntroPanel(wx.Panel):
1230     def __init__(self, parent):
1231         wx.Panel.__init__(self, parent)
1232         #col = randint(0, 255)
1233         #col1 = randint(0,255)
1234         #col2 = randint(0,255)
1235         #col = 57
1236         col = 161
1237         col1 = 198
1238         col2 = 224
1239         bckgrdcolor = wx.Colour(col, col1, col2)
1240         self.SetBackgroundColour(bckgrdcolor)
1241         txtcolour = wx.Colour(250, 250, 250)
1242         linkcolor = wx.Colour(255, 0, 0)
1243         sizer1 = wx.BoxSizer(wx.VERTICAL)
1244         sizer2 = wx.BoxSizer(wx.VERTICAL)
1245         sizer4 = wx.BoxSizer(wx.HORIZONTAL)
1246         grid_sizer_1 = wx.FlexGridSizer(1, 4, 0, 0)
1247         grid_sizer_3 = wx.FlexGridSizer(1, 4, 0, 0)
1248         grid_sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
1249         
1250         iralink = hl.HyperLinkCtrl(self, wx.ID_ANY, u"http://www.iramuteq.org", URL="http://www.iramuteq.org")
1251         iralink.SetColours(linkcolor, linkcolor, "RED")
1252         iralink.SetBackgroundColour(bckgrdcolor)
1253         iralink.EnableRollover(True)
1254         iralink.SetUnderlines(False, False, True)
1255         iralink.SetBold(True)
1256         iralink.UpdateLink()
1257         
1258         PanelPres = wx.Panel(self)
1259         bckgrdcolor = wx.Colour(randint(0, 255), randint(0, 255), randint(0, 255))
1260         PanelPres.SetBackgroundColour(bckgrdcolor)
1261         
1262         label_1 = wx.StaticText(self, -1, u"IRaMuTeQ", size=(-1, -1))
1263         label_1.SetFont(wx.Font(46, wx.TELETYPE, wx.NORMAL, wx.BOLD, 0, "Purisa"))
1264         label_1.SetForegroundColour(wx.RED)
1265         
1266         iraicone = wx.Image(os.path.join(ImagePath,'iraicone100x100.png'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1267         but_ira = wx.StaticBitmap(self, -1, bitmap = iraicone)
1268
1269         
1270         label2 = wx.StaticText(PanelPres, -1 , u'\nVersion ' + ConfigGlob.get('DEFAULT', 'version') + '\n')
1271         label2.SetForegroundColour(txtcolour)
1272         label2.SetBackgroundColour(bckgrdcolor)
1273         self.hyper2 = hl.HyperLinkCtrl(PanelPres, wx.ID_ANY, u"REPERE", URL="http://repere.no-ip.org/")
1274         self.hyper2.SetColours(linkcolor, linkcolor, "RED")
1275         self.hyper2.SetBackgroundColour(bckgrdcolor)
1276         self.hyper2.EnableRollover(True)
1277         self.hyper2.SetUnderlines(False, False, True)
1278         self.hyper2.SetBold(True)
1279         self.hyper2.UpdateLink()
1280         
1281         label_lerass = wx.StaticText(PanelPres, -1, u'Laboratoire ')
1282         label_lerass.SetForegroundColour(txtcolour)
1283         label_lerass.SetBackgroundColour(bckgrdcolor)
1284         
1285         self.hyper_lerass = hl.HyperLinkCtrl(PanelPres, -1, u'LERASS', URL="http://www.lerass.com")
1286         self.hyper_lerass.SetColours(linkcolor, linkcolor, "RED")
1287         self.hyper_lerass.SetBackgroundColour(bckgrdcolor)
1288         self.hyper_lerass.EnableRollover(True)
1289         self.hyper_lerass.SetUnderlines(False, False, True)
1290         self.hyper_lerass.SetBold(True)
1291         self.hyper_lerass.UpdateLink()
1292         
1293         blank = wx.StaticText(PanelPres, -1, u'\n')
1294         blank1 = wx.StaticText(PanelPres, -1, u'\n')
1295         
1296         labellicence = wx.StaticText(PanelPres, -1, _(u"License GNU GPL").decode('utf8'))
1297         labellicence.SetForegroundColour(txtcolour)
1298         labellicence.SetBackgroundColour(bckgrdcolor)
1299         
1300         labelcopy = wx.StaticText(PanelPres, -1, ConfigGlob.get('DEFAULT', 'copyright'))
1301         labelcopy.SetForegroundColour(txtcolour)
1302         labelcopy.SetBackgroundColour(bckgrdcolor)
1303         
1304         python_img = wx.Image(os.path.join(ImagePath,'python-logo.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1305         r_img = wx.Image(os.path.join(ImagePath,'Rlogo.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1306         lexique_img = wx.Image(os.path.join(ImagePath,'LexTexte4.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1307         but_python = wx.BitmapButton(self, -1, python_img)
1308         but_lexique = wx.BitmapButton(self, -1, lexique_img)
1309         but_r = wx.BitmapButton(self, -1, r_img)
1310         self.Bind(wx.EVT_BUTTON, self.OnPython, but_python)
1311         self.Bind(wx.EVT_BUTTON, self.OnLexique, but_lexique)
1312         self.Bind(wx.EVT_BUTTON, self.OnR, but_r)
1313         
1314         
1315         grid_sizer_1.Add(self.hyper2, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1316         grid_sizer_3.Add(label_lerass, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1317         grid_sizer_3.Add(self.hyper_lerass, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1318         sizer4.Add(label_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5)
1319         
1320         sizer2.Add(label2, 0, wx.ALIGN_CENTER, 5)
1321         sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1322         sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1323         sizer2.Add(grid_sizer_3, 0, wx.ALIGN_CENTER, 5)
1324         sizer2.Add(wx.StaticText(PanelPres, -1, u' '), 0, wx.ALIGN_CENTER, 5)
1325         sizer2.Add(grid_sizer_1, 0, wx.ALIGN_CENTER, 5)
1326         sizer2.Add(labellicence, 0, wx.ALIGN_CENTER, 5)
1327         sizer2.Add(labelcopy, 0, wx.ALIGN_CENTER, 5)
1328         sizer1.Add(sizer4, 2, wx.ALIGN_CENTER_HORIZONTAL, 0)
1329         sizer1.Add(but_ira, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5)
1330         sizer1.Add(iralink, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_TOP, 5)
1331         sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 10)
1332         PanelPres.SetSizer(sizer2)
1333         grid_sizer_2.Add(but_python, 1, wx.ALIGN_BOTTOM)
1334         grid_sizer_2.Add(but_lexique, 1, wx.ALIGN_BOTTOM)
1335         grid_sizer_2.Add(but_r, 1,  wx.ALIGN_BOTTOM)
1336         
1337         sizer1.Add(PanelPres, 0, wx.EXPAND |wx.ALL, 10)
1338         sizer1.Add(grid_sizer_2, 2, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 1)
1339         self.SetSizer(sizer1)
1340         sizer1.Fit(self)
1341     
1342     def OnPython(self,evt):
1343         webbrowser.open('http://www.python.org')
1344     
1345     def OnLexique(self,evt):
1346         webbrowser.open('http://www.lexique.org')
1347         
1348     def OnR(self,evt):
1349         webbrowser.open('http://www.r-project.org')
1350
1351 class MySplashScreen(wx.SplashScreen):
1352     def __init__(self):
1353         bmp = wx.Image(os.path.join(ImagePath, 'splash.png')).ConvertToBitmap()
1354         wx.SplashScreen.__init__(self, bmp,
1355                                  wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
1356                                  1000, None, -1)
1357         self.Bind(wx.EVT_CLOSE, self.OnClose)
1358         self.fc = wx.FutureCall(1, self.ShowMain)
1359
1360     def OnClose(self, evt):
1361         evt.Skip()
1362         self.Hide()
1363         
1364         if self.fc.IsRunning():
1365             self.fc.Stop()
1366             self.ShowMain()
1367
1368     def ShowMain(self):
1369         displaySize = wx.DisplaySize()
1370         w = displaySize[0]/1.2
1371         h = displaySize[1]/1.2
1372         frame = IraFrame(None, -1, "IRaMuTeQ " + ConfigGlob.get('DEFAULT', 'version'), size=(w, h))
1373         frame.Show()
1374         frame.finish_init()
1375         frame.Upgrade()
1376         frame.OnOpenFromCmdl()
1377 #        if self.fc.IsRunning():
1378 #            self.Raise()
1379         #wx.CallAfter(frame.ShowTip)
1380         
1381 class MyApp(wx.App):
1382     def OnInit(self):
1383         """
1384         Create and show the splash screen.  It will then create and show
1385         the main frame when it is time to do so.
1386         """
1387         wx.SystemOptions.SetOptionInt("mac.window-plain-transition", 1)
1388         self.SetAppName("Iramuteq")       
1389         splash = MySplashScreen()
1390         splash.Show()
1391         return True
1392
1393 def main():
1394     app = MyApp(False)
1395     app.MainLoop()
1396
1397 if __name__ == '__main__':
1398     __name__ = 'Main'
1399     main()