diff clients/pychan_demo/styling.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 f98443afed5b
children dfd48d49c044
line wrap: on
line diff
--- a/clients/pychan_demo/styling.py	Wed Jun 03 19:29:52 2009 +0000
+++ b/clients/pychan_demo/styling.py	Mon Jun 08 16:00:02 2009 +0000
@@ -1,19 +1,8 @@
 #!/usr/bin/env python
-# coding: utf-8
-
-import sys, os, re
+# -*- coding: utf-8 -*-
 
-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
 
 import pychan
 
@@ -77,6 +66,9 @@
 			'base_color': fife.Color(80,200,80) ,
 			'background_color': fife.Color(200,250,200),
 			},
+		'Window' : {
+			'titlebar_height' : 30,
+		},
 		'ListBox' : {
 			'font' : 'samanata_large'
 			}
@@ -94,7 +86,12 @@
 		pychan.loadFonts("fonts/samanata.fontdef")
 
 	def start(self):
-		self.styledCredits = None
+		self.styledCredits = pychan.loadXML('gui/all_widgets.xml')
+		self.styledCredits.distributeInitialData({
+			'demoList' : map(lambda x:unicode(x,'utf8'),dir(pychan)),
+			'demoText' : unicode(pychan.__doc__,'utf8')
+		})
+
 		self.widget = pychan.loadXML(self.xmlFile)
 		self.widget.mapEvents({
 			'testStyle' : self.testStyle,
@@ -103,7 +100,10 @@
 		self.widget.distributeInitialData({
 			'styleList' : self.styles
 		})
+		self.widget.position_technique = 'right-20:center'
+		self.styledCredits.position_technique = 'left+20:center'
 		self.widget.show()
+		self.styledCredits.show()
 
 	def stop(self):
 		super(StylingExample,self).stop()
@@ -114,11 +114,5 @@
 		style = self.styles[self.widget.collectData('styleList')]
 		if self.styledCredits:
 			self.styledCredits.hide()
-		self.styledCredits = pychan.loadXML('gui/all_widgets.xml')
-		self.styledCredits.distributeInitialData({
-			'demoList' : dir(pychan),
-			'demoText' : pychan.__doc__
-		})
 		self.styledCredits.stylize(style)
-		self.styledCredits.mapEvents({'okButton':self.styledCredits.hide})
 		self.styledCredits.show()