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 if wx.__version__ >= '2.11' :
32 import wx.lib.agw.aui as aui
37 import wx.lib.hyperlink as hl
38 #------------------------------------
39 from functions import BugReport, PlaySound, ReadLexique, History, DoConf, ReadDicoAsDico, progressbar
40 from checkversion import NewVersion
41 from guifunct import *
42 from tableau import Tableau
43 from dialog import PrefDialog, EncodeDialog, CorpusPref
44 from tabfrequence import Frequences
45 from tabchi2 import ChiSquare
46 #from tabstudent import MakeStudent
47 from tabchddist import ChdCluster
48 from tabafcm import DoAFCM
49 from tabchdalc import AnalyseQuest
50 from tabsimi import DoSimi
51 from tabrsimple import InputText
52 from tabverges import Prototypical
53 #from textafcuci import AfcUci
54 from analysetxt import Alceste
55 from textdist import AnalysePam
56 from textstat import Stat
57 from textaslexico import Lexico
58 from textsimi import SimiTxt, SimiFromCluster
59 from textwordcloud import WordCloud, ClusterCloud
60 from profile_segment import ProfileSegment
61 #from textcheckcorpus import checkcorpus
62 from openanalyse import OpenAnalyse
63 from corpus import BuildFromAlceste, Builder
64 from sheet import MySheet
65 from checkinstall import CreateIraDirectory, CheckRPath, FindRPAthWin32, FindRPathNix, CheckRPackages, IsNew, UpgradeConf, CopyConf, RLibsAreInstalled
66 from chemins import RscriptsPath, ConstructConfigPath, ConstructDicoPath, ConstructGlobalPath, PathOut
67 from parse_factiva_xml import ImportFactiva
68 from tools import Extract
70 from tree import LeftTree
71 ##########################################################
72 ID_OpenData = wx.NewId()
73 ID_Import = wx.NewId()
74 ID_OpenText = wx.NewId()
75 ID_OnOpenAnalyse = wx.NewId()
78 ID_Student = wx.NewId()
79 ID_CHDSIM = wx.NewId()
80 ID_CHDAlceste = wx.NewId()
81 ID_TEXTAFCM = wx.NewId()
82 ID_TEXTSTAT = wx.NewId()
84 ID_TEXTALCESTE = wx.NewId()
85 ID_TEXTPAM = wx.NewId()
86 ID_CHECKCORPUS = wx.NewId()
87 ID_Tabcontent = wx.NewId()
90 ID_CloseTab = wx.NewId()
91 ID_SaveTab = wx.NewId()
92 ID_CreateText = wx.NewId()
93 ID_ACCEUIL = wx.NewId()
94 ID_RESULT = wx.NewId()
95 ID_VIEWDATA = wx.NewId()
96 ID_HTMLcontent = wx.NewId()
97 ID_SimiTxt = wx.NewId()
99 ID_ImportTXM = wx.NewId()
100 ##########################################################
101 #elements de configuration
102 ##########################################################
104 if sys.platform == 'darwin' :
105 sys.setdefaultencoding('UTF-8')
106 wx.SetDefaultPyEncoding('UTF-8')
108 sys.setdefaultencoding(locale.getpreferredencoding())
110 #chemin de l'application
111 AppliPath = os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0])))
113 ImagePath = os.path.join(AppliPath, 'images')
114 #configuration generale
115 DictConfigPath = ConstructGlobalPath(AppliPath)
116 ConfigGlob = ConfigParser()
117 ConfigGlob.read(DictConfigPath['global'])
118 #repertoire de l'utilisateur
119 if os.getenv('HOME') != None:
120 user_home = os.getenv('HOME')
122 user_home = os.getenv('HOMEPATH')
123 UserConfigPath = os.path.abspath(os.path.join(user_home, '.iramuteq'))
124 #Si pas de fichiers de config utilisateur, on cree le repertoire
125 CreateIraDirectory(UserConfigPath, AppliPath)
126 #fichiers log pour windows (py2exe)
127 log = logging.getLogger('iramuteq')
128 fh = logging.FileHandler(os.path.join(UserConfigPath,'stdout.log'))
129 formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
130 fh.setFormatter(formatter)
132 if sys.platform != 'win32' and sys.platform != 'darwin':
133 ch = logging.StreamHandler()
134 ch.setFormatter(formatter)
136 log.setLevel(logging.INFO)
138 class writer(object):
139 def write(self, data):
140 if data.strip() != '' :
141 log.info('ERROR : %s' % data)
143 class printer(object) :
144 def write(self, data) :
145 if data.strip() != '' :
146 log.info('Print : %s' % data)
148 sys.stderr = writer()
149 sys.stdout = printer()
151 ConfigPath = ConstructConfigPath(UserConfigPath)
153 langues = {'french' : wx.LANGUAGE_FRENCH,
154 'english' : wx.LANGUAGE_ENGLISH,}
155 #####################################################################
157 class IraFrame(wx.Frame):
158 def __init__(self, parent, id= -1, title="", pos=wx.DefaultPosition,
159 size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE |
162 log.info('Starting...')
163 wx.Frame.__init__(self, parent, id, title, pos, size, style)
165 self.AppliPath = AppliPath
166 self.images_path = os.path.join(AppliPath,'images')
167 self.UserConfigPath = UserConfigPath
168 #self.RscriptsPath = ConstructRscriptsPath(AppliPath)
169 self.RscriptsPath = PathOut(dirout=os.path.join(AppliPath, 'Rscripts'))
170 self.RscriptsPath.basefiles(RscriptsPath)
171 #self.DictPath = ConstructDicoPath(AppliPath)
172 self.DictPath = ConstructDicoPath(UserConfigPath)
173 self.ConfigGlob = ConfigGlob
174 self.ConfigPath = ConstructConfigPath(UserConfigPath)
175 self.pref = RawConfigParser()
176 #workaround for import problem
177 self.SimiFromCluster = SimiFromCluster
179 gettext.install('iramuteq', os.path.join(AppliPath,'locale'), unicode=True)
180 self.presLan_fr = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=['fr_FR'])
181 self.presLan_en = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=['en'])
183 # tell FrameManager to manage this frame
184 #self._mgr = wx.aui.AuiManager()
185 self._mgr = aui.AuiManager()
186 self._mgr.SetManagedWindow(self)
189 #--------------------------------------------------------------------------------
190 self.mb = wx.MenuBar()
192 file_menu = wx.Menu()
193 item = wx.MenuItem(file_menu, ID_OpenData, _(u"Open a matrix").decode('utf8'), _(u"Open a matrix").decode('utf8'))
194 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
195 file_menu.AppendItem(item)
197 item = wx.MenuItem(file_menu, ID_OpenText, _(u"Open a text corpora").decode('utf8'), _(u"Open a text corpora").decode('utf8'))
198 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
199 file_menu.AppendItem(item)
201 item = wx.MenuItem(file_menu, ID_OnOpenAnalyse, _(u"Open an analysis").decode('utf8'), _(u"Open an analysis").decode('utf8'))
202 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
203 file_menu.AppendItem(item)
206 menuFactiva = wx.Menu()
207 fact_from_xml = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from xml").decode('utf8'))
208 fact_from_mail = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from mail").decode('utf8'))
209 fact_from_txt = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from copy/paste").decode('utf8'))
210 menuFactiva.AppendItem(fact_from_xml)
211 menuFactiva.AppendItem(fact_from_mail)
212 menuFactiva.AppendItem(fact_from_txt)
213 file_menu.AppendMenu(-1, _(u"Import from factiva").decode('utf8'), menuFactiva)
215 item = wx.MenuItem(file_menu, ID_ImportTXM, _(u"Import from TXM").decode('utf8'), _(u"Import from TXM").decode('utf8'))
216 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
217 file_menu.AppendItem(item)
219 menuTools = wx.Menu()
220 splitvar = wx.MenuItem(menuTools, wx.ID_ANY, _(u"Split from variable").decode('utf8'))
221 extractmod = wx.MenuItem(menuTools, wx.ID_ANY, _(u"Extract mods").decode('utf8'))
222 menuTools.AppendItem(splitvar)
223 menuTools.AppendItem(extractmod)
224 self.ID_splitvar = splitvar.GetId()
225 self.ID_extractmod = extractmod.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_CHDAlceste, _(u"Reinert 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_TEXTALCESTE, _(u"Reinert 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("Navigateur").
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().
339 self.Sheet = MySheet(self)
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.OnFreq, id=ID_Freq)
375 self.Bind(wx.EVT_MENU, self.OnChi2, id=ID_Chi2)
376 self.Bind(wx.EVT_MENU, self.OnStudent, id=ID_Student)
377 self.Bind(wx.EVT_MENU, self.OnCHDSIM, id=ID_CHDSIM)
378 self.Bind(wx.EVT_MENU, self.OnCHDAlceste, id=ID_CHDAlceste)
379 self.Bind(wx.EVT_MENU, self.OnAFCM, id=ID_AFCM)
380 self.Bind(wx.EVT_MENU, self.OnProto, id=ID_proto)
381 self.Bind(wx.EVT_MENU, self.OnRCode, id=ID_RCODE)
382 #self.Bind(wx.EVT_MENU, self.OnCheckcorpus, id = ID_CHECKCORPUS)
383 self.Bind(wx.EVT_MENU, self.OnTextStat, id=ID_TEXTSTAT)
384 self.Bind(wx.EVT_MENU, self.OnTextSpec, id=ID_ASLEX)
385 self.Bind(wx.EVT_MENU, self.OnTextAfcm, id=ID_TEXTAFCM)
386 self.Bind(wx.EVT_MENU, self.OnTextAlceste, id=ID_TEXTALCESTE)
387 self.Bind(wx.EVT_MENU, self.OnPamSimple, id=ID_TEXTPAM)
388 self.Bind(wx.EVT_MENU, self.OnSimiTxt, id=ID_SimiTxt)
389 self.Bind(wx.EVT_MENU, self.OnWordCloud, id=ID_WC)
390 self.Bind(wx.EVT_MENU, self.OnSimi, id=ID_SIMI)
391 self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT)
392 self.Bind(wx.EVT_MENU, self.OnSaveTabAs, id=ID_SaveTab)
393 self.Bind(wx.EVT_MENU, self.OnAbout, id=wx.ID_ABOUT)
394 self.Bind(wx.EVT_MENU, self.OnHelp, id=wx.ID_HELP)
395 self.Bind(wx.EVT_MENU, self.OnPref, id=wx.ID_PREFERENCES)
396 self.Bind(wx.EVT_MENU, self.OnImportTXM, id=ID_ImportTXM)
397 self.Bind(wx.EVT_CLOSE, self.OnClose)
398 ##################################################################
399 flags = self._mgr.GetAGWFlags()
400 #flags &= ~wx.aui.AUI_MGR_TRANSPARENT_HINT
401 #flags &= ~wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT
402 #flags &= ~wx.aui.AUI_MGR_RECTANGLE_HINT
403 flags &= ~(aui.AUI_MGR_RECTANGLE_HINT | aui.AUI_MGR_ALLOW_FLOATING)
404 self._mgr.SetAGWFlags(self._mgr.GetAGWFlags() ^ (aui.AUI_MGR_RECTANGLE_HINT | aui.AUI_MGR_ALLOW_FLOATING))
405 self._mgr.GetArtProvider().SetMetric(aui.AUI_DOCKART_GRADIENT_TYPE, aui.AUI_GRADIENT_HORIZONTAL)
406 self.GetDockArt().SetColor(aui.AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR, "#00FFF9")
409 self._icon = wx.Icon(os.path.join(ImagePath, "iraicone.ico"), wx.BITMAP_TYPE_ICO)
410 self.SetIcon(self._icon)
411 ##########################
413 self.input_path = [False]
414 self.TEMPDIR = tempfile.mkdtemp('iramuteq')
415 self.FileTabList = []
421 self.g_header = False
428 self.SysEncoding = sys.getdefaultencoding()
429 self.syscoding = sys.getdefaultencoding()
430 #print 'SysEncoding',self.SysEncoding
431 if self.SysEncoding == 'mac-roman' : self.SysEncoding = 'MacRoman'
434 ##############################################################@
435 self.DisEnSaveTabAs(False)
436 self.ShowMenu(_("View").decode('utf8'), False)
437 self.ShowMenu(_("Matrix analysis").decode('utf8'), False)
438 self.ShowMenu(_("Text analysis").decode('utf8'), False)
449 def finish_init(self) :
451 self.pref.read(self.ConfigPath['preferences'])
454 self.pref.read(self.ConfigPath['preferences'])
461 self.pref.read(self.ConfigPath['preferences'])
463 self.sound = self.pref.getboolean('iramuteq', 'sound')
464 self.check_update = self.pref.getboolean('iramuteq', 'checkupdate')
465 self.version = ConfigGlob.get('DEFAULT', 'version')
466 #configuration des chemins de R
467 self.PathPath = ConfigParser()
468 self.PathPath.read(ConfigPath['path'])
470 if not CheckRPath(self.PathPath) :
471 if sys.platform == 'win32':
472 BestRPath = FindRPAthWin32()
474 BestRPath = FindRPathNix()
476 self.PathPath.set('PATHS', 'rpath', BestRPath)
477 with open(ConfigPath['path'], 'w') as f :
478 self.PathPath.write(f)
482 self.RPath = self.PathPath.get('PATHS', 'rpath')
485 if not RLibsAreInstalled(self) :
489 Le chemin de l'executable de R n'a pas été trouvé.
490 Si R n'est pas installé, vous devez l'installer (http://www.r-project.org/).
491 Si R n'est pas installé dans le répertoire par défaut
492 (souvent C:\Program Files\R\R-2.x.x\R.exe sous windows ou /usr/bin/R sous linux ou Mac Os X)
493 vous devez signaler le chemin de l'éxecutable de R dans les préférences."""
494 dlg = wx.MessageDialog(self, msg, u"Problème de configuration", wx.OK | wx.NO_DEFAULT | wx.ICON_WARNING)
496 if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
501 def setlangue(self) :
503 self.pref.read(self.ConfigPath['preferences'])
504 guilangue = self.pref.get('iramuteq', 'guilanguage')
505 if guilangue == 'french' :
506 self.presLan_fr.install()
508 self.presLan_en.install()
509 mylocale = wx.Locale(langues[guilangue])
510 mylocale.AddCatalogLookupPathPrefix(os.path.join(AppliPath,'locale'))
511 mylocale.AddCatalog('iramuteq')
513 self.presLan_fr.install()
514 mylocale = wx.Locale(langues['french'])
515 mylocale.AddCatalogLookupPathPrefix(os.path.join(AppliPath,'locale'))
516 mylocale.AddCatalog('iramuteq')
519 def OnVerif(self, evt) :
520 pack = CheckRPackages(self)
522 dlg = wx.MessageDialog(self, u"Installation OK", u"Installation", wx.OK | wx.ICON_INFORMATION)
524 if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
527 def DisEnSaveTabAs(self, DISEN):
529 file_menu = self.mb.GetMenu(0)
530 items = file_menu.GetMenuItems()
532 if item.GetId() == ID_SaveTab :
535 def ShowMenu(self, menu, Show=True):
536 menu_pos = self.mb.FindMenu(menu)
537 self.mb.EnableTop(menu_pos, Show)
538 self.mb.UpdateMenus()
541 #--------------------------------------------------------------------
542 def OnClose(self, event):
544 with open(self.ConfigPath['path'], 'w') as f :
545 self.PathPath.write(f)
546 if self.DictTab != {} :
547 savestates = [self.DictTab[item][0] for item in self.DictTab]
548 if False in savestates :
549 notsave = [item for item in self.DictTab if self.DictTab[item][0] == False]
551 Certains résultats ne sont pas enregistrés.
552 Voulez-vous fermer quand mĂŞme ?"""
553 dlg = wx.MessageDialog(self, msg, "Sauvegarde",
554 wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
556 if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
561 for item in notsave :
562 for tmpfile in self.DictTab[item][1:] :
564 print 'remove : ' + tmpfile
576 #if sys.platform == 'win32' :
577 # os.system("taskkill /im iramuteq.exe /f")
578 # print 'meurtre de process'
580 def OnOpenData(self, event):
581 inputname, self.input_path = OnOpen(self, "Data")
583 self.filename = self.input_path[0]
584 self.tableau = Tableau(self,os.path.abspath(self.input_path[0]))
585 get_table_param(self, self.input_path[0])
586 self.tableau.make_content()
587 self.tableau.show_tab()
589 def OnOpenAnalyse(self, event):
590 self.AnalysePath = OnOpen(self, "Analyse")
591 OpenAnalyse(self, self.AnalysePath[1][0], True)
592 self.ShowMenu(_("View"))
594 def OnOpenText(self, event):
595 inputname, self.input_path = OnOpen(self, "Texte")
596 self.filename = self.input_path[0]
600 def OnViewData(self, event):
603 if self.type == "Data":
604 if not self.DataPop :
605 self.Sheet.Populate(self.content)
608 self.ShowAPane(u"Data")
609 elif self.type == "Texte" or self.type == 'Analyse' :
610 if not self.DataTxt :
611 self.text_ctrl_txt.Clear()
612 self.text_ctrl_txt.write(self.content)
613 self.text_ctrl_txt.ShowPosition(0)
616 self.ShowAPane(u"Text")
620 #dial = EncodeDialog(self)
621 dlg = wx.ProgressDialog("Ouverture...",
622 "Veuillez patienter...",
625 style=wx.PD_APP_MODAL | wx.PD_AUTO_HIDE | wx.PD_ELAPSED_TIME | wx.PD_CAN_ABORT
628 builder = Builder(self, dlg)
629 if builder.res == wx.ID_OK :
631 corpus = builder.doanalyse()
632 self.history.add(corpus.parametres)
633 self.tree.OnItemAppend(corpus.parametres)
634 OpenAnalyse(self, corpus.parametres)
639 keepGoing = dlg.Update(count, u"Lecture du fichier")
640 self.ShowMenu(_(u"View").decode('utf8'))
641 self.ShowMenu(_(u"Text analysis").decode('utf8'))
642 self.ShowMenu(_(u"Matrix analysis").decode('utf8'), False)
647 keepGoing = dlg.Update(count, u"Chargement du dictionnaire")
649 #self.OnViewData(wx.EVT_BUTTON)
651 def OnExit(self, event):
654 def OnAbout(self, event):
655 info = wx.AboutDialogInfo()
656 info.Name = ConfigGlob.get('DEFAULT', 'name')
657 info.Version = ConfigGlob.get('DEFAULT', 'version')
658 info.Copyright = ConfigGlob.get('DEFAULT', 'copyright')
659 info.Description = u"""
660 Interface de R pour les Analyses Multidimensionnelles
661 de Textes et de Questionnaires
664 construit avec des logiciels libres.
670 info.WebSite = ("http://www.iramuteq.org", u"Site web IRaMuTeQ")
671 dev = ConfigGlob.get('DEFAULT', 'dev').split(';')
672 info.Developers = dev
673 info.License = u"""Iramuteq est un logiciel libre ; vous pouvez le diffuser et/ou le modifier
674 suivant les termes de la Licence Publique Générale GNU telle que publiée
675 par la Free Software Foundation ; soit la version 2 de cette licence,
676 soit (à votre convenance) une version ultérieure.
678 Iramuteq est diffusé dans l'espoir qu'il sera utile,
679 mais SANS AUCUNE GARANTIEÂ ; sans mĂŞme une garantie implicite
680 de COMMERCIALISATION ou d'ADÉQUATION À UN USAGE PARTICULIER.
681 Voyez la Licence Publique Générale GNU pour plus de détails.
683 Vous devriez avoir reçu une copie de la Licence Publique Générale GNU
684 avec Iramuteq ; sinon, veuillez écrire à la Free Software Foundation,
685 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, États-Unis."""
688 def GetDockArt(self):
689 return self._mgr.GetArtProvider()
694 def OnPageChanged(self, event) :
695 new = event.GetSelection()
696 nobject = event.GetEventObject()
697 parent = nobject.GetParent()
698 if isinstance(parent, IraFrame) :
699 npage = self.nb.GetPage(new)
700 if 'parametres' in dir(npage) :
701 self.tree.GiveFocus(uuid=npage.parametres['uuid'])
703 def OnCloseTab(self, evt):
704 #log.info('Closing tab %s' % str(evt.GetEventObject()))
705 ctrl = evt.GetEventObject()
706 if isinstance(ctrl.GetParent(), aui.AuiNotebook) or isinstance(ctrl.GetParent(), wx.Panel):
710 page = self.nb.GetPage(self.nb.GetSelection())
711 if 'parametres' in dir(page) and isinstance(ctrl.GetParent(), IraFrame) :
712 self.history.rmtab(page.parametres)
713 self.tree.CloseItem(uuid = page.parametres['uuid'])
714 TabTitle = self.nb.GetPageText(self.nb.GetSelection())
715 if self.DictTab != {} :
716 if TabTitle in self.DictTab :
717 ListFile=self.DictTab[TabTitle]
718 if False in ListFile:
720 Certains résultats ne sont pas enregistrer.
721 Voulez-vous fermer quand mĂŞme ?"""
722 dlg = wx.MessageDialog(self, msg, "Sauvegarde",wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
725 if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
730 for f in ListFile[1:] :
735 elif True in ListFile :
738 del self.DictTab[TabTitle]
743 if self.nb.GetPageCount() == 1 and remove and not notebook :
746 def LastTabClose(self) :
747 if self.nb.GetPageCount() == 1 :
748 self.DisEnSaveTabAs(False)
750 self.ShowAPane("Text")
752 self.ShowAPane("Data")
754 self.ShowAPane("Intro_Text")
756 def OnSaveTabAs(self, event):
757 SelectTab = self.nb.GetSelection()
758 TabTitle = self.nb.GetPageText(SelectTab)
759 FileToSave = self.DictTab[TabTitle]
762 self, message="Enregistrer sous...", defaultDir=os.getcwd(),
763 defaultFile="resultat.html", wildcard="Tous les fichiers|*", style=wx.SAVE | wx.OVERWRITE_PROMPT
765 dlg.SetFilterIndex(2)
768 if dlg.ShowModal() == wx.ID_OK:
770 Dirname = os.path.dirname(Path)
771 Filename = dlg.GetFilename()
776 shutil.copyfile(FileToSave[-1], Path)
777 os.remove(FileToSave[len(FileToSave) - 1])
778 NewListFile.append(True)
779 NewListFile.append(Path)
780 for f in FileToSave[1:-1] :
781 Fileout = os.path.join(Dirname, os.path.basename(f))
782 shutil.copyfile(f, Fileout)
783 NewListFile.append(Fileout)
786 self.DictTab[TabText] = NewListFile
787 del self.DictTab[TabTitle]
788 self.nb.SetPageText(SelectTab, TabText)
790 def GetStartPosition(self):
794 pt = self.ClientToScreen(wx.Point(0, 0))
796 return wx.Point(pt.x + x, pt.y + x)
798 def ShowAPane(self, panel):
799 for pane in self._mgr.GetAllPanes() :
800 if not pane.IsToolbar() and pane.name != 'lefttree':
802 self._mgr.GetPane(panel).Show()
805 def OnAcceuil(self, event):
806 self.ShowAPane(u"Intro_Text")
809 def CreateHTMLCtrl(self):
810 ctrl = wx.html.HtmlWindow(self, -1, wx.DefaultPosition, wx.Size(400, 300))
811 if "gtk2" in wx.PlatformInfo:
812 ctrl.SetStandardFonts()
813 ctrl.SetPage(u"text")
816 def ShowTab(self, evt):
817 self.ShowAPane("Tab_content")
819 ################################################################
821 ################################################################
823 def OnFreq(self, event):
829 def OnChi2(self, event):
831 # print('PAS DE DEBUG SUR CHI2')
832 chi = ChiSquare(self)
836 def OnStudent(self, event):
842 def OnRCode(self, event):
848 def OnCHDSIM(self, event):
850 # print 'ATTENTION!!!!'
851 chdsim = ChdCluster(self)
852 if chdsim.val == wx.ID_OK:
857 def OnCHDAlceste(self, event):
859 # print('PLUS DE BUG SUR ALCESTE QUESTIONNAIRE')
860 self.quest = AnalyseQuest(self)
861 if self.quest.val == wx.ID_OK:
866 def OnProto(self, evt) :
867 Prototypical(self, {'type' : 'proto'})
869 def OnSimiTxt(self, evt, corpus = None) :
870 # print 'PLUS DE BUG SUR SIMITXT'
872 #self.Text = SimiTxt(self)
874 corpus = self.tree.getcorpus()
875 self.Text = SimiTxt(self, corpus, parametres = {'type': 'simitxt'}, dlg = progressbar(self, 3))
876 if self.Text.val == wx.ID_OK :
881 def OnWordCloud(self, evt, corpus = None) :
882 # print 'PLUS DE BUG SUR WORDCLOUD'
885 corpus = self.tree.getcorpus()
886 self.Text = WordCloud(self, corpus, parametres = {'type' : 'wordcloud'}, dlg = progressbar(self, 3))
887 if self.Text.val == wx.ID_OK :
892 def OnClusterCloud(self, corpus, parametres = None) :
893 self.Text = ClusterCloud(self, corpus, parametres = parametres, dlg = progressbar(self, 3))
895 def OnAFCM(self, event):
901 def OnTextStat(self, event, corpus = None):
902 #print 'PAS DE BUG SUR TEXT STAT'
905 corpus = self.tree.getcorpus()
906 self.Text = Stat(self, corpus, parametres = {'type': 'stat'}, dlg = progressbar(self, 7))
908 if self.Text.val == wx.ID_OK :
913 def OnTextSpec(self, event, corpus = None):
915 #self.Text = AsLexico(self)
916 #print('ATTENTION : PLUS DE BUG SUR LEXICO')
918 corpus = self.tree.getcorpus()
919 self.Text = Lexico(self, corpus, parametres = {'type' : 'spec'}, dlg = progressbar(self, 3))
920 if self.Text.val == wx.ID_OK :
925 def OnTextAfcm(self, event):
932 def import_factiva_xml(self,event):
934 ImportFactiva(self, 'xml')
938 def import_factiva_mail(self, evt) :
940 ImportFactiva(self, 'mail')
944 def import_factiva_txt(self, evt) :
946 ImportFactiva(self, 'txt')
950 def OnImportTXM(self, evt) :
952 ImportFactiva(self, 'txm')
956 def ExtractTools(self, evt) :
958 if ID == self.ID_splitvar :
959 Extract(self, 'splitvar')
961 Extract(self, 'mods')
963 def OnTextAlceste(self, event, corpus = None):
965 #print('ATTENTION : PLUS DE BUG SUR ALCESTE')
966 #RunAnalyse(self, corpus, Alceste, OptAlceste)
968 corpus = self.tree.getcorpus()
969 self.Text = Alceste(self, corpus, parametres = {'type': 'alceste'}, dlg = progressbar(self,6))
970 if self.Text.val == wx.ID_OK:
975 def OnPamSimple(self, event, corpus = None):
978 corpus = self.tree.getcorpus()
979 self.Text = AnalysePam(self, corpus, parametres = {'type' : 'pamtxt'}, dlg = progressbar(self,6))
980 if self.Text.val == wx.ID_OK:
985 def SimiCluster(self, parametres = {}, fromprof = False, pathout = '', listactives = [], actives = [], tableau = None) :
986 DoSimi(self, param = parametres, fromprof = fromprof, pathout = pathout, listactives = listactives, actives = actives, tableau = tableau)
988 def OnSimi(self,evt):
990 #print 'ATTENTION !!!! VERGES'
991 #print 'PLUS DE BUG SUR SIMI'
992 self.res = DoSimi(self, param = None)
993 #self.res = Verges(self)
994 if self.res.val == wx.ID_OK :
998 #################################################################
1000 def OnHelp(self, event):
1001 webbrowser.open('http://www.iramuteq.org/documentation')
1003 def OnPref(self, event):
1004 dlg = PrefDialog(self)
1005 dlg.CenterOnParent()
1006 self.val = dlg.ShowModal()
1009 if self.check_update:
1012 print 'pas de verif'
1014 #CheckRPackages(self)
1016 def OnOpenFromCmdl(self):
1018 if options.filename :
1019 if os.path.exists(options.filename):
1020 self.filename = os.path.abspath(options.filename)
1024 if os.path.exists(os.path.realpath(args[0])):
1025 self.filename = os.path.abspath(os.path.realpath(args[0]))
1031 if os.path.splitext(self.filename)[1] in ['.csv', '.xls', '.ods']:
1032 self.tableau = Tableau(self, self.filename)
1033 get_table_param(self, self.filename)
1034 self.tableau.make_content()
1035 self.tableau.show_tab()
1036 #open_data(self, self.filename)
1037 elif os.path.splitext(self.filename)[1] == '.txt':
1039 elif os.path.splitext(self.filename)[1] == '.ira' :
1040 #self.corpus = Corpus(self)
1041 #self.Text = OpenAnalyse(self, self.filename)
1042 OpenAnalyse(self, self.filename)
1044 print 'ce fichier n\'existe pas'
1048 class IntroPanel(wx.Panel):
1049 def __init__(self, parent):
1050 wx.Panel.__init__(self, parent)
1051 #col = randint(0, 255)
1052 #col1 = randint(0,255)
1053 #col2 = randint(0,255)
1055 bckgrdcolor = wx.Colour(col, col, col)
1056 self.SetBackgroundColour(bckgrdcolor)
1057 txtcolour = wx.Colour(250, 250, 250)
1058 linkcolor = wx.Colour(255, 0, 0)
1059 sizer1 = wx.BoxSizer(wx.VERTICAL)
1060 sizer2 = wx.BoxSizer(wx.VERTICAL)
1061 sizer3 = wx.BoxSizer(wx.HORIZONTAL)
1062 sizer4 = wx.BoxSizer(wx.VERTICAL)
1063 sizer5 = wx.BoxSizer(wx.HORIZONTAL)
1064 grid_sizer_1 = wx.FlexGridSizer(1, 4, 0, 0)
1065 grid_sizer_3 = wx.FlexGridSizer(1, 4, 0, 0)
1066 grid_sizer_2 = wx.FlexGridSizer(1, 3, 0, 0)
1067 PanelPres = wx.Panel(self)
1068 PanelPres.SetBackgroundColour(bckgrdcolor)
1069 label_1 = wx.StaticText(self, -1, u"IRaMuTeQ", size=(-1, -1))
1070 label_1.SetFont(wx.Font(46, wx.TELETYPE, wx.NORMAL, wx.BOLD, 0, "Purisa"))
1071 label_1.SetForegroundColour(wx.RED)
1072 label2 = wx.StaticText(PanelPres, -1 , u'\nVersion ' + ConfigGlob.get('DEFAULT', 'version') + '\n')
1073 label2.SetForegroundColour(txtcolour)
1074 label2.SetBackgroundColour(bckgrdcolor)
1075 #label3 = wx.StaticText(PanelPres, -1 , u'Equipe ')
1076 #label3.SetForegroundColour(txtcolour)
1077 #label3.SetBackgroundColour(bckgrdcolor)
1078 self.hyper2 = hl.HyperLinkCtrl(PanelPres, wx.ID_ANY, u"REPERE", URL="http://repere.no-ip.org/")
1079 self.hyper2.SetColours(linkcolor, linkcolor, "RED")
1080 self.hyper2.SetBackgroundColour(bckgrdcolor)
1081 self.hyper2.EnableRollover(True)
1082 self.hyper2.SetUnderlines(False, False, True)
1083 self.hyper2.SetBold(True)
1084 self.hyper2.UpdateLink()
1085 label_lerass = wx.StaticText(PanelPres, -1, u'Laboratoire ')
1086 label_lerass.SetForegroundColour(txtcolour)
1087 label_lerass.SetBackgroundColour(bckgrdcolor)
1088 self.hyper_lerass = hl.HyperLinkCtrl(PanelPres, -1, u'LERASS', URL="http://www.lerass.com")
1089 self.hyper_lerass.SetColours(linkcolor, linkcolor, "RED")
1090 self.hyper_lerass.SetBackgroundColour(bckgrdcolor)
1091 self.hyper_lerass.EnableRollover(True)
1092 self.hyper_lerass.SetUnderlines(False, False, True)
1093 self.hyper_lerass.SetBold(True)
1094 self.hyper_lerass.UpdateLink()
1095 blank = wx.StaticText(PanelPres, -1, u'\n')
1096 blank1 = wx.StaticText(PanelPres, -1, u'\n')
1097 labellicence = wx.StaticText(PanelPres, -1, u'Licence GNU GPL')
1098 labellicence.SetForegroundColour(txtcolour)
1099 labellicence.SetBackgroundColour(bckgrdcolor)
1100 labelcopy = wx.StaticText(PanelPres, -1, ConfigGlob.get('DEFAULT', 'copyright'))
1101 labelcopy.SetForegroundColour(txtcolour)
1102 labelcopy.SetBackgroundColour(bckgrdcolor)
1103 python_img = wx.Image(os.path.join(ImagePath,'python-logo.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1104 r_img = wx.Image(os.path.join(ImagePath,'Rlogo.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1105 lexique_img = wx.Image(os.path.join(ImagePath,'LexTexte4.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1106 but_python = wx.BitmapButton(self, -1, python_img)
1107 but_lexique = wx.BitmapButton(self, -1, lexique_img)
1108 but_r = wx.BitmapButton(self, -1, r_img)
1109 self.Bind(wx.EVT_BUTTON, self.OnPython, but_python)
1110 self.Bind(wx.EVT_BUTTON, self.OnLexique, but_lexique)
1111 self.Bind(wx.EVT_BUTTON, self.OnR, but_r)
1114 #grid_sizer_1.Add(label3, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1115 grid_sizer_1.Add(self.hyper2, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1116 grid_sizer_3.Add(label_lerass, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1117 grid_sizer_3.Add(self.hyper_lerass, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1118 sizer4.Add(label_1, 0, wx.ALIGN_CENTER, 5)
1119 sizer2.Add(label2, 0, wx.ALIGN_CENTER, 5)
1120 #sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1121 sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1122 sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1123 sizer2.Add(grid_sizer_3, 0, wx.ALIGN_CENTER, 5)
1124 sizer2.Add(wx.StaticText(PanelPres, -1, u' '), 0, wx.ALIGN_CENTER, 5)
1125 #sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1126 #sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1127 sizer2.Add(grid_sizer_1, 0, wx.ALIGN_CENTER, 5)
1128 sizer2.Add(labellicence, 0, wx.ALIGN_CENTER, 5)
1129 sizer2.Add(labelcopy, 0, wx.ALIGN_CENTER, 5)
1130 sizer1.Add(sizer4, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1131 PanelPres.SetSizer(sizer2)
1132 sizer5.Add(blank, 1, wx.EXPAND | wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 2)
1133 sizer5.Add(PanelPres, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1134 sizer5.Add(blank1, 1, wx.ALIGN_CENTER_HORIZONTAL,2)
1135 grid_sizer_2.Add(but_python, 1, wx.ALIGN_CENTER_HORIZONTAL| wx.ALIGN_CENTER_VERTICAL)
1136 grid_sizer_2.Add(but_lexique, 1,wx.ALIGN_CENTER_HORIZONTAL| wx.ALIGN_CENTER_VERTICAL)
1137 grid_sizer_2.Add(but_r, 1, wx.ALIGN_CENTER_HORIZONTAL| wx.ALIGN_CENTER_VERTICAL)
1139 sizer1.Add(sizer5, 3, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 1)
1140 sizer1.Add(grid_sizer_2, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL)
1141 self.SetSizer(sizer1)
1144 def OnPython(self,evt):
1145 webbrowser.open('http://www.python.org')
1147 def OnLexique(self,evt):
1148 webbrowser.open('http://www.lexique.org')
1151 webbrowser.open('http://www.r-project.org')
1153 class MySplashScreen(wx.SplashScreen):
1155 bmp = wx.Image(os.path.join(ImagePath, 'splash.png')).ConvertToBitmap()
1156 wx.SplashScreen.__init__(self, bmp,
1157 wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
1159 self.Bind(wx.EVT_CLOSE, self.OnClose)
1160 self.fc = wx.FutureCall(1, self.ShowMain)
1162 def OnClose(self, evt):
1166 if self.fc.IsRunning():
1171 frame = IraFrame(None, -1, "IRaMuTeQ " + ConfigGlob.get('DEFAULT', 'version'), size=(1100, 800))
1175 frame.OnOpenFromCmdl()
1176 # if self.fc.IsRunning():
1178 #wx.CallAfter(frame.ShowTip)
1180 class MyApp(wx.App):
1183 Create and show the splash screen. It will then create and show
1184 the main frame when it is time to do so.
1186 wx.SystemOptions.SetOptionInt("mac.window-plain-transition", 1)
1187 self.SetAppName("Iramuteq")
1188 splash = MySplashScreen()
1196 if __name__ == '__main__':