X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=blobdiff_plain;f=tree.py;h=82aada2f2ecde984b0a5e8a073bc1687a290e023;hp=8ebbe2e12fc6fea7b16028438c0c7d48111ab62c;hb=9807dd4ff12bb4206359404461c7170361e35d67;hpb=6523e3596df7ec9b7b94b875593953d4b34b6117 diff --git a/tree.py b/tree.py index 8ebbe2e..82aada2 100644 --- a/tree.py +++ b/tree.py @@ -381,7 +381,8 @@ class LeftTree(CT.CustomTreeCtrl): if not item in [self.textroot, self.matroot] : menu = wx.Menu() - info = menu.Append(wx.ID_ANY, "Informations") + info = menu.Append(wx.ID_ANY, _(u"Informations").encode('utf8')) + rename = menu.Append(wx.ID_ANY, _(u"Rename").encode('utf8')) menu.AppendSeparator() if 'corpus_name' in pydata : @@ -396,7 +397,7 @@ class LeftTree(CT.CustomTreeCtrl): 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"Subcorpus").decode('utf8'), subcorpus) + menu.AppendMenu(-1, _(u"Sub corpus").decode('utf8'), subcorpus) menu.AppendSeparator() self.Bind(wx.EVT_MENU, self.OnReinert, reinert) #self.Bind(wx.EVT_MENU, self.OnPam, pam) @@ -412,6 +413,10 @@ class LeftTree(CT.CustomTreeCtrl): itemid = item.GetId() itemtext = item.GetText() 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')) @@ -478,6 +483,7 @@ class LeftTree(CT.CustomTreeCtrl): #self.Bind(wx.EVT_MENU, self.OnDisableItem, item7) #self.Bind(wx.EVT_MENU, self.OnItemIcons, item8) 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.OnItemPrepend, item11) #self.Bind(wx.EVT_MENU, self.OnItemAppend, item12) @@ -539,6 +545,12 @@ class LeftTree(CT.CustomTreeCtrl): def OnSimiTab(self, evt): self.parent.OnSimiTab(evt, self.getmatrix()) + + def OnProto(self, evt): + self.parent.OnProto(evt, self.getmatrix()) + + def OnSplitFromVar(self, evt): + self.parent.OnSplitVar(evt, self.getmatrix()) def OnCHDReinert(self, evt): self.parent.OnCHDReinert(evt, self.getmatrix()) @@ -685,11 +697,16 @@ class LeftTree(CT.CustomTreeCtrl): def OnTgenCompute(self, evt): corpus = self.page.corpus tgenpath = os.path.join(self.page.parametres['pathout'], 'tgen.csv') - 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) - TgenLayout(self.page) + if not os.path.exists(tgenpath) : + message = wx.MessageDialog(self.parent, _(u"No TGen yet !"), style = wx.ICON_EXCLAMATION | wx.OK) + message.ShowModal() + message.Destroy() + 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) + TgenLayout(self.page) def OnExportClasses(self, event): corpus = self.page.corpus @@ -705,6 +722,10 @@ class LeftTree(CT.CustomTreeCtrl): dial = wx.MessageDialog(self, self.page.pathout['classe_x_export.txt'], u"Export", wx.OK|wx.ICON_INFORMATION) dial.ShowModal() dial.Destroy() + + def OnRename(self, event): + pydata = self.itemdict['pydata'] + print pydata def OnItemBackground(self, event): @@ -887,6 +908,7 @@ class LeftTree(CT.CustomTreeCtrl): self.SetItemImage(item, img, CT.TreeItemIcon_Normal) self.SetItemImage(item, 13, CT.TreeItemIcon_Expanded) self.SetItemBold(item, bold) + self.SelectItem(item) def AddMatAnalyse(self, parametres, itemParent = None, bold = True) : uuid = parametres.get('matrix', None) @@ -914,7 +936,8 @@ class LeftTree(CT.CustomTreeCtrl): img = 24 self.SetItemImage(item, img, CT.TreeItemIcon_Normal) self.SetItemImage(item, 13, CT.TreeItemIcon_Expanded) - self.SetItemBold(item, bold) + self.SetItemBold(item, bold) + self.SelectItem(item) def OnItemAppend(self, item): if 'corpus_name' in item :