PyBitmessage-2021-04-27/src/bitmessagekivy/main.kv

376 lines
13 KiB
Plaintext

#:import IconLeftWidget kivymd.uix.list.IconLeftWidget
#:import images_path kivymd.images_path
#:import Spinner kivy.uix.spinner.Spinner
#:import Factory kivy.factory.Factory
#:import MDCheckbox kivymd.uix.selectioncontrol.MDCheckbox
#:import MDList kivymd.uix.list.MDList
#:import OneLineListItem kivymd.uix.list.OneLineListItem
#:import MDTextField kivymd.uix.textfield.MDTextField
#:import get_color_from_hex kivy.utils.get_color_from_hex
#:import MDCard kivymd.uix.card.MDCard
#:import colors kivymd.color_definitions.colors
#:import MDTabs kivymd.uix.tab.MDTabs
#:import MDFloatingActionButton kivymd.uix.button.MDFloatingActionButton
#:import Factory kivy.factory.Factory
#:import MDScrollViewRefreshLayout kivymd.uix.refreshlayout.MDScrollViewRefreshLayout
#:import MDSpinner kivymd.uix.spinner.MDSpinner
#:import MDTabsBase kivymd.uix.tab.MDTabsBase
##:import ZBarSymbol pyzbar.pyzbar.ZBarSymbol
<Tab@BoxLayout+MDTabsBase>
#:set color_button (0.784, 0.443, 0.216, 1) # brown
#:set color_button_pressed (0.659, 0.522, 0.431, 1) # darker brown
#:set color_font (0.957, 0.890, 0.843, 1) # off white
<MySpinnerOption@SpinnerOption>:
font_size: '12.5sp'
#background_color: color_button if self.state == 'down' else color_button_pressed
#background_down: 'atlas://data/images/defaulttheme/button'
background_normal: 'atlas://data/images/defaulttheme/textinput_active'
background_color: app.theme_cls.primary_color
# text_autoupdate: True
color: color_font
<NavigationItem>
#on_press: root.active = not root.active
on_press: root.currentlyActive()
active_color: root.theme_cls.primary_color if root.active else root.theme_cls.text_color
IconLeftWidget:
icon: root.icon
theme_text_color: "Custom"
text_color: root.active_color
BadgeText:
id: badge_txt
text: f"{root.badge_text}"
theme_text_color: "Custom"
#text_color: root.active_color
halign: 'right'
<NavigationDrawerDivider>:
canvas:
Color:
rgba: self.theme_cls.divider_color
Line:
points: root.x, root.y + dp(8), root.x + self.width, root.y + dp(8)
<ContentNavigationDrawer>
BoxLayout:
orientation: 'vertical'
FloatLayout:
size_hint_y: None
height: "200dp"
MDIconButton:
id: reset_image
icon: "refresh"
x: root.parent.x + dp(10)
pos_hint: {"top": 1, 'left': 1}
color: [1,0,0,1]
on_release: app.rest_default_avatar_img()
theme_text_color: "Custom"
text_color: app.theme_cls.primary_color
# opacity: 1 if app.current_address_label() else 0
# disabled: False if app.current_address_label() else True
opacity: 0
disabled: True
MDIconButton:
id: file_manager
icon: "file-image"
x: root.parent.x + dp(10)
pos_hint: {"top": 1, 'right': 1}
color: [1,0,0,1]
on_release: app.file_manager_open()
# md_bg_color: app.theme_cls.primary_color
theme_text_color: "Custom"
text_color: app.theme_cls.primary_color
opacity: 1 if app.current_address_label() else 0
disabled: False if app.current_address_label() else True
BoxLayout:
id: top_box
size_hint_y: None
height: "200dp"
#padding: "10dp"
x: root.parent.x
pos_hint: {"top": 1}
Image:
# source: './images/drawer_logo1.png'
# source: app.get_default_logo()
ScrollView:
id: scroll_y
pos_hint: {"top": 1}
GridLayout:
id: box_item
cols: 1
size_hint_y: None
height: self.minimum_height
NavigationDrawerDivider:
NavigationDrawerSubheader:
text: app.tr._('Accounts')
#text: app.tr._('Hello World')
height:"35dp"
NavigationItem:
# size: 50,50
height: dp(48)
CustomSpinner:
id: btn
pos_hint:{"x":0,"y":0}
option_cls: Factory.get("MySpinnerOption")
font_size: '12.5sp'
text: app.getDefaultAccData(self)
#background_color: color_button if self.state == 'normal' else color_button_pressed
#background_down: 'atlas://data/images/defaulttheme/spinner'
color: color_font
background_normal: ''
background_color: app.theme_cls.primary_color
#background_color: (0.62,0.67,0.72,1)
# values: app.variable_1
on_text:app.getCurrentAccountData(self.text)
# Image:
# source: app.get_default_image()
# x: self.width/6
# y: self.parent.y + self.parent.height/4
# size: self.parent.height/2, self.parent.height/2
ArrowImg:
NavigationItem:
id: inbox_cnt
text: app.tr._('Inbox')
#text: app.tr._('Hello World')
icon: 'email-open'
divider: None
on_release: app.root.ids.scr_mngr.current = 'inbox'
on_release: root.parent.set_state()
on_press: app.load_screen(self)
NavigationItem:
id: send_cnt
text: app.tr._('Sent')
icon: 'send'
divider: None
on_release: app.root.ids.scr_mngr.current = 'sent'
on_release: root.parent.set_state()
NavigationItem:
id: draft_cnt
text: app.tr._('Draft')
icon: 'message-draw'
divider: None
on_release: app.root.ids.scr_mngr.current = 'draft'
on_release: root.parent.set_state()
NavigationItem:
id: trash_cnt
text: app.tr._('Trash')
icon: 'delete'
divider: None
on_release: app.root.ids.scr_mngr.current = 'trash'
on_release: root.parent.set_state()
NavigationItem:
id: allmail_cnt
text: app.tr._('All Mails')
icon: 'mailbox'
divider: None
on_release: app.root.ids.scr_mngr.current = 'allmails'
on_release: root.parent.set_state()
on_press: app.load_screen(self)
# NavigationItem:
# id: chat_rm
# text: app.tr._('Chat Room')
# icon: 'wechat'
# divider: None
# on_release: app.root.ids.scr_mngr.current = 'chlist'
# on_release: root.parent.set_state()
NavigationDrawerDivider:
NavigationDrawerSubheader:
text: app.tr._("All labels")
NavigationItem:
text: app.tr._('Address Book')
icon: 'book-multiple'
divider: None
on_release: app.root.ids.scr_mngr.current = 'addressbook'
on_release: root.parent.set_state()
NavigationItem:
text: app.tr._('Settings')
icon: 'application-settings'
divider: None
on_release: app.root.ids.scr_mngr.current = 'set'
on_release: root.parent.set_state()
NavigationItem:
text: app.tr._('Purchase')
icon: 'shopping'
divider: None
on_release: app.root.ids.scr_mngr.current = 'payment'
on_release: root.parent.set_state()
# NavigationItem:
# text: app.tr._('Credits')
# icon: 'wallet'
# divider: None
# on_release: app.root.ids.scr_mngr.current = 'credits'
# on_release: root.parent.set_state()
NavigationItem:
text: app.tr._('New address')
icon: 'account-plus'
divider: None
on_release: app.root.ids.scr_mngr.current = 'login'
on_release: root.parent.set_state()
on_press: app.reset_login_screen()
NavigationItem:
text: app.tr._('Network status')
icon: 'server-network'
divider: None
on_release: app.root.ids.scr_mngr.current = 'networkstat'
on_release: root.parent.set_state()
NavigationItem:
text: app.tr._('My addresses')
icon: 'account-multiple'
divider: None
on_release: app.root.ids.scr_mngr.current = 'myaddress'
on_release: root.parent.set_state()
MDNavigationLayout:
id: nav_layout
MDToolbar:
id: toolbar
title: app.current_address_label()
opacity: 1 if app.addressexist() else 0
disabled: False if app.addressexist() else True
pos_hint: {"top": 1}
md_bg_color: app.theme_cls.primary_color
elevation: 10
left_action_items: [['menu', lambda x: nav_drawer.set_state("toggle")]]
right_action_items: [['account-plus', lambda x: app.addingtoaddressbook()]]
ScreenManager:
id: scr_mngr
size_hint_y: None
height: root.height - toolbar.height
Inbox:
id:sc1
Page:
id:sc2
Create:
id:sc3
Sent:
id:sc4
Trash:
id:sc5
Login:
id:sc6
Random:
id:sc7
Spam:
id:sc8
Setting:
id:sc9
MyAddress:
id:sc10
AddressBook:
id:sc11
Payment:
id:sc12
NetworkStat:
id:sc13
MailDetail:
id:sc14
ShowQRCode:
id:sc15
Draft:
id:sc16
Allmails:
id:sc17
Credits:
id:sc18
Starred:
id:sc19
Archieve:
id:sc20
ChatRoom:
id:sc21
ChatList:
id:sc22
ScanScreen:
id:sc23
MDNavigationDrawer:
id: nav_drawer
ContentNavigationDrawer:
id: content_drawer
<Page>:
name: 'page'
Label:
text:"I am in Page"
color: 0,0,0,1
<Create>:
name: 'create'
Loader:
<Spam>:
name: 'spam'
Label:
text:"I am in Spam"
color: 0,0,0,1
<ShowQRCode>:
name: 'showqrcode'
BoxLayout:
orientation: 'vertical'
size_hint: (None, None)
pos_hint:{'center_x': .5, 'top': 0.9}
size: (app.window_size[0]/1.8, app.window_size[0]/1.8)
id: qr
BoxLayout:
orientation: 'vertical'
MyMDTextField:
size_hint_y: None
font_style: 'Body1'
theme_text_color: 'Primary'
text: app.tr._(root.address)
multiline: True
readonly: True
line_color_normal: [0,0,0,0]
_current_line_color: [0,0,0,0]
line_color_focus: [0,0,0,0]
halign: 'center'
font_size: dp(15)
bold: True
canvas.before:
Color:
rgba: (0,0,0,1)
# MDLabel:
# size_hint_y: None
# font_style: 'Body1'
# theme_text_color: 'Primary'
# text: "[b]BM-2cV7Y8imvAevK6z6YmhYRcj2t7rghBtDSZ[/b]"
# markup: True
# pos_hint: {'x': .28, 'y': 0.6}
<Starred>:
name: 'starred'
Label:
text:"I am in Starred"
color: 0,0,0,1
color: 0,0,0,1
<Archieve>:
name: 'archieve'
Label:
text:"I am in Archieve"
color: 0,0,0,1
color: 0,0,0,1
<ScanScreen>:
name:'scanscreen'