コード例 #1
0
ファイル: MainFrame.py プロジェクト: only-a-ptr/ror-toolkit
def startApp(MainApp):
		
		rorSettings().stopOnExceptions = False
		myFrame = MainFrame(None, -1, "") 
		MainApp.SetTopWindow(myFrame)

		rorSettings().rorDebug = False
		
	
#		if rorSettings().rorDebug:
#			myFrame.SetDimensions(0,0,1900,1000)
#			myFrame.lastFilenameUsed = "C:\Documents and Settings\Administrador\Mis documentos\Rigs of Rods\terrains\TERRENO1\Terreno1.terrn"
		myFrame.SetFocus()			
		myFrame.Show() 
		log().info("starting MainFrame.MainLoop")
		autoMap = rorSettings().getSetting(TOOLKIT, "autoopen")
		if autoMap != "":
			myFrame.openTerrain(autoMap)
			if bool(rorSettings().getSetting(TOOLKIT, "autoopeniszip")) == False:
				myFrame.lastFilenameUsed = autoMap
		else:
			# Open Tree window and update toolbar button state
			myFrame.ObjectTree.Show(True)
			idx = list_has_value(myFrame.tbbuttons, 'label', 'Tree')
			if idx != -1:
				item = myFrame.terraintoolbar.FindTool(myFrame.tbbuttons[idx]['id'])._tbItem.Toggle()
			else: print "idx not found"
				
		log().debug('starting rendering loop')
#		getOgreManager().startRendering()
		MainApp.MainLoop() 
コード例 #2
0
ファイル: MainFrame.py プロジェクト: only-a-ptr/ror-toolkit
		def OnStartRoRClick(self,
							   doc=" "):
			if self.terrainOgreWin:
				if self.terrainOgreWin.terrain:
#					self.Preview.clear()
					self.OnSaveTerrain(None)
					log().info(" ************** STARTING ROR **************")
					self.ToggleRenderAll()
					
					truck = rorSettings().getSetting(TOOLKIT, "usetruck")
					#RORBUG: launching RoR with a truck that doesn't have UID, ror doesn't load the truck
					#		 if parameter "-enter" is used, RoR crash
					if truck != "":
						truck = " -truck " + truck
					
					log().info("command line: " + rorSettings().rorFile + " -map " + self.terrainOgreWin.terrain.name + truck)
#					Popen(rorSettings().rorFile + " -map " +  self.terrainOgreWin.terrain.name, 1024, cwd = rorSettings().rorFolder )
					call(rorSettings().rorFile + " -map " + self.terrainOgreWin.terrain.name, 1024, cwd=rorSettings().rorFolder)
					log().info(" ************** ROR FINISHED **************")
					self.ToggleRenderAll()
					sleep(2)#wait a bit
					for x in self.tbbuttons:
						x['window'].restorePosition()
				else:
					log().warning("trying to execute RoR without a loaded terrain")
			else:
				log().warning("trying to execute RoR without created the Ogrewindow")
コード例 #3
0
	def checkValidChars(self, text):
		# we allow mathematic calcs as 3*3, 2.0+10, etc
		try:
			f = eval(text)
		except Exception:
			rorSettings().mainApp.MessageBox('error', "Hey, don't be a bad child and type a valid Float Number")
			raise # keep the bad number at the edit and abort saving the value
		return f		
コード例 #4
0
ファイル: MainFrame.py プロジェクト: only-a-ptr/ror-toolkit
		def OnExit(self, event):
				log().debug("closing MainFrame...")
				self.tbbuttons = []  #dec ref count
#				getOgreManager().ogreRoot.shutdown()
				self.ogreTimer.Stop()
				log().debug("Rendering Timer stopped")
				del self.ogreTimer
				p = self.GetPosition()
				rorSettings().setSetting("MainFrame", "left", p.x)
				rorSettings().setSetting("MainFrame", "top", p.y)
				p = self.GetSize()
				rorSettings().setSetting("MainFrame", "width", p.width)
				rorSettings().setSetting("MainFrame", "height", p.height)
				
				# this event is not triggered for Child windows :F
				if self.truckEditorOgreWin:
					self.truckEditorOgreWin.close() #save settings
				try:
						all_panes = self._mgr.GetAllPanes()
						for ii in xrange(len(all_panes)):
								if not all_panes[ii].IsToolbar():
										all_panes[ii].Hide()			  
						self._mgr.UnInit()
#						del self._mgr
						log().debug("Destroying MainFrame")
						self.Destroy()
#						self.Close()
				except Exception, err:
					log().debug("exception while freeing MainFrame %s" % str(err))
コード例 #5
0
	def __init__(self, parent, **kwargs):
		ShapedWindow.__init__(self, parent, **kwargs)
	   
		self.parent = parent
		self.rordir = rorSettings().rorFolder
			
		grid = self.grid
		grid.SetEmptyCellSize(wx.Size(110, 10))
		r = 1
		c = 1
		self.mainLabel = wx.StaticText(self, -1, "", size=wx.Size(0, 20), style=wx.TRANSPARENT_WINDOW | wx.ST_NO_AUTORESIZE)

		grid.Add(self.mainLabel, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 1))
		r += 1
		self.objectPreviewWindow = ObjectPreviewOgreWindow(self, "PreviewToolwindow", size=wx.Size(150, 150))
		grid.Add(self.objectPreviewWindow, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 2))
		
		self.errorLabel = wx.StaticText(self, -1, " ", size=wx.Size(240, 80))
		self.errorLabel.Wrap(230)
		self.errorLabel.SetForegroundColour(wx.RED)
		self.errorLabel.SetBackgroundColour(self.skinBack)
		r += 1
		grid.Add(self.errorLabel,
				 pos=wx.GBPosition(r, c),
				 span=wx.GBSpan(1, 1))		
		
		self.SetSizerAndFit(grid)
		 

# It works too, but i want the window "minimized"
#		self.SetSize(self.skinSize)
		self.Refresh()
コード例 #6
0
	def __init__(self, parent, ID, size = wx.Size(200,200), **kwargs):
		self.parent = parent
		self.rordir = rorSettings().rorFolder
		self.sceneManager = None
		self.trucktree = None
		self.clearlist = {'entity':[]}
		self.initScene()
		wxOgreWindow.__init__(self, parent, ID, "truckUV", size = size, **kwargs)
コード例 #7
0
	def loadodef(self, filename, uuid):
		try:
			self.mainOdef = odefClass(filename)
		except Exception, err:
			self.mainOdef = None
			log().error("error while processing odef file %s" % filename)
			log().error(str(err))
			if rorSettings().stopOnExceptions:
				raise 
			
			return
