File: py-namespace.e

package info (click to toggle)
entity 0.7.2-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,352 kB
  • ctags: 5,272
  • sloc: ansic: 61,707; sh: 7,921; makefile: 732; perl: 399
file content (76 lines) | stat: -rwxr-xr-x 1,663 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env entity

<object>

<object name="test" default-lang="python" __python-namespace="ETest">

	<renderer name="entity-namespace-test"
		tag="test"
		lang="python"
		onrender="test_render"
		ondestroy="test_destroy"
		onparent="test_parent">

		<attrib name="something"
			description="The location of something."
			value_desc="string"
			values="*"
			onset="test_attr_set" />
		
		<python name="test_attr_set"><![CDATA[
def print_namespace(node):
  obj = node.parent("object")
  namespace = obj["__python-namespace"]
  print "namespace is %s" % namespace


def test_attr_set(node, attr, val):
    print "In test node, test node is %s, %s => %s\n" % (node, attr, val)
    print_namespace(node);

def test_attr_set(node, attr, val):
    pass
]]></python>
		
		<python name="test_render"><![CDATA[
def test_render(node, *args):
    print "!!!in test_render!!!"
    print_namespace (node)
]]></python>

                 <python name="test_destroy"><![CDATA[
def test_destroy(node, *args):
    print "!!!in test_destroy!!!"
    print_namespace (node)
]]></python>


		<python name="test_parent"><![CDATA[
def test_parent(node, *args):
    print "in test_parent"
]]></python>

	</renderer>
</object>

<object name="test" ondelete="entity:exit" default-lang="python">
  <test name="foo">
  <python><![CDATA[
def testme(*args):
  test = enode ("test.foo")
  some_func()
  test["something"] == "nothing"
  some_func ()
    	
def some_func(*args):
    print ("in some_func")
]]></python>
  </test>
  
  <window title="Namespace Test">
    <button label="test" onclick="testme"/>
    <button label="exit" onclick="entity:exit"/>
  </window>
</object>

</object>