Skip to content

Commit 8add82c

Browse files
committed
Add main.kv in kivy live
1 parent 5cb7b51 commit 8add82c

File tree

1 file changed

+378
-0
lines changed

1 file changed

+378
-0
lines changed

src/bitmessagekivy/main.kv

Lines changed: 378 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,378 @@
1+
#:import get_color_from_hex kivy.utils.get_color_from_hex
2+
#:import Factory kivy.factory.Factory
3+
#:import Spinner kivy.uix.spinner.Spinner
4+
5+
#:import colors kivymd.color_definitions.colors
6+
#:import images_path kivymd.images_path
7+
8+
#:import IconLeftWidget kivymd.uix.list.IconLeftWidget
9+
#:import MDCard kivymd.uix.card.MDCard
10+
#:import MDCheckbox kivymd.uix.selectioncontrol.MDCheckbox
11+
#:import MDFloatingActionButton kivymd.uix.button.MDFloatingActionButton
12+
#:import MDList kivymd.uix.list.MDList
13+
#:import MDScrollViewRefreshLayout kivymd.uix.refreshlayout.MDScrollViewRefreshLayout
14+
#:import MDSpinner kivymd.uix.spinner.MDSpinner
15+
#:import MDTextField kivymd.uix.textfield.MDTextField
16+
#:import MDTabs kivymd.uix.tab.MDTabs
17+
#:import MDTabsBase kivymd.uix.tab.MDTabsBase
18+
#:import OneLineListItem kivymd.uix.list.OneLineListItem
19+
20+
<Tab@BoxLayout+MDTabsBase>
21+
22+
#:set color_button (0.784, 0.443, 0.216, 1) # brown
23+
#:set color_button_pressed (0.659, 0.522, 0.431, 1) # darker brown
24+
#:set color_font (0.957, 0.890, 0.843, 1) # off white
25+
26+
<MySpinnerOption@SpinnerOption>:
27+
font_size: '12.5sp'
28+
background_normal: 'atlas://data/images/defaulttheme/textinput_active'
29+
background_color: app.theme_cls.primary_color
30+
color: color_font
31+
32+
<NavigationItem>
33+
on_press: root.currentlyActive()
34+
active_color: root.theme_cls.primary_color if root.active else root.theme_cls.text_color
35+
36+
IconLeftWidget:
37+
icon: root.icon
38+
theme_text_color: "Custom"
39+
text_color: root.active_color
40+
41+
BadgeText:
42+
id: badge_txt
43+
text: f"{root.badge_text}"
44+
theme_text_color: "Custom"
45+
halign: 'right'
46+
47+
<NavigationDrawerDivider>:
48+
canvas:
49+
Color:
50+
rgba: self.theme_cls.divider_color
51+
Line:
52+
points: root.x, root.y + dp(8), root.x + self.width, root.y + dp(8)
53+
54+
<ContentNavigationDrawer>
55+
56+
BoxLayout:
57+
orientation: 'vertical'
58+
59+
FloatLayout:
60+
size_hint_y: None
61+
height: "200dp"
62+
63+
MDIconButton:
64+
id: reset_image
65+
icon: "refresh"
66+
x: root.parent.x + dp(10)
67+
pos_hint: {"top": 1, 'left': 1}
68+
color: [1,0,0,1]
69+
on_release: app.rest_default_avatar_img()
70+
theme_text_color: "Custom"
71+
text_color: app.theme_cls.primary_color
72+
opacity: 0
73+
disabled: True
74+
75+
MDIconButton:
76+
id: file_manager
77+
icon: "file-image"
78+
x: root.parent.x + dp(10)
79+
pos_hint: {"top": 1, 'right': 1}
80+
color: [1,0,0,1]
81+
on_release: app.file_manager_open()
82+
theme_text_color: "Custom"
83+
text_color: app.theme_cls.primary_color
84+
opacity: 1 if app.current_address_label() else 0
85+
disabled: False if app.current_address_label() else True
86+
87+
BoxLayout:
88+
id: top_box
89+
size_hint_y: None
90+
height: "200dp"
91+
x: root.parent.x
92+
pos_hint: {"top": 1}
93+
Image:
94+
source: app.get_default_logo(self)
95+
96+
ScrollView:
97+
id: scroll_y
98+
pos_hint: {"top": 1}
99+
100+
GridLayout:
101+
id: box_item
102+
cols: 1
103+
size_hint_y: None
104+
height: self.minimum_height
105+
NavigationDrawerDivider:
106+
NavigationDrawerSubheader:
107+
text: app.tr._('Accounts')
108+
height:"35dp"
109+
NavigationItem:
110+
height: dp(48)
111+
CustomSpinner:
112+
id: btn
113+
pos_hint:{"x":0,"y":0}
114+
option_cls: Factory.get("MySpinnerOption")
115+
font_size: '12.5sp'
116+
text: app.getDefaultAccData(self)
117+
color: color_font
118+
background_normal: ''
119+
background_color: app.theme_cls.primary_color
120+
on_text:app.getCurrentAccountData(self.text)
121+
ArrowImg:
122+
NavigationItem:
123+
id: inbox_cnt
124+
text: app.tr._('Inbox')
125+
icon: 'email-open'
126+
divider: None
127+
on_release: app.root.ids.scr_mngr.current = 'inbox'
128+
on_release: root.parent.set_state()
129+
on_press: app.load_screen(self)
130+
NavigationItem:
131+
id: send_cnt
132+
text: app.tr._('Sent')
133+
icon: 'send'
134+
divider: None
135+
on_release: app.root.ids.scr_mngr.current = 'sent'
136+
on_release: root.parent.set_state()
137+
NavigationItem:
138+
id: draft_cnt
139+
text: app.tr._('Draft')
140+
icon: 'message-draw'
141+
divider: None
142+
on_release: app.root.ids.scr_mngr.current = 'draft'
143+
on_release: root.parent.set_state()
144+
NavigationItem:
145+
id: trash_cnt
146+
text: app.tr._('Trash')
147+
icon: 'delete'
148+
divider: None
149+
on_release: app.root.ids.scr_mngr.current = 'trash'
150+
on_press: root.parent.set_state()
151+
on_press: app.load_screen(self)
152+
NavigationItem:
153+
id: allmail_cnt
154+
text: app.tr._('All Mails')
155+
icon: 'mailbox'
156+
divider: None
157+
on_release: app.root.ids.scr_mngr.current = 'allmails'
158+
on_release: root.parent.set_state()
159+
on_press: app.load_screen(self)
160+
NavigationDrawerDivider:
161+
NavigationDrawerSubheader:
162+
text: app.tr._("All labels")
163+
NavigationItem:
164+
text: app.tr._('Address Book')
165+
icon: 'book-multiple'
166+
divider: None
167+
on_release: app.root.ids.scr_mngr.current = 'addressbook'
168+
on_release: root.parent.set_state()
169+
NavigationItem:
170+
text: app.tr._('Settings')
171+
icon: 'application-settings'
172+
divider: None
173+
on_release: app.root.ids.scr_mngr.current = 'set'
174+
on_release: root.parent.set_state()
175+
NavigationItem:
176+
text: app.tr._('Purchase')
177+
icon: 'shopping'
178+
divider: None
179+
on_release: app.root.ids.scr_mngr.current = 'payment'
180+
on_release: root.parent.set_state()
181+
NavigationItem:
182+
text: app.tr._('New address')
183+
icon: 'account-plus'
184+
divider: None
185+
on_release: app.root.ids.scr_mngr.current = 'login'
186+
on_release: root.parent.set_state()
187+
on_press: app.reset_login_screen()
188+
NavigationItem:
189+
text: app.tr._('Network status')
190+
icon: 'server-network'
191+
divider: None
192+
on_release: app.root.ids.scr_mngr.current = 'networkstat'
193+
on_release: root.parent.set_state()
194+
NavigationItem:
195+
text: app.tr._('My addresses')
196+
icon: 'account-multiple'
197+
divider: None
198+
on_release: app.root.ids.scr_mngr.current = 'myaddress'
199+
on_release: root.parent.set_state()
200+
201+
MDNavigationLayout:
202+
id: nav_layout
203+
204+
MDToolbar:
205+
id: toolbar
206+
title: app.current_address_label()
207+
opacity: 1 if app.addressexist() else 0
208+
disabled: False if app.addressexist() else True
209+
pos_hint: {"top": 1}
210+
md_bg_color: app.theme_cls.primary_color
211+
elevation: 10
212+
left_action_items: [['menu', lambda x: nav_drawer.set_state("toggle")]]
213+
right_action_items: [['account-plus', lambda x: app.addingtoaddressbook()]]
214+
215+
ScreenManager:
216+
id: scr_mngr
217+
size_hint_y: None
218+
height: root.height - toolbar.height
219+
Inbox:
220+
id:sc1
221+
Create:
222+
id:sc3
223+
Sent:
224+
id:sc4
225+
Trash:
226+
id:sc5
227+
Login:
228+
id:sc6
229+
Random:
230+
id:sc7
231+
Setting:
232+
id:sc9
233+
MyAddress:
234+
id:sc10
235+
AddressBook:
236+
id:sc11
237+
Payment:
238+
id:sc12
239+
NetworkStat:
240+
id:sc13
241+
MailDetail:
242+
id:sc14
243+
ShowQRCode:
244+
id:sc15
245+
Draft:
246+
id:sc16
247+
Allmails:
248+
id:sc17
249+
ScanScreen:
250+
id:sc23
251+
252+
MDNavigationDrawer:
253+
id: nav_drawer
254+
255+
ContentNavigationDrawer:
256+
id: content_drawer
257+
258+
259+
<ArrowImg@Image>:
260+
source: app.image_path +('/down-arrow.png' if self.parent.is_open == True else '/right-arrow.png')
261+
size: 15, 15
262+
x: self.parent.x + self.parent.width - self.width - 5
263+
y: self.parent.y + self.parent.height/2 - self.height + 5
264+
265+
266+
<SearchBar@BoxLayout>:
267+
size_hint_y: None
268+
height: self.minimum_height
269+
270+
MDIconButton:
271+
icon: 'magnify'
272+
273+
MDTextField:
274+
id: search_field
275+
hint_text: 'Search'
276+
on_text: app.searchQuery(self)
277+
canvas.before:
278+
Color:
279+
rgba: (0,0,0,1)
280+
281+
282+
<Loader@MDSpinner>:
283+
id: spinner
284+
size_hint: None, None
285+
size: dp(46), dp(46)
286+
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
287+
active: False
288+
289+
<ComposerButton@BoxLayout>:
290+
size_hint_y: None
291+
height: dp(56)
292+
spacing: '10dp'
293+
pos_hint: {'center_x':0.45, 'center_y': .1}
294+
295+
Widget:
296+
297+
MDFloatingActionButton:
298+
icon: 'plus'
299+
opposite_colors: True
300+
elevation_normal: 8
301+
md_bg_color: [0.941, 0, 0,1]
302+
on_press: app.root.ids.scr_mngr.current = 'create'
303+
on_press: app.clear_composer()
304+
305+
306+
<SwipeToDeleteItem>:
307+
size_hint_y: None
308+
height: content.height
309+
310+
MDCardSwipeLayerBox:
311+
padding: "8dp"
312+
313+
MDIconButton:
314+
id: delete_msg
315+
icon: "trash-can"
316+
pos_hint: {"center_y": .5}
317+
md_bg_color: (1, 0, 0, 1)
318+
disabled: True
319+
320+
MDCardSwipeFrontBox:
321+
322+
TwoLineAvatarIconListItem:
323+
id: content
324+
text: root.text
325+
_no_ripple_effect: True
326+
327+
AvatarSampleWidget:
328+
id: avater_img
329+
source: None
330+
331+
TimeTagRightSampleWidget:
332+
id: time_tag
333+
text: ''
334+
font_size: "11sp"
335+
font_style: "Caption"
336+
size: [120, 140] if app.app_platform == "android" else [64, 80]
337+
338+
339+
<CutsomSwipeToDeleteItem>:
340+
size_hint_y: None
341+
height: content.height
342+
343+
MDCardSwipeLayerBox:
344+
padding: "8dp"
345+
346+
MDIconButton:
347+
id: delete_msg
348+
icon: "trash-can"
349+
pos_hint: {"center_y": .5}
350+
md_bg_color: (1, 0, 0, 1)
351+
disabled: True
352+
353+
MDCardSwipeFrontBox:
354+
355+
TwoLineAvatarIconListItem:
356+
id: content
357+
text: root.text
358+
_no_ripple_effect: True
359+
360+
AvatarSampleWidget:
361+
id: avater_img
362+
source: None
363+
364+
TimeTagRightSampleWidget:
365+
id: time_tag
366+
text: 'time'
367+
font_size: "11sp"
368+
font_style: "Caption"
369+
size: [120, 140] if app.app_platform == "android" else [64, 80]
370+
MDChip:
371+
id: chip_tag
372+
size_hint: (0.16 if app.app_platform == "android" else 0.08, None)
373+
text: 'test'
374+
icon: ""
375+
pos_hint: {"center_x": 0.91 if app.app_platform == "android" else 0.94, "center_y": 0.3}
376+
height: '18dp'
377+
text_color: (1,1,1,1)
378+
radius: [8]

0 commit comments

Comments
 (0)