def __init__(self, parent, sceneManager):
        Scene.__init__(self, parent, sceneManager)

        # when populating a cegui list, must keep the references, otherwise segfault
        self.servers = []

        login = helpers.loadWindowLayout("login.layout")
        self.guiSystem.getGUISheet().addChildWindow(login)
        self.windows.append(login)
        self.login = login

        # key states
        self.tab_down = False
        self.enter_down = False

        wm = cegui.WindowManager.getSingleton()
        wm.getWindow("Login/SaveDetails").setSelected(settings.save_details)
        if settings.user_name != None:
            wm.getWindow("Login/Username").setText(settings.user_name)
        if settings.password != None:
            wm.getWindow("Login/Password").setText(settings.password)
        if settings.previous_game != None:
            self.setServer(settings.previous_game)

        helpers.bindButtonEvent("Login/LoginButton", self, "onConnect")
        helpers.bindButtonEvent("Login/QuitButton", self, "quit")
        helpers.bindButtonEvent("Login/ConfigButton", self, "onConfig")
        helpers.bindEvent("Login/SaveDetails", self, "onSaveDetails",
                          cegui.Checkbox.EventCheckStateChanged)

        helpers.bindButtonEvent("Message/OkButton", self, "onMessageOk")

        self.hide()
	def __init__(self, parent, sceneManager):
		Scene.__init__(self, parent, sceneManager)

		# when populating a cegui list, must keep the references, otherwise segfault
		self.servers = []

		login = helpers.loadWindowLayout("login.layout")
		self.guiSystem.getGUISheet().addChildWindow(login)
		self.windows.append(login)
		self.login = login

		# key states
		self.tab_down = False
		self.enter_down = False

		wm = cegui.WindowManager.getSingleton()
		wm.getWindow("Login/SaveDetails").setSelected(settings.save_details)
		if settings.user_name != None:
			wm.getWindow("Login/Username").setText(settings.user_name)
		if settings.password != None:
			wm.getWindow("Login/Password").setText(settings.password)
		if settings.previous_game != None:
			self.setServer(settings.previous_game)

		helpers.bindButtonEvent("Login/LoginButton", self, "onConnect")
		helpers.bindButtonEvent("Login/QuitButton", self, "quit")
		helpers.bindButtonEvent("Login/ConfigButton", self, "onConfig")
		helpers.bindEvent("Login/SaveDetails", self, "onSaveDetails", cegui.Checkbox.EventCheckStateChanged)

		helpers.bindButtonEvent("Message/OkButton", self, "onMessageOk")

		self.hide()
Esempio n. 3
0
	def __init__(self, window):
		self.config = helpers.loadWindowLayout("config.layout")
		window.addChildWindow(self.config)
		helpers.bindButtonEvent("Config/OK", self, "onConfigSave")
		helpers.bindButtonEvent("Config/Cancel", self, "onConfigCancel")
		helpers.bindButtonEvent("Config/Sound", self, "onSound")
		helpers.bindButtonEvent("Config/Graphics", self, "onGraphics")
		helpers.bindEvent("Config", self, "onConfigCancel", cegui.FrameWindow.EventCloseClicked)
		helpers.bindEvent("Config/Zoom", self, "onZoomChange", cegui.Slider.EventValueChanged)
		helpers.bindEvent("Config/ShowFps", self, "onShowFpsChange", cegui.Checkbox.EventCheckStateChanged)

		helpers.bindEvent("Sound", self, "onSoundCancel", cegui.FrameWindow.EventCloseClicked)
		helpers.bindButtonEvent("Sound/Cancel", self, "onSoundCancel")
		helpers.bindButtonEvent("Sound/OK", self, "onSoundSave")

		helpers.bindEvent("Graphics", self, "onGraphicsCancel", cegui.FrameWindow.EventCloseClicked)
		helpers.bindButtonEvent("Graphics/Cancel", self, "onGraphicsCancel")
		helpers.bindButtonEvent("Graphics/OK", self, "onGraphicsSave")

		helpers.toggleWindow("Config").activate()
		wm = cegui.WindowManager.getSingleton()
		wm.getWindow("Config/Zoom").currentValue = settings.icon_zoom_switch_level
		wm.getWindow("Config/ZoomSpeed").setMaxValue(self.max_zoom_speed)
		wm.getWindow("Config/ZoomSpeed").currentValue = settings.zoom_speed - 1
		wm.getWindow("Config/StarsVisible").setSelected(settings.show_stars_during_icon_view)
		wm.getWindow("Config/ShowFps").setSelected(settings.show_fps)
		wm.getWindow("Config/ShowIntro").setSelected(settings.show_intro)

		helpers.toggleWindow("Config", True)
		helpers.toggleWindow("Sound", False)
		helpers.toggleWindow("Graphics", False)