コード例 #8
0
	def saveCamera(self, terrnFile=None):
		if self.cameraList and (len(self.cameraList) > 0):
			log().debug("saving %d cameras" % len(self.cameraList))
			if terrnFile is not None:
				barename, self.ext = os.path.splitext(os.path.basename(terrnFile))
				self._file = rorSettings().concatToToolkitHomeFolder(['cameras', '%s.txt' % barename], True)
			output = open(self._file, 'wb')
			if output:
				pickle.dump(self.cameraList, output, 0)
				output.close()
				log().debug("cameras saved to %s" % self._file)
コード例 #9
0
ファイル: MainFrame.py プロジェクト: only-a-ptr/ror-toolkit
		def OnSaveTerrain(self, event=None):
				if self.lastFilenameUsed == "":
					default = ""
					if self.rordir:
							default = rorSettings().rorHomeFolder
					dialog = wx.FileDialog(self, "Save Terrain as", default, "", "Terrain Files (*.terrn)|*.terrn", wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
					if dialog.ShowModal() == wx.ID_OK:
						self.lastFilenameUsed = dialog.GetPath()

				if self.lastFilenameUsed != "":
					self.terrainOgreWin.SaveTerrain(self.lastFilenameUsed)
コード例 #10
0
ファイル: MainFrame.py プロジェクト: only-a-ptr/ror-toolkit
		def ConfigureSkin(self):
			theTheme = rorSettings().getSetting(TOOLKIT, "theme") 
			if theTheme != '':
				try:
					path = os.path.join(rorSettings().toolkitMainFolder, 'media', 'gui', 'skins', theTheme)  
					if os.path.isdir(path):
						cfg = ConfigParser.ConfigParser()
						cfg.read(os.path.join(path, "config.txt"))
						read = (cfg.get('skin', 'SkinBackgroundColor')).split(',')
						theSkinBackColor = wx.Color(int(read[0]), int(read[1]), int(read[2])) #arggggg
						read = cfg.get('skin', 'SkinTransparentColor').split(',')
						theTransparentColor = wx.Color(int(read[0]), int(read[1]), int(read[2])) #arggggg
						del cfg
					ShapedControls.skinBackColor = theSkinBackColor
					ShapedControls.skinTransparentColor = theTransparentColor
					ShapedControls.skinTheme = theTheme
				except:
					ShapedControls.skinTheme = 'RoR theme'
					ShapedControls.skinBackColor = wx.Color(254, 184, 0)
					ShapedControls.skinTransparentColor = wx.Color(0, 0, 0)

					log().error('skin %s is not valid, using default' % theTheme)
			log().debug('using skin %s' % ShapedControls.skinTheme)
コード例 #11
0
	def loadCamera(self, terrnFile):
		self.cameraList = []
		self.list.Set([])
		barename, self.ext = os.path.splitext(os.path.basename(terrnFile))
		self._file = rorSettings().concatToToolkitHomeFolder(['cameras', '%s.txt' % barename], True)
		
		try:
			if os.path.isfile(self._file):
				input = open(self._file, 'rb')
				if input:
					self.cameraList = pickle.load(input)
					input.close()
				log().info("loaded %d camera Bookmarks" % len(self.cameraList))
		except:
			self.cameraList = []
			log().info("cameraBookmark couldn't be loaded")
			
		self.lastcount = len(self.cameraList)
		self.list.Set(self.getValues())
コード例 #12
0
 def __init__(self, parent, name, **kwargs):
     log().debug("ObjectPreviewOgreWindow is initialising...")
     self.rordir = rorSettings().rorFolder
     self.parent = parent
     self.objnode = None
     self.objentity = None
     self.camalpha = 0
     self.radius = 40
     self.dragging = False
     self.mode = None
     self.logovisible = True
     self.wheelRadius = 0
     self.sceneManager = None
     wxOgreWindow.__init__(self, parent, -1, name, **kwargs)
     # bind mouse and keyboard
     self.Bind(wx.EVT_MOUSE_EVENTS, self.onMouseEvent)
     self.Bind(wx.EVT_KEY_DOWN, self.onKeyDown)
     # 		droptarget = TreeDropTarget(self)
     # 		self.SetDropTarget(droptarget)
     log().debug("ObjectPreviewOgreWindow created")
コード例 #13
0
ファイル: OgreManager.py プロジェクト: only-a-ptr/ror-toolkit
	def init(self):
		renderWindows = {}
		#Root creation
		pluginsfile = 'plugins.cfg'
		if sys.platform in ['linux', 'linux2']:
			pluginsfile = 'plugins_linux.cfg'
		elif sys.platform in ['win32']:
			pluginsfile = 'plugins_windows.cfg'

#		self.logMgr = ogre.LogManager()
#		self.currentLog = ogre.LogManager.getSingleton().createLog("ogre.log" , True, False, False)
#		self.myLog = MyLog()
#		self.currentLog.addListener ( self.myLog )
#		ogre.LogManager.getSingleton().setDefaultLog(currentLog)
		plugin = self.getConfigPath(pluginsfile)
		ogrecfg = self.getConfigPath('ogre.cfg')
		logfolder = rorSettings().concatToToolkitHomeFolder(["logs", "Ogre.log"], True)
		self.ogreRoot = ogre.Root(plugin, ogrecfg, logfolder)

		if not self.tryDetectRenderer():
			self.ogreRoot.showConfigDialog()
		self.ogreRoot.initialise(False)
コード例 #14
0
	def __init__(self, parent, title, **kwargs):
		ShapedWindow.__init__(self, parent, title, ** kwargs)
	   
		self.parent = parent
		self.rordir = rorSettings().rorFolder
		self.title = title
		grid = self.grid
		grid.SetEmptyCellSize(wx.Size(110, 3))
		
		# Window padding - sides
		spacer_size = (6,6)
		grid.AddSpacer(spacer_size, (0,0)) # Row 0, Col 0
		grid.AddSpacer(spacer_size, (0,2)) # Row 0, Col 2
		
		r = 1
		c = 1
		self.mainLabel = wx.StaticText(self, -1, "", size=wx.Size(0, 20), style=wx.TRANSPARENT_WINDOW | wx.ST_NO_AUTORESIZE)
		self.mainLabel.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD))
		grid.Add(self.mainLabel, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 3))

		r += 2
		self.transpa = wx.StaticText(self, -1, "Transparency", size=wx.Size(265, 20), style=wx.TRANSPARENT_WINDOW | wx.ST_NO_AUTORESIZE)
		self.transpa.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL))
		grid.Add(self.transpa, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 3))

		r += 1 
		self.ObjTransparencySlider = wx.SpinCtrl(self, ID_ChangeMainMeshTrans, "", wx.DefaultPosition, wx.Size(265, 20), min=0, max=100, initial=60)
		grid.Add(self.ObjTransparencySlider,
				pos=wx.GBPosition(r, c),
				span=wx.GBSpan(1, 4))
		
		r += 1
		c = 1

		self.chkMeshVisible = wx.CheckBox(self, ID_ChangeMainMeshVisibility, "Display Object", wx.DefaultPosition, wx.Size(265, 20))
		grid.Add(self.chkMeshVisible,
				 pos=wx.GBPosition(r, c),
				 span=wx.GBSpan(1, 4))
		
		r += 1
		self.chkBoxNormalVisible = wx.CheckBox(self, ID_ChangeNormalBoxesVisibility, "Display Collision Boxes", wx.DefaultPosition, wx.Size(265, 20))
		grid.Add(self.chkBoxNormalVisible,
				 pos=wx.GBPosition(r, c),
				 span=wx.GBSpan(1, 4))
		
		r += 1
		self.chkBoxVirtualVisible = wx.CheckBox(self, ID_ChangeVirtualBoxesVisibility, "Display Virtual Boxes", wx.DefaultPosition, wx.Size(265, 20))
		self.chkBoxVirtualVisible.SetValue(True)
		grid.Add(self.chkBoxVirtualVisible,
				pos=wx.GBPosition(r, c),
		 		span=wx.GBSpan(1, 4))

		self.Bind(wx.EVT_SPINCTRL, self.OnMainMeshTransChange, id=ID_ChangeMainMeshTrans)
		self.Bind(wx.EVT_CHECKBOX, self.OnMainMeshVisibilityChange, id=ID_ChangeMainMeshVisibility)
		self.Bind(wx.EVT_CHECKBOX, self.OnNormalBoxesVisibilityChange, id=ID_ChangeNormalBoxesVisibility)
		self.Bind(wx.EVT_CHECKBOX, self.OnVirtualBoxesVisibilityChange, id=ID_ChangeVirtualBoxesVisibility)
		
		# Window padding - bottom
		r += 1
		grid.AddSpacer(spacer_size, (r, c))

		self.SetSizerAndFit(grid)
		self.resetControls()
		self.updateSkin()
