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 ##########################################################
100 #elements de configuration
101 ##########################################################
103 if sys.platform == 'darwin' :
104 sys.setdefaultencoding('UTF-8')
105 wx.SetDefaultPyEncoding('UTF-8')
107 sys.setdefaultencoding(locale.getpreferredencoding())
109 #chemin de l'application
110 AppliPath = os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0])))
112 ImagePath = os.path.join(AppliPath, 'images')
113 #configuration generale
114 DictConfigPath = ConstructGlobalPath(AppliPath)
115 ConfigGlob = ConfigParser()
116 ConfigGlob.read(DictConfigPath['global'])
117 #repertoire de l'utilisateur
118 if os.getenv('HOME') != None:
119 user_home = os.getenv('HOME')
121 user_home = os.getenv('HOMEPATH')
122 UserConfigPath = os.path.abspath(os.path.join(user_home, '.iramuteq'))
123 #Si pas de fichiers de config utilisateur, on cree le repertoire
124 CreateIraDirectory(UserConfigPath, AppliPath)
125 #fichiers log pour windows (py2exe)
126 log = logging.getLogger('iramuteq')
127 fh = logging.FileHandler(os.path.join(UserConfigPath,'stdout.log'))
128 formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
129 fh.setFormatter(formatter)
131 if sys.platform != 'win32' and sys.platform != 'darwin':
132 ch = logging.StreamHandler()
133 ch.setFormatter(formatter)
135 log.setLevel(logging.INFO)
137 class writer(object):
138 def write(self, data):
139 if data.strip() != '' :
140 log.info('ERROR : %s' % data)
142 class printer(object) :
143 def write(self, data) :
144 if data.strip() != '' :
145 log.info('Print : %s' % data)
147 sys.stderr = writer()
148 sys.stdout = printer()
150 ConfigPath = ConstructConfigPath(UserConfigPath)
152 langues = {'french' : wx.LANGUAGE_FRENCH,
153 'english' : wx.LANGUAGE_ENGLISH,}
154 #####################################################################
156 class IraFrame(wx.Frame):
157 def __init__(self, parent, id= -1, title="", pos=wx.DefaultPosition,
158 size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE |
161 log.info('Starting...')
162 wx.Frame.__init__(self, parent, id, title, pos, size, style)
164 self.AppliPath = AppliPath
165 self.images_path = os.path.join(AppliPath,'images')
166 self.UserConfigPath = UserConfigPath
167 #self.RscriptsPath = ConstructRscriptsPath(AppliPath)
168 self.RscriptsPath = PathOut(dirout=os.path.join(AppliPath, 'Rscripts'))
169 self.RscriptsPath.basefiles(RscriptsPath)
170 #self.DictPath = ConstructDicoPath(AppliPath)
171 self.DictPath = ConstructDicoPath(UserConfigPath)
172 self.ConfigGlob = ConfigGlob
173 self.ConfigPath = ConstructConfigPath(UserConfigPath)
174 self.pref = RawConfigParser()
175 #workaround for import problem
176 self.SimiFromCluster = SimiFromCluster
178 gettext.install('iramuteq', os.path.join(AppliPath,'locale'), unicode=True)
179 self.presLan_fr = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=['fr_FR'])
180 self.presLan_en = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=['en'])
182 # tell FrameManager to manage this frame
183 #self._mgr = wx.aui.AuiManager()
184 self._mgr = aui.AuiManager()
185 self._mgr.SetManagedWindow(self)
188 #--------------------------------------------------------------------------------
189 self.mb = wx.MenuBar()
191 file_menu = wx.Menu()
192 item = wx.MenuItem(file_menu, ID_OpenData, _(u"Open a matrix").decode('utf8'), _(u"Open a matrix").decode('utf8'))
193 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
194 file_menu.AppendItem(item)
196 item = wx.MenuItem(file_menu, ID_OpenText, _(u"Open a text corpora").decode('utf8'), _(u"Open a text corpora").decode('utf8'))
197 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
198 file_menu.AppendItem(item)
200 item = wx.MenuItem(file_menu, ID_OnOpenAnalyse, _(u"Open an analysis").decode('utf8'), _(u"Open an analysis").decode('utf8'))
201 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
202 file_menu.AppendItem(item)
205 menuFactiva = wx.Menu()
206 fact_from_xml = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from xml").decode('utf8'))
207 fact_from_mail = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from mail").decode('utf8'))
208 fact_from_txt = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from copy/paste").decode('utf8'))
209 menuFactiva.AppendItem(fact_from_xml)
210 menuFactiva.AppendItem(fact_from_mail)
211 menuFactiva.AppendItem(fact_from_txt)
212 file_menu.AppendMenu(-1, _(u"Import from factiva"), menuFactiva)
214 menuTools = wx.Menu()
215 splitvar = wx.MenuItem(menuTools, wx.ID_ANY, _(u"Split from variable").decode('utf8'))
216 extractmod = wx.MenuItem(menuTools, wx.ID_ANY, _(u"Extract mods").decode('utf8'))
217 menuTools.AppendItem(splitvar)
218 menuTools.AppendItem(extractmod)
219 self.ID_splitvar = splitvar.GetId()
220 self.ID_extractmod = extractmod.GetId()
221 file_menu.AppendMenu(-1, _(u"Tools"), menuTools)
224 item = wx.MenuItem(file_menu, ID_SaveTab, _(u"Save tab as...").decode('utf8'), _(u"Save tab as...").decode('utf8'))
225 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_SAVE_AS))
226 file_menu.AppendItem(item)
228 file_menu.Append(wx.ID_EXIT, _(u"Exit"))
230 edit_menu = wx.Menu()
231 edit_menu.Append(wx.ID_PREFERENCES, '', _(u'Preferences').decode('utf8'))
233 view_menu = wx.Menu()
234 view_menu.Append(ID_ACCEUIL, _(u"Home page").decode('utf8'))
235 view_menu.Append(ID_VIEWDATA, _(u"Show data").decode('utf8'))
236 view_menu.Append(ID_RESULT, _(u'Show results').decode('utf8'))
237 #view_menu.AppendSeparator()
239 analyse_menu = wx.Menu()
240 analyse_menu.Append(ID_Freq, u"Fréquences")
241 analyse_menu.Append(ID_Chi2, u"Chi2")
242 #analyse_menu.Append(ID_Student, u"t de Student")
243 menu_classif = wx.Menu()
244 menu_classif.Append(ID_CHDAlceste, u"Méthode GNEPA")
245 #menu_classif.Append(ID_CHDSIM, u"Par matrice des distances")
246 analyse_menu.AppendMenu(-1, u"Classification", menu_classif)
247 #analyse_menu.Append(ID_AFCM, u"AFCM")
248 analyse_menu.Append(ID_SIMI, u"Analyse de similitudes")
249 analyse_menu.Append(ID_proto, _(u"Prototypical analysis"))
250 ID_RCODE = wx.NewId()
251 analyse_menu.Append(ID_RCODE, u"Code R...")
253 text_menu = wx.Menu()
254 #text_menu.Append(ID_CHECKCORPUS, u"Vérifier le corpus")
255 text_menu.Append(ID_TEXTSTAT, u"Statistiques textuelles")
256 text_menu.Append(ID_ASLEX, u"Spécificités et AFC")
257 #text_menu.Append(ID_TEXTAFCM, u"AFC sur UCI / Vocabulaire")
258 menu_classiftxt = wx.Menu()
259 menu_classiftxt.Append(ID_TEXTALCESTE, u"Méthode GNEPA")
260 #menu_classiftxt.Append(ID_TEXTPAM, u"Par matrice des distances")
261 text_menu.AppendMenu(-1, u"Classification", menu_classiftxt)
262 text_menu.Append(ID_SimiTxt, u'Analyse de similitude')
264 text_menu.Append(ID_WC, u'Nuage de mots')
266 help_menu = wx.Menu()
267 help_menu.Append(wx.ID_ABOUT, u'À propos...')
268 help_menu.Append(wx.ID_HELP, u'Aide en ligne')
270 self.mb.Append(file_menu, _(u"File").decode('utf8'))
271 self.mb.Append(edit_menu, _(u"Edition").decode('utf8'))
272 self.mb.Append(view_menu, _(u"View").decode('utf8'))
273 self.mb.Append(analyse_menu, _("Spreadsheet analysis").decode('utf8'))
274 self.mb.Append(text_menu, _(u"Text analysis").decode('utf8'))
275 self.mb.Append(help_menu, _(u"Help").decode('utf8'))
277 self.SetMenuBar(self.mb)
278 #--------------------------------------------------------------------
279 self.statusbar = self.CreateStatusBar(2, wx.ST_SIZEGRIP)
280 self.statusbar.SetStatusWidths([-2, -3])
281 self.statusbar.SetStatusText(u"Prêt", 0)
282 self.statusbar.SetStatusText(u"Bienvenue", 1)
284 # min size for the frame itself isn't completely done.
285 # see the end up FrameManager::Update() for the test
286 # code. For now, just hard code a frame minimum size
287 self.SetMinSize(wx.Size(400, 400))
289 # create some toolbars
290 tb1 = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize,
291 wx.TB_FLAT | wx.TB_NODIVIDER)
292 tb1.SetToolBitmapSize(wx.Size(16, 16))
293 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")
295 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")
299 #------------------------------------------------------------------------------------------------
301 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)
303 #self._mgr.AddPane(self.text_ctrl_txt, wx.aui.AuiPaneInfo().
304 # Name("Text").CenterPane())
305 self._mgr.AddPane(self.text_ctrl_txt, aui.AuiPaneInfo().
306 Name("Text").CenterPane())
307 #self._mgr.AddPane(IntroPanel(self), wx.aui.AuiPaneInfo().Name("Intro_Text").
309 self._mgr.AddPane(IntroPanel(self), aui.AuiPaneInfo().Name("Intro_Text").
311 #if not os.path.exists(os.path.join(UserConfigPath, 'history.db')) :
312 # with open(os.path.join(UserConfigPath, 'history.db'), 'w') as f :
314 self.history = History(os.path.join(UserConfigPath, 'history.db'))
315 self.tree = LeftTree(self)
316 self._mgr.AddPane(self.tree, aui.AuiPaneInfo().Name("lefttree").Caption("Navigateur").
317 Left().MinSize(wx.Size(200,500)).Layer(1).Position(1).CloseButton(False).MaximizeButton(True).
318 MinimizeButton(True))
320 #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)
321 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)
322 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
323 self.nb.SetAGWWindowStyleFlag(notebook_flags)
324 self.nb.SetArtProvider(aui.ChromeTabArt())
325 #self.nb.SetArtProvider(aui.VC8TabArt())
326 #self.nb.parent = self
327 #self._notebook_style = aui.AUI_NB_DEFAULT_STYLE | aui.AUI_NB_TAB_EXTERNAL_MOVE | wx.NO_BORDER
328 #self._mgr.AddPane(self.nb, wx.aui.AuiPaneInfo().
329 # Name("Tab_content").
331 self._mgr.AddPane(self.nb, aui.AuiPaneInfo().
334 self.Sheet = MySheet(self)
335 #self._mgr.AddPane(self.Sheet, wx.aui.AuiPaneInfo().Name("Data").CenterPane())
336 self._mgr.AddPane(self.Sheet, aui.AuiPaneInfo().Name("Data").CenterPane())
337 self.nb.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.OnCloseTab)
338 self.nb.Bind(aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
339 # add the toolbars to the manager
341 #self._mgr.AddPane(tb1, wx.aui.AuiPaneInfo().
342 # Name("tb1").Caption("Fichiers").
343 # ToolbarPane().Top().
344 # LeftDockable(False).RightDockable(False))
345 self._mgr.AddPane(tb1, aui.AuiPaneInfo().
346 Name("tb1").Caption("Fichiers").
348 LeftDockable(True).RightDockable(False))
350 self.ShowAPane("Intro_Text")
351 self._mgr.GetPane("lefttree").Show()
352 self._mgr.GetPane("classif_tb").Hide()
353 # "commit" all changes made to FrameManager
356 # Show How To Use The Closing Panes Event
357 ##################################################################
358 self.Bind(wx.EVT_MENU, self.OnAcceuil, id=ID_ACCEUIL)
359 self.Bind(wx.EVT_MENU, self.OnViewData, id=ID_VIEWDATA)
360 self.Bind(wx.EVT_MENU, self.ShowTab, id=ID_RESULT)
361 self.Bind(wx.EVT_MENU, self.OnOpenData, id=ID_OpenData)
362 self.Bind(wx.EVT_MENU, self.OnOpenText, id=ID_OpenText)
363 self.Bind(wx.EVT_MENU, self.OnOpenAnalyse, id=ID_OnOpenAnalyse)
364 self.Bind(wx.EVT_MENU, self.import_factiva_xml, fact_from_xml)
365 self.Bind(wx.EVT_MENU, self.import_factiva_mail, fact_from_mail)
366 self.Bind(wx.EVT_MENU, self.import_factiva_txt, fact_from_txt)
367 self.Bind(wx.EVT_MENU, self.ExtractTools, splitvar)
368 self.Bind(wx.EVT_MENU, self.ExtractTools, extractmod)
369 self.Bind(wx.EVT_MENU, self.OnFreq, id=ID_Freq)
370 self.Bind(wx.EVT_MENU, self.OnChi2, id=ID_Chi2)
371 self.Bind(wx.EVT_MENU, self.OnStudent, id=ID_Student)
372 self.Bind(wx.EVT_MENU, self.OnCHDSIM, id=ID_CHDSIM)
373 self.Bind(wx.EVT_MENU, self.OnCHDAlceste, id=ID_CHDAlceste)
374 self.Bind(wx.EVT_MENU, self.OnAFCM, id=ID_AFCM)
375 self.Bind(wx.EVT_MENU, self.OnProto, id=ID_proto)
376 self.Bind(wx.EVT_MENU, self.OnRCode, id=ID_RCODE)
377 #self.Bind(wx.EVT_MENU, self.OnCheckcorpus, id = ID_CHECKCORPUS)
378 self.Bind(wx.EVT_MENU, self.OnTextStat, id=ID_TEXTSTAT)
379 self.Bind(wx.EVT_MENU, self.OnTextSpec, id=ID_ASLEX)
380 self.Bind(wx.EVT_MENU, self.OnTextAfcm, id=ID_TEXTAFCM)
381 self.Bind(wx.EVT_MENU, self.OnTextAlceste, id=ID_TEXTALCESTE)
382 self.Bind(wx.EVT_MENU, self.OnPamSimple, id=ID_TEXTPAM)
383 self.Bind(wx.EVT_MENU, self.OnSimiTxt, id=ID_SimiTxt)
384 self.Bind(wx.EVT_MENU, self.OnWordCloud, id=ID_WC)
385 self.Bind(wx.EVT_MENU, self.OnSimi, id=ID_SIMI)
386 self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT)
387 self.Bind(wx.EVT_MENU, self.OnSaveTabAs, id=ID_SaveTab)
388 self.Bind(wx.EVT_MENU, self.OnAbout, id=wx.ID_ABOUT)
389 self.Bind(wx.EVT_MENU, self.OnHelp, id=wx.ID_HELP)
390 self.Bind(wx.EVT_MENU, self.OnPref, id=wx.ID_PREFERENCES)
391 self.Bind(wx.EVT_CLOSE, self.OnClose)
392 ##################################################################
393 flags = self._mgr.GetAGWFlags()
394 #flags &= ~wx.aui.AUI_MGR_TRANSPARENT_HINT
395 #flags &= ~wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT
396 #flags &= ~wx.aui.AUI_MGR_RECTANGLE_HINT
397 flags &= ~(aui.AUI_MGR_RECTANGLE_HINT | aui.AUI_MGR_ALLOW_FLOATING)
398 self._mgr.SetAGWFlags(self._mgr.GetAGWFlags() ^ (aui.AUI_MGR_RECTANGLE_HINT | aui.AUI_MGR_ALLOW_FLOATING))
399 self._mgr.GetArtProvider().SetMetric(aui.AUI_DOCKART_GRADIENT_TYPE, aui.AUI_GRADIENT_HORIZONTAL)
400 self.GetDockArt().SetColor(aui.AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR, "#00FFF9")
403 self._icon = wx.Icon(os.path.join(ImagePath, "iraicone.ico"), wx.BITMAP_TYPE_ICO)
404 self.SetIcon(self._icon)
405 ##########################
407 self.input_path = [False]
408 self.TEMPDIR = tempfile.mkdtemp('iramuteq')
409 self.FileTabList = []
415 self.g_header = False
422 self.SysEncoding = sys.getdefaultencoding()
423 self.syscoding = sys.getdefaultencoding()
424 #print 'SysEncoding',self.SysEncoding
425 if self.SysEncoding == 'mac-roman' : self.SysEncoding = 'MacRoman'
428 ##############################################################@
429 self.DisEnSaveTabAs(False)
430 self.ShowMenu(_("View"), False)
431 self.ShowMenu(_("Spreadsheet analysis"), False)
432 self.ShowMenu(_("Text analysis"), False)
443 def finish_init(self) :
445 self.pref.read(self.ConfigPath['preferences'])
448 self.pref.read(self.ConfigPath['preferences'])
455 self.pref.read(self.ConfigPath['preferences'])
457 self.sound = self.pref.getboolean('iramuteq', 'sound')
458 self.check_update = self.pref.getboolean('iramuteq', 'checkupdate')
459 self.version = ConfigGlob.get('DEFAULT', 'version')
460 #configuration des chemins de R
461 self.PathPath = ConfigParser()
462 self.PathPath.read(ConfigPath['path'])
464 if not CheckRPath(self.PathPath) :
465 if sys.platform == 'win32':
466 BestRPath = FindRPAthWin32()
468 BestRPath = FindRPathNix()
470 self.PathPath.set('PATHS', 'rpath', BestRPath)
471 with open(ConfigPath['path'], 'w') as f :
472 self.PathPath.write(f)
476 self.RPath = self.PathPath.get('PATHS', 'rpath')
479 if not RLibsAreInstalled(self) :
483 Le chemin de l'executable de R n'a pas été trouvé.
484 Si R n'est pas installé, vous devez l'installer (http://www.r-project.org/).
485 Si R n'est pas installé dans le répertoire par défaut
486 (souvent C:\Program Files\R\R-2.x.x\R.exe sous windows ou /usr/bin/R sous linux ou Mac Os X)
487 vous devez signaler le chemin de l'éxecutable de R dans les préférences."""
488 dlg = wx.MessageDialog(self, msg, u"Problème de configuration", wx.OK | wx.NO_DEFAULT | wx.ICON_WARNING)
490 if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
495 def setlangue(self) :
497 self.pref.read(self.ConfigPath['preferences'])
498 guilangue = self.pref.get('iramuteq', 'guilanguage')
499 if guilangue == 'french' :
500 self.presLan_fr.install()
502 self.presLan_en.install()
503 mylocale = wx.Locale(langues[guilangue])
504 mylocale.AddCatalogLookupPathPrefix(os.path.join(AppliPath,'locale'))
505 mylocale.AddCatalog('iramuteq')
507 self.presLan_fr.install()
508 mylocale = wx.Locale(langues['french'])
509 mylocale.AddCatalogLookupPathPrefix(os.path.join(AppliPath,'locale'))
510 mylocale.AddCatalog('iramuteq')
513 def OnVerif(self, evt) :
514 pack = CheckRPackages(self)
516 dlg = wx.MessageDialog(self, u"Installation OK", u"Installation", wx.OK | wx.ICON_INFORMATION)
518 if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
521 def DisEnSaveTabAs(self, DISEN):
523 file_menu = self.mb.GetMenu(0)
524 items = file_menu.GetMenuItems()
526 if item.GetId() == ID_SaveTab :
529 def ShowMenu(self, menu, Show=True):
530 menu_pos = self.mb.FindMenu(menu)
531 self.mb.EnableTop(menu_pos, Show)
532 self.mb.UpdateMenus()
535 #--------------------------------------------------------------------
536 def OnClose(self, event):
538 with open(self.ConfigPath['path'], 'w') as f :
539 self.PathPath.write(f)
540 if self.DictTab != {} :
541 savestates = [self.DictTab[item][0] for item in self.DictTab]
542 if False in savestates :
543 notsave = [item for item in self.DictTab if self.DictTab[item][0] == False]
545 Certains résultats ne sont pas enregistrés.
546 Voulez-vous fermer quand même ?"""
547 dlg = wx.MessageDialog(self, msg, "Sauvegarde",
548 wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
550 if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
555 for item in notsave :
556 for tmpfile in self.DictTab[item][1:] :
558 print 'remove : ' + tmpfile
570 #if sys.platform == 'win32' :
571 # os.system("taskkill /im iramuteq.exe /f")
572 # print 'meurtre de process'
574 def OnOpenData(self, event):
575 inputname, self.input_path = OnOpen(self, "Data")
577 self.filename = self.input_path[0]
578 self.tableau = Tableau(self,os.path.abspath(self.input_path[0]))
579 get_table_param(self, self.input_path[0])
580 self.tableau.make_content()
581 self.tableau.show_tab()
583 def OnOpenAnalyse(self, event):
584 self.AnalysePath = OnOpen(self, "Analyse")
585 OpenAnalyse(self, self.AnalysePath[1][0], True)
586 self.ShowMenu(_("View"))
588 def OnOpenText(self, event):
589 inputname, self.input_path = OnOpen(self, "Texte")
590 self.filename = self.input_path[0]
594 def OnViewData(self, event):
597 if self.type == "Data":
598 if not self.DataPop :
599 self.Sheet.Populate(self.content)
602 self.ShowAPane(u"Data")
603 elif self.type == "Texte" or self.type == 'Analyse' :
604 if not self.DataTxt :
605 self.text_ctrl_txt.Clear()
606 self.text_ctrl_txt.write(self.content)
607 self.text_ctrl_txt.ShowPosition(0)
610 self.ShowAPane(u"Text")
614 #dial = EncodeDialog(self)
615 dlg = wx.ProgressDialog("Ouverture...",
616 "Veuillez patienter...",
619 style=wx.PD_APP_MODAL | wx.PD_AUTO_HIDE | wx.PD_ELAPSED_TIME | wx.PD_CAN_ABORT
622 builder = Builder(self, dlg)
623 if builder.res == wx.ID_OK :
625 corpus = builder.doanalyse()
626 self.history.add(corpus.parametres)
627 self.tree.OnItemAppend(corpus.parametres)
628 OpenAnalyse(self, corpus.parametres)
631 #self.content = DoConf().totext(corpus.parametres)
632 # parametres = DoConf(os.path.join(UserConfigPath,'corpus.cfg')).getoptions('corpus')
633 # parametres['originalpath'] = self.filename
635 # parametres['pathout'] = PathOut(self.filename, 'corpus').dirout
636 # dial = CorpusPref(self, parametres)
637 # dial.CenterOnParent()
638 # dial.txtpath.SetLabel(self.filename)
639 # res = dial.ShowModal()
640 # parametres = dial.doparametres()
642 # ReadLexique(self, lang = parametres['lang'])
643 # self.expressions = ReadDicoAsDico(self.DictPath.get(parametres['lang'], 'french_exp'))
644 # corpus = BuildFromAlceste(self.filename, parametres, self.lexique, self.expressions).corpus
645 #self.corpus_encodage = dial.encodages[dial.list_encodages.GetSelection()][0]
646 #self.corpus_lang = dial.langues[dial.choice_dict.GetSelection()]
649 keepGoing = dlg.Update(count, u"Lecture du fichier")
650 # msg = u"Ce fichier ne semble pas être encodé en %s" % self.corpus_encodage
651 # dial = wx.MessageDialog(self, msg, u"Problème d'encodage", wx.OK | wx.NO_DEFAULT | wx.ICON_WARNING)
652 # dial.CenterOnParent()
653 # res = dial.ShowModal()
656 self.ShowMenu(_("View"))
657 self.ShowMenu(_("Text analysis"))
658 self.ShowMenu(_(u"Spreadsheet analysis"), False)
663 keepGoing = dlg.Update(count, u"Chargement du dictionnaire")
665 #self.OnViewData(wx.EVT_BUTTON)
667 def OnExit(self, event):
670 def OnAbout(self, event):
671 info = wx.AboutDialogInfo()
672 info.Name = ConfigGlob.get('DEFAULT', 'name')
673 info.Version = ConfigGlob.get('DEFAULT', 'version')
674 info.Copyright = ConfigGlob.get('DEFAULT', 'copyright')
675 info.Description = u"""
676 Interface de R pour les Analyses Multidimensionnelles
677 de Textes et de Questionnaires
680 construit avec des logiciels libres.
686 info.WebSite = ("http://www.iramuteq.org", u"Site web IRaMuTeQ")
687 dev = ConfigGlob.get('DEFAULT', 'dev').split(';')
688 info.Developers = dev
689 info.License = u"""Iramuteq est un logiciel libre ; vous pouvez le diffuser et/ou le modifier
690 suivant les termes de la Licence Publique Générale GNU telle que publiée
691 par la Free Software Foundation ; soit la version 2 de cette licence,
692 soit (à votre convenance) une version ultérieure.
694 Iramuteq est diffusé dans l'espoir qu'il sera utile,
695 mais SANS AUCUNE GARANTIE ; sans même une garantie implicite
696 de COMMERCIALISATION ou d'ADÉQUATION À UN USAGE PARTICULIER.
697 Voyez la Licence Publique Générale GNU pour plus de détails.
699 Vous devriez avoir reçu une copie de la Licence Publique Générale GNU
700 avec Iramuteq ; sinon, veuillez écrire à la Free Software Foundation,
701 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, États-Unis."""
704 def GetDockArt(self):
705 return self._mgr.GetArtProvider()
710 def OnPageChanged(self, event) :
711 new = event.GetSelection()
712 nobject = event.GetEventObject()
713 parent = nobject.GetParent()
714 if isinstance(parent, IraFrame) :
715 npage = self.nb.GetPage(new)
716 if 'parametres' in dir(npage) :
717 self.tree.GiveFocus(uuid=npage.parametres['uuid'])
719 def OnCloseTab(self, evt):
720 #log.info('Closing tab %s' % str(evt.GetEventObject()))
721 ctrl = evt.GetEventObject()
722 if isinstance(ctrl.GetParent(), aui.AuiNotebook) or isinstance(ctrl.GetParent(), wx.Panel):
726 page = self.nb.GetPage(self.nb.GetSelection())
727 if 'parametres' in dir(page) and isinstance(ctrl.GetParent(), IraFrame) :
728 self.history.rmtab(page.parametres)
729 self.tree.CloseItem(uuid = page.parametres['uuid'])
730 TabTitle = self.nb.GetPageText(self.nb.GetSelection())
731 if self.DictTab != {} :
732 if TabTitle in self.DictTab :
733 ListFile=self.DictTab[TabTitle]
734 if False in ListFile:
736 Certains résultats ne sont pas enregistrer.
737 Voulez-vous fermer quand même ?"""
738 dlg = wx.MessageDialog(self, msg, "Sauvegarde",wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
741 if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
746 for f in ListFile[1:] :
751 elif True in ListFile :
754 del self.DictTab[TabTitle]
759 if self.nb.GetPageCount() == 1 and remove and not notebook :
762 def LastTabClose(self) :
763 if self.nb.GetPageCount() == 1 :
764 self.DisEnSaveTabAs(False)
766 self.ShowAPane("Text")
768 self.ShowAPane("Data")
770 self.ShowAPane("Intro_Text")
772 def OnSaveTabAs(self, event):
773 SelectTab = self.nb.GetSelection()
774 TabTitle = self.nb.GetPageText(SelectTab)
775 FileToSave = self.DictTab[TabTitle]
778 self, message="Enregistrer sous...", defaultDir=os.getcwd(),
779 defaultFile="resultat.html", wildcard="Tous les fichiers|*", style=wx.SAVE | wx.OVERWRITE_PROMPT
781 dlg.SetFilterIndex(2)
784 if dlg.ShowModal() == wx.ID_OK:
786 Dirname = os.path.dirname(Path)
787 Filename = dlg.GetFilename()
792 shutil.copyfile(FileToSave[-1], Path)
793 os.remove(FileToSave[len(FileToSave) - 1])
794 NewListFile.append(True)
795 NewListFile.append(Path)
796 for f in FileToSave[1:-1] :
797 Fileout = os.path.join(Dirname, os.path.basename(f))
798 shutil.copyfile(f, Fileout)
799 NewListFile.append(Fileout)
802 self.DictTab[TabText] = NewListFile
803 del self.DictTab[TabTitle]
804 self.nb.SetPageText(SelectTab, TabText)
806 def GetStartPosition(self):
810 pt = self.ClientToScreen(wx.Point(0, 0))
812 return wx.Point(pt.x + x, pt.y + x)
814 def ShowAPane(self, panel):
815 for pane in self._mgr.GetAllPanes() :
816 if not pane.IsToolbar() and pane.name != 'lefttree':
818 self._mgr.GetPane(panel).Show()
821 def OnAcceuil(self, event):
822 self.ShowAPane(u"Intro_Text")
825 def CreateHTMLCtrl(self):
826 ctrl = wx.html.HtmlWindow(self, -1, wx.DefaultPosition, wx.Size(400, 300))
827 if "gtk2" in wx.PlatformInfo:
828 ctrl.SetStandardFonts()
829 ctrl.SetPage(u"text")
832 def ShowTab(self, evt):
833 self.ShowAPane("Tab_content")
835 ################################################################
837 ################################################################
839 def OnFreq(self, event):
845 def OnChi2(self, event):
847 # print('PAS DE DEBUG SUR CHI2')
848 chi = ChiSquare(self)
852 def OnStudent(self, event):
858 def OnRCode(self, event):
864 def OnCHDSIM(self, event):
866 # print 'ATTENTION!!!!'
867 chdsim = ChdCluster(self)
868 if chdsim.val == wx.ID_OK:
873 def OnCHDAlceste(self, event):
875 # print('PLUS DE BUG SUR ALCESTE QUESTIONNAIRE')
876 self.quest = AnalyseQuest(self)
877 if self.quest.val == wx.ID_OK:
882 def OnProto(self, evt) :
883 Prototypical(self, {'type' : 'proto'})
885 def OnSimiTxt(self, evt, corpus = None) :
886 # print 'PLUS DE BUG SUR SIMITXT'
888 #self.Text = SimiTxt(self)
890 corpus = self.tree.getcorpus()
891 self.Text = SimiTxt(self, corpus, parametres = {'type': 'simitxt'}, dlg = progressbar(self, 3))
892 if self.Text.val == wx.ID_OK :
897 def OnWordCloud(self, evt, corpus = None) :
898 # print 'PLUS DE BUG SUR WORDCLOUD'
901 corpus = self.tree.getcorpus()
902 self.Text = WordCloud(self, corpus, parametres = {'type' : 'wordcloud'}, dlg = progressbar(self, 3))
903 if self.Text.val == wx.ID_OK :
908 def OnClusterCloud(self, corpus, parametres = None) :
909 self.Text = ClusterCloud(self, corpus, parametres = parametres, dlg = progressbar(self, 3))
911 def OnAFCM(self, event):
917 # def OnCheckcorpus(self, evt):
923 def OnTextStat(self, event, corpus = None):
924 #print 'PAS DE BUG SUR TEXT STAT'
927 corpus = self.tree.getcorpus()
928 self.Text = Stat(self, corpus, parametres = {'type': 'stat'}, dlg = progressbar(self, 7))
930 if self.Text.val == wx.ID_OK :
935 def OnTextSpec(self, event, corpus = None):
937 #self.Text = AsLexico(self)
938 #print('ATTENTION : PLUS DE BUG SUR LEXICO')
940 corpus = self.tree.getcorpus()
941 self.Text = Lexico(self, corpus, parametres = {'type' : 'spec'}, dlg = progressbar(self, 3))
942 if self.Text.val == wx.ID_OK :
947 def OnTextAfcm(self, event):
954 def import_factiva_xml(self,event):
956 ImportFactiva(self, 'xml')
960 def import_factiva_mail(self, evt) :
962 ImportFactiva(self, 'mail')
966 def import_factiva_txt(self, evt) :
968 ImportFactiva(self, 'txt')
972 def ExtractTools(self, evt) :
974 if ID == self.ID_splitvar :
975 Extract(self, 'splitvar')
977 Extract(self, 'mods')
979 def OnTextAlceste(self, event, corpus = None):
981 #print('ATTENTION : PLUS DE BUG SUR ALCESTE')
982 #RunAnalyse(self, corpus, Alceste, OptAlceste)
984 corpus = self.tree.getcorpus()
985 self.Text = Alceste(self, corpus, parametres = {'type': 'alceste'}, dlg = progressbar(self,6))
986 if self.Text.val == wx.ID_OK:
991 def OnPamSimple(self, event, corpus = None):
994 corpus = self.tree.getcorpus()
995 self.Text = AnalysePam(self, corpus, parametres = {'type' : 'pamtxt'}, dlg = progressbar(self,6))
996 if self.Text.val == wx.ID_OK:
1001 def SimiCluster(self, parametres = {}, fromprof = False, pathout = '', listactives = [], actives = [], tableau = None) :
1002 DoSimi(self, param = parametres, fromprof = fromprof, pathout = pathout, listactives = listactives, actives = actives, tableau = tableau)
1004 def OnSimi(self,evt):
1006 #print 'ATTENTION !!!! VERGES'
1007 #print 'PLUS DE BUG SUR SIMI'
1008 self.res = DoSimi(self, param = None)
1009 #self.res = Verges(self)
1010 if self.res.val == wx.ID_OK :
1014 #################################################################
1016 def OnHelp(self, event):
1017 webbrowser.open('http://www.iramuteq.org/documentation')
1019 def OnPref(self, event):
1020 dlg = PrefDialog(self)
1021 dlg.CenterOnParent()
1022 self.val = dlg.ShowModal()
1025 if self.check_update:
1028 print 'pas de verif'
1030 #CheckRPackages(self)
1032 def OnOpenFromCmdl(self):
1034 if options.filename :
1035 if os.path.exists(options.filename):
1036 self.filename = os.path.abspath(options.filename)
1040 if os.path.exists(os.path.realpath(args[0])):
1041 self.filename = os.path.abspath(os.path.realpath(args[0]))
1047 if os.path.splitext(self.filename)[1] in ['.csv', '.xls', '.ods']:
1048 self.tableau = Tableau(self, self.filename)
1049 get_table_param(self, self.filename)
1050 self.tableau.make_content()
1051 self.tableau.show_tab()
1052 #open_data(self, self.filename)
1053 elif os.path.splitext(self.filename)[1] == '.txt':
1055 elif os.path.splitext(self.filename)[1] == '.ira' :
1056 #self.corpus = Corpus(self)
1057 #self.Text = OpenAnalyse(self, self.filename)
1058 OpenAnalyse(self, self.filename)
1060 print 'ce fichier n\'existe pas'
1064 class IntroPanel(wx.Panel):
1065 def __init__(self, parent):
1066 wx.Panel.__init__(self, parent)
1067 #col = randint(0, 255)
1068 #col1 = randint(0,255)
1069 #col2 = randint(0,255)
1071 bckgrdcolor = wx.Colour(col, col, col)
1072 self.SetBackgroundColour(bckgrdcolor)
1073 txtcolour = wx.Colour(250, 250, 250)
1074 linkcolor = wx.Colour(255, 0, 0)
1075 sizer1 = wx.BoxSizer(wx.VERTICAL)
1076 sizer2 = wx.BoxSizer(wx.VERTICAL)
1077 sizer3 = wx.BoxSizer(wx.HORIZONTAL)
1078 sizer4 = wx.BoxSizer(wx.VERTICAL)
1079 sizer5 = wx.BoxSizer(wx.HORIZONTAL)
1080 grid_sizer_1 = wx.FlexGridSizer(1, 4, 0, 0)
1081 grid_sizer_3 = wx.FlexGridSizer(1, 4, 0, 0)
1082 grid_sizer_2 = wx.FlexGridSizer(1, 3, 0, 0)
1083 PanelPres = wx.Panel(self)
1084 PanelPres.SetBackgroundColour(bckgrdcolor)
1085 label_1 = wx.StaticText(self, -1, u"IRaMuTeQ", size=(-1, -1))
1086 label_1.SetFont(wx.Font(46, wx.TELETYPE, wx.NORMAL, wx.BOLD, 0, "Purisa"))
1087 label_1.SetForegroundColour(wx.RED)
1088 label2 = wx.StaticText(PanelPres, -1 , u'\nVersion ' + ConfigGlob.get('DEFAULT', 'version') + '\n')
1089 label2.SetForegroundColour(txtcolour)
1090 label2.SetBackgroundColour(bckgrdcolor)
1091 #label3 = wx.StaticText(PanelPres, -1 , u'Equipe ')
1092 #label3.SetForegroundColour(txtcolour)
1093 #label3.SetBackgroundColour(bckgrdcolor)
1094 self.hyper2 = hl.HyperLinkCtrl(PanelPres, wx.ID_ANY, u"REPERE", URL="http://repere.no-ip.org/")
1095 self.hyper2.SetColours(linkcolor, linkcolor, "RED")
1096 self.hyper2.SetBackgroundColour(bckgrdcolor)
1097 self.hyper2.EnableRollover(True)
1098 self.hyper2.SetUnderlines(False, False, True)
1099 self.hyper2.SetBold(True)
1100 self.hyper2.UpdateLink()
1101 label_lerass = wx.StaticText(PanelPres, -1, u'Laboratoire ')
1102 label_lerass.SetForegroundColour(txtcolour)
1103 label_lerass.SetBackgroundColour(bckgrdcolor)
1104 self.hyper_lerass = hl.HyperLinkCtrl(PanelPres, -1, u'LERASS', URL="http://www.lerass.com")
1105 self.hyper_lerass.SetColours(linkcolor, linkcolor, "RED")
1106 self.hyper_lerass.SetBackgroundColour(bckgrdcolor)
1107 self.hyper_lerass.EnableRollover(True)
1108 self.hyper_lerass.SetUnderlines(False, False, True)
1109 self.hyper_lerass.SetBold(True)
1110 self.hyper_lerass.UpdateLink()
1111 blank = wx.StaticText(PanelPres, -1, u'\n')
1112 blank1 = wx.StaticText(PanelPres, -1, u'\n')
1113 labellicence = wx.StaticText(PanelPres, -1, u'Licence GNU GPL')
1114 labellicence.SetForegroundColour(txtcolour)
1115 labellicence.SetBackgroundColour(bckgrdcolor)
1116 labelcopy = wx.StaticText(PanelPres, -1, ConfigGlob.get('DEFAULT', 'copyright'))
1117 labelcopy.SetForegroundColour(txtcolour)
1118 labelcopy.SetBackgroundColour(bckgrdcolor)
1119 python_img = wx.Image(os.path.join(ImagePath,'python-logo.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1120 r_img = wx.Image(os.path.join(ImagePath,'Rlogo.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1121 lexique_img = wx.Image(os.path.join(ImagePath,'LexTexte4.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1122 but_python = wx.BitmapButton(self, -1, python_img)
1123 but_lexique = wx.BitmapButton(self, -1, lexique_img)
1124 but_r = wx.BitmapButton(self, -1, r_img)
1125 self.Bind(wx.EVT_BUTTON, self.OnPython, but_python)
1126 self.Bind(wx.EVT_BUTTON, self.OnLexique, but_lexique)
1127 self.Bind(wx.EVT_BUTTON, self.OnR, but_r)
1130 #grid_sizer_1.Add(label3, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1131 grid_sizer_1.Add(self.hyper2, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1132 grid_sizer_3.Add(label_lerass, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1133 grid_sizer_3.Add(self.hyper_lerass, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1134 sizer4.Add(label_1, 0, wx.ALIGN_CENTER, 5)
1135 sizer2.Add(label2, 0, wx.ALIGN_CENTER, 5)
1136 #sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1137 sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1138 sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1139 sizer2.Add(grid_sizer_3, 0, wx.ALIGN_CENTER, 5)
1140 sizer2.Add(wx.StaticText(PanelPres, -1, u' '), 0, wx.ALIGN_CENTER, 5)
1141 #sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1142 #sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1143 sizer2.Add(grid_sizer_1, 0, wx.ALIGN_CENTER, 5)
1144 sizer2.Add(labellicence, 0, wx.ALIGN_CENTER, 5)
1145 sizer2.Add(labelcopy, 0, wx.ALIGN_CENTER, 5)
1146 sizer1.Add(sizer4, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1147 PanelPres.SetSizer(sizer2)
1148 sizer5.Add(blank, 1, wx.EXPAND | wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 2)
1149 sizer5.Add(PanelPres, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1150 sizer5.Add(blank1, 1, wx.ALIGN_CENTER_HORIZONTAL,2)
1151 grid_sizer_2.Add(but_python, 1, wx.ALIGN_CENTER_HORIZONTAL| wx.ALIGN_CENTER_VERTICAL)
1152 grid_sizer_2.Add(but_lexique, 1,wx.ALIGN_CENTER_HORIZONTAL| wx.ALIGN_CENTER_VERTICAL)
1153 grid_sizer_2.Add(but_r, 1, wx.ALIGN_CENTER_HORIZONTAL| wx.ALIGN_CENTER_VERTICAL)
1155 sizer1.Add(sizer5, 3, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 1)
1156 sizer1.Add(grid_sizer_2, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL)
1157 self.SetSizer(sizer1)
1160 def OnPython(self,evt):
1161 webbrowser.open('http://www.python.org')
1163 def OnLexique(self,evt):
1164 webbrowser.open('http://www.lexique.org')
1167 webbrowser.open('http://www.r-project.org')
1169 class MySplashScreen(wx.SplashScreen):
1171 bmp = wx.Image(os.path.join(ImagePath, 'splash.png')).ConvertToBitmap()
1172 wx.SplashScreen.__init__(self, bmp,
1173 wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
1175 self.Bind(wx.EVT_CLOSE, self.OnClose)
1176 self.fc = wx.FutureCall(1, self.ShowMain)
1178 def OnClose(self, evt):
1182 if self.fc.IsRunning():
1187 frame = IraFrame(None, -1, "IRaMuTeQ " + ConfigGlob.get('DEFAULT', 'version'), size=(1100, 800))
1191 frame.OnOpenFromCmdl()
1192 # if self.fc.IsRunning():
1194 #wx.CallAfter(frame.ShowTip)
1196 class MyApp(wx.App):
1199 Create and show the splash screen. It will then create and show
1200 the main frame when it is time to do so.
1202 wx.SystemOptions.SetOptionInt("mac.window-plain-transition", 1)
1203 self.SetAppName("Iramuteq")
1204 splash = MySplashScreen()
1212 if __name__ == '__main__':