Esempio n. 4
0
	def __init__(self, parent):
		self.parent = parent
		if self.base != "":
			helpers.bindEvent(self.base, self, "closeClicked", cegui.FrameWindow.EventCloseClicked)

		if self.toggle_button != "":
			helpers.bindButtonEvent(self.toggle_button, self, "windowToggle")
	def createGui(self):
		system = helpers.loadWindowLayout("system.layout")
		self.guiSystem.getGUISheet().addChildWindow(system)
		self.windows = [system]
		self.system = system

		helpers.bindButtonEvent("TopBar/MenuButton", self, "toggleMainMenu")
		helpers.bindButtonEvent("Windows/EndTurnButton", self, "requestEOT")
		helpers.bindEvent("Navigation/ZoomIn", self.starmap, "zoomIn", cegui.Window.EventMouseButtonDown)
		helpers.bindEvent("Navigation/ZoomOut", self.starmap, "zoomOut", cegui.Window.EventMouseButtonDown)
		helpers.bindEvent("Navigation/Deselect", self, "unselect", cegui.Window.EventMouseButtonDown)
		helpers.bindEvent("Navigation/Center", self, "focus", cegui.Window.EventMouseButtonDown)
		helpers.bindEvent("Navigation/Autofit", self.starmap, "autofit", cegui.Window.EventMouseButtonDown)

		self.message_window = gui.MessageWindow(self)
		self.design_window = gui.DesignsWindow(self)
		self.info_window = gui.InformationWindow(self)
		self.system_window = gui.SystemWindow(self)
		self.orders_window = gui.OrdersWindow(self)
		self.sub_windows = [
			self.message_window,
			self.design_window,
			self.info_window,
			self.system_window,
			self.orders_window,
			]

		wm = cegui.WindowManager.getSingleton()
		self.orders_menu = overlay.RadialMenu(self.camera)
		wm.getWindow("Starmap").addChildWindow(self.orders_menu.menu)

		self.information_overlay = overlay.InformationOverlay()
		wm.getWindow("Starmap").addChildWindow(self.information_overlay.overlay)
Esempio n. 6
0
	def bindChildren(self, name, base):
		window = self.wm.getWindow(name)
		num_children = window.getChildCount()
		for i in range(num_children):
			child = window.getChildAtIdx(i)
			child_name = child.getName().c_str()
			self.child_map[child_name] = base
			helpers.bindEvent(child_name, self, "show", cegui.Window.EventMouseEnters)
			helpers.bindEvent(child_name, self, "hide", cegui.Window.EventMouseLeaves)
			self.bindChildren(child_name, base)
	def add(self, caption, parent, handler):
		wm = cegui.WindowManager.getSingleton()
		index = len(self.buttons)
		button = wm.createWindow("SleekSpace/Button", "%s/Button%i" % (self.window_name, index))
		button.size = cegui.UVector2(cegui.UDim(0.5, 0), cegui.UDim(0.2, 0))
		button.text = caption
		button.setProperty("ClippedByParent", "False")
		self.menu.addChildWindow(button)
		self.buttons.append(button)
		self.arrange()
		helpers.bindEvent("%s/Button%i" % (self.window_name, index), parent, handler, cegui.PushButton.EventClicked)
Esempio n. 8
0
	def __init__(self, parent):
		Window.__init__(self, parent)
		self.clear()

		# store as [ListboxTextItem : design_id] pairs
		helpers.bindEvent("Designs/DesignList", self, "selectDesign", cegui.Listbox.EventSelectionChanged)

		current_design = cegui.WindowManager.getSingleton().getWindow("Designs/CurrentDesign")
		current_design.addColumn("#", 0, cegui.UDim(0.3, 0))
		current_design.addColumn("Component", 1, cegui.UDim(0.5, 0))
		current_design.setSelectionMode(cegui.MultiColumnList.RowSingle)
