def connectHandlers(self):

		# Inherited connections.
		MenuStandard.connectHandlers(self)

		# Specific connections.
		self.btnPractice.subscribeEvent(PyCEGUI.PushButton.EventClicked, self, "onPracticeButtonClicked")
		self.btnQuickRace.subscribeEvent(PyCEGUI.PushButton.EventClicked, self, "onQuickRaceButtonClicked")
		self.btnSingleEvent.subscribeEvent(PyCEGUI.PushButton.EventClicked, self, "onSingleEventButtonClicked")
Exemplo n.º 2
0
	def connectHandlers(self):

		# Inherited connections.
		MenuStandard.connectHandlers(self)

		# Specific connections.
		self.btnBack.subscribeEvent(PyCEGUI.PushButton.EventClicked, self, "onBackButtonClicked")
		self.btnStart.subscribeEvent(PyCEGUI.PushButton.EventClicked, self, "onStartButtonClicked")
		self.treCars.subscribeEvent(PyCEGUI.Tree.EventSelectionChanged, self, "onTreeSelectionChanged")
Exemplo n.º 3
0
	def connectHandlers(self):

		# Inherited connections.
		MenuStandard.connectHandlers(self)

		# Specific connections.
		self.btnBack.subscribeEvent(PyCEGUI.PushButton.EventClicked, self, "onBackButtonClicked")
		self.btnNext.subscribeEvent(PyCEGUI.PushButton.EventClicked, self, "onNextButtonClicked")
		
		self.cbxCat.subscribeEvent(PyCEGUI.Combobox.EventListSelectionAccepted, self, "onCatChanged")
		self.cbxTrack.subscribeEvent(PyCEGUI.Combobox.EventListSelectionAccepted, self, "onTrackChanged")
Exemplo n.º 4
0
    def connectHandlers(self):

        # Inherited connections.
        MenuStandard.connectHandlers(self)

        # Specific connections.
        self.btnBack.subscribeEvent(PyCEGUI.PushButton.EventClicked, self,
                                    "onBackButtonClicked")
        self.btnStart.subscribeEvent(PyCEGUI.PushButton.EventClicked, self,
                                     "onStartButtonClicked")
        self.treCars.subscribeEvent(PyCEGUI.Tree.EventSelectionChanged, self,
                                    "onTreeSelectionChanged")
Exemplo n.º 5
0
    def connectHandlers(self):

        # Inherited connections.
        MenuStandard.connectHandlers(self)

        # Specific connections.
        self.btnPractice.subscribeEvent(PyCEGUI.PushButton.EventClicked, self,
                                        "onPracticeButtonClicked")
        self.btnQuickRace.subscribeEvent(PyCEGUI.PushButton.EventClicked, self,
                                         "onQuickRaceButtonClicked")
        self.btnSingleEvent.subscribeEvent(PyCEGUI.PushButton.EventClicked,
                                           self, "onSingleEventButtonClicked")
Exemplo n.º 6
0
    def connectHandlers(self):

        # Inherited connections.
        MenuStandard.connectHandlers(self)

        # Specific connections.
        self.window.subscribeEvent(PyCEGUI.Window.EventSized, self,
                                   "onWindowSized")
        self.btnBack.subscribeEvent(PyCEGUI.PushButton.EventClicked, self,
                                    "onBackButtonClicked")
        self.btnNext.subscribeEvent(PyCEGUI.PushButton.EventClicked, self,
                                    "onNextButtonClicked")

        self.cbxCat.subscribeEvent(PyCEGUI.Combobox.EventListSelectionAccepted,
                                   self, "onCatChanged")
        self.cbxTrack.subscribeEvent(
            PyCEGUI.Combobox.EventListSelectionAccepted, self,
            "onTrackChanged")
