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 tabsplitvar import SplitMatrixFromVar
51 #from textafcuci import AfcUci
52 from textdist import AnalysePam
53 from textstat import Stat
54 from textaslexico import Lexico
55 from textsimi import SimiTxt, SimiFromCluster
56 from textwordcloud import WordCloud, ClusterCloud
57 from textreinert import Reinert
58 #from profile_segment import ProfileSegment
59 #from textcheckcorpus import checkcorpus
60 from openanalyse import OpenAnalyse
61 from corpus import Builder, SubBuilder
62 #from sheet import MySheet
63 from checkinstall import CreateIraDirectory, CheckRPath, FindRPAthWin32, FindRPathNix, CheckRPackages, IsNew, UpgradeConf, CopyConf, RLibsAreInstalled
64 from chemins import RscriptsPath, ConstructConfigPath, ConstructDicoPath, ConstructGlobalPath, PathOut
65 from parse_factiva_xml import ImportFactiva
66 from tools import Extract
68 from tree import LeftTree
69 ##########################################################
70 ID_OpenData = wx.NewId()
71 ID_Import = wx.NewId()
72 ID_OpenText = wx.NewId()
73 ID_OnOpenAnalyse = wx.NewId()
76 ID_Student = wx.NewId()
77 ID_CHDSIM = wx.NewId()
78 ID_CHDReinert = wx.NewId()
79 ID_TEXTAFCM = wx.NewId()
80 ID_TEXTSTAT = wx.NewId()
82 ID_TEXTREINERT = wx.NewId()
83 ID_TEXTPAM = wx.NewId()
84 ID_CHECKCORPUS = wx.NewId()
85 ID_Tabcontent = wx.NewId()
88 ID_CloseTab = wx.NewId()
89 ID_SaveTab = wx.NewId()
90 ID_CreateText = wx.NewId()
91 ID_ACCEUIL = wx.NewId()
92 ID_RESULT = wx.NewId()
93 ID_VIEWDATA = wx.NewId()
94 ID_HTMLcontent = wx.NewId()
95 ID_SimiTxt = wx.NewId()
97 ID_ImportTXM = wx.NewId()
98 ##########################################################
99 #elements de configuration
100 ##########################################################
102 if sys.platform == 'darwin' :
103 sys.setdefaultencoding('UTF-8')
104 wx.SetDefaultPyEncoding('UTF-8')
106 sys.setdefaultencoding(locale.getpreferredencoding())
108 #chemin de l'application
109 AppliPath = os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0])))
111 ImagePath = os.path.join(AppliPath, 'images')
112 #configuration generale
113 DictConfigPath = ConstructGlobalPath(AppliPath)
114 ConfigGlob = ConfigParser()
115 ConfigGlob.read(DictConfigPath['global'])
116 #repertoire de l'utilisateur
117 if os.getenv('HOME') != None:
118 user_home = os.getenv('HOME')
120 user_home = os.getenv('HOMEPATH')
121 UserConfigPath = os.path.abspath(os.path.join(user_home, '.iramuteq'))
122 #Si pas de fichiers de config utilisateur, on cree le repertoire
123 CreateIraDirectory(UserConfigPath, AppliPath)
124 #fichiers log pour windows (py2exe)
125 log = logging.getLogger('iramuteq')
126 fh = logging.FileHandler(os.path.join(UserConfigPath,'stdout.log'))
127 formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
128 fh.setFormatter(formatter)
130 if sys.platform != 'win32' and sys.platform != 'darwin':
131 ch = logging.StreamHandler()
132 ch.setFormatter(formatter)
134 log.setLevel(logging.INFO)
136 class writer(object):
137 def write(self, data):
138 if data.strip() != '' :
139 log.info('ERROR : %s' % data)
141 class printer(object) :
142 def write(self, data) :
143 if data.strip() != '' :
144 log.info('Print : %s' % data)
146 sys.stderr = writer()
147 sys.stdout = printer()
149 ConfigPath = ConstructConfigPath(UserConfigPath)
151 langues = {'french' : wx.LANGUAGE_FRENCH,
152 'english' : wx.LANGUAGE_ENGLISH,
153 'portuguese' : wx.LANGUAGE_PORTUGUESE,
154 'italian' : wx.LANGUAGE_ITALIAN,
155 'spanish' : wx.LANGUAGE_SPANISH}
157 code_langues = {'french' : 'fr_FR',
159 'portuguese' : 'pt_PT',
163 #####################################################################
165 class IraFrame(wx.Frame):
166 def __init__(self, parent, id= -1, title="", pos=wx.DefaultPosition,
167 size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE |
170 log.info('Starting...')
171 wx.Frame.__init__(self, parent, id, title, pos, size, style)
173 self.AppliPath = AppliPath
174 self.images_path = os.path.join(AppliPath,'images')
175 self.UserConfigPath = UserConfigPath
176 #self.RscriptsPath = ConstructRscriptsPath(AppliPath)
177 self.RscriptsPath = PathOut(dirout=os.path.join(AppliPath, 'Rscripts'))
178 self.RscriptsPath.basefiles(RscriptsPath)
179 #self.DictPath = ConstructDicoPath(AppliPath)
180 self.DictPath = ConstructDicoPath(UserConfigPath)
181 self.ConfigGlob = ConfigGlob
182 self.ConfigPath = ConstructConfigPath(UserConfigPath)
183 self.pref = RawConfigParser()
184 #workaround for import problem
185 self.SimiFromCluster = SimiFromCluster
187 gettext.install('iramuteq', os.path.join(AppliPath,'locale'), unicode=True)
188 #langues = ['fr_FR', 'en', 'pt_PT']
192 for langue in code_langues :
193 self.preslangue[langue] = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=[code_langues[langue]])
195 #self.presLan_fr = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=['fr_FR'])
196 #self.presLan_en = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=['en'])
198 # tell FrameManager to manage this frame
199 #self._mgr = wx.aui.AuiManager()
200 self._mgr = aui.AuiManager()
201 self._mgr.SetManagedWindow(self)
204 #--------------------------------------------------------------------------------
205 self.mb = wx.MenuBar()
207 file_menu = wx.Menu()
208 item = wx.MenuItem(file_menu, ID_OpenData, _(u"Open a matrix").decode('utf8'), _(u"Open a matrix").decode('utf8'))
209 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
210 file_menu.AppendItem(item)
212 item = wx.MenuItem(file_menu, ID_OpenText, _(u"Open a text corpus").decode('utf8'), _(u"Open a text corpus").decode('utf8'))
213 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
214 file_menu.AppendItem(item)
216 item = wx.MenuItem(file_menu, ID_OnOpenAnalyse, _(u"Open an analysis").decode('utf8'), _(u"Open an analysis").decode('utf8'))
217 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
218 file_menu.AppendItem(item)
221 menuFactiva = wx.Menu()
222 fact_from_xml = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from xml").decode('utf8'))
223 fact_from_mail = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from mail").decode('utf8'))
224 fact_from_txt = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from copy/paste").decode('utf8'))
225 menuFactiva.AppendItem(fact_from_xml)
226 menuFactiva.AppendItem(fact_from_mail)
227 menuFactiva.AppendItem(fact_from_txt)
228 file_menu.AppendMenu(-1, _(u"Import from factiva").decode('utf8'), menuFactiva)
230 item = wx.MenuItem(file_menu, ID_ImportTXM, _(u"Import from TXM").decode('utf8'), _(u"Import from TXM").decode('utf8'))
231 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
232 file_menu.AppendItem(item)
234 menuTools = wx.Menu()
235 splitvar = wx.MenuItem(menuTools, wx.ID_ANY, _(u"Split from variable").decode('utf8'))
236 extractmod = wx.MenuItem(menuTools, wx.ID_ANY, _(u"Extract mods").decode('utf8'))
237 extractthem = wx.MenuItem(menuTools, wx.ID_ANY, _(u"Extract thematics").decode('utf8'))
238 menuTools.AppendItem(splitvar)
239 menuTools.AppendItem(extractmod)
240 menuTools.AppendItem(extractthem)
241 self.ID_splitvar = splitvar.GetId()
242 self.ID_extractmod = extractmod.GetId()
243 self.ID_extractthem = extractthem.GetId()
244 file_menu.AppendMenu(-1, _(u"Tools").decode('utf8'), menuTools)
247 #item = wx.MenuItem(file_menu, ID_SaveTab, _(u"Save tab as...").decode('utf8'), _(u"Save tab as...").decode('utf8'))
248 #item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_SAVE_AS))
249 #file_menu.AppendItem(item)
251 file_menu.Append(wx.ID_EXIT, _(u"Exit").decode('utf8'))
253 edit_menu = wx.Menu()
254 edit_menu.Append(wx.ID_PREFERENCES, '', _(u'Preferences').decode('utf8'))
256 view_menu = wx.Menu()
257 view_menu.Append(ID_ACCEUIL, _(u"Home page").decode('utf8'))
258 view_menu.Append(ID_VIEWDATA, _(u"Show data").decode('utf8'))
259 view_menu.Append(ID_RESULT, _(u'Show results').decode('utf8'))
260 #view_menu.AppendSeparator()
261 matrix_menu = wx.Menu()
262 matrix_menu.Append(ID_Freq, _(u"Frequencies").decode('utf8'))
263 matrix_menu.Append(ID_Chi2, _(u"Chi2").decode('utf8'))
264 #matrix_menu.Append(ID_Student, u"t de Student")
265 menu_classif = wx.Menu()
266 menu_classif.Append(ID_CHDReinert, _(u"Reinert's Method").decode('utf8'))
267 #menu_classif.Append(ID_CHDSIM, u"Par matrice des distances")
268 matrix_menu.AppendMenu(-1, _(u"Clustering").decode('utf8'), menu_classif)
269 #matrix_menu.Append(ID_AFCM, u"AFCM")
270 matrix_menu.Append(ID_SIMI, _(u"Similarities Analysis").decode('utf8'))
271 matrix_menu.Append(ID_proto, _(u"Prototypical Analysis").decode('utf8'))
272 ID_RCODE = wx.NewId()
273 matrix_menu.Append(ID_RCODE, u"Code R...")
274 #menu_splittab = wx.Menu()
275 #ID_SPLITVAR = wx.NewId()
276 #splitvar = wx.MenuItem(menu_splittab, ID_SPLITVAR, _(u"Split from variable").decode('utf8'))
277 #menu_splittab.AppendItem(splitvar)
278 #matrix_menu.AppendMenu(-1, _(u"Split matrix").decode('utf8'), menu_splittab)
279 self.matrix_menu = matrix_menu
281 text_menu = wx.Menu()
282 #text_menu.Append(ID_CHECKCORPUS, u"Vérifier le corpus")
283 text_menu.Append(ID_TEXTSTAT, _(u"Statistics").decode('utf8'))
284 text_menu.Append(ID_ASLEX, _(u"Specificities and CA").decode('utf8'))
285 #text_menu.Append(ID_TEXTAFCM, u"AFC sur UCI / Vocabulaire")
286 menu_classiftxt = wx.Menu()
287 menu_classiftxt.Append(ID_TEXTREINERT, _(u"Reinert's Method").decode('utf8'))
288 #menu_classiftxt.Append(ID_TEXTPAM, u"Par matrice des distances")
289 text_menu.AppendMenu(-1, _(u"Clustering").decode('utf8'), menu_classiftxt)
290 text_menu.Append(ID_SimiTxt, _(u"Similarities Analysis").decode('utf8'))
292 text_menu.Append(ID_WC, _(u"WordCloud").decode('utf8'))
293 self.text_menu = text_menu
295 help_menu = wx.Menu()
296 help_menu.Append(wx.ID_ABOUT, _(u"About...").decode('utf8'))
297 help_menu.Append(wx.ID_HELP, _(u"Online help...").decode('utf8'))
299 self.mb.Append(file_menu, _(u"File").decode('utf8'))
300 self.mb.Append(edit_menu, _(u"Edition").decode('utf8'))
301 self.mb.Append(view_menu, _(u"View").decode('utf8'))
302 self.mb.Append(matrix_menu, _(u"Matrix analysis").decode('utf8'))
303 self.mb.Append(text_menu, _(u"Text analysis").decode('utf8'))
304 self.mb.Append(help_menu, _(u"Help").decode('utf8'))
306 self.SetMenuBar(self.mb)
307 #--------------------------------------------------------------------
308 self.statusbar = self.CreateStatusBar(2, wx.ST_SIZEGRIP)
309 self.statusbar.SetStatusWidths([-2, -3])
310 self.statusbar.SetStatusText(u"Prêt", 0)
311 self.statusbar.SetStatusText(u"Bienvenue", 1)
313 # min size for the frame itself isn't completely done.
314 # see the end up FrameManager::Update() for the test
315 # code. For now, just hard code a frame minimum size
316 self.SetMinSize(wx.Size(400, 400))
318 # create some toolbars
319 tb1 = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize,
320 wx.TB_FLAT | wx.TB_NODIVIDER)
321 tb1.SetToolBitmapSize(wx.Size(16, 16))
322 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")
324 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")
328 #------------------------------------------------------------------------------------------------
330 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)
332 #self._mgr.AddPane(self.text_ctrl_txt, wx.aui.AuiPaneInfo().
333 # Name("Text").CenterPane())
334 self._mgr.AddPane(self.text_ctrl_txt, aui.AuiPaneInfo().
335 Name("Text").CenterPane())
336 #self._mgr.AddPane(IntroPanel(self), wx.aui.AuiPaneInfo().Name("Intro_Text").
338 self._mgr.AddPane(IntroPanel(self), aui.AuiPaneInfo().Name("Intro_Text").
340 #if not os.path.exists(os.path.join(UserConfigPath, 'history.db')) :
341 # with open(os.path.join(UserConfigPath, 'history.db'), 'w') as f :
343 self.history = History(os.path.join(UserConfigPath, 'history.db'))
344 self.tree = LeftTree(self)
345 self._mgr.AddPane(self.tree, aui.AuiPaneInfo().Name("lefttree").Caption(_(u"Navigator").decode('utf8')).
346 Left().MinSize(wx.Size(200,500)).Layer(1).Position(1).CloseButton(False).MaximizeButton(True).
347 MinimizeButton(True))
349 #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)
350 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)
351 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
352 self.nb.SetAGWWindowStyleFlag(notebook_flags)
353 self.nb.SetArtProvider(aui.ChromeTabArt())
354 #self.nb.SetArtProvider(aui.VC8TabArt())
355 #self.nb.parent = self
356 #self._notebook_style = aui.AUI_NB_DEFAULT_STYLE | aui.AUI_NB_TAB_EXTERNAL_MOVE | wx.NO_BORDER
357 #self._mgr.AddPane(self.nb, wx.aui.AuiPaneInfo().
358 # Name("Tab_content").
360 self._mgr.AddPane(self.nb, aui.AuiPaneInfo().
364 #self._mgr.AddPane(self.Sheet, wx.aui.AuiPaneInfo().Name("Data").CenterPane())
365 #self._mgr.AddPane(self.Sheet, aui.AuiPaneInfo().Name("Data").CenterPane())
366 self.nb.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.OnCloseTab)
367 self.nb.Bind(aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
368 # add the toolbars to the manager
370 #self._mgr.AddPane(tb1, wx.aui.AuiPaneInfo().
371 # Name("tb1").Caption("Fichiers").
372 # ToolbarPane().Top().
373 # LeftDockable(False).RightDockable(False))
374 self._mgr.AddPane(tb1, aui.AuiPaneInfo().
375 Name("tb1").Caption("Fichiers").
377 LeftDockable(True).RightDockable(False))
379 self.ShowAPane("Intro_Text")
380 self._mgr.GetPane("lefttree").Show()
381 self._mgr.GetPane("classif_tb").Hide()
382 # "commit" all changes made to FrameManager
385 # Show How To Use The Closing Panes Event
386 ##################################################################
387 self.Bind(wx.EVT_MENU, self.OnAcceuil, id=ID_ACCEUIL)
388 self.Bind(wx.EVT_MENU, self.OnViewData, id=ID_VIEWDATA)
389 self.Bind(wx.EVT_MENU, self.ShowTab, id=ID_RESULT)
390 self.Bind(wx.EVT_MENU, self.OnOpenData, id=ID_OpenData)
391 self.Bind(wx.EVT_MENU, self.OnOpenText, id=ID_OpenText)
392 self.Bind(wx.EVT_MENU, self.OnOpenAnalyse, id=ID_OnOpenAnalyse)
393 self.Bind(wx.EVT_MENU, self.import_factiva_xml, fact_from_xml)
394 self.Bind(wx.EVT_MENU, self.import_factiva_mail, fact_from_mail)
395 self.Bind(wx.EVT_MENU, self.import_factiva_txt, fact_from_txt)
396 self.Bind(wx.EVT_MENU, self.ExtractTools, splitvar)
397 self.Bind(wx.EVT_MENU, self.ExtractTools, extractmod)
398 self.Bind(wx.EVT_MENU, self.ExtractTools, extractthem)
399 self.Bind(wx.EVT_MENU, self.OnFreq, id=ID_Freq)
400 self.Bind(wx.EVT_MENU, self.OnChi2, id=ID_Chi2)
401 self.Bind(wx.EVT_MENU, self.OnStudent, id=ID_Student)
402 self.Bind(wx.EVT_MENU, self.OnCHDSIM, id=ID_CHDSIM)
403 self.Bind(wx.EVT_MENU, self.OnCHDReinert, id=ID_CHDReinert)
404 self.Bind(wx.EVT_MENU, self.OnAFCM, id=ID_AFCM)
405 self.Bind(wx.EVT_MENU, self.OnProto, id=ID_proto)
406 self.Bind(wx.EVT_MENU, self.OnRCode, id=ID_RCODE)
407 #self.Bind(wx.EVT_MENU, self.OnSplitVar, id=ID_SPLITVAR)
408 #self.Bind(wx.EVT_MENU, self.OnCheckcorpus, id = ID_CHECKCORPUS)
409 self.Bind(wx.EVT_MENU, self.OnTextStat, id=ID_TEXTSTAT)
410 self.Bind(wx.EVT_MENU, self.OnTextSpec, id=ID_ASLEX)
411 self.Bind(wx.EVT_MENU, self.OnTextAfcm, id=ID_TEXTAFCM)
412 self.Bind(wx.EVT_MENU, self.OnTextReinert, id=ID_TEXTREINERT)
413 self.Bind(wx.EVT_MENU, self.OnPamSimple, id=ID_TEXTPAM)
414 self.Bind(wx.EVT_MENU, self.OnSimiTxt, id=ID_SimiTxt)
415 self.Bind(wx.EVT_MENU, self.OnWordCloud, id=ID_WC)
416 self.Bind(wx.EVT_MENU, self.OnSimiTab, id=ID_SIMI)
417 self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT)
418 #self.Bind(wx.EVT_MENU, self.OnSaveTabAs, id=ID_SaveTab)
419 self.Bind(wx.EVT_MENU, self.OnAbout, id=wx.ID_ABOUT)
420 self.Bind(wx.EVT_MENU, self.OnHelp, id=wx.ID_HELP)
421 self.Bind(wx.EVT_MENU, self.OnPref, id=wx.ID_PREFERENCES)
422 self.Bind(wx.EVT_MENU, self.OnImportTXM, id=ID_ImportTXM)
423 self.Bind(wx.EVT_CLOSE, self.OnClose)
424 ##################################################################
425 flags = self._mgr.GetAGWFlags()
426 #flags &= ~wx.aui.AUI_MGR_TRANSPARENT_HINT
427 #flags &= ~wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT
428 #flags &= ~wx.aui.AUI_MGR_RECTANGLE_HINT
429 flags &= ~(aui.AUI_MGR_RECTANGLE_HINT | aui.AUI_MGR_ALLOW_FLOATING)
430 self._mgr.SetAGWFlags(self._mgr.GetAGWFlags() ^ (aui.AUI_MGR_RECTANGLE_HINT | aui.AUI_MGR_ALLOW_FLOATING))
431 self._mgr.GetArtProvider().SetMetric(aui.AUI_DOCKART_GRADIENT_TYPE, aui.AUI_GRADIENT_HORIZONTAL)
432 self.GetDockArt().SetColor(aui.AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR, "#00FFF9")
435 self._icon = wx.Icon(os.path.join(ImagePath, "iraicone.ico"), wx.BITMAP_TYPE_ICO)
436 self.SetIcon(self._icon)
437 ##########################
439 self.input_path = [False]
440 self.TEMPDIR = tempfile.mkdtemp('iramuteq')
441 self.FileTabList = []
447 self.g_header = False
454 self.SysEncoding = sys.getdefaultencoding()
455 self.syscoding = sys.getdefaultencoding()
456 #print 'SysEncoding',self.SysEncoding
457 if self.SysEncoding == 'mac-roman' : self.SysEncoding = 'MacRoman'
460 ##############################################################@
461 self.DisEnSaveTabAs(False)
462 self.ShowMenu(_("View").decode('utf8'), False)
463 self.ShowMenu(_("Matrix analysis").decode('utf8'), False)
464 self.ShowMenu(_("Text analysis").decode('utf8'), False)
475 def finish_init(self) :
477 self.pref.read(self.ConfigPath['preferences'])
480 self.pref.read(self.ConfigPath['preferences'])
487 self.pref.read(self.ConfigPath['preferences'])
489 self.sound = self.pref.getboolean('iramuteq', 'sound')
490 self.check_update = self.pref.getboolean('iramuteq', 'checkupdate')
491 self.version = ConfigGlob.get('DEFAULT', 'version')
492 #configuration des chemins de R
493 self.PathPath = ConfigParser()
494 self.PathPath.read(ConfigPath['path'])
496 if not CheckRPath(self.PathPath) :
497 if sys.platform == 'win32':
498 BestRPath = FindRPAthWin32()
500 BestRPath = FindRPathNix()
502 self.PathPath.set('PATHS', 'rpath', BestRPath)
503 with open(ConfigPath['path'], 'w') as f :
504 self.PathPath.write(f)
508 self.RPath = self.PathPath.get('PATHS', 'rpath')
511 if not RLibsAreInstalled(self) :
515 Le chemin de l'executable de R n'a pas été trouvé.
516 Si R n'est pas installé, vous devez l'installer (http://www.r-project.org/).
517 Si R n'est pas installé dans le répertoire par défaut
518 (souvent C:\Program Files\R\R-2.x.x\R.exe sous windows ou /usr/bin/R sous linux ou Mac Os X)
519 vous devez signaler le chemin de l'éxecutable de R dans les préférences."""
520 dlg = wx.MessageDialog(self, msg, u"Problème de configuration", wx.OK | wx.NO_DEFAULT | wx.ICON_WARNING)
522 if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
527 def setlangue(self) :
528 self.pref.read(self.ConfigPath['preferences'])
529 guilangue = self.pref.get('iramuteq', 'guilanguage')
530 self.preslangue.get(guilangue, 'english').install()
532 def OnVerif(self, evt) :
533 pack = CheckRPackages(self)
535 dlg = wx.MessageDialog(self, u"Installation OK", u"Installation", wx.OK | wx.ICON_INFORMATION)
537 if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
540 def DisEnSaveTabAs(self, DISEN):
542 file_menu = self.mb.GetMenu(0)
543 items = file_menu.GetMenuItems()
545 if item.GetId() == ID_SaveTab :
548 def ShowMenu(self, menu, Show=True):
549 menu_pos = self.mb.FindMenu(menu)
550 self.mb.EnableTop(menu_pos, Show)
551 self.mb.UpdateMenus()
554 #--------------------------------------------------------------------
555 def OnClose(self, event):
557 with open(self.ConfigPath['path'], 'w') as f :
558 self.PathPath.write(f)
563 def OnOpenData(self, event):
564 inputname, self.input_path = OnOpen(self, "Data")
566 #filename = self.input_path[0]
567 self.tableau = Tableau(self,os.path.abspath(self.input_path[0]))
568 val = get_table_param(self, self.input_path[0])
570 self.tableau.make_content()
571 OpenAnalyse(self, self.tableau.parametres)
572 self.tree.OnItemAppend(self.tableau.parametres)
573 #self.tableau.show_tab()
575 def OnOpenAnalyse(self, event):
576 self.AnalysePath = OnOpen(self, "Analyse")
577 OpenAnalyse(self, self.AnalysePath[1][0], True)
578 self.ShowMenu(_("View"))
580 def OnOpenText(self, event):
581 inputname, self.input_path = OnOpen(self, "Texte")
582 self.filename = self.input_path[0]
586 def OnViewData(self, event):
589 if self.type == "Data":
590 if not self.DataPop :
591 self.Sheet.Populate(self.content)
594 self.ShowAPane(u"Data")
595 elif self.type == "Texte" or self.type == 'Analyse' :
596 if not self.DataTxt :
597 self.text_ctrl_txt.Clear()
598 self.text_ctrl_txt.write(self.content)
599 self.text_ctrl_txt.ShowPosition(0)
602 self.ShowAPane(u"Text")
605 def OnSubText(self, corpus, parametres = None):
607 corpus = self.tree.getcorpus()
608 builder = SubBuilder(self, corpus, parametres)
609 if builder.res == wx.ID_OK :
610 busy = wx.BusyInfo(_("Please wait...").decode('utf8'), self)
612 corpus = builder.doanalyse()
613 self.history.add(corpus.parametres)
614 self.tree.OnItemAppend(corpus.parametres)
615 OpenAnalyse(self, corpus.parametres)
619 dlg = wx.ProgressDialog("Ouverture...",
620 "Veuillez patienter...",
623 style=wx.PD_APP_MODAL | wx.PD_AUTO_HIDE | wx.PD_ELAPSED_TIME | wx.PD_CAN_ABORT
626 builder = Builder(self, dlg)
627 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)
637 keepGoing = dlg.Update(count, u"Lecture du fichier")
638 self.ShowMenu(_(u"View").decode('utf8'))
639 self.ShowMenu(_(u"Text analysis").decode('utf8'))
640 self.ShowMenu(_(u"Matrix analysis").decode('utf8'), False)
645 keepGoing = dlg.Update(count, u"Chargement du dictionnaire")
647 #self.OnViewData(wx.EVT_BUTTON)
649 def OnExit(self, event):
652 def OnAbout(self, event):
653 info = wx.AboutDialogInfo()
654 info.Name = ConfigGlob.get('DEFAULT', 'name')
655 info.Version = ConfigGlob.get('DEFAULT', 'version')
656 info.Copyright = ConfigGlob.get('DEFAULT', 'copyright')
657 info.Description = u"""
658 Interface de R pour les Analyses Multidimensionnelles
659 de Textes et de Questionnaires
662 construit avec des logiciels libres.
668 info.WebSite = ("http://www.iramuteq.org", u"Site web IRaMuTeQ")
669 dev = ConfigGlob.get('DEFAULT', 'dev').decode('utf8').split(';')
670 info.Developers = dev
671 info.License = u"""Iramuteq est un logiciel libre ; vous pouvez le diffuser et/ou le modifier
672 suivant les termes de la Licence Publique Générale GNU telle que publiée
673 par la Free Software Foundation ; soit la version 2 de cette licence,
674 soit (à votre convenance) une version ultérieure.
676 Iramuteq est diffusé dans l'espoir qu'il sera utile,
677 mais SANS AUCUNE GARANTIE ; sans même une garantie implicite
678 de COMMERCIALISATION ou d'ADÉQUATION À UN USAGE PARTICULIER.
679 Voyez la Licence Publique Générale GNU pour plus de détails.
681 Vous devriez avoir reçu une copie de la Licence Publique Générale GNU
682 avec Iramuteq ; sinon, veuillez écrire à la Free Software Foundation,
683 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, États-Unis."""
686 def GetDockArt(self):
687 return self._mgr.GetArtProvider()
692 def OnPageChanged(self, event) :
693 new = event.GetSelection()
694 nobject = event.GetEventObject()
695 parent = nobject.GetParent()
696 if isinstance(parent, IraFrame) :
697 npage = self.nb.GetPage(new)
698 if 'parametres' in dir(npage) :
699 self.tree.GiveFocus(uuid=npage.parametres['uuid'])
700 if npage.parametres.get('matrix', False) :
701 self.ShowMenu(_(u"Text analysis").decode('utf8'), False)
702 self.ShowMenu(_(u"Matrix analysis").decode('utf8'), True)
703 elif npage.parametres.get('corpus', False) :
704 self.ShowMenu(_(u"Text analysis").decode('utf8'))
705 self.ShowMenu(_(u"Matrix analysis").decode('utf8'), False)
707 def OnCloseTab(self, evt):
708 #log.info('Closing tab %s' % str(evt.GetEventObject()))
709 ctrl = evt.GetEventObject()
710 if isinstance(ctrl.GetParent(), aui.AuiNotebook) or isinstance(ctrl.GetParent(), wx.Panel):
714 page = self.nb.GetPage(self.nb.GetSelection())
715 if 'parametres' in dir(page) and isinstance(ctrl.GetParent(), IraFrame) :
716 self.history.rmtab(page.parametres)
717 self.tree.CloseItem(uuid = page.parametres['uuid'])
718 TabTitle = self.nb.GetPageText(self.nb.GetSelection())
719 # if self.DictTab != {} :
720 # if TabTitle in self.DictTab :
721 # ListFile=self.DictTab[TabTitle]
722 # if False in ListFile:
724 # Certains résultats ne sont pas enregistrer.
725 # Voulez-vous fermer quand même ?"""
726 # dlg = wx.MessageDialog(self, msg, "Sauvegarde",wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
728 # dlg.CenterOnParent()
729 # if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
734 # for f in ListFile[1:] :
739 # elif True in ListFile :
742 # del self.DictTab[TabTitle]
744 # self.LastTabClose()
747 if self.nb.GetPageCount() == 1 and not notebook :
750 def LastTabClose(self) :
751 if self.nb.GetPageCount() == 1 :
752 #self.DisEnSaveTabAs(False)
754 self.ShowAPane("Text")
756 self.ShowAPane("Data")
758 self.ShowAPane("Intro_Text")
760 # def OnSaveTabAs(self, event):
761 # SelectTab = self.nb.GetSelection()
762 # TabTitle = self.nb.GetPageText(SelectTab)
763 # FileToSave = self.DictTab[TabTitle]
765 # dlg = wx.FileDialog(
766 # self, message="Enregistrer sous...", defaultDir=os.getcwd(),
767 # defaultFile="resultat.html", wildcard="Tous les fichiers|*", style=wx.SAVE | wx.OVERWRITE_PROMPT
769 # dlg.SetFilterIndex(2)
770 # dlg.CenterOnParent()
772 # if dlg.ShowModal() == wx.ID_OK:
773 # Path = dlg.GetPath()
774 # Dirname = os.path.dirname(Path)
775 # Filename = dlg.GetFilename()
780 # shutil.copyfile(FileToSave[-1], Path)
781 # os.remove(FileToSave[len(FileToSave) - 1])
782 # NewListFile.append(True)
783 # NewListFile.append(Path)
784 # for f in FileToSave[1:-1] :
785 # Fileout = os.path.join(Dirname, os.path.basename(f))
786 # shutil.copyfile(f, Fileout)
787 # NewListFile.append(Fileout)
790 # self.DictTab[TabText] = NewListFile
791 # del self.DictTab[TabTitle]
792 # self.nb.SetPageText(SelectTab, TabText)
794 def GetStartPosition(self):
798 pt = self.ClientToScreen(wx.Point(0, 0))
800 return wx.Point(pt.x + x, pt.y + x)
802 def ShowAPane(self, panel):
803 for pane in self._mgr.GetAllPanes() :
804 if not pane.IsToolbar() and pane.name != 'lefttree':
806 self._mgr.GetPane(panel).Show()
809 def OnAcceuil(self, event):
810 self.ShowAPane(u"Intro_Text")
813 def CreateHTMLCtrl(self):
814 ctrl = wx.html.HtmlWindow(self, -1, wx.DefaultPosition, wx.Size(400, 300))
815 if "gtk2" in wx.PlatformInfo:
816 ctrl.SetStandardFonts()
817 ctrl.SetPage(u"text")
820 def ShowTab(self, evt):
821 self.ShowAPane("Tab_content")
823 ################################################################
825 ################################################################
826 def analyse_matrix(self, analyse, analyse_type = '', matrix = None, parametres = None, dlgnb = 1):
828 matrix = self.tree.getmatrix()
829 if parametres is not None :
830 parametres['type'] = analyse_type
832 parametres = {'type' : analyse_type}
834 print 'plus de bug@@@@@@@@@@@@@@@@@@@@@@'
835 analyse(self, matrix, parametres = parametres, dlg = dlgnb)
839 def OnFreq(self, event, matrix = None):
840 self.analyse_matrix(Frequences, analyse_type = 'freq', matrix = matrix, dlgnb = 3)
842 def OnChi2(self, event, matrix = None):
843 self.analyse_matrix(ChiSquare, matrix = matrix, analyse_type = 'chi2', dlgnb = 3)
845 def OnSimiTab(self, event, matrix = None):
846 self.analyse_matrix(DoSimi, matrix = matrix, analyse_type = 'simimatrix', dlgnb = 5)
848 def OnCHDReinert(self, event, matrix = None):
850 # matrix = self.tree.getmatrix()
851 #AnalyseQuest(self, matrix, parametres = {'type' : 'reinertmatrix'}, dlg = 3)
852 self.analyse_matrix(AnalyseQuest, matrix = matrix, analyse_type = 'reinertmatrix', dlgnb = 5)
854 def OnStudent(self, event):
860 def OnRCode(self, event):
866 def OnCHDSIM(self, event):
868 # print 'ATTENTION!!!!'
869 chdsim = ChdCluster(self)
870 if chdsim.val == wx.ID_OK:
875 # def OnCHDReinert(self, event):
877 # # print('PLUS DE BUG SUR ALCESTE QUESTIONNAIRE')
878 # self.quest = AnalyseQuest(self)
879 # if self.quest.val == wx.ID_OK:
884 def OnProto(self, evt, matrix = None) :
885 self.analyse_matrix(Prototypical, matrix = matrix, analyse_type = 'proto', dlgnb = 3)
886 #Prototypical(self, {'type' : 'proto'})
888 def OnSplitVar(self, evt, matrix = None):
889 self.analyse_matrix(SplitMatrixFromVar, matrix = matrix, analyse_type = 'splitvar', parametres = {'pathout': matrix.pathout.dirout}, dlgnb = 3)
890 matrix = self.tree.getmatrix()
893 def OnSimiTxt(self, evt, corpus = None) :
894 # print 'PLUS DE BUG SUR SIMITXT'
896 #self.Text = SimiTxt(self)
898 corpus = self.tree.getcorpus()
899 self.Text = SimiTxt(self, corpus, parametres = {'type': 'simitxt'}, dlg = 3)
900 if self.Text.val == wx.ID_OK :
905 def OnWordCloud(self, evt, corpus = None) :
906 # print 'PLUS DE BUG SUR WORDCLOUD'
909 corpus = self.tree.getcorpus()
910 self.Text = WordCloud(self, corpus, parametres = {'type' : 'wordcloud'}, dlg = 3)
911 if self.Text.val == wx.ID_OK :
916 def OnClusterCloud(self, corpus, parametres = None) :
917 self.Text = ClusterCloud(self, corpus, parametres = parametres, dlg = 3)
919 def OnAFCM(self, event):
925 def OnTextStat(self, event, corpus = None):
926 #print 'PAS DE BUG SUR TEXT STAT'
929 corpus = self.tree.getcorpus()
930 self.Text = Stat(self, corpus, parametres = {'type': 'stat'}, dlg = 7)
932 if self.Text.val == wx.ID_OK :
937 def OnTextSpec(self, event, corpus = None):
939 #self.Text = AsLexico(self)
940 #print('ATTENTION : PLUS DE BUG SUR LEXICO')
942 corpus = self.tree.getcorpus()
943 self.Text = Lexico(self, corpus, parametres = {'type' : 'spec'}, dlg = 3)
944 if self.Text.val == wx.ID_OK :
949 def OnTextAfcm(self, event):
956 def import_factiva_xml(self,event):
958 ImportFactiva(self, 'xml')
962 def import_factiva_mail(self, evt) :
964 ImportFactiva(self, 'mail')
968 def import_factiva_txt(self, evt) :
970 ImportFactiva(self, 'txt')
974 def OnImportTXM(self, evt) :
976 ImportFactiva(self, 'txm')
980 def ExtractTools(self, evt) :
982 if ID == self.ID_splitvar :
983 Extract(self, 'splitvar')
984 elif ID == self.ID_extractmod :
985 Extract(self, 'mods')
986 elif ID == self.ID_extractthem :
987 Extract(self, 'them')
989 def OnTextReinert(self, event, corpus = None):
991 #print('ATTENTION : PLUS DE BUG SUR ALCESTE')
992 #RunAnalyse(self, corpus, Alceste, OptAlceste)
994 corpus = self.tree.getcorpus()
995 self.Text = Reinert(self, corpus, parametres = {'type': 'alceste'}, dlg = 6)
996 if self.Text.val == wx.ID_OK:
1001 def OnPamSimple(self, event, corpus = None):
1004 corpus = self.tree.getcorpus()
1005 self.Text = AnalysePam(self, corpus, parametres = {'type' : 'pamtxt'}, dlg = 6)
1006 if self.Text.val == wx.ID_OK:
1011 def SimiCluster(self, parametres = {}, fromprof = False, pathout = '', listactives = [], actives = [], tableau = None) :
1012 DoSimi(self, param = parametres, fromprof = fromprof, listactives = listactives, actives = actives, tableau = tableau)
1014 # def OnSimi(self,evt):
1016 #print 'ATTENTION !!!! VERGES'
1017 #print 'PLUS DE BUG SUR SIMI'
1018 # self.res = DoSimi(self, param = None)
1019 #self.res = Verges(self)
1020 # if self.res.val == wx.ID_OK :
1024 #################################################################
1026 def OnHelp(self, event):
1027 webbrowser.open('http://www.iramuteq.org/documentation')
1029 def OnPref(self, event):
1030 dlg = PrefDialog(self)
1031 dlg.CenterOnParent()
1032 self.val = dlg.ShowModal()
1035 if self.check_update:
1038 print 'pas de verif'
1040 #CheckRPackages(self)
1042 def OnOpenFromCmdl(self):
1044 if options.filename :
1045 if os.path.exists(options.filename):
1046 self.filename = os.path.abspath(options.filename)
1050 if os.path.exists(os.path.realpath(args[0])):
1051 self.filename = os.path.abspath(os.path.realpath(args[0]))
1057 if os.path.splitext(self.filename)[1] in ['.csv', '.xls', '.ods']:
1058 self.tableau = Tableau(self, self.filename)
1059 val = get_table_param(self, self.filename)
1060 if val == wx.ID_OK :
1061 self.tableau.make_content()
1062 OpenAnalyse(self, self.tableau.parametres)
1063 self.tree.OnItemAppend(self.tableau.parametres)
1064 #get_table_param(self, self.filename)
1065 #self.tableau.make_content()
1066 #self.tableau.show_tab()
1067 #open_data(self, self.filename)
1068 elif os.path.splitext(self.filename)[1] == '.txt':
1070 elif os.path.splitext(self.filename)[1] == '.ira' :
1071 #self.corpus = Corpus(self)
1072 #self.Text = OpenAnalyse(self, self.filename)
1073 OpenAnalyse(self, self.filename)
1075 print 'ce fichier n\'existe pas'
1079 class IntroPanel(wx.Panel):
1080 def __init__(self, parent):
1081 wx.Panel.__init__(self, parent)
1082 col = randint(0, 255)
1083 col1 = randint(0,255)
1084 col2 = randint(0,255)
1086 bckgrdcolor = wx.Colour(col, col1, col2)
1087 self.SetBackgroundColour(bckgrdcolor)
1088 txtcolour = wx.Colour(250, 250, 250)
1089 linkcolor = wx.Colour(255, 0, 0)
1090 sizer1 = wx.BoxSizer(wx.VERTICAL)
1091 sizer2 = wx.BoxSizer(wx.VERTICAL)
1092 sizer3 = wx.BoxSizer(wx.HORIZONTAL)
1093 sizer4 = wx.BoxSizer(wx.VERTICAL)
1094 sizer5 = wx.BoxSizer(wx.HORIZONTAL)
1095 grid_sizer_1 = wx.FlexGridSizer(1, 4, 0, 0)
1096 grid_sizer_3 = wx.FlexGridSizer(1, 4, 0, 0)
1097 grid_sizer_2 = wx.FlexGridSizer(1, 3, 0, 0)
1098 PanelPres = wx.Panel(self)
1099 PanelPres.SetBackgroundColour(bckgrdcolor)
1100 label_1 = wx.StaticText(self, -1, u"IRaMuTeQ", size=(-1, -1))
1101 label_1.SetFont(wx.Font(46, wx.TELETYPE, wx.NORMAL, wx.BOLD, 0, "Purisa"))
1102 label_1.SetForegroundColour(wx.RED)
1103 label2 = wx.StaticText(PanelPres, -1 , u'\nVersion ' + ConfigGlob.get('DEFAULT', 'version') + '\n')
1104 label2.SetForegroundColour(txtcolour)
1105 label2.SetBackgroundColour(bckgrdcolor)
1106 #label3 = wx.StaticText(PanelPres, -1 , u'Equipe ')
1107 #label3.SetForegroundColour(txtcolour)
1108 #label3.SetBackgroundColour(bckgrdcolor)
1109 self.hyper2 = hl.HyperLinkCtrl(PanelPres, wx.ID_ANY, u"REPERE", URL="http://repere.no-ip.org/")
1110 self.hyper2.SetColours(linkcolor, linkcolor, "RED")
1111 self.hyper2.SetBackgroundColour(bckgrdcolor)
1112 self.hyper2.EnableRollover(True)
1113 self.hyper2.SetUnderlines(False, False, True)
1114 self.hyper2.SetBold(True)
1115 self.hyper2.UpdateLink()
1116 label_lerass = wx.StaticText(PanelPres, -1, u'Laboratoire ')
1117 label_lerass.SetForegroundColour(txtcolour)
1118 label_lerass.SetBackgroundColour(bckgrdcolor)
1119 self.hyper_lerass = hl.HyperLinkCtrl(PanelPres, -1, u'LERASS', URL="http://www.lerass.com")
1120 self.hyper_lerass.SetColours(linkcolor, linkcolor, "RED")
1121 self.hyper_lerass.SetBackgroundColour(bckgrdcolor)
1122 self.hyper_lerass.EnableRollover(True)
1123 self.hyper_lerass.SetUnderlines(False, False, True)
1124 self.hyper_lerass.SetBold(True)
1125 self.hyper_lerass.UpdateLink()
1126 blank = wx.StaticText(PanelPres, -1, u'\n')
1127 blank1 = wx.StaticText(PanelPres, -1, u'\n')
1128 labellicence = wx.StaticText(PanelPres, -1, _(u"License GNU GPL").decode('utf8'))
1129 labellicence.SetForegroundColour(txtcolour)
1130 labellicence.SetBackgroundColour(bckgrdcolor)
1131 labelcopy = wx.StaticText(PanelPres, -1, ConfigGlob.get('DEFAULT', 'copyright'))
1132 labelcopy.SetForegroundColour(txtcolour)
1133 labelcopy.SetBackgroundColour(bckgrdcolor)
1134 python_img = wx.Image(os.path.join(ImagePath,'python-logo.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1135 r_img = wx.Image(os.path.join(ImagePath,'Rlogo.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1136 lexique_img = wx.Image(os.path.join(ImagePath,'LexTexte4.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1137 but_python = wx.BitmapButton(self, -1, python_img)
1138 but_lexique = wx.BitmapButton(self, -1, lexique_img)
1139 but_r = wx.BitmapButton(self, -1, r_img)
1140 self.Bind(wx.EVT_BUTTON, self.OnPython, but_python)
1141 self.Bind(wx.EVT_BUTTON, self.OnLexique, but_lexique)
1142 self.Bind(wx.EVT_BUTTON, self.OnR, but_r)
1145 #grid_sizer_1.Add(label3, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1146 grid_sizer_1.Add(self.hyper2, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1147 grid_sizer_3.Add(label_lerass, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1148 grid_sizer_3.Add(self.hyper_lerass, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1149 sizer4.Add(label_1, 0, wx.ALIGN_CENTER, 5)
1150 sizer2.Add(label2, 0, wx.ALIGN_CENTER, 5)
1151 #sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1152 sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1153 sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1154 sizer2.Add(grid_sizer_3, 0, wx.ALIGN_CENTER, 5)
1155 sizer2.Add(wx.StaticText(PanelPres, -1, u' '), 0, wx.ALIGN_CENTER, 5)
1156 #sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1157 #sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1158 sizer2.Add(grid_sizer_1, 0, wx.ALIGN_CENTER, 5)
1159 sizer2.Add(labellicence, 0, wx.ALIGN_CENTER, 5)
1160 sizer2.Add(labelcopy, 0, wx.ALIGN_CENTER, 5)
1161 sizer1.Add(sizer4, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1162 PanelPres.SetSizer(sizer2)
1163 sizer5.Add(blank, 1, wx.EXPAND | wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 2)
1164 sizer5.Add(PanelPres, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1165 sizer5.Add(blank1, 1, wx.ALIGN_CENTER_HORIZONTAL,2)
1166 grid_sizer_2.Add(but_python, 1, wx.ALIGN_CENTER_HORIZONTAL| wx.ALIGN_CENTER_VERTICAL)
1167 grid_sizer_2.Add(but_lexique, 1,wx.ALIGN_CENTER_HORIZONTAL| wx.ALIGN_CENTER_VERTICAL)
1168 grid_sizer_2.Add(but_r, 1, wx.ALIGN_CENTER_HORIZONTAL| wx.ALIGN_CENTER_VERTICAL)
1170 sizer1.Add(sizer5, 3, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 1)
1171 sizer1.Add(grid_sizer_2, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL)
1172 self.SetSizer(sizer1)
1175 def OnPython(self,evt):
1176 webbrowser.open('http://www.python.org')
1178 def OnLexique(self,evt):
1179 webbrowser.open('http://www.lexique.org')
1182 webbrowser.open('http://www.r-project.org')
1184 class MySplashScreen(wx.SplashScreen):
1186 bmp = wx.Image(os.path.join(ImagePath, 'splash.png')).ConvertToBitmap()
1187 wx.SplashScreen.__init__(self, bmp,
1188 wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
1190 self.Bind(wx.EVT_CLOSE, self.OnClose)
1191 self.fc = wx.FutureCall(1, self.ShowMain)
1193 def OnClose(self, evt):
1197 if self.fc.IsRunning():
1202 displaySize = wx.DisplaySize()
1203 w = displaySize[0]/1.2
1204 h = displaySize[1]/1.2
1205 frame = IraFrame(None, -1, "IRaMuTeQ " + ConfigGlob.get('DEFAULT', 'version'), size=(w, h))
1209 frame.OnOpenFromCmdl()
1210 # if self.fc.IsRunning():
1212 #wx.CallAfter(frame.ShowTip)
1214 class MyApp(wx.App):
1217 Create and show the splash screen. It will then create and show
1218 the main frame when it is time to do so.
1220 wx.SystemOptions.SetOptionInt("mac.window-plain-transition", 1)
1221 self.SetAppName("Iramuteq")
1222 splash = MySplashScreen()
1230 if __name__ == '__main__':