当前位置: 首页>>代码示例>>Python>>正文


Python Menu.initialize方法代码示例

本文整理汇总了Python中menu.Menu.initialize方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.initialize方法的具体用法?Python Menu.initialize怎么用?Python Menu.initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在menu.Menu的用法示例。


在下文中一共展示了Menu.initialize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initialize

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import initialize [as 别名]
	def initialize(self):

		name = "MenuLoading"

		# No code written for this menu : use mandatory layout.
		window = Menu.initialize(self, name=name, title="Loading", layout="menuloading")
			
		# Retrieve window descendants created here.
		self.prbProgress = window.getChild(name + "/PrbProgress")
		self.scpMessages = window.getChild(name + "/ScpMessages")
		
		# Complete widget initialization.

		return window
开发者ID:Donald-Otto,项目名称:SpeedDreamsForkProject,代码行数:16,代码来源:menuloading.py

示例2: initialize

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import initialize [as 别名]
	def initialize(self):

		name = "MenuProfiles"

		# No code written for this menu : use mandatory layout.
		window = Menu.initialize(self, name=name, title="Profiles", layout="menuprofiles")
			
		# Retrieve window descendants created here.
		self.btnAccept = window.getChild(name + "/BtnAccept")
		self.btnCancel = window.getChild(name + "/BtnCancel")
		self.edxName = window.getChild(name + "/EdxName")
		self.cbxSkill = window.getChild(name + "/CbxSkill")
		self.lbxProfiles = window.getChild(name + "/LbxProfiles")
		self.btnAdd = window.getChild(name + "/BtnAdd")
		self.btnRemove = window.getChild(name + "/BtnRemove")
		
		# Complete widget initialization.
		self.cbxSkillItems = []
		for skill in ("Rookie", "Amateur", "Semi-pro", "Pro"):
			cbxItem = PyCEGUI.ListboxTextItem(skill)
			cbxItem.setSelectionBrushImage("CEGUIDemo", "ComboboxSelectionBrush")
			cbxItem.setSelectionColours(0xFF3FFFEE)
			self.cbxSkill.addItem(cbxItem)
			self.cbxSkillItems.append(cbxItem) # Avoid its being GC'd at return !
			if skill.startswith("Rookie"):
				self.cbxSkill.setText(cbxItem.getText())

		#self.lbProfItems = []
		self.lbItemId = 0
		for name in ("Mike", "Horst", "Paolo", "Albert", "Yuuki", "Bjorn",
					 "Jane", "Henri", "Francesca", "Joao", "Klaus"):
			# Obsolete Listbox use case.
			#lbItem = PyCEGUI.ListboxTextItem(name, auto_delete=False)
			#lbItem.setSelectionBrushImage("CEGUIDemo", "ListboxSelectionBrush")
			#lbItem.setSelectionColours(0xFF3FFFEE)
			#lbItem.setSelectionBrushImage("CEGUIDemo", "ListboxSelectionBrush")
			#lbItem.setSelectionColours(0xFF3FFFEE)
			#self.lbProfItems.append(lbItem) # Avoid its being GC'd at return !

			lbItem = PyCEGUI.WindowManager.getSingleton().createWindow("CEGUIDemo/ListboxItem", "profile_%d" % self.lbItemId)
			self.lbItemId += 1
			lbItem.setText(name)
			self.lbxProfiles.addItem(lbItem)

		return window
开发者ID:rongzhou,项目名称:speed-dreams,代码行数:47,代码来源:menuprofiles.py

