-
- # only do this part the first time so the events are only bound once
- if not hasattr(self, "popupID1"):
- self.popupID1 = wx.NewId()
- self.popupID2 = wx.NewId()
- self.popupID3 = wx.NewId()
- self.popup_Tgen_glob = wx.NewId()
-
- self.Bind(wx.EVT_MENU, self.OnPopupOne, id=self.popupID1)
- self.Bind(wx.EVT_MENU, self.OnPopupTwo, id=self.popupID2)
- self.Bind(wx.EVT_MENU, self.OnPopupThree, id=self.popupID3)
- self.Bind(wx.EVT_MENU, self.OnTgen_glob, id=self.popup_Tgen_glob)
- # make a menu
- menu = wx.Menu()
- # add some items
- menu.Append(self.popupID1, u"Formes associées")
- menu.Append(self.popupID2, u"Concordancier")
- menu.Append(self.popupID3, "Graphique")
- #menu.Append(self.popup_Tgen_glob, "Tgen global")
-
- self.PopupMenu(menu)
- menu.Destroy()
-
+ if self.menu :
+ # only do this part the first time so the events are only bound once
+ if not hasattr(self, "popupID1"):
+ self.popupID1 = wx.NewId()
+ self.popupID2 = wx.NewId()
+ self.popupID3 = wx.NewId()
+ self.popup_Tgen_glob = wx.NewId()
+ self.onmaketgen = wx.NewId()
+ self.ID_stcaract = wx.NewId()
+
+ self.Bind(wx.EVT_MENU, self.OnPopupOne, id=self.popupID1)
+ self.Bind(wx.EVT_MENU, self.OnPopupTwo, id=self.popupID2)
+ self.Bind(wx.EVT_MENU, self.OnPopupThree, id=self.popupID3)
+ self.Bind(wx.EVT_MENU, self.OnTgen_glob, id=self.popup_Tgen_glob)
+ self.Bind(wx.EVT_MENU, self.OnMakeTgen, id=self.onmaketgen)
+ #self.Bind(wx.EVT_MENU, self.onstcaract, id = self.ID_stcaract)
+ # make a menu
+ menu = wx.Menu()
+ # add some items
+ menu.Append(self.popupID1, _(u"Associated forms").decode('utf8'))
+ menu.Append(self.popupID2, _(u"Concordance").decode('utf8'))
+ menu.Append(self.popupID3, _(u"Graphic").decode('utf8'))
+ menu_stcaract = wx.Menu()
+ self.menuid = {}
+ if not self.tgen :
+ for i, et in enumerate(self.etoiles) :
+ nid = wx.NewId()
+ self.menuid[nid] = i
+ menu_stcaract.Append(nid, et)
+ self.Bind(wx.EVT_MENU, self.onstcaract, id = nid)
+ menu.AppendMenu(-1, _(u"Typical text segments").decode('utf8'), menu_stcaract)
+ menu.Append(self.onmaketgen, _(u"Make Tgen").decode('utf8'))
+ self.PopupMenu(menu)
+ menu.Destroy()
+
+ def getselectedwords(self) :
+ words = [self.getColumnText(self.GetFirstSelected(), 0)]
+ last = self.GetFirstSelected()
+ while self.GetNextSelected(last) != -1:
+ last = self.GetNextSelected(last)
+ words.append(self.getColumnText(last, 0))
+ return words