コード例 #15
0
ファイル: MainFrame.py プロジェクト: only-a-ptr/ror-toolkit
		def __init__(self, parent, id= -1, title="", pos=wx.DefaultPosition,
								 size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE | 
															wx.SUNKEN_BORDER | 
															wx.CLIP_CHILDREN):

				wx.Frame.__init__(self, parent, id, title, pos, size, style)
				log().debug("MainFrame.__init__  started")
				self.lastFilenameUsed = ""
				# tell FrameManager to manage this frame		
				self._mgr = wx.aui.AuiManager()
				self._mgr.SetManagedWindow(self)
				self.SetIcon(wx.Icon('rortoolkit.ico', wx.BITMAP_TYPE_ICO))
				rorSettings().mainApp = self
				self._perspectives = []
				self.n = 0
				self.x = 0

				self.ConfigureSkin()
				# Lepes: move starter here since rorSettings needs a MainApp launched
				# before retrieving paths due wx.StandardPaths module
				import ror.rorcommon		
				if not ror.rorcommon.checkRoRDirectory():
					import ror.starter
					log().debug("First time Toolkit is running.")
					myFrame = ror.starter.startApp(self)
					myFrame.ShowModal()
					log().debug("Starter closed")
				
				if rorSettings().has_section("MainFrame"):
					self.SetDimensions(#int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO)  
										int(rorSettings().getSetting("MainFrame", "left")), \
										int(rorSettings().getSetting("MainFrame", "top")), \
										int(rorSettings().getSetting("MainFrame", "width")), \
										int(rorSettings().getSetting("MainFrame", "height"))\
								)
				else:
					self.SetDimensions(0, 0, 800, 600)
				self.newMyTheme = ArtManager.Get().AddMenuTheme(FM_MyRenderer())
				ArtManager.Get().SetMenuTheme(self.newMyTheme)
				file_menu = FM.FlatMenu()
				#file_menu.Append(ID_OpenTerrain, "Open Terrain")
				file_menu.AppendItem(FM.FlatMenuItem(file_menu, wx.ID_EXIT, "Exit", "", wx.ITEM_NORMAL))
				#view_menu = wx.Menu()

				self.managerInit()
				options_menu = FM.FlatMenu()
				options_menu.AppendItem(FM.FlatMenuItem(options_menu, ID_Settings, "GUI Settings Pane", "", wx.ITEM_NORMAL))
				if rorSettings().rorDebug: options_menu.AppendItem(FM.FlatMenuItem(options_menu, ID_ModTool, "mod Tool Dependences", wx.ITEM_NORMAL))
				if rorSettings().rorDebug: options_menu.AppendItem(FM.FlatMenuItem(options_menu, ID_wxInspector, "wx Widget Inspector", "", wx.ITEM_NORMAL))
				if rorSettings().rorDebug: options_menu.AppendItem(FM.FlatMenuItem(options_menu, ID_hideCaptions, "hide toolbar captions", "", wx.ITEM_NORMAL))
				options_menu.AppendItem(FM.FlatMenuItem(options_menu, ID_selectSkin, "select Skin", "", wx.ITEM_NORMAL))
				
				self._perspectives_menu = FM.FlatMenu()
				self._perspectives_menu.AppendItem(FM.FlatMenuItem(self._perspectives_menu, ID_CreatePerspective, "Create Perspective", "", wx.ITEM_NORMAL))
				#self._perspectives_menu.Append(ID_CopyPerspective, "Copy Perspective Data To Clipboard")
				self._perspectives_menu.AppendSeparator()
				self._perspectives_menu.AppendItem(FM.FlatMenuItem(self._perspectives_menu, ID_FirstPerspective + 0, "Default Startup", "", wx.ITEM_RADIO))
				self._perspectives_menu.AppendItem(FM.FlatMenuItem(self._perspectives_menu, ID_FirstPerspective + 1, "Terrain", "", wx.ITEM_RADIO))
				self._perspectives_menu.AppendItem(FM.FlatMenuItem(self._perspectives_menu, ID_FirstPerspective + 2, "ODef Editor", "", wx.ITEM_RADIO))
				self._perspectives_menu.AppendItem(FM.FlatMenuItem(self._perspectives_menu, ID_FirstPerspective + 3, "Truck Editor", "", wx.ITEM_RADIO))

				help_menu = FM.FlatMenu()
				help_menu.AppendItem(FM.FlatMenuItem(self._perspectives_menu, ID_About, "About...", "", wx.ITEM_NORMAL))
				help_menu.AppendItem(FM.FlatMenuItem(self._perspectives_menu, ID_ViewHelp, "View Help", "", wx.ITEM_NORMAL))
				

				# min size for the frame itself isn't completely done.
				# see the end up FrameManager::Update() for the test
				# code. For now, just hard code a frame minimum size
				self.SetMinSize(wx.Size(600, 400))
				self.SetTitle(rorSettings().title)
				
				# create some toolbars
				self.terraintoolbar = FM.FlatMenuBar(self, iconSize=32, spacer=5, options=FM_OPT_SHOW_TOOLBAR)
				self.terraintoolbar.Append(file_menu, "File")
				self.terraintoolbar.Append(options_menu, "Options")
				self.terraintoolbar.Append(self._perspectives_menu, "Perspectives")
				self.terraintoolbar.Append(help_menu, "Help")
				