Exemplo n.º 7
0
	def initialize(self):

		name = "MenuCarSelect"

		# No code written for this menu : use mandatory layout.
		window = MenuStandard.initialize(self, name=name, title="Select a car", layout="menucarselect")

		# Retrieve the window descendants created here.
		self.btnBack = window.getChild(name + "/BtnBack")
		self.btnStart = window.getChild(name + "/BtnStart")
		self.prbTopSpd = window.getChild(name + "/PrbTopSpeed")
		self.prbAccel = window.getChild(name + "/PrbAcceleration")
		self.prbCorner = window.getChild(name + "/PrbCornering")
		self.treCars = window.getChild(name + "/TreCars")
		self.imgPreview = window.getChild(name + "/ImgCarPreview")

		# Complete widget initialization.
		self.treCars.initialise()
		self.lstTreeItems = []
		self.dictTreeItemID2Car = {}
		
		treeItemId = 0
		rootTreeItem = PyCEGUI.TreeItem("Cars", item_id=treeItemId)
		treeItemId += 1
		rootTreeItem.setSelectionBrushImage("CEGUIDemo", "TreeSelectionBrush")
		rootTreeItem.setFont("MenuNormal")
		rootTreeItem.toggleIsOpen()
		self.treCars.addItem(rootTreeItem)
		self.lstTreeItems.append(rootTreeItem) # Avoid its being GC'd at return !

		for cat in self.Cars:
			catTreeItem = PyCEGUI.TreeItem(cat, item_id=treeItemId)
			treeItemId += 1
			catTreeItem.setSelectionBrushImage("CEGUIDemo", "TreeSelectionBrush")
			catTreeItem.setFont("MenuNormal")
			catTreeItem.toggleIsOpen()
			rootTreeItem.addItem(catTreeItem)
			self.lstTreeItems.append(catTreeItem) # Avoid its being GC'd at return !
			for car in self.Cars[cat].values():
				carTreeItem = PyCEGUI.TreeItem(car.name, item_id=treeItemId)
				treeItemId += 1
				carTreeItem.setSelectionBrushImage("CEGUIDemo", "TreeSelectionBrush")
				carTreeItem.setFont("MenuNormal")
				carTreeItem.toggleIsOpen()
				catTreeItem.addItem(carTreeItem)
				self.lstTreeItems.append(carTreeItem) # Avoid its being GC'd at return !
				self.dictTreeItemID2Car[carTreeItem.getID()] = car
				for name, file in car.skins.items():
					skinTreeItem = PyCEGUI.TreeItem(name, item_id=treeItemId)
					treeItemId += 1
					skinTreeItem.setSelectionBrushImage("CEGUIDemo", "TreeSelectionBrush")
					skinTreeItem.setFont("MenuMedium")
					carTreeItem.addItem(skinTreeItem)
					self.lstTreeItems.append(skinTreeItem) # Avoid its being GC'd at return !
					self.dictTreeItemID2Car[skinTreeItem.getID()] = car

		return window
Exemplo n.º 8
0
    def initialize(self):

        name = "MenuTrackSelect"

        # No code written for this menu : use mandatory layout.
        window = MenuStandard.initialize(self,
                                         name=name,
                                         title="Select a track",
                                         layout="menutrackselect")

        # Retrieve the window descendants created here.
        self.btnBack = window.getChild(name + "/BtnBack")
        self.btnNext = window.getChild(name + "/BtnNext")
        self.cbxCat = window.getChild(name + "/CbxCategory")
        self.cbxTrack = window.getChild(name + "/CbxTrack")
        self.txtDesc = window.getChild(name + "/TxtDesc")
        self.txtLength = window.getChild(name + "/TxtLength")
        self.txtWidth = window.getChild(name + "/TxtWidth")
        self.txtNPits = window.getChild(name + "/TxtNbPits")
        self.txtAuthors = window.getChild(name + "/TxtAuthors")
        self.imgOutline = window.getChild(name + "/ImgOutline")

        # Complete widget initialization.
        self.cbxCatItems = []
        for cat in self.Tracks:
            cbxItem = PyCEGUI.ListboxTextItem(cat)
            cbxItem.setSelectionBrushImage("CEGUIDemo",
                                           "ComboboxSelectionBrush")
            cbxItem.setSelectionColours(0xFF3FFFEE)
            self.cbxCat.addItem(cbxItem)
            self.cbxCatItems.append(
                cbxItem)  # Avoid its being GC'd at return !

        self.cbxCatItems[0].setSelected(True)  # Select first category.
        self.cbxCat.setText(self.cbxCatItems[0].getText())

        self.onCatChanged()  # Initialise track combobox.

        # TODO.

        return window
