2 # -*- coding: utf-8 -*-
3 #Author: Pierre Ratinaud
4 #Copyright (c) 2008-2012, Pierre Ratinaud
7 from optparse import OptionParser
8 from wx import BusyCursor
10 parser = OptionParser()
11 parser.add_option("-f", "--file", dest="filename",
12 help="open FILE", metavar="FILE", default=False)
13 (options, args) = parser.parse_args()
21 from random import randint
22 from ConfigParser import ConfigParser, RawConfigParser
26 #------------------------------------
28 import wx.lib.agw.aui as aui
31 import wx.lib.hyperlink as hl
32 #------------------------------------
33 from functions import BugReport, PlaySound, History
34 from checkversion import NewVersion
35 from guifunct import *
36 from tableau import Tableau
37 from dialog import PrefDialog
38 from tabfrequence import Frequences, FreqMultiple
39 from tabchi2 import ChiSquare
40 #from tabstudent import MakeStudent
41 from tabchddist import ChdCluster
42 from tabafcm import DoAFCM
43 from tabchdalc import AnalyseQuest
44 from tabsimi import DoSimi
45 from tabrsimple import InputText
46 from tabverges import Prototypical
47 from tabsplitvar import SplitMatrixFromVar
48 from textdist import AnalysePam
49 from textstat import Stat
50 from textaslexico import Lexico
51 from textsimi import SimiTxt, SimiFromCluster
52 from textwordcloud import WordCloud, ClusterCloud
53 from textreinert import Reinert
54 #from textcheckcorpus import checkcorpus
55 from openanalyse import OpenAnalyse
56 from corpus import Builder, SubBuilder
57 from checkinstall import CreateIraDirectory, CheckRPath, FindRPAthWin32, FindRPathNix, CheckRPackages, IsNew, UpgradeConf, CopyConf, RLibsAreInstalled
58 from chemins import RscriptsPath, ConstructConfigPath, ConstructDicoPath, ConstructGlobalPath, PathOut
59 from parse_factiva_xml import ImportFactiva
60 from tools import Extract
62 from tree import LeftTree
63 ##########################################################
64 ID_OpenData = wx.NewId()
65 ID_Import = wx.NewId()
66 ID_OpenText = wx.NewId()
67 ID_OnOpenAnalyse = wx.NewId()
70 ID_Student = wx.NewId()
71 ID_CHDSIM = wx.NewId()
72 ID_CHDReinert = wx.NewId()
73 ID_TEXTAFCM = wx.NewId()
74 ID_TEXTSTAT = wx.NewId()
76 ID_TEXTREINERT = wx.NewId()
77 ID_TEXTPAM = wx.NewId()
78 ID_CHECKCORPUS = wx.NewId()
79 ID_Tabcontent = wx.NewId()
82 ID_CloseTab = wx.NewId()
83 ID_SaveTab = wx.NewId()
84 ID_CreateText = wx.NewId()
85 ID_ACCEUIL = wx.NewId()
86 ID_RESULT = wx.NewId()
87 ID_VIEWDATA = wx.NewId()
88 ID_HTMLcontent = wx.NewId()
89 ID_SimiTxt = wx.NewId()
91 ID_ImportTXM = wx.NewId()
92 ID_FreqMulti = wx.NewId()
93 ##########################################################
94 #elements de configuration
95 ##########################################################
97 if sys.platform == 'darwin' :
98 sys.setdefaultencoding('UTF-8')
99 wx.SetDefaultPyEncoding('UTF-8')
101 sys.setdefaultencoding(locale.getpreferredencoding())
103 #chemin de l'application
104 AppliPath = os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0])))
106 ImagePath = os.path.join(AppliPath, 'images')
107 #configuration generale
108 DictConfigPath = ConstructGlobalPath(AppliPath)
109 ConfigGlob = ConfigParser()
110 ConfigGlob.read(DictConfigPath['global'])
111 DefaultConf = ConfigParser()
112 DefaultConf.read(DictConfigPath['preferences'])
113 #repertoire de l'utilisateur
114 if os.getenv('HOME') != None:
115 user_home = os.getenv('HOME')
117 user_home = os.getenv('HOMEPATH')
118 UserConfigPath = os.path.abspath(os.path.join(user_home, '.iramuteq'))
119 #Si pas de fichiers de config utilisateur, on cree le repertoire
120 CreateIraDirectory(UserConfigPath, AppliPath)
121 #fichiers log pour windows (py2exe)
122 log = logging.getLogger('iramuteq')
123 fh = logging.FileHandler(os.path.join(UserConfigPath,'stdout.log'))
124 formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
125 fh.setFormatter(formatter)
127 if sys.platform != 'win32' and sys.platform != 'darwin':
128 ch = logging.StreamHandler()
129 ch.setFormatter(formatter)
131 log.setLevel(logging.INFO)
133 class writer(object):
134 def write(self, data):
135 if data.strip() != '' :
136 log.info('ERROR : %s' % data)
138 class printer(object) :
139 def write(self, data) :
140 if data.strip() != '' :
141 log.info('Print : %s' % data)
143 sys.stderr = writer()
144 sys.stdout = printer()
146 ConfigPath = ConstructConfigPath(UserConfigPath)
148 langues = {'french' : wx.LANGUAGE_FRENCH,
149 'english' : wx.LANGUAGE_ENGLISH,
150 'portuguese' : wx.LANGUAGE_PORTUGUESE,
151 'italian' : wx.LANGUAGE_ITALIAN,
152 'spanish' : wx.LANGUAGE_SPANISH
155 code_langues = {'french' : 'fr_FR',
157 'portuguese' : 'pt_PT',
161 #####################################################################
163 class IraFrame(wx.Frame):
164 def __init__(self, parent, id= -1, title="", pos=wx.DefaultPosition,
165 size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE |
168 log.info('Starting...')
169 wx.Frame.__init__(self, parent, id, title, pos, size, style)
171 self.AppliPath = AppliPath
172 self.images_path = os.path.join(AppliPath,'images')
173 self.UserConfigPath = UserConfigPath
174 #self.RscriptsPath = ConstructRscriptsPath(AppliPath)
175 self.RscriptsPath = PathOut(dirout=os.path.join(AppliPath, 'Rscripts'))
176 self.RscriptsPath.basefiles(RscriptsPath)
177 #self.DictPath = ConstructDicoPath(AppliPath)
178 self.DictPath = ConstructDicoPath(UserConfigPath)
179 self.ConfigGlob = ConfigGlob
180 self.ConfigPath = ConstructConfigPath(UserConfigPath)
181 self.pref = RawConfigParser()
182 #workaround for import problem
183 self.SimiFromCluster = SimiFromCluster
185 gettext.install('iramuteq', os.path.join(AppliPath,'locale'), unicode=True)
186 #langues = ['fr_FR', 'en', 'pt_PT']
190 for langue in code_langues :
191 self.preslangue[langue] = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=[code_langues[langue]])
193 #self.presLan_fr = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=['fr_FR'])
194 #self.presLan_en = gettext.translation("iramuteq", os.path.join(AppliPath,'locale'), languages=['en'])
195 # tell FrameManager to manage this frame
196 #self._mgr = wx.aui.AuiManager()
197 self._mgr = aui.AuiManager()
198 self._mgr.SetManagedWindow(self)
201 #--------------------------------------------------------------------------------
202 self.mb = wx.MenuBar()
204 file_menu = wx.Menu()
205 item = wx.MenuItem(file_menu, ID_OpenData, _(u"Open a matrix").decode('utf8'), _(u"Open a matrix").decode('utf8'))
206 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
207 file_menu.AppendItem(item)
209 item = wx.MenuItem(file_menu, ID_OpenText, _(u"Open a text corpus").decode('utf8'), _(u"Open a text corpus").decode('utf8'))
210 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
211 file_menu.AppendItem(item)
213 item = wx.MenuItem(file_menu, ID_OnOpenAnalyse, _(u"Open an analysis").decode('utf8'), _(u"Open an analysis").decode('utf8'))
214 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
215 file_menu.AppendItem(item)
218 menuFactiva = wx.Menu()
219 fact_from_xml = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from xml").decode('utf8'))
220 fact_from_mail = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from mail").decode('utf8'))
221 fact_from_txt = wx.MenuItem(menuFactiva, wx.ID_ANY, _(u"from copy/paste").decode('utf8'))
222 menuFactiva.AppendItem(fact_from_xml)
223 menuFactiva.AppendItem(fact_from_mail)
224 menuFactiva.AppendItem(fact_from_txt)
225 file_menu.AppendMenu(-1, _(u"Import from factiva").decode('utf8'), menuFactiva)
227 item = wx.MenuItem(file_menu, ID_ImportTXM, _(u"Import from TXM").decode('utf8'), _(u"Import from TXM").decode('utf8'))
228 item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
229 file_menu.AppendItem(item)
231 menuTools = wx.Menu()
232 splitvar = wx.MenuItem(menuTools, wx.ID_ANY, _(u"Split from variable").decode('utf8'))
233 extractmod = wx.MenuItem(menuTools, wx.ID_ANY, _(u"Extract mods").decode('utf8'))
234 extractthem = wx.MenuItem(menuTools, wx.ID_ANY, _(u"Extract thematics").decode('utf8'))
235 menuTools.AppendItem(splitvar)
236 menuTools.AppendItem(extractmod)
237 menuTools.AppendItem(extractthem)
238 self.ID_splitvar = splitvar.GetId()
239 self.ID_extractmod = extractmod.GetId()
240 self.ID_extractthem = extractthem.GetId()
241 file_menu.AppendMenu(-1, _(u"Tools").decode('utf8'), menuTools)
244 #item = wx.MenuItem(file_menu, ID_SaveTab, _(u"Save tab as...").decode('utf8'), _(u"Save tab as...").decode('utf8'))
245 #item.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FILE_SAVE_AS))
246 #file_menu.AppendItem(item)
248 file_menu.Append(wx.ID_EXIT, _(u"Exit").decode('utf8'))
250 edit_menu = wx.Menu()
251 edit_menu.Append(wx.ID_PREFERENCES, '', _(u'Preferences').decode('utf8'))
253 view_menu = wx.Menu()
254 view_menu.Append(ID_ACCEUIL, _(u"Home page").decode('utf8'))
255 view_menu.Append(ID_VIEWDATA, _(u"Show data").decode('utf8'))
256 view_menu.Append(ID_RESULT, _(u'Show results').decode('utf8'))
257 #view_menu.AppendSeparator()
258 matrix_menu = wx.Menu()
259 matrix_menu.Append(ID_Freq, _(u"Frequencies").decode('utf8'))
260 matrix_menu.Append(ID_FreqMulti, _(u'Multiple frequencies').decode('utf8'))
261 matrix_menu.Append(ID_Chi2, _(u"Chi2").decode('utf8'))
262 #matrix_menu.Append(ID_Student, u"t de Student")
263 menu_classif = wx.Menu()
264 menu_classif.Append(ID_CHDReinert, _(u"Reinert's Method").decode('utf8'))
265 #menu_classif.Append(ID_CHDSIM, u"Par matrice des distances")
266 matrix_menu.AppendMenu(-1, _(u"Clustering").decode('utf8'), menu_classif)
267 #matrix_menu.Append(ID_AFCM, u"AFCM")
268 matrix_menu.Append(ID_SIMI, _(u"Similarities Analysis").decode('utf8'))
269 matrix_menu.Append(ID_proto, _(u"Prototypical Analysis").decode('utf8'))
270 ID_RCODE = wx.NewId()
271 matrix_menu.Append(ID_RCODE, u"Code R...")
272 #menu_splittab = wx.Menu()
273 #ID_SPLITVAR = wx.NewId()
274 #splitvar = wx.MenuItem(menu_splittab, ID_SPLITVAR, _(u"Split from variable").decode('utf8'))
275 #menu_splittab.AppendItem(splitvar)
276 #matrix_menu.AppendMenu(-1, _(u"Split matrix").decode('utf8'), menu_splittab)
277 self.matrix_menu = matrix_menu
279 text_menu = wx.Menu()
280 #text_menu.Append(ID_CHECKCORPUS, u"Vérifier le corpus")
281 text_menu.Append(ID_TEXTSTAT, _(u"Statistics").decode('utf8'))
282 text_menu.Append(ID_ASLEX, _(u"Specificities and CA").decode('utf8'))
283 #text_menu.Append(ID_TEXTAFCM, u"AFC sur UCI / Vocabulaire")
284 menu_classiftxt = wx.Menu()
285 menu_classiftxt.Append(ID_TEXTREINERT, _(u"Reinert's Method").decode('utf8'))
286 #menu_classiftxt.Append(ID_TEXTPAM, u"Par matrice des distances")
287 text_menu.AppendMenu(-1, _(u"Clustering").decode('utf8'), menu_classiftxt)
288 text_menu.Append(ID_SimiTxt, _(u"Similarities Analysis").decode('utf8'))
290 text_menu.Append(ID_WC, _(u"WordCloud").decode('utf8'))
291 self.text_menu = text_menu
293 help_menu = wx.Menu()
294 help_menu.Append(wx.ID_ABOUT, _(u"About...").decode('utf8'))
295 help_menu.Append(wx.ID_HELP, _(u"Online help...").decode('utf8'))
297 self.mb.Append(file_menu, _(u"File").decode('utf8'))
298 self.mb.Append(edit_menu, _(u"Edition").decode('utf8'))
299 self.mb.Append(view_menu, _(u"View").decode('utf8'))
300 self.mb.Append(matrix_menu, _(u"Matrix analysis").decode('utf8'))
301 self.mb.Append(text_menu, _(u"Text analysis").decode('utf8'))
302 self.mb.Append(help_menu, _(u"Help").decode('utf8'))
304 self.SetMenuBar(self.mb)
305 #--------------------------------------------------------------------
306 self.statusbar = self.CreateStatusBar(2, wx.ST_SIZEGRIP)
307 self.statusbar.SetStatusWidths([-2, -3])
308 self.statusbar.SetStatusText(_(u"Ready"), 0)
309 self.statusbar.SetStatusText(_(u"Welcome"), 1)
311 # min size for the frame itself isn't completely done.
312 # see the end up FrameManager::Update() for the test
313 # code. For now, just hard code a frame minimum size
314 self.SetMinSize(wx.Size(400, 400))
316 # create some toolbars
317 tb1 = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize,
318 wx.TB_FLAT | wx.TB_NODIVIDER)
319 tb1.SetToolBitmapSize(wx.Size(16, 16))
320 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")
322 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")
326 #------------------------------------------------------------------------------------------------
328 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)
330 #self._mgr.AddPane(self.text_ctrl_txt, wx.aui.AuiPaneInfo().
331 # Name("Text").CenterPane())
332 self._mgr.AddPane(self.text_ctrl_txt, aui.AuiPaneInfo().
333 Name("Text").CenterPane())
334 #self._mgr.AddPane(IntroPanel(self), wx.aui.AuiPaneInfo().Name("Intro_Text").
336 self._mgr.AddPane(IntroPanel(self), aui.AuiPaneInfo().Name("Intro_Text").
338 #if not os.path.exists(os.path.join(UserConfigPath, 'history.db')) :
339 # with open(os.path.join(UserConfigPath, 'history.db'), 'w') as f :
341 self.history = History(os.path.join(UserConfigPath, 'history.db'))
342 self.tree = LeftTree(self)
343 self._mgr.AddPane(self.tree, aui.AuiPaneInfo().Name("lefttree").Caption(_(u"Navigator").decode('utf8')).
344 Left().MinSize(wx.Size(200,500)).Layer(1).Position(1).CloseButton(False).MaximizeButton(True).
345 MinimizeButton(True))
347 #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)
348 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)
349 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
350 self.nb.SetAGWWindowStyleFlag(notebook_flags)
351 self.nb.SetArtProvider(aui.ChromeTabArt())
352 #self.nb.SetArtProvider(aui.VC8TabArt())
353 #self.nb.parent = self
354 #self._notebook_style = aui.AUI_NB_DEFAULT_STYLE | aui.AUI_NB_TAB_EXTERNAL_MOVE | wx.NO_BORDER
355 #self._mgr.AddPane(self.nb, wx.aui.AuiPaneInfo().
356 # Name("Tab_content").
358 self._mgr.AddPane(self.nb, aui.AuiPaneInfo().
362 #self._mgr.AddPane(self.Sheet, wx.aui.AuiPaneInfo().Name("Data").CenterPane())
363 #self._mgr.AddPane(self.Sheet, aui.AuiPaneInfo().Name("Data").CenterPane())
364 self.nb.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.OnCloseTab)
365 self.nb.Bind(aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
366 # add the toolbars to the manager
368 #self._mgr.AddPane(tb1, wx.aui.AuiPaneInfo().
369 # Name("tb1").Caption("Fichiers").
370 # ToolbarPane().Top().
371 # LeftDockable(False).RightDockable(False))
372 self._mgr.AddPane(tb1, aui.AuiPaneInfo().
373 Name("tb1").Caption("Fichiers").
375 LeftDockable(True).RightDockable(False))
377 self.ShowAPane("Intro_Text")
378 self._mgr.GetPane("lefttree").Show()
379 self._mgr.GetPane("classif_tb").Hide()
380 # "commit" all changes made to FrameManager
383 # Show How To Use The Closing Panes Event
384 ##################################################################
385 self.Bind(wx.EVT_MENU, self.OnAcceuil, id=ID_ACCEUIL)
386 self.Bind(wx.EVT_MENU, self.OnViewData, id=ID_VIEWDATA)
387 self.Bind(wx.EVT_MENU, self.ShowTab, id=ID_RESULT)
388 self.Bind(wx.EVT_MENU, self.OnOpenData, id=ID_OpenData)
389 self.Bind(wx.EVT_MENU, self.OnOpenText, id=ID_OpenText)
390 self.Bind(wx.EVT_MENU, self.OnOpenAnalyse, id=ID_OnOpenAnalyse)
391 self.Bind(wx.EVT_MENU, self.import_factiva_xml, fact_from_xml)
392 self.Bind(wx.EVT_MENU, self.import_factiva_mail, fact_from_mail)
393 self.Bind(wx.EVT_MENU, self.import_factiva_txt, fact_from_txt)
394 self.Bind(wx.EVT_MENU, self.ExtractTools, splitvar)
395 self.Bind(wx.EVT_MENU, self.ExtractTools, extractmod)
396 self.Bind(wx.EVT_MENU, self.ExtractTools, extractthem)
397 self.Bind(wx.EVT_MENU, self.OnFreq, id=ID_Freq)
398 self.Bind(wx.EVT_MENU, self.OnFreqMulti, id=ID_FreqMulti)
399 self.Bind(wx.EVT_MENU, self.OnChi2, id=ID_Chi2)
400 self.Bind(wx.EVT_MENU, self.OnStudent, id=ID_Student)
401 self.Bind(wx.EVT_MENU, self.OnCHDSIM, id=ID_CHDSIM)
402 self.Bind(wx.EVT_MENU, self.OnCHDReinert, id=ID_CHDReinert)
403 self.Bind(wx.EVT_MENU, self.OnAFCM, id=ID_AFCM)
404 self.Bind(wx.EVT_MENU, self.OnProto, id=ID_proto)
405 self.Bind(wx.EVT_MENU, self.OnRCode, id=ID_RCODE)
406 #self.Bind(wx.EVT_MENU, self.OnSplitVar, id=ID_SPLITVAR)
407 #self.Bind(wx.EVT_MENU, self.OnCheckcorpus, id = ID_CHECKCORPUS)
408 self.Bind(wx.EVT_MENU, self.OnTextStat, id=ID_TEXTSTAT)
409 self.Bind(wx.EVT_MENU, self.OnTextSpec, id=ID_ASLEX)
410 self.Bind(wx.EVT_MENU, self.OnTextAfcm, id=ID_TEXTAFCM)
411 self.Bind(wx.EVT_MENU, self.OnTextReinert, id=ID_TEXTREINERT)
412 self.Bind(wx.EVT_MENU, self.OnPamSimple, id=ID_TEXTPAM)
413 self.Bind(wx.EVT_MENU, self.OnSimiTxt, id=ID_SimiTxt)
414 self.Bind(wx.EVT_MENU, self.OnWordCloud, id=ID_WC)
415 self.Bind(wx.EVT_MENU, self.OnSimiTab, id=ID_SIMI)
416 self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT)
417 #self.Bind(wx.EVT_MENU, self.OnSaveTabAs, id=ID_SaveTab)
418 self.Bind(wx.EVT_MENU, self.OnAbout, id=wx.ID_ABOUT)
419 self.Bind(wx.EVT_MENU, self.OnHelp, id=wx.ID_HELP)
420 self.Bind(wx.EVT_MENU, self.OnPref, id=wx.ID_PREFERENCES)
421 self.Bind(wx.EVT_MENU, self.OnImportTXM, id=ID_ImportTXM)
422 self.Bind(wx.EVT_CLOSE, self.OnClose)
423 ##################################################################
424 flags = self._mgr.GetAGWFlags()
425 #flags &= ~wx.aui.AUI_MGR_TRANSPARENT_HINT
426 #flags &= ~wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT
427 #flags &= ~wx.aui.AUI_MGR_RECTANGLE_HINT
428 flags &= ~(aui.AUI_MGR_RECTANGLE_HINT | aui.AUI_MGR_ALLOW_FLOATING)
429 self._mgr.SetAGWFlags(self._mgr.GetAGWFlags() ^ (aui.AUI_MGR_RECTANGLE_HINT | aui.AUI_MGR_ALLOW_FLOATING))
430 self._mgr.GetArtProvider().SetMetric(aui.AUI_DOCKART_GRADIENT_TYPE, aui.AUI_GRADIENT_HORIZONTAL)
431 self.GetDockArt().SetColor(aui.AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR, "#00FFF9")
434 self._icon = wx.Icon(os.path.join(ImagePath, "iraicone.ico"), wx.BITMAP_TYPE_ICO)
435 self.SetIcon(self._icon)
436 ##########################
438 self.input_path = [False]
439 self.TEMPDIR = tempfile.mkdtemp('iramuteq')
440 self.FileTabList = []
446 self.g_header = False
453 self.SysEncoding = sys.getdefaultencoding()
454 self.syscoding = sys.getdefaultencoding()
455 #print 'SysEncoding',self.SysEncoding
456 if self.SysEncoding == 'mac-roman' : self.SysEncoding = 'MacRoman'
459 ##############################################################@
460 self.DisEnSaveTabAs(False)
461 self.ShowMenu('view', False)
462 self.ShowMenu('matrix', False)
463 self.ShowMenu('text', False)
474 def finish_init(self) :
476 self.pref.read(self.ConfigPath['preferences'])
479 self.pref.read(self.ConfigPath['preferences'])
486 self.pref.read(self.ConfigPath['preferences'])
488 self.sound = self.pref.getboolean('iramuteq', 'sound')
489 self.check_update = self.pref.getboolean('iramuteq', 'checkupdate')
490 self.version = ConfigGlob.get('DEFAULT', 'version')
491 #configuration des chemins de R
492 self.PathPath = ConfigParser()
493 self.PathPath.read(ConfigPath['path'])
495 if not CheckRPath(self.PathPath) :
496 if sys.platform == 'win32':
497 BestRPath = FindRPAthWin32()
499 BestRPath = FindRPathNix()
501 self.PathPath.set('PATHS', 'rpath', BestRPath)
502 with open(ConfigPath['path'], 'w') as f :
503 self.PathPath.write(f)
507 self.RPath = self.PathPath.get('PATHS', 'rpath')
510 if not RLibsAreInstalled(self) :
514 Le chemin de l'executable de R n'a pas été trouvé.
515 Si R n'est pas installé, vous devez l'installer (http://www.r-project.org/).
516 Si R n'est pas installé dans le répertoire par défaut
517 (souvent C:\Program Files\R\R-2.x.x\R.exe sous windows ou /usr/bin/R sous linux ou Mac Os X)
518 vous devez signaler le chemin de l'éxecutable de R dans les préférences."""
519 dlg = wx.MessageDialog(self, msg, u"Problème de configuration", wx.OK | wx.NO_DEFAULT | wx.ICON_WARNING)
521 if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
525 def setlangue(self) :
526 self.pref.read(self.ConfigPath['preferences'])
528 guilangue = self.pref.get('iramuteq', 'guilanguage')
530 guilangue = DefaultConf.get('iramuteq', 'guilanguage')
531 self.preslangue.get(guilangue, 'english').install()
533 def OnVerif(self, evt) :
534 pack = CheckRPackages(self)
536 dlg = wx.MessageDialog(self, u"Installation OK", u"Installation", wx.OK | wx.ICON_INFORMATION)
538 if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
541 def DisEnSaveTabAs(self, DISEN):
543 file_menu = self.mb.GetMenu(0)
544 items = file_menu.GetMenuItems()
546 if item.GetId() == ID_SaveTab :
549 def ShowMenu(self, menu, Show=True):
552 elif menu == 'matrix' :
554 elif menu == 'view' :
559 #menu_pos = self.mb.FindMenu(menu)
560 if not menu_pos is None :
561 self.mb.EnableTop(menu_pos, Show)
562 self.mb.UpdateMenus()
565 #--------------------------------------------------------------------
566 def OnClose(self, event):
568 with open(self.ConfigPath['path'], 'w') as f :
569 self.PathPath.write(f)
574 def OnOpenData(self, event):
575 inputname, self.input_path = OnOpen(self, "Data")
577 #filename = self.input_path[0]
578 self.tableau = Tableau(self,os.path.abspath(self.input_path[0]))
579 val = get_table_param(self, self.input_path[0])
581 busy = wx.BusyInfo(_("Please wait...").decode('utf8'), self)
584 self.tableau.make_content()
585 OpenAnalyse(self, self.tableau.parametres)
586 self.tree.OnItemAppend(self.tableau.parametres)
591 #self.tableau.show_tab()
593 def OnOpenAnalyse(self, event):
594 self.AnalysePath = OnOpen(self, "Analyse")
595 OpenAnalyse(self, self.AnalysePath[1][0], True)
596 self.ShowMenu('view')
598 def OnOpenText(self, event):
599 inputname, self.input_path = OnOpen(self, "Texte")
600 self.filename = self.input_path[0]
604 def OnViewData(self, event):
605 if self.type == "Data":
606 if not self.DataPop :
607 self.Sheet.Populate(self.content)
610 self.ShowAPane(u"Data")
611 elif self.type == "Texte" or self.type == 'Analyse' :
612 if not self.DataTxt :
613 self.text_ctrl_txt.Clear()
614 self.text_ctrl_txt.write(self.content)
615 self.text_ctrl_txt.ShowPosition(0)
618 self.ShowAPane(u"Text")
621 def OnSubText(self, corpus, parametres = None):
623 corpus = self.tree.getcorpus()
624 builder = SubBuilder(self, corpus, parametres)
625 if builder.res == wx.ID_OK :
626 busy = wx.BusyInfo(_("Please wait...").decode('utf8'), self)
628 corpus = builder.doanalyse()
629 self.history.add(corpus.parametres)
630 self.tree.OnItemAppend(corpus.parametres)
631 OpenAnalyse(self, corpus.parametres)
635 dlg = wx.ProgressDialog("Ouverture...",
636 "Veuillez patienter...",
639 style=wx.PD_APP_MODAL | wx.PD_AUTO_HIDE | wx.PD_ELAPSED_TIME | wx.PD_CAN_ABORT
642 builder = Builder(self, dlg)
643 if builder.res == wx.ID_OK :
645 corpus = builder.doanalyse()
646 self.history.add(corpus.parametres)
647 self.tree.OnItemAppend(corpus.parametres)
648 OpenAnalyse(self, corpus.parametres)
654 keepGoing = dlg.Update(count, u"Lecture du fichier")
655 self.ShowMenu('view')
656 self.ShowMenu('text')
657 self.ShowMenu('matrix', False)
662 keepGoing = dlg.Update(count, u"Chargement du dictionnaire")
664 #self.OnViewData(wx.EVT_BUTTON)
666 def OnExit(self, event):
669 def OnAbout(self, event):
670 info = wx.AboutDialogInfo()
671 info.Name = ConfigGlob.get('DEFAULT', 'name')
672 info.Version = ConfigGlob.get('DEFAULT', 'version')
673 info.Copyright = ConfigGlob.get('DEFAULT', 'copyright')
674 info.Description = u"""
675 Interface de R pour les Analyses Multidimensionnelles
676 de Textes et de Questionnaires
679 construit avec des logiciels libres.
685 info.WebSite = ("http://www.iramuteq.org", u"Site web IRaMuTeQ")
686 dev = ConfigGlob.get('DEFAULT', 'dev').decode('utf8').split(';')
687 info.Developers = dev
688 info.License = u"""Iramuteq est un logiciel libre ; vous pouvez le diffuser et/ou le modifier
689 suivant les termes de la Licence Publique Générale GNU telle que publiée
690 par la Free Software Foundation ; soit la version 2 de cette licence,
691 soit (à votre convenance) une version ultérieure.
693 Iramuteq est diffusé dans l'espoir qu'il sera utile,
694 mais SANS AUCUNE GARANTIE ; sans même une garantie implicite
695 de COMMERCIALISATION ou d'ADÉQUATION À UN USAGE PARTICULIER.
696 Voyez la Licence Publique Générale GNU pour plus de détails.
698 Vous devriez avoir reçu une copie de la Licence Publique Générale GNU
699 avec Iramuteq ; sinon, veuillez écrire à la Free Software Foundation,
700 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, États-Unis."""
703 def GetDockArt(self):
704 return self._mgr.GetArtProvider()
709 def OnPageChanged(self, event) :
710 new = event.GetSelection()
711 nobject = event.GetEventObject()
712 parent = nobject.GetParent()
713 if isinstance(parent, IraFrame) :
714 npage = self.nb.GetPage(new)
715 if 'parametres' in dir(npage) :
716 self.tree.GiveFocus(uuid=npage.parametres['uuid'])
717 if npage.parametres.get('matrix', False) :
718 self.ShowMenu('text', False)
719 self.ShowMenu('matrix', True)
720 elif npage.parametres.get('corpus', False) :
721 self.ShowMenu('text')
722 self.ShowMenu('matrix', False)
724 def OnCloseTab(self, evt):
725 #log.info('Closing tab %s' % str(evt.GetEventObject()))
726 ctrl = evt.GetEventObject()
727 if isinstance(ctrl.GetParent(), aui.AuiNotebook) or isinstance(ctrl.GetParent(), wx.Panel):
731 page = self.nb.GetPage(self.nb.GetSelection())
732 if 'parametres' in dir(page) and isinstance(ctrl.GetParent(), IraFrame) :
733 self.history.rmtab(page.parametres)
734 self.tree.CloseItem(uuid = page.parametres['uuid'])
735 TabTitle = self.nb.GetPageText(self.nb.GetSelection())
737 if self.nb.GetPageCount() == 1 and not notebook :
740 def LastTabClose(self) :
741 if self.nb.GetPageCount() == 1 :
742 #self.DisEnSaveTabAs(False)
744 self.ShowAPane("Text")
746 self.ShowAPane("Data")
748 self.ShowAPane("Intro_Text")
750 def GetStartPosition(self):
754 pt = self.ClientToScreen(wx.Point(0, 0))
756 return wx.Point(pt.x + x, pt.y + x)
758 def ShowAPane(self, panel):
759 for pane in self._mgr.GetAllPanes() :
760 if not pane.IsToolbar() and pane.name != 'lefttree':
762 self._mgr.GetPane(panel).Show()
765 def OnAcceuil(self, event):
766 self.ShowAPane(u"Intro_Text")
769 def CreateHTMLCtrl(self):
770 ctrl = wx.html.HtmlWindow(self, -1, wx.DefaultPosition, wx.Size(400, 300))
771 if "gtk2" in wx.PlatformInfo:
772 ctrl.SetStandardFonts()
773 ctrl.SetPage(u"text")
776 def ShowTab(self, evt):
777 self.ShowAPane("Tab_content")
779 ################################################################
781 ################################################################
782 def analyse_matrix(self, analyse, analyse_type = '', matrix = None, parametres = None, dlgnb = 1):
784 matrix = self.tree.getmatrix()
785 if parametres is not None :
786 parametres['type'] = analyse_type
788 parametres = {'type' : analyse_type}
790 #print 'plus de bug@@@@@@@@@@@@@@@@@@@@@@'
791 analyse(self, matrix, parametres = parametres, dlg = dlgnb)
795 def OnFreq(self, event, matrix = None):
796 self.analyse_matrix(Frequences, analyse_type = 'freq', matrix = matrix, dlgnb = 3)
798 def OnFreqMulti(self, event, matrix = None):
799 self.analyse_matrix(FreqMultiple, analyse_type = 'freqmulti', matrix = matrix, dlgnb = 3)
801 def OnChi2(self, event, matrix = None):
802 self.analyse_matrix(ChiSquare, matrix = matrix, analyse_type = 'chi2', dlgnb = 3)
804 def OnSimiTab(self, event, matrix = None):
805 self.analyse_matrix(DoSimi, matrix = matrix, analyse_type = 'simimatrix', dlgnb = 5)
807 def OnCHDReinert(self, event, matrix = None):
809 # matrix = self.tree.getmatrix()
810 #AnalyseQuest(self, matrix, parametres = {'type' : 'reinertmatrix'}, dlg = 3)
811 self.analyse_matrix(AnalyseQuest, matrix = matrix, analyse_type = 'reinertmatrix', dlgnb = 5)
813 def OnStudent(self, event):
819 def OnRCode(self, event):
825 def OnCHDSIM(self, event):
827 # print 'ATTENTION!!!!'
828 chdsim = ChdCluster(self)
829 if chdsim.val == wx.ID_OK:
834 # def OnCHDReinert(self, event):
836 # # print('PLUS DE BUG SUR ALCESTE QUESTIONNAIRE')
837 # self.quest = AnalyseQuest(self)
838 # if self.quest.val == wx.ID_OK:
843 def OnProto(self, evt, matrix = None) :
844 self.analyse_matrix(Prototypical, matrix = matrix, analyse_type = 'proto', dlgnb = 3)
845 #Prototypical(self, {'type' : 'proto'})
847 def OnSplitVar(self, evt, matrix = None):
848 self.analyse_matrix(SplitMatrixFromVar, matrix = matrix, analyse_type = 'splitvar', parametres = {'pathout': matrix.pathout.dirout}, dlgnb = 3)
849 matrix = self.tree.getmatrix()
852 def OnSimiTxt(self, evt, corpus = None) :
853 # print 'PLUS DE BUG SUR SIMITXT'
855 #self.Text = SimiTxt(self)
857 corpus = self.tree.getcorpus()
858 self.Text = SimiTxt(self, corpus, parametres = {'type': 'simitxt'}, dlg = 3)
859 if self.Text.val == wx.ID_OK :
864 def OnWordCloud(self, evt, corpus = None) :
865 # print 'PLUS DE BUG SUR WORDCLOUD'
868 corpus = self.tree.getcorpus()
869 self.Text = WordCloud(self, corpus, parametres = {'type' : 'wordcloud'}, dlg = 3)
870 if self.Text.val == wx.ID_OK :
875 def OnClusterCloud(self, corpus, parametres = None) :
876 self.Text = ClusterCloud(self, corpus, parametres = parametres, dlg = 3)
878 def OnAFCM(self, event):
884 def OnTextStat(self, event, corpus = None):
885 #print 'PAS DE BUG SUR TEXT STAT'
888 corpus = self.tree.getcorpus()
889 self.Text = Stat(self, corpus, parametres = {'type': 'stat'}, dlg = 7)
891 if self.Text.val == wx.ID_OK :
896 def OnTextSpec(self, event, corpus = None):
898 #self.Text = AsLexico(self)
899 #print('ATTENTION : PLUS DE BUG SUR LEXICO')
901 corpus = self.tree.getcorpus()
902 self.Text = Lexico(self, corpus, parametres = {'type' : 'spec'}, dlg = 3)
903 if self.Text.val == wx.ID_OK :
908 def OnTextAfcm(self, event):
915 def import_factiva_xml(self,event):
917 ImportFactiva(self, 'xml')
921 def import_factiva_mail(self, evt) :
923 ImportFactiva(self, 'mail')
927 def import_factiva_txt(self, evt) :
929 ImportFactiva(self, 'txt')
933 def OnImportTXM(self, evt) :
935 ImportFactiva(self, 'txm')
939 def ExtractTools(self, evt) :
941 if ID == self.ID_splitvar :
942 Extract(self, 'splitvar')
943 elif ID == self.ID_extractmod :
944 Extract(self, 'mods')
945 elif ID == self.ID_extractthem :
946 Extract(self, 'them')
948 def OnTextReinert(self, event, corpus = None):
950 #print('ATTENTION : PLUS DE BUG SUR ALCESTE')
951 #RunAnalyse(self, corpus, Alceste, OptAlceste)
953 corpus = self.tree.getcorpus()
954 self.Text = Reinert(self, corpus, parametres = {'type': 'alceste'}, dlg = 6)
955 if self.Text.val == wx.ID_OK:
960 def OnPamSimple(self, event, corpus = None):
963 corpus = self.tree.getcorpus()
964 self.Text = AnalysePam(self, corpus, parametres = {'type' : 'pamtxt'}, dlg = 6)
965 if self.Text.val == wx.ID_OK:
970 def SimiCluster(self, parametres = {}, fromprof = False, tableau = None) :
971 self.analyse_matrix(DoSimi, parametres = parametres, analyse_type = 'simiclustermatrix', matrix = tableau)
973 # def OnSimi(self,evt):
975 #print 'ATTENTION !!!! VERGES'
976 #print 'PLUS DE BUG SUR SIMI'
977 # self.res = DoSimi(self, param = None)
978 #self.res = Verges(self)
979 # if self.res.val == wx.ID_OK :
983 #################################################################
985 def OnHelp(self, event):
986 webbrowser.open('http://www.iramuteq.org/documentation')
988 def OnPref(self, event):
989 dlg = PrefDialog(self)
991 self.val = dlg.ShowModal()
994 if self.check_update:
999 #CheckRPackages(self)
1001 def OnOpenFromCmdl(self):
1003 if options.filename :
1004 if os.path.exists(options.filename):
1005 self.filename = os.path.abspath(options.filename)
1009 if os.path.exists(os.path.realpath(args[0])):
1010 self.filename = os.path.abspath(os.path.realpath(args[0]))
1016 if os.path.splitext(self.filename)[1] in ['.csv', '.xls', '.ods']:
1017 self.tableau = Tableau(self, self.filename)
1018 val = get_table_param(self, self.filename)
1019 if val == wx.ID_OK :
1020 self.tableau.make_content()
1021 OpenAnalyse(self, self.tableau.parametres)
1022 self.tree.OnItemAppend(self.tableau.parametres)
1023 #get_table_param(self, self.filename)
1024 #self.tableau.make_content()
1025 #self.tableau.show_tab()
1026 #open_data(self, self.filename)
1027 elif os.path.splitext(self.filename)[1] == '.txt':
1029 elif os.path.splitext(self.filename)[1] == '.ira' :
1030 #self.corpus = Corpus(self)
1031 #self.Text = OpenAnalyse(self, self.filename)
1032 OpenAnalyse(self, self.filename)
1034 print 'ce fichier n\'existe pas'
1038 class IntroPanel(wx.Panel):
1039 def __init__(self, parent):
1040 wx.Panel.__init__(self, parent)
1041 col = randint(0, 255)
1042 col1 = randint(0,255)
1043 col2 = randint(0,255)
1045 bckgrdcolor = wx.Colour(col, col1, col2)
1046 self.SetBackgroundColour(bckgrdcolor)
1047 txtcolour = wx.Colour(250, 250, 250)
1048 linkcolor = wx.Colour(255, 0, 0)
1049 sizer1 = wx.BoxSizer(wx.VERTICAL)
1050 sizer2 = wx.BoxSizer(wx.VERTICAL)
1051 sizer3 = wx.BoxSizer(wx.HORIZONTAL)
1052 sizer4 = wx.BoxSizer(wx.VERTICAL)
1053 sizer5 = wx.BoxSizer(wx.HORIZONTAL)
1054 grid_sizer_1 = wx.FlexGridSizer(1, 4, 0, 0)
1055 grid_sizer_3 = wx.FlexGridSizer(1, 4, 0, 0)
1056 grid_sizer_2 = wx.FlexGridSizer(1, 3, 0, 0)
1057 PanelPres = wx.Panel(self)
1058 PanelPres.SetBackgroundColour(bckgrdcolor)
1059 label_1 = wx.StaticText(self, -1, u"IRaMuTeQ", size=(-1, -1))
1060 label_1.SetFont(wx.Font(46, wx.TELETYPE, wx.NORMAL, wx.BOLD, 0, "Purisa"))
1061 label_1.SetForegroundColour(wx.RED)
1062 label2 = wx.StaticText(PanelPres, -1 , u'\nVersion ' + ConfigGlob.get('DEFAULT', 'version') + '\n')
1063 label2.SetForegroundColour(txtcolour)
1064 label2.SetBackgroundColour(bckgrdcolor)
1065 #label3 = wx.StaticText(PanelPres, -1 , u'Equipe ')
1066 #label3.SetForegroundColour(txtcolour)
1067 #label3.SetBackgroundColour(bckgrdcolor)
1068 self.hyper2 = hl.HyperLinkCtrl(PanelPres, wx.ID_ANY, u"REPERE", URL="http://repere.no-ip.org/")
1069 self.hyper2.SetColours(linkcolor, linkcolor, "RED")
1070 self.hyper2.SetBackgroundColour(bckgrdcolor)
1071 self.hyper2.EnableRollover(True)
1072 self.hyper2.SetUnderlines(False, False, True)
1073 self.hyper2.SetBold(True)
1074 self.hyper2.UpdateLink()
1075 label_lerass = wx.StaticText(PanelPres, -1, u'Laboratoire ')
1076 label_lerass.SetForegroundColour(txtcolour)
1077 label_lerass.SetBackgroundColour(bckgrdcolor)
1078 self.hyper_lerass = hl.HyperLinkCtrl(PanelPres, -1, u'LERASS', URL="http://www.lerass.com")
1079 self.hyper_lerass.SetColours(linkcolor, linkcolor, "RED")
1080 self.hyper_lerass.SetBackgroundColour(bckgrdcolor)
1081 self.hyper_lerass.EnableRollover(True)
1082 self.hyper_lerass.SetUnderlines(False, False, True)
1083 self.hyper_lerass.SetBold(True)
1084 self.hyper_lerass.UpdateLink()
1085 blank = wx.StaticText(PanelPres, -1, u'\n')
1086 blank1 = wx.StaticText(PanelPres, -1, u'\n')
1087 labellicence = wx.StaticText(PanelPres, -1, _(u"License GNU GPL").decode('utf8'))
1088 labellicence.SetForegroundColour(txtcolour)
1089 labellicence.SetBackgroundColour(bckgrdcolor)
1090 labelcopy = wx.StaticText(PanelPres, -1, ConfigGlob.get('DEFAULT', 'copyright'))
1091 labelcopy.SetForegroundColour(txtcolour)
1092 labelcopy.SetBackgroundColour(bckgrdcolor)
1093 python_img = wx.Image(os.path.join(ImagePath,'python-logo.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1094 r_img = wx.Image(os.path.join(ImagePath,'Rlogo.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1095 lexique_img = wx.Image(os.path.join(ImagePath,'LexTexte4.jpg'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
1096 but_python = wx.BitmapButton(self, -1, python_img)
1097 but_lexique = wx.BitmapButton(self, -1, lexique_img)
1098 but_r = wx.BitmapButton(self, -1, r_img)
1099 self.Bind(wx.EVT_BUTTON, self.OnPython, but_python)
1100 self.Bind(wx.EVT_BUTTON, self.OnLexique, but_lexique)
1101 self.Bind(wx.EVT_BUTTON, self.OnR, but_r)
1104 #grid_sizer_1.Add(label3, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1105 grid_sizer_1.Add(self.hyper2, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1106 grid_sizer_3.Add(label_lerass, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1107 grid_sizer_3.Add(self.hyper_lerass, 0, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1108 sizer4.Add(label_1, 0, wx.ALIGN_CENTER, 5)
1109 sizer2.Add(label2, 0, wx.ALIGN_CENTER, 5)
1110 #sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1111 sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1112 sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1113 sizer2.Add(grid_sizer_3, 0, wx.ALIGN_CENTER, 5)
1114 sizer2.Add(wx.StaticText(PanelPres, -1, u' '), 0, wx.ALIGN_CENTER, 5)
1115 #sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1116 #sizer2.Add(wx.StaticText(PanelPres, -1, u''), 0, wx.ALIGN_CENTER, 5)
1117 sizer2.Add(grid_sizer_1, 0, wx.ALIGN_CENTER, 5)
1118 sizer2.Add(labellicence, 0, wx.ALIGN_CENTER, 5)
1119 sizer2.Add(labelcopy, 0, wx.ALIGN_CENTER, 5)
1120 sizer1.Add(sizer4, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1121 PanelPres.SetSizer(sizer2)
1122 sizer5.Add(blank, 1, wx.EXPAND | wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 2)
1123 sizer5.Add(PanelPres, 1, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 0)
1124 sizer5.Add(blank1, 1, wx.ALIGN_CENTER_HORIZONTAL,2)
1125 grid_sizer_2.Add(but_python, 1, wx.ALIGN_CENTER_HORIZONTAL| wx.ALIGN_CENTER_VERTICAL)
1126 grid_sizer_2.Add(but_lexique, 1,wx.ALIGN_CENTER_HORIZONTAL| wx.ALIGN_CENTER_VERTICAL)
1127 grid_sizer_2.Add(but_r, 1, wx.ALIGN_CENTER_HORIZONTAL| wx.ALIGN_CENTER_VERTICAL)
1129 sizer1.Add(sizer5, 3, wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL, 1)
1130 sizer1.Add(grid_sizer_2, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL)
1131 self.SetSizer(sizer1)
1134 def OnPython(self,evt):
1135 webbrowser.open('http://www.python.org')
1137 def OnLexique(self,evt):
1138 webbrowser.open('http://www.lexique.org')
1141 webbrowser.open('http://www.r-project.org')
1143 class MySplashScreen(wx.SplashScreen):
1145 bmp = wx.Image(os.path.join(ImagePath, 'splash.png')).ConvertToBitmap()
1146 wx.SplashScreen.__init__(self, bmp,
1147 wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
1149 self.Bind(wx.EVT_CLOSE, self.OnClose)
1150 self.fc = wx.FutureCall(1, self.ShowMain)
1152 def OnClose(self, evt):
1156 if self.fc.IsRunning():
1161 displaySize = wx.DisplaySize()
1162 w = displaySize[0]/1.2
1163 h = displaySize[1]/1.2
1164 frame = IraFrame(None, -1, "IRaMuTeQ " + ConfigGlob.get('DEFAULT', 'version'), size=(w, h))
1168 frame.OnOpenFromCmdl()
1169 # if self.fc.IsRunning():
1171 #wx.CallAfter(frame.ShowTip)
1173 class MyApp(wx.App):
1176 Create and show the splash screen. It will then create and show
1177 the main frame when it is time to do so.
1179 wx.SystemOptions.SetOptionInt("mac.window-plain-transition", 1)
1180 self.SetAppName("Iramuteq")
1181 splash = MySplashScreen()
1189 if __name__ == '__main__':