comparison clients/pychan_demo/pychan_test.py @ 125:97d6946bd917

- prepared files for new dir structure
author chewie@33b003aa-7bff-0310-803a-e67f0ece8222
date Wed, 06 Aug 2008 22:24:57 +0000
parents 4a0efb7baf70
children fe7ff4808529
comparison
equal deleted inserted replaced
124:d5658e6c34f5 125:97d6946bd917
41 super(DemoApplication,self).__init__() 41 super(DemoApplication,self).__init__()
42 42
43 pychan.init(self.engine,debug=True) 43 pychan.init(self.engine,debug=True)
44 pychan.setupModalExecution(self.mainLoop,self.breakFromMainLoop) 44 pychan.setupModalExecution(self.mainLoop,self.breakFromMainLoop)
45 45
46 self.gui = pychan.loadXML('content/gui/demoapp.xml') 46 self.gui = pychan.loadXML('gui/demoapp.xml')
47 47
48 eventMap = { 48 eventMap = {
49 'creditsLink' : self.showCredits, 49 'creditsLink' : self.showCredits,
50 'closeButton' : self.quit, 50 'closeButton' : self.quit,
51 'demoList' : self.selectExample 51 'demoList' : self.selectExample
54 54
55 from dynamic import DynamicExample 55 from dynamic import DynamicExample
56 from styling import StylingExample 56 from styling import StylingExample
57 57
58 self.examples = { 58 self.examples = {
59 'Absolute Positioning' : PyChanExample('content/gui/absolute.xml'), 59 'Absolute Positioning' : PyChanExample('gui/absolute.xml'),
60 'Basic Styling' : StylingExample(), 60 'Basic Styling' : StylingExample(),
61 'All Widgets' : PyChanExample('content/gui/all_widgets.xml'), 61 'All Widgets' : PyChanExample('gui/all_widgets.xml'),
62 'Dynamic Widgets' : DynamicExample(), 62 'Dynamic Widgets' : DynamicExample(),
63 } 63 }
64 self.demoList = self.gui.findChild(name='demoList') 64 self.demoList = self.gui.findChild(name='demoList')
65 self.demoList.items += self.examples.keys() 65 self.demoList.items += self.examples.keys()
66 self.gui.show() 66 self.gui.show()
75 self.currentExample = self.examples[self.demoList.selected_item] 75 self.currentExample = self.examples[self.demoList.selected_item]
76 self.gui.findChild(name="xmlSource").text = open(self.currentExample.xmlFile).read() 76 self.gui.findChild(name="xmlSource").text = open(self.currentExample.xmlFile).read()
77 self.currentExample.start() 77 self.currentExample.start()
78 78
79 def showCredits(self): 79 def showCredits(self):
80 print pychan.loadXML('content/gui/credits.xml').execute({ 'okButton' : "Yay!" }) 80 print pychan.loadXML('gui/credits.xml').execute({ 'okButton' : "Yay!" })
81 81
82 class TestXMLApplication(basicapplication.ApplicationBase): 82 class TestXMLApplication(basicapplication.ApplicationBase):
83 """ 83 """
84 Test Application. Run the pychan_test.py file 84 Test Application. Run the pychan_test.py file
85 with the XML file you want to load as argument. 85 with the XML file you want to load as argument.