def __init__(self, parent): wxScrolledPanel.__init__(self, parent, -1) self.parent = parent self.notebookWin = CreatorNotebook(self) self.notebookWin.SetSelection(0) EVT_CLOSE(self.parent, self._onClose) titleSzr = wxBoxSizer(wxHORIZONTAL) self.isDirtyLbl = boldLabel("", self, wxALIGN_LEFT) titleSzr.Add(self.isDirtyLbl, 1, wxLEFT, border=5) self.nameLbl = boldLabel("", self, wxALIGN_RIGHT) titleSzr.Add(self.nameLbl, 1, wxRIGHT, border=5) mainSzr = wxBoxSizer(wxVERTICAL) mainSzr.Add((0, 5)) mainSzr.Add(titleSzr, 0, wxEXPAND) mainSzr.Add(self.notebookWin, 1, wxEXPAND|wxLEFT|wxRIGHT, border=5) self.addButtons(mainSzr) mainSzr.Fit(self) self.SetSizer(mainSzr) self.SetupScrolling() self.SetAutoLayout(1) self.Layout()
def __init__(self, parent, id, c): wxScrolledPanel.__init__(self, parent, id, style=wx.TAB_TRAVERSAL) self.SetBackgroundColour(wx.WHITE) self._widgets = {} self._heartbeats = heartbeat.HeartBeatDict() sizer = wx.BoxSizer(wx.VERTICAL) for endpoint in c['endpoints']: roomwidget = control.RoomWidget(self, -1, endpoint[1], endpoint[0], c['endpoint_port'], c['wait']) sizer.Add(roomwidget, 0, wx.ALIGN_RIGHT | wx.ALL, 3) self._widgets[endpoint[0]] = roomwidget self._heartbeats[endpoint[0]] = 0 #initialize last_access_time to #long time ago self.SetSizer(sizer) self.SetAutoLayout(True) #self.SetScrollRate(5, 5) for wx.ScrolledWindow self.SetupScrolling(rate_x=5, rate_y=5) self.SetSize(self.GetBestSize()) self._recorder_thread = heartbeat.Recorder(self._heartbeats.update, c['hb_listening_port']) self._guiupdate_thread = GuiUpdate(c['inactive_time_length'], self._heartbeats, self._widgets) self._recorder_thread.start() self._guiupdate_thread.start()
def __init__(self, parent, numTeams, teamSize): wxScrolledPanel.__init__(self, parent, -1) # Build participant grid self.participantGrid = [] self.parent = parent vertSzr = wxBoxSizer(wxVERTICAL) from gui.jowstgui import makeBold for row in range(numTeams): self.participantGrid.append([]) rowSzr = wxBoxSizer(wxHORIZONTAL) lbl = makeBold(wxStaticText(self, -1, "#%d" % (row + 1), size=(30, -1), style=wxST_NO_AUTORESIZE)) rowSzr.Add(lbl, 0, wxLEFT, border=5) for col in range(teamSize): entry = wxTextCtrl(self, -1, size=(200, -1), style=wxTE_READONLY) entry.pos = (row, col) EVT_SET_FOCUS(entry, self.setSelection) self.participantGrid[-1].append(entry) rowSzr.Add(entry, 0, wxRIGHT, border=10) vertSzr.Add(rowSzr) self.currSelection = None self._doSetSelection(self.participantGrid[0][0]) vertSzr.Fit(self) self.SetSizer(vertSzr) self.SetAutoLayout(1) self.SetupScrolling() self.Layout() self.Show(1)