示例3: initialize

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import initialize [as 别名]
	def initialize(self):

		name = "MenuResults"

		# No code written for this menu : use mandatory layout.
		window = Menu.initialize(self, name=name, title="Results", layout="menuresults")
		
		# Retrieve window descendants created here.
		self.mclTable = window.getChild(name + "/MclTable")
		self.btnContinue = window.getChild(name + "/BtnContinue")
		
		# Complete widget initialization (whatever creation mode : code or .layout).
		self.mclTable.addColumn("Rk", self.CIdRank, PyCEGUI.UDim(0.05, 0))
		self.mclTable.addColumn("Adv", self.CIdAdvance, PyCEGUI.UDim(0.05, 0))
		self.mclTable.addColumn("Driver", self.CIdDriver, PyCEGUI.UDim(0.18, 0))
		self.mclTable.addColumn("Robot", self.CIdRobot, PyCEGUI.UDim(0.10, 0))
		self.mclTable.addColumn("Car", self.CIdCar, PyCEGUI.UDim(0.17, 0))
		self.mclTable.addColumn("Time", self.CIdTime, PyCEGUI.UDim(0.12, 0))
		self.mclTable.addColumn("Best", self.CIdBestLap, PyCEGUI.UDim(0.10, 0))
		self.mclTable.addColumn("Laps", self.CIdNLaps, PyCEGUI.UDim(0.05, 0))
		self.mclTable.addColumn("Top spd", self.CIdTopSpeed, PyCEGUI.UDim(0.05, 0))
		self.mclTable.addColumn("Damages", self.CIdDamages, PyCEGUI.UDim(0.05, 0))
		self.mclTable.addColumn("Pits", self.CIdNPits, PyCEGUI.UDim(0.05, 0))

		# Note: Keep a reference to each listbox item,
		# otherwise they get garbage collected at the end of this function,
		# and then CEGUI crashes of course (see below : self.mclItems.append).
		self.mclItems = []
		for row in self.Results:
			rowId = self.mclTable.addRow()
			colId = 0
			for col in row:
				mclItem = PyCEGUI.ListboxTextItem(unicode(col))
				if colId == self.CIdAdvance:
					if col > 0:
						mclItem.setTextColours(PyCEGUI.colour(0xFFFFE000))
					elif col < 0:
						mclItem.setTextColours(PyCEGUI.colour(0xFFA0A0A0))
				self.mclTable.setItem(mclItem, colId, rowId)
				colId += 1
				self.mclItems.append(mclItem)

		return window
开发者ID:Donald-Otto,项目名称:SpeedDreamsForkProject,代码行数:45,代码来源:menuresults.py

示例4: initialize

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import initialize [as 别名]
	def initialize(self):

		name = "MenuCredits"

		# No code written for this menu : use mandatory layout.
		window = Menu.initialize(self, name=name, title="Credits", layout="menucredits")

		# Retrieve window descendants created till there.
		self.tacCred = window.getChild(name + "/TacCredits")
		self.btnBack = window.getChild(name + "/BtnBack")
		
		# Ehrrrr ... well, not much ...
		winMgr = PyCEGUI.WindowManager.getSingleton()
		tabInd = 0
		self.mclTables = []
		for tabText in ("Development Team", "Contributors",
						"Third party libs and tools", "Pre-fork contributors (TORCS)"):
			tabPane = winMgr.createWindow("CEGUIDemo/TabContentPane",
										  name + "/TapCredits%d" % tabInd)
			self.tacCred.addTab(tabPane)
			tabPane.setText(tabText)
			tabPane.setXPosition(PyCEGUI.UDim(0, 0))
			tabPane.setYPosition(PyCEGUI.UDim(0, 0))
			tabPane.setWidth(PyCEGUI.UDim(1, 0))
			tabPane.setHeight(PyCEGUI.UDim(1, 0))
			mclTable = winMgr.createWindow("CEGUIDemo/MultiColumnList",
										   name + "/MclTable%d" % tabInd)
			tabPane.addChildWindow(mclTable)
			mclTable.setXPosition(PyCEGUI.UDim(0, 0))
			mclTable.setYPosition(PyCEGUI.UDim(0, 0))
			mclTable.setWidth(PyCEGUI.UDim(1, 0))
			mclTable.setHeight(PyCEGUI.UDim(1, 0))
			mclTable.setProperty("Font", "TextSmall")
			mclTable.setProperty("ColumnsMovable", "False")
			mclTable.setProperty("ColumnsSizable", "True")
			mclTable.setProperty("SortSettingEnabled", "False")
			mclTable.addColumn("Name / Role", 0, PyCEGUI.UDim(0.35, 0))
			mclTable.addColumn("Main contributions / Contact", 1, PyCEGUI.UDim(0.65, 0))
			self.mclTables.append(mclTable)

			tabInd += 1

		# Retrieve window descendants created here.
		self.tacCred = window.getChild(name + "/TacCredits")
		self.btnBack = window.getChild(name + "/BtnBack")
		
		# Complete widget initialization.
		# TODO.
		# Note: Keep a reference to each listbox item,
		# otherwise they get garbage collected at the end of this function,
		# and then CEGUI crashes of course (see below : self.lbItems.append).
		self.lbItems = []
		for tabInd in range(len(self.mclTables)):
			for i in range(8):

				rowId = self.mclTables[tabInd].addRow()

				lbItem = PyCEGUI.ListboxTextItem("my name")
				self.mclTables[tabInd].setItem(lbItem, 0, rowId)
				self.lbItems.append(lbItem)

				lbItem = PyCEGUI.ListboxTextItem("my role")
				self.mclTables[tabInd].setItem(lbItem, 1, rowId)
				self.lbItems.append(lbItem)

				rowId = self.mclTables[tabInd].addRow()

				lbItem = PyCEGUI.ListboxTextItem("my contribs")
				self.mclTables[tabInd].setItem(lbItem, 0, rowId)
				self.lbItems.append(lbItem)

				lbItem = PyCEGUI.ListboxTextItem("my web site")
				self.mclTables[tabInd].setItem(lbItem, 1, rowId)
				self.lbItems.append(lbItem)

		return window
