Skip to content
Newer
Older
100644 141 lines (137 sloc) 3.43 KB
9713cf1 @chickenkiller remove unicode BOM from file (was failing to run under ruby18)
chickenkiller authored May 2, 2011
1 #! /usr/bin/env ruby
67b6e2f @jeremyz add test_edje and data
authored May 1, 2011
2 # -*- coding: UTF-8 -*-
3 #
4 require 'efl/ecore'
5 require 'efl/ecore_evas'
6 require 'efl/edje'
7 #
8 WIDTH=320
9 HEIGHT=240
e6eb6b7 @jeremyz clean test_edje.rb
authored May 6, 2011
10 #
d56f34a @jeremyz embed edje_test.edc into test_edje.rb
authored May 1, 2011
11 EDC_FILE=File.join '/tmp','edje_test.edc'
12 EDJE_FILE=File.join '/tmp','edje_test.edj'
13 #
e6eb6b7 @jeremyz clean test_edje.rb
authored May 6, 2011
14 txt = ( ARGV.length>0 ? ARGV[0] : nil )
15 #
16 # compile edje_file
fd0042f @jeremyz edje updates
authored May 6, 2011
17 puts "write #{EDC_FILE}"
18 content = DATA.read
19 File.open(EDC_FILE,'w') do |f| f << content end
20 puts "compile #{EDJE_FILE}"
21 system "edje_cc #{EDC_FILE}"
67b6e2f @jeremyz add test_edje and data
authored May 1, 2011
22 #
e6eb6b7 @jeremyz clean test_edje.rb
authored May 6, 2011
23 # load edje
67b6e2f @jeremyz add test_edje and data
authored May 1, 2011
24 def create_my_group canvas, txt
25 edje = canvas.edje_object_add
26 if not edje.file_set EDJE_FILE, "my_group"
27 puts "unable to open #{EDJE_FILE}"
28 exit 1
29 end
fd0042f @jeremyz edje updates
authored May 5, 2011
30 puts "file and group : #{edje.file_get.join ' ; ' }"
31 puts "key1 : #{Efl::Native.edje_file_data_get EDJE_FILE, "key1"}"
32 puts "key2 : #{Efl::Native.edje_object_data_get edje, "key2"}"
67b6e2f @jeremyz add test_edje and data
authored May 1, 2011
33 edje.part_text_set "text", txt unless txt.nil?
34 edje.move 0, 0
35 edje.resize WIDTH, HEIGHT
36 edje.show
37 edje
38 end
39 #
e6eb6b7 @jeremyz clean test_edje.rb
authored May 6, 2011
40 def del_cb ecore_evas
75e1104 @jeremyz tests cleanup
authored May 9, 2011
41 puts "delete request callback"
e6eb6b7 @jeremyz clean test_edje.rb
authored May 6, 2011
42 Efl::Ecore.main_loop_quit
43 end
67b6e2f @jeremyz add test_edje and data
authored May 1, 2011
44 #
75e1104 @jeremyz tests cleanup
authored May 9, 2011
45 Efl::EcoreEvas::init
46 Efl::Edje::init
47 #
67b6e2f @jeremyz add test_edje and data
authored May 1, 2011
48 window = Efl::EcoreEvas::REcoreEvas.new { |w|
49 w.resize WIDTH, HEIGHT
fd0042f @jeremyz edje updates
authored May 5, 2011
50 w.move 100, 100
67b6e2f @jeremyz add test_edje and data
authored May 1, 2011
51 }
e6eb6b7 @jeremyz clean test_edje.rb
authored May 6, 2011
52 window.ecore_evas_callback_delete_request_set method(:del_cb)
67b6e2f @jeremyz add test_edje and data
authored May 1, 2011
53 canvas = window.get
54 edje = create_my_group canvas, txt
55 window.show
56 #
57 Efl::Ecore.main_loop_begin
58 #
59 edje.free
60 window.free
d56f34a @jeremyz embed edje_test.edc into test_edje.rb
authored May 1, 2011
61 #
fd0042f @jeremyz edje updates
authored May 5, 2011
62 Efl::Edje::shutdown
63 Efl::EcoreEvas::shutdown
d56f34a @jeremyz embed edje_test.edc into test_edje.rb
authored May 1, 2011
64
65 __END__
66
fd0042f @jeremyz edje updates
authored May 5, 2011
67 data {
68 item: "key1" "val1";
69 }
d56f34a @jeremyz embed edje_test.edc into test_edje.rb
authored May 1, 2011
70 collections {
71 group {
fd0042f @jeremyz edje updates
authored May 5, 2011
72 name: "my_group";
73 data {
74 item: "key2" "val2";
75 }
d56f34a @jeremyz embed edje_test.edc into test_edje.rb
authored May 1, 2011
76 parts {
77 part {
78 name: "background";
fd0042f @jeremyz edje updates
authored May 5, 2011
79 type: RECT;
80 mouse_events: 0;
d56f34a @jeremyz embed edje_test.edc into test_edje.rb
authored May 1, 2011
81 description {
fd0042f @jeremyz edje updates
authored May 5, 2011
82 state: "default" 0.0;
83 color: 255 255 255 255;
84 rel1 {
d56f34a @jeremyz embed edje_test.edc into test_edje.rb
authored May 1, 2011
85 relative: 0.0 0.0;
86 offset: 0 0;
87 }
fd0042f @jeremyz edje updates
authored May 5, 2011
88 rel2 {
d56f34a @jeremyz embed edje_test.edc into test_edje.rb
authored May 1, 2011
89 relative: 1.0 1.0;
90 offset: -1 -1;
91 }
92 }
93 }
94 part {
95 name: "text";
96 type: TEXT;
fd0042f @jeremyz edje updates
authored May 5, 2011
97 mouse_events: 1;
d56f34a @jeremyz embed edje_test.edc into test_edje.rb
authored May 1, 2011
98 description {
99 state: "default" 0.0;
fd0042f @jeremyz edje updates
authored May 5, 2011
100 color: 255 0 0 255;
101 rel1 {
d56f34a @jeremyz embed edje_test.edc into test_edje.rb
authored May 1, 2011
102 relative: 0.1 0.2;
103 offset: 5 10;
104 }
fd0042f @jeremyz edje updates
authored May 5, 2011
105 rel2 {
d56f34a @jeremyz embed edje_test.edc into test_edje.rb
authored May 1, 2011
106 relative: 0.9 0.8;
107 offset: -6 -11;
108 }
109 text {
fd0042f @jeremyz edje updates
authored May 5, 2011
110 font: "Sans";
d56f34a @jeremyz embed edje_test.edc into test_edje.rb
authored May 1, 2011
111 size: 10;
112 text: "hello world";
113 }
114 }
115 description {
116 state: "over" 0.0;
fd0042f @jeremyz edje updates
authored May 5, 2011
117 inherit: "default" 0.0;
118 color: 0 255 0 255;
d56f34a @jeremyz embed edje_test.edc into test_edje.rb
authored May 1, 2011
119 }
120 }
121 programs {
122 program {
123 signal: "mouse,in";
124 source: "text";
125 action: STATE_SET "over" 0.0;
126 target: "text";
127 transition: LINEAR 0.1;
128 }
129 program {
130 signal: "mouse,out";
131 source: "text";
132 action: STATE_SET "default" 0.0;
133 target: "text";
134 transition: LINEAR 0.1;
135 }
136 }
137 }
138 }
139 }
140
Something went wrong with that request. Please try again.