Ejemplo n.º 1
0
 def OnItemActivcated(self, event):
     node = event.GetItem()
     if not self.__isGroupNode(node):
         parent = self.GetParent()
         jid = self.GetItemPyData(node)
         if jid != None:
             parent.GetParent()._sessionMgr.activeChatSession(jid)
Ejemplo n.º 2
0
    def OnTreeItemMenu(self, event):
        item = event.GetItem()
        if item == None:
            return
        jid = self.GetPyData(item)
        self.SelectItem(item)
        menu = wx.Menu()
        if jid == None:
            menu.Append(self.ID_RENAME, u"改名")
            menu.Append(self.ID_REMOVE, u"删除本组所有联系人")
            menu.AppendSeparator()
            menu.Append(self.ID_BROADCAST, u"发送广播消息")
        else:
            menu.Append(self.ID_CHAT, u"开始交谈")
            menu.Append(self.ID_SEND_FILE, u"发送文件...")
            menu.AppendSeparator()
            menu.Append(self.ID_RENAME, u"改名")
            menu.Append(self.ID_MOVE, u"移动到其它组")
            menu.Append(self.ID_COPY, u"复制到其它组")
            menu.Append(self.ID_REMOVE, u"删除联系人")
            menu.AppendSeparator()
            menu.Append(self.ID_DETAIL, u"联系人详情")

        self.Bind(wx.EVT_MENU, self.OnCmdChat, id=self.ID_CHAT)
        self.Bind(wx.EVT_MENU, self.OnCmdSendFile, id=self.ID_SEND_FILE)

        self.Bind(wx.EVT_MENU, self.OnRemove, id=self.ID_REMOVE)
        self.Bind(wx.EVT_MENU, self.OnMove, id=self.ID_MOVE)
        self.Bind(wx.EVT_MENU, self.OnCopy, id=self.ID_COPY)
        self.Bind(wx.EVT_MENU, self.OnRename, id=self.ID_RENAME)
        self.Bind(wx.EVT_MENU, self.OnDetail, id=self.ID_DETAIL)

        self.PopupMenu(menu)
Ejemplo n.º 3
0
 def OnImageClick(self, event):
     print 'onimageclick'
     node = event.GetItem()
     if self.ItemHasChildren(node):
         if self.IsExpanded(node):
             self.Collapse(node)
         else:
             self.Expand(node)
Ejemplo n.º 4
0
    def OnEndLabelEdit(self, event):
        if event.IsEditCancelled():
            return

        newName = event.GetLabel()
        node = event.GetItem()

        if self.__isGroupNode(node):
            # 联系人组
            if newName in glob.imclient.roster.get_groups():
                event.Veto()
                return
            glob.imclient.renameGroup(self.oldName, newName)
        else:
            #单个联系人
            jid = self.GetPyData(node)
            glob.imclient.renameRoster(jid, newName)
Ejemplo n.º 5
0
 def OnBeginLabelEdit(self, event):
     node = event.GetItem()
     if self.__isGeneralGroupNode(node):
         event.Veto()
     else:
         self.oldName = self.GetItemText(node)