Esempio n. 9
0
	def addArgument(self, caption, argument):
		"""Add an argument widget to the argument window

		argument parameter is one of the predefined TP arguments e.g. list, string, etc

		"""
		wm = cegui.WindowManager.getSingleton()
		index = len(self.arguments)
		parent = wm.getWindow("Arguments/Pane")

		try:
			base_name = ARG_GUI_MAP[argument]
		except KeyError:
			print "Unsupported argument"
			return None

		base = wm.getWindow("Arguments/%s" % base_name)
		widget = helpers.copyWindow(base, "Argument%i" % index)

		prefix = (index, base_name)
		caption_widget = wm.getWindow("Argument%i/%s/Caption" % prefix)
		caption_widget.text = caption.capitalize()
		parent.addChildWindow(widget)

		if argument is ARG_LIST:
			self.arguments_pending_update.append((ARG_LIST, widget, caption))
			list_widget = wm.getWindow("Argument%i/%s/Listbox" % prefix)
			list_widget.addColumn("#", 0, cegui.UDim(0.3, 0))
			list_widget.addColumn("Type", 1, cegui.UDim(0.5, 0))
			list_widget.setSelectionMode(cegui.MultiColumnList.RowSingle)
			helpers.bindEvent("Argument%i/%s/Add" % prefix, self, "addItemToList", cegui.PushButton.EventClicked)
		if argument is ARG_OBJECT:
			# populate the listbox with universe items
			list_widget = wm.getWindow("Argument%i/%s/Object" % prefix)
			for id, obj in self.parent.objects.items():
				item = cegui.ListboxTextItem("%s (%i)" % (obj.name, id))
				#print item.text
				item.setAutoDeleted(False)
				if prefix in self.object_list:
					self.object_list[prefix].append(item)
				else:
					self.object_list[prefix] = [item]
				list_widget.addItem(item)

		# push the new widget down so it doesn't overlap
		offset_x = cegui.UDim(0, 0)
		offset_y = cegui.UDim(0, 0)
		for arg_widget in self.arguments:
			offset_y += arg_widget.position.d_y + arg_widget.height
		widget.position += cegui.UVector2(offset_x, offset_y)
		self.arguments.append(widget)

		return widget
Esempio n. 10
0
 def add(self, caption, parent, handler):
     wm = cegui.WindowManager.getSingleton()
     index = len(self.buttons)
     button = wm.createWindow("SleekSpace/Button",
                              "%s/Button%i" % (self.window_name, index))
     button.size = cegui.UVector2(cegui.UDim(0.5, 0), cegui.UDim(0.2, 0))
     button.text = caption
     button.setProperty("ClippedByParent", "False")
     self.menu.addChildWindow(button)
     self.buttons.append(button)
     self.arrange()
     helpers.bindEvent("%s/Button%i" % (self.window_name, index), parent,
                       handler, cegui.PushButton.EventClicked)
Esempio n. 11
0
	def registerElement(self, element, min_alpha=0.01, fadeout_time=1.0, fadein_time=1.0):
		window = self.wm.getWindow(element)
		cur_alpha = window.getAlpha()
		self.elements[element] = {'min_alpha':min_alpha,
							'max_alpha':cur_alpha,
							'cur_alpha':cur_alpha,
							'alpha_step_in':(cur_alpha-min_alpha)/fadein_time,
							'alpha_step_out':(cur_alpha-min_alpha)/fadeout_time,
							'active':True,
							'direction':'out',
							'event':True}
		helpers.bindEvent(element, self, "show", cegui.Window.EventMouseEnters)
		helpers.bindEvent(element, self, "hide", cegui.Window.EventMouseLeaves)
		self.bindChildren(element, element)
