Пример #1
0
    def initUI(self):
        boxsizer = wx.BoxSizer(wx.HORIZONTAL)
        
        leftP = wx.Panel(self,-1)
        boxsizerL = wx.BoxSizer(wx.VERTICAL)
        self.contentPanel = scrolled.ScrolledPanel(leftP, -1)
        self.contentPanel.SetBackgroundColour('white')
        self.contentBS = wx.BoxSizer(wx.VERTICAL)
        self.contentPanel.SetSizer(self.contentBS)
        self.contentPanel.Layout()
        self.contentPanel.SetAutoLayout(1)
        self.contentPanel.SetupScrolling()
        self.toolP = wx.Panel(leftP,-1)
        boxsizertb = wx.BoxSizer(wx.HORIZONTAL)
        bm1 = tools.scale_bitmap_from_file('images/send.png', 25, 25)
        bm2 = tools.scale_bitmap_from_file('images/emt.png', 25, 25)
        bm3 = tools.scale_bitmap_from_file('images/chat.png', 25, 25)
        bmb1 = wx.BitmapButton(self.toolP,-1,bitmap=bm1,size=(40,30),style=0)
        bmb2 = wx.BitmapButton(self.toolP,-1,bitmap=bm2,size=(40,30),style=0)
        bmb3 = wx.BitmapButton(self.toolP,-1,bitmap=bm3,size=(40,30),style=0)
        boxsizertb.Add(bmb2,0,flag=wx.ALL|wx.ALIGN_LEFT)
        boxsizertb.Add(bmb1,0,flag=wx.ALL|wx.ALIGN_LEFT)
        boxsizertb.Add(bmb3,0,flag=wx.ALL|wx.ALIGN_LEFT)
        self.toolP.SetSizer(boxsizertb)
        self.textArea = wx.TextCtrl(leftP, -1, "",style=wx.TE_MULTILINE|wx.TE_RICH2|wx.NO_BORDER)
        bottomP = wx.Panel(leftP,-1)
        bottomPBS = wx.BoxSizer(wx.HORIZONTAL)
        self.sendBtn = wx.Button(bottomP,-1,u'发送',size=(50,30))
        self.closeBtn = wx.Button(bottomP,-1,u'关闭',size=(50,30))
        bottomPBS.Add(self.closeBtn,1,flag=wx.ALL)
        bottomPBS.Add(self.sendBtn,1,flag=wx.ALL)
        bottomP.SetSizer(bottomPBS)
        boxsizerL.Add(self.contentPanel,10,flag=wx.ALL|wx.EXPAND)
        boxsizerL.Add(self.toolP,1,flag=wx.ALL|wx.EXPAND)
        boxsizerL.Add(self.textArea,4,flag=wx.ALL|wx.EXPAND)
        boxsizerL.Add(bottomP,1,flag=wx.ALL|wx.ALIGN_RIGHT)
        leftP.SetSizer(boxsizerL)
        boxsizer.Add(leftP,5,flag=wx.ALL|wx.EXPAND)
        
        rightP = wx.Panel(self,-1)     
        rightP.SetBackgroundColour('gray')     
        boxsizerR = wx.BoxSizer(wx.VERTICAL)
        st = wx.StaticText(rightP,-1,u'群公告')
        stPanel = wx.Panel(rightP,-1)
        stPanel.SetBackgroundColour('white')
        wx.StaticText(stPanel,-1,u'xxxxxxxxxxxxxx')
        self.grouplist = self.updateUserList(rightP)
        

        boxsizerR.Add(st,1,flag=wx.ALL|wx.ALIGN_CENTER_HORIZONTAL,border=8)
        boxsizerR.Add(stPanel,5,flag=wx.ALL|wx.EXPAND,border=5)
        boxsizerR.Add(self.grouplist,10,flag=wx.ALL|wx.EXPAND)
        rightP.SetSizer(boxsizerR)
        
        boxsizer.Add(rightP,2,flag=wx.ALL|wx.EXPAND)
        
        self.Bind(wx.EVT_BUTTON,self.onSendMsg,self.sendBtn)
        self.Bind(wx.EVT_BUTTON,self.onClose,self.closeBtn)
           
        self.SetSizer(boxsizer)
