Here I can find out where to draw a line, above or below the item.
But I don't know how to draw the line and I'm having some trouble with how to get the exact position of the line. It must be under the pisxbuf and the string with it's name.
Can someone show me how to draw the line please?
Code:
# day1 is an iconview
self.day1.connect("drag-motion",self.day1.on_drag_move)
def on_drag_move(self, widget, drag_context, x, y, time):
position = None
try:
path, position = widget.get_dest_item_at_pos(x, y)
model = widget.get_model()
selected_iter = model.get_iter(path)
pixbuf = model.get_value(selected_iter, COLUMN_PIXBUF)
name = model.get_value(selected_iter, COLUMN_TEXT_NAME)
except:
print("no item")
if position != None:
print("item at Path: ",path,"position: ", position)
print(("mouse_pos_X",x ,"mouse_pos_Y", y))
if (position == Gtk.IconViewDropPosition.DROP_LEFT or position == Gtk.IconViewDropPosition.DROP_ABOVE or position == Gtk.IconViewDropPosition.DROP_INTO):
print("Pixbuf width", pixbuf.get_width())
print("position LEFT/ABOVE")
elif (position == Gtk.IconViewDropPosition.DROP_RIGHT or position == Gtk.IconViewDropPosition.DROP_BELOW):
print("Pixbuf width", pixbuf.get_width())
print("position RIGHT/BELOW")
else:
print("position = None")