Attached is a patch to add handling for Hover with the Entry anchor, and
updated test script.
Tue, 10 Apr 2012 19:02:44 +0900
Daniel Juyung Seo <seojuyu...@gmail.com> kirjoitti:
> It looks good to me. But I hope other efl-python experts can review
> this. Anyhow, in SVN. Thanks.
>
> Daniel Juyung Seo (SeoZ)
>
> On Mon, Apr 9, 2012 at 5:43 AM, Kai Huuhko <kai.huu...@gmail.com>
> wrote:
> > Attached is a patch which makes the callback receive event_info
> > with a conversion function. I used the old AnchorBlock widget as
> > reference. It still doesn't open Hover, should this be done in the
> > conversion code?
> >
> > Wed, 4 Apr 2012 13:48:28 +0300
> > Kai Huuhko <kai.huu...@gmail.com> kirjoitti:
> >
> >> Attached is a simple test to demonstrate this.
> >>
> >> I get this output:
> >>
> >> Entry object is Entry(name=%r, geometry=(8, 192, 384, 30),
> >> color=(255, 255, 255, 255), layer=0, clip=True, visible=True)
> >> We should have event_info here: ()
> >>
> >> Wed, 4 Apr 2012 09:36:26 +0900
> >> Daniel Juyung Seo <seojuyu...@gmail.com> kirjoitti:
> >>
> >> > Thanks for the report but can you attach any test code?
> >> > I can't reproduce it and at least I got event_info with
> >> > "anchor,clicked" callback in entry.
> >> > Thanks.
> >> >
> >> > Daniel Juyung Seo (SeoZ)
> >> >
> >> > On Wed, Apr 4, 2012 at 1:15 AM, Kai Huuhko <kai.huu...@gmail.com>
> >> > wrote:
> >> > > The event signal for "anchor, clicked" isn't passing
> >> > > event_info to the callback. I believe
> >> > > callback_anchor_clicked_add should have a conversion function
> >> > > and use it with _callback_add_full.
> >> > >
> >> > > This seems to be the case for the other anchor signals as well.
> >> > >
> >
> >
> > ------------------------------------------------------------------------------
> > For Developers, A Lot Can Happen In A Second.
> > Boundary is the first to Know...and Tell You.
> > Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> > http://p.sf.net/sfu/Boundary-d2dvs2
> > _______________________________________________
> > enlightenment-devel mailing list
> > enlightenment-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >
>
> ------------------------------------------------------------------------------
> Better than sec? Nothing is better than sec when it comes to
> monitoring Big Data applications. Try Boundary one-second
> resolution app monitoring today. Free.
> http://p.sf.net/sfu/Boundary-dev2dev
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>From 971ad27d96e2566cba6598d14b095a567d86aa92 Mon Sep 17 00:00:00 2001
From: Kai Huuhko <kai.huu...@gmail.com>
Date: Tue, 10 Apr 2012 17:02:18 +0300
Subject: [PATCH 3/3] Entry anchor hover - Add anchor_hover_parent_set/get -
Add anchor_hover_style_set/get - Add anchor_hover_end -
Add definition for EntryAnchorHoverInfo - Add callback
for Entry "anchor,hover,opened"
diff --git a/python-elementary/elementary/elementary.c_elementary_entry.pxi b/python-elementary/elementary/elementary.c_elementary_entry.pxi
index f693730..765745b 100644
--- a/python-elementary/elementary/elementary.c_elementary_entry.pxi
+++ b/python-elementary/elementary/elementary.c_elementary_entry.pxi
@@ -39,6 +39,16 @@ class EntryAnchorInfo:
self.w = 0
self.h = 0
+class EntryAnchorHoverInfo:
+ def __init__(self):
+ self.anchor_info = None
+ self.hover = None
+ self.hover_parent = (0, 0, 0, 0)
+ self.hover_left = False
+ self.hover_right = False
+ self.hover_top = False
+ self.hover_bottom = False
+
def _entryanchor_conv(long addr):
cdef Elm_Entry_Anchor_Info *ei = <Elm_Entry_Anchor_Info *>addr
eai = EntryAnchorInfo()
@@ -49,6 +59,18 @@ def _entryanchor_conv(long addr):
eai.w = ei.w
eai.h = ei.h
return eai
+
+def _entryanchorhover_conv(long addr):
+ cdef Elm_Entry_Anchor_Hover_Info *ehi = <Elm_Entry_Anchor_Hover_Info *>addr
+ eahi = EntryAnchorHoverInfo()
+ eahi.hover = Hover(None, <object>ehi.hover)
+ eahi.hover_parent = (ehi.hover_parent.x, ehi.hover_parent.y,
+ ehi.hover_parent.w, ehi.hover_parent.h)
+ eahi.hover_left = ehi.hover_left
+ eahi.hover_right = ehi.hover_right
+ eahi.hover_top = ehi.hover_top
+ eahi.hover_bottom = ehi.hover_bottom
+ return eahi
cdef class Entry(Object):
def __init__(self, c_evas.Object parent):
@@ -111,11 +133,19 @@ cdef class Entry(Object):
def callback_anchor_clicked_add(self, func, *args, **kwargs):
self._callback_add_full("anchor,clicked", _entryanchor_conv,
- func, *args, **kwargs)
+ func, *args, **kwargs)
def callback_anchor_clicked_del(self, func):
self._callback_del_full("anchor,clicked", _entryanchor_conv,
- func)
+ func)
+
+ def callback_anchor_hover_opened_add(self, func, *args, **kwargs):
+ self._callback_add_full("anchor,hover,opened", _entryanchorhover_conv,
+ func, *args, **kwargs)
+
+ def callback_anchor_hover_opened_del(self, func):
+ self._callback_del_full("anchor,hover,opened", _entryanchorhover_conv,
+ func)
def callback_activated_add(self, func, *args, **kwargs):
self._callback_add("activated", func, *args, **kwargs)
@@ -288,6 +318,37 @@ cdef class Entry(Object):
def input_panel_enabled_get(self):
return bool(elm_entry_input_panel_enabled_get(self.obj))
+ def anchor_hover_parent_set(self, c_evas.Object anchor_hover_parent):
+ elm_entry_anchor_hover_parent_set(self.obj, anchor_hover_parent.obj)
+
+ def anchor_hover_parent_get(self):
+ cdef c_evas.Evas_Object *anchor_hover_parent
+ anchor_hover_parent = elm_entry_anchor_hover_parent_get(self.obj)
+ return evas.c_evas._Object_from_instance(<long> anchor_hover_parent)
+
+ property anchor_hover_parent:
+ def __get__(self):
+ return self.anchor_hover_parent_get()
+
+ def __set__(self, value):
+ self.anchor_hover_parent_set(value)
+
+ def anchor_hover_style_set(self, style):
+ elm_entry_anchor_hover_style_set(self.obj, style)
+
+ def anchor_hover_style_get(self):
+ return elm_entry_anchor_hover_style_get(self.obj)
+
+ property anchor_hover_style:
+ def __get__(self):
+ return self.anchor_hover_style_get()
+
+ def __set__(self, value):
+ self.anchor_hover_style_set(value)
+
+ def anchor_hover_end(self):
+ elm_entry_anchor_hover_end(self.obj)
+
markup_to_utf8 = staticmethod(Entry_markup_to_utf8)
utf8_to_markup = staticmethod(Entry_utf8_to_markup)
diff --git a/python-elementary/include/elementary/c_elementary.pxd b/python-elementary/include/elementary/c_elementary.pxd
index 005f929..4f5ca23 100644
--- a/python-elementary/include/elementary/c_elementary.pxd
+++ b/python-elementary/include/elementary/c_elementary.pxd
@@ -189,6 +189,14 @@ cdef extern from "Elementary.h":
evas.c_evas.Evas_Coord w
evas.c_evas.Evas_Coord h
+ ctypedef struct Elm_Entry_Anchor_Hover_Info:
+ evas.c_evas.Evas_Object *hover
+ evas.c_evas.Eina_Rectangle hover_parent
+ evas.c_evas.Eina_Bool hover_left
+ evas.c_evas.Eina_Bool hover_right
+ evas.c_evas.Eina_Bool hover_top
+ evas.c_evas.Eina_Bool hover_bottom
+
ctypedef char *(*GenlistItemLabelGetFunc)(void *data, evas.c_evas.Evas_Object *obj, const_char_ptr part)
ctypedef evas.c_evas.Evas_Object *(*GenlistItemIconGetFunc)(void *data, evas.c_evas.Evas_Object *obj, const_char_ptr part)
ctypedef evas.c_evas.Eina_Bool (*GenlistItemStateGetFunc)(void *data, evas.c_evas.Evas_Object *obj, const_char_ptr part)
@@ -577,6 +585,11 @@ cdef extern from "Elementary.h":
void elm_entry_context_menu_disabled_set(evas.c_evas.Evas_Object *obj, evas.c_evas.Eina_Bool disabled)
void elm_entry_input_panel_enabled_set(evas.c_evas.Evas_Object *obj, evas.c_evas.Eina_Bool enabled)
evas.c_evas.Eina_Bool elm_entry_input_panel_enabled_get(evas.c_evas.Evas_Object *obj)
+ void elm_entry_anchor_hover_parent_set(evas.c_evas.Evas_Object *obj, evas.c_evas.Evas_Object *anchor_hover_parent)
+ evas.c_evas.Evas_Object *elm_entry_anchor_hover_parent_get(evas.c_evas.Evas_Object *obj)
+ void elm_entry_anchor_hover_style_set(evas.c_evas.Evas_Object *obj, char *anchor_hover_style)
+ char *elm_entry_anchor_hover_style_get(evas.c_evas.Evas_Object *obj)
+ void elm_entry_anchor_hover_end(evas.c_evas.Evas_Object *obj)
# Scrolled Entry Object
evas.c_evas.Evas_Object *elm_scrolled_entry_add(evas.c_evas.Evas_Object *parent)
--
1.7.9.4
#!/usr/bin/python
from elementary import *
class Test(Window):
def __init__(self):
Window.__init__(self, "entry-test", ELM_WIN_BASIC)
self.title_set("Entry test")
self.callback_destroy_add(self.quit)
bg = Background(self)
bg.size_hint_weight_set(1.0, 1.0)
self.resize_object_add(bg)
bg.show()
box = Box(self)
box.size_hint_weight_set(1.0, 1.0)
self.resize_object_add(box)
entry = Entry(self)
entry.text_set("<a href=url:http://www.enlightenment.org/>Enlightenment</a>")
entry.callback_anchor_clicked_add(self.anchor_clicked)
entry.anchor_hover_style_set("popout")
entry.anchor_hover_parent_set(self)
entry.callback_anchor_hover_opened_add(self.anchor_hover_opened)
entry.show()
frame = Frame(self)
frame.size_hint_align_set(-1.0, -1.0)
frame.text_set("Entry test")
frame.content_set(entry)
frame.show()
box.pack_end(frame)
box.show()
self.resize(400, 400)
self.show()
def anchor_clicked(self, obj, event_info):
print("Entry object is %s" % (obj))
print("We should have EntryAnchorInfo here: %s" % (str(event_info)))
print("EntryAnchorInfo has the following properties and methods: %s" % (dir(event_info)))
def anchor_hover_opened(self, obj, event_info):
print("We should have EntryAnchorHoverInfo here: %s" % (event_info))
print("EntryAnchorHoverInfo has the following properties and methods: %s" % (dir(event_info)))
btn = Button(obj)
btn.text_set("Testing entry anchor")
event_info.hover.content_set("middle", btn)
btn.show()
def quit(self, *args):
exit()
if __name__ == "__main__":
init()
test = Test()
run()
shutdown()
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel