diff clients/pychan_demo/dynamic.py @ 255:51cc05d862f2

Merged editor_rewrite branch to trunk. This contains changes that may break compatibility against existing clients. For a list of changes that may affect your client, see: http://wiki.fifengine.de/Changes_to_pychan_and_FIFE_in_editor_rewrite_branch
author cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
date Mon, 08 Jun 2009 16:00:02 +0000
parents bb9902910067
children dfd48d49c044
line wrap: on
line diff
--- a/clients/pychan_demo/dynamic.py	Wed Jun 03 19:29:52 2009 +0000
+++ b/clients/pychan_demo/dynamic.py	Mon Jun 08 16:00:02 2009 +0000
@@ -1,53 +1,18 @@
 #!/usr/bin/env python
-# coding: utf-8
-
-import sys, os, re
-
-def _jp(path):
-	return os.path.sep.join(path.split('/'))
-
-_paths = ('../../engine/swigwrappers/python', '../../engine/extensions')
-for p in _paths:
-	if p not in sys.path:
-		sys.path.append(_jp(p))
-
-import fife
-import fifelog
-import settings
+# -*- coding: utf-8 -*-
 
 import pychan
-
 from pychan_test import PyChanExample
 
-class Test(object):
-	def __init__(self,button,text1,text2):
-		super(Test,self).__init__()
-		self.button = button
-		self.text1 = text1
-		self.text2 = text2
-		self.button.text = text1
-
-	def mouseEntered(self, event):
-		print event
-		self.button.text = self.text2
-
-	def mouseExited(self, event):
-		print event
-		self.button.text = self.text1
-
-
 class DynamicExample(PyChanExample):
 	def __init__(self):
 		super(DynamicExample,self).__init__('gui/dynamic.xml')
 		
 	def start(self):
 		self.widget = pychan.loadXML(self.xmlFile)
-		self.l = Test(self.widget.findChild(name="okButton"),"Ok?","Ok!")
 		self.widget.mapEvents({
 			'okButton'   :self.stop,
 			'addButton'  :self.addLabel,
-			'okButton/mouseEntered' : self.l.mouseEntered,
-			'okButton/mouseExited'  : self.l.mouseExited
 		})
 		self.labelBox = self.widget.findChild(name="labelBox")
 		self.widget.show()
@@ -61,5 +26,5 @@
 		self.widget.adaptLayout()
 		
 	def removeLabel(self,widget=None):
-		widget._parent.removeChild(widget)
+		widget.parent.removeChild(widget)
 		self.widget.adaptLayout()