-
Notifications
You must be signed in to change notification settings - Fork 1
/
WidgetStation.py
48 lines (36 loc) · 1.29 KB
/
WidgetStation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
-----------------------------------------------------------
WidgetStation
-----------------------------------------------------------
"""
from kivy.uix.image import Image
from kivy.uix.label import Label
from kivy.uix.behaviors import DragBehavior
class WidgetStation (DragBehavior,Image):
station_uid = '?'
def __init__(self, **kwargs):
super(WidgetStation, self).__init__(**kwargs)
self.drag_timeout = 10000000
self.drag_distance = 0
self.drag_rectangle = [self.x, self.y, self.width, self.height]
self.size = (24, 24)
self.size_hint = (None, None)
def on_pos(self, *args):
self.drag_rectangle = [self.x, self.y, self.width, self.height]
def on_size(self, *args):
self.drag_rectangle = [self.x, self.y, self.width, self.height]
def initiate_drag(self):
# during a drag, we remove the widget from the original location
#self.parent.remove_widget(self)
print('initiate_drag')
#
# Drag & Drop
#
#def on_touch_down(self, touch):
# if self.collide_point(*touch.pos):
# if touch.button == "right":
# pass
# elif touch.button == "left":
# print("on_touch_down")
# else:
# print(self.id)