-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchat.kv
110 lines (87 loc) · 2.39 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
#:import C kivy.utils.get_color_from_hex
#:import RiseInTransition kivy.uix.screenmanager.RiseInTransition
<BoxLayout>:
padding: 10
spacing: 10
<GridLayout>:
rows: 2
cols: 2
spacing: 10
row_default_height: 90
row_force_default: True
<Label>:
font_size: 25
<Button>:
font_size: 30
height: 90
size_hint: (1, None)
background_normal: 'button_normal.png'
background_down: 'button_down.png'
border: (2, 2, 2, 2)
<TextInput>:
font_size: 30
multiline: False
padding: [10, 0.5 * (self.height - self.line_height)]
<ScrollView>:
canvas.before:
Color:
rgb: 1, 1, 1
Rectangle:
pos: self.pos
size: self.size
<ChatLabel@Label>:
color: C('#101010')
text_size: (self.width, None)
halign: 'left'
valign: 'top'
padding: (-10, 0) # fixed in Kivy 1.8.1
size_hint: (1, None)
height: self.texture_size[1]
markup: True
ScreenManager:
transition: RiseInTransition()
Screen:
name: 'login'
BoxLayout:
orientation: 'vertical'
GridLayout:
Label:
text: 'Server:'
size_hint: (0.4, 1)
TextInput:
id: server
text: '127.0.0.1'
Label:
text: 'Nickname:'
size_hint: (0.4, 1)
TextInput:
id: nickname
text: 'Kivy'
Button:
text: 'Connect'
on_press: app.connect()
Screen:
name: 'chatroom'
BoxLayout:
orientation: 'vertical'
Button:
text: 'Disconnect'
on_press: app.disconnect()
background_normal: 'red_button_normal.png'
background_down: 'red_button_down.png'
ScrollView:
ChatLabel:
id: chat_logs
text: ''
BoxLayout:
height: 90
orientation: 'horizontal'
padding: 0
size_hint: (1, None)
TextInput:
id: message
on_text_validate: app.send_msg()
Button:
text: 'Send'
on_press: app.send_msg()
size_hint: (0.3, 1)