开发者ID:Donald-Otto,项目名称:SpeedDreamsForkProject,代码行数:78,代码来源:menucredits.py

示例5: initialize

# 需要导入模块: from menu import Menu [as 别名]
# 或者: from menu.Menu import initialize [as 别名]
	def initialize(self, name, title=None, layout=None, background=None):

		# Standard initialization.
		window = Menu.initialize(self, name=name, title=title, layout=layout, background=background)

		# If no layout specified, go on building up the menu through code.
		if not layout:

			# Specific to these menus.
			btnCredits = PyCEGUI.WindowManager.getSingleton().createWindow("CEGUIDemo/Button", name + "/BtnCredits")
			btnCredits.setText("Credits")
			btnCredits.setTooltipText("Thanks to all contributors !")
			btnCredits.setXPosition(PyCEGUI.UDim(0.3, 0.0))
			btnCredits.setYPosition(PyCEGUI.UDim(0.0, 0.0))
			btnCredits.setWidth(PyCEGUI.UDim(0.13, 0.0))
			btnCredits.setHeight(PyCEGUI.UDim(0.05, 0.0))
			btnCredits.setProperty("Font", "MenuMedium")

			window.addChildWindow(btnCredits)

			# Specific to these menus.
			btnProfiles = PyCEGUI.WindowManager.getSingleton().createWindow("CEGUIDemo/Button", name + "/BtnProfiles")
			btnProfiles.setText("Profiles")
			btnProfiles.setTooltipText("Configure player input controls / profiles")
			btnProfiles.setXPosition(PyCEGUI.UDim(0.45, 0.0))
			btnProfiles.setYPosition(PyCEGUI.UDim(0.0, 0.0))
			btnProfiles.setWidth(PyCEGUI.UDim(0.13, 0.0))
			btnProfiles.setHeight(PyCEGUI.UDim(0.05, 0.0))
			btnProfiles.setProperty("Font", "MenuMedium")

			window.addChildWindow(btnProfiles)

			# Specific to these menus.
			btnOptions = PyCEGUI.WindowManager.getSingleton().createWindow("CEGUIDemo/Button", name + "/BtnOptions")
			btnOptions.setText("Options")
			btnOptions.setTooltipText("Settings for display, graphics, simulation ...")
			btnOptions.setXPosition(PyCEGUI.UDim(0.60, 0.0))
			btnOptions.setYPosition(PyCEGUI.UDim(0.0, 0.0))
			btnOptions.setWidth(PyCEGUI.UDim(0.13, 0.0))
			btnOptions.setHeight(PyCEGUI.UDim(0.05, 0.0))
			btnOptions.setProperty("Font", "MenuMedium")

			window.addChildWindow(btnOptions)

			# Specific to these menus.
			btnExit = PyCEGUI.WindowManager.getSingleton().createWindow("CEGUIDemo/Button", name + "/BtnExit")
			btnExit.setText("Exit")
			btnExit.setTooltipText("Exit from the game")
			btnExit.setXPosition(PyCEGUI.UDim(0.75, 0.0))
			btnExit.setYPosition(PyCEGUI.UDim(0.0, 0.0))
			btnExit.setWidth(PyCEGUI.UDim(0.13, 0.0))
			btnExit.setHeight(PyCEGUI.UDim(0.05, 0.0))
			btnExit.setProperty("Font", "MenuMedium")

			window.addChildWindow(btnExit)

		# Retrieve the root window children created here.
		self.btnCredits = window.getChild(name + "/BtnCredits")
		self.btnProfiles = window.getChild(name + "/BtnProfiles")
		self.btnOptions = window.getChild(name + "/BtnOptions")
		self.btnExit = window.getChild(name + "/BtnExit")

		return window
开发者ID:Donald-Otto,项目名称:SpeedDreamsForkProject,代码行数:65,代码来源:menustandard.py


注:本文中的menu.Menu.initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。