#				self.hor_sizer.Add(self.terraintoolbar)
				self.Bind(wx.EVT_RIGHT_DOWN, self.Onterraintoolbar, self.terraintoolbar)

				self.statusbar = self.CreateStatusBar(4, 0, wx.ID_ANY, "mainstatusbar")
				self.statusbar.SetStatusWidths([300, 300, 300, 350])

				
#				self.terraintoolbar.SetToolBitmapSize(wx.Size(16,16))
#				self.terraintoolbar.AddLabelTool(ID_OpenTerrain, "Open Terrain", wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN))
				self.terraintoolbar.AddTool(ID_SaveTerrain, "Save Terrain", wx.ArtProvider_GetBitmap(wx.ART_FILE_SAVE))
				self.terraintoolbar.AddTool(ID_SaveTerrainAs, "Save Terrain As", wx.ArtProvider_GetBitmap(wx.ART_FILE_SAVE_AS))
				self.terraintoolbar.AddSeparator()
#				self.terraintoolbar.AddLabelTool(ID_StickTo02, "Stick to 0.2 m",wx.ArtProvider_GetBitmap(wx.ART_GO_DOWN),
#									shortHelp="Stick New Objects to 0.2 from ground")
#				self.terraintoolbar.AddLabelTool(ID_Inspector, "Object Inspector",wx.ArtProvider_GetBitmap(wx.ART_GO_DOWN),
#									shortHelp="Stick New Objects to 0.2 from ground")				
				self.terraintoolbar.AddTool(ID_StartRoR, "Save && Start RoR", getBitmap("Save Start RoR"),
									shortHelp="Save Terrain and Start RoR loading this map")
				
#				self.terraintoolbar.AddSeparator()
#				self.terraintoolbar.EnableTool(ID_StartRoR, False)								
				 
				#self.terraintoolbar.AddTool(ID_AddObject, "Add Something", wx.ArtProvider_GetBitmap(wx.ART_NEW))
				#self.terraintoolbar.EnableTool(ID_AddObject, False)
				#self.terraintoolbar.AddTool(ID_DeleteSelection, "Delete Selection", wx.ArtProvider_GetBitmap(wx.ART_DELETE))
				#self.terraintoolbar.EnableTool(ID_DeleteSelection, False)
				#self.terraintoolbar.AddSeparator()		
				self.terraintoolbar.AddTool(ID_CopySelection, "Copy Selection", wx.ArtProvider_GetBitmap(wx.ART_COPY))
#				self.terraintoolbar.EnableTool(ID_CopySelection, False)
				self.terraintoolbar.AddTool(ID_PasteSelection, "Paste Selection", wx.ArtProvider_GetBitmap(wx.ART_PASTE))
#				self.terraintoolbar.EnableTool(ID_PasteSelection, False)
				#self.terraintoolbar.AddSeparator()		
				#self.terraintoolbar.AddTool(ID_UndoAction, "Undo last Action", wx.ArtProvider_GetBitmap(wx.ART_UNDO))
				#self.terraintoolbar.EnableTool(ID_UndoAction, False)
				#self.terraintoolbar.AddTool(ID_RedoAction, "Redo last Undo", wx.ArtProvider_GetBitmap(wx.ART_REDO))
				#self.terraintoolbar.EnableTool(ID_RedoAction, False)
				#self.terraintoolbar.AddSeparator()		
				self.terraintoolbar.AddTool(ID_FindObject, "go to...", wx.ArtProvider_GetBitmap(wx.ART_FIND), shortHelp="go to to some coordenates")
#				self.terraintoolbar.EnableTool(ID_FindObject, True)
				#self.terraintoolbar.AddSeparator()		
#				self.terraintoolbar.AddTool(ID_Quit, "Quit", wx.ArtProvider_GetBitmap(wx.ART_QUIT))

				self.terraintoolbar.PositionAUI(self._mgr)			
				self.rordir = rorSettings().rorFolder
				log().debug("creating shaped windows")
		
				#self.dummyOgreWindow = ObjectPreviewOgreWindow(self, "ogre3DDummyWindow")
				#self.dummyOgreWindow.Hide() 
				# add a bunch of panes
				# Lepes: Shaped window 
				self.RoadSystem = RoadSystemWindow(self, title="Road")
				self.RoadSystem.Show(False)
				self.RoadSystem.perspective = 1
#				self.Preview = RoRPreviewCtrl(self, 
#											  title = "Object Preview",
#											  pos = (self.GetScreenPosition().x,self.GetScreenPosition().y + shapedtop))
				self.race = Race(self, title="Manage Races")
#				self.PivotControls = PivotControlWindow(self,title = "Pivot Controls" pos = (self.GetScreenPosition().x,self.GetScreenPosition().y + shapedtop) )
#				self.PivotControls.Show(True)
#				self._mgr.AddPane(self.objectPreviewWindow, wx.aui.AuiPaneInfo().
#												  Name("object_preview").
#												  Caption("Object Preview").
#												  CenterPane().
#												  MinSize(wx.Size(200, 100)).
#												  CloseButton(True).
#												  MaximizeButton(False))

				self._mgr.AddPane(HelpPanel(self, self), wx.aui.AuiPaneInfo().
												  Name("help").
												  Caption("Help").
												  Dockable(False).
												  Float().
												  Hide().
												  CloseButton(True).
												  MaximizeButton(True))

				self._mgr.AddPane(SettingsPanel(self, self), wx.aui.AuiPaneInfo().
												  Name("settings").
												  Caption("Dock Manager Settings").
												  Dockable(False).
												  Float().
												  Fixed().
												  Hide().
												  CloseButton(True).
												  MaximizeButton(True))
				#BUG: why first wxOgreWindow that is created, it is mess up when starting RoR in full screen mode ??
			
				# Map Preview
				self.MapPreview = ObjectPreviewOgreWindow(self, "mapPreview")
				self._mgr.AddPane(self.MapPreview, wx.aui.AuiPaneInfo().
								  Name("Map_Preview").
								  Caption("Map Preview").
								  MinSize(wx.Size(200, 200)).
								  CloseButton(True).
								  MaximizeButton(False).
								  Show(True).
								  CenterPane())
#				self.MapPreview.Show(False)

				self.ObjectTree = RoRObjectTreeCtrl(self, title="Tree")
				self.ObjectTree.perspective = 1
#				self._mgr.AddPane(self.ObjectTree, wx.aui.AuiPaneInfo().
#												  Name("object_tree").
#												  Caption("Object Tree").
#												  Show(True)
#												  )

				self.MapOptions = MapOptionWindow(self, title="Map Options")
				self.MapOptions.perspective = 1						  
				# odef editor panels
				self.oddefEditorViewSettings = OdefViewPanel(self, title="Odef")
				self.oddefEditorViewSettings.perspective = 2
