grid_sizer_1.Add(self.listlabel[i], 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_1.Add(self.listspin[i], 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_1.Add(self.listbutton[i], 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
- for i in range(13,len(self.listlabel)):
+ for i in range(14,len(self.listlabel)):
grid_sizer_2.Add(self.listlabel[i], 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_2.Add(self.listspin[i], 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_2.Add(self.listbutton[i], 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
'prof_type' : 'profil_type.csv',
'antiprof_type' : 'antiprof_type.csv',
'type_cl' : 'type_cl.csv',
- 'db' : 'analyse'#.db,
+ 'db' : 'analyse.db',
}
def StatTxtPathOut(pathout):
'afct_col_csv': ffr(os.path.join(pathout, 'afct_col.csv')),
'afct_facteur_csv': ffr(os.path.join(pathout, 'afct_facteur.csv')),
'ira' : ffr(os.path.join(pathout, 'Analyse.ira')),
- 'db' : os.path.join(pathout, 'analyse'),
+ 'db' : os.path.join(pathout, 'analyse.db'),
'zipf' : ffr(os.path.join(pathout, 'zipf.png')),
}
return d
'liste_graph' :'liste_graph.txt',
'ira' : 'Analyse.ira',
'film' : '',
- 'db' : 'analyse',
+ 'db' : 'analyse.db',
'corpus' : 'corpus.db',
}
self._mgr.GetPane("lefttree").Show()
self._mgr.GetPane("classif_tb").Hide() # utilisé nulle part ailleurs que sur cette ligne ???
# "commit" all changes made to FrameManager
- self._mgr.Update()
+ #self._mgr.Update()
# Attache les événements aux éléments d'interface
self.Bind(wx.EVT_MENU, self.OnAcceuil, id=ID_ACCEUIL)
self._mgr.SetAGWFlags(self._mgr.GetAGWFlags() ^ (aui.AUI_MGR_RECTANGLE_HINT | aui.AUI_MGR_ALLOW_FLOATING))
self._mgr.GetArtProvider().SetMetric(aui.AUI_DOCKART_GRADIENT_TYPE, aui.AUI_GRADIENT_HORIZONTAL)
self.GetDockArt().SetColor(aui.AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR, "#00FFF9")
- self.DoUpdate()
+ #self.DoUpdate()
self._icon = wx.Icon(os.path.join(ImagePath, "iraicone.ico"), wx.BITMAP_TYPE_ICO)
self.SetIcon(self._icon)
# vu comme elle est écrite, impossible de gérer
# l'affichage/masquage des toolbars en fonction du contexte
def ShowMenu(self, menu, Show=True):
- print("showmenu")
if menu == 'text' :
menu_pos = 4
if Show :
+ if self._mgr.GetPane('tb_text').IsShown() :
+ return
self._mgr.GetPane('tb_text').Show()
self._mgr.GetPane('tb_mat').Hide()
self.mb.EnableTop(menu_pos, Show)
elif menu == 'matrix' :
menu_pos = 3
if Show :
+ if self._mgr.GetPane('tb_mat').IsShown():
+ return
self._mgr.GetPane('tb_mat').Show()
self._mgr.GetPane('tb_text').Hide()
self.mb.EnableTop(menu_pos, Show)
#self.mb.EnableTop(menu_pos, Show)
self.mb.Refresh()
self._mgr.Update()
+ self.Refresh()
#--------------------------------------------------------------------
# fin de __init__ du wx.Frame
# action ou évènement ?
def OnPageChanged(self, event) :
- print("OnPageChange")
new = event.GetSelection()
nobject = event.GetEventObject()
parent = nobject.GetParent()
if isinstance(parent, IraFrame) :
npage = self.nb.GetPage(new)
if 'parametres' in dir(npage) :
- #self.tree.GiveFocus(uuid=npage.parametres['uuid'])
- if npage.parametres.get('matrix', False) :
- #self.ShowMenu('text', False)
- self.ShowMenu('matrix', True)
- elif npage.parametres.get('corpus', False) :
- self.ShowMenu('text')
- #self.ShowMenu('matrix', False)
- wx.CallAfter(self.nb.SendSizeEvent)
- self.Refresh()
+ self.tree.GiveFocus(uuid=npage.parametres['uuid'])
# action ou évènement ?
def OnCloseTab(self, evt):
# action ou évènement ?
def ShowAPane(self, panel):
+ print('ShowAPane')
for pane in self._mgr.GetAllPanes() :
if not pane.IsToolbar() and pane.name != 'lefttree':
pane.Hide()
else :
corpname = self.corpus.parametres['matrix_name']
if os.path.exists(self.pathout['analyse.db']) :
- self.corpus.read_tableau(self.pathout['analyse'])
+ self.corpus.read_tableau(self.pathout['analyse.db'])
clnb = parametres['clnb']
dlg = progressbar(self, maxi = 4 + clnb)
self.clnb = clnb
ira.nb.SetSelection(ira.nb.GetPageCount() - 1)
ira.ShowAPane("Tab_content")
-
class MatLayout :
def __init__(self, ira, matrix):
self.tableau = tableau
self.parametres = parametres
if os.path.exists(self.pathout['analyse.db']) :
- self.tableau.read_tableau(self.pathout['analyse'])
+ self.tableau.read_tableau(self.pathout['analyse.db'])
self.dolayout()
self.ira.nb.SetSelection(self.ira.nb.GetPageCount() - 1)
self.ira.ShowAPane("Tab_content")
class CateLayout(DefaultMatLayout) :
def dolayout(self) :
- self.tableau.read_tableau(self.pathout['analyse'])
+ self.tableau.read_tableau(self.pathout['analyse.db'])
TabCate = ElCategorizator(self.ira.nb, self.pathout, self.tableau)
self.ira.nb.AddPage(TabCate, ' - '.join([_('ElCaTeGoRiZaToR'), self.parametres['name']]))
cate['TOCATE'][val] = self.tableau.actives[val][0]
with open(self.pathout['cate.json'], 'w', encoding='utf8') as f :
f.write(json.dumps(cate))
- self.tableau.save_tableau(self.pathout['analyse'])
+ self.tableau.save_tableau(self.pathout['analyse.db'])
self.dlg.Destroy()
self.BuildProfile()
temps = time.time() - self.t1
PrintRapport(self, self, {}, istxt = False)
- self.tableau.save_tableau(self.pathout['db'])
+ self.tableau.save_tableau(self.pathout['analyse.db'])
#CreateIraFile(self.dictpathout, self.clnb, corpname = os.path.basename(self.parent.filename), section = 'questionnaire')
afc_graph_list = [[os.path.basename(self.pathout['AFC2DL_OUT']), 'Variables actives - coordonnées - facteurs 1 / 2'],
[os.path.basename(self.pathout['AFC2DSL_OUT']), 'variables illustratives - coordonnées - facteurs 1 / 2'],
from copy import copy
import re
import html.entities
-import shelve
+#import shelve
+import json
from uuid import uuid4
import logging
#self.parametres = self.parametre
def read_tableau(self, fileout) :
- d=shelve.open(fileout)
- #self.parametres = d['parametres']
- #if 'syscoding' not in self.parametres :
- # self.parametres['syscoding'] = sys.getdefaultencoding()
+ with open(fileout, 'r', encoding='utf8') as f :
+ d = json.load(f)
self.actives = d['actives']
self.sups = d['sups']
self.classes = d['classes']
self.lchi = d['lchi']
if 'content' in d :
self.content = d['content']
- d.close()
def open(self):
print('open matrix')
self.colnb = len(self.linecontent[0])
def save_tableau(self, fileout) :
- d=shelve.open(fileout)
+ d = {}
d['parametres'] = self.parametres
d['actives'] = self.actives
d['sups'] = self.sups
if 'lchi' in dir(self) :
d['lchi'] = self.lchi
d['content'] = self.content
- d.close()
+ with open(fileout, 'w', encoding='utf8') as f :
+ json.dump(d, f)
def make_content(self) :
self.pathout.createdir(self.parametres['pathout'])
self.tmpfile = self.script.scriptout
self.DoR(self.dlg)
self.addgraph()
- self.tableau.save_tableau(self.pathout['db'])
+ self.tableau.save_tableau(self.pathout['analyse.db'])
#self.make_ira()
#count += 1
#self.dlg.Update(count, u"")
event.Skip()
def OnSelChanged(self, event = None, pydata = None):
- print("OnSelChange")
if event is not None :
item = event.GetItem()
pydata = self.GetPyData(item)
self.ira.ShowMenu('matrix', False)
self.pydata = pydata
if pydata['uuid'] in self.parent.history.opened :
+ actual = self.parent.nb.GetSelection()
for i in range(self.parent.nb.GetPageCount()) :
self.page = self.parent.nb.GetPage(i)
if 'parametres' in dir(self.page) :
if self.page.parametres['uuid'] == pydata['uuid'] :
self.parent.nb.SetSelection(i)
+ wx.CallAfter(self.parent.nb.SendSizeEvent)
+ #self.parent.Refresh()
break
#self.parent._mgr.Update()
- wx.CallAfter(self.parent.nb.SendSizeEvent)
- self.parent.Refresh()
#if event is not None :
# event.Skip()