Exemplo n.º 9
0
	def initialize(self):

		name = "MenuTrackSelect"
		
		# No code written for this menu : use mandatory layout.
		window = MenuStandard.initialize(self, name=name, title="Select a track", layout="menutrackselect")

		# Retrieve the window descendants created here.
		self.btnBack  = window.getChild(name + "/BtnBack")
		self.btnNext  = window.getChild(name + "/BtnNext")
		self.cbxCat   = window.getChild(name + "/CbxCategory")
		self.cbxTrack = window.getChild(name + "/CbxTrack")
		self.txtDesc = window.getChild(name + "/TxtDesc")
		self.txtLength = window.getChild(name + "/TxtLength")
		self.txtWidth = window.getChild(name + "/TxtWidth")
		self.txtNPits = window.getChild(name + "/TxtNbPits")
		self.txtAuthors = window.getChild(name + "/TxtAuthors")
		self.imgOutline = window.getChild(name + "/ImgOutline")

		# Complete widget initialization.
		self.cbxCatItems = []
		for cat in self.Tracks:
			cbxItem = PyCEGUI.ListboxTextItem(cat)
			cbxItem.setSelectionBrushImage("CEGUIDemo", "ComboboxSelectionBrush")
			cbxItem.setSelectionColours(0xFF3FFFEE)
			self.cbxCat.addItem(cbxItem)
			self.cbxCatItems.append(cbxItem) # Avoid its being GC'd at return !
			
		self.cbxCatItems[0].setSelected(True) # Select first category.
		self.cbxCat.setText(self.cbxCatItems[0].getText())
		
		self.onCatChanged() # Initialise track combobox.

		# TODO.

		return window
Exemplo n.º 10
0
	def __init__(self):

		MenuStandard.__init__(self)
Exemplo n.º 11
0
    def initialize(self):

        name = "MenuCarSelect"

        # No code written for this menu : use mandatory layout.
        window = MenuStandard.initialize(self,
                                         name=name,
                                         title="Select a car",
                                         layout="menucarselect")

        # Retrieve the window descendants created here.
        self.btnBack = window.getChild(name + "/BtnBack")
        self.btnStart = window.getChild(name + "/BtnStart")
        self.prbTopSpd = window.getChild(name + "/PrbTopSpeed")
        self.prbAccel = window.getChild(name + "/PrbAcceleration")
        self.prbCorner = window.getChild(name + "/PrbCornering")
        self.treCars = window.getChild(name + "/TreCars")
        self.imgPreview = window.getChild(name + "/ImgCarPreview")

        # Complete widget initialization.
        self.treCars.initialise()
        self.lstTreeItems = []
        self.dictTreeItemID2Car = {}

        treeItemId = 0
        rootTreeItem = PyCEGUI.TreeItem("Cars", item_id=treeItemId)
        treeItemId += 1
        rootTreeItem.setSelectionBrushImage("CEGUIDemo", "TreeSelectionBrush")
        rootTreeItem.setFont("MenuNormal")
        rootTreeItem.toggleIsOpen()
        self.treCars.addItem(rootTreeItem)
        self.lstTreeItems.append(
            rootTreeItem)  # Avoid its being GC'd at return !

        for cat in self.Cars:
            catTreeItem = PyCEGUI.TreeItem(cat, item_id=treeItemId)
            treeItemId += 1
            catTreeItem.setSelectionBrushImage("CEGUIDemo",
                                               "TreeSelectionBrush")
            catTreeItem.setFont("MenuNormal")
            catTreeItem.toggleIsOpen()
            rootTreeItem.addItem(catTreeItem)
            self.lstTreeItems.append(
                catTreeItem)  # Avoid its being GC'd at return !
            for car in self.Cars[cat].values():
                carTreeItem = PyCEGUI.TreeItem(car.name, item_id=treeItemId)
                treeItemId += 1
                carTreeItem.setSelectionBrushImage("CEGUIDemo",
                                                   "TreeSelectionBrush")
                carTreeItem.setFont("MenuNormal")
                carTreeItem.toggleIsOpen()
                catTreeItem.addItem(carTreeItem)
                self.lstTreeItems.append(
                    carTreeItem)  # Avoid its being GC'd at return !
                self.dictTreeItemID2Car[carTreeItem.getID()] = car
                for name, file in car.skins.items():
                    skinTreeItem = PyCEGUI.TreeItem(name, item_id=treeItemId)
                    treeItemId += 1
                    skinTreeItem.setSelectionBrushImage(
                        "CEGUIDemo", "TreeSelectionBrush")
                    skinTreeItem.setFont("MenuMedium")
                    carTreeItem.addItem(skinTreeItem)
                    self.lstTreeItems.append(
                        skinTreeItem)  # Avoid its being GC'd at return !
                    self.dictTreeItemID2Car[skinTreeItem.getID()] = car

        return window
Exemplo n.º 12
0
    def __init__(self):

        MenuStandard.__init__(self)