#				self._mgr.AddPane(self.oddefEditorViewSettings, wx.aui.AuiPaneInfo().
#												  Name("odef_editor_view_settings").
#												  Caption("ODef Editor View Settings").
#												  MinSize(wx.Size(200, 100)).
#												  Left().
#												  CloseButton(True).
#												  MaximizeButton(False).
#												  Hide())

#				self.sectionLine = TruckLinePanel(self)
#				self._mgr.AddPane(self.sectionLine, wx.aui.AuiPaneInfo().
#												  Name("sectionLine").
#												  Caption("Section Line").
#												  MinSize(wx.Size(400, 100)).
#												  Bottom().
#												  CloseButton(True).
#												  MaximizeButton(False).
#												  Hide()
#												  )				
				self.truckEditorViewSettings = TruckViewPanel(self)
				self._mgr.AddPane(self.truckEditorViewSettings, wx.aui.AuiPaneInfo().
												  Name("truck_editor_view_settings").
												  Caption("Truck Editor View Settings").
												  MinSize(wx.Size(200, 100)).
												  Left().
												  CloseButton(True).
												  MaximizeButton(False).
												  Hide())
				# Lepes Object Inspector, only visible on RoRTerrainEditor
				self.ObjectInspector = ObjectInspector(self, title="Inspector")
				self.ObjectInspector.perspective = 1
#				self._mgr.AddPane(self.ObjectInspector, wx.aui.AuiPaneInfo().
#												  Name("object_inspector").
#												  Caption("Object Inspector")
#												  CloseButton(True).
#												  MaximizeButton(False).
#												  PinButton(True).
##												  Float().
#												  FloatingPosition(wx.Point(200,20)).
#												  FloatingSize(wx.Size(240,430)).
#												  LeftDockable().
#												  RightDockable()
#												  )
				self.cameraBookmark = CameraWindow(self, title="Camera Bookmark")
											  
				self.cameraBookmark.perspective = 1
				self.tbbuttons = [] #[ {'id' :ID, 'label': string, 'window' : ShapedWindow_instance} ]
				#create toolbarButtons for shaped windows
				for w in wx.GetTopLevelWindows():
					if isinstance(w, ShapedWindow):
						label = w.title
						id = wx.NewId()
						
						buttonidx = self.terraintoolbar.AddTool(id, label, bitmap1=getBitmap(label), bitmap2=getBitmap(label), kind=wx.ITEM_CHECK)						
						self.Bind(wx.EVT_MENU, self.OnToolbarButtonClick, id=id)
						w.Hide()
						self.tbbuttons.append({'id' : id, 'label': label, 'window': w, 'perspective' : w.perspective, 'buttonidx': buttonidx})
												  
				#  create the center pane(s)
				#Timer creation  (for rendering)
				self.ogreTimer = wx.Timer() 
				self.ogreTimer.SetOwner(self)
				self.Bind(wx.EVT_TIMER, self.onUpdateRender, self.ogreTimer)
				self.ogreTimer.Start(25)
				
				# the terrain editor ogre window
				self.terrainOgreWin = RoRTerrainOgreWindow(self, wx.ID_ANY, rordir=self.rordir)
				self._mgr.AddPane(self.terrainOgreWin, wx.aui.AuiPaneInfo().Name("ogre_terrain_content").CenterPane().Hide())


				#lepesnew
				# the odef editor ogre window
				self.odefEditorOgreWin = ODefEditorOgreWindow(self, wx.ID_ANY)
				self._mgr.AddPane(self.odefEditorOgreWin, wx.aui.AuiPaneInfo().Name("ogre_odef_editor_content").CenterPane().Hide())

				# the truck editor window
				self.truckEditorOgreWin = RoRTruckOgreWindow(self, wx.ID_ANY)
				self._mgr.AddPane(self.truckEditorOgreWin, wx.aui.AuiPaneInfo().Name("ogre_truck_editor_content").CenterPane().Hide())
#				self.truckEditorOgreWin.linePanel = self.sectionLine
				# the truck editor UV window
				self.truckEditorUVOgreWin = RoRTruckUVOgreWindow(self, wx.ID_ANY)
				self._mgr.AddPane(self.truckEditorUVOgreWin, wx.aui.AuiPaneInfo().Name("ogre_truck_editor_uv_content").Float().Hide())
				
				# Hide Object Inspector
				self._mgr.GetPane("object_inspector").Show(False)
				# Hide Controls
				self._mgr.GetPane("controls").Show(False)			   

				# add the toolbars to the manager
#				self._mgr.AddPane(self.terraintoolbar, wx.aui.AuiPaneInfo().
#												  Name("terrain_toolbar").
#												  Caption("General Toolbar").
#												  ToolbarPane().Left().
#												  LeftDockable(False).
#												  RightDockable(False)
##												  Hide()
#												  )

				self._mgr.GetPane("Map_Preview").Show(True)
				# make some default perspectives
				self._perspectives.append(self._mgr.SavePerspective())
				self.actualPerspective = 0
				
				self.hideAllPanes()
				log().debug("all windows created yet, creating perspectives") 
#				if rorSettings().has_section("perspectives"):
#					self._perspectives = [] 
#					for option, value in rorSettings().myConfig.items("perspectives"):
#						self._perspectives.append(value)
#				else:
				if True:
#					 terrain perspective 
					self._mgr.GetPane("terrain_toolbar").Show(True)
					self._mgr.GetPane("ogre_terrain_content").Show(True)
					self._mgr.GetPane("object_tree").Show(True)
					self._perspectives.append(self._mgr.SavePerspective())
	
					# odef editor perspective
					self.hideAllPanes()
					self._mgr.GetPane("ogre_odef_editor_content").Show(True)
					self._mgr.GetPane("odef_editor_view_settings").Show(True)
					self._mgr.GetPane("object_tree").Show(True)
					self._perspectives.append(self._mgr.SavePerspective())
	
					# truck editor perspective
					self.hideAllPanes()
#					self._mgr.GetPane("sectionLine").Show(True)
					self._mgr.GetPane("ogre_truck_editor_uv_content").Show(True)
					self._mgr.GetPane("ogre_truck_editor_content").Show(True)
					self._mgr.GetPane("truck_editor_view_settings").Show(True)
					self._perspectives.append(self._mgr.SavePerspective())
