-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChat.kv
523 lines (511 loc) · 17.3 KB
/
Chat.kv
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
#: import SlideTransition kivy.uix.screenmanager.SlideTransition
#:import RGBA kivy.utils.rgba
Screen_Manager:
Login:
JoinOrCreate:
CreateGroup:
SelectGroup:
ChatWindow:
#------------------------------------------------------------------------Custom Widgets------------------------------------
<CustomTextInput>:
on_parent: self._refresh_text(self.text)
background_normal: ""
background_disabled_normal: ""
background_color:(34/255,43/255,46/255,1) if not self.disabled else (30/255,39/255,42/255,0.75)
multiline: False
foreground_color:(150/255,150/255,150/255,1)
write_tab: False
hint_text_color:(95/255,93/255,98/255,1)
cursor_color:(22/255,160/255,133/255,1)
disabled_foreground_color:(60/255,60/255,60/255,0.5)
<Custom_Button@Button>:
background_normal: ""
background_down: ""
foreground_color:(95/255,93/255,98/255,1)
background_color: (16/255,112/255,93/255,1) if self.state == 'down' else (22/255,160/255,133/255,1)
<Custom_ToggleButton@ToggleButton>:
background_normal: ""
background_down: ""
foreground_color:(95/255,93/255,98/255,1)
background_color: (16/255,112/255,93/255,1) if self.state == 'down' else (22/255,160/255,133/255,1)
<H1@Label>:
font_family: "Arial"
markup: True
font_size: 40
color: (22/255,160/255,133/255,1)
<H2@Label>:
font_family: "Arial"
markup: True
font_size: 25
color: (22/255,160/255,133/255,1)
<H3@Label>:
font_family: "Arial"
markup: True
font_size: 18
color: (22/255,160/255,133/255,1)
<P@Label>:
font_family: "Arial"
markup: True
font_size: 15
color: (22/255,160/255,133/255,1)
<Space@Widget>:
#-------------------------------------------------------------------------------------------------------------------------
<Login>:
name: 'login'
BoxLayout:
orientation: "vertical"
spacing:30
padding:(100,200)
CustomTextInput:
id: username
#text:"arjun" #REMOVEE THIS SHIT
hint_text: "Username"
press_enter: root.transition_after_login
size_hint_x:0.7
pos_hint:{'center_x':0.5}
CustomTextInput:
id: password
#text:"arjun2000" #REMOVEE THIS SHIT
hint_text: "Password"
password: True
press_enter: root.transition_after_login
size_hint_x:0.7
pos_hint:{'center_x':0.5}
BoxLayout:
orientation:"horizontal"
spacing:10
size_hint_x:0.7
pos_hint: {'center_x':0.5}
Custom_Button:
id:signup_btn
text:"Sign-Up"
pos_hint:{'left':0}
on_release:
root.Sign_Up()
Custom_Button:
id:login_btn
text:"Log-in"
pos_hint:{'right':0.85}
on_release:
app.root.transition = SlideTransition(direction="left")
app.root.current='join_or_create' if root.login_error() else 'login'
<SizeWidget10@Widget>:
size_hint: None, None
size: 20, 50
#---------------------------------------------------Popups--------------------------------------------
<SignUp_pop>:
BoxLayout:
orientation:"vertical"
BoxLayout:
padding:[40,80]
spacing: 20
orientation:'vertical'
size_hint_y: 0.9
CustomTextInput:
id: username
hint_text: "Username [*]"
background_color:(40/255,50/255,54/255,1)
size_hint_x:0.7
pos_hint:{'center_x':0.5}
CustomTextInput:
id:password
hint_text: "Password [8 characters]"
size_hint_x:0.7
pos_hint:{'center_x':0.5}
background_color:(40/255,50/255,54/255,1)
password: True
CustomTextInput:
id: c_password
hint_text: "Confirm Password"
size_hint_x:0.7
pos_hint:{'center_x':0.5}
background_color:(40/255,50/255,54/255,1)
password: True
BoxLayout:
size_hint_y: 0.1
spacing:dp(8)
padding:1
Custom_Button:
id:btn_signup
text:"Sign-Up"
pos_hint:{'center_x':0.5}
on_release:
root.authenticate_signup_and_hash()
Custom_Button:
id:btn_back
text:"Back"
pos_hint:{'center_x':0.5}
<QuickMessage_pop>:
BoxLayout:
orientation:"vertical"
Label:
id: message
pos_hint:{'center_x': 0.5}
text:""
size_hint_x: None
width:350
text_size:(self.width,None)
BoxLayout:
padding: [100,15,10,10]
orientation:"vertical"
Custom_Button:
id: okay
text:"Okay"
size_hint_x: 0.5
pos_hint:{"x":0.5}
<JoinOrCreate>:
name: "join_or_create"
BoxLayout:
orientation: "vertical"
spacing:dp(40)
BoxLayout:
size_hint_y: 0.9
padding: dp(40)
spacing:dp(40)
Button:
background_normal: "img/join_normal.png"
background_down: "img/join_down.png"
on_release:
app.root.transition = SlideTransition(direction="down")
app.root.current= 'join'
Button:
background_normal: "img/create_normal.png"
background_down: "img/create_down.png"
on_release:
app.root.transition = SlideTransition(direction="up")
app.root.current= 'creategroup'
FloatLayout:
size_hint_y: 0.1
Custom_Button:
size_hint: (0.2, 0.75)
pos_hint:{"center_x":0.5, "top":1}
text: "Log-Out"
on_release:
app.root.transition = SlideTransition(direction="right")
app.root.current="login"
root.client_close()
<GroupVerifyAndJoin>:
BoxLayout:
orientation: 'vertical'
BoxLayout:
orientation: 'vertical'
padding: (0,40)
spacing: dp(20)
H3:
id:title
text: ""
size_hint:(0,0.1)
pos_hint: {'center_x':0.5}
H2:
id:name
text: ""
size_hint:(0,0.1)
text_size:(None, None)
width:350
pos_hint: {'center_x':0.5}
H3:
size_hint_y:0.2
id:members
text: ""
CustomTextInput:
id: password
hint_text: "Enter the password"
background_color:(40/255,50/255,54/255,1)
size_hint: (0.8,0.18)
pos_hint: {'center_x':0.5}
password: True
BoxLayout:
size_hint_y:0.15
orientation: "horizontal"
spacing: dp(200)
Custom_Button:
id: back
text:"Back"
size_hint_x:0.25
pos_hint: {'left':1}
Custom_Button:
id: submit
text:"Submit"
size_hint_x:0.25
pos_hint: {'right':1}
#------------------------------------------------------------------------------------------
<CreateGroup>:
name: 'creategroup'
BoxLayout:
orientation: "vertical"
padding:(0,600*0.1)
H1:
text: "[b]Describe Your Chamber: [/b]"
size_hint_y:0.1
BoxLayout:
size_hint_y: 0.8
orientation: "vertical"
padding: 40
spacing: dp(30)
CustomTextInput:
id: name
#text: 'hey' #REMOVEE THIS SHIT
press_enter: root.submit
hint_text: "Chamber Name [atleast 3 characters]"
font_size:18
BoxLayout:
spacing: 640*0.1
CustomTextInput:
id: password
#text: "arjun" #REMOVEE THIS SHIT
press_enter: root.submit
hint_text: "Chamber Password [atleast 5 characters]"
password: True
disabled: not root.allow_password
size_hint_x: 0.45
Custom_ToggleButton:
text: "Disable Password for this Chamber"
state: 'normal' if root.allow_password else 'down'
on_state: root.allow_password = not root.allow_password
size_hint_x: 0.45
CustomTextInput:
id: c_password
#text: "arjun" #REMOVEE THIS SHIT
press_enter: root.submit
hint_text: "Confirm Password"
size_hint_x: 0.45
password: True
disabled: not root.allow_password
CustomTextInput:
id: members
#text: "4" #REMOVEE THIS SHIT
hint_text: "Number of members [atleast two members]"
size_hint_x: 0.45
press_enter: root.submit
FloatLayout:
size_hint_y: 0.1
Custom_Button:
id: back
text:"Back"
size_hint_x:0.25
pos_hint: {'left':1}
on_release:
app.root.transition= SlideTransition(direction='down')
app.root.current= 'join_or_create'
Custom_Button:
id: submit
text:"Submit"
size_hint_x:0.25
pos_hint: {'right':1}
on_release: root.submit()
<RecycleGroups>:
orientation: 'horizontal'
spacing: 70
Custom_Button:
text: root.group_name
font_size: 18
size_hint_x: 0.8
on_release:
root.AuthenticateAndJoin()
H2:
text: root.group_code
size_hint_x:0.15
halign: 'center'
<SelectGroup>:
name: "join"
on_pre_enter:
root.on_search()
BoxLayout:
orientation: "vertical"
padding: 0
spacing: dp(20)
BoxLayout:
size_hint_y: 0.1
CustomTextInput:
id: search_box
hint_text: "Search for a Chamber (Chamber name + Chamber code)"
size_hint_x: 0.75
BoxLayout:
spacing:50
size_hint_y:0.1
padding: (200,0,0,0)
H2:
text: "Chamber Names"
color:(110/255,110/255,110/255,1)
#pos_hint: {'x': 0.8}
H2:
text: "Chamber Code"
text_size: (None, None)
color:(110/255,110/255,110/255,1)
RecycleView:
id: rv
data: root.activegroups
viewclass: 'RecycleGroups'
RecycleBoxLayout:
spacing: 10
padding: (100,0)
default_size: None, dp(65)
default_size_hint: 1, None
orientation: 'vertical'
size_hint_y: None
height: self.minimum_height
FloatLayout:
size_hint_y: 0.1
Custom_Button:
id: back
text:"Back"
size_hint_x:0.25
pos_hint: {'left':1}
on_release:
app.root.transition= SlideTransition(direction='up')
app.root.current= 'join_or_create'
root.unschedule()
<MemberLabels>:
H3:
canvas.before:
Color:
rgba: (11/255,80/255,66/255,1)
RoundedRectangle:
size: self.size
pos: self.pos
radius: 10,10,10,10
text: root.text
font_size:13
color: (1,1,1,1)
text_size: 120, None
halign: "center"
shorten: True
shorten_from: 'right'
<Message>:
canvas.before:
Color:
rgba: RGBA(root.bg_color)
RoundedRectangle:
size: self.size
pos: self.pos
radius: 5, 5, 5, 5
padding: 10, 10
text: ''
username: ''
message_id: -1
bg_color: '#223344'
orientation: 'vertical'
size_hint: 1, None
height: userLabel.texture_size[1] + messageLabel.texture_size[1] + 20
H3:
id: userLabel
text: root.username
size_hint: 1, None
text_size: self.width, None
size: self.texture_size
Label:
id: messageLabel
text: root.text
size_hint: 1, None
text_size: self.width, None
size: self.texture_size
padding: 10, 0
<ChatWindow>:
name:'chatwin'
on_pre_enter:
root.assign_chamber_info()
root.members_online_rv_assignment()
root.refresh_messages_scheduler()
BoxLayout:
orientation: 'vertical'
FloatLayout:
size_hint_y: 0.1
pos_hint: {'top': 1}
Custom_Button:
text: "Exit"
pos_hint: {'x': 0, 'top': 1}
size_hint_x: 0.25
font_size: 16
on_release:
app.root.transition=SlideTransition(direction="right")
app.root.current='join_or_create'
root.exit_chat()
BoxLayout:
size_hint_x:0.6
pos_hint: {'right':1, 'top':1}
spacing: dp(15)
H2:
id: info_label
text: ''
Custom_Button:
text: "Copy to Clipboard"
font_size: 14
size_hint_x: 0.35
on_release:
root.copytoclipboard()
BoxLayout:
BoxLayout:
size_hint_x: 0.25
padding: dp(20), dp(20), 0, dp(20)
RecycleView:
id: memberview
canvas.before:
Color:
rgba: (34/255,43/255,46/255,1)
Rectangle:
size: self.size
pos: self.pos
data: root.members_online
viewclass: 'MemberLabels'
RecycleBoxLayout:
id: members_box
spacing: 10
padding: dp(10)
default_size: None, dp(30)
default_size_hint: 1, None
orientation: 'vertical'
size_hint_y: None
height: self.minimum_height
BoxLayout:
size_hint_x:0.75
orientation: 'vertical'
padding: dp(20)
RecycleView:
id: chat_view
canvas.before:
Color:
rgba: (34/255,43/255,46/255,1)
Rectangle:
size: self.size
pos: self.pos
data: root.messages
viewclass: 'Message'
RecycleBoxLayout:
id: box
orientation: 'vertical'
size_hint_y: None
height: self.minimum_height
padding: dp(10)
spacing: dp(15)
default_size_hint: 1, None
FloatLayout:
size_hint_y: None
height: 0
Custom_Button:
size_hint_y: None
height: self.texture_size[1]
padding: [5,5]
opacity: 0 if not self.height else 1
text: 'Go to Latest Message' if chat_view.height < box.height and chat_view.scroll_y > 0 else ''
pos_hint: {'pos': (0, 0)}
on_release: root.scroll_bottom()
BoxLayout:
size_hint_y:0.08
CustomTextInput:
id: message_input
height: min(max(self.line_height, self.minimum_height), 90)
background_color:(40/255,50/255,54/255,1)
multiline: True
press_enter: root.send_message
size_hint: 0.8, None
pos_hint:{'center_y': 0.5}
Custom_Button:
text: 'Send'
disabled: not message_input.text
background_disabled_normal:''
background_disabled_down: ''
background_color: (4/255,40/255,33/255,1) if self.disabled else (22/255,160/255,133/255,1)
disabled_color: (110/255,110/255,110/255,1)
size_hint: 0.2, 1
on_release:
root.send_message()