From: Enlightenment S. <no-...@en...> - 2012-05-12 12:27:52
|
Log: Python: align Clock to C api Author: davemds Date: 2012-05-12 05:27:41 -0700 (Sat, 12 May 2012) New Revision: 70945 Trac: http://trac.enlightenment.org/e/changeset/70945 Modified: trunk/BINDINGS/python/python-elementary/elementary/__init__.py trunk/BINDINGS/python/python-elementary/elementary/elementary.c_elementary_clock.pxi trunk/BINDINGS/python/python-elementary/include/elementary/c_elementary.pxd trunk/BINDINGS/python/python-elementary/tests/test_clock.py Modified: trunk/BINDINGS/python/python-elementary/elementary/__init__.py =================================================================== --- trunk/BINDINGS/python/python-elementary/elementary/__init__.py 2012-05-12 11:51:10 UTC (rev 70944) +++ trunk/BINDINGS/python/python-elementary/elementary/__init__.py 2012-05-12 12:27:41 UTC (rev 70945) @@ -44,6 +44,15 @@ ELM_BUBBLE_POS_BOTTOM_LEFT = 2 ELM_BUBBLE_POS_BOTTOM_RIGHT = 3 +ELM_CLOCK_EDIT_DEFAULT = 0 +ELM_CLOCK_EDIT_HOUR_DECIMAL = 1 << 0 +ELM_CLOCK_EDIT_HOUR_UNIT = 1 << 1 +ELM_CLOCK_EDIT_MIN_DECIMAL = 1 << 2 +ELM_CLOCK_EDIT_MIN_UNIT = 1 << 3 +ELM_CLOCK_EDIT_SEC_DECIMAL = 1 << 4 +ELM_CLOCK_EDIT_SEC_UNIT = 1 << 5 +ELM_CLOCK_EDIT_ALL = (1 << 6) - 1 + ELM_FLIP_ROTATE_Y_CENTER_AXIS = 0 ELM_FLIP_ROTATE_X_CENTER_AXIS = 1 ELM_FLIP_ROTATE_XZ_CENTER_AXIS = 2 Modified: trunk/BINDINGS/python/python-elementary/elementary/elementary.c_elementary_clock.pxi =================================================================== --- trunk/BINDINGS/python/python-elementary/elementary/elementary.c_elementary_clock.pxi 2012-05-12 11:51:10 UTC (rev 70944) +++ trunk/BINDINGS/python/python-elementary/elementary/elementary.c_elementary_clock.pxi 2012-05-12 12:27:41 UTC (rev 70945) @@ -25,27 +25,82 @@ elm_clock_time_set(self.obj, hours, minutes, seconds) def time_get(self): - """ - Returns the current time of the clock + cdef int hrs, min, sec - @rtype: list of int - """ - cdef int hrs - cdef int min - cdef int sec - elm_clock_time_get(self.obj, &hrs, &min, &sec) - return (hrs, min, sec) + property time: + def __get__(self): + return self.time_get() + + def __set__(self, value): + self.time_set(*value) + def edit_set(self, edit): elm_clock_edit_set(self.obj, edit) + def edit_get(self, edit): + return elm_clock_edit_get(self.obj) + + property edit: + def __get__(self): + return self.edit_get() + + def __set__(self, value): + self.edit_set(value) + + def edit_mode_set(self, mode): + elm_clock_edit_mode_set(self.obj, mode) + + def edit_mode_get(self): + return elm_clock_edit_mode_get(self.obj) + + property edit_mode: + def __get__(self): + return self.edit_mode_get() + + def __set__(self, value): + self.edit_mode_set(value) + def show_am_pm_set(self, am_pm): elm_clock_show_am_pm_set(self.obj, am_pm) + def show_am_pm_get(self): + return elm_clock_show_am_pm_get(self.obj) + + property show_am_pm: + def __get__(self): + return self.show_am_pm_get() + + def __set__(self, value): + self.show_am_pm_set(value) + def show_seconds_set(self, seconds): elm_clock_show_seconds_set(self.obj, seconds) + def show_seconds_get(self): + return elm_clock_show_seconds_get(self.obj) + property show_seconds: + def __get__(self): + return self.show_seconds_get() + + def __set__(self, value): + self.show_seconds_set(value) + + def first_interval_set(self, interval): + elm_clock_first_interval_set(self.obj, interval) + + def first_interval_get(self): + return elm_clock_first_interval_get(self.obj) + + property first_interval: + def __get__(self): + return self.first_interval_get() + + def __set__(self, value): + self.first_interval_set(value) + + _elm_widget_type_register("clock", Clock) Modified: trunk/BINDINGS/python/python-elementary/include/elementary/c_elementary.pxd =================================================================== --- trunk/BINDINGS/python/python-elementary/include/elementary/c_elementary.pxd 2012-05-12 11:51:10 UTC (rev 70944) +++ trunk/BINDINGS/python/python-elementary/include/elementary/c_elementary.pxd 2012-05-12 12:27:41 UTC (rev 70945) @@ -65,6 +65,16 @@ ELM_BUBBLE_POS_BOTTOM_LEFT ELM_BUBBLE_POS_BOTTOM_RIGHT + ctypedef enum Elm_Clock_Edit_Mode: + ELM_CLOCK_EDIT_DEFAULT = 0 + ELM_CLOCK_EDIT_HOUR_DECIMAL = 1 << 0 + ELM_CLOCK_EDIT_HOUR_UNIT = 1 << 1 + ELM_CLOCK_EDIT_MIN_DECIMAL = 1 << 2 + ELM_CLOCK_EDIT_MIN_UNIT = 1 << 3 + ELM_CLOCK_EDIT_SEC_DECIMAL = 1 << 4 + ELM_CLOCK_EDIT_SEC_UNIT = 1 << 5 + ELM_CLOCK_EDIT_ALL = (1 << 6) - 1 + ctypedef enum Elm_Win_Type: ELM_WIN_BASIC ELM_WIN_DIALOG_BASIC @@ -467,6 +477,21 @@ void elm_check_state_set(evas.c_evas.Evas_Object *obj, evas.c_evas.Eina_Bool state) evas.c_evas.Eina_Bool elm_check_state_get(evas.c_evas.Evas_Object *obj) + # Clock object (DONE) + evas.c_evas.Evas_Object *elm_clock_add(evas.c_evas.Evas_Object *parent) + void elm_clock_time_set(evas.c_evas.Evas_Object *obj, int hrs, int min, int sec) + void elm_clock_time_get(evas.c_evas.Evas_Object *obj, int *hrs, int *min, int *sec) + void elm_clock_edit_set(evas.c_evas.Evas_Object *obj, evas.c_evas.Eina_Bool edit) + evas.c_evas.Eina_Bool elm_clock_edit_get(evas.c_evas.Evas_Object *obj) + void elm_clock_edit_mode_set(evas.c_evas.Evas_Object *obj, Elm_Clock_Edit_Mode mode) + Elm_Clock_Edit_Mode elm_clock_edit_mode_get(evas.c_evas.Evas_Object *obj) + void elm_clock_show_am_pm_set(evas.c_evas.Evas_Object *obj, evas.c_evas.Eina_Bool am_pm) + evas.c_evas.Eina_Bool elm_clock_show_am_pm_get(evas.c_evas.Evas_Object *obj) + void elm_clock_show_seconds_set(evas.c_evas.Evas_Object *obj, evas.c_evas.Eina_Bool seconds) + evas.c_evas.Eina_Bool elm_clock_show_seconds_get(evas.c_evas.Evas_Object *obj) + void elm_clock_first_interval_set(evas.c_evas.Evas_Object *obj, double interval) + double elm_clock_first_interval_get(evas.c_evas.Evas_Object *obj) + # Icon object evas.c_evas.Evas_Object *elm_icon_add(evas.c_evas.Evas_Object *parent) void elm_icon_file_set(evas.c_evas.Evas_Object *obj, char *file, char *group) @@ -562,14 +587,6 @@ void elm_table_unpack(evas.c_evas.Evas_Object *obj, evas.c_evas.Evas_Object *subobj) void elm_table_clear(evas.c_evas.Evas_Object *obj, evas.c_evas.Eina_Bool clear) - # Clock object - evas.c_evas.Evas_Object *elm_clock_add(evas.c_evas.Evas_Object *parent) - void elm_clock_time_set(evas.c_evas.Evas_Object *obj, int hrs, int min, int sec) - void elm_clock_time_get(evas.c_evas.Evas_Object *obj, int *hrs, int *min, int *sec) - void elm_clock_edit_set(evas.c_evas.Evas_Object *obj, evas.c_evas.Eina_Bool edit) - void elm_clock_show_am_pm_set(evas.c_evas.Evas_Object *obj, evas.c_evas.Eina_Bool am_pm) - void elm_clock_show_seconds_set(evas.c_evas.Evas_Object *obj, evas.c_evas.Eina_Bool seconds) - # Layout object evas.c_evas.Evas_Object *elm_layout_add(evas.c_evas.Evas_Object *parent) evas.c_evas.Eina_Bool elm_layout_file_set(evas.c_evas.Evas_Object *obj, char *file, char *group) Modified: trunk/BINDINGS/python/python-elementary/tests/test_clock.py =================================================================== --- trunk/BINDINGS/python/python-elementary/tests/test_clock.py 2012-05-12 11:51:10 UTC (rev 70944) +++ trunk/BINDINGS/python/python-elementary/tests/test_clock.py 2012-05-12 12:27:41 UTC (rev 70945) @@ -51,6 +51,15 @@ bx.pack_end(ck) ck.show() + ck = elementary.Clock(win) + ck.edit_set(True) + ck.show_seconds_set(True) + ck.edit_mode = elementary.ELM_CLOCK_EDIT_HOUR_DECIMAL | \ + elementary.ELM_CLOCK_EDIT_MIN_DECIMAL | \ + elementary.ELM_CLOCK_EDIT_SEC_DECIMAL + bx.pack_end(ck) + ck.show() + win.show() # }}} |