Exemplo n.º 13
0
    def initialize(self):

        name = "MenuMain"

        # Use layout if specified.
        if TheConfig.useLayouts:

            window = MenuStandard.initialize(self,
                                             name=name,
                                             title="Welcome",
                                             layout="menumain")

        else:

            # If no layout specified, go on building up the menu through code.
            window = MenuStandard.initialize(self,
                                             name=name,
                                             title="Welcome",
                                             background="SplashMain")

            # Specific to this menu.
            btnPractice = PyCEGUI.WindowManager.getSingleton().createWindow(
                "CEGUIDemo/MainButton", name + "/BtnPractice")
            btnPractice.setText("Practice")
            btnPractice.setTooltipText(
                "A free practice session for one player on one track")
            btnPractice.setXPosition(PyCEGUI.UDim(0.22, 0.0))
            btnPractice.setYPosition(PyCEGUI.UDim(0.3, 0.0))
            btnPractice.setWidth(PyCEGUI.UDim(0.6, 0.0))
            btnPractice.setHeight(PyCEGUI.UDim(0.07, 0.0))
            btnPractice.setProperty("Font", "MenuBig")

            window.addChildWindow(btnPractice)

            btnQuickRace = PyCEGUI.WindowManager.getSingleton().createWindow(
                "CEGUIDemo/MainButton", name + "/BtnQuickRace")
            btnQuickRace.setText("QuickRace")
            btnQuickRace.setTooltipText(
                "A race on one track, with no qualifying session")
            btnQuickRace.setXPosition(PyCEGUI.UDim(0.22, 0.0))
            btnQuickRace.setYPosition(PyCEGUI.UDim(0.37, 0.0))
            btnQuickRace.setWidth(PyCEGUI.UDim(0.6, 0.0))
            btnQuickRace.setHeight(PyCEGUI.UDim(0.07, 0.0))
            btnQuickRace.setProperty("Font", "MenuBig")

            window.addChildWindow(btnQuickRace)

            btnSingleEvent = PyCEGUI.WindowManager.getSingleton().createWindow(
                "CEGUIDemo/MainButton", name + "/BtnSingleEvent")
            btnSingleEvent.setText("SingleEvent")
            btnSingleEvent.setTooltipText(
                "A race on one track, with various qualifying schemes")
            btnSingleEvent.setXPosition(PyCEGUI.UDim(0.22, 0.0))
            btnSingleEvent.setYPosition(PyCEGUI.UDim(0.44, 0.0))
            btnSingleEvent.setWidth(PyCEGUI.UDim(0.6, 0.0))
            btnSingleEvent.setHeight(PyCEGUI.UDim(0.07, 0.0))
            btnSingleEvent.setProperty("Font", "MenuBig")
            #btnSingleEvent.setEnabled(False)

            window.addChildWindow(btnSingleEvent)

            cbxSingleEvent = PyCEGUI.WindowManager.getSingleton().createWindow(
                "CEGUIDemo/Combobox", name + "/CbxSingleEvent.SubType")
            cbxSingleEvent.setTooltipText(
                "Select the type of single event race")
            cbxSingleEvent.setXPosition(PyCEGUI.UDim(0.40, 0.0))
            cbxSingleEvent.setYPosition(PyCEGUI.UDim(0.50, 0.0))
            cbxSingleEvent.setWidth(PyCEGUI.UDim(0.42, 0.0))
            cbxSingleEvent.setHeight(PyCEGUI.UDim(0.16, 0.0))
            cbxSingleEvent.setProperty("Font", "MenuMedium")

            window.addChildWindow(cbxSingleEvent)

        # Retrieve the window descendants created here.
        self.btnPractice = window.getChild(name + "/BtnPractice")
        self.btnQuickRace = window.getChild(name + "/BtnQuickRace")
        self.btnSingleEvent = window.getChild(name + "/BtnSingleEvent")
        self.cbxSingleEvent = window.getChild(name + "/CbxSingleEvent.SubType")

        # Complete widget initialization (whatever creation mode : code or .layout).
        self.lstItemsSingleEvent = []
        for subType in ("Endurance", "Challenge", "1936 Grand Prix",
                        "LS1 Challenge"):
            cbxItem = PyCEGUI.ListboxTextItem(subType)
            cbxItem.setSelectionBrushImage("CEGUIDemo",
                                           "ComboboxSelectionBrush")
            cbxItem.setSelectionColours(0xFF3FFFEE)
            self.cbxSingleEvent.addItem(cbxItem)
            self.lstItemsSingleEvent.append(
                cbxItem)  # Avoid its being GC'd at return !

        itemCbx = self.cbxSingleEvent.findItemWithText(
            "Challenge", None)  # Get the "Challenge" item
        itemCbx.setSelected(True)  # Select this item
        self.cbxSingleEvent.setText(
            itemCbx.getText())  # Copy the item's text into the Editbox

        return window
