X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=blobdiff_plain;f=tree.py;h=3d8196c6ac18bba2b70567aa76904637da9fdea5;hp=d1df2d6829533a5b47bbdb3624ef64989fa8d4de;hb=763d90785a9de548c3a5ffd9b718e3e5fea8332d;hpb=b563d3428deb1e62062d8af0fd3dfa2e329930bd diff --git a/tree.py b/tree.py index d1df2d6..3d8196c 100644 --- a/tree.py +++ b/tree.py @@ -11,13 +11,14 @@ 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 from profile_segment import ProfileSegment, ProfilType from search_tools import SearchFrame from dialog import PrefSimpleFile, PrefExport from layout import open_antiprofil, TgenLayout from guifunct import TGenFrame from textaslexico import TgenSpec +from textreinert import TgenProf log = logging.getLogger('iramuteq.tree') @@ -123,9 +124,11 @@ class LeftTree(CT.CustomTreeCtrl): 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['freqmulti'] = 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['simiclustermatrix'] = 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()) self.SetImageList(self.il) @@ -141,7 +144,7 @@ class LeftTree(CT.CustomTreeCtrl): 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) @@ -163,7 +166,7 @@ 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) @@ -383,8 +386,8 @@ class LeftTree(CT.CustomTreeCtrl): 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 = menu.Append(wx.ID_ANY, _(u"Informations").decode('utf8')) + rename = menu.Append(wx.ID_ANY, _(u"Rename").decode('utf8')) menu.AppendSeparator() if 'corpus_name' in pydata : @@ -443,6 +446,8 @@ class LeftTree(CT.CustomTreeCtrl): profsr = menu.Append(wx.ID_ANY, _(u"Repeated segments profiles").decode('utf8')) profgram = menu.Append(wx.ID_ANY, _(u"POS profiles").decode('utf8')) + tgen = menu.Append(wx.ID_ANY, _(u"Tgen Editor").decode('utf8')) + computetgen = menu.Append(wx.ID_ANY, _(u"Compute Tgen").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')) @@ -454,6 +459,8 @@ class LeftTree(CT.CustomTreeCtrl): self.Bind(wx.EVT_MENU, self.OpenAntipro, antipro) self.Bind(wx.EVT_MENU, self.OnProfSR, profsr) self.Bind(wx.EVT_MENU, self.OnProfGram, profgram) + self.Bind(wx.EVT_MENU, self.OnTgenEditor, tgen) + self.Bind(wx.EVT_MENU, self.OnTgenCompute, computetgen) 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) @@ -716,8 +723,11 @@ class LeftTree(CT.CustomTreeCtrl): else : self.page.parametres['tgenpath'] = tgenpath tgen = TGen(path = tgenpath, encoding = self.parent.syscoding) - self.page.parametres['etoiles'] = self.page.etoiles - TgenSpec(self.parent, corpus, self.page.parametres) + if self.page.parametres['type'] == 'spec' : + self.page.parametres['etoiles'] = self.page.etoiles + TgenSpec(self.parent, corpus, self.page.parametres) + elif self.page.parametres['type'] == 'alceste' : + TgenProf(self.parent, corpus, self.page.parametres, self.page.cluster_size) TgenLayout(self.page) def OnExportClasses(self, event): @@ -969,6 +979,7 @@ class LeftTree(CT.CustomTreeCtrl): if select : self.history.addtab(item) self.SetItemBold(child, True) + self.SelectItem(child) #dlg = wx.TextEntryDialog(self, "Please Enter The New Item Name", 'Item Naming', 'Python') @@ -1030,12 +1041,19 @@ class LeftTree(CT.CustomTreeCtrl): elif pydata['uuid'] in ['textroot', 'matroot'] : pass else : - busy = wx.BusyInfo(_("Please wait..."), self.parent) - wx.SafeYield() - OpenAnalyse(self.parent, pydata) - del busy - self.SetItemBold(item, True) - self.OnSelChanged(pydata = pydata) + if os.path.exists(pydata['ira']) : + busy = wx.BusyInfo(_("Please wait..."), self.parent) + wx.SafeYield() + try : + OpenAnalyse(self.parent, pydata) + del busy + self.SetItemBold(item, True) + self.OnSelChanged(pydata = pydata) + except : + del busy + BugReport(self.ira) + else : + wx.MessageBox(_(u"This file does not exist : %s" % pydata['ira']).decode('utf8'), 'Information', wx.ICON_EXCLAMATION | wx.STAY_ON_TOP ) #if item and (flags & CT.TREE_HITTEST_ONITEMLABEL): # if self.GetAGWWindowStyleFlag() & CT.TR_EDIT_LABELS: # self.log.info("OnLeftDClick: %s (manually starting label edit)"% self.GetItemText(item) + "\n")