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())
self.SetImageList(self.il)
self.count = 0
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'})
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)
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 :
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)
item = self.parent.matrix_menu.FindItemByPosition(i)
itemid = item.GetId()
itemtext = item.GetText()
- menu.Append(itemid, itemtext)
+ 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'))
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'))
- export_classes = menu.Append(wx.ID_ANY, _(u"Export Clusters").decode('utf8'))
+ export_classes = menu.Append(wx.ID_ANY, _(u"Export clusters").decode('utf8'))
+ 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.OnProfSR, profsr)
self.Bind(wx.EVT_MENU, self.StatClasse, statclasse)
self.Bind(wx.EVT_MENU, self.OnRapport, rapport)
self.Bind(wx.EVT_MENU, self.OnExportClasses, export_classes)
+ self.Bind(wx.EVT_MENU, self.OnSubCorpusFromClusters, subcorpusfromcl)
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'))
elif pydata.get('type', False) == 'reinertmatrix' and pydata['uuid'] in self.parent.history.opened :
openmenu = wx.Menu()
antipro = openmenu.Append(wx.ID_ANY, _(u"antiprofiles").decode('utf8'))
+ rapport = menu.Append(wx.ID_ANY, _(u"Report").decode('utf8'))
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'))
#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)
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())
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()
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
dial = wx.MessageDialog(self, self.page.pathout['classe_x_export.txt'], u"Export", wx.OK|wx.ICON_INFORMATION)
dial.ShowModal()
dial.Destroy()
+
+ def OnSubCorpusFromClusters(self, evt):
+ self.parent.OnSubText(self.getcorpus(), parametres = {'fromclusters' : True, 'clnb': self.page.parametres['clnb'], 'lc' : self.page.corpus.lc})
+
+ def OnRename(self, event):
+ pydata = self.itemdict['pydata']
+ print pydata
def OnItemBackground(self, event):
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)
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):
+ def OnItemAppend(self, item, select = True):
if 'corpus_name' in item :
child = self.InsertItem(self.textroot, 0, item['corpus_name'])
else :
child = self.InsertItem(self.matroot, 0, item['matrix_name'])
self.SetPyData(child, item)
- self.history.addtab(item)
if item['type'] in self.ild :
img = self.ild[item['type']]
else :
img = 24
self.SetItemImage(child, img, CT.TreeItemIcon_Normal)
- self.SetItemImage(child, 13, CT.TreeItemIcon_Expanded)
- self.SetItemBold(child, True)
+ self.SetItemImage(child, img, CT.TreeItemIcon_Expanded)
+ if select :
+ self.history.addtab(item)
+ self.SetItemBold(child, True)
#dlg = wx.TextEntryDialog(self, "Please Enter The New Item Name", 'Item Naming', 'Python')