# TODO: self._perspective should be a dictionary with self._perspective_menu captions and the self._mgr.SavePerspective
#	  as a key, to be able to restore perspective with their names into menu and self._mgr
#	 bug with autoMap feature :-S
#					for i in range(len(self._perspectives)):
#						rorSettings().setSetting("perspectives", str(i), self._perspectives[i], autoSaveFile = False)
#					rorSettings().saveSettings()
				
				# load startup perspective
				self._mgr.LoadPerspective(self._perspectives[0])
				

				self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
				self.Bind(wx.EVT_SIZE, self.OnSize)
				self.Bind(wx.EVT_CLOSE, self.OnClose)

				self.Bind(wx.EVT_MENU, self.OnSaveTerrain, id=ID_SaveTerrain)
				self.Bind(wx.EVT_MENU, self.OnSaveTerrainAs, id=ID_SaveTerrainAs)				
				self.Bind(wx.EVT_MENU, self.OnViewHelp, id=ID_ViewHelp)
				self.Bind(wx.EVT_MENU, self.OnmodTool, id=ID_ModTool)

				self.Bind(wx.EVT_MENU, self.OnwxInspector, id=ID_wxInspector)
				self.Bind(wx.EVT_MENU, self.OnselectSkin, id=ID_selectSkin)
				self.Bind(wx.EVT_MENU, self.Onterraintoolbar, id=ID_hideCaptions)
				self.Bind(wx.EVT_TOOL, self.OnStickTo02Click, id=ID_StickTo02)
				self.Bind(wx.EVT_TOOL, self.OnStartRoRClick, id=ID_StartRoR)
				self.Bind(wx.EVT_TOOL, self.OnfindObject, id=ID_FindObject)
				
				self.Bind(wx.EVT_MENU, self.OnCreatePerspective, id=ID_CreatePerspective)
				self.Bind(wx.EVT_MENU, self.OnCopyPerspective, id=ID_CopyPerspective)
				self.Bind(wx.EVT_MENU, self.OnCopySelection, id=ID_CopySelection)
				self.Bind(wx.EVT_MENU, self.OnPasteSelection, id=ID_PasteSelection)

				self.Bind(wx.EVT_MENU, self.OnSettings, id=ID_Settings)
				
				self.Bind(wx.EVT_MENU, self.OnExit, id=ID_Quit)
				self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT)
				self.Bind(wx.EVT_MENU, self.OnAbout, id=ID_About)
		
				self.Bind(wx.EVT_MENU_RANGE, self.OnRestorePerspective, id=ID_FirstPerspective,
								  id2=ID_FirstPerspective + 1000)
				
				# "commit" all changes made to FrameManager   
				self.terraintoolbar.Refresh()
#				self.terraintoolbar.Show(True)				
#				self.hor_sizer = wx.BoxSizer(wx.HORIZONTAL)
#				self.hor_sizer.Add(self.terraintoolbar, 0, wx.EXPAND)
#				self.hor_sizer.Add(self.statusbar, 1, wx.EXPAND)
#				self.SetSizer(self.hor_sizer)
				self._mgr.GetArtProvider().SetColor(wx.aui.AUI_DOCKART_BACKGROUND_COLOUR, ShapedControls.skinBackColor)
				self._mgr.Update()
#				self.DoUpdate()
#				for s in range(len(self.tbbuttons)):
#					self.tbbuttons[s]['window'].Show(False)

				log().debug("Mainframe.__init__ finished")
コード例 #16
0
    def __init__(self, parent, **kwargs):
        ShapedWindow.__init__(self, parent, **kwargs)

        self.parent = parent
        self.rordir = rorSettings().rorFolder

        self._splines = []
        grid = self.grid
        grid.SetEmptyCellSize(wx.Size(10, 3))

        # Window padding - sides
        spacer_size = (6, 6)
        grid.AddSpacer(spacer_size, (0, 0))  # Row 0, Col 0
        grid.AddSpacer(spacer_size, (0, 8))  # Row 0, Col 2

        r = 1
        c = 1
        self.mainLabel = wx.StaticText(
            self, -1, "", size=wx.Size(0, 20), style=wx.TRANSPARENT_WINDOW | wx.ST_NO_AUTORESIZE
        )
        grid.Add(self.mainLabel, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 3))

        r += 2
        l = wx.StaticText(self, -1, "Splines:", size=wx.Size(60, 20), style=wx.TRANSPARENT_WINDOW)
        grid.Add(l, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 2))

        c += 2  # span
        self.cboSpline = wx.ComboBox(self, -1, size=wx.Size(170, 20), style=wx.CB_READONLY)
        self.cboSpline.Bind(wx.EVT_COMBOBOX, self.OncboSpline)
        grid.Add(self.cboSpline, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 4))

        r += 1
        c -= 2
        self.createSpline = wx.Button(self, -1, "Create new road", size=wx.Size(100, 20))
        self.createSpline.Bind(wx.EVT_BUTTON, self.OncreateSpline)
        grid.Add(self.createSpline, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 4))

        r += 1
        c += 1
        self.changeName = wx.Button(self, -1, "Change Spline name")
        self.changeName.Bind(wx.EVT_BUTTON, self.OnchangeName)
        grid.Add(self.changeName, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 4))

        r += 1
        self.pauseSpline = wx.Button(self, -1, "Pause - allow to modify control points")
        self.pauseSpline.Bind(wx.EVT_BUTTON, self.OnpauseSpline)
        grid.Add(self.pauseSpline, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 4))

        r += 1
        self.insertBefore = wx.Button(self, -1, "Insert control point Before")
        self.insertBefore.Bind(wx.EVT_BUTTON, self.OninsertBefore)
        grid.Add(self.insertBefore, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 3))

        r += 1
        self.deleteControlPoint = wx.Button(self, -1, "Delete control point")
        self.deleteControlPoint.Bind(wx.EVT_BUTTON, self.OndeleteControlPoint)
        grid.Add(self.deleteControlPoint, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 3))

        r += 1
        self.insertAfter = wx.Button(self, -1, "Insert control point After")
        self.insertAfter.Bind(wx.EVT_BUTTON, self.OninsertAfter)
        grid.Add(self.insertAfter, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 3))

        r += 1
        l = wx.StaticText(self, -1, "segment Type:", size=wx.Size(80, 20), style=wx.TRANSPARENT_WINDOW)
        grid.Add(l, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 2))

        c += 2
        self.cbosegmentType = wx.ComboBox(
            self,
            -1,
            size=wx.Size(130, 20),
            choices=[
                "auto",
                "road",
                "roadborderleft",
                "roadborderright",
                "roadborderboth",
                "roadbridge",
                "roadbridgenopillar",
            ],
            style=wx.CB_READONLY,
        )
        self.cbosegmentType.SetSelection(0)
        self._segmentType = "auto"
        self.cbosegmentType.Bind(wx.EVT_COMBOBOX, self.OncbosegmentType)
        grid.Add(self.cbosegmentType, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 4))

        r += 1
        c -= 2
        self.chkSmooth = wx.CheckBox(self, -1, "stick to ground", wx.DefaultPosition, wx.Size(100, 20))
        self.chkSmooth.SetValue(True)
        self._segmentSticked = True
        self.chkSmooth.Bind(wx.EVT_CHECKBOX, self.Onsmooth)
        grid.Add(self.chkSmooth, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 4))

        r += 1
        self.finishSpline = wx.Button(self, -1, "Finish - Accept the road")
        self.finishSpline.Bind(wx.EVT_BUTTON, self.OnfinishSpline)
        grid.Add(self.finishSpline, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 4))

        r += 1
        self.deleteSpline = wx.Button(self, -1, "Delete - Decline actual road")
        self.deleteSpline.Bind(wx.EVT_BUTTON, self.OndeleteSpline)
        grid.Add(self.deleteSpline, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 4))

        r += 1
        self.walk = wx.Button(self, -1, "Walk on roads")
        self.walk.Bind(wx.EVT_BUTTON, self.Onwalk)
        grid.Add(self.walk, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 2))

        r += 1
        self.purgue = wx.Button(self, -1, "Purgue spline forever")
        self.purgue.Bind(wx.EVT_BUTTON, self.Onpurgue)
        grid.Add(self.purgue, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 3))

        self.enableCreateSpline(True)
        self.enableInsert(False)

        # Window padding - bottom
        r += 1
        grid.AddSpacer(spacer_size, (r, c))

        self.SetSizerAndFit(grid)

        self.updateSkin()
