...
[iramuteq] / tree.py
diff --git a/tree.py b/tree.py
index 80515fa..1a9b6fd 100644 (file)
--- a/tree.py
+++ b/tree.py
@@ -159,7 +159,7 @@ class LeftTree(CT.CustomTreeCtrl):
                     else :
                         img = 24
                     self.SetItemImage(last, img, CT.TreeItemIcon_Normal)
-                    self.SetItemImage(last, 13, CT.TreeItemIcon_Expanded)
+                    self.SetItemImage(last, img, CT.TreeItemIcon_Expanded)
 
         self.matroot = self.AppendItem(self.root, u'Matrices')
         self.SetPyData(self.matroot, {'uuid': 'matroot'})
@@ -182,7 +182,7 @@ class LeftTree(CT.CustomTreeCtrl):
                         else :
                             img = 24
                         self.SetItemImage(last, img, CT.TreeItemIcon_Normal)
-                        self.SetItemImage(last, 13, CT.TreeItemIcon_Expanded)
+                        self.SetItemImage(last, img, CT.TreeItemIcon_Expanded)
             else :
                 orphmat.append(matrix)     
 
@@ -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 :
@@ -394,9 +395,9 @@ class LeftTree(CT.CustomTreeCtrl):
                 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 corpora from metadata').decode('utf8'))
-                subcorpusfromtheme = subcorpus.Append(wx.ID_ANY, _(u'Sub corpora from thematic').decode('utf8'))
-                menu.AppendMenu(-1, _(u"SubCorpora").decode('utf8'), subcorpus)
+                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)
                 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'))
@@ -430,8 +435,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'))
-                export_corpus = menu.Append(wx.ID_ANY, _(u"Export corpora").decode('utf8'))
-                colored = menu.Append(wx.ID_ANY, _(u"Colored corpora").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'))
                 statclasse = menu.Append(wx.ID_ANY, _(u"Clusters statistics").decode('utf8'))
                 rapport = menu.Append(wx.ID_ANY, _(u"Report").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())
@@ -578,7 +590,7 @@ class LeftTree(CT.CustomTreeCtrl):
             dlg.Destroy()
 
     def OnColored(self, evt) :
-        dial = PrefSimpleFile(self, self.parent, **{'mask' : '*.html', 'title': _(u"Colored corpora").decode('utf8')})
+        dial = PrefSimpleFile(self, self.parent, **{'mask' : '*.html', 'title': _(u"Colored corpus").decode('utf8')})
         dial.fbb.SetValue(os.path.join(os.path.dirname(self.page.dictpathout['ira']), 'corpus_couleur.html'))
         dial.CenterOnParent()
         res = dial.ShowModal()
@@ -705,6 +717,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):
 
@@ -928,7 +944,7 @@ class LeftTree(CT.CustomTreeCtrl):
         else :
             img = 24
         self.SetItemImage(child, img, CT.TreeItemIcon_Normal)
-        self.SetItemImage(child, 13, CT.TreeItemIcon_Expanded)
+        self.SetItemImage(child, img, CT.TreeItemIcon_Expanded)
         self.SetItemBold(child, True)
         
         #dlg = wx.TextEntryDialog(self, "Please Enter The New Item Name", 'Item Naming', 'Python')