def __init__(self,appli_window): wx.Panel.__init__(self, appli_window, -1) self.appli_window = appli_window [ wxID_WXMAINFRAMECHATTERSLISTBOX, wxID_WXMAINFRAMECHATTEXTCTRL, wxID_WXMAINFRAMEMESSAGETEXTCTRL, wxID_WXMAINFRAMESENDMESSAGEBUTTON ] = map(lambda _init_ctrls: wx.NewId(), range(4)) [ wxID_WXMAINFRAMELOGO_WINDOW, wxID_WXMAINFRAMELOGOBITMAP ] = map(lambda _init_ctrls: wx.NewId(), range(2)) self.logo_window = wx.Window(id=wxID_WXMAINFRAMELOGO_WINDOW, name='logo_window', parent=self, pos=wx.Point(0, 0), size=wx.Size(295, 76), style=0) logo = ImageManager.getBitmap(ImageManager.IMG_SOLIPSIS_LOGO) self.logoBitmap = wx.StaticBitmap(bitmap=logo, id=wxID_WXMAINFRAMELOGOBITMAP, name='logoBitmap', parent=self.logo_window, pos=wx.Point(0, 0), size=wx.Size(295, 76), style=0) self.logoHeight = 76 self.chattersListBox = wx.ListBox(choices=[], id=wxID_WXMAINFRAMECHATTERSLISTBOX, name='chattersList', parent=self, pos=wx.Point(6, 30 + self.logoHeight), size=wx.Size(279,135), style=wx.NO_BORDER|wx.LB_ALWAYS_SB, validator=wx.DefaultValidator) self.chatTextCtrl = wx.TextCtrl(id=wxID_WXMAINFRAMECHATTEXTCTRL, name='chatTextCtrl', parent=self, pos=wx.Point(6, 201 + self.logoHeight), size=wx.Size(279, 233), style=wx.NO_BORDER|wx.TE_MULTILINE|wx.TE_READONLY, value='') self.messageTextCtrl = wx.TextCtrl(id=wxID_WXMAINFRAMEMESSAGETEXTCTRL, name='messageTextCtrl', parent=self, pos=wx.Point(6, 460 + self.logoHeight), size=wx.Size(279, 115), style=wx.NO_BORDER|wx.TE_MULTILINE, value='') sendBitmap =ImageManager.getBitmap(ImageManager.IMG_SEND_BLUE) self.sendMessageButton = wx.BitmapButton(bitmap=sendBitmap, id=wxID_WXMAINFRAMESENDMESSAGEBUTTON, name='sendMessageButton', parent=self, pos=wx.Point(190, 441 + self.logoHeight), size=wx.Size(81, 17), validator=wx.DefaultValidator) self.Bind(wx.EVT_PAINT, self.OnPaint)
def _init_ctrls(self): # frame initialization wxFrame.__init__(self, id=wxID_WXMAINFRAME, name='wxMainFrame', parent=None, pos=wxPoint(0, 0), size=wxSize(1024, 768), style=wxDEFAULT_FRAME_STYLE & ~ (wxRESIZE_BORDER | wxRESIZE_BOX | wxMAXIMIZE_BOX), title='Solipsis') self._init_utils() self.SetClientSize(wxSize(1016, 741)) # set the Solipsis icon in the frame iconSolipsis = ImageManager.getSolipsisIconWxIcon() bitmap = ImageManager.getSolipsisIconWxBitmap() iconSolipsis.CopyFromBitmap(bitmap) self.SetIcon(iconSolipsis) # navigation window self.navig_window = wxWindow(id=wxID_WXMAINFRAMENAVIG_WINDOW, name='navig_window', parent=self, pos=wxPoint(0, 0), size=wxSize(1014, 46), style=0) top = ImageManager.getTopBannerWxBitmap() self.bannerBitmap = wxStaticBitmap(bitmap=top, id=wxID_WXMAINFRAMETOPBANNERBITMAP, name='topBannerBitmap', parent=self.navig_window, pos=wxPoint(0, 0), size=wxSize(1014, 46), style=0) # logo window self.logo_window = wxWindow(id=wxID_WXMAINFRAMELOGO_WINDOW, name='logo_window', parent=self, pos=wxPoint(719, 46), size=wxSize(295, 76), style=0) logo = ImageManager.getSolipsisLogoWxBitmap() self.logoBitmap = wxStaticBitmap(bitmap=logo, id=wxID_WXMAINFRAMELOGOBITMAP, name='logoBitmap', parent=self.logo_window, pos=wxPoint(0, 0), size=wxSize(295, 76), style=0) # 2D view window self.two_d_window = wxWindow(id=wxID_WXMAINFRAMETWO_D_WINDOW, name='two_d_window', parent=self, pos=wxPoint(0, 46), size=wxSize(719, 676), style=0) # application window self.appli_window = wxWindow(id=wxID_WXMAINFRAMEAPPLI_WINDOW, name='appli_window', parent=self, pos=wxPoint(719, 122), size=wxSize(295, 600), style=0) self.transferButton = wxBitm
def OnPaint(self, event): dc = wx.ClientDC(self.two_d_window) # opions for the device context dc.SetBackground( wx.Brush("White",wx.SOLID) ) dc.SetBackgroundMode(wx.TRANSPARENT) dc.SetFont( wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False) ) dc.SetPen( wx.Pen("White",1) ) dc.SetTextForeground("White") dc.SetBrush( wx.Brush("White",wx.TRANSPARENT) ) # draw background picture two_d_bitmap = ImageManager.get2DBackgrounddWxBitmap() dc.DrawBitmap(two_d_bitmap, wx.Point(0,0), True) width = self.two_d_window.GetClientSize().GetWidth() height = self.two_d_window.GetClientSize().GetHeight() # we are not connected, just display a 'not connected' message if not self.navigatorInfo.isConnected(): dc.DrawText('Not connected', wx.Point(width/2, height/2)) else: # display awarness radius dc.DrawCircle(wx.Point(width/2, height/2), width/2) self.displayEntity(dc, self.navigatorInfo.getNode()) print '---' for peer in self.navigatorInfo.enumeratePeers(): print peer.getId() self.displayEntity(dc, peer)
def __init__(self, parent): wx.Panel.__init__(self, parent, -1) [wxID_WXMAINFRAMELOGO_WINDOW, wxID_WXMAINFRAMELOGOBITMAP] = map(lambda _init_ctrls: wx.NewId(), range(2)) self.logo_window = wx.Window( id=wxID_WXMAINFRAMELOGO_WINDOW, name="logo_window", parent=self, pos=wx.Point(0, 0), size=wx.Size(295, 76), style=0, ) logo = ImageManager.getBitmap(ImageManager.IMG_SOLIPSIS_LOGO) self.logoBitmap = wx.StaticBitmap( bitmap=logo, id=wxID_WXMAINFRAMELOGOBITMAP, name="logoBitmap", parent=self.logo_window, pos=wx.Point(0, 0), size=wx.Size(295, 76), style=0, ) button = wx.Button(self, -1, "I do nothing")
def _init_ctrls(self): # frame initialization wx.Frame.__init__(self, id=wxID_WXMAINFRAME, name='wxMainFrame', parent=None, pos=wx.DefaultPosition, size=wx.Size(1024, 768), style=wx.DEFAULT_FRAME_STYLE, title='Solipsis') self._init_utils() self.SetClientSize(wx.Size(1016, 741)) # set the Solipsis icon in the frame iconSolipsis = ImageManager.getIcon(ImageManager.IMG_SOLIPSIS_ICON) bitmap = ImageManager.getBitmap(ImageManager.IMG_SOLIPSIS_ICON) iconSolipsis.CopyFromBitmap(bitmap) self.SetIcon(iconSolipsis) # navigation window self.navig_window = wx.Window(id=wxID_WXMAINFRAMENAVIG_WINDOW, name='navig_window', parent=self, pos=wx.Point(0, 0), size=wx.Size(1014, 46), style=0) top = ImageManager.getBitmap(ImageManager.IMG_TOP_BANNER) self.bannerBitmap = wx.StaticBitmap(bitmap=top, id=wxID_WXMAINFRAMETOPBANNERBITMAP, name='topBannerBitmap', parent=self.navig_window, pos=wx.Point(0, 0), size=wx.Size(1014, 46), style=0) # logo window # 2D view window self.two_d_window = wx.Window(id=wxID_WXMAINFRAMETWO_D_WINDOW, name='two_d_window', parent=self, pos=wx.Point(0, 46), size=wx.Size(719, 676), style=0) # application window self.appli_window = wx.Notebook(id=wxID_WXMAINFRAMEAPPLI_WINDOW, name='appli_window', par
def displayEntity(self, dc, entity): # display pseudo if self.navigatorInfo.arePseudosDisplayed() : pseudoCoordinate = self.getPseudoWindowCoordinate(entity) dc.DrawText(entity.getPseudo(), pseudoCoordinate) # display avatar if self.navigatorInfo.areAvatarsDisplayed() : avatarBitmap = ImageManager.getGreyAvatar() self.posAvatar = self.getWindowCoordinate(entity) dc.DrawBitmap(avatarBitmap, self.posAvatar, True) # display services picto bitmap for service in entity.enumerateServices(): if service.id == Service.ID_CHAT: chatBitmap = ImageManager.getChatPicto() chatCoordinate = self.getServiceWindowCoordinate(entity, Service.ID_CHAT) dc.DrawBitmap(chatBitmap, chatCoordinate, True) elif service.id == Service.ID_AVATAR: avatarPicto = ImageManager.getAvatarPicto() avatarCoordinate = self.getServiceWindowCoordinate(entity, Service.ID_AVATAR) dc.DrawBitmap(avatarPicto, avatarCoordinate, True) elif service.id == Service.ID_FILE_TRANSFER: filePicto = ImageManager.getFilePicto() fileCoordinate = self.getServiceWindowCoordinate(entity, Service.ID_FILE_TRANSFER) dc.DrawBitmap(filePicto, fileCoordinate, True) # unknown service type : display a question mark pictogram else: unknownPicto = ImageManager.getUnknownPicto() unknownCoord = self.getServiceWindowCoordinate(entity, Service.ID_UNKNOWN) dc.DrawBitmap(unknownPicto, unknownCoord, True)
def _init_ctrls(self): # frame initialization wx.Frame.__init__(self, id=wxID_WXMAINFRAME, name='wxMainFrame', parent=None, pos=wx.Point(0, 0), size=wx.Size(1024, 768), style=wx.DEFAULT_FRAME_STYLE & ~ (wx.RESIZE_BORDER | wx.RESIZE_BOX | wx.MAXIMIZE_BOX), title='Solipsis') self._init_utils() self.SetClientSize(wx.Size(1016, 741)) # set the Solipsis icon in the frame iconSolipsis = ImageManager.getSolipsisIconWxIcon() bitmap = ImageManager.getSolipsisIconWxBitmap() iconSolipsis.CopyFromBitmap(bitmap) self.SetIcon(iconSolipsis) # navigation window self.navig_window = wx.Window(id=wxID_WXMAINFRAMENAVIG_WINDOW, name='navig_window', parent=self, pos=wx.Point(0, 0), size=wx.Size(1014, 46), style=0) top = ImageManager.getTopBannerWxBitmap() self.bannerBitmap = wx.StaticBitmap(bitmap=top, id=wxID_WXMAINFRAMETOPBANNERBITMAP, name='topBannerBitmap', parent=self.navig_window, pos=wx.Point(0, 0), size=wx.Size(1014, 46), style=0) # logo window self.logo_window = wx.Window(id=wxID_WXMAINFRAMELOGO_WINDOW, name='logo_window', parent=self, pos=wx.Point(719, 46), size=wx.Size(295, 76), style=0) logo = ImageManager.getSolipsisLogoWxBitmap() self.logoBitmap = wx.StaticBitmap(bitmap=logo, id=wxID_WXMAINFRAMELOGOBITMAP, name='logoBitmap', parent=self.logo_window, pos=wx.Point(0, 0), size=wx.Size(295, 76), style=0) # 2D view window self.two_d_window = wx.Window(id=wxID_WXMAINFRAMETWO_D_WINDOW, name='two_d_window', parent=self, pos=wx.Point(0, 46), size=wx.Size(719, 676), style=0) # application window self.appli_window = wx.Window(id=wxID_WXMAINFRAMEAPPLI_WINDOW, name='appli_window', parent=self, pos=wx.Point(719, 122), size=wx.Size(295, 600), style=0) self.transferButton = wx.BitmapButton(bitmap= ImageManager.getBlueTransferWxBitmap(), id=wxID_WXMAINFRAMETRANSFERBUTTON, name='transferButton', parent=self.navig_window, pos=wx.Point(812, 9), size=wx.Size(100, 31), style=0, validator=wx.DefaultValidator) self.chatButton = wx.BitmapButton(bitmap=ImageManager.getRedChatWxBitmap(), id=wxID_WXMAINFRAMECHATBUTTON, name='chatButton', parent=self.navig_window, pos=wx.Point(912, 9), size=wx.Size(100, 31), style=wx.BU_AUTODRAW, validator=wx.DefaultValidator) self.chattersListBox = wx.ListBox(choices=[], id=wxID_WXMAINFRAMECHATTERSLISTBOX, name='chattersList', parent=self.appli_window, pos=wx.Point(6, 30), size=wx.Size(279,135), style=wx.NO_BORDER|wx.LB_ALWAYS_SB, validator=wx.DefaultValidator) self.chatTextCtrl = wx.TextCtrl(id=wxID_WXMAINFRAMECHATTEXTCTRL, name='chatTextCtrl',parent=self.appli_window, pos=wx.Point(6, 201), size=wx.Size(279, 233), style=wx.NO_BORDER|wx.TE_MULTILINE|wx.TE_READONLY, value='') self.messageTextCtrl = wx.TextCtrl(id=wxID_WXMAINFRAMEMESSAGETEXTCTRL, name='messageTextCtrl', parent=self.appli_window, pos=wx.Point(6, 460),size=wx.Size(279, 115), style=wx.NO_BORDER|wx.TE_MULTILINE,value='') sendBitmap =ImageManager.getBlueSendWxBitmap() self.sendMessageButton = wx.BitmapButton(bitmap=sendBitmap, id=wxID_WXMAINFRAMESENDMESSAGEBUTTON, name='sendMessageButton', parent=self.appli_window, pos=wx.Point(190, 441), size=wx.Size(81, 17), validator=wx.DefaultValidator)
def OnPaint(self, event): dc = wx.ClientDC(self) background = ImageManager.getBitmap(ImageManager.IMG_CHAT) dc.DrawBitmap(background, 0, self.logoHeight, True)
def _init_ctrls(self): # frame initialization wx.Frame.__init__(self, id=wxID_WXMAINFRAME, name='wxMainFrame', parent=None, pos=wx.DefaultPosition, size=wx.Size(1024, 768), style=wx.DEFAULT_FRAME_STYLE, title='Solipsis') self._init_utils() self.SetClientSize(wx.Size(1016, 741)) # set the Solipsis icon in the frame iconSolipsis = ImageManager.getIcon(ImageManager.IMG_SOLIPSIS_ICON) bitmap = ImageManager.getBitmap(ImageManager.IMG_SOLIPSIS_ICON) iconSolipsis.CopyFromBitmap(bitmap) self.SetIcon(iconSolipsis) # navigation window self.navig_window = wx.Window(id=wxID_WXMAINFRAMENAVIG_WINDOW, name='navig_window', parent=self, pos=wx.Point(0, 0), size=wx.Size(1014, 46), style=0) top = ImageManager.getBitmap(ImageManager.IMG_TOP_BANNER) self.bannerBitmap = wx.StaticBitmap(bitmap=top, id=wxID_WXMAINFRAMETOPBANNERBITMAP, name='topBannerBitmap', parent=self.navig_window, pos=wx.Point(0, 0), size=wx.Size(1014, 46), style=0) # logo window # 2D view window self.two_d_window = wx.Window(id=wxID_WXMAINFRAMETWO_D_WINDOW, name='two_d_window', parent=self, pos=wx.Point(0, 46), size=wx.Size(719, 676), style=0) # application window self.appli_window = wx.Notebook(id=wxID_WXMAINFRAMEAPPLI_WINDOW, name='appli_window', parent=self, pos=wx.Point(719, 0), size=wx.Size(295, 722), style=0) #imgList = wx.ImageList(100,31) #imgList.Add(ImageManager.getRedChatWxBitmap()) #imgList.Add(ImageManager.getBlueTransferWxBitmap()) #imgList = wx.ImageList(80,30) #imgList.Add(ImageManager.getSmallBlueChatWxBitmap()) #imgList.Add(ImageManager.getSmallRedTransferWxBitmap()) imgList = wx.ImageList(16,16) imgList.Add(ImageManager.getBitmap(ImageManager.IMG_SOLIPSIS_ICON)) imgList.Add(ImageManager.getBitmap(ImageManager.IMG_SOLIPSIS_ICON)) self.appli_window.SetImageList(imgList) self.wxChat = WxChat(self.appli_window) import solipsis.navigator.filetransfer self.wxFileTransfer = solipsis.navigator.filetransfer.WxFileTransfer(self.appli_window) self.appli_window.AddPage(self.wxChat, 'chat', imageId=0) self.appli_window.AddPage(self.wxFileTransfer, 'transfer', imageId=1)