Esempio n. 12
0
	def __init__(self, parent):
		Window.__init__(self, parent)
		self.clear()

		helpers.bindEvent("Messages/Next", self, "nextMessage", cegui.PushButton.EventClicked)
		helpers.bindEvent("Messages/Prev", self, "prevMessage", cegui.PushButton.EventClicked)
		helpers.bindEvent("Messages/Goto", self, "gotoMessageSubject", cegui.PushButton.EventClicked)
		helpers.bindEvent("Messages/Delete", self, "deleteMessage", cegui.PushButton.EventClicked)
		helpers.bindEvent("Messages/MessageList", self, "selectMessage", cegui.MultiColumnList.EventSelectionChanged)

		wm = cegui.WindowManager.getSingleton()
		message_list = wm.getWindow("Messages/MessageList")
		message_list.addColumn("Subject", 0, cegui.UDim(0.7, 0))
		message_list.addColumn("Turn", 1, cegui.UDim(0.1, 0))
		message_list.setSelectionMode(cegui.MultiColumnList.RowSingle)
		self.message_list = message_list
    def createGui(self):
        system = helpers.loadWindowLayout("system.layout")
        self.guiSystem.getGUISheet().addChildWindow(system)
        self.windows = [system]
        self.system = system

        helpers.bindButtonEvent("TopBar/MenuButton", self, "toggleMainMenu")
        helpers.bindButtonEvent("Windows/EndTurnButton", self, "requestEOT")
        helpers.bindEvent("Navigation/ZoomIn", self.starmap, "zoomIn",
                          cegui.Window.EventMouseButtonDown)
        helpers.bindEvent("Navigation/ZoomOut", self.starmap, "zoomOut",
                          cegui.Window.EventMouseButtonDown)
        helpers.bindEvent("Navigation/Deselect", self, "unselect",
                          cegui.Window.EventMouseButtonDown)
        helpers.bindEvent("Navigation/Center", self, "focus",
                          cegui.Window.EventMouseButtonDown)
        helpers.bindEvent("Navigation/Autofit", self.starmap, "autofit",
                          cegui.Window.EventMouseButtonDown)

        self.message_window = gui.MessageWindow(self)
        self.design_window = gui.DesignsWindow(self)
        self.info_window = gui.InformationWindow(self)
        self.system_window = gui.SystemWindow(self)
        self.orders_window = gui.OrdersWindow(self)
        self.sub_windows = [
            self.message_window,
            self.design_window,
            self.info_window,
            self.system_window,
            self.orders_window,
        ]

        wm = cegui.WindowManager.getSingleton()
        self.orders_menu = overlay.RadialMenu(self.camera)
        wm.getWindow("Starmap").addChildWindow(self.orders_menu.menu)

        self.information_overlay = overlay.InformationOverlay()
        wm.getWindow("Starmap").addChildWindow(
            self.information_overlay.overlay)
Esempio n. 14
0
	def __init__(self, parent):
		Window.__init__(self, parent)
		self.clear()

		helpers.bindEvent("Orders/Delete", self, "deleteOrder", cegui.PushButton.EventClicked)
		helpers.bindEvent("Orders/NewOrder", self, "newOrder", cegui.PushButton.EventClicked)
		helpers.bindEvent("Orders/Edit", self, "editOrder", cegui.PushButton.EventClicked)

		wm = cegui.WindowManager.getSingleton()
		order_queue = wm.getWindow("Orders/OrderQueue")
		order_queue.addColumn("Type", 0, cegui.UDim(0.4, 0))
		order_queue.addColumn("Turns left", 1, cegui.UDim(0.4, 0))
		order_queue.setSelectionMode(cegui.MultiColumnList.RowSingle)

		self.arguments_window = ArgumentsWindow(parent)
		self.update_order = None
		self.update_id = None
