-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtrollboxcc.kv
208 lines (183 loc) · 5.78 KB
/
trollboxcc.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
#:import Factory kivy.factory.Factory
#:import ListAdapter kivy.adapters.listadapter.ListAdapter
#:import ListItemButton kivy.uix.listview.ListItemButton
#:import Color kivy.graphics
#:import Rectangle kivy.graphics
#:import hex kivy.utils.get_color_from_hex
<CreateNicknamePopup@Popup>:
title: 'Nickname creation'
auto_dismiss: False
size_hint: (0.5, 0.5)
BoxLayout:
orientation: 'vertical'
GridLayout:
cols: 2
Label:
text: 'Nickname:'
TextInput:
id: input_nickname
Label:
text: 'Password:'
TextInput:
id: input_password
BoxLayout:
size_hint: (1, 0.2)
orientation: 'horizontal'
CreateNicknameButton:
text: 'Create nickname'
on_release: self.create_nickname(input_nickname.text, input_password.text)
Button:
text: 'Close'
on_release: root.dismiss()
<CreateRoomPopup@Popup>:
title: 'New chat room creation'
auto_dismiss: False
size_hint: (0.5, 0.5)
BoxLayout:
orientation: 'vertical'
GridLayout:
cols: 2
Label:
text: 'Room name:'
TextInput:
id: input_room_name
Label:
text: 'Room description:'
TextInput:
id: input_room_description
BoxLayout:
size_hint: (1, 0.2)
orientation: 'horizontal'
CreateRoomButton:
text: 'Create room'
on_release: self.create_room(input_room_name.text, input_room_description.text)
Button:
text: 'Close'
on_release: root.dismiss()
<SubscribeOnRoom@Popup>:
title: 'Subscribe on room'
auto_dismiss: False
size_hint: (0.8, 0.8)
BoxLayout:
orientation: 'vertical'
GridLayout:
cols: 2
Label:
text: 'Registration UTXOs amount:'
TextInput:
id: input_reg_utxos
Label:
text: 'Room to which you subscribing:'
Label:
id: display_current_room
text: app.active_room_id
BoxLayout:
size_hint: (1, 0.2)
orientation: 'horizontal'
SubscribeOnRoomButton:
text: 'Subscribe on room'
on_release: self.subscribe_room(input_reg_utxos.text)
Button:
text: 'Close'
on_release: root.dismiss()
ScreenManagement:
LoginPage:
UserPage:
<LoginPage>:
name: "login_page"
BoxLayout:
orientation: 'vertical'
Image:
source: 'img/logo.png'
size_hint: 1, 0.3
GridLayout:
rows: 4
Label:
text: "RPC Server:"
TextInput:
id: rpcserver
Label:
text: "RPC User:"
TextInput:
id: rpcuser
Label:
text: "RPC Password:"
TextInput:
id: rpcpassword
Label:
text: "RPC Port:"
TextInput:
id: port
Button:
text: "Try to connect"
size_hint: 1, 0.2
on_release: root.verify_credentials()
<UserPage>:
name: "user"
BoxLayout:
id: mainbox
orientation: 'horizontal'
padding: 10
BoxLayout:
id: leftarea
orientation: 'vertical'
padding: 10
Label:
size_hint: (None, 0.05)
valign: 'top'
text: 'ROOMS'
BoxLayout:
# rooms list area
ListView:
name: 'roomslist'
id: roomslist
adapter: ListAdapter(data = app.get_rooms_list(), cls = 'RoomListItemButton')
Button:
text: 'Create nickname'
on_release: Factory.CreateNicknamePopup().open()
size_hint: 1, 0.0675
Button:
text: 'Create room'
on_release: Factory.CreateRoomPopup().open()
size_hint: 1, 0.0675
Button:
text: 'Subscribe on room'
on_release: Factory.SubscribeOnRoom().open()
size_hint: 1, 0.0675
Button:
text: 'Refresh rooms list'
size_hint: 1, 0.0675
on_press: app.callback_refresh_rooms(roomslist)
BoxLayout:
id: rightarea
orientation: 'vertical'
padding: 10
MessagesBoxLabel:
id: messageslabel
size_hint: (None, 0.05)
valign: 'top'
text: 'MESSAGES'
ScrollView:
id: messagesscroll
padding: 5
canvas.before:
Color:
#possible to change messages box background color here
rgba: hex('#000000')
Rectangle:
pos: self.pos
size: self.size
#messages box area
ListView:
id: messagesview
item_strings: [str(index) for index in app.messages]
#adapter: ListAdapter(data = app.messages, cls = 'CompositeListItem')
BoxLayout:
orientation: 'horizontal'
size_hint: 1, 0.27
TextInput:
id: inputmsg
Button:
text: 'Send'
on_press: app.send_message(inputmsg)
size_hint: 0.2, 1