Example #1
0
    def __init__(self, parent, msg, caption, label=""):
        wxDialog.__init__(self, parent, -1, caption)
        szr = wxBoxSizer(wxVERTICAL)
        if label:
            from gui.jowstgui import makeBold

            szr.Add(makeBold(wxStaticText(self, -1, label)), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, border=10)
        szr.Add(
            wxTextCtrl(self, -1, msg, style=wxTE_MULTILINE | wxTE_READONLY, size=(320, 240)),
            1,
            wxALL | wxEXPAND,
            border=10,
        )

        hszr = wxBoxSizer(wxHORIZONTAL)
        hszr.Add(wxButton(self, wxID_OK, "OK"))
        hszr.Add((10, 0))
        hszr.Add(wxButton(self, wxID_CANCEL, "Cancel"))
        szr.Add(hszr, 0, wxALIGN_CENTER | wxALL, border=5)

        szr.Fit(self)
        self.SetSizer(szr)
        self.SetAutoLayout(1)
        self.Layout()
        self.Center()
Example #2
0
    def addLabel(self, labelstr, name=None, bold=0, center=0):
        lbl = wxStaticText(self, -1, labelstr)
        if bold:
            from gui.jowstgui import makeBold

            lbl = makeBold(lbl)
        if name:
            setattr(self, name, lbl)
        if center:
            center = wxALIGN_CENTER

        self.szr.Add(lbl, 0, wxALL | center, border=5)
Example #3
0
    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)
Example #4
0
    def __init__(self, parent, tourney):
        self.tourney = tourney
        roundstr = self.tourney.getRoundString()
        matchstrings = self.tourney.getMatchStrings()
        from gui.jowstgui import makeBold
        self.parent = parent
        wxPanel.__init__(self, parent, -1, size=(-1, -1))
        hSzr = wxBoxSizer(wxHORIZONTAL)
        szr = wxBoxSizer(wxVERTICAL)
        if roundstr in ["Quarterfinals", "Semifinals", "Finals"]:
            roundstr = "the %s" % roundstr
            
        szr.Add(makeBold(wxStaticText(self, -1,
                                      "Matches remaining in %s" % roundstr)),
                0,
                wxALIGN_CENTER)
        szr.Add((0, 10))
        szr.Add(wxStaticText(self, -1, "Select match:"), 0, wxALIGN_CENTER)

        self.matchSelect = wxListBox(self, -1, choices=matchstrings,
                                     style=wxLB_SINGLE)
        EVT_LISTBOX(self, self.matchSelect.GetId(), self._onSelection)
        szr.Add(self.matchSelect, 0, wxALIGN_CENTER)

        self.cpuControlled = wxCheckBox(self, -1,
                                        "Wrestlers are CPU controlled")
        EVT_CHECKBOX(self, self.cpuControlled.GetId(), self._setInteractive)
            
        szr.Add(self.cpuControlled, 1, wxALL, border=20)
        hSzr.Add(szr, 0, wxALL, border=20)

        setupObj = Interface.MatchSetup()
        suSzr = wxBoxSizer(wxVERTICAL)
        self.matchSetup = matchSetup.MatchSetupDialog(setupObj,
                                                      panel_parent=self)
        
        self.matchSetup.buildMatchControlGUI()
        self.matchSetup.disableAddDeleteButtons()
        self._setSelectedTeams()
        self.matchSetup.enableWidgetEvents()
        self.matchSetup.enableWidgets()

        # Tourney match preferences will be set after the first match
        if self.tourney.hasPrefs():
            self.matchSetup.setPrefs(self.tourney.matchPrefs)
        else:
            self.tourney.setPrefs(prefs.MatchPrefs())
            
        if not self.tourney.isInteractive():
            self.cpuControlled.SetValue(1)
            self._setInteractive()

        if self.tourney.isSemiFinalOrFinal():
            self.tourney.matchPrefs["DQ_ENABLED"] = 0
            self.tourney.matchPrefs["TIME_LIMIT"] = NO_TIME_LIMIT
            self.matchSetup.setPrefs(self.tourney.matchPrefs)
            self.matchSetup.disableWidgets(["dqEnabled", "timeLimitEntry",
                                            "noTimeLimitChkbox"])
            
        
        suSzr.Add(self.matchSetup, 1, wxEXPAND)
        hSzr.Add(suSzr, 5, wxEXPAND)                
        
        hSzr.Fit(self)
        self.SetSizer(hSzr)
        self.SetAutoLayout(1)
        self.Layout()
        self.Fit()
Example #5
0
    def __init__(self, parent, tourney_data, match_start_cb, close_cb):
        from gui.jowstgui import makeBold
        self.tourney = tourney_data
        self.parent = parent
        self.startCB = match_start_cb
        self.closeCB = close_cb
        self.tourneyFile = None
        self.runningMatch = 0
        
        wxPanel.__init__(self, parent, -1, size=(-1, -1))

        self._buildMenu()
        self.statusBar = wxStatusBar(self.parent, -1)
        self.parent.SetStatusBar(self.statusBar)
        
        szr = wxBoxSizer(wxVERTICAL)
        lbl = wxStaticText(self, -1, self.tourney.getTourneyName())
        lblfont = lbl.GetFont()
        lblfont.SetPointSize(18)
        lbl.SetFont(lblfont)
        szr.Add(makeBold(lbl), 0, wxALIGN_CENTER)
        self.nbWin = wxNotebook(self, -1, style=wxNB_TOP)
        self.nbWin.parent = self
        from gui import brackets
        currRnd = self.tourney.currentRound
        rounds = self.tourney.getTourneyRounds()
        table = self.tourney.getTourneyTable()
        tourneyName = self.tourney.getTourneyName()
        self.bracketPage = brackets.BracketPageBuilder(rounds, table, currRnd,
                                                       tourneyName)
        
        import wx
        import wx.html
        import wx.lib.wxpTag
        self.html = wx.html.HtmlWindow(self.nbWin, -1)
        self.html.SetPage(self.bracketPage.getHTML())

        if not self.tourney.isFinished():
            self.lbMatchSelect = MatchSelectPanel(self.nbWin, self.tourney)
            self.nbWin.AddPage(self.lbMatchSelect, "Matches", 1)
        else:
            self.enableMenuItems((("FileMenu", ["Export Bracket...",
                                                "Print Bracket..."]),))
            self.closeCB()
            
        self.nbWin.AddPage(self.html, "Brackets")
        self.guiBuilding = 1

        szr.Add(self.nbWin, 1, wxEXPAND)

        if not self.tourney.isFinished():
            self.startButton = wxButton(self, -1, "Start Match")
            EVT_BUTTON(self, self.startButton.GetId(), self._startMatch)
            szr.Add(self.startButton, 0, wxALIGN_CENTER)
        
        EVT_NOTEBOOK_PAGE_CHANGED(self.nbWin, self.nbWin.GetId(),
                                  self._onPageChange)
        EVT_CLOSE(self.parent, self.Destroy)
        
        self.SetAutoLayout(True)
        szr.Fit(self)
        self.SetSizer(szr)
        self.Layout()
        self.Fit()
        self.Center()
        self.guiBuilding = 0