def displayData(self, activity_id=0): self.activity_id = activity_id if activity_id: self.editMode = True else : self.editMode = False groupInfo = fetch.excul_groupInfo(activity_id) self.text_ctrl_activity_name.SetValue(groupInfo['subject_name']) self.text_ctrl_description.SetValue('')
def OnRightClick(self, event): vList = event.GetEventObject() club_id = int(vList.GetName()) groupInfo = fetch.excul_groupInfo(club_id) subject_name = groupInfo['subject_name'] self.currentItem = vList.currentItem student_id = vList.GetSelectedID() gVar.student_id = student_id # 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.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) # make a menu menu = wx.Menu() # add some items title = "%s, %s, %s" % (subject_name, "Teacher", "Population") menu.SetTitle(title) menu.Append(self.popupID1, "Edit Club") menu.Append(self.popupID2, "Delete Club") menu.AppendSeparator() self.currentItem = vList.currentItem student_id = vList.GetSelectedID() item_has_focus = vList.GetFirstSelected() if item_has_focus > -1: menu.Append(self.popupID3, "View Student Details") # Popup the menu. If an item is selected then its handler # will be called before PopupMenu returns. position = self.ScreenToClient(wx.GetMousePosition()) self.PopupMenu(menu, position) menu.Destroy()