Пример #2
0
    def initUI(self):
        boxsizer = wx.BoxSizer(wx.HORIZONTAL)
        
        leftP = wx.Panel(self,-1)
        boxsizerL = wx.BoxSizer(wx.VERTICAL)
        self.contentPanel = scrolled.ScrolledPanel(leftP, -1)
        self.contentPanel.SetBackgroundColour('white')
        self.contentBS = wx.BoxSizer(wx.VERTICAL)
        self.contentPanel.SetSizer(self.contentBS)
        self.contentPanel.Layout()
        self.contentPanel.SetAutoLayout(1)
        self.contentPanel.SetupScrolling()
        self.toolP = wx.Panel(leftP,-1)
        boxsizertb = wx.BoxSizer(wx.HORIZONTAL)
        bm1 = tools.scale_bitmap_from_file('images/send.png', 25, 25)
        bm2 = tools.scale_bitmap_from_file('images/emt.png', 25, 25)
        bm3 = tools.scale_bitmap_from_file('images/chat.png', 25, 25)
        bmb1 = wx.BitmapButton(self.toolP,-1,bitmap=bm1,size=(40,30),style=0)
        bmb2 = wx.BitmapButton(self.toolP,-1,bitmap=bm2,size=(40,30),style=0)
        bmb3 = wx.BitmapButton(self.toolP,-1,bitmap=bm3,size=(40,30),style=0)
        boxsizertb.Add(bmb2,0,flag=wx.ALL|wx.ALIGN_LEFT)
        boxsizertb.Add(bmb1,0,flag=wx.ALL|wx.ALIGN_LEFT)
        boxsizertb.Add(bmb3,0,flag=wx.ALL|wx.ALIGN_LEFT)
        self.toolP.SetSizer(boxsizertb)
        self.textArea = wx.TextCtrl(leftP, -1, "",style=wx.TE_MULTILINE|wx.TE_RICH2|wx.NO_BORDER)
        bottomP = wx.Panel(leftP,-1)
        bottomPBS = wx.BoxSizer(wx.HORIZONTAL)
        self.sendBtn = wx.Button(bottomP,-1,u'发送',size=(50,30))
        self.closeBtn = wx.Button(bottomP,-1,u'关闭',size=(50,30))
        bottomPBS.Add(self.closeBtn,1,flag=wx.ALL)
        bottomPBS.Add(self.sendBtn,1,flag=wx.ALL)
        bottomP.SetSizer(bottomPBS)
        boxsizerL.Add(self.contentPanel,10,flag=wx.ALL|wx.EXPAND)
        boxsizerL.Add(self.toolP,1,flag=wx.ALL|wx.EXPAND)
        boxsizerL.Add(self.textArea,4,flag=wx.ALL|wx.EXPAND)
        boxsizerL.Add(bottomP,1,flag=wx.ALL|wx.ALIGN_RIGHT)
        leftP.SetSizer(boxsizerL)
        boxsizer.Add(leftP,5,flag=wx.ALL|wx.EXPAND)
        
        rightP = wx.Panel(self,-1)    
        rightP.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
        rightP.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) 
        rightP.SetBackgroundColour('white')     
        boxsizerR = wx.BoxSizer(wx.VERTICAL)
        if os.path.isfile('images/%s.png'%self.jid):
            bitmap = wx.Bitmap('images/%s.png'%self.jid,BITMAP_TYPE_ANY)
        else:
            bitmap = wx.Bitmap('images/im.png',BITMAP_TYPE_ANY)

        image = self.scale_bitmap(bitmap, 80, 80)
        blankP = wx.Panel(rightP,-1)
        blankP2 = wx.Panel(rightP,-1)
        username = wx.StaticText(rightP,-1,u'    姓名: %s'%self.nickname)
        position = wx.StaticText(rightP,-1,u'    职位: ')
        deparment = wx.StaticText(rightP,-1,u'    部门: ')
        tel = wx.StaticText(rightP,-1,u'    电话: ')
        phone = wx.StaticText(rightP,-1,u'    手机: ')
        email = wx.StaticText(rightP,-1,u'    邮箱: ')
        self.userPic = userPic = wx.StaticBitmap(rightP,bitmap=image)
        boxsizerR.Add(blankP,1,flag=wx.ALL|wx.EXPAND)
        boxsizerR.Add(userPic,5,flag=wx.ALL|wx.ALIGN_CENTER)
        boxsizerR.Add(username,1,flag=wx.ALL|wx.EXPAND)
        boxsizerR.Add(position,1,flag=wx.ALL|wx.EXPAND)
        boxsizerR.Add(deparment,1,flag=wx.ALL|wx.EXPAND)
        boxsizerR.Add(tel,1,flag=wx.ALL|wx.EXPAND)
        boxsizerR.Add(phone,1,flag=wx.ALL|wx.EXPAND)
        boxsizerR.Add(email,1,flag=wx.ALL|wx.EXPAND)
        boxsizerR.Add(blankP2,3,flag=wx.ALL|wx.EXPAND)
        rightP.SetSizer(boxsizerR)
        
        boxsizer.Add(rightP,2,flag=wx.ALL|wx.EXPAND)
        
        self.Bind(wx.EVT_BUTTON,self.onSendMsg,self.sendBtn)
        self.Bind(wx.EVT_BUTTON,self.onClose,self.closeBtn)
           
        self.SetSizer(boxsizer)
Пример #3
0
 def updateImg(self,name,nickname):
     image = tools.scale_bitmap_from_file('images/%s.png' % (name), 64, 64)
     self.sm.SetBitmap(image)
     self.username.SetLabel('%s'%nickname)