コード例 #17
0
	def __init__(self, parent, ID, size=wx.Size(200, 200), **kwargs):
		self.rordir = rorSettings().rorFolder
		self.parent = parent
		wxOgreWindow.__init__(self, parent, ID, "odefEditor", size=size, **kwargs)
		self.initVariables()
コード例 #18
0
	def __init__(self, parent, **kwargs):
		ShapedWindow.__init__(self, parent, **kwargs)
	   
		self.parent = parent
		self.rordir = rorSettings().rorFolder
			

		self.cameraList = []
		# self.cameraList = [ {'name': "camera 1", 'pos': tupleType, 'dir': tupleType ]
		self.lastcount = 0
		grid = self.grid
		grid.SetEmptyCellSize(wx.Size(110, 3))
		
		# Window padding
		spacer_size = (6,6)
		grid.AddSpacer(spacer_size, (0,0)) # Row 0, Col 0
		grid.AddSpacer(spacer_size, (0,2)) # Row 0, Col 2
		
		
		r = 1
		c = 1
		self.mainLabel = wx.StaticText(self, -1, "", size=wx.Size(0, 20), style=wx.TRANSPARENT_WINDOW | wx.ST_NO_AUTORESIZE)
		#self.mainLabel.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
		grid.Add(self.mainLabel, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 1))

		
		r += 2
		c = 1		 
		l = wx.StaticText(self, -1, " add a New camera Bookmark called:")
		grid.Add(l,
				 pos=wx.GBPosition(r, c),
				 span=wx.GBSpan(1, 1))
		
		r += 1
		c = 1
		self.cameraName = wx.TextCtrl(self, -1, "", size=wx.Size(250, 20), style=wx.TE_PROCESS_ENTER)
		self.cameraName.Bind(wx.EVT_TEXT_ENTER, self.OnText)
		grid.Add(self.cameraName,
				 pos=wx.GBPosition(r, c),
				 span=wx.GBSpan(1, 1))
		
		r += 1
		c = 1
		self.add = wx.Button(self, -1, "add New camera Position", size=wx.Size(250, 20))
		self.add.Bind(wx.EVT_BUTTON, self.Onadd)
		grid.Add(self.add, pos=wx.GBPosition(r, c))

		r += 2
		c = 1		 
		l = wx.StaticText(self, -1, "Available cameras (left click to go)")
		grid.Add(l,
				 pos=wx.GBPosition(r, c),
				 span=wx.GBSpan(1, 1))

		r += 1
		c = 1
		# don't sort camera names due inconsistent with self.cameraList
		self.list = wx.ListBox(self, -1, wx.DefaultPosition, wx.Size(250, 180), [], wx.LB_SINGLE | wx.LB_NEEDED_SB)
		self.list.Bind(wx.EVT_LISTBOX, self.Onselect)
		grid.Add(self.list, pos=wx.GBPosition(r, c))

		r += 1
		c = 1
		self.deleteCamera = wx.Button(self, -1, "Delete selected camera or last one", size=wx.Size(250, 20))
		self.deleteCamera.Bind(wx.EVT_BUTTON, self.Ondelete)
		grid.Add(self.deleteCamera, pos=wx.GBPosition(r, c))
		
		r += 1
		c = 1
		# create a panel to put some static labels and TextCtrl on the same row.
		pan = wx.Panel(self, -1, size=wx.Size(250, 20))

		l = wx.StaticText(pan, -1, " normal Velocity", pos=wx.Point(0, 0), size=wx.Size(80, 20))

		self.normalVel = wx.TextCtrl(pan, -1, "", pos=wx.Point(80, 0), size=wx.Size(40, 20), style=wx.TE_PROCESS_ENTER)
		self.normalVel.Bind(wx.EVT_TEXT_ENTER, self.OnnormalVel)
		grid.Add(pan,
				 pos=wx.GBPosition(r, c),
				 span=wx.GBSpan(1, 1))

		r += 1
		c = 1
		pan = wx.Panel(self, -1, size=wx.Size(250, 20))
		
		l = wx.StaticText(pan, -1, " SHIFT Velocity", pos=wx.Point(0, 0), size=wx.Size(80, 20))

		self.shiftVel = wx.TextCtrl(pan, -1, "", pos=wx.Point(80, 0), size=wx.Size(40, 20), style=wx.TE_PROCESS_ENTER)
		self.shiftVel.Bind(wx.EVT_TEXT_ENTER, self.OnshiftVel)

		grid.Add(pan,
				 pos=wx.GBPosition(r, c),
				 span=wx.GBSpan(1, 1))
				 
		# Bottom padding
		r += 1
		grid.AddSpacer(spacer_size, (r,c))
		
		self.SetSizerAndFit(grid)
		self.updateSkin()
