diff tools/editor/scripts/gui/cameradialog.py @ 562:e34b44afd428

Fixed the built in pychan dialogs as they didin't work at all. Updated the editor to support modal execution and now use the pychan dialog message boxes for displaying some error messages.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 24 Jun 2010 19:58:59 +0000
parents 85e8986e7b8f
children 0e0a30f0eb20
line wrap: on
line diff
--- a/tools/editor/scripts/gui/cameradialog.py	Thu Jun 24 18:40:30 2010 +0000
+++ b/tools/editor/scripts/gui/cameradialog.py	Thu Jun 24 19:58:59 2010 +0000
@@ -23,6 +23,7 @@
 
 from fife import fife
 from fife.extensions import pychan
+from fife.extensions.pychan import dialogs
 
 class CameraDialog(object):
 	"""
@@ -61,19 +62,19 @@
 	def _finished(self):
 		id = self._widget.collectData('idBox')
 		if id == '':
-			print 'Please enter a camera id.'
+			dialogs.message(message=unicode("Please enter a camera ID."), caption=unicode("Error"))
 			return
 
 		try:
 			map = self.engine.getModel().getMap(str(self._widget.collectData('mapBox')))
 		except fife.Exception:
-			print 'Cannot find the specified map id.'
+			dialogs.message(message=unicode("Cannot find the specified map id."), caption=unicode("Error"))
 			return
 
 		try:
 			layer = map.getLayer(str(self._widget.collectData('layerBox')))
 		except fife.Exception:
-			print 'Cannot find the specified layer id.'	
+			dialogs.message(message=unicode("Cannot find the specified layer id."), caption=unicode("Error"))
 			return
 
 		try:
@@ -83,21 +84,22 @@
 
 			viewport = fife.Rect(*[int(c) for c in vals])
 		except ValueError:
-			print 'Please enter 4 comma (,) delimited values for viewport x,y,width,height.'
+			dialogs.message(message=unicode("Please enter 4 comma (,) delimited values for viewport x,y,width,height."), caption=unicode("Error"))
 			return
 
 		try:
 			refh = int(self._widget.collectData('refhBox'))
 			refw = int(self._widget.collectData('refwBox'))
 		except ValueError:
-			print 'Please enter positive integer values for reference width and height.'
+			dialogs.message(message=unicode("Please enter positive integer values for reference width and height."), caption=unicode("Error"))
 			return
 
 		try:
 			rot = int(self._widget.collectData('rotBox'))
 			tilt = int(self._widget.collectData('tiltBox'))
 		except ValueError:
-			print 'Please enter positive integer values for rotation and tilt.'
+			dialogs.message(message=unicode("Please enter positive integer values for rotation and tilt."), caption=unicode("Error"))
+
 			return
 
 		cam = map.addCamera(str(id), layer, viewport)