Esempio n. 15
0
	def __init__(self, parent):
		self.arguments = []
		self.arguments_pending_update = []
		self.parent = parent
		self.id = None
		self.order_subtype = None
		self.order_node = None

		self.selection_list = {}
		self.listbox_queue = {}
		self.update_list = {}
		self.attributes = {}
		self.object_list = {}

		helpers.bindEvent("Arguments", self, "hide", cegui.FrameWindow.EventCloseClicked)
		helpers.bindEvent("Arguments/Cancel", self, "hide", cegui.PushButton.EventClicked)
		helpers.bindEvent("Arguments/Save", self, "confirm", cegui.PushButton.EventClicked)
		for win in ['Turns', 'Position', 'List', 'Objects', 'String']:
			helpers.toggleWindow("Arguments/%s" % win, False)
		self.hide()
    def _createScene(self):
        """Setup CEGUI and create the various scenes"""
        # Initialise CEGUI Renderer
        self.guiRenderer = cegui.OgreCEGUIRenderer(
            self.renderWindow, ogre.RENDER_QUEUE_OVERLAY, True, 0, self.sceneManager
        )
        self.guiSystem = cegui.System(self.guiRenderer)
        cegui.Logger.getSingleton().loggingLevel = cegui.Insane

        # Load Cegui Scheme
        cegui.ImagesetManager.getSingleton().createImageset("controls.imageset")
        cegui.SchemeManager.getSingleton().loadScheme("SleekSpace.scheme")
        self.guiSystem.setDefaultMouseCursor("SleekSpace", "MouseArrow")

        wmgr = cegui.WindowManager.getSingleton()
        root = helpers.loadWindowLayout("battleviewer.layout")
        self.guiSystem.setGUISheet(root)

        # Bind events to their respective buttons and set up other misc GUI stuff
        self.gfl = GUIFadeListener()
        ogre_root = ogre.Root.getSingleton()
        ogre_root.addFrameListener(self.gfl)
        helpers.bindEvent("Controls/Next", self, "next_round", cegui.Window.EventMouseButtonDown)
        helpers.bindEvent("Controls/Prev", self, "prev_round", cegui.Window.EventMouseButtonDown)
        helpers.bindEvent("Controls/Beginning", self, "beginning_round", cegui.Window.EventMouseButtonDown)
        helpers.bindEvent("Controls/End", self, "end_round", cegui.Window.EventMouseButtonDown)
        helpers.bindEvent("Controls/Stop", self, "stop_prog", cegui.Window.EventMouseButtonDown)
        helpers.bindEvent("Controls/Play", self, "start_prog", cegui.Window.EventMouseButtonDown)
        self.gfl.registerElement("Controls")
        self.gfl.registerElement("Logs", 0.01, 3)

        self.battlescene = BattleScene(self, self.sceneManager).initial(self.battle.sides)
        self.rounds = self.battle.rounds

        self.queue_round()

        self.roundtimer = ogre.Timer()

        self.changeScene(self.battlescene)

        self.guiSystem.injectMousePosition(0, 0)
Esempio n. 17
0
	def __init__(self, parent):
		Window.__init__(self, parent)
		self.clear()
		helpers.bindEvent("System/SystemList", self, "systemSelected", cegui.Listbox.EventSelectionChanged)
		helpers.bindEvent("System/SystemList", self, "systemSelected", cegui.Window.EventMouseDoubleClick)
		helpers.bindEvent("System/SystemFilter", self, "filterSystems", cegui.Editbox.EventTextChanged)
    def _createScene(self):
        """Setup CEGUI and create the various scenes"""
        # Initialise CEGUI Renderer
        self.guiRenderer = cegui.OgreCEGUIRenderer(self.renderWindow,
                                                   ogre.RENDER_QUEUE_OVERLAY,
                                                   True, 0, self.sceneManager)
        self.guiSystem = cegui.System(self.guiRenderer)
        cegui.Logger.getSingleton().loggingLevel = cegui.Insane

        # Load Cegui Scheme
        cegui.ImagesetManager.getSingleton().createImageset(
            "controls.imageset")
        cegui.SchemeManager.getSingleton().loadScheme("SleekSpace.scheme")
        self.guiSystem.setDefaultMouseCursor("SleekSpace", "MouseArrow")

        wmgr = cegui.WindowManager.getSingleton()
        root = helpers.loadWindowLayout("battleviewer.layout")
        self.guiSystem.setGUISheet(root)

        # Bind events to their respective buttons and set up other misc GUI stuff
        self.gfl = GUIFadeListener()
        ogre_root = ogre.Root.getSingleton()
        ogre_root.addFrameListener(self.gfl)
        helpers.bindEvent("Controls/Next", self, "next_round",
                          cegui.Window.EventMouseButtonDown)
        helpers.bindEvent("Controls/Prev", self, "prev_round",
                          cegui.Window.EventMouseButtonDown)
        helpers.bindEvent("Controls/Beginning", self, "beginning_round",
                          cegui.Window.EventMouseButtonDown)
        helpers.bindEvent("Controls/End", self, "end_round",
                          cegui.Window.EventMouseButtonDown)
        helpers.bindEvent("Controls/Stop", self, "stop_prog",
                          cegui.Window.EventMouseButtonDown)
        helpers.bindEvent("Controls/Play", self, "start_prog",
                          cegui.Window.EventMouseButtonDown)
        self.gfl.registerElement("Controls")
        self.gfl.registerElement("Logs", 0.01, 3)

        self.battlescene = BattleScene(self, self.sceneManager).initial(
            self.battle.sides)
        self.rounds = self.battle.rounds

        self.queue_round()

        self.roundtimer = ogre.Timer()

        self.changeScene(self.battlescene)

        self.guiSystem.injectMousePosition(0, 0)