X-Git-Url: http://iramuteq.org/git?a=blobdiff_plain;f=tree.py;h=3a5d30764a60e56f100b058c56898534f40cfa66;hb=10d67a5cd48583c060b6a0e77e87c41f80671027;hp=91f663cb42495f0db01fd0792e7e7d3c16a03c3a;hpb=b3bc705961fd8798f6379bad9e1d448a85f484a5;p=iramuteq
diff --git a/tree.py b/tree.py
old mode 100644
new mode 100755
index 91f663c..3a5d307
--- a/tree.py
+++ b/tree.py
@@ -11,47 +11,72 @@ import logging
from openanalyse import OpenAnalyse
from corpus import Corpus, copycorpus
from tableau import Tableau, copymatrix
-from functions import DoConf, GetTxtProfile, TGen
+from functions import DoConf, GetTxtProfile, TGen, BugReport, open_folder, translateprofile, ReadProfileAsDico, write_translation_profile, progressbar, doconcorde
from profile_segment import ProfileSegment, ProfilType
from search_tools import SearchFrame
-from dialog import PrefSimpleFile, PrefExport
+from dialog import PrefSimpleFile, PrefExport, SearchCorpus, translate_dialog, PrefUCECarac
from layout import open_antiprofil, TgenLayout
from guifunct import TGenFrame
from textaslexico import TgenSpec
+from textreinert import TgenProf
+from mergeclustergraph import MergeClusterGraph
log = logging.getLogger('iramuteq.tree')
+def buildmenu(menu, parent_menu):
+ for i in range(parent_menu.GetMenuItemCount()) :
+ item = parent_menu.FindItemByPosition(i)
+ itemid = item.GetId()
+ itemtext = item.GetText()
+ itemicon = item.GetBitmap()
+ nitem = wx.MenuItem(menu, itemid, itemtext)
+ nitem.SetBitmap(itemicon)
+ if item.IsSubMenu() :
+ nmenu = wx.Menu()
+ for val in item.GetSubMenu().GetMenuItems() :
+ itemid = val.GetId()
+ itemtext = val.GetText()
+ itemicon = val.GetBitmap()
+ nitem = wx.MenuItem(menu, itemid, itemtext)
+ nitem.SetBitmap(itemicon)
+ nmenu.AppendItem(nitem)
+ menu.AppendMenu(-1, item.GetText(), nmenu)
+ else :
+ menu.AppendItem(nitem)
+
class InfoDialog ( wx.Dialog ):
-
+
def __init__( self, parent, txt, parametres ):
wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Informations", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
if len(parametres) > 30 :
nb = 4
else :
- nb = 2
+ nb = 2
self.SetSizeHintsSz( wx.Size( 500,200 ), wx.DefaultSize )
-
+
bSizer1 = wx.BoxSizer( wx.VERTICAL )
-
+
self.m_panel2 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
bSizer2 = wx.BoxSizer( wx.VERTICAL )
-
+
self.m_staticText4 = wx.StaticText( self.m_panel2, wx.ID_ANY, txt, wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText4.Wrap( -1 )
bSizer2.Add( self.m_staticText4, 0, wx.ALL, 5 )
-
-
+
self.m_panel2.SetSizer( bSizer2 )
self.m_panel2.Layout()
bSizer2.Fit( self.m_panel2 )
bSizer1.Add( self.m_panel2, 0, wx.EXPAND |wx.ALL, 5 )
-
- self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
+
+ self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL|wx.VSCROLL )
fgSizer1 = wx.FlexGridSizer( 0, nb, 0, 0 )
+ fgSizer1.AddGrowableCol( 1 )
+ if nb == 4 :
+ fgSizer1.AddGrowableCol( 3 )
fgSizer1.SetFlexibleDirection( wx.BOTH )
- fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
-
+ fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_NONE )
+
txtctrl = []
for val in parametres :
fgSizer1.Add( wx.StaticText( self.m_panel1, wx.ID_ANY, val[0], wx.DefaultPosition, wx.DefaultSize, 0 ), 0, wx.ALL, 0)
@@ -66,22 +91,20 @@ class InfoDialog ( wx.Dialog ):
self.m_panel1.SetSizer( fgSizer1 )
self.m_panel1.Layout()
fgSizer1.Fit( self.m_panel1 )
- bSizer1.Add( self.m_panel1, 0, wx.EXPAND|wx.ALL, 3 )
-
+ bSizer1.Add( self.m_panel1, 1, wx.EXPAND|wx.ALL, 3 )
+
m_sdbSizer1 = wx.StdDialogButtonSizer()
self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
m_sdbSizer1.Realize();
-
+
bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
-
-
+
self.SetSizer( bSizer1 )
self.Layout()
bSizer1.Fit( self )
-
self.Centre( wx.BOTH )
-
+
def __del__( self ):
pass
@@ -94,6 +117,11 @@ class LeftTree(CT.CustomTreeCtrl):
agwStyle=CT.TR_HIDE_ROOT|CT.TR_HAS_BUTTONS|CT.TR_HAS_VARIABLE_ROW_HEIGHT):
CT.CustomTreeCtrl.__init__(self, parent, id, pos, size, style, agwStyle)
+ #FIXME : test for bigger font on HIDPI screen
+ font = wx.Font(pointSize=12, family=wx.DEFAULT, style=wx.NORMAL, weight=wx.FONTWEIGHT_NORMAL,
+ underline=False, face="", encoding=wx.FONTENCODING_DEFAULT)
+ self.SetFont(font)
+ ##################
self.log = log
alldata = dir(CT)
treestyles = []
@@ -104,46 +132,44 @@ class LeftTree(CT.CustomTreeCtrl):
elif data.startswith("EVT_"):
events.append(data)
self.parent = parent
+ self.ira = parent
self.events = events
self.styles = treestyles
self.item = None
-
+
+
self.il = wx.ImageList(16, 16)
self.ild = {}
- imgtextroot = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'textroot.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
- self.ild['alceste'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'reinert.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
- self.ild['corpus'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'textcorpus.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
- self.ild['wordcloud'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'wordcloud.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
- self.ild['stat'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'stats.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
- self.ild['simitxt'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'simitxt.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
- self.ild['clustersimitxt'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'clustersimitxt.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
- self.ild['clustercloud'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'clustercloud.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
- self.ild['spec'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'spec.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
- imgmatroot = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'matroot.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
- self.ild['matrix'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'matrix.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
- self.ild['freq'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'frequences.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
- self.ild['chi2'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'chi2.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
- self.ild['reinertmatrix'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'reinertmatrix.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
- self.ild['simimatrix'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'simimatrix.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
- self.ild['proto'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'proto.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
+ for img in self.ira.images_analyses :
+ self.ild[img] = self.il.Add(self.ira.images_analyses[img])
self.SetImageList(self.il)
-
+
self.count = 0
self.log = log
self.history = parent.history
self.h = self.history.history
+
+ idopenfolder = wx.NewId()
+ #accel_tbl = wx.AcceleratorTable([(wx.ACCEL_CTRL, ord('E'), idopenfolder)])
+ self.Bind(wx.EVT_MENU, self.OnOpenFolder, id=idopenfolder)
+
+ idsearchcorpus = wx.NewId()
+ accel_tbl = wx.AcceleratorTable([(wx.ACCEL_CTRL, ord('E'), idopenfolder), (wx.ACCEL_CTRL, ord('F'), idsearchcorpus)])
+ self.Bind(wx.EVT_MENU, self.OnSearchCorpus, id=idsearchcorpus)
+ self.SetAcceleratorTable(accel_tbl)
+
self.root = self.AddRoot("Iramuteq")
-
+
if not(self.GetAGWWindowStyleFlag() & CT.TR_HIDE_ROOT):
self.SetPyData(self.root, None)
self.SetItemImage(self.root, 24, CT.TreeItemIcon_Normal)
self.SetItemImage(self.root, 13, CT.TreeItemIcon_Expanded)
-
- self.textroot = self.AppendItem(self.root, u'Corpus texte')
+
+ self.textroot = self.AppendItem(self.root, _(u'Textual corpus'))
self.SetPyData(self.textroot, {'uuid': 'textroot'})
- self.SetItemImage(self.textroot, imgtextroot, CT.TreeItemIcon_Normal)
- self.SetItemImage(self.textroot, imgtextroot, CT.TreeItemIcon_Expanded)
+ self.SetItemImage(self.textroot, self.ild['textroot'], CT.TreeItemIcon_Normal)
+ self.SetItemImage(self.textroot, self.ild['textroot'], CT.TreeItemIcon_Expanded)
for corpus in reversed(self.h) :
child = self.AppendItem(self.textroot, corpus['corpus_name'])
@@ -162,11 +188,11 @@ class LeftTree(CT.CustomTreeCtrl):
self.SetItemImage(last, img, CT.TreeItemIcon_Normal)
self.SetItemImage(last, img, CT.TreeItemIcon_Expanded)
- self.matroot = self.AppendItem(self.root, u'Matrices')
+ self.matroot = self.AppendItem(self.root, _(u'Matrix'))
self.SetPyData(self.matroot, {'uuid': 'matroot'})
- self.SetItemImage(self.matroot, imgmatroot, CT.TreeItemIcon_Normal)
- self.SetItemImage(self.matroot, imgmatroot, CT.TreeItemIcon_Expanded)
-
+ self.SetItemImage(self.matroot, self.ild['matroot'], CT.TreeItemIcon_Normal)
+ self.SetItemImage(self.matroot, self.ild['matroot'], CT.TreeItemIcon_Expanded)
+
orphmat = []
for matrix in reversed(self.history.matrix) :
if 'matrix_name' in matrix :
@@ -185,7 +211,7 @@ class LeftTree(CT.CustomTreeCtrl):
self.SetItemImage(last, img, CT.TreeItemIcon_Normal)
self.SetItemImage(last, img, CT.TreeItemIcon_Expanded)
else :
- orphmat.append(matrix)
+ orphmat.append(matrix)
self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDClick)
#self.Bind(wx.EVT_IDLE, self.OnIdle)
@@ -202,7 +228,7 @@ class LeftTree(CT.CustomTreeCtrl):
'EVT_TREE_SEL_CHANGING': self.OnSelChanging, "EVT_TREE_ITEM_HYPERLINK": self.OnHyperLink}
mainframe = wx.GetTopLevelParent(self)
-
+
if not hasattr(mainframe, "leftpanel"):
#self.Bind(CT.EVT_TREE_ITEM_EXPANDED, self.OnItemExpanded)
#self.Bind(CT.EVT_TREE_ITEM_COLLAPSED, self.OnItemCollapsed)
@@ -226,7 +252,7 @@ class LeftTree(CT.CustomTreeCtrl):
value = choice.GetValue()
text = choice.GetLabel()
-
+
evt = "CT." + text
binder = self.eventdict[text]
@@ -251,13 +277,12 @@ class LeftTree(CT.CustomTreeCtrl):
if self.GetAGWWindowStyleFlag() != style:
self.SetAGWWindowStyleFlag(style)
-
+
def OnCompareItems(self, item1, item2):
-
+
t1 = self.GetItemText(item1)
t2 = self.GetItemText(item2)
-
if t1 < t2:
return -1
@@ -266,7 +291,6 @@ class LeftTree(CT.CustomTreeCtrl):
return 1
-
def OnIdle(self, event):
# if self.gauge:
@@ -315,7 +339,7 @@ class LeftTree(CT.CustomTreeCtrl):
if itemParent is None :
itemParent = self.root
child, cookie = self.GetFirstChild(itemParent)
-
+
while child :
pydata = self.GetPyData(child)
if pydata['uuid'] == uuid :
@@ -326,7 +350,6 @@ class LeftTree(CT.CustomTreeCtrl):
def OnRightDown(self, event):
-
pt = event.GetPosition()
item, flags = self.HitTest(pt)
@@ -339,7 +362,7 @@ class LeftTree(CT.CustomTreeCtrl):
def OnRightUp(self, event):
item = self.item
-
+
if not item:
event.Skip()
return
@@ -373,75 +396,47 @@ class LeftTree(CT.CustomTreeCtrl):
text = self.GetItemText(item)
pydata = self.GetPyData(item)
self.pydata = pydata
-
+
self.current = item
self.itemdict = {"ishtml": ishtml, "back": back, "fore": fore, "isbold": isbold,
"font": font, "normal": normal, "selected": selected, "expanded": expanded,
"selexp": selexp, "haswin": haswin, "children": children,
"itemtype": itemtype, "text": text, "pydata": pydata, "enabled": enabled}
-
+
if not item in [self.textroot, self.matroot] :
menu = wx.Menu()
- info = menu.Append(wx.ID_ANY, _(u"Informations").encode('utf8'))
- rename = menu.Append(wx.ID_ANY, _(u"Rename").encode('utf8'))
+ info = wx.MenuItem(menu, wx.ID_ANY, _(u"Informations").decode('utf8'))
+ info.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_INFORMATION, size = (16,16)))
+ menu.AppendItem(info)
+
+ rename = wx.MenuItem(menu, wx.ID_ANY, _(u"Rename").decode('utf8'))
+ rename.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_TIP, size = (16,16)))
+ menu.AppendItem(rename)
+
+ openfolder = wx.MenuItem(menu, wx.ID_ANY, _(u"Open directory").decode('utf8'))
+ openfolder.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_FOLDER_OPEN, size = (16,16)))
+ menu.AppendItem(openfolder)
+
menu.AppendSeparator()
-
+
if 'corpus_name' in pydata :
- stat = menu.Append(wx.ID_ANY, _(u"Statistics").decode('utf8'))
- spec = menu.Append(wx.ID_ANY, _(u"Specificities and CA").decode('utf8'))
- classification = wx.Menu()
- reinert = classification.Append(wx.ID_ANY, _(u"Reinert method").decode('utf8'))
- #pam = classification.Append(wx.ID_ANY, u"Par matrice des distances")
- menu.AppendMenu(-1, _(u"Clustering").decode('utf8'), classification)
- simi = menu.Append(wx.ID_ANY, _(u"Similarities analysis").decode('utf8'))
- wdc = menu.Append(wx.ID_ANY, _(u"Wordcloud").decode('utf8'))
- subcorpus = wx.Menu()
- subcorpusfrommeta = subcorpus.Append(wx.ID_ANY, _(u'Sub corpus from metadata').decode('utf8'))
- subcorpusfromtheme = subcorpus.Append(wx.ID_ANY, _(u'Sub corpus from thematic').decode('utf8'))
- menu.AppendMenu(-1, _(u"Sub corpus").decode('utf8'), subcorpus)
+ buildmenu(menu, self.parent.text_menu)
menu.AppendSeparator()
- self.Bind(wx.EVT_MENU, self.OnReinert, reinert)
- #self.Bind(wx.EVT_MENU, self.OnPam, pam)
- self.Bind(wx.EVT_MENU, self.OnStat, stat)
- self.Bind(wx.EVT_MENU, self.OnSpec, spec)
- self.Bind(wx.EVT_MENU, self.OnSimiTxt, simi)
- self.Bind(wx.EVT_MENU, self.OnWordCloud, wdc)
- self.Bind(wx.EVT_MENU, self.OnSubTextFromMeta, subcorpusfrommeta)
- self.Bind(wx.EVT_MENU, self.OnSubTextFromTheme, subcorpusfromtheme)
elif 'matrix_name' in pydata :
- for i in range(self.parent.matrix_menu.GetMenuItemCount()) :
- item = self.parent.matrix_menu.FindItemByPosition(i)
- itemid = item.GetId()
- itemtext = item.GetText()
- if item.IsSubMenu() :
- nmenu = wx.Menu()
- for val in item.GetSubMenu().GetMenuItems() :
- nmenu.Append(val.GetId(), val.GetText())
- menu.AppendMenu(itemid, itemtext, nmenu)
- else :
- menu.Append(itemid, itemtext)
- split = wx.Menu()
- splitfromvar = split.Append(-1, _(u"Split from variable").decode('utf8'))
- menu.AppendMenu(-1, _(u"Split matrix").decode('utf8'), split)
- self.Bind(wx.EVT_MENU, self.OnSplitFromVar, splitfromvar)
- #print item, itemid, itemtext
- #menu = self.parent.matrix_menu
- #freq = menu.Append(wx.ID_ANY, _(u"Frequency").decode('utf8'))
- #chi2 = menu.Append(wx.ID_ANY, _(u"Chi square").decode('utf8'))
- #chdreinert = menu.Append(wx.ID_ANY, _(u"Reinert clustering").decode('utf8'))
- #simi = menu.Append(wx.ID_ANY, _(u"Similarity analysis").decode('utf8'))
+ buildmenu(menu, self.parent.matrix_menu)
menu.AppendSeparator()
- #self.Bind(wx.EVT_MENU, self.OnFreq, freq)
- #self.Bind(wx.EVT_MENU, self.OnChiSquare, chi2)
- #self.Bind(wx.EVT_MENU, self.OnSimiTab, simi)
- #self.Bind(wx.EVT_MENU, self.OnCHDReinert, chdreinert)
elif pydata.get('type', False) == 'alceste' and pydata['uuid'] in self.parent.history.opened :
openmenu = wx.Menu()
antipro = openmenu.Append(wx.ID_ANY, _(u"Antiprofiles").decode('utf8'))
menu.AppendMenu(wx.ID_ANY, _(u"Open ...").decode('utf8'), openmenu)
-
+
+ translate = menu.Append(wx.ID_ANY, _(u"Translate Profile").decode('utf8'))
profsr = menu.Append(wx.ID_ANY, _(u"Repeated segments profiles").decode('utf8'))
profgram = menu.Append(wx.ID_ANY, _(u"POS profiles").decode('utf8'))
+ stcaract = menu.Append(wx.ID_ANY, _(u"Typical text segments").decode('utf8'))
+ tgen = menu.Append(wx.ID_ANY, _(u"Tgen Editor").decode('utf8'))
+ computetgen = menu.Append(wx.ID_ANY, _(u"Compute Tgen").decode('utf8'))
+ mergeclustergraph = menu.Append(wx.ID_ANY, _(u"Merge Cluster Graph").decode('utf8'))
export_corpus = menu.Append(wx.ID_ANY, _(u"Export corpus").decode('utf8'))
colored = menu.Append(wx.ID_ANY, _(u"Colored corpus").decode('utf8'))
navig = menu.Append(wx.ID_ANY, _(u"Navigator").decode('utf8'))
@@ -451,8 +446,13 @@ class LeftTree(CT.CustomTreeCtrl):
subcorpusfromcl = menu.Append(wx.ID_ANY, _(u"Sub corpus from clusters").decode('utf8'))
menu.AppendSeparator()
self.Bind(wx.EVT_MENU, self.OpenAntipro, antipro)
+ self.Bind(wx.EVT_MENU, self.OnTranslate, translate)
self.Bind(wx.EVT_MENU, self.OnProfSR, profsr)
self.Bind(wx.EVT_MENU, self.OnProfGram, profgram)
+ self.Bind(wx.EVT_MENU, self.OnStCaract, stcaract)
+ self.Bind(wx.EVT_MENU, self.OnTgenEditor, tgen)
+ self.Bind(wx.EVT_MENU, self.OnTgenCompute, computetgen)
+ self.Bind(wx.EVT_MENU, self.OnMergeClusterGraph, mergeclustergraph)
self.Bind(wx.EVT_MENU, self.OnExportCorpus, export_corpus)
self.Bind(wx.EVT_MENU, self.OnColored, colored)
self.Bind(wx.EVT_MENU, self.OnNavig, navig)
@@ -463,8 +463,10 @@ class LeftTree(CT.CustomTreeCtrl):
elif pydata.get('type', False) == 'stat' and pydata['uuid'] in self.parent.history.opened :
export_dictionary = menu.Append(wx.ID_ANY, _(u"Export dictionary").decode('utf8'))
export_lems = menu.Append(wx.ID_ANY, _(u"Export lemma dictionary").decode('utf8'))
+ export_cut_corpus = menu.Append(wx.ID_ANY, _(u"Export segmented corpus").decode('utf8'))
self.Bind(wx.EVT_MENU, self.OnExportDictionary, export_dictionary)
self.Bind(wx.EVT_MENU, self.OnExportLems, export_lems)
+ self.Bind(wx.EVT_MENU, self.OnExportCutCorpus, export_cut_corpus)
menu.AppendSeparator()
elif pydata.get('type', False) == 'spec' and pydata['uuid'] in self.parent.history.opened :
tgen = menu.Append(wx.ID_ANY, _(u"Tgen Editor").decode('utf8'))
@@ -479,12 +481,13 @@ class LeftTree(CT.CustomTreeCtrl):
menu.AppendMenu(wx.ID_ANY, _(u"Open ...").decode('utf8'), openmenu)
self.Bind(wx.EVT_MENU, self.OpenAntipro, antipro)
self.Bind(wx.EVT_MENU, self.OnRapport, rapport)
-
-
- itemdelete = menu.Append(wx.ID_ANY, _(u"Delete from history").decode('utf8'))
+
+ itemdelete = wx.MenuItem(menu, wx.ID_ANY, _(u"Delete from history").decode('utf8'))
+ itemdelete.SetBitmap(wx.ArtProvider_GetBitmap(wx.ART_DELETE, size = (16,16)))
+ menu.AppendItem(itemdelete)
#item11 = menu.Append(wx.ID_ANY, "Prepend An Item")
#item12 = menu.Append(wx.ID_ANY, "Append An Item")
-
+
#self.Bind(wx.EVT_MENU, self.OnItemBackground, item1)
#self.Bind(wx.EVT_MENU, self.OnItemForeground, item2)
#self.Bind(wx.EVT_MENU, self.OnItemBold, item3)
@@ -496,9 +499,10 @@ class LeftTree(CT.CustomTreeCtrl):
self.Bind(wx.EVT_MENU, self.OnItemInfo, info)
self.Bind(wx.EVT_MENU, self.OnRename, rename)
self.Bind(wx.EVT_MENU, self.OnItemDelete, itemdelete)
+ self.Bind(wx.EVT_MENU, self.OnOpenFolder, openfolder)
#self.Bind(wx.EVT_MENU, self.OnItemPrepend, item11)
#self.Bind(wx.EVT_MENU, self.OnItemAppend, item12)
-
+
self.PopupMenu(menu)
menu.Destroy()
@@ -518,7 +522,7 @@ class LeftTree(CT.CustomTreeCtrl):
corpus = Corpus(self.parent, parametres = DoConf(irapath).getoptions('corpus'), read = True)
del busy
return corpus
-
+
def getmatrix(self):
if 'matrix_name' in self.pydata :
matrix = Tableau(self.parent, parametres = DoConf(self.pydata['ira']).getoptions('matrix'))
@@ -535,7 +539,7 @@ class LeftTree(CT.CustomTreeCtrl):
def OnStat(self, evt) :
self.parent.OnTextStat(evt, self.getcorpus())
-
+
def OnReinert(self, evt) :
self.parent.OnTextReinert(evt, self.getcorpus())
@@ -547,30 +551,30 @@ class LeftTree(CT.CustomTreeCtrl):
def OnWordCloud(self, evt) :
self.parent.OnWordCloud(evt, self.getcorpus())
+
+# def OnFreq(self, evt):
+# self.parent.OnFreq(evt, self.getmatrix())
+
+# def OnChiSquare(self, evt):
+# self.parent.OnChi2(evt, self.getmatrix())
+
+# def OnSimiTab(self, evt):
+# self.parent.OnSimiTab(evt, self.getmatrix())
- def OnFreq(self, evt):
- self.parent.OnFreq(evt, self.getmatrix())
-
- def OnChiSquare(self, evt):
- self.parent.OnChi2(evt, self.getmatrix())
-
- def OnSimiTab(self, evt):
- self.parent.OnSimiTab(evt, self.getmatrix())
-
- def OnProto(self, evt):
- self.parent.OnProto(evt, self.getmatrix())
+# def OnProto(self, evt):
+# self.parent.OnProto(evt, self.getmatrix())
- def OnSplitFromVar(self, evt):
- self.parent.OnSplitVar(evt, self.getmatrix())
+# def OnSplitFromVar(self, evt):
+# self.parent.OnSplitVar(evt, self.getmatrix())
- def OnCHDReinert(self, evt):
- self.parent.OnCHDReinert(evt, self.getmatrix())
+# def OnCHDReinert(self, evt):
+# self.parent.OnCHDReinert(evt, self.getmatrix())
- def OnSubTextFromMeta(self, evt):
- self.parent.OnSubText(self.getcorpus(), parametres = {'frommeta' : True})
+ #def OnSubTextFromMeta(self, evt):
+ # self.parent.OnSubText(self.getcorpus(), parametres = {'frommeta' : True})
- def OnSubTextFromTheme(self, evt):
- self.parent.OnSubText(self.getcorpus(), parametres = {'fromtheme' : True})
+ #def OnSubTextFromTheme(self, evt):
+ # self.parent.OnSubText(self.getcorpus(), parametres = {'fromtheme' : True})
def OnProfSR(self, evt) :
ProfileSegment(self.parent, self.page.dictpathout, self.page.parametres, self.page.corpus)
@@ -578,6 +582,49 @@ class LeftTree(CT.CustomTreeCtrl):
def OnProfGram(self, evt) :
ProfilType(self.parent, self.page.corpus, self.page.parametres)
+ def OnMergeClusterGraph(self, evt) :
+ MergeClusterGraph(self.parent, self.page.corpus, self.page.parametres)
+ print 'merge done !'
+
+ def OnStCaract(self, evt) :
+ dial = PrefUCECarac(self, self.parent)
+ dial.CenterOnParent()
+ if self.page.parametres['classif_mode'] != 2 :
+ uci = False
+ else :
+ uci = True
+
+ if dial.ShowModal() == wx.ID_OK :
+ limite = dial.spin_eff.GetValue()
+ atype = dial.radio_type.GetSelection()
+ dial.Destroy()
+ corpus = self.page.corpus
+ dlg = progressbar(self.ira, maxi = len(corpus.lc))
+ dlg.Update(1, 'wait...')
+ for i in range(0, len(corpus.lc)) :
+ page = self.page.ProfNB.GetPage(i)
+ rcl = page.cl - 1
+ dlg.Update(i, u'Cluster %i' % (i+1))
+ uces = corpus.lc[rcl]
+ tab = corpus.make_table_with_classe(uces, page.la, uci = uci)
+ tab.pop(0)
+ if atype == 0 :
+ ntab = [round(sum([page.lchi[j] for j, word in enumerate(line) if word == 1]),2) for line in tab]
+ else :
+ ntab = [round(sum([page.lchi[j] for j, word in enumerate(line) if word == 1])/float(sum(line)),2) if sum(line)!=0 else 0 for line in tab]
+ ntab2 = [[ntab[j], uces[j]] for j, val in enumerate(ntab)]
+ del ntab
+ ntab2.sort(reverse = True)
+ ntab2 = ntab2[:limite]
+ nuces = [val[1] for val in ntab2]
+ ucis_txt, ucestxt = doconcorde(corpus, nuces, page.la, uci = uci)
+ items = ['
'.join([ucis_txt[j], '
score : %.2f |