summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2015-12-09 21:26:29 +0200
committerKai Huuhko <kai.huuhko@gmail.com>2015-12-09 21:26:29 +0200
commit75fa5ff25600005dec7ae002b33b4f9f12171c9c (patch)
tree915076dbe039048e7426b677ddb78a32ef1addb7
parent5d73c59088961ece986c6754615b68d9bbd0475a (diff)
Elementary.dnd: Fix various leftover issues
-rw-r--r--efl/elementary/object.pxi69
-rw-r--r--examples/elementary/test_dnd.py2
2 files changed, 43 insertions, 28 deletions
diff --git a/efl/elementary/object.pxi b/efl/elementary/object.pxi
index 27c91fb..5c5ddad 100644
--- a/efl/elementary/object.pxi
+++ b/efl/elementary/object.pxi
@@ -1669,19 +1669,20 @@ cdef class Object(SmartObject):
1669 raise RuntimeError("Could not add drop target.") 1669 raise RuntimeError("Could not add drop target.")
1670 1670
1671 def drop_target_del(self, Elm_Sel_Format fmt, 1671 def drop_target_del(self, Elm_Sel_Format fmt,
1672 entercb, enterdata, leavecb, leavedata, poscb, posdata, dropcb, dropdata): 1672 entercb=None, enterdata=None, leavecb=None, leavedata=None,
1673 poscb=None, posdata=None, dropcb=None, dropdata=None):
1673 """Deletes the drop target status of an object 1674 """Deletes the drop target status of an object
1674 1675
1675 @param format The formats supported for dropping 1676 :param format: The formats supported for dropping
1676 @param entercb The function to call when the object is entered with a drag 1677 :param entercb: The function to call when the object is entered with a drag
1677 @param enterdata The application data to pass to enterdata 1678 :param enterdata: The application data to pass to enterdata
1678 @param leavecb The function to call when the object is left with a drag 1679 :param leavecb: The function to call when the object is left with a drag
1679 @param leavedata The application data to pass to leavedata 1680 :param leavedata: The application data to pass to leavedata
1680 @param poscb The function to call when the object has a drag over it 1681 :param poscb: The function to call when the object has a drag over it
1681 @param posdata The application data to pass to posdata 1682 :param posdata: The application data to pass to posdata
1682 @param dropcb The function to call when a drop has occurred 1683 :param dropcb: The function to call when a drop has occurred
1683 @param dropdata The application data to pass to dropcb 1684 :param dropdata: The application data to pass to dropcb
1684 @return Returns @c EINA_TRUE, if successful, or @c EINA_FALSE if not. 1685 :raise RuntimeError: if drop target cannot be deleted
1685 1686
1686 .. versionadded:: 1.17 1687 .. versionadded:: 1.17
1687 1688
@@ -1717,8 +1718,8 @@ cdef class Object(SmartObject):
1717 raise RuntimeError("Could not del drop target.") 1718 raise RuntimeError("Could not del drop target.")
1718 1719
1719 def drag_start(self, Elm_Sel_Format format, 1720 def drag_start(self, Elm_Sel_Format format,
1720 data, Elm_Xdnd_Action action, createicon, createdata, 1721 data, Elm_Xdnd_Action action, createicon=None, createdata=None,
1721 dragpos, dragdata, acceptcb, acceptdata, dragdone, donecbdata): 1722 dragpos=None, dragdata=None, acceptcb=None, acceptdata=None, dragdone=None, donecbdata=None):
1722 """Begins a drag given a source object 1723 """Begins a drag given a source object
1723 1724
1724 :param format: The drag formats supported by the data 1725 :param format: The drag formats supported by the data
@@ -1742,23 +1743,37 @@ cdef class Object(SmartObject):
1742 .. versionadded:: 1.17 1743 .. versionadded:: 1.17
1743 1744
1744 """ 1745 """
1745 if not callable(createicon) \ 1746 if createicon:
1746 or not callable(dragpos) \ 1747 if not callable(createicon):
1747 or not callable(acceptcb) \ 1748 raise TypeError("A callback passed is not callable.")
1748 or not callable(dragdone): 1749 create = (createicon, createdata)
1749 raise TypeError("A callback passed is not callable.") 1750 Py_INCREF(create)
1750 1751 if dragpos:
1751 create = (createicon, createdata) 1752 if not callable(dragpos):
1752 pos = (dragpos, dragdata) 1753 raise TypeError("A callback passed is not callable.")
1753 accept = (acceptcb, acceptdata) 1754 pos = (dragpos, dragdata)
1754 done = (dragdone, donecbdata) 1755 Py_INCREF(pos)
1756 if acceptcb:
1757 if not callable(acceptcb):
1758 raise TypeError("A callback passed is not callable.")
1759 accept = (acceptcb, acceptdata)
1760 Py_INCREF(accept)
1761 if dragdone:
1762 if not callable(dragdone):
1763 raise TypeError("A callback passed is not callable.")
1764 done = (dragdone, donecbdata)
1765 Py_INCREF(done)
1755 1766
1756 if not elm_drag_start(self.obj, format, 1767 if not elm_drag_start(self.obj, format,
1757 <const char *>data, action, 1768 <const char *>data, action,
1758 py_elm_drag_icon_create_cb, <void *>create, 1769 <Elm_Drag_Icon_Create_Cb>py_elm_drag_icon_create_cb if createicon is not None else NULL,
1759 py_elm_drag_pos_cb, <void *>pos, 1770 <void *>create if createicon is not None else NULL,
1760 py_elm_drag_accept_cb, <void *>accept, 1771 <Elm_Drag_Pos>py_elm_drag_pos_cb if dragpos is not None else NULL,
1761 py_elm_drag_state_cb, <void *>done 1772 <void *>pos if dragpos is not None else NULL,
1773 <Elm_Drag_Accept>py_elm_drag_accept_cb if acceptcb is not None else NULL,
1774 <void *>accept if acceptcb is not None else NULL,
1775 <Elm_Drag_State>py_elm_drag_state_cb if dragdone is not None else NULL,
1776 <void *>done if dragdone is not None else NULL
1762 ): 1777 ):
1763 raise RuntimeError("Could not start drag.") 1778 raise RuntimeError("Could not start drag.")
1764 1779
diff --git a/examples/elementary/test_dnd.py b/examples/elementary/test_dnd.py
index 31bdea6..31922ac 100644
--- a/examples/elementary/test_dnd.py
+++ b/examples/elementary/test_dnd.py
@@ -631,7 +631,7 @@ def _drop_but_icon_change_cb(obj, ev, data):
631# Callback used to test multi-callbacks feature */ 631# Callback used to test multi-callbacks feature */
632def _drop_but_cb_remove_cb(obj, ev, data): 632def _drop_but_cb_remove_cb(obj, ev, data):
633 print("Second callback called - removing it") 633 print("Second callback called - removing it")
634 obj.drop_target_del(ELM_SEL_FORMAT_TARGETS, _enter_but_cb, NULL, NULL, NULL, NULL, NULL, _drop_but_cb_remove_cb, NULL) 634 obj.drop_target_del(ELM_SEL_FORMAT_TARGETS, _enter_but_cb, dropcb=_drop_but_cb_remove_cb)
635 return True 635 return True
636 636
637def _drop_bg_change_cb(obj, ev, data): 637def _drop_bg_change_cb(obj, ev, data):