-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstack.py
161 lines (112 loc) · 3.44 KB
/
stack.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
from kivy.app import App
from kivy.uix.popup import Popup
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.scrollview import ScrollView
from mat.list import MDList, OneLineListItem,TwoLineListItem
from kivy.lang import Builder
from mat.label import MDLabel
from mat.button import MDFlatButton,MDRaisedButton
import threading
from models_sql import *
from kivy.properties import ObjectProperty
from mat.textfields import SingleLineTextField
from mat.spinner import MDSpinner
from kivy.clock import Clock
from kivy.uix.floatlayout import FloatLayout
session = Session()
kv = '''
Testimonies:
Button:
text: " Testify"
size_hint: None, None
size: 4 * dp(40), dp(40)
pos_hint: {'center_x': 0.2, 'center_y': 0.3}
font_name: 'Roboto-Regular'
on_release: root.share();
<F>:
name: name
message: message
id: sub_button
title: 'Share Your Testimony'
markup: True
size_hint: .9, None
height: dp(300)
pos_hint:{'center_x': 0.5, 'center_y': 0.65}
FloatLayout:
SingleLineTextField:
id: name
hint_text: 'Name'
multiline: False
pos_hint:{'center_x': 0.5, 'center_y': 0.8}
text: ''
SingleLineTextField:
id: message
hint_text: 'Message'
multiline: True
pos_hint:{'center_x': 0.5, 'center_y': 0.5}
text: ''
MDFlatButton:
text: 'ShieeeeeeM)'
pos_hint:{'center_x': 0.5, 'center_y': 0.2}
on_press: root.shiemor()
<DBScroll>:
id: dbscroll
title: ''
size_hint: None, None
size: 400,100
FloatLayout:
Label:
text: 'Sending'
pos_hint:{'center_x': 0.8, 'center_y': 0.7}
size_hint: None, None
size: 50,100
MDSpinner:
size_hint: None,None
size: dp(30),dp(30)
pos_hint:{'center_x': 0.2, 'center_y': 0.7}
'''
from kivy.properties import StringProperty
class F(Popup):
name = ObjectProperty(None)
message_text = StringProperty(None)
message = ObjectProperty(None)
def __init__(self, **kwargs):
super(F, self).__init__(**kwargs)
def shiemor(self):
dbt =DBThread()
popt = PopThread()
dbt.start()
popt.start()
class DBScroll(Popup):
pass
class DBThread(threading.Thread):
def __init__(self,**kwargs):
super(DBThread,self).__init__(**kwargs)
def run(self):
add_testimony = Testify(name='', message='db')
session.add(add_testimony)
session.commit()
print(self.name)
class PopThread(threading.Thread):
def run(self):
pop = DBScroll(auto_dismiss=True)
pop.open()
class Testimonies(BoxLayout):
def __init__(self, **kwargs):
super(Testimonies, self).__init__(**kwargs)
def share(self):
pop = F()
pop.open()
class Stack(App):
global rows
rows = session.query(Person).count()
def counter(self):
print(rows)
num = rows
if rows > num:
print('new notification')
def build(self):
Clock.schedule_interval(lambda x: self.counter(), 8)
return Builder.load_string(kv)
if __name__=="__main__":
Stack().run()