def initUI(self,roster): boxsizer = wx.BoxSizer(wx.VERTICAL) toppanel = wx.Panel(self,-1) gridbs = wx.GridBagSizer() icon = wx.Icon('images/char.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(icon) bitmap = wx.Bitmap('images/im.png',BITMAP_TYPE_ANY) bitmap = tools.scale_bitmap(bitmap, 64, 64) if os.path.isfile('images/%s.png'%self.jid): userPicBit = wx.Bitmap('images/%s.png'%self.jid,BITMAP_TYPE_ANY) bitmap = tools.scale_bitmap(userPicBit, 64, 64) else: userPicBit = wx.Bitmap('images/im.png',BITMAP_TYPE_ANY) bitmap = tools.scale_bitmap(userPicBit, 64, 64) self.sm = sm = wx.StaticBitmap(toppanel,-1,bitmap=bitmap) font = wx.Font(16,wx.DEFAULT,wx.NORMAL,wx.NORMAL) self.username = username = wx.StaticText(toppanel, -1, "") username.SetFont(font) choiceslist = [u"忙碌",u"离开",u"离线"] status = wx.ComboBox(parent=toppanel,choices=choiceslist,size=(50,30),value=u'在线') signature = wx.StaticText(toppanel,-1,u"存在的就是合理的...........") gridbs.Add(sm,pos=(0,0),span=(4,3),flag=wx.ALL|wx.EXPAND,border=5) gridbs.Add(username,pos=(0,3),span=(1,15),flag=wx.ALIGN_BOTTOM) gridbs.Add(status,pos=(0,21),flag=wx.ALL|wx.ALIGN_RIGHT,border=1) gridbs.Add(signature,pos=(1,3),span=(1,15)) toppanel.SetSizer(gridbs) #self.tabpanel = tabpanel = tabPanel(self,-1,roster) self.tabpanel = tabpanel = tabPanel(self,-1,roster,self.conn) boxsizer.Add(toppanel,1,flag=wx.ALL|wx.EXPAND) boxsizer.Add(tabpanel,7,flag=wx.ALL|wx.EXPAND) self.SetSizer(boxsizer) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.Show(True) self.conn.sendInitPresence() self.conn.send(xmpp.Iq('get','vcard-temp','',xmpp.JID(self.jid))) self.conn.send(xmpp.Iq('get','http://jabber.org/protocol/disco#items','','conference.m.zy.cm'))
def updateGroupUserList(self,users): isz = (16,16) il = wx.ImageList(isz[0], isz[1]) group = wx.Bitmap('images/games_rpg.png',BITMAP_TYPE_ANY) groupbm = tools.scale_bitmap(group, 16, 16) fldridx = il.Add(groupbm) self.tree.SetImageList(il) self.il = il self.root = self.tree.AddRoot("The Root Item") for jid,name in users: child = self.tree.AppendItem(self.root,'%s'%name) # self.tree.SetPyData(child, {'jid':'%s'%jid,'msg':[],'name':"%s" % (name)}) self.tree.SetItemImage(child, fldridx, wx.TreeItemIcon_Normal) return
def updateUserList(self,panel): groupUserList = wx.Panel(panel,-1) groupUserList.Bind(wx.EVT_SIZE, self.OnSize) self.tree = wx.TreeCtrl(groupUserList,-1,style=wx.TR_HAS_BUTTONS|wx.TR_HIDE_ROOT|wx.NO_BORDER) isz = (16,16) il = wx.ImageList(isz[0], isz[1]) group = wx.Bitmap('images/games_rpg.png',BITMAP_TYPE_ANY) groupbm = tools.scale_bitmap(group, 16, 16) fldridx = il.Add(groupbm) self.tree.SetImageList(il) self.il = il self.root = self.tree.AddRoot("The Root Item") #self.tree.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDClick) return groupUserList
def updateTree(self,rooms): self.tree = wx.TreeCtrl(self,-1,style=wx.TR_HAS_BUTTONS|wx.TR_HIDE_ROOT|wx.NO_BORDER) isz = (16,16) il = wx.ImageList(isz[0], isz[1]) group = wx.Bitmap('images/games_rpg.png',BITMAP_TYPE_ANY) groupbm = tools.scale_bitmap(group, 16, 16) fldridx = il.Add(groupbm) self.tree.SetImageList(il) self.il = il self.root = self.tree.AddRoot("The Root Item") for jid,name in rooms: child = self.tree.AppendItem(self.root,'%s'%name) self.tree.SetPyData(child, {'jid':'%s'%jid,'msg':[],'name':"%s" % (name)}) self.tree.SetItemImage(child, fldridx, wx.TreeItemIcon_Normal) self.tree.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDClick)