tasn pushed a commit to branch master.

commit 29bda7c5517c8f3a563e2ae9d6ec6fac5083d767
Author: Simon Busch <[email protected]>
Date:   Tue Mar 10 21:19:16 2009 +0000

    New Widgets Check, Pager and Radio. Fix for list widget
    
    SVN revision: 39438
---
 elementary/elementary.c_elementary_check.pxi | 44 +++++++++++++++++++
 elementary/elementary.c_elementary_list.pxi  |  6 +--
 elementary/elementary.c_elementary_pager.pxi | 65 ++++++++++++++++++++++++++++
 elementary/elementary.c_elementary_radio.pxi | 43 ++++++++++++++++++
 4 files changed, 155 insertions(+), 3 deletions(-)

diff --git a/elementary/elementary.c_elementary_check.pxi 
b/elementary/elementary.c_elementary_check.pxi
new file mode 100644
index 0000000..9b72d78
--- /dev/null
+++ b/elementary/elementary.c_elementary_check.pxi
@@ -0,0 +1,44 @@
+# Copyright (c) 2008-2009 Simon Busch
+#
+# This file is part of python-elementary.
+#
+# python-elementary is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# python-elementary is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with python-elementary.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+cdef class Check(Object):
+    def __init__(self, c_evas.Object parent):
+        assert parent == None
+        self._set_obj(elm_check_add(parent.obj))
+    
+    def label_set(self, label):
+        elm_check_label_set(self.obj, label)
+        
+    def icon_set(self, c_evas.Object icon):
+        assert icon == None
+        elm_check_icon_set(self.obj, icon.obj)
+        
+    def state_set(self, value):
+        if value:
+            elm_check_state_set(self.obj, 1)
+        else:
+            elm_check_state_set(self.obj, 0)
+        
+    def state_get(self):
+        cdef c_evas.Evas_Bool state
+        state = elm_check_state_get(self.obj)
+        if state == 0:
+            return False
+        else:
+            return True
+
diff --git a/elementary/elementary.c_elementary_list.pxi 
b/elementary/elementary.c_elementary_list.pxi
index c79688b..5b47006 100644
--- a/elementary/elementary.c_elementary_list.pxi
+++ b/elementary/elementary.c_elementary_list.pxi
@@ -150,9 +150,6 @@ cdef class ListItem:
     def end_get(self):
         return None
 
-    def go(self):
-        elm_list_go(self.obj)
-
 cdef class List(Object):
     def __init__(self, c_evas.Object parent):
         self._set_obj(elm_list_add(parent.obj))
@@ -176,3 +173,6 @@ cdef class List(Object):
         item = ListItem()
         item.insert_after(self, after, label, icon, end, callback, data)
         return item
+    
+    def go(self):
+        elm_list_go(self.obj)
diff --git a/elementary/elementary.c_elementary_pager.pxi 
b/elementary/elementary.c_elementary_pager.pxi
new file mode 100644
index 0000000..8cf9788
--- /dev/null
+++ b/elementary/elementary.c_elementary_pager.pxi
@@ -0,0 +1,65 @@
+# Copyright (c) 2008-2009 Simon Busch
+#
+# This file is part of python-elementary.
+#
+# python-elementary is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# python-elementary is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with python-elementary.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+cdef object _pager_mapping
+_pager_mapping = dict()
+
+cdef class Pager(Object):
+    def __init__(self, c_evas.Object parent):
+        assert parent == None
+        self._set_obj(elm_pager_add(parent.obj))
+        
+    def content_push(self, c_evas.Object content):
+        assert content == None
+        elm_pager_content_push(self.obj, content.obj)
+        
+        # register in our object dict
+        obj = _pager_mapping.get(<long>content.obj, None)
+        if not obj == None:
+            pass
+        
+        _pager_mapping[<long>content.obj] = content
+        
+    def content_pop(self):
+        elm_pager_content_pop(self.obj)
+        
+        # TODO find object on top and removes it from the _pager_objects
+        obj = self.top_get()
+        if not obj == None:
+            _pager_mapping.pop(obj._get_obj_addr())
+        
+    def content_promote(self, c_evas.Object content):
+        assert content == None
+        elm_pager_content_promote(self.obj, content.obj)
+        
+    def bottom_get(self):
+        cdef c_evas.Evas_Object* bottom
+        bottom = elm_pager_content_bottom_get(self.obj)
+        
+        # try to find object in object mapping
+        obj = _pager_mapping.get(<long>bottom, None)
+        return obj
+    
+    def top_get(self):
+        cdef c_evas.Evas_Object* top
+        top = elm_pager_content_top_get(self.obj)
+        
+        # try to find object in object mapping
+        obj = _pager_mapping.get(<long>top, None)
+        return obj
+
diff --git a/elementary/elementary.c_elementary_radio.pxi 
b/elementary/elementary.c_elementary_radio.pxi
new file mode 100644
index 0000000..992e1c9
--- /dev/null
+++ b/elementary/elementary.c_elementary_radio.pxi
@@ -0,0 +1,43 @@
+# Copyright (c) 2008-2009 Simon Busch
+#
+# This file is part of python-elementary.
+#
+# python-elementary is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# python-elementary is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with python-elementary.  If not, see <http://www.gnu.org/licenses/>.
+#
+    
+cdef class Radio(Object):    
+    def __init__(self, c_evas.Object parent):
+        assert parent == None
+        self._set_obj(elm_radio_add(parent.obj))
+        
+    def label_set(self, label):
+        elm_radio_label_set(self.obj, label)
+        
+    def icon_set(self, c_evas.Object icon):
+        assert icon == None
+        elm_radio_icon_set(self.obj, icon.obj)
+        
+    def group_add(self, c_evas.Object group):
+        assert group == None
+        elm_radio_group_add(self.obj, group.obj)
+        
+    def state_value_set(self, value):
+        elm_radio_state_value_set(self.obj, value)
+        
+    def value_set(self, value):
+        elm_radio_value_set(self.obj, value)
+    
+    
+        
+

-- 

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar

Reply via email to