Exemplo n.º 14
0
	def initialize(self):

		name = "MenuMain"

		# Use layout if specified.
		if TheConfig.useLayouts:
			
			window = MenuStandard.initialize(self, name=name, title="Welcome", layout="menumain")
			
		else:
			
			# If no layout specified, go on building up the menu through code.
			window = MenuStandard.initialize(self, name=name, title="Welcome", background="SplashMain")

			# Specific to this menu.
			btnPractice = PyCEGUI.WindowManager.getSingleton().createWindow("CEGUIDemo/MainButton", name + "/BtnPractice")
			btnPractice.setText("Practice")
			btnPractice.setTooltipText("A free practice session for one player on one track")
			btnPractice.setXPosition(PyCEGUI.UDim(0.22, 0.0))
			btnPractice.setYPosition(PyCEGUI.UDim(0.3, 0.0))
			btnPractice.setWidth(PyCEGUI.UDim(0.6, 0.0))
			btnPractice.setHeight(PyCEGUI.UDim(0.07, 0.0))
			btnPractice.setProperty("Font", "MenuBig")

			window.addChildWindow(btnPractice)

			btnQuickRace = PyCEGUI.WindowManager.getSingleton().createWindow("CEGUIDemo/MainButton", name + "/BtnQuickRace")
			btnQuickRace.setText("QuickRace")
			btnQuickRace.setTooltipText("A race on one track, with no qualifying session")
			btnQuickRace.setXPosition(PyCEGUI.UDim(0.22, 0.0))
			btnQuickRace.setYPosition(PyCEGUI.UDim(0.37, 0.0))
			btnQuickRace.setWidth(PyCEGUI.UDim(0.6, 0.0))
			btnQuickRace.setHeight(PyCEGUI.UDim(0.07, 0.0))
			btnQuickRace.setProperty("Font", "MenuBig")

			window.addChildWindow(btnQuickRace)

			btnSingleEvent = PyCEGUI.WindowManager.getSingleton().createWindow("CEGUIDemo/MainButton", name + "/BtnSingleEvent")
			btnSingleEvent.setText("SingleEvent")
			btnSingleEvent.setTooltipText("A race on one track, with various qualifying schemes")
			btnSingleEvent.setXPosition(PyCEGUI.UDim(0.22, 0.0))
			btnSingleEvent.setYPosition(PyCEGUI.UDim(0.44, 0.0))
			btnSingleEvent.setWidth(PyCEGUI.UDim(0.6, 0.0))
			btnSingleEvent.setHeight(PyCEGUI.UDim(0.07, 0.0))
			btnSingleEvent.setProperty("Font", "MenuBig")
			#btnSingleEvent.setEnabled(False)

			window.addChildWindow(btnSingleEvent)

			cbxSingleEvent = PyCEGUI.WindowManager.getSingleton().createWindow("CEGUIDemo/Combobox", name + "/CbxSingleEvent.SubType")
			cbxSingleEvent.setTooltipText("Select the type of single event race")
			cbxSingleEvent.setXPosition(PyCEGUI.UDim(0.40, 0.0))
			cbxSingleEvent.setYPosition(PyCEGUI.UDim(0.50, 0.0))
			cbxSingleEvent.setWidth(PyCEGUI.UDim(0.42, 0.0))
			cbxSingleEvent.setHeight(PyCEGUI.UDim(0.16, 0.0))
			cbxSingleEvent.setProperty("Font", "MenuMedium")

			window.addChildWindow(cbxSingleEvent)

		# Retrieve the window descendants created here.
		self.btnPractice = window.getChild(name + "/BtnPractice")
		self.btnQuickRace = window.getChild(name + "/BtnQuickRace")
		self.btnSingleEvent = window.getChild(name + "/BtnSingleEvent")
		self.cbxSingleEvent = window.getChild(name + "/CbxSingleEvent.SubType")

		# Complete widget initialization (whatever creation mode : code or .layout).
		self.lstItemsSingleEvent = []
		for subType in ("Endurance", "Challenge", "1936 Grand Prix", "LS1 Challenge"):
			cbxItem = PyCEGUI.ListboxTextItem(subType)
			cbxItem.setSelectionBrushImage("CEGUIDemo", "ComboboxSelectionBrush")
			cbxItem.setSelectionColours(0xFF3FFFEE)
			self.cbxSingleEvent.addItem(cbxItem)
			self.lstItemsSingleEvent.append(cbxItem) # Avoid its being GC'd at return !

		itemCbx = self.cbxSingleEvent.findItemWithText("Challenge", None) # Get the "Challenge" item
		itemCbx.setSelected(True) # Select this item
		self.cbxSingleEvent.setText(itemCbx.getText()) # Copy the item's text into the Editbox

		return window