2 # -*- coding: utf-8 -*-
3 #Author: Pierre Ratinaud
4 #Copyright (c) 2008-2012, Pierre Ratinaud
7 from optparse import OptionParser
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()
23 from random import randint
24 from ConfigParser import *
28 #------------------------------------
31 import wx.lib.agw.aui as aui
34 import wx.lib.hyperlink as hl
35 #------------------------------------
36 from functions import BugReport, PlaySound, ReadLexique, History, DoConf, ReadDicoAsDico, progressbar
37 from checkversion import NewVersion
38 from guifunct import *
39 from tableau import Tableau
40 from dialog import PrefDialog, CorpusPref
41 from tabfrequence import Frequences
42 from tabchi2 import ChiSquare
43 #from tabstudent import MakeStudent
44 from tabchddist import ChdCluster
45 from tabafcm import DoAFCM
46 from tabchdalc import AnalyseQuest
47 from tabsimi import DoSimi
48 from tabrsimple import InputText
49 from tabverges import Prototypical
50 #from textafcuci import AfcUci
51 from textdist import AnalysePam
52 from textstat import Stat
53 from textaslexico import Lexico
54 from textsimi import SimiTxt, SimiFromCluster
55 from textwordcloud import WordCloud, ClusterCloud
56 from textreinert import Reinert
57 #from profile_segment import ProfileSegment
58 #from textcheckcorpus import checkcorpus
59 from openanalyse import OpenAnalyse
60 from corpus import Builder, SubBuilder
61 #from sheet import MySheet
62 from checkinstall import CreateIraDirectory, CheckRPath, FindRPAthWin32, FindRPathNix, CheckRPackages, IsNew, UpgradeConf, CopyConf, RLibsAreInstalled
63 from chemins import RscriptsPath, ConstructConfigPath, ConstructDicoPath, ConstructGlobalPath, PathOut
64 from parse_factiva_xml import ImportFactiva
65 from tools import Extract
67 from tree import LeftTree
68 ##########################################################
69 ID_OpenData = wx.NewId()
70 ID_Import = wx.NewId()
71 ID_OpenText = wx.NewId()
72 ID_OnOpenAnalyse = wx.NewId()
75 ID_Student = wx.NewId()
76 ID_CHDSIM = wx.NewId()
77 ID_CHDReinert = wx.NewId()
78 ID_TEXTAFCM = wx.NewId()
79 ID_TEXTSTAT = wx.NewId()
81 ID_TEXTREINERT = wx.NewId()
82 ID_TEXTPAM = wx.NewId()
83 ID_CHECKCORPUS = wx.NewId()
84 ID_Tabcontent = wx.NewId()
87 ID_CloseTab = wx.NewId()
88 ID_SaveTab = wx.NewId()
89 ID_CreateText = wx.NewId()
90 ID_ACCEUIL = wx.NewId()
91 ID_RESULT = wx.NewId()
92 ID_VIEWDATA = wx.NewId()
93 ID_HTMLcontent = wx.NewId()
94 ID_SimiTxt = wx.NewId()
96 ID_ImportTXM = wx.NewId()
97 ##########################################################
98 #elements de configuration
99 ##########################################################
101 if sys.platform == 'darwin' :
102 sys.setdefaultencoding('UTF-8')
103 wx.SetDefaultPyEncoding('UTF-8')
105 sys.setdefaultencoding(locale.getpreferredencoding())
107 #chemin de l'application
108 AppliPath = os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0])))
110 ImagePath = os.path.join(AppliPath, 'images')
111 #configuration generale
112 DictConfigPath = ConstructGlobalPath(AppliPath)
113 ConfigGlob = ConfigParser()
114 ConfigGlob.read(DictConfigPath['global'])
115 #repertoire de l'utilisateur
116 if os.getenv('HOME') != None:
117 user_home = os.getenv('HOME')
119 user_home = os.getenv('HOMEPATH')
120 UserConfigPath = os.path.abspath(os.path.join(user_home, '.iramuteq'))
121 #Si pas de fichiers de config utilisateur, on cree le repertoire
122 CreateIraDirectory(UserConfigPath, AppliPath)
123 #fichiers log pour windows (py2exe)
124 log = logging.getLogger('iramuteq')
125 fh = logging.FileHandler(os.path.join(UserConfigPath,'stdout.log'))
126 formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
127 fh.setFormatter(formatter)
129 if sys.platform != 'win32' and sys.platform != 'darwin':
130 ch = logging.StreamHandler()
131 ch.setFormatter(formatter)
133 log.setLevel(logging.INFO)
135 class writer(object):
136 def write(self, data):
137 if data.strip() != '' :
138 log.info('ERROR : %s' % data)
140 class printer(object) :
141 def write(self, data) :
142 if data.strip() != '' :
143 log.info('Print : %s' % data)
145 sys.stderr = writer()
146 sys.stdout = printer()
148 ConfigPath = ConstructConfigPath(UserConfigPath)
150 langues = {'french' : wx.LANGUAGE_FRENCH,
151 'english' : wx.LANGUAGE_ENGLISH,}
152 #####################################################################
154 class IraFrame(wx.Frame):
155 def __init__(self, parent, id= -1, title="", pos=wx.DefaultPosition,
156 size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE |
159 log.info('Starting...')
160 wx.Frame.__init__(self, parent, id, title, pos, size, style)
162 self.AppliPath = AppliPath
163 self.images_path = os.path.join(AppliPath,'images')
164 self.UserConfigPath = UserConfigPath
165 #self.RscriptsPath = ConstructRscriptsPath(AppliPath)
166 self.RscriptsPath = PathOut(dirout=os.path.join(AppliPath, 'Rscripts'))
167 self.RscriptsPath.basefiles(RscriptsPath)
168 #self.DictPath = ConstructDicoPath(AppliPath)
169 self.DictPath = ConstructDicoPath(UserConfigPath)
170 self.ConfigGlob = ConfigGlob
171 self.ConfigPath = ConstructConfigPath(UserConfigPath)
172 self.pref = RawConfigParser()
173 #workaround for import problem
174 self.SimiFromCluster = SimiFromCluster
176 gettext.install('iramuteq', os.path.join(AppliPath,'locale'), unicode=True)
177 self.presLan_fr = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=['fr_FR'])
178 self.presLan_en = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=['en'])
180 # tell FrameManager to manage this frame
181 #self._mgr = wx.aui.AuiManager()
182 self._mgr = aui.AuiManager()
183 self._mgr.SetManagedWindow(self)
186 #--------------------------------------------------------------------------------
187 self.mb = wx.MenuBar()
189 file_menu = wx.Menu()
190 item = wx.MenuItem(file_menu, ID_OpenData, _(u"Open a matrix").decode('utf8'), _(u"Open a matrix").decode('utf8'))
191 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
192 file_menu.AppendItem(item)
194 item = wx.MenuItem(file_menu, ID_OpenText, _(u"Open a text corpora").decode('utf8'), _(u"Open a text corpora").decode('utf8'))
195 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
196 file_menu.AppendItem(item)
198 item = wx.MenuItem(file_menu, ID_OnOpenAnalyse, _(u"Open an analysis").decode('utf8'), _(u"Open an analysis").decode('utf8'))
199 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
200 file_menu.AppendItem(item)
203 menuFactiva = wx.Menu()
204 fact_from_xml = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from xml").decode('utf8'))
205 fact_from_mail = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from mail").decode('utf8'))
206 fact_from_txt = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from copy/paste").decode('utf8'))
207 menuFactiva.AppendItem(fact_from_xml)
208 menuFactiva.AppendItem(fact_from_mail)
209 menuFactiva.AppendItem(fact_from_txt)
210 file_menu.AppendMenu(-1, _(u"Import from factiva").decode('utf8'), menuFactiva)
212 item = wx.MenuItem(file_menu, ID_ImportTXM, _(u"Import from TXM").decode('utf8'), _(u"Import from TXM").decode('utf8'))
213 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
214 file_menu.AppendItem(item)
216 menuTools = wx.Menu()
217 splitvar = wx.MenuItem(menuTools, wx.ID_ANY, _(u"Split from variable").decode('utf8'))
218 extractmod = wx.MenuItem(menuTools, wx.ID_ANY, _(u"Extract mods").decode('utf8'))
219 extractthem = wx.MenuItem(menuTools, wx.ID_ANY, _(u"Extract thematics").decode('utf8'))
220 menuTools.AppendItem(splitvar)
221 menuTools.AppendItem(extractmod)
222 menuTools.AppendItem(extractthem)
223 self.ID_splitvar = splitvar.GetId()
224 self.ID_extractmod = extractmod.GetId()
225 self.ID_extractthem = extractthem.GetId()
226 file_menu.AppendMenu(-1, _(u"Tools"), menuTools)
229 #item = wx.MenuItem(file_menu, ID_SaveTab, _(u"Save tab as...").decode('utf8'), _(u"Save tab as...").decode('utf8'))
230 #item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_SAVE_AS))
231 #file_menu.AppendItem(item)
233 file_menu.Append(wx.ID_EXIT, _(u"Exit").decode('utf8'))
235 edit_menu = wx.Menu()
236 edit_menu.Append(wx.ID_PREFERENCES, '', _(u'Preferences').decode('utf8'))
238 view_menu = wx.Menu()
239 view_menu.Append(ID_ACCEUIL, _(u"Home page").decode('utf8'))
240 view_menu.Append(ID_VIEWDATA, _(u"Show data").decode('utf8'))
241 view_menu.Append(ID_RESULT, _(u'Show results').decode('utf8'))
242 #view_menu.AppendSeparator()
244 analyse_menu = wx.Menu()
245 analyse_menu.Append(ID_Freq, _(u"Frequencies").decode('utf8'))
246 analyse_menu.Append(ID_Chi2, _(u"Chi2").decode('utf8'))
247 #analyse_menu.Append(ID_Student, u"t de Student")
248 menu_classif = wx.Menu()
249 menu_classif.Append(ID_CHDReinert, _(u"Reinert's Method").decode('utf8'))
250 #menu_classif.Append(ID_CHDSIM, u"Par matrice des distances")
251 analyse_menu.AppendMenu(-1, _(u"Clustering").decode('utf8'), menu_classif)
252 #analyse_menu.Append(ID_AFCM, u"AFCM")
253 analyse_menu.Append(ID_SIMI, _(u"Similarities Analysis").decode('utf8'))
254 analyse_menu.Append(ID_proto, _(u"Prototypical analysis").decode('utf8'))
255 ID_RCODE = wx.NewId()
256 analyse_menu.Append(ID_RCODE, u"Code R...")
258 text_menu = wx.Menu()
259 #text_menu.Append(ID_CHECKCORPUS, u"Vérifier le corpus")
260 text_menu.Append(ID_TEXTSTAT, _(u"Statistics").decode('utf8'))
261 text_menu.Append(ID_ASLEX, _(u"Specificities and CA").decode('utf8'))
262 #text_menu.Append(ID_TEXTAFCM, u"AFC sur UCI / Vocabulaire")
263 menu_classiftxt = wx.Menu()
264 menu_classiftxt.Append(ID_TEXTREINERT, _(u"Reinert's Method").decode('utf8'))
265 #menu_classiftxt.Append(ID_TEXTPAM, u"Par matrice des distances")
266 text_menu.AppendMenu(-1, _(u"Clustering").decode('utf8'), menu_classiftxt)
267 text_menu.Append(ID_SimiTxt, _(u"Similarities Analysis").decode('utf8'))
269 text_menu.Append(ID_WC, _(u"WordCloud").decode('utf8'))
271 help_menu = wx.Menu()
272 help_menu.Append(wx.ID_ABOUT, _(u"About...").decode('utf8'))
273 help_menu.Append(wx.ID_HELP, _(u"Inline help...").decode('utf8'))
275 self.mb.Append(file_menu, _(u"File").decode('utf8'))
276 self.mb.Append(edit_menu, _(u"Edition").decode('utf8'))
277 self.mb.Append(view_menu, _(u"View").decode('utf8'))
278 self.mb.Append(analyse_menu, _("Matrix analysis").decode('utf8'))
279 self.mb.Append(text_menu, _(u"Text analysis").decode('utf8'))
280 self.mb.Append(help_menu, _(u"Help").decode('utf8'))
282 self.SetMenuBar(self.mb)
283 #--------------------------------------------------------------------
284 self.statusbar = self.CreateStatusBar(2, wx.ST_SIZEGRIP)
285 self.statusbar.SetStatusWidths([-2, -3])
286 self.statusbar.SetStatusText(u"Prêt", 0)
287 self.statusbar.SetStatusText(u"Bienvenue", 1)
289 # min size for the frame itself isn't completely done.
290 # see the end up FrameManager::Update() for the test
291 # code. For now, just hard code a frame minimum size
292 self.SetMinSize(wx.Size(400, 400))
294 # create some toolbars
295 tb1 = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize,
296 wx.TB_FLAT | wx.TB_NODIVIDER)
297 tb1.SetToolBitmapSize(wx.Size(16, 16))
298 tb1.AddLabelTool(ID_OpenData, "OpenData", wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, wx.Size(16, 16)), shortHelp="Questionnaire", longHelp="Ouvrir un questionnaire")
300 tb1.AddLabelTool(ID_OpenText, "OpenText", wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, wx.Size(16, 16)), shortHelp="Texte", longHelp="Ouvrir un corpus texte")
304 #------------------------------------------------------------------------------------------------
306 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)
308 #self._mgr.AddPane(self.text_ctrl_txt, wx.aui.AuiPaneInfo().
309 # Name("Text").CenterPane())
310 self._mgr.AddPane(self.text_ctrl_txt, aui.AuiPaneInfo().
311 Name("Text").CenterPane())
312 #self._mgr.AddPane(IntroPanel(self), wx.aui.AuiPaneInfo().Name("Intro_Text").
314 self._mgr.AddPane(IntroPanel(self), aui.AuiPaneInfo().Name("Intro_Text").
316 #if not os.path.exists(os.path.join(UserConfigPath, 'history.db')) :
317 # with open(os.path.join(UserConfigPath, 'history.db'), 'w') as f :
319 self.history = History(os.path.join(UserConfigPath, 'history.db'))
320 self.tree = LeftTree(self)
321 self._mgr.AddPane(self.tree, aui.AuiPaneInfo().Name("lefttree").Caption(_(u"Navigator").decode('utf8')).
322 Left().MinSize(wx.Size(200,500)).Layer(1).Position(1).CloseButton(False).MaximizeButton(True).
323 MinimizeButton(True))
325 #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)
326 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)
327 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
328 self.nb.SetAGWWindowStyleFlag(notebook_flags)
329 self.nb.SetArtProvider(aui.ChromeTabArt())
330 #self.nb.SetArtProvider(aui.VC8TabArt())
331 #self.nb.parent = self
332 #self._notebook_style = aui.AUI_NB_DEFAULT_STYLE | aui.AUI_NB_TAB_EXTERNAL_MOVE | wx.NO_BORDER
333 #self._mgr.AddPane(self.nb, wx.aui.AuiPaneInfo().
334 # Name("Tab_content").
336 self._mgr.AddPane(self.nb, aui.AuiPaneInfo().
340 #self._mgr.AddPane(self.Sheet, wx.aui.AuiPaneInfo().Name("Data").CenterPane())
341 #self._mgr.AddPane(self.Sheet, aui.AuiPaneInfo().Name("Data").CenterPane())
342 self.nb.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.OnCloseTab)
343 self.nb.Bind(aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
344 # add the toolbars to the manager
346 #self._mgr.AddPane(tb1, wx.aui.AuiPaneInfo().
347 # Name("tb1").Caption("Fichiers").
348 # ToolbarPane().Top().
349 # LeftDockable(False).RightDockable(False))
350 self._mgr.AddPane(tb1, aui.AuiPaneInfo().
351 Name("tb1").Caption("Fichiers").
353 LeftDockable(True).RightDockable(False))
355 self.ShowAPane("Intro_Text")
356 self._mgr.GetPane("lefttree").Show()
357 self._mgr.GetPane("classif_tb").Hide()
358 # "commit" all changes made to FrameManager
361 # Show How To Use The Closing Panes Event
362 ##################################################################
363 self.Bind(wx.EVT_MENU, self.OnAcceuil, id=ID_ACCEUIL)
364 self.Bind(wx.EVT_MENU, self.OnViewData, id=ID_VIEWDATA)
365 self.Bind(wx.EVT_MENU, self.ShowTab, id=ID_RESULT)
366 self.Bind(wx.EVT_MENU, self.OnOpenData, id=ID_OpenData)
367 self.Bind(wx.EVT_MENU, self.OnOpenText, id=ID_OpenText)
368 self.Bind(wx.EVT_MENU, self.OnOpenAnalyse, id=ID_OnOpenAnalyse)
369 self.Bind(wx.EVT_MENU, self.import_factiva_xml, fact_from_xml)
370 self.Bind(wx.EVT_MENU, self.import_factiva_mail, fact_from_mail)
371 self.Bind(wx.EVT_MENU, self.import_factiva_txt, fact_from_txt)
372 self.Bind(wx.EVT_MENU, self.ExtractTools, splitvar)
373 self.Bind(wx.EVT_MENU, self.ExtractTools, extractmod)
374 self.Bind(wx.EVT_MENU, self.ExtractTools, extractthem)
375 self.Bind(wx.EVT_MENU, self.OnFreq, id=ID_Freq)
376 self.Bind(wx.EVT_MENU, self.OnChi2, id=ID_Chi2)
377 self.Bind(wx.EVT_MENU, self.OnStudent, id=ID_Student)
378 self.Bind(wx.EVT_MENU, self.OnCHDSIM, id=ID_CHDSIM)
379 self.Bind(wx.EVT_MENU, self.OnCHDReinert, id=ID_CHDReinert)
380 self.Bind(wx.EVT_MENU, self.OnAFCM, id=ID_AFCM)
381 self.Bind(wx.EVT_MENU, self.OnProto, id=ID_proto)
382 self.Bind(wx.EVT_MENU, self.OnRCode, id=ID_RCODE)
383 #self.Bind(wx.EVT_MENU, self.OnCheckcorpus, id = ID_CHECKCORPUS)
384 self.Bind(wx.EVT_MENU, self.OnTextStat, id=ID_TEXTSTAT)
385 self.Bind(wx.EVT_MENU, self.OnTextSpec, id=ID_ASLEX)
386 self.Bind(wx.EVT_MENU, self.OnTextAfcm, id=ID_TEXTAFCM)
387 self.Bind(wx.EVT_MENU, self.OnTextReinert, id=ID_TEXTREINERT)
388 self.Bind(wx.EVT_MENU, self.OnPamSimple, id=ID_TEXTPAM)
389 self.Bind(wx.EVT_MENU, self.OnSimiTxt, id=ID_SimiTxt)
390 self.Bind(wx.EVT_MENU, self.OnWordCloud, id=ID_WC)
391 self.Bind(wx.EVT_MENU, self.OnSimiTab, id=ID_SIMI)
392 self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT)
393 #self.Bind(wx.EVT_MENU, self.OnSaveTabAs, id=ID_SaveTab)
394 self.Bind(wx.EVT_MENU, self.OnAbout, id=wx.ID_ABOUT)
395 self.Bind(wx.EVT_MENU, self.OnHelp, id=wx.ID_HELP)
396 self.Bind(wx.EVT_MENU, self.OnPref, id=wx.ID_PREFERENCES)
397 self.Bind(wx.EVT_MENU, self.OnImportTXM, id=ID_ImportTXM)
398 self.Bind(wx.EVT_CLOSE, self.OnClose)
399 ##################################################################
400 flags = self._mgr.GetAGWFlags()
401 #flags &= ~wx.aui.AUI_MGR_TRANSPARENT_HINT
402 #flags &= ~wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT
403 #flags &= ~wx.aui.AUI_MGR_RECTANGLE_HINT
404 flags &= ~(aui.AUI_MGR_RECTANGLE_HINT | aui.AUI_MGR_ALLOW_FLOATING)
405 self._mgr.SetAGWFlags(self._mgr.GetAGWFlags() ^ (aui.AUI_MGR_RECTANGLE_HINT | aui.AUI_MGR_ALLOW_FLOATING))
406 self._mgr.GetArtProvider().SetMetric(aui.AUI_DOCKART_GRADIENT_TYPE, aui.AUI_GRADIENT_HORIZONTAL)
407 self.GetDockArt().SetColor(aui.AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR, "#00FFF9")
410 self._icon = wx.Icon(os.path.join(ImagePath, "iraicone.ico"), wx.BITMAP_TYPE_ICO)
411 self.SetIcon(self._icon)
412 ##########################
414 self.input_path = [False]
415 self.TEMPDIR = tempfile.mkdtemp('iramuteq')
416 self.FileTabList = []
422 self.g_header = False
429 self.SysEncoding = sys.getdefaultencoding()
430 self.syscoding = sys.getdefaultencoding()
431 #print 'SysEncoding',self.SysEncoding
432 if self.SysEncoding == 'mac-roman' : self.SysEncoding = 'MacRoman'
435 ##############################################################@
436 self.DisEnSaveTabAs(False)
437 self.ShowMenu(_("View").decode('utf8'), False)
438 self.ShowMenu(_("Matrix analysis").decode('utf8'), False)
439 self.ShowMenu(_("Text analysis").decode('utf8'), False)
450 def finish_init(self) :
452 self.pref.read(self.ConfigPath['preferences'])
455 self.pref.read(self.ConfigPath['preferences'])
462 self.pref.read(self.ConfigPath['preferences'])
464 self.sound = self.pref.getboolean('iramuteq', 'sound')
465 self.check_update = self.pref.getboolean('iramuteq', 'checkupdate')
466 self.version = ConfigGlob.get('DEFAULT', 'version')
467 #configuration des chemins de R
468 self.PathPath = ConfigParser()
469 self.PathPath.read(ConfigPath['path'])
471 if not CheckRPath(self.PathPath) :
472 if sys.platform == 'win32':
473 BestRPath = FindRPAthWin32()
475 BestRPath = FindRPathNix()
477 self.PathPath.set('PATHS', 'rpath', BestRPath)
478 with open(ConfigPath['path'], 'w') as f :
479 self.PathPath.write(f)
483 self.RPath = self.PathPath.get('PATHS', 'rpath')
486 if not RLibsAreInstalled(self) :
490 Le chemin de l'executable de R n'a pas été trouvé.
491 Si R n'est pas installé, vous devez l'installer (http://www.r-project.org/).
492 Si R n'est pas installé dans le répertoire par défaut
493 (souvent C:\Program Files\R\R-2.x.x\R.exe sous windows ou /usr/bin/R sous linux ou Mac Os X)
494 vous devez signaler le chemin de l'éxecutable de R dans les préférences."""
495 dlg = wx.MessageDialog(self, msg, u"Problème de configuration", wx.OK | wx.NO_DEFAULT | wx.ICON_WARNING)
497 if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
502 def setlangue(self) :
504 self.pref.read(self.ConfigPath['preferences'])
505 guilangue = self.pref.get('iramuteq', 'guilanguage')
506 if guilangue == 'french' :
507 self.presLan_fr.install()
509 self.presLan_en.install()
510 mylocale = wx.Locale(langues[guilangue])
511 mylocale.AddCatalogLookupPathPrefix(os.path.join(AppliPath,'locale'))
512 mylocale.AddCatalog('iramuteq')
514 self.presLan_fr.install()
515 mylocale = wx.Locale(langues['french'])
516 mylocale.AddCatalogLookupPathPrefix(os.path.join(AppliPath,'locale'))
517 mylocale.AddCatalog('iramuteq')
520 def OnVerif(self, evt) :
521 pack = CheckRPackages(self)
523 dlg = wx.MessageDialog(self, u"Installation OK", u"Installation", wx.OK | wx.ICON_INFORMATION)
525 if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
528 def DisEnSaveTabAs(self, DISEN):
530 file_menu = self.mb.GetMenu(0)
531 items = file_menu.GetMenuItems()
533 if item.GetId() == ID_SaveTab :
536 def ShowMenu(self, menu, Show=True):
537 menu_pos = self.mb.FindMenu(menu)
538 self.mb.EnableTop(menu_pos, Show)
539 self.mb.UpdateMenus()
542 #--------------------------------------------------------------------
543 def OnClose(self, event):
545 with open(self.ConfigPath['path'], 'w') as f :
546 self.PathPath.write(f)
547 if self.DictTab != {} :
548 savestates = [self.DictTab[item][0] for item in self.DictTab]
549 if False in savestates :
550 notsave = [item for item in self.DictTab if self.DictTab[item][0] == False]
552 Certains résultats ne sont pas enregistrés.
553 Voulez-vous fermer quand même ?"""
554 dlg = wx.MessageDialog(self, msg, "Sauvegarde",
555 wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
557 if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
562 for item in notsave :
563 for tmpfile in self.DictTab[item][1:] :
565 print 'remove : ' + tmpfile
577 #if sys.platform == 'win32' :
578 # os.system("taskkill /im iramuteq.exe /f")
579 # print 'meurtre de process'
581 def OnOpenData(self, event):
582 inputname, self.input_path = OnOpen(self, "Data")
584 #filename = self.input_path[0]
585 self.tableau = Tableau(self,os.path.abspath(self.input_path[0]))
586 val = get_table_param(self, self.input_path[0])
588 self.tableau.make_content()
589 OpenAnalyse(self, self.tableau.parametres)
590 self.tree.OnItemAppend(self.tableau.parametres)
591 #self.tableau.show_tab()
593 def OnOpenAnalyse(self, event):
594 self.AnalysePath = OnOpen(self, "Analyse")
595 OpenAnalyse(self, self.AnalysePath[1][0], True)
596 self.ShowMenu(_("View"))
598 def OnOpenText(self, event):
599 inputname, self.input_path = OnOpen(self, "Texte")
600 self.filename = self.input_path[0]
604 def OnViewData(self, event):
607 if self.type == "Data":
608 if not self.DataPop :
609 self.Sheet.Populate(self.content)
612 self.ShowAPane(u"Data")
613 elif self.type == "Texte" or self.type == 'Analyse' :
614 if not self.DataTxt :
615 self.text_ctrl_txt.Clear()
616 self.text_ctrl_txt.write(self.content)
617 self.text_ctrl_txt.ShowPosition(0)
620 self.ShowAPane(u"Text")
623 def OnSubText(self, corpus, parametres = None):
624 busy = wx.BusyInfo(_("Please wait...").decode('utf8'), self)
626 builder = SubBuilder(self, corpus, parametres)
628 if builder.res == wx.ID_OK :
629 corpus = builder.doanalyse()
630 self.history.add(corpus.parametres)
631 self.tree.OnItemAppend(corpus.parametres)
632 OpenAnalyse(self, corpus.parametres)
635 dlg = wx.ProgressDialog("Ouverture...",
636 "Veuillez patienter...",
639 style=wx.PD_APP_MODAL | wx.PD_AUTO_HIDE | wx.PD_ELAPSED_TIME | wx.PD_CAN_ABORT
642 builder = Builder(self, dlg)
643 if builder.res == wx.ID_OK :
645 corpus = builder.doanalyse()
646 self.history.add(corpus.parametres)
647 self.tree.OnItemAppend(corpus.parametres)
648 OpenAnalyse(self, corpus.parametres)
653 keepGoing = dlg.Update(count, u"Lecture du fichier")
654 self.ShowMenu(_(u"View").decode('utf8'))
655 self.ShowMenu(_(u"Text analysis").decode('utf8'))
656 self.ShowMenu(_(u"Matrix analysis").decode('utf8'), False)
661 keepGoing = dlg.Update(count, u"Chargement du dictionnaire")
663 #self.OnViewData(wx.EVT_BUTTON)
665 def OnExit(self, event):
668 def OnAbout(self, event):
669 info = wx.AboutDialogInfo()
670 info.Name = ConfigGlob.get('DEFAULT', 'name')
671 info.Version = ConfigGlob.get('DEFAULT', 'version')
672 info.Copyright = ConfigGlob.get('DEFAULT', 'copyright')
673 info.Description = u"""
674 Interface de R pour les Analyses Multidimensionnelles
675 de Textes et de Questionnaires
678 construit avec des logiciels libres.
684 info.WebSite = ("http://www.iramuteq.org", u"Site web IRaMuTeQ")
685 dev = ConfigGlob.get('DEFAULT', 'dev').split(';')
686 info.Developers = dev
687 info.License = u"""Iramuteq est un logiciel libre ; vous pouvez le diffuser et/ou le modifier
688 suivant les termes de la Licence Publique Générale GNU telle que publiée
689 par la Free Software Foundation ; soit la version 2 de cette licence,
690 soit (à votre convenance) une version ultérieure.
692 Iramuteq est diffusé dans l'espoir qu'il sera utile,
693 mais SANS AUCUNE GARANTIE ; sans même une garantie implicite
694 de COMMERCIALISATION ou d'ADÉQUATION À UN USAGE PARTICULIER.
695 Voyez la Licence Publique Générale GNU pour plus de détails.
697 Vous devriez avoir reçu une copie de la Licence Publique Générale GNU
698 avec Iramuteq ; sinon, veuillez écrire à la Free Software Foundation,
699 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, États-Unis."""
702 def GetDockArt(self):
703 return self._mgr.GetArtProvider()
708 def OnPageChanged(self, event) :
709 new = event.GetSelection()
710 nobject = event.GetEventObject()
711 parent = nobject.GetParent()
712 if isinstance(parent, IraFrame) :
713 npage = self.nb.GetPage(new)
714 if 'parametres' in dir(npage) :
715 self.tree.GiveFocus(uuid=npage.parametres['uuid'])
716 if npage.parametres.get('matrix', False) :
717 self.ShowMenu(_(u"Text analysis").decode('utf8'), False)
718 self.ShowMenu(_(u"Matrix analysis").decode('utf8'), True)
719 elif npage.parametres.get('corpus', False) :
720 self.ShowMenu(_(u"Text analysis").decode('utf8'))
721 self.ShowMenu(_(u"Matrix analysis").decode('utf8'), False)
723 def OnCloseTab(self, evt):
724 #log.info('Closing tab %s' % str(evt.GetEventObject()))
725 ctrl = evt.GetEventObject()
726 if isinstance(ctrl.GetParent(), aui.AuiNotebook) or isinstance(ctrl.GetParent(), wx.Panel):
730 page = self.nb.GetPage(self.nb.GetSelection())
731 if 'parametres' in dir(page) and isinstance(ctrl.GetParent(), IraFrame) :
732 self.history.rmtab(page.parametres)
733 self.tree.CloseItem(uuid = page.parametres['uuid'])
734 TabTitle = self.nb.GetPageText(self.nb.GetSelection())
735 # if self.DictTab != {} :
736 # if TabTitle in self.DictTab :
737 # ListFile=self.DictTab[TabTitle]
738 # if False in ListFile:
740 # Certains résultats ne sont pas enregistrer.
741 # Voulez-vous fermer quand même ?"""
742 # dlg = wx.MessageDialog(self, msg, "Sauvegarde",wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
744 # dlg.CenterOnParent()
745 # if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
750 # for f in ListFile[1:] :
755 # elif True in ListFile :
758 # del self.DictTab[TabTitle]
760 # self.LastTabClose()
763 if self.nb.GetPageCount() == 1 and not notebook :
766 def LastTabClose(self) :
767 if self.nb.GetPageCount() == 1 :
768 #self.DisEnSaveTabAs(False)
770 self.ShowAPane("Text")
772 self.ShowAPane("Data")
774 self.ShowAPane("Intro_Text")
776 # def OnSaveTabAs(self, event):
777 # SelectTab = self.nb.GetSelection()
778 # TabTitle = self.nb.GetPageText(SelectTab)
779 # FileToSave = self.DictTab[TabTitle]
781 # dlg = wx.FileDialog(
782 # self, message="Enregistrer sous...", defaultDir=os.getcwd(),
783 # defaultFile="resultat.html", wildcard="Tous les fichiers|*", style=wx.SAVE | wx.OVERWRITE_PROMPT
785 # dlg.SetFilterIndex(2)
786 # dlg.CenterOnParent()
788 # if dlg.ShowModal() == wx.ID_OK:
789 # Path = dlg.GetPath()
790 # Dirname = os.path.dirname(Path)
791 # Filename = dlg.GetFilename()
796 # shutil.copyfile(FileToSave[-1], Path)
797 # os.remove(FileToSave[len(FileToSave) - 1])
798 # NewListFile.append(True)
799 # NewListFile.append(Path)
800 # for f in FileToSave[1:-1] :
801 # Fileout = os.path.join(Dirname, os.path.basename(f))
802 # shutil.copyfile(f, Fileout)
803 # NewListFile.append(Fileout)
806 # self.DictTab[TabText] = NewListFile
807 # del self.DictTab[TabTitle]
808 # self.nb.SetPageText(SelectTab, TabText)
810 def GetStartPosition(self):
814 pt = self.ClientToScreen(wx.Point(0, 0))
816 return wx.Point(pt.x + x, pt.y + x)
818 def ShowAPane(self, panel):
819 for pane in self._mgr.GetAllPanes() :
820 if not pane.IsToolbar() and pane.name != 'lefttree':
822 self._mgr.GetPane(panel).Show()
825 def OnAcceuil(self, event):
826 self.ShowAPane(u"Intro_Text")
829 def CreateHTMLCtrl(self):
830 ctrl = wx.html.HtmlWindow(self, -1, wx.DefaultPosition, wx.Size(400, 300))
831 if "gtk2" in wx.PlatformInfo:
832 ctrl.SetStandardFonts()
833 ctrl.SetPage(u"text")
836 def ShowTab(self, evt):
837 self.ShowAPane("Tab_content")
839 ################################################################
841 ################################################################
842 def analyse_matrix(self, evt, analyse, analyse_type = '', matrix = None, dlgnb = 1):
844 matrix = self.tree.getmatrix()
846 analyse(self, matrix, parametres = {'type' : analyse_type}, dlg = progressbar(self, dlgnb))
850 def OnFreq(self, event, matrix = None):
851 self.analyse_matrix(event, Frequences, analyse_type = 'freq', matrix = matrix, dlgnb = 3)
853 # matrix = self.tree.getmatrix()
855 # Frequences(self, matrix, parametres = {'type' : 'freq'}, dlg = progressbar(self, 3))
859 def OnChi2(self, event, matrix = None):
861 self.analyse_matrix(event, ChiSquare, matrix = matrix, analyse_type = 'chi2', dlgnb = 3)
865 def OnSimiTab(self, event, matrix = None):
867 matrix = self.tree.getmatrix()
869 DoSimi(self, matrix, parametres = {'type' : 'simimatrix'}, dlg = progressbar(self, 3))
873 def OnCHDReinert(self, event, matrix = None):
875 matrix = self.tree.getmatrix()
876 AnalyseQuest(self, matrix, parametres = {'type' : 'reinertmatrix'}, dlg = progressbar(self, 3))
878 def OnStudent(self, event):
884 def OnRCode(self, event):
890 def OnCHDSIM(self, event):
892 # print 'ATTENTION!!!!'
893 chdsim = ChdCluster(self)
894 if chdsim.val == wx.ID_OK:
899 # def OnCHDReinert(self, event):
901 # # print('PLUS DE BUG SUR ALCESTE QUESTIONNAIRE')
902 # self.quest = AnalyseQuest(self)
903 # if self.quest.val == wx.ID_OK:
908 def OnProto(self, evt) :
909 Prototypical(self, {'type' : 'proto'})
911 def OnSimiTxt(self, evt, corpus = None) :
912 # print 'PLUS DE BUG SUR SIMITXT'
914 #self.Text = SimiTxt(self)
916 corpus = self.tree.getcorpus()
917 self.Text = SimiTxt(self, corpus, parametres = {'type': 'simitxt'}, dlg = progressbar(self, 3))
918 if self.Text.val == wx.ID_OK :
923 def OnWordCloud(self, evt, corpus = None) :
924 # print 'PLUS DE BUG SUR WORDCLOUD'
927 corpus = self.tree.getcorpus()
928 self.Text = WordCloud(self, corpus, parametres = {'type' : 'wordcloud'}, dlg = progressbar(self, 3))
929 if self.Text.val == wx.ID_OK :
934 def OnClusterCloud(self, corpus, parametres = None) :
935 self.Text = ClusterCloud(self, corpus, parametres = parametres, dlg = progressbar(self, 3))
937 def OnAFCM(self, event):
943 def OnTextStat(self, event, corpus = None):
944 #print 'PAS DE BUG SUR TEXT STAT'
947 corpus = self.tree.getcorpus()
948 self.Text = Stat(self, corpus, parametres = {'type': 'stat'}, dlg = progressbar(self, 7))
950 if self.Text.val == wx.ID_OK :
955 def OnTextSpec(self, event, corpus = None):
957 #self.Text = AsLexico(self)
958 #print('ATTENTION : PLUS DE BUG SUR LEXICO')
960 corpus = self.tree.getcorpus()
961 self.Text = Lexico(self, corpus, parametres = {'type' : 'spec'}, dlg = progressbar(self, 3))
962 if self.Text.val == wx.ID_OK :
967 def OnTextAfcm(self, event):
974 def import_factiva_xml(self,event):
976 ImportFactiva(self, 'xml')
980 def import_factiva_mail(self, evt) :
982 ImportFactiva(self, 'mail')
986 def import_factiva_txt(self, evt) :
988 ImportFactiva(self, 'txt')
992 def OnImportTXM(self, evt) :
994 ImportFactiva(self, 'txm')
998 def ExtractTools(self, evt) :
1000 if ID == self.ID_splitvar :
1001 Extract(self, 'splitvar')
1002 elif ID == self.ID_extractmod :
1003 Extract(self, 'mods')
1004 elif ID == self.ID_extractthem :
1005 Extract(self, 'them')
1007 def OnTextReinert(self, event, corpus = None):
1009 #print('ATTENTION : PLUS DE BUG SUR ALCESTE')
1010 #RunAnalyse(self, corpus, Alceste, OptAlceste)
1012 corpus = self.tree.getcorpus()
1013 self.Text = Reinert(self, corpus, parametres = {'type': 'alceste'}, dlg = progressbar(self,6))
1014 if self.Text.val == wx.ID_OK:
1019 def OnPamSimple(self, event, corpus = None):
1022 corpus = self.tree.getcorpus()
1023 self.Text = AnalysePam(self, corpus, parametres = {'type' : 'pamtxt'}, dlg = progressbar(self,6))
1024 if self.Text.val == wx.ID_OK:
1029 def SimiCluster(self, parametres = {}, fromprof = False, pathout = '', listactives = [], actives = [], tableau = None) :
1030 DoSimi(self, param = parametres, fromprof = fromprof, listactives = listactives, actives = actives, tableau = tableau)
1032 # def OnSimi(self,evt):
1034 #print 'ATTENTION !!!! VERGES'
1035 #print 'PLUS DE BUG SUR SIMI'
1036 # self.res = DoSimi(self, param = None)
1037 #self.res = Verges(self)
1038 # if self.res.val == wx.ID_OK :
1042 #################################################################
1044 def OnHelp(self, event):
1045 webbrowser.open('http://www.iramuteq.org/documentation')
1047 def OnPref(self, event):
1048 dlg = PrefDialog(self)
1049 dlg.CenterOnParent()
1050 self.val = dlg.ShowModal()
1053 if self.check_update:
1056 print 'pas de verif'
1058 #CheckRPackages(self)
1060 def OnOpenFromCmdl(self):
1062 if options.filename :
1063 if os.path.exists(options.filename):
1064 self.filename = os.path.abspath(options.filename)
1068 if os.path.exists(os.path.realpath(args[0])):
1069 self.filename = os.path.abspath(os.path.realpath(args[0]))
1075 if os.path.splitext(self.filename)[1] in ['.csv', '.xls', '.ods']:
1076 self.tableau = Tableau(self, self.filename)
1077 get_table_param(self, self.filename)
1078 self.tableau.make_content()
1079 self.tableau.show_tab()
1080 #open_data(self, self.filename)
1081 elif os.path.splitext(self.filename)[1] == '.txt':
1083 elif os.path.splitext(self.filename)[1] == '.ira' :
1084 #self.corpus = Corpus(self)
1085 #self.Text = OpenAnalyse(self, self.filename)
1086 OpenAnalyse(self, self.filename)
1088 print 'ce fichier n\'existe pas'
1092 class IntroPanel(wx.Panel):
1093 def __init__(self, parent):
1094 wx.Panel.__init__(self, parent)
1095 col = randint(0, 255)
1096 col1 = randint(0,255)
1097 col2 = randint(0,255)
1099 bckgrdcolor = wx.Colour(col, col1, col2)
1100 self.SetBackgroundColour(bckgrdcolor)
1101 txtcolour = wx.Colour(250, 250, 250)
1102 linkcolor = wx.Colour(255, 0, 0)
1103 sizer1 = wx.BoxSizer(wx.VERTICAL)
1104 sizer2 = wx.BoxSizer(wx.VERTICAL)
1105 sizer3 = wx.BoxSizer(wx.HORIZONTAL)
1106 sizer4 = wx.BoxSizer(wx.VERTICAL)
1107 sizer5 = wx.BoxSizer(wx.HORIZONTAL)
1108 grid_sizer_1 = wx.FlexGridSizer(1, 4, 0, 0)
1109 grid_sizer_3 = wx.FlexGridSizer(1, 4, 0, 0)
1110 grid_sizer_2 = wx.FlexGridSizer(1, 3, 0, 0)
1111 PanelPres = wx.Panel(self)
1112 PanelPres.SetBackgroundColour(bckgrdcolor)
1113 label_1 = wx.StaticText(self, -1, u"IRaMuTeQ", size=(-1, -1))
1114 label_1.SetFont(wx.Font(46, wx.TELETYPE, wx.NORMAL, wx.BOLD, 0, "Purisa"))
1115 label_1.SetForegroundColour(wx.RED)
1116 label2 = wx.StaticText(PanelPres, -1 , u'\nVersion ' + ConfigGlob.get('DEFAULT', 'version') + '\n')
1117 label2.SetForegroundColour(txtcolour)
1118 label2.SetBackgroundColour(bckgrdcolor)
1119 #label3 = wx.StaticText(PanelPres, -1 , u'Equipe ')
1120 #label3.SetForegroundColour(txtcolour)
1121 #label3.SetBackgroundColour(bckgrdcolor)
1122 self.hyper2 = hl.HyperLinkCtrl(PanelPres, wx.ID_ANY, u"REPERE", URL="http://repere.no-ip.org/")
1123 self.hyper2.SetColours(linkcolor, linkcolor, "RED")
1124 self.hyper2.SetBackgroundColour(bckgrdcolor)
1125 self.hyper2.EnableRollover(True)
1126 self.hyper2.SetUnderlines(False, False, True)
1127 self.hyper2.SetBold(True)
1128 self.hyper2.UpdateLink()
1129 label_lerass = wx.StaticText(PanelPres, -1, u'Laboratoire ')
1130 label_lerass.SetForegroundColour(txtcolour)
1131 label_lerass.SetBackgroundColour(bckgrdcolor)
1132 self.hyper_lerass = hl.HyperLinkCtrl(PanelPres, -1, u'LERASS', URL="http://www.lerass.com")
1133 self.hyper_lerass.SetColours(linkcolor, linkcolor, "RED")
1134 self.hyper_lerass.SetBackgroundColour(bckgrdcolor)
1135 self.hyper_lerass.EnableRollover(True)
1136 self.hyper_lerass.SetUnderlines(False, False, True)
1137 self.hyper_lerass.SetBold(True)
1138 self.hyper_lerass.UpdateLink()
1139 blank = wx.StaticText(PanelPres, -1, u'\n')
1140 blank1 = wx.StaticText(PanelPres, -1, u'\n')
1141 labellicence = wx.StaticText(PanelPres, -1, _(u"License GNU GPL").decode('utf8'))
1142 labellicence.SetForegroundColour(txtcolour)
1143 labellicence.SetBackgroundColour(bckgrdcolor)
1144 labelcopy = wx.StaticText(PanelPres, -1, ConfigGlob.get('DEFAULT', 'copyright'))
1145 labelcopy.SetForegroundColour(txtcolour)
1146 labelcopy.SetBackgroundColour(bckgrdcolor)
1147 python_img = wx.Image(os.path.join(ImagePath,'python-logo.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1148 r_img = wx.Image(os.path.join(ImagePath,'Rlogo.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1149 lexique_img = wx.Image(os.path.join(ImagePath,'LexTexte4.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1150 but_python = wx.BitmapButton(self, -1, python_img)
1151 but_lexique = wx.BitmapButton(self, -1, lexique_img)
1152 but_r = wx.BitmapButton(self, -1, r_img)
1153 self.Bind(wx.EVT_BUTTON, self.OnPython, but_python)
1154 self.Bind(wx.EVT_BUTTON, self.OnLexique, but_lexique)
1155 self.Bind(wx.EVT_BUTTON, self.OnR, but_r)
1158 #grid_sizer_1.Add(label3, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1159 grid_sizer_1.Add(self.hyper2, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1160 grid_sizer_3.Add(label_lerass, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1161 grid_sizer_3.Add(self.hyper_lerass, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1162 sizer4.Add(label_1, 0, wx.ALIGN_CENTER, 5)
1163 sizer2.Add(label2, 0, wx.ALIGN_CENTER, 5)
1164 #sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1165 sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1166 sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1167 sizer2.Add(grid_sizer_3, 0, wx.ALIGN_CENTER, 5)
1168 sizer2.Add(wx.StaticText(PanelPres, -1, u' '), 0, wx.ALIGN_CENTER, 5)
1169 #sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1170 #sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1171 sizer2.Add(grid_sizer_1, 0, wx.ALIGN_CENTER, 5)
1172 sizer2.Add(labellicence, 0, wx.ALIGN_CENTER, 5)
1173 sizer2.Add(labelcopy, 0, wx.ALIGN_CENTER, 5)
1174 sizer1.Add(sizer4, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1175 PanelPres.SetSizer(sizer2)
1176 sizer5.Add(blank, 1, wx.EXPAND | wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 2)
1177 sizer5.Add(PanelPres, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1178 sizer5.Add(blank1, 1, wx.ALIGN_CENTER_HORIZONTAL,2)
1179 grid_sizer_2.Add(but_python, 1, wx.ALIGN_CENTER_HORIZONTAL| wx.ALIGN_CENTER_VERTICAL)
1180 grid_sizer_2.Add(but_lexique, 1,wx.ALIGN_CENTER_HORIZONTAL| wx.ALIGN_CENTER_VERTICAL)
1181 grid_sizer_2.Add(but_r, 1, wx.ALIGN_CENTER_HORIZONTAL| wx.ALIGN_CENTER_VERTICAL)
1183 sizer1.Add(sizer5, 3, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 1)
1184 sizer1.Add(grid_sizer_2, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL)
1185 self.SetSizer(sizer1)
1188 def OnPython(self,evt):
1189 webbrowser.open('http://www.python.org')
1191 def OnLexique(self,evt):
1192 webbrowser.open('http://www.lexique.org')
1195 webbrowser.open('http://www.r-project.org')
1197 class MySplashScreen(wx.SplashScreen):
1199 bmp = wx.Image(os.path.join(ImagePath, 'splash.png')).ConvertToBitmap()
1200 wx.SplashScreen.__init__(self, bmp,
1201 wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
1203 self.Bind(wx.EVT_CLOSE, self.OnClose)
1204 self.fc = wx.FutureCall(1, self.ShowMain)
1206 def OnClose(self, evt):
1210 if self.fc.IsRunning():
1215 frame = IraFrame(None, -1, "IRaMuTeQ " + ConfigGlob.get('DEFAULT', 'version'), size=(1100, 800))
1219 frame.OnOpenFromCmdl()
1220 # if self.fc.IsRunning():
1222 #wx.CallAfter(frame.ShowTip)
1224 class MyApp(wx.App):
1227 Create and show the splash screen. It will then create and show
1228 the main frame when it is time to do so.
1230 wx.SystemOptions.SetOptionInt("mac.window-plain-transition", 1)
1231 self.SetAppName("Iramuteq")
1232 splash = MySplashScreen()
1240 if __name__ == '__main__':