X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=blobdiff_plain;f=ProfList.py;h=0e3fab796028cc7f4dabaee7f70cca887d103415;hp=73f8ff721d52dc124cffd9a236a755dff6ebc33c;hb=655d1e1ab00740c37712f476dc89dff7965c2161;hpb=a503f041dc4947ee21c1d353ddd05ddb13a5e322
diff --git a/ProfList.py b/ProfList.py
index 73f8ff7..0e3fab7 100644
--- a/ProfList.py
+++ b/ProfList.py
@@ -41,6 +41,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
self.Alceste = Alceste
self.Source = gparent
self.cl = cl
+ self.var_mod = {}
line1 = profclasse.pop(0)
classen = [line for line in profclasse if line[0] != '*' and line[0] != '*****']
@@ -56,7 +57,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
except ValueError:
self.lensup = 0
self.lenet = len(profclasse) - (self.lenact + self.lensup)
- print self.lenact, self.lensup, self.lenet
+# print self.lenact, self.lensup, self.lenet
for i, line in enumerate(classen) :
line[0] = i
dictdata = dict(zip([i for i in range(0,len(classen))], classen))
@@ -153,7 +154,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
def OnItemSelected(self, event):
self.currentItem = event.m_itemIndex
- print 'OnItemSelected: "%s", "%s", "%s", "%s"\n' % (self.currentItem, self.GetItemText(self.currentItem), self.getColumnText(self.currentItem, 1), self.getColumnText(self.currentItem, 2))
+ #print 'OnItemSelected: "%s", "%s", "%s", "%s"\n' % (self.currentItem, self.GetItemText(self.currentItem), self.getColumnText(self.currentItem, 1), self.getColumnText(self.currentItem, 2))
#self.log.WriteText('OnItemSelected: "%s", "%s", "%s", "%s"\n' %
# (self.currentItem,
# self.GetItemText(self.currentItem),
@@ -162,7 +163,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
def OnItemActivated(self, event):
self.currentItem = event.m_itemIndex
- print "OnItemActivated: %s\nTopItem: %s\n" % (self.GetItemText(self.currentItem), self.GetTopItem())
+ #print "OnItemActivated: %s\nTopItem: %s\n" % (self.GetItemText(self.currentItem), self.GetTopItem())
#self.log.WriteText("OnItemActivated: %s\nTopItem: %s\n" %
# (self.GetItemText(self.currentItem), self.GetTopItem()))
@@ -367,11 +368,19 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
corpus = self.Source.corpus
ClasseCHD(self.parent, corpus, self.cl)
+ def getselectedwords(self) :
+ words = [self.getColumnText(self.GetFirstSelected(), 6)]
+ last = self.GetFirstSelected()
+ while self.GetNextSelected(last) != -1:
+ last = self.GetNextSelected(last)
+ words.append(self.getColumnText(last, 6))
+ return words
+
def quest_var_mod(self, evt) :
if 'corpus' in dir(self.Source):
corpus = self.Source.corpus
if self.var_mod == {} :
- self.var_mod = treat_var_mod([val for val in corpus.make_etoiles()])
+ self.var_mod = self.Source.corpus.make_etoiles_dict()
else :
corpus = self.Source.tableau
if self.var_mod == {} :
@@ -383,10 +392,10 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
chistable.pop(0)
vchistable = [line[1:] for line in chistable]
fchistable = [line[0] for line in chistable]
- word = self.getColumnText(self.GetFirstSelected(), 6)
+ word = self.getselectedwords()[0]
if len(word.split('_')) > 1 :
- var = word.split('_')[0]
- words = [word for word in self.var_mod[var]]
+ var = word.split('_')
+ words = ['_'.join([var[0],word]) for word in self.var_mod[var[0]]]
words.sort()
tableout = []
kwords = []
@@ -401,7 +410,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
file.write(txt)
file.close()
exec_rcode(self.Source.parent.RPath, tmpscript, wait = True)
- win = MessageImage(self, -1, u"Graphique", size=(700, 500),style = wx.DEFAULT_FRAME_STYLE)
+ win = MessageImage(self,u"Graphique", size=(700, 500))
win.addsaveimage(tmpgraph)
txt = "" % tmpgraph
win.HtmlPage.SetPage(txt)
@@ -632,7 +641,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
#ucestxt = [corpus.make_concord(self.la, ' '.join(uce), 'red') for uce in ucestxt]
dlg.Update(4, u'texte...')
#ucis_txt = [' '.join(corpus.ucis[val[1][0]][0]) for val in ntab2]
- win = message(self, -1, u"UCE caractéristiques - Classe %i" % self.cl, size=(600, 500), style=wx.DEFAULT_FRAME_STYLE)
+ win = message(self, u"UCE caractéristiques - Classe %i" % self.cl, (750, 600))
win.html = '\n' + '
'.join(['
'.join([ucis_txt[i], 'score : ' + str(ntab2[i][0]), ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n'
win.HtmlPage.SetPage(win.html)
dlg.Destroy()
@@ -650,14 +659,8 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
chistable.pop(0)
vchistable = [line[1:] for line in chistable]
fchistable = [line[0] for line in chistable]
- words = [self.getColumnText(self.GetFirstSelected(), 6)]
- tableout = [vchistable[fchistable.index(words[0])]]
- last = self.GetFirstSelected()
- while self.GetNextSelected(last) != -1:
- last = self.GetNextSelected(last)
- word = self.getColumnText(last, 6)
- words.append(word)
- tableout.append(vchistable[fchistable.index(word)])
+ words = self.getselectedwords()
+ tableout = [vchistable[fchistable.index(word)] for word in words]
tmpgraph = tempfile.mktemp(dir=self.Source.parent.TEMPDIR)
nbcl = len(title)
txt = barplot(tableout, words, title, self.Source.parent.RscriptsPath['Rgraph'], tmpgraph)
@@ -667,7 +670,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
file.close()
exec_rcode(self.Source.parent.RPath, tmpscript, wait = True)
- win = MessageImage(self, -1, u"Graphique", size=(700, 500),style = wx.DEFAULT_FRAME_STYLE)
+ win = MessageImage(self, u"Graphique", size=(700, 500))
win.addsaveimage(tmpgraph)
txt = "" % tmpgraph
win.HtmlPage.SetPage(txt)
@@ -685,14 +688,8 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
chistable.pop(0)
vchistable = [line[1:] for line in chistable]
fchistable = [line[0] for line in chistable]
- words = [self.getColumnText(self.GetFirstSelected(), 6)]
- tableout = [vchistable[fchistable.index(words[0])]]
- last = self.GetFirstSelected()
- while self.GetNextSelected(last) != -1:
- last = self.GetNextSelected(last)
- word = self.getColumnText(last, 6)
- words.append(word)
- tableout.append(vchistable[fchistable.index(word)])
+ words = self.getselectedwords()
+ tableout = [vchistable[fchistable.index(word)] for word in words]
tmpgraph = tempfile.mktemp(dir=self.Source.parent.TEMPDIR)
txttable = 'c(' + ','.join([','.join(line) for line in tableout]) + ')'
rownames = 'c("' + '","'.join(words) + '")'
@@ -717,7 +714,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
file.write(txt)
file.close()
exec_rcode(self.Source.parent.RPath, tmpscript, wait = True)
- win = MessageImage(self, -1, u"Graphique", size=(700, 500),style = wx.DEFAULT_FRAME_STYLE)
+ win = MessageImage(self, u"Graphique", size=(700, 500))
win.addsaveimage(tmpgraph)
txt = "" % tmpgraph
win.HtmlPage.SetPage(txt)
@@ -732,7 +729,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
last = self.GetNextSelected(last)
ListWord.append(self.getColumnText(last, 6))
listmot = [forme for item in ListWord for forme in corpus.getlems()[item].formes]
- win = message(self, -1, title, size=(600, 500), style=wx.DEFAULT_FRAME_STYLE)
+ win = message(self, title, size=(750, 600))
toshow = ['\n