aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2012-12-17 17:00:29 +0200
committerYakov Goldberg <yakov.g@samsung.com>2012-12-17 17:00:29 +0200
commit27f48694bf3e54d822e3283d608f70462ec3beae (patch)
tree39f8eb1535ae148f0eff2014f5cd5f7888aabd4a /examples
parentRelease 0.0.1 (diff)
parentJS gen: fixes to avoid name clash with 'val'-named var (diff)
downloadeo_bindings-master.tar.gz
Release 0.0.2HEADmaster
'eoparser' package, with tools 'eorepo' is provided with base classes
Diffstat (limited to 'examples')
-rw-r--r--examples/elm_elm.js201
-rw-r--r--examples/elw_button.js159
-rw-r--r--examples/elw_button_new_names.js162
-rw-r--r--examples/elw_button_old.js247
-rw-r--r--examples/elw_eoisa.js24
-rw-r--r--examples/elw_mixin.js18
-rw-r--r--examples/elw_signal.js54
-rw-r--r--examples/evas_elem_test.py66
-rw-r--r--examples/evas_lib_test.py2
-rw-r--r--examples/evas_test.py32
-rw-r--r--examples/evas_test2.py154
-rw-r--r--examples/mixin_test.py13
-rw-r--r--examples/signal_test.py62
-rw-r--r--examples/simple_test.py14
14 files changed, 1163 insertions, 45 deletions
diff --git a/examples/elm_elm.js b/examples/elm_elm.js
new file mode 100644
index 0000000..d8c4f8d
--- /dev/null
+++ b/examples/elm_elm.js
@@ -0,0 +1,201 @@
+//var elm = require('jse');
+var elm = require('jsevaselm');
+
+//var m = new elm.Mixin()
+
+function cb_add(par){
+ print(par.text + ": calback_added")
+}
+
+function cb_del(par){
+ print(par.text + ": calback_deleted")
+}
+
+//==============================
+var global_obj
+
+function freeze_this(par){
+ par.alert("Object: " + par.text)
+ par.alert("Freezing cb for this obj")
+ global_obj = par
+ par.event_freeze()
+ par.alert("Freeze count = " + par.event_freeze_get())
+}
+
+function thaw_cb(par){
+ par.alert("Thawing cb for global_obj")
+ global_obj.event_thaw()
+}
+//==================================
+
+function numbers_cb(par){
+ par.alert("numbers_cb")
+ par.no_par()
+
+ par.ints(0, 0)
+ print (" === Testing int ===")
+
+ o = par.ints(1, 2, 3)
+ par.alert("xx: " + o.xx)
+ par.alert("yy: " + o.yy)
+
+ par.par_by_ref(1, 2, 3)
+
+
+ print (" === Testing floats ===")
+ a = 7.32
+ b = -21474.5134
+ o = par.floats(a, b)
+
+ par.alert("bb: " + o.bb)
+ par.alert("cc: " + o.cc)
+}
+
+function cb3(par)
+{
+ print("callback called for: " + par.text)
+ /*
+ par.alert("getting size")
+
+ o = par.size
+ par.alert("W: " + o.w)
+ par.alert("H: " + o.h)
+
+ o = par.position
+ par.alert("X: " + o.x)
+ par.alert("Y: " + o.y)
+ */
+}
+
+
+var win = elm.ElmWin({
+ evas_obj_size: { w: 300, h: 350},
+ elm_obj_win_title: "My JS window",
+
+ elements: {
+ bg: elm.ElmBg({
+ // text: "Hello",
+ evas_obj_size: {w: 210, h: 60},
+ elm_obj_bg_color: {r: 0, g: 245, b: 255, a: 255},
+ }),
+ shalom_bt: elm.ElmButton({
+ // text: "Hello",
+ evas_obj_position : {x: 30, y: "asdf"},
+ evas_obj_size: {w: 210, h: 60},
+ evas_obj_color: {r: 159, g: 245, b: 255, a: 255},
+ /*
+ eo_ev_callback_add : cb_add,
+ eo_ev_callback_del : cb_del,
+ ev_clicked : cb3
+ */
+ }),
+ ba: elm.ElmButton({
+// text: "(B) ADD cb",
+ evas_obj_position : {x: 30, y: 100},
+ evas_obj_size: {w: 100, h: 50},
+ evas_obj_color: {r: 255, g: 0, b: 255, a: 255},
+// evas_obj_visibility : false,
+ // ev_clicked : cb3
+ }),
+
+ }
+
+});
+/*
+var w = elm.ElwWin({
+ size: { w: 300, h: 350},
+ elements: {
+
+
+ but1: elm.ElwButton({
+ text: "1st but in box",
+ //position : { x: 250, y: 100},
+ //size: { w: 90, h: 20},
+ color: { r: 255, g: 0, b: 255, a: 255},
+ ev_clicked : thaw_cb
+ }),
+
+ but2: elm.ElwButton({
+ text: "2nd but in box",
+ //position : { x: 270, y: 150},
+ //size: { w: 90, h: 50},
+ color: {r: 240, g: 240, b: 0, a: 255},
+ ev_clicked : freeze_this
+ }),
+
+ box : elm.ElwBox ({
+ position : {x: 140, y: 170},
+ size: {w: 100, h: 50},
+ }),
+
+ pb: elm.ElwButton({
+ text: "But in BB (num)",
+ //position : { x: 310, y: 150},
+ //size: { w: 70, h: 50},
+ color: {r: 240, g: 240, b: 245, a: 255},
+ ev_clicked : numbers_cb
+ }),
+
+ ebb: elm.ElwBoxedbutton({
+ text: "BoxedButton",
+ position : {x: 30, y: 170},
+ size: { w: 100, h: 50},
+ color: { r: 100, g: 85, b: 255, a: 255},
+ //ev_clicked : freeze_all,
+ }),
+ }
+});
+*/
+var w = elm.realise(win);
+
+print ("========= DPI ========")
+print (w.elm_obj_win_screen_dpi)
+print ("====================")
+
+print ("==== call for bitton size =====")
+var s = w.elements.ba.evas_obj_size
+print (s)
+print ("==== end call for button size =====")
+
+print ("==== Window size =====")
+print( w.evas_obj_size )
+print ("====================")
+
+//var dpi = e.elements.w.elm_obj_win_screen_dpi
+//print ("DPI: " + dpi)
+
+print ("====================")
+print (w.elm_obj_win_aspect)
+w.elm_obj_win_center(1, 1)
+
+
+
+w.elements.ba.evas_obj_visibility = false
+w.elements.ba.elm_wdg_text_part_set(null, "Button")
+w.elements.shalom_bt.elm_wdg_text_part_set(null, "Big Button")
+w.elements.ba.evas_obj_visibility = true
+var t = w.elements.ba.elm_wdg_text_part_get(null)
+print ("====================")
+print(t)
+print ("====================")
+
+/*
+
+e.elements.box.pack_end(e.elements.but1)
+
+e.elements.box.pack_end(e.elements.but2)
+e.elements.ebb.pack_end(e.elements.pb)
+
+//e.elements.shalom_bt.eo_ev_callback_add = cb_add
+e.elements.shalom_bt.ev_clicked = cb3
+
+
+
+elm.ElwWin.event_global_freeze()
+elm.ElwWin.event_global_thaw()
+
+
+
+
+
+*/
diff --git a/examples/elw_button.js b/examples/elw_button.js
new file mode 100644
index 0000000..b2eefd3
--- /dev/null
+++ b/examples/elw_button.js
@@ -0,0 +1,159 @@
+//var elm = require('jse');
+var elm = require('jse');
+
+//var m = new elm.Mixin()
+
+function cb_add(par){
+ par.alert(par.text + ": calback_added")
+}
+
+function cb_del(par){
+ par.alert(par.text + ": calback_deleted")
+}
+
+//==============================
+var global_obj
+
+function freeze_this(par){
+ par.alert("Object: " + par.text)
+ par.alert("Freezing cb for this obj")
+ global_obj = par
+ par.event_freeze()
+ par.alert("Freeze count = " + par.event_freeze_get())
+}
+
+function thaw_cb(par){
+ par.alert("Thawing cb for global_obj")
+ global_obj.event_thaw()
+}
+//==================================
+
+function numbers_cb(par){
+ par.alert("numbers_cb")
+ par.no_par()
+
+ par.ints(0, 0)
+ print (" === Testing int ===")
+
+ o = par.ints(1, 2, 3)
+ par.alert("xx: " + o.xx)
+ par.alert("yy: " + o.yy)
+
+ par.par_by_ref(1, 2, 3)
+
+
+ print (" === Testing floats ===")
+ a = 7.32
+ b = -21474.5134
+ o = par.floats(a, b)
+
+ par.alert("bb: " + o.bb)
+ par.alert("cc: " + o.cc)
+}
+
+function cb3(par)
+{
+ par.alert("callback called for: " + par.text)
+ par.alert("getting size")
+
+ o = par.size
+ par.alert("W: " + o.w)
+ par.alert("H: " + o.h)
+
+ o = par.position
+ par.alert("X: " + o.x)
+ par.alert("Y: " + o.y)
+}
+
+
+
+var w = elm.ElwWin({
+ size: { w: 300, h: 350},
+ elements: {
+ shalom_bt: elm.ElwButton({
+ text: "Hello",
+ position : {x: 30, y: 30},
+ size: {w: 210, h: 60},
+ color: {r: 159, g: 245, b: 255, a: 255},
+ eo_ev_callback_add : cb_add,
+ eo_ev_callback_del : cb_del,
+ ev_clicked : cb3
+ }),
+
+ ba: elm.ElwButton({
+ text: "(B) ADD cb",
+ position : {x: 30, y: 100},
+ size: {w: 100, h: 50},
+ color: {r: 255, g: 0, b: 255, a: 255},
+ ev_clicked : cb3
+ }),
+
+ red_bt: elm.ElwBoxedbutton({
+ text: "Red button",
+ position : {x: 140, y: 100},
+ size: {w: 100, h: 50},
+ color: {r: 255, g: 0, b: 5, a: 255},
+ ev_clicked : cb3
+
+ }),
+
+ but1: elm.ElwButton({
+ text: "1st but in box",
+ //position : { x: 250, y: 100},
+ //size: { w: 90, h: 20},
+ color: { r: 255, g: 0, b: 255, a: 255},
+ ev_clicked : thaw_cb
+ }),
+
+ but2: elm.ElwButton({
+ text: "2nd but in box",
+ //position : { x: 270, y: 150},
+ //size: { w: 90, h: 50},
+ color: {r: 240, g: 240, b: 0, a: 255},
+ ev_clicked : freeze_this
+ }),
+
+ box : elm.ElwBox ({
+ position : {x: 140, y: 170},
+ size: {w: 100, h: 50},
+ }),
+
+ pb: elm.ElwButton({
+ text: "But in BB (num)",
+ //position : { x: 310, y: 150},
+ //size: { w: 70, h: 50},
+ color: {r: 240, g: 240, b: 245, a: 255},
+ ev_clicked : numbers_cb
+ }),
+
+ ebb: elm.ElwBoxedbutton({
+ text: "BoxedButton",
+ position : {x: 30, y: 170},
+ size: { w: 100, h: 50},
+ color: { r: 100, g: 85, b: 255, a: 255},
+ //ev_clicked : freeze_all,
+ }),
+ }
+});
+
+
+var e = elm.realise(w);
+
+
+e.elements.box.pack_end(e.elements.but1)
+e.elements.box.pack_end(e.elements.but2)
+e.elements.ebb.pack_end(e.elements.pb)
+
+//e.elements.shalom_bt.eo_ev_callback_add = cb_add
+e.elements.shalom_bt.ev_clicked = cb3
+
+
+
+elm.ElwWin.event_global_freeze()
+elm.ElwWin.event_global_thaw()
+
+
+
+
+
+
diff --git a/examples/elw_button_new_names.js b/examples/elw_button_new_names.js
new file mode 100644
index 0000000..7dd40b5
--- /dev/null
+++ b/examples/elw_button_new_names.js
@@ -0,0 +1,162 @@
+//var elm = require('jse');
+var elm = require('jse');
+//var elm = require('/opt/e17/lib/elev8/linux-gnu-i686-0.1.0/libjse.so');
+
+//var m = new elm.Mixin()
+
+function cb_add(par){
+ par.elw_alert_alert(par.elw_button_text + ": calback_added")
+}
+
+function cb_del(par){
+ par.elw_alert_alert(par.elw_button_text + ": calback_deleted")
+}
+
+//==============================
+var global_obj
+
+function freeze_this(par){
+ par.elw_alert_alert("Object: " + par.elw_button_text)
+ par.elw_alert_alert("Freezing cb for this obj")
+ global_obj = par
+ par.event_freeze()
+ par.elw_alert_alert("Freeze count = " + par.event_freeze_get())
+}
+
+function thaw_cb(par){
+ par.elw_alert_alert("Thawing cb for global_obj")
+ global_obj.event_thaw()
+}
+//==================================
+
+function numbers_cb(par){
+ par.elw_alert_alert("numbers_cb")
+ par.no_par()
+
+ par.ints(0, 0)
+ print (" === Testing int ===")
+
+ o = par.ints(1, 2, 3)
+ par.elw_alert_alert("xx: " + o.xx)
+ par.elw_alert_alert("yy: " + o.yy)
+
+ par.par_by_ref(1, 2, 3)
+
+
+ print (" === Testing floats ===")
+ a = 7.32
+ b = -21474.5134
+ o = par.floats(a, b)
+
+ par.elw_alert_alert("bb: " + o.bb)
+ par.elw_alert_alert("cc: " + o.cc)
+}
+
+function cb3(par, f)
+{
+ print(par)
+ print(f)
+ par.elw_alert_alert("callback called for: " + par.elw_button_text)
+ par.elw_alert_alert("getting size")
+
+ o = par.exevas_obj_size
+ par.elw_alert_alert("W: " + o.w)
+ par.elw_alert_alert("H: " + o.h)
+
+ o = par.exevas_obj_position
+ par.elw_alert_alert("X: " + o.x)
+ par.elw_alert_alert("Y: " + o.y)
+}
+
+
+
+var w = elm.ElwWin({
+ exevas_obj_size: { w: 300, h: 350},
+ elements: {
+ shalom_bt: elm.ElwButton({
+ elw_button_text: "Hello",
+ exevas_obj_position : {x: 30, y: 30},
+ exevas_obj_size: {w: 210, h: 60},
+ exevas_obj_color: {r: 159, g: 245, b: 255, a: 255},
+ eo_ev_callback_add : cb_add,
+ eo_ev_callback_del : cb_del,
+ ev_clicked : cb3
+ }),
+
+ ba: elm.ElwButton({
+ elw_button_text: "(B) ADD cb",
+ exevas_obj_position : {x: 30, y: 100},
+ exevas_obj_size: {w: 100, h: 50},
+ exevas_obj_color: {r: 255, g: 0, b: 255, a: 255},
+ ev_clicked : cb3
+ }),
+
+ red_bt: elm.ElwBoxedbutton({
+ elw_button_text: "Red button",
+ exevas_obj_position : {x: 140, y: 100},
+ exevas_obj_size: {w: 100, h: 50},
+ exevas_obj_color: {r: 255, g: 0, b: 5, a: 255},
+ ev_clicked : cb3
+
+ }),
+
+ but1: elm.ElwButton({
+ elw_button_text: "1st but in box",
+ //exevas_obj_position : { x: 250, y: 100},
+ //exevas_obj_size: { w: 90, h: 20},
+ exevas_obj_color: { r: 255, g: 0, b: 255, a: 255},
+ ev_clicked : thaw_cb
+ }),
+
+ but2: elm.ElwButton({
+ elw_button_text: "2nd but in box",
+ //exevas_obj_position : { x: 270, y: 150},
+ //exevas_obj_size: { w: 90, h: 50},
+ exevas_obj_color: {r: 240, g: 240, b: 0, a: 255},
+ ev_clicked : freeze_this
+ }),
+
+ box : elm.ElwBox ({
+ exevas_obj_position : {x: 140, y: 170},
+ exevas_obj_size: {w: 100, h: 50},
+ }),
+
+ pb: elm.ElwButton({
+ elw_button_text: "But in BB (num)",
+ //exevas_obj_position : { x: 310, y: 150},
+ //exevas_obj_size: { w: 70, h: 50},
+ exevas_obj_color: {r: 240, g: 240, b: 245, a: 255},
+ ev_clicked : numbers_cb
+ }),
+
+ ebb: elm.ElwBoxedbutton({
+ elw_button_text: "BoxedButton",
+ exevas_obj_position : {x: 30, y: 170},
+ exevas_obj_size: { w: 100, h: 50},
+ exevas_obj_color: { r: 100, g: 85, b: 255, a: 255},
+ //ev_clicked : freeze_all,
+ }),
+ }
+});
+
+
+var e = elm.realise(w);
+
+
+e.elements.box.elw_box_pack_end(e.elements.but1)
+e.elements.box.elw_box_pack_end(e.elements.but2)
+e.elements.ebb.elw_box_pack_end(e.elements.pb)
+
+//e.elements.shalom_bt.eo_ev_callback_add = cb_add
+e.elements.shalom_bt.ev_clicked = cb3
+
+
+
+elm.ElwWin.event_global_freeze()
+elm.ElwWin.event_global_thaw()
+
+
+
+
+
+
diff --git a/examples/elw_button_old.js b/examples/elw_button_old.js
new file mode 100644
index 0000000..f71790a
--- /dev/null
+++ b/examples/elw_button_old.js
@@ -0,0 +1,247 @@
+var elm = require('elm');
+//var m = new elm.Mixin()
+
+function cb_add(par){
+ par.alert(par.text + ": calback_added")
+}
+
+function cb_del(par){
+ par.alert(par.text + ": calback_deleted")
+}
+
+//==============================
+var global_obj
+
+function freeze_this(par){
+ par.alert("Object: " + par.text)
+ par.alert("Freezing cb for this obj")
+ global_obj = par
+ par.event_freeze()
+ par.alert("Freeze count = " + par.event_freeze_get())
+}
+
+function thaw_cb(par){
+ par.alert("Thawing cb for global_obj")
+ global_obj.event_thaw()
+}
+//==================================
+
+function numbers_cb(par){
+ par.alert("numbers_cb")
+ par.no_par()
+
+ par.ints(0, 0)
+ print (" === Testing int ===")
+
+ o = par.ints(1, 2, 3)
+ par.alert("xx: " + o.xx)
+ par.alert("yy: " + o.yy)
+
+ par.par_by_ref(1, 2, 3)
+
+ // par.floats(0.6, 43.345)
+ print (" === Testing floats ===")
+ a = 7.32
+ b = -21474.5134
+ o = par.floats(a, b)
+
+ par.alert("bb: " + o.bb)
+ par.alert("cc: " + o.cc)
+
+
+}
+
+function cb3(par){
+ par.alert("callback called for: " + par.text)
+ par.alert("getting size")
+
+ o = par.size
+ par.alert("W: " + o.w)
+ par.alert("H: " + o.h)
+
+ o = par.position
+ par.alert("X: " + o.x)
+ par.alert("Y: " + o.y)
+}
+
+var w = elm.ElwWin({
+ size: { w: 300, h: 350},
+ elements: {
+ shalom_bt: elm.ElwButton({
+ text: "שלום",
+ position : { x: 30, y: 30},
+ size: { w: 210, h: 60},
+ color: { r: 159, g: 245, b: 255, a: 255},
+ eo_ev_callback_add : cb_add,
+ eo_ev_callback_del : cb_del,
+ ev_clicked : cb3
+ }),
+
+ ba: elm.ElwButton({
+ text: "(B) ADD cb",
+ position : { x: 30, y: 100},
+ size: { w: 100, h: 50},
+ color: { r: 255, g: 0, b: 255, a: 255},
+ ev_clicked : cb3
+ }),
+
+ red_bt: elm.ElwBoxedbutton({
+ text: "Красная кнопка",
+ position : { x: 140, y: 100},
+ size: { w: 100, h: 50},
+ color: { r: 255, g: 0, b: 5, a: 255},
+ //ev_clicked : cb2
+
+ }),
+
+ but1: elm.ElwButton({
+ text: "1st but in box (thaw_cb)",
+ //position : { x: 250, y: 100},
+ //size: { w: 90, h: 20},
+ color: { r: 255, g: 0, b: 255, a: 255},
+ ev_clicked : thaw_cb
+ }),
+
+ but2: elm.ElwButton({
+ text: "2nd but in box (freeze_this)",
+ //position : { x: 270, y: 150},
+ //size: { w: 90, h: 50},
+ color: { r: 240, g: 240, b: 0, a: 255},
+ ev_clicked : freeze_this
+
+ }),
+
+ box : elm.ElwBox ({
+ position : {x: 140, y: 170},
+ size: { w: 50, h: 100},
+
+ }),
+
+ pb: elm.ElwButton({
+ text: "But in BB (num)",
+ // position : { x: 310, y: 150},
+ // size: { w: 70, h: 50},
+ color: { r: 240, g: 240, b: 245, a: 255},
+ ev_clicked : numbers_cb
+
+ }),
+
+ ebb: elm.ElwBoxedbutton({
+ text: "BoxedButton",
+ position : { x: 30, y: 170},
+ size: { w: 100, h: 50},
+ color: { r: 100, g: 85, b: 255, a: 255},
+ //ev_clicked : freeze_all,
+ }),
+
+/*
+ bb2: elm.ElwBoxedbutton({
+ text: "BoxedButton",
+// mixin: "hello, שלום, привет",
+ position : { x: 180, y: 250},
+ size: { w: 100, h: 65},
+ color: { r: 0, g: 255, b: 0, a: 255},
+ ev_clicked : cb2,
+ // on_test : cb1,
+
+/*
+ disabled1: elm.Button({
+ text: "Dis1",
+ x: 10,
+ y: 160,
+ width: 100,
+ height: 15,
+ enabled: true,
+ on_click : ff,
+ }),
+
+ disabled2: elm.Button({
+ text: "Dis2",
+ x: 10,
+ y: 190,
+ width: 100,
+ height: 15,
+ enabled: true,
+ on_click : ff,
+ }),
+*/
+/*
+ bb2: elm.ElwBoxedbutton({
+ text: "BoxedButton",
+// mixin: "hello, שלום, привет",
+ position : { x: 180, y: 250},
+ size: { w: 100, h: 65},
+ color: { r: 0, g: 255, b: 0, a: 255},
+ ev_clicked : cb2,
+ // on_test : cb1,
+
+ elements : {
+ label_only: elm.ElwButton({
+ color: { r: 10, g: 20, b: 30, a: 255},
+ text: "button in the boxedbutton!",
+ size: { w: 80, h: 65},
+ }),
+ },
+ }),
+*/
+
+/*
+ disabled: elm.Button({
+ text: "Don",
+ x: 10,
+ y: 160,
+ width: 100,
+ height: 300,
+ enabled: true
+ }),
+
+ label_only: elm.Button({
+ weight: { x: 1.0, y: 1.0 },
+ style: "anchor",
+ text: "hello!",
+ x: 110,
+ y: 260,
+ width: 80,
+ height: 65
+ }),
+*/
+/*
+ hbox2 : elm.ElwBox ({
+ position : {x: 90, y: 180},
+
+ elements : {
+ label_only2: elm.ElwButton({
+ text: "button in the box! + exit()",
+ // pos : {x: 110, y: 260},
+ color: { r: 0, g: 5, b: 255, a: 255},
+ size: { w: 80, h: 65},
+ on_test: function(par){
+ par.alert("close application")
+ elm.exit()
+ }
+
+ }),
+ },
+ }),
+*/
+
+ }
+});
+
+
+var e = elm.realise(w);
+
+e.elements.box.pack_end(e.elements.but1)
+e.elements.box.pack_end(e.elements.but2)
+e.elements.ebb.pack_end(e.elements.pb)
+
+//e.elements.shalom_bt.eo_ev_callback_add = cb_add
+e.elements.shalom_bt.ev_clicked = cb3
+
+
+
+elm.ElwWin.event_global_freeze()
+elm.ElwWin.event_global_thaw()
+
+
+
diff --git a/examples/elw_eoisa.js b/examples/elw_eoisa.js
new file mode 100644
index 0000000..636f362
--- /dev/null
+++ b/examples/elw_eoisa.js
@@ -0,0 +1,24 @@
+//var elm = require('jstest');
+var elm = require('jseoisa');
+
+var so = new elm.Simple()
+
+so.a = 2
+a = so.a
+a2 = so.a_square
+a3 = so.a_power_3
+print("a = " + a + "; a^2 = " + a2 + "; a^3 = " + a3)
+
+print("*******************************\n")
+
+
+var co = new elm.Complex()
+co.a = 3
+a = co.a
+a2 = co.a_square
+a3 = co.a_power_3
+print("a = " + a + "; a^2 = " + a2 + "; a^3 = " + a3)
+
+elm.exit()
+
+
diff --git a/examples/elw_mixin.js b/examples/elw_mixin.js
new file mode 100644
index 0000000..e505714
--- /dev/null
+++ b/examples/elw_mixin.js
@@ -0,0 +1,18 @@
+var elm = require('jsmixin');
+
+var obj1 = new elm.Simple({a:5, b:5})
+
+obj1.a = 1
+obj1.b = 2
+sum = obj1.ab_sum
+
+print("Sum for obj1: " + sum)
+
+
+var obj2 = elm.Simple({a:3, b:4})
+var e = elm.realise(obj2)
+
+sum = e.ab_sum
+print("Sum for obj1: " + sum)
+
+elm.exit()
diff --git a/examples/elw_signal.js b/examples/elw_signal.js
new file mode 100644
index 0000000..ef47d46
--- /dev/null
+++ b/examples/elw_signal.js
@@ -0,0 +1,54 @@
+var elm = require('jssignal');
+
+
+function cb_add(par){
+ print("Callback on callback adding")
+}
+
+var poo = function(pa){
+ print("Callback on changing: a = " + pa.a);
+}
+
+
+var ms = new elm.Simple()
+
+print("\nSetting a...")
+ms.a = 12345678
+print("a = " + ms.a + "\n")
+
+print("\nAdding callback...")
+ms.eo_ev_callback_add = cb_add
+ms.ev_a_changed = poo
+
+print("\nSetting b(a) to 896...")
+ms.b = 896
+print("Reading \"b\" (no getter for \"b\" prop): " + ms.b)
+
+
+print("\nSetting c(a) to 123...")
+ms.c = 123
+print("Reading \"c\" (no setter for \"c\" prop, so it should be 896): " + ms.c + "\n")
+
+
+
+print("\nFreezing callback...")
+ms.event_freeze()
+ms.a = 123
+
+print("\nThawing callback...")
+ms.event_thaw()
+ms.a = 123
+
+
+
+/*
+
+var ss = elm.realise(elm.Simple({a:5, on_change:poo, b:55}))
+
+ss.ev_a_changed = cb
+ss.a = 123
+*/
+
+elm.exit()
+
+
diff --git a/examples/evas_elem_test.py b/examples/evas_elem_test.py
new file mode 100644
index 0000000..62d1a14
--- /dev/null
+++ b/examples/evas_elem_test.py
@@ -0,0 +1,66 @@
+# -*- coding: UTF-8 -*-
+import sys
+
+from eorepo.evas_elem_py import elm_init, elm_run
+#from eobase import EoBase
+#from evas_lib.py.evas_l import Evas, EvasObjectRectangle, EvasObjectLine
+from eorepo.evas_elem_py import ElmWin, ElmBg, ElmBox, ElmButton
+
+print "Initializing Elementary..."
+print "Init res:", elm_init(sys.argv)
+print ""
+
+w1 = ElmWin(None, "my win name", 0)
+w1.elm_obj_win_title_set("first_title")
+t = w1.elm_obj_win_title_get()
+print "title:", t
+w1.evas_obj_size_set(370, 350)
+xx,yy = w1.evas_obj_size_get()
+print "size : " , xx, yy
+w1.evas_obj_visibility_set(1)
+v = w1.evas_obj_visibility_get()
+print "v=", v
+
+bg = ElmBg(w1)
+bg.evas_obj_size_hint_weight_set(1.0, 1.0)
+w1.elm_obj_win_resize_object_add(bg)
+bg.evas_obj_visibility_set(1)
+
+
+box = ElmBox(w1)
+box.evas_obj_size_hint_weight_set(1.0, 1.0)
+w1.elm_obj_win_resize_object_add(box)
+box.evas_obj_visibility_set(1)
+
+but = ElmButton(w1)
+box.elm_obj_box_pack_end(but)
+but.evas_obj_visibility_set(1)
+but.evas_obj_color_set(255, 255, 0, 255)
+but.elm_wdg_text_part_set(None, "Button")
+but.evas_obj_size_set(100, 30)
+
+d = w1.elm_obj_win_screen_dpi_get()
+print d
+d = w1.elm_obj_win_role_get()
+print d
+#d = w1.fullscreen_set(1)
+
+
+elm_run()
+
+"""
+ev = Evas(None)
+rect = EvasObjectRectangle(ev)
+line = EvasObjectLine(ev)
+
+rect.color_set(255, 55, 0, 255)
+r, g, b, a = rect.color_get()
+print "%d %d %d %d"%(r, g, b, a)
+print "=================="
+
+line.xy_set(0, 0, 10, 20)
+r, g, b, a = line.xy_get()
+print "%d %d %d %d"%(r, g, b, a)
+print "=================="
+"""
+
diff --git a/examples/evas_lib_test.py b/examples/evas_lib_test.py
index 248ca86..f0f289f 100644
--- a/examples/evas_lib_test.py
+++ b/examples/evas_lib_test.py
@@ -4,7 +4,7 @@ import sys
from base.eodefault import py_elm_init, elem_run
from eobase import EoBase
#from evas_lib.py.evas_l import Evas, EvasObjectRectangle, EvasObjectLine
-from tmp2.evas_l import Evas, EvasObjectRectangle, EvasObjectLine
+from evas_lib.py.evas_l import Evas, EvasObjectRectangle, EvasObjectLine
ev = Evas(None)
rect = EvasObjectRectangle(ev)
diff --git a/examples/evas_test.py b/examples/evas_test.py
index fced191..2a15b9b 100644
--- a/examples/evas_test.py
+++ b/examples/evas_test.py
@@ -3,7 +3,7 @@ import sys
from base.eodefault import py_elm_init, elem_run
from eobase import EoBase
-from evas.py.py_evas import ElwWin, ElwBox, ElwButton, ElwBoxedbutton, EvasObject
+from evas.py.evas_py import ElwWin, ElwBox, ElwButton, ElwBoxedbutton, ExEvasObject
print "Initializing Elementary..."
@@ -41,19 +41,20 @@ def properties_cb(obj):
######################## setting data ##########################
def data_cb(obj):
- print "setting data"
+ print "setting data - int : 5"
i = 5
obj.data_set("int", i)
i = 999999
f = obj.data_get("int")
+ print "getting data"
print f, type(f)
f = obj.data_del("int")
#ebb.data_set("list", ["a", "bb", "cc", "asdfasfd", "1234124", "asdf", "123", "12"])
-#ebb.data_set("list", ["xx", "yy", "zz"])
-#f = ebb.data_get("list")
-#print f, type(f)
+ #ebb.data_set("list", ["xx", "yy", "zz"])
+ #f = ebb.data_get("list")
+ #print f, type(f)
#l = ["a", "b", "c", "asd", "123"]
#ebb.data_set("list2", l)
@@ -62,12 +63,14 @@ def data_cb(obj):
# f = obj.data_get("list2")
# print f, type(f)
+ print "setting data - char : string data"
obj.data_set("char", "string data")
f = obj.data_get("char")
print f, type(f)
obj.data_set("object",pb)
f = obj.data_get("object")
+ print "getting data"
print f, type(f)
#f.text_set("neeew name")
#f = ebb.data_del("object")
@@ -133,21 +136,21 @@ def num_cb(obj):
def cb_add(o):
- o.alert("obj: " + o.text_get() + "; Added: cb_add")
+ o.alert(" obj: " + o.text_get() + "; cb_added")
def cb_del(o):
- o.alert("obj: " + o.text_get() + "; Added: cb_del")
+ o.alert(" obj: " + o.text_get() + "; cb_deleted")
def thaw_ba(o):
- print "size:", o.size_get()
+ print " size:", o.size_get()
p_but.event_thaw()
def cb_clicked(o):
- o.alert("obj: " + o.text_get())
+ o.alert(" obj: " + o.text_get())
w1 = ElwWin(None)
-w1.size_set(270, 350)
+w1.size_set(370, 350)
w1.visibility_set(1)
@@ -160,11 +163,14 @@ bt.color_set(159, 245, 255, 255)
bt.text_set("Hello")
bt.visibility_set(1)
+print "> adding cb on CALLBACK_ADD"
bt.event_callback_priority_add(EoBase.CALLBACK_ADD, -100, cb_add)
+print "> adding cb on CALLBACK_DEL"
bt.event_callback_priority_add(EoBase.CALLBACK_DEL, 0, cb_del)
-print "adding clicked"
+print "> adding cb on CLICKED"
bt.event_callback_priority_add(ElwButton.CLICKED, -100, cb_clicked)
#bt.event_callback_priority_add(ElwButton.CLICKED, -200, thaw_ba)
+print "> adding cb on CLICKED"
bt.event_callback_priority_add(ElwButton.CLICKED, -200, properties_cb)
del w
@@ -206,7 +212,7 @@ but.visibility_set(1)
#but.position_set(250, 100)
but.size_set(90, 20)
but.color_set(255, 0, 255, 255)
-but.text_set("1st button in box")
+but.text_set("1st button in box - gl_thaw")
but.event_callback_priority_add(ElwButton.CLICKED, 0, thaw_global)
@@ -216,7 +222,7 @@ but2.visibility_set(1)
#but2.position_set(270, 150)
#but2.size_set(90, 50)
but2.color_set(255, 255, 0, 255)
-but2.text_set("2nd button in box")
+but2.text_set("2nd button in box - freeze cb")
but2.event_callback_priority_add(ElwButton.CLICKED, 0, freeze_me)
diff --git a/examples/evas_test2.py b/examples/evas_test2.py
new file mode 100644
index 0000000..900f2da
--- /dev/null
+++ b/examples/evas_test2.py
@@ -0,0 +1,154 @@
+# -*- coding: UTF-8 -*-
+import sys
+
+
+from eorepo.eobase import EoBase
+from eorepo.evas_py import ElwWin, ElwBox, ElwButton, ElwBoxedbutton, ExEvasObject
+from eorepo.evas_py import elm_run, elm_init
+
+
+lst = [56, "elm", 56.76]
+
+print "Initializing Elementary..."
+print "Init res:", elm_init(sys.argv)
+print ""
+
+global_obj = None
+
+
+def freeze_me(obj):
+ global global_obj
+ global_obj = obj
+ obj.event_freeze()
+ obj.elw_alert_alert("obl: " + obj.text_get() + "; freezing events; count: " + str(obj.event_freeze_get()))
+
+
+def thaw_global(obj):
+ global global_obj
+ if global_obj.event_freeze_get() == 0:
+ return
+ obj.alert("thawing global")
+ global_obj.event_thaw()
+
+
+######################## setting data ##########################
+def properties_cb(obj, data):
+ a,b,c,d = obj.exevas_obj_color_get()
+ print "color : ", a, b, c, d
+ ww,hh = obj.exevas_obj_size_get()
+ xx,yy = obj.exevas_obj_position_get()
+ print "size : " + str((ww, hh)) + "; pos: " + str((xx, yy))
+
+ obj.exevas_obj_size_set(ww-1, hh)
+ obj.exevas_obj_color_set(a-5, b, c-10, d)
+
+######################## setting data ##########################
+def data_cb(obj, data):
+ print "setting data - int : 5"
+ i = 5
+ obj.data_set("int", i)
+ i = 999999
+
+ f = obj.data_get("int")
+ print "getting data"
+ print f, type(f)
+ f = obj.data_del("int")
+
+#ebb.data_set("list", ["a", "bb", "cc", "asdfasfd", "1234124", "asdf", "123", "12"])
+ #ebb.data_set("list", ["xx", "yy", "zz"])
+ #f = ebb.data_get("list")
+ #print f, type(f)
+
+#l = ["a", "b", "c", "asd", "123"]
+#ebb.data_set("list2", l)
+#l[0] = "12341234124"
+#del l
+# f = obj.data_get("list2")
+# print f, type(f)
+
+ print "setting data - char : string data"
+ obj.data_set("char", "string data")
+ f = obj.data_get("char")
+ print f, type(f)
+
+ obj.data_set("object",pb)
+ f = obj.data_get("object")
+ print "getting data"
+ print f, type(f)
+#f.text_set("neeew name")
+#f = ebb.data_del("object")
+
+
+
+
+def cb_add(o, data):
+ o.elw_alert_alert(" obj: " + o.elw_button_text_get() + "; cb_added")
+
+def cb_del(o, data):
+ o.elw_alert_alert(" obj: " + o.elw_button_text_get() + "; cb_deleted")
+
+def thaw_ba(o, data):
+ print " size:", o.size_get()
+ p_but.event_thaw()
+
+def cb_clicked(o, data):
+ print o
+ o.elw_alert_alert(" obj: " + o.elw_button_text_get())
+ print "=== data ==="
+ d = data
+ print d
+ print "======"
+ lst.append("!")
+
+
+w1 = ElwWin(None)
+w1.exevas_obj_size_set(370, 350)
+w1.exevas_obj_visibility_set(1)
+
+
+w = w1
+
+bt = ElwButton(w)
+bt.exevas_obj_position_set(30, 30)
+bt.exevas_obj_size_set(210, 60)
+bt.exevas_obj_color_set(159, 245, 255, 255)
+bt.elw_button_text_set("Hello")
+bt.exevas_obj_visibility_set(1)
+
+print "\n> adding cb on CALLBACK_ADD"
+cb_obj1 = (cb_add, None)
+bt.event_callback_priority_add(EoBase.CALLBACK_ADD, -100, cb_obj1)
+print "\n> adding cb on CALLBACK_DEL"
+cb_obj2 = (cb_del, None)
+bt.event_callback_priority_add(EoBase.CALLBACK_DEL, 0, cb_obj2)
+print "\n> adding cb on CLICKED"
+
+cb_obj3 = (cb_clicked, None)
+bt.event_callback_priority_add(ElwButton.CLICKED, -100, cb_obj3)
+#bt.event_callback_priority_add(ElwButton.CLICKED, -200, thaw_ba)
+print "\n> adding cb on CLICKED"
+cb_obj4 = (properties_cb, None)
+bt.event_callback_priority_add(ElwButton.CLICKED, -200, cb_obj4)
+
+del w
+w = bt.parent_get()
+print type(w)
+
+ba = ElwButton(w);
+ba.exevas_obj_visibility_set(1)
+ba.exevas_obj_position_set(30, 100)
+ba.elw_button_text_set("(B) ADD cb")
+ba.exevas_obj_size_set(100, 50)
+ba.exevas_obj_color_set(255, 0, 255, 255)
+
+
+
+cb_obj5 = (cb_clicked, lst)
+print cb_obj5
+ba.event_callback_priority_add(ElwButton.CLICKED, 0, cb_obj5)
+#ba.event_callback_del(ElwButton.CLICKED, cb_obj5)
+
+print "Running Elementary..."
+
+elm_run()
+
diff --git a/examples/mixin_test.py b/examples/mixin_test.py
index 869dc49..e7b44fd 100644
--- a/examples/mixin_test.py
+++ b/examples/mixin_test.py
@@ -4,20 +4,23 @@
import sys
from base.eodefault import *
-from mixin.mixin_py import Simple
+from mixin.py.mixin_py import Simple
sobj = Simple(None)
-print "ref: ", sobj.ref_get()
sobj.a_set(1)
sobj.b_set(2)
-sobj.a_get()
-sobj.b_get()
-sobj.ab_sum_get()
+a = sobj.a_get()
+b = sobj.b_get()
+s = sobj.ab_sum_get()
+print a + b + 2 == s
+"""
sobj.ab_sum_get()
sobj.ab_sum_get()
+"""
+print "suuuuper..."
super(Simple,sobj).ab_sum_get()
print "end"
diff --git a/examples/signal_test.py b/examples/signal_test.py
index 0f3dc9c..e86b3c3 100644
--- a/examples/signal_test.py
+++ b/examples/signal_test.py
@@ -1,52 +1,63 @@
# -*- coding: UTF-8 -*-
-from base.eodefault import *
-from eobase import EoBase
-from signals.signals_py import Simple
+from eoeoeo.eodefault import *#for CALLBACK_STOP
+from eoeoeo.eobase import EoBase
+from eoeoeo.signals_py import Simple
-def cb_del(o):
+def cb_del(o, d):
print "OBJECT DELETED"
-def cb_free(o):
+_o_cb_del = (cb_del, None)
+
+def cb_free(o, d):
print "OBJECT FREED"
-def cb_a_changed(o):
+_o_cb_free = (cb_free, None)
+
+def cb_a_changed(o, d):
print "A_CHANGED"
-def cb_a_changed_stop(o):
+_o_cb_a_changed = (cb_a_changed, None)
+
+def cb_a_changed_stop(o, d):
print "A_CHANGED_STOP"
return CALLBACK_STOP
+_o_cb_a_changed_stop = (cb_a_changed_stop, None)
-def cb_add(o):
+def cb_add(o, d):
print "CALBACK_ADD"
-def cb_del(o):
+
+_o_cb_add = (cb_add, None)
+
+def cb_del(o, d):
print "CALBACK_DEL"
+_o_cb_del = (cb_del, None)
+
print "Creating Simple object"
sobj = Simple(None)
-
print "adding event on EV_DELETING"
-sobj.event_callback_priority_add(EoBase.DEL, 0, cb_del)
+sobj.event_callback_priority_add(EoBase.DEL, 0, _o_cb_del)
print "adding event on CHANGING"
-sobj.event_callback_priority_add(Simple.A_CHANGED, 0, cb_a_changed)
+sobj.event_callback_priority_add(Simple.A_CHANGED, 0, _o_cb_a_changed)
print "adding event on EV_ADDING"
-sobj.event_callback_priority_add(EoBase.CALLBACK_ADD, 0, cb_add)
+sobj.event_callback_priority_add(EoBase.CALLBACK_ADD, 0, _o_cb_add)
print "adding 2 events on EV_DELETING"
-sobj.event_callback_priority_add(EoBase.CALLBACK_DEL, 0, cb_del)
-sobj.event_callback_priority_add(EoBase.CALLBACK_DEL, 0, cb_del)
+sobj.event_callback_priority_add(EoBase.CALLBACK_DEL, 0, _o_cb_del)
+sobj.event_callback_priority_add(EoBase.CALLBACK_DEL, 0, _o_cb_del)
print "adding event on CHANGING"
-sobj.event_callback_priority_add(Simple.A_CHANGED, 0, cb_a_changed)
+sobj.event_callback_priority_add(Simple.A_CHANGED, 0, _o_cb_a_changed)
print "adding 2nd event on ADDING"
-sobj.event_callback_priority_add(EoBase.CALLBACK_ADD, 0, cb_add)
+sobj.event_callback_priority_add(EoBase.CALLBACK_ADD, 0, _o_cb_add)
-sobj.a_set(4)
+sobj.simple_a_set(4)
print "deleting event on EV_ADDING"
sobj.event_callback_del(EoBase.CALLBACK_ADD, cb_add)
@@ -55,16 +66,15 @@ print "deleting event on EV_DELETING"
sobj.event_callback_del(EoBase.CALLBACK_DEL, cb_del)
print "adding 4 events on CHANGING, second is STOP"
-sobj.event_callback_priority_add(Simple.A_CHANGED, 0, cb_a_changed)
-sobj.event_callback_priority_add(Simple.A_CHANGED, 0, cb_a_changed_stop)
-sobj.event_callback_priority_add(Simple.A_CHANGED, 0, cb_a_changed)
-sobj.event_callback_priority_add(Simple.A_CHANGED, 0, cb_a_changed)
-
-sobj.a_set(5)
+sobj.event_callback_priority_add(Simple.A_CHANGED, 0, _o_cb_a_changed)
+sobj.event_callback_priority_add(Simple.A_CHANGED, 0, _o_cb_a_changed_stop)
+sobj.event_callback_priority_add(Simple.A_CHANGED, 0, _o_cb_a_changed)
+sobj.event_callback_priority_add(Simple.A_CHANGED, 0, _o_cb_a_changed)
+sobj.simple_a_set(5)
print "deleting event on CHANGING"
-res = sobj.event_callback_del(Simple.A_CHANGED, cb_a_changed)
+res = sobj.event_callback_del(Simple.A_CHANGED, _o_cb_a_changed)
print "Res:", res
print "explicitly calling ON_CHANGE"
@@ -74,7 +84,7 @@ print "Res:", res
sobj.event_global_freeze()
-sobj.a_set(89)
+sobj.simple_a_set(89)
#sobj.b_set(8)
#res = sobj.c_get()
diff --git a/examples/simple_test.py b/examples/simple_test.py
new file mode 100644
index 0000000..7d1e98a
--- /dev/null
+++ b/examples/simple_test.py
@@ -0,0 +1,14 @@
+# -*- coding: UTF-8 -*-
+
+from simple.py.simple_py import Simple, Mixin, Interface
+
+so = Simple(None)
+
+so.a_set(4)
+
+a = so.a_get()
+a2 = so.a_square_get()
+a3 = so.a_power_3_get()
+
+print "a = %d; a^2 = %d; a^3 = %d " %(a, a2, a3)
+