-
Notifications
You must be signed in to change notification settings - Fork 0
/
directory.py
54 lines (34 loc) · 1.39 KB
/
directory.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
49
50
51
52
53
54
from kivy.metrics import dp
from kivy.properties import ObjectProperty
from mat.list import ILeftBody, ILeftBodyTouch, IRightBodyTouch
from mat.list import MDList
from mat.list import TwoLineListItem, OneLineListItem
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.screenmanager import Screen
#from plyer import call
#from plyer.platforms.android.notification import AndroidNotification
#from models import *
from models_sql import *
session = Session()
class CallerButton(TwoLineListItem):
def __init__(self,**kwargs):
super(CallerButton,self).__init__(**kwargs)
def on_touch_down(self,touch):
if self.collide_point(*touch.pos):
self.pressed = touch.pos
template = '+233'
print(template+self.secondary_text)
number = template+self.secondary_text
print('calling')
print(number)
tel = number
print(tel)
call.makecall(tel=tel)
class Directory(Screen,FloatLayout):
ml = ObjectProperty(None)
scroller = ObjectProperty(None)
button = ObjectProperty(None)
def load_contacts(self):
for name,number in session.query(Person.name,Person.number):
self.ids.ml.remove_widget(self.button)
self.ids.ml.add_widget(CallerButton(text=str(name),secondary_text=str(number)))