コード例 #19
0
	def __init__(self, parent, **kwargs):
		ShapedWindow.__init__(self, parent, **kwargs)
	   
		self.parent = parent
		self._luaParser = None
		self.rordir = rorSettings().rorFolder
					
		grid = self.grid
		grid.SetEmptyCellSize(wx.Size(110, 20))
		
		# Window padding - sides
		spacer_size = (6,6)
		grid.AddSpacer(spacer_size, (0,0)) # Row 0, Col 0
		grid.AddSpacer(spacer_size, (0,3)) # Row 0, Col 2
		
		r = 1
		c = 1
		self.mainLabel = wx.StaticText(self, -1, "", size=wx.Size(0, 20), style=wx.TRANSPARENT_WINDOW | wx.ST_NO_AUTORESIZE)
		grid.Add(self.mainLabel, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 1))

		
		r += 1		 
		self.newRace = wx.Button(self, -1, "new Race", size=wx.Size(100, 20))
		self.newRace.Bind(wx.EVT_BUTTON, self.OnnewRace)
		grid.Add(self.newRace, pos=wx.GBPosition(r, c))
		
		c += 1
		self.modifyRace = wx.Button(self, -1, "Modify Race", size=wx.Size(100, 20))
		self.modifyRace.Bind(wx.EVT_BUTTON, self.OnmodifyRace)
		grid.Add(self.modifyRace, pos=wx.GBPosition(r, c))
		
		r += 1
		c = 1
		l = wx.StaticText(self, -1, "available races:")
		grid.Add(l,
				 pos=wx.GBPosition(r, c),
				 span=wx.GBSpan(1, 1))
		c += 1
		self.racelist = wx.ComboBox(self, -1, "", size=wx.Size(100, 20), style=wx.CB_READONLY)
		self.racelist.Bind(wx.EVT_COMBOBOX , self.Onracelist)
		grid.Add(self.racelist, pos=wx.GBPosition(r, c))

		r += 1
		c = 1		 
		l = wx.StaticText(self, -1, "Objects to spawn (click to go):")
		grid.Add(l,
				 pos=wx.GBPosition(r, c),
				 span=wx.GBSpan(1, 1))

		r += 1
		c = 1
		self.list = wx.ListBox(self, -1, wx.DefaultPosition, wx.Size(250, 180), [], wx.LB_SINGLE | wx.LB_NEEDED_SB)
		self.list.Bind(wx.EVT_LISTBOX, self.OnselectCheckpoint)
		grid.Add(self.list, pos=wx.GBPosition(r, c),
					span=wx.GBSpan(1, 2))
		
		r += 1
		c = 1
		self.endModify = wx.Button(self, -1, "End Modify", size=wx.Size(100, 20))
		self.endModify.Bind(wx.EVT_BUTTON, self.OnendModify)
		grid.Add(self.endModify, pos=wx.GBPosition(r, c))

		c += 1
		self.deleteRace = wx.Button(self, -1, "Delete Race", size=wx.Size(100, 20))
		self.deleteRace.Bind(wx.EVT_BUTTON, self.OndeleteRace)
		grid.Add(self.deleteRace, pos=wx.GBPosition(r, c))

		r += 1		
		c = 1
		self.altitude = wx.CheckBox(self, -1, "Show Altitude of the next Checkpoint")
		self.altitude.Bind(wx.EVT_CHECKBOX, self.Onaltitude)
		grid.Add(self.altitude,
				 pos=wx.GBPosition(r, c),
				 span=wx.GBSpan(1, 2))

		r += 1		
		c = 1
		self.isLoop = wx.CheckBox(self, -1, "is circuit race?")
		self.isLoop.Bind(wx.EVT_CHECKBOX, self.OnisLoop)
		grid.Add(self.isLoop,
				 pos=wx.GBPosition(r, c),
				 span=wx.GBSpan(1, 1))
				 
		# Window padding - bottom
		r += 1
		grid.AddSpacer(spacer_size, (r, c))
	
		self.SetSizerAndFit(grid)
		self._raceIndex = -1
		self.updateSkin()
コード例 #20
0
	def __init__(self, parent, **kwargs):
		ShapedWindow.__init__(self, parent, **kwargs)
	   
		self.parent = parent
		self.rordir = rorSettings().rorFolder
			
		grid = self.grid
		grid.SetEmptyCellSize(wx.Size(110, 3))
		
		# Window padding
		spacer_size = (6,6)
		grid.AddSpacer(spacer_size, (0,0)) # Row 0, Col 0
		grid.AddSpacer(spacer_size, (0,2)) # Row 0, Col 2
		
		r = 1
		c = 1
		self.mainLabel = wx.StaticText(self, -1, "", size=wx.Size(0, 20), style=wx.TRANSPARENT_WINDOW | wx.ST_NO_AUTORESIZE)
		grid.Add(self.mainLabel, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 1))
		
		r += 1
		c = 1
		l = wx.StaticText(self, -1, "Ingame menu Map name:", style=wx.TRANSPARENT_WINDOW)
		grid.Add(l, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 2))

		r += 1
		c = 1
		self.mapName = wx.TextCtrl(self, -1, "", size=wx.Size(252, 20), style=wx.TE_PROCESS_ENTER)
		self.mapName.Bind(wx.EVT_TEXT_ENTER, self.OnmapName)
		grid.Add(self.mapName,
				 pos=wx.GBPosition(r, c),
				 span=wx.GBSpan(1, 2))


		r += 1
		c = 1
		l = wx.StaticText(self, -1, "Config file (*.cfg):", style=wx.TRANSPARENT_WINDOW)
		grid.Add(l, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 1))

		c += 1
		self.mapConfig = wx.TextCtrl(self, -1, "", size=wx.Size(120, 20), style=wx.TE_PROCESS_ENTER)
		self.mapConfig.Bind(wx.EVT_TEXT_ENTER, self.OnmapConfig)
		grid.Add(self.mapConfig,
				 pos=wx.GBPosition(r, c),
				 span=wx.GBSpan(1, 2))

		r += 1
		c = 1
		self.useCaelum = wx.CheckBox(self, -1, "Use Caelum in this map")
		self.useCaelum.Bind(wx.EVT_CHECKBOX, self.OnuseCaelum)
		grid.Add(self.useCaelum,
				 pos=wx.GBPosition(r, c),
				 span=wx.GBSpan(1, 1))
		
		r += 1
		c = 1
		self.chkWaterLevel = wx.CheckBox(self, -1, "Water level (in meters):")
		self.chkWaterLevel.Bind(wx.EVT_CHECKBOX, self.OnCheckWater)
		grid.Add(self.chkWaterLevel, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 1))
		
#		r+=1
		c += 1
		self.waterHeight = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_ENTER)
		self.waterHeight.Bind(wx.EVT_TEXT_ENTER, self.OnwaterHeight)
		grid.Add(self.waterHeight,
				 pos=wx.GBPosition(r, c),
				 span=wx.GBSpan(1, 1))
		
		r += 1
		c = 1
		l = wx.StaticText(self, -1, "author information:", style=wx.TRANSPARENT_WINDOW)
		grid.Add(l, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 2))

		r += 1
		c = 1
		self.comments = wx.TextCtrl(self, -1, "", size=wx.Size(252, 150), style=wx.TE_MULTILINE | wx.TE_PROCESS_ENTER)	
		self.comments.Bind(wx.EVT_TEXT_ENTER, self.Oncomments)
		grid.Add(self.comments,
				 pos=wx.GBPosition(r, c),
				 span=wx.GBSpan(1, 2))

		r += 1
		self.btdetails = wx.Button(self, -1, "Summary...", size=wx.Size(100, 20))
		self.btdetails.Bind(wx.EVT_BUTTON, self.Onbtdetails)
		grid.Add(self.btdetails, pos=wx.GBPosition(r, c), span=wx.GBSpan(1, 4))
		
		# Bottom padding
		r += 1
		grid.AddSpacer(spacer_size, (r, 3))
		
		self.SetSizerAndFit(grid)
		self.updateSkin()
		 

# It works too, but i want the window "minimized"
#		self.SetSize(self.skinSize)
		self.Refresh()