kivy fixed part 6

This commit is contained in:
navjot 2020-01-09 20:39:01 +05:30
parent aca97aca9e
commit 32748d716c
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C
2 changed files with 674 additions and 686 deletions

View File

@ -1,8 +1,8 @@
#:import IconLeftWidget kivymd.uix.list.IconLeftWidget
#:import images_path kivymd.images_path
#:import Spinner kivy.uix.spinner.Spinner
#:import Factory kivy.factory.Factory
#:import MDToolbar kivymd.uix.toolbar.MDToolbar
#:import NavigationLayout kivymd.uix.navigationdrawer.NavigationLayout
#:import NavigationDrawerDivider kivymd.uix.navigationdrawer.NavigationDrawerDivider
#:import NavigationDrawerSubheader kivymd.uix.navigationdrawer.NavigationDrawerSubheader
#:import MDCheckbox kivymd.uix.selectioncontrol.MDCheckbox
#:import MDList kivymd.uix.list.MDList
#:import OneLineListItem kivymd.uix.list.OneLineListItem
@ -15,35 +15,58 @@
#:import Factory kivy.factory.Factory
#:import MDScrollViewRefreshLayout kivymd.uix.refreshlayout.MDScrollViewRefreshLayout
#:import MDSpinner kivymd.uix.spinner.MDSpinner
#:import NoTransition kivy.uix.screenmanager.NoTransition
#:import MDTabsBase kivymd.uix.tab.MDTabsBase
<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
<MyNavigationDrawerIconButton@NavigationDrawerIconButton>:
font_style: 'Body1'
theme_text_color: 'Secondary'
<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'
color: color_font
<ContentNavigationDrawer@Navigatorss>:
drawer_logo: './images/drawer_logo1.png'
NavigationDrawerDivider:
height: dp(7)
NavigationDrawerSubheader:
text: "Accounts"
AddressDropdown:
CustomSpinner:
<NavigationItem>
theme_text_color: 'Custom'
divider: None
IconLeftWidget:
icon: root.icon
<ContentNavigationDrawer>
BoxLayout:
orientation: 'vertical'
FloatLayout:
size_hint_y: None
height: "200dp"
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'
ScrollView:
pos_hint: {"top": 1}
GridLayout:
id: box_item
cols: 1
size_hint_y: None
height: self.minimum_height
NavigationItem:
Spinner:
id: btn
pos_hint:{"x":0,"y":.25}
pos_hint:{"x":0,"y":.1}
option_cls: Factory.get("MySpinnerOption")
font_size: '11.9sp'
text: app.getDefaultAccData()
@ -58,110 +81,100 @@
y: self.parent.y + self.parent.height/4
size: self.parent.height/2, self.parent.height/2
ArrowImg:
MyNavigationDrawerIconButton:
id: inbox_cnt
NavigationItem:
text: 'Inbox'
icon: 'email-open'
text: "Inbox"
divider: None
badge_text: "0"
on_release: app.root.ids.scr_mngr.current = 'inbox'
badge_text: "0"
on_release: root.parent.toggle_nav_drawer()
on_press: app.load_screen(self)
MyNavigationDrawerIconButton:
id: send_cnt
NavigationItem:
text: 'Sent'
icon: 'send'
text: "Sent"
#use_active: False
divider: None
on_release: app.root.ids.scr_mngr.current = 'sent'
badge_text: "0"
MyNavigationDrawerIconButton:
id: draft_cnt
on_release: root.parent.toggle_nav_drawer()
NavigationItem:
text: 'Draft'
icon: 'message-draw'
text: "Draft"
divider: None
on_release: app.root.ids.scr_mngr.current = 'draft'
badge_text: "0"
#MyNavigationDrawerIconButton:
#text: "Starred"
#icon:'star'
#on_release: app.root.ids.scr_mngr.current = 'starred'
#badge_text: "0"
#MyNavigationDrawerIconButton:
#icon: 'archive'
#text: "Archieve"
#on_release: app.root.ids.scr_mngr.current = 'archieve'
#badge_text: "0"
#MyNavigationDrawerIconButton:
#icon: 'email-open-outline'
#text: "Spam"
#on_release: app.root.ids.scr_mngr.current = 'spam'
#badge_text: "0"
MyNavigationDrawerIconButton:
id: trash_cnt
on_release: root.parent.toggle_nav_drawer()
NavigationItem:
text: 'Trash'
icon: 'delete'
text: "Trash"
divider: None
on_release: app.root.ids.scr_mngr.current = 'trash'
badge_text: "0"
MyNavigationDrawerIconButton:
id: allmail_cnt
text: "All Mails"
icon:'contact-mail'
on_release: root.parent.toggle_nav_drawer()
NavigationItem:
text: 'All Mails'
icon: 'contact-mail'
divider: None
on_release: app.root.ids.scr_mngr.current = 'allmails'
badge_text: "0"
on_release: root.parent.toggle_nav_drawer()
on_press: app.load_screen(self)
NavigationDrawerDivider:
NavigationDrawerSubheader:
text: "All labels"
MyNavigationDrawerIconButton:
text: "Address Book"
icon:'book-multiple'
NavigationItem:
text: 'Address Book'
icon: 'book-multiple'
divider: None
on_release: app.root.ids.scr_mngr.current = 'addressbook'
MyNavigationDrawerIconButton:
text: "Settings"
icon:'settings'
on_release: root.parent.toggle_nav_drawer()
NavigationItem:
text: 'Settings'
icon: 'settings'
divider: None
on_release: app.root.ids.scr_mngr.current = 'set'
MyNavigationDrawerIconButton:
text: "Subscriptions/Payment"
icon:'bell'
on_release: root.parent.toggle_nav_drawer()
NavigationItem:
text: 'Payment'
icon: 'bell'
divider: None
on_release: app.root.ids.scr_mngr.current = 'payment'
MyNavigationDrawerIconButton:
text: "Credits"
icon:'wallet'
on_release: root.parent.toggle_nav_drawer()
NavigationItem:
text: 'Credits'
icon: 'wallet'
divider: None
on_release: app.root.ids.scr_mngr.current = 'credits'
MyNavigationDrawerIconButton:
text: "new address"
icon:'account-plus'
on_release: root.parent.toggle_nav_drawer()
NavigationItem:
text: 'New address'
icon: 'account-plus'
divider: None
on_release: app.root.ids.scr_mngr.current = 'login'
MyNavigationDrawerIconButton:
text: "Network Status"
icon:'server-network'
on_release: root.parent.toggle_nav_drawer()
NavigationItem:
text: 'Network status'
icon: 'server-network'
divider: None
on_release: app.root.ids.scr_mngr.current = 'networkstat'
MyNavigationDrawerIconButton:
text: "My Addresses"
icon:'account-multiple'
on_release: root.parent.toggle_nav_drawer()
NavigationItem:
text: 'My addresses'
icon: 'account-multiple'
divider: None
on_release: app.root.ids.scr_mngr.current = 'myaddress'
on_release: root.parent.toggle_nav_drawer()
NavigationLayout:
id: nav_layout
ContentNavigationDrawer:
id: nav_drawer
FloatLayout:
id: float_box
BoxLayout:
id: box_layout
orientation: 'vertical'
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
background_palette: 'Primary'
background_hue: '500'
left_action_items: [['menu', lambda x: app.root.toggle_nav_drawer()]]
elevation: 10
left_action_items: [['menu', lambda x: nav_drawer.toggle_nav_drawer()]]
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:
@ -203,9 +216,15 @@ NavigationLayout:
Archieve:
id:sc20
MDNavigationDrawer:
id: nav_drawer
ContentNavigationDrawer:
id: content_drawer
<Inbox>:
name: 'inbox'
transition: NoTransition()
#transition: NoTransition()
BoxLayout:
orientation: 'vertical'
spacing: dp(5)
@ -261,6 +280,16 @@ NavigationLayout:
Loader:
ComposerButton:
<Page>:
name: 'page'
Label:
text:"I am in Page"
color: 0,0,0,1
<Create>:
name: 'create'
Loader:
<Trash>:
name: 'trash'
BoxLayout:
@ -286,224 +315,6 @@ NavigationLayout:
Loader:
ComposerButton:
<Draft>:
name: 'draft'
BoxLayout:
orientation: 'vertical'
spacing: dp(5)
GridLayout:
id: identi_tag
padding: [20, 20, 0, 5]
cols: 1
size_hint_y: None
height: self.minimum_height
MDLabel:
text: ''
font_style: 'Subtitle2'
BoxLayout:
orientation:'vertical'
ScrollView:
id: scroll_y
do_scroll_x: False
MDList:
id: ml
ComposerButton:
<Starred>:
name: 'starred'
ScrollView:
do_scroll_x: False
MDList:
id: ml
ComposerButton:
<Archieve>:
name: 'archieve'
ScrollView:
do_scroll_x: False
MDList:
id: ml
ComposerButton:
<Spam>:
name: 'spam'
ScrollView:
do_scroll_x: False
MDList:
id: ml
ComposerButton:
<Allmails>:
name: 'allmails'
#FloatLayout:
# MDScrollViewRefreshLayout:
# id: refresh_layout
# refresh_callback: root.refresh_callback
# root_layout: root.set_root_layout()
# MDList:
# id: ml
BoxLayout:
orientation: 'vertical'
spacing: dp(5)
GridLayout:
id: identi_tag
padding: [20, 20, 0, 5]
spacing: dp(5)
cols: 1
size_hint_y: None
height: self.minimum_height
MDLabel:
text: ''
font_style: 'Subtitle2'
BoxLayout:
orientation:'vertical'
ScrollView:
id: scroll_y
do_scroll_x: False
MDList:
id: ml
Loader:
ComposerButton:
<Test>:
name: 'test'
Label:
text:"I am in test"
color: 0,0,0,1
<Page>:
name: 'page'
Label:
text:"I am on page"
color: 0,0,0,1
<Create>:
name: 'create'
Loader:
<Credits>:
name: 'credits'
ScrollView:
do_scroll_x: False
MDList:
id: ml
size_hint_y: None
height: dp(200)
OneLineListItem:
text: "Available Credits"
BoxLayout:
AnchorLayout:
MDRaisedButton:
height: dp(40)
MDLabel:
font_style: 'H4'
text: root.available_credits
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
<DropDownWidget>:
ScrollView:
BoxLayout:
orientation: 'vertical'
size_hint_y: None
height: self.minimum_height + 2 * self.parent.height/4
padding: dp(32)
spacing: 15
BoxLayout:
orientation: 'vertical'
MDTextField:
id: ti
hint_text: 'type or select sender address'
size_hint_y: None
height: 100
font_size: '13sp'
multiline: False
required: True
helper_text_mode: "on_error"
BoxLayout:
size_hint_y: None
height: dp(40)
CustomSpinner:
background_color: app.theme_cls.primary_dark
id: btn
values: app.variable_1
on_text: root.auto_fill_fromaddr() if self.text != 'Select' else ''
option_cls: Factory.get("MySpinnerOption")
background_color: color_button if self.state == 'normal' else color_button_pressed
background_down: 'atlas://data/images/defaulttheme/spinner'
color: color_font
font_size: '12.5sp'
ArrowImg:
BoxLayout:
orientation: 'vertical'
txt_input: txt_input
rv: rv
size : (890, 60)
MyTextInput:
id: txt_input
size_hint_y: None
font_size: '13sp'
height: self.parent.height/2
hint_text: 'type, select or scan QR code for recipients address'
RV:
id: rv
MDTextField:
id: subject
hint_text: 'subject'
required: True
height: 100
font_size: '13sp'
size_hint_y: None
multiline: False
helper_text_mode: "on_error"
MDTextField:
id: body
multiline: True
hint_text: 'body'
size_hint_y: None
font_size: '13sp'
required: True
helper_text_mode: "on_error"
BoxLayout:
spacing:50
<MyTextInput>:
readonly: False
multiline: False
<SelectableLabel>:
# Draw a background to indicate selection
color: 0,0,0,1
canvas.before:
Color:
rgba: app.theme_cls.primary_dark if self.selected else (1, 1, 1, 0)
Rectangle:
pos: self.pos
size: self.size
<RV>:
canvas:
Color:
rgba: 0,0,0,.2
Line:
rectangle: self.x +1 , self.y, self.width - 2, self.height -2
bar_width: 10
scroll_type:['bars']
viewclass: 'SelectableLabel'
SelectableRecycleBoxLayout:
default_size: None, dp(20)
default_size_hint: 1, None
size_hint_y: None
height: self.minimum_height
orientation: 'vertical'
multiselect: False
<Login>:
name: 'login'
ScrollView:
@ -608,6 +419,12 @@ NavigationLayout:
color: (1,1,1,1)
halign: 'center'
<Spam>:
name: 'spam'
Label:
text:"I am in Spam"
color: 0,0,0,1
<Setting>:
name: 'set'
ScrollView:
@ -696,7 +513,7 @@ NavigationLayout:
MDScrollViewRefreshLayout:
id: refresh_layout
refresh_callback: root.refresh_callback
root_layout: root.set_root_layout()
root_layout: root
MDList:
id: ml
Loader:
@ -872,75 +689,6 @@ NavigationLayout:
color: (0,0,0,1)
halign: 'center'
<GrashofPopup>:
id: popup
size_hint : (None,None)
height: 2*(label.height + address.height) + 10
width :app.window_size[0] - (app.window_size[0]/10 if app.app_platform == 'android' else app.window_size[0]/4)
title: 'add contact\'s'
background: './images/popup.jpeg'
title_size: sp(20)
title_color: 0.4, 0.3765, 0.3451, 1
auto_dismiss: False
separator_color: 0.3529, 0.3922, 0.102, 0.7
BoxLayout:
size_hint_y: 0.5
orientation: 'vertical'
spacing:dp(20)
id: popup_box
BoxLayout:
orientation: 'vertical'
MDTextField:
id: label
multiline: False
hint_text: "Label"
required: True
helper_text_mode: "on_error"
on_text: root.checkLabel_valid(self)
MDTextField:
id: address
hint_text: "Address"
required: True
helper_text_mode: "on_error"
on_text: root.checkAddress_valid(self)
BoxLayout:
spacing:5
orientation: 'horizontal'
MDRaisedButton:
id: save_addr
size_hint: 1.5, None
height: dp(40)
on_release:
root.savecontact()
MDLabel:
font_style: 'H6'
text: 'Save'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
MDRaisedButton:
size_hint: 1.5, None
height: dp(40)
on_press: root.dismiss()
on_press: root.close_pop()
MDLabel:
font_style: 'H6'
text: 'Cancel'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
MDRaisedButton:
size_hint: 2, None
height: dp(40)
MDLabel:
font_style: 'H6'
text: 'Scan QR code'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
<NetworkStat>:
name: 'networkstat'
MDTabs:
@ -1075,18 +823,130 @@ NavigationLayout:
height: dp(100) + self.minimum_height
Loader:
<CopyTextBtn@Button>:
id: cpyButton
<ShowQRCode>:
name: 'showqrcode'
BoxLayout:
orientation: 'vertical'
id: qr
<Draft>:
name: 'draft'
BoxLayout:
orientation: 'vertical'
spacing: dp(5)
GridLayout:
id: identi_tag
padding: [20, 20, 0, 5]
cols: 1
size_hint_y: None
height: self.minimum_height
MDLabel:
text: ''
font_style: 'Subtitle2'
BoxLayout:
orientation:'vertical'
ScrollView:
id: scroll_y
do_scroll_x: False
MDList:
id: ml
ComposerButton:
<Allmails>:
name: 'allmails'
#FloatLayout:
# MDScrollViewRefreshLayout:
# id: refresh_layout
# refresh_callback: root.refresh_callback
# root_layout: root.set_root_layout()
# MDList:
# id: ml
BoxLayout:
orientation: 'vertical'
spacing: dp(5)
GridLayout:
id: identi_tag
padding: [20, 20, 0, 5]
spacing: dp(5)
cols: 1
size_hint_y: None
height: self.minimum_height
MDLabel:
text: ''
font_style: 'Subtitle2'
BoxLayout:
orientation:'vertical'
ScrollView:
id: scroll_y
do_scroll_x: False
MDList:
id: ml
Loader:
ComposerButton:
<Credits>:
name: 'credits'
ScrollView:
do_scroll_x: False
MDList:
id: ml
size_hint_y: None
height: dp(200)
OneLineListItem:
text: "Available Credits"
BoxLayout:
AnchorLayout:
MDRaisedButton:
height: dp(40)
MDLabel:
font_style: 'H4'
text: root.available_credits
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
<Starred>:
name: 'starred'
Label:
text:"I am in Starred"
color: 0,0,0,1
background_color: (0,0,0,0)
center_x: self.parent.center_x * 2 - self.parent.parent.padding[0]/2
center_y: self.parent.center_y
on_press:app.root.ids.sc14.copy_composer_text(self)
Image:
source: './images/copy_text.png'
center_x: self.parent.center_x
center_y: self.parent.center_y
size: 20, 20
color: 0,0,0,1
<Archieve>:
name: 'archieve'
Label:
text:"I am in Archieve"
color: 0,0,0,1
color: 0,0,0,1
<ArrowImg@Image>:
source: './images/down-arrow.png' if self.parent.is_open == True else './images/right-arrow.png'
size: 15, 15
x: self.parent.x + self.parent.width - self.width - 5
y: self.parent.y + self.parent.height/2 - self.height + 5
<SearchBar@BoxLayout>:
id: search_bar
size_hint_y: None
height: self.minimum_height
MDIconButton:
icon: 'magnify'
MDTextField:
id: search_field
hint_text: 'Search'
on_text: app.searchQuery(self)
<Loader@MDSpinner>:
id: spinner
size_hint: None, None
size: dp(46), dp(46)
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
active: False
<ComposerButton@BoxLayout>:
size_hint_y: None
@ -1104,71 +964,180 @@ NavigationLayout:
on_press: app.root.ids.scr_mngr.current = 'create'
on_press: app.clear_composer()
<MyaddDetailPopup>:
id: myadd_popup
<DropDownWidget>:
ScrollView:
BoxLayout:
orientation: 'vertical'
size_hint_y: None
height: self.minimum_height + 2 * self.parent.height/4
padding: dp(32)
spacing: 15
BoxLayout:
orientation: 'vertical'
MDTextField:
id: ti
hint_text: 'type or select sender address'
size_hint_y: None
height: 100
font_size: '13sp'
multiline: False
required: True
helper_text_mode: "on_error"
BoxLayout:
size_hint_y: None
height: dp(40)
Spinner:
id: btn
background_color: app.theme_cls.primary_dark
values: app.variable_1
on_text: root.auto_fill_fromaddr() if self.text != 'Select' else ''
option_cls: Factory.get("MySpinnerOption")
background_color: color_button if self.state == 'normal' else color_button_pressed
background_down: 'atlas://data/images/defaulttheme/spinner'
color: color_font
font_size: '12.5sp'
ArrowImg:
BoxLayout:
orientation: 'vertical'
txt_input: txt_input
rv: rv
size : (890, 60)
MyTextInput:
id: txt_input
size_hint_y: None
font_size: '13sp'
height: self.parent.height/2
hint_text: 'type, select or scan QR code for recipients address'
RV:
id: rv
MDTextField:
id: subject
hint_text: 'subject'
required: True
height: 100
font_size: '13sp'
size_hint_y: None
multiline: False
helper_text_mode: "on_error"
MDTextField:
id: body
multiline: True
hint_text: 'body'
size_hint_y: None
font_size: '13sp'
required: True
helper_text_mode: "on_error"
BoxLayout:
spacing:50
<MyTextInput>:
readonly: False
multiline: False
<SelectableLabel>:
# Draw a background to indicate selection
color: 0,0,0,1
canvas.before:
Color:
rgba: app.theme_cls.primary_dark if self.selected else (1, 1, 1, 0)
Rectangle:
pos: self.pos
size: self.size
<RV>:
canvas:
Color:
rgba: 0,0,0,.2
Line:
rectangle: self.x +1 , self.y, self.width - 2, self.height -2
bar_width: 10
scroll_type:['bars']
viewclass: 'SelectableLabel'
SelectableRecycleBoxLayout:
default_size: None, dp(20)
default_size_hint: 1, None
size_hint_y: None
height: self.minimum_height
orientation: 'vertical'
multiselect: False
<LoadingPopup>:
separator_color: 1, 1, 1, 1
background: "White.png"
Button:
id: btn
disabled: True
background_disabled_normal: "White.png"
Image:
source: './images/loader.zip'
anim_delay: 0
#mipmap: True
size: root.size
<CopyTextBtn@Button>:
id: cpyButton
color: 0,0,0,1
background_color: (0,0,0,0)
center_x: self.parent.center_x * 2 - self.parent.parent.padding[0]/2
center_y: self.parent.center_y
on_press:app.root.ids.sc14.copy_composer_text(self)
Image:
source: './images/copy_text.png'
center_x: self.parent.center_x
center_y: self.parent.center_y
size: 20, 20
<GrashofPopup>:
id: popup
size_hint : (None,None)
height: 4.5*(myaddr_label.height+ my_add_btn.children[0].height)
height: 2*(label.height + address.height) + 10
width :app.window_size[0] - (app.window_size[0]/10 if app.app_platform == 'android' else app.window_size[0]/4)
title: 'add contact\'s'
background: './images/popup.jpeg'
title_size: sp(20)
title_color: 0.4, 0.3765, 0.3451, 1
auto_dismiss: False
separator_height: 0
separator_color: 0.3529, 0.3922, 0.102, 0.7
BoxLayout:
id: myadd_popup_box
size_hint_y: None
spacing:dp(70)
size_hint_y: 0.5
orientation: 'vertical'
spacing:dp(20)
id: popup_box
BoxLayout:
size_hint_y: None
orientation: 'vertical'
spacing:dp(25)
MDLabel:
id: myaddr_label
font_style: 'Subtitle2'
theme_text_color: 'Primary'
text: "Label"
font_size: '17sp'
halign: 'left'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: root.address_label
font_size: '15sp'
halign: 'left'
MDLabel:
font_style: 'Subtitle2'
theme_text_color: 'Primary'
text: "Address"
font_size: '17sp'
halign: 'left'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: root.address
font_size: '15sp'
halign: 'left'
MDTextField:
id: label
multiline: False
hint_text: "Label"
required: True
helper_text_mode: "on_error"
on_text: root.checkLabel_valid(self)
MDTextField:
id: address
hint_text: "Address"
required: True
helper_text_mode: "on_error"
on_text: root.checkAddress_valid(self)
BoxLayout:
id: my_add_btn
spacing:5
orientation: 'horizontal'
MDRaisedButton:
size_hint: 2, None
height: dp(40)
on_press: root.send_message_from()
MDLabel:
font_style: 'H6'
text: 'Send message from'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
MDRaisedButton:
id: save_addr
size_hint: 1.5, None
height: dp(40)
on_press: root.dismiss()
on_press: app.root.ids.scr_mngr.current = 'showqrcode'
on_press: app.root.ids.sc15.qrdisplay()
on_release:
root.savecontact()
MDLabel:
font_style: 'H6'
text: 'Show QR code'
text: 'Save'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
@ -1183,6 +1152,15 @@ NavigationLayout:
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
MDRaisedButton:
size_hint: 2, None
height: dp(40)
MDLabel:
font_style: 'H6'
text: 'Scan QR code'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
<AddbookDetailPopup>:
id: addbook_popup
@ -1267,51 +1245,83 @@ NavigationLayout:
color: (1,1,1,1)
halign: 'center'
<ShowQRCode>:
name: 'showqrcode'
<MyaddDetailPopup>:
id: myadd_popup
size_hint : (None,None)
height: 4.5*(myaddr_label.height+ my_add_btn.children[0].height)
width :app.window_size[0] - (app.window_size[0]/10 if app.app_platform == 'android' else app.window_size[0]/4)
background: './images/popup.jpeg'
auto_dismiss: False
separator_height: 0
BoxLayout:
orientation: 'vertical'
id: qr
<ArrowImg@Image>:
source: './images/down-arrow.png' if self.parent.is_open == True else './images/right-arrow.png'
size: 15, 15
x: self.parent.x + self.parent.width - self.width - 5
y: self.parent.y + self.parent.height/2 - self.height + 5
<SearchBar@BoxLayout>:
id: search_bar
id: myadd_popup_box
size_hint_y: None
height: self.minimum_height
MDIconButton:
icon: 'magnify'
MDTextField:
id: search_field
hint_text: 'Search'
on_text: app.searchQuery(self)
<LoadingPopup>:
separator_color: 1, 1, 1, 1
background: "White.png"
Button:
id: btn
disabled: True
background_disabled_normal: "White.png"
Image:
source: './images/loader.zip'
anim_delay: 0
#mipmap: True
size: root.size
<Loader@MDSpinner>:
id: spinner
size_hint: None, None
size: dp(46), dp(46)
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
active: False
spacing:dp(70)
orientation: 'vertical'
BoxLayout:
size_hint_y: None
orientation: 'vertical'
spacing:dp(25)
MDLabel:
id: myaddr_label
font_style: 'Subtitle2'
theme_text_color: 'Primary'
text: "Label"
font_size: '17sp'
halign: 'left'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: root.address_label
font_size: '15sp'
halign: 'left'
MDLabel:
font_style: 'Subtitle2'
theme_text_color: 'Primary'
text: "Address"
font_size: '17sp'
halign: 'left'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: root.address
font_size: '15sp'
halign: 'left'
BoxLayout:
id: my_add_btn
spacing:5
orientation: 'horizontal'
MDRaisedButton:
size_hint: 2, None
height: dp(40)
on_press: root.send_message_from()
MDLabel:
font_style: 'H6'
text: 'Send message from'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
MDRaisedButton:
size_hint: 1.5, None
height: dp(40)
on_press: root.dismiss()
on_press: app.root.ids.scr_mngr.current = 'showqrcode'
on_press: app.root.ids.sc15.qrdisplay()
MDLabel:
font_style: 'H6'
text: 'Show QR code'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
MDRaisedButton:
size_hint: 1.5, None
height: dp(40)
on_press: root.dismiss()
on_press: root.close_pop()
MDLabel:
font_style: 'H6'
text: 'Cancel'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'

View File

@ -11,7 +11,7 @@ from bitmessagekivy.uikivysignaler import UIkivySignaler
from bmconfigparser import BMConfigParser
from functools import partial
from helper_sql import sqlExecute, sqlQuery
from kivy.app import App
from kivymd.app import MDApp
from kivy.clock import Clock
from kivy.core.clipboard import Clipboard
from kivy.core.window import Window
@ -48,11 +48,13 @@ from kivymd.uix.list import (
TwoLineAvatarIconListItem,
TwoLineListItem,
OneLineIconListItem,
OneLineAvatarListItem,
IRightBody
)
from kivymd.uix.navigationdrawer import (
MDNavigationDrawer,
NavigationDrawerHeaderBase
)
# from kivymd.uix.navigationdrawer import (
# MDNavigationDrawer,
# NavigationDrawerHeaderBase
# )
from kivymd.uix.selectioncontrol import MDCheckbox
from kivymd.theming import ThemeManager
@ -71,14 +73,6 @@ def toast(text):
return
class Navigatorss(MDNavigationDrawer):
"""Navigators class contains image, title and logo"""
image_source = StringProperty('images/qidenticon_two.png')
title = StringProperty('Navigation')
drawer_logo = StringProperty()
class Inbox(Screen):
"""Inbox Screen uses screen to show widgets of screens"""
@ -115,8 +109,8 @@ class Inbox(Screen):
self.inboxDataQuery(xAddress, where, what)
if self.queryreturn:
state.kivyapp.get_inbox_count()
src_mng_obj = state.kivyapp.root.children[2].children[0].ids
src_mng_obj.inbox_cnt.badge_text = state.inbox_count
# src_mng_obj = state.kivyapp.root.children[2].children[0].ids
# src_mng_obj.inbox_cnt.badge_text = state.inbox_count
for mail in self.queryreturn:
# third_text = mail[3].replace('\n', ' ')
data.append({
@ -395,8 +389,9 @@ class MyAddress(Screen):
def refresh_callback(interval):
"""Method used for loading the myaddress screen data"""
state.searcing_text = ''
state.kivyapp.root.ids.sc10.children[2].active = False
self.children[2].children[2].ids.search_field.text = ''
#state.kivyapp.root.ids.sc10.children[2].active = False
# self.children[2].children[2].ids.search_field.text = ''
self.children[3].children[2].ids.search_field.text = ''
self.has_refreshed = True
self.ids.ml.clear_widgets()
self.init_ui()
@ -417,10 +412,6 @@ class MyAddress(Screen):
return True
return False
def set_root_layout(self):
"""Setting root layout"""
return self.manager.parent.parent
class AddressBook(Screen):
"""AddressBook Screen uses screen to show widgets of screens"""
@ -653,20 +644,16 @@ class DropDownWidget(BoxLayout):
int(BMConfigParser().safeGet(
'bitmessagesettings', 'ttl')))
state.check_sent_acc = fromAddress
state.msg_counter_objs = self.parent.parent.parent.parent\
.parent.parent.children[2].children[0].ids
# state.msg_counter_objs = self.parent.parent.parent.parent\
# .parent.parent.children[2].children[0].ids
if state.detailPageType == 'draft' \
and state.send_draft_mail:
state.draft_count = str(int(state.draft_count) - 1)
state.msg_counter_objs.draft_cnt.badge_text = (
state.draft_count)
# state.msg_counter_objs.draft_cnt.badge_text = (
# state.draft_count)
state.detailPageType = ''
state.send_draft_mail = None
# self.parent.parent.screens[0].ids.ml.clear_widgets()
# self.parent.parent.screens[0].loadMessagelist(state.association)
self.parent.parent.screens[3].update_sent_messagelist()
# self.parent.parent.screens[16].clear_widgets()
# self.parent.parent.screens[16].add_widget(Allmails())
Clock.schedule_once(self.callback_for_msgsend, 3)
queues.workerQueue.put(('sendmessage', toAddress))
print("sqlExecute successfully #######################")
@ -824,7 +811,7 @@ class NetworkStat(Screen):
len(objectracker.missingObjects))
class ContentNavigationDrawer(Navigatorss):
class ContentNavigationDrawer(BoxLayout):
"""Navigate Content Drawer"""
pass
@ -857,14 +844,14 @@ class Random(Screen):
self.ids.label.text = ''
self.parent.parent.children[1].opacity = 1
self.parent.parent.children[1].disabled = False
state.kivyapp.root.ids.sc10.children[1].active = True
state.kivyapp.loadMyAddressScreen(True)
self.manager.current = 'myaddress'
Clock.schedule_once(self.address_created_callback, 6)
@staticmethod
def address_created_callback(dt=0):
"""New address created"""
state.kivyapp.root.ids.sc10.children[1].active = False
state.kivyapp.loadMyAddressScreen(False)
state.kivyapp.root.ids.sc10.ids.ml.clear_widgets()
state.kivyapp.root.ids.sc10.is_add_created = True
state.kivyapp.root.ids.sc10.init_ui()
@ -1050,8 +1037,8 @@ class Sent(Screen):
@staticmethod
def set_sentCount(total_sent):
"""Set the total no. of sent message count"""
src_mng_obj = state.kivyapp.root.children[2].children[0].ids
src_mng_obj.send_cnt.badge_text = str(total_sent)
# src_mng_obj = state.kivyapp.root.children[2].children[0].ids
# src_mng_obj.send_cnt.badge_text = str(total_sent)
state.sent_count = str(total_sent)
def sent_detail(self, ackdata, *args):
@ -1068,19 +1055,19 @@ class Sent(Screen):
def delete(self, data_index, instance, *args):
"""Delete sent mail from sent mail listing"""
try:
msg_count_objs = self.parent.parent.parent.parent.children[
2].children[0].ids
except Exception:
msg_count_objs = self.parent.parent.parent.parent.parent.children[
2].children[0].ids
# try:
# msg_count_objs = self.parent.parent.parent.parent.children[
# 2].children[0].ids
# except Exception:
# msg_count_objs = self.parent.parent.parent.parent.parent.children[
# 2].children[0].ids
if int(state.sent_count) > 0:
msg_count_objs.send_cnt.badge_text = str(
int(state.sent_count) - 1)
msg_count_objs.trash_cnt.badge_text = str(
int(state.trash_count) + 1)
msg_count_objs.allmail_cnt.badge_text = str(
int(state.all_count) - 1)
# msg_count_objs.send_cnt.badge_text = str(
# int(state.sent_count) - 1)
# msg_count_objs.trash_cnt.badge_text = str(
# int(state.trash_count) + 1)
# msg_count_objs.allmail_cnt.badge_text = str(
# int(state.all_count) - 1)
state.sent_count = str(int(state.sent_count) - 1)
state.trash_count = str(int(state.trash_count) + 1)
state.all_count = str(int(state.all_count) - 1)
@ -1137,8 +1124,8 @@ class Trash(Screen):
self.trashDataQuery(0, 20)
if self.trash_messages:
self.ids.identi_tag.children[0].text = 'Trash'
src_mng_obj = state.kivyapp.root.children[2].children[0].ids
src_mng_obj.trash_cnt.badge_text = state.trash_count
# src_mng_obj = state.kivyapp.root.children[2].children[0].ids
# src_mng_obj.trash_cnt.badge_text = state.trash_count
self.set_mdList()
self.ids.scroll_y.bind(scroll_y=self.check_scroll_y)
else:
@ -1256,8 +1243,8 @@ class Trash(Screen):
"DELETE FROM sent WHERE ackdata = ?;", self.delete_index)
msg_count_objs = state.kivyapp.root.children[2].children[0].ids
if int(state.trash_count) > 0:
msg_count_objs.trash_cnt.badge_text = str(
int(state.trash_count) - 1)
# msg_count_objs.trash_cnt.badge_text = str(
# int(state.trash_count) - 1)
state.trash_count = str(int(state.trash_count) - 1)
Clock.schedule_once(self.callback_for_screen_load, 1)
@ -1288,11 +1275,11 @@ class Setting(Screen):
pass
class NavigateApp(App):
class NavigateApp(MDApp):
"""Navigation Layout of class"""
# pylint: disable=too-many-public-methods
theme_cls = ThemeManager()
# theme_cls = ThemeManager()
previous_date = ObjectProperty()
obj_1 = ObjectProperty()
variable_1 = ListProperty(BMConfigParser().addresses())
@ -1325,7 +1312,6 @@ class NavigateApp(App):
print(os.path.join(os.path.dirname(__file__), 'main.kv'))
main_widget = Builder.load_file(
os.path.join(os.path.dirname(__file__), 'main.kv'))
self.nav_drawer = Navigatorss()
self.obj_1 = AddressBook()
kivysignalthread = UIkivySignaler()
kivysignalthread.daemon = True
@ -1473,7 +1459,7 @@ class NavigateApp(App):
self.root.ids.sc11.children[1].active = True
Clock.schedule_once(self.search_callback, 0.5)
elif state.search_screen == 'myaddress':
self.root.ids.sc10.children[1].active = True
self.loadMyAddressScreen(True)
Clock.schedule_once(self.search_callback, 0.5)
elif state.search_screen == 'sent':
self.root.ids.sc4.children[1].active = True
@ -1492,13 +1478,20 @@ class NavigateApp(App):
elif state.search_screen == 'myaddress':
self.root.ids.sc10.ids.ml.clear_widgets()
self.root.ids.sc10.init_ui()
self.root.ids.sc10.children[1].active = False
self.loadMyAddressScreen(False)
else:
self.root.ids.sc4.ids.ml.clear_widgets()
self.root.ids.sc4.loadSent(state.association)
self.root.ids.sc4.children[1].active = False
self.root.ids.scr_mngr.current = state.search_screen
def loadMyAddressScreen(self, action):
"""loadMyAddressScreen method spin the loader"""
if len(self.root.ids.sc10.children) <=3:
self.root.ids.sc10.children[1].active = action
else:
self.root.ids.sc10.children[2].active = action
def save_draft(self):
"""Saving drafts messages"""
composer_objs = self.root
@ -1547,8 +1540,10 @@ class NavigateApp(App):
"""Common header for all window"""
self.root.ids.toolbar.right_action_items = [
['account-plus', lambda x: self.addingtoaddressbook()]]
# self.root.ids.toolbar.left_action_items = [
# ['menu', lambda x: self.root.toggle_nav_drawer()]]
self.root.ids.toolbar.left_action_items = [
['menu', lambda x: self.root.toggle_nav_drawer()]]
['menu', lambda x: self.root.ids.nav_drawer.toggle_nav_drawer()]]
return
def back_press(self):
@ -1694,7 +1689,7 @@ class NavigateApp(App):
except Exception:
self.root.ids.sc10.children[
2].children[2].ids.search_field.text = ''
self.root.ids.sc10.children[1].active = True
self.loadMyAddressScreen(True)
Clock.schedule_once(self.search_callback, 0.5)
else:
self.root.ids.sc4.children[
@ -1706,8 +1701,9 @@ class NavigateApp(App):
def set_identicon(self, text):
"""Show identicon in address spinner"""
img = identiconGeneration.generate(text)
self.root.children[2].children[0].ids.btn.children[1].texture = (
img.texture)
# self.root.children[2].children[0].ids.btn.children[1].texture = (
# img.texture)
self.root.children[0].children[0].ids.btn.texture = (img.texture)
def set_mail_detail_header(self):
"""Setting the details of the page"""
@ -1804,8 +1800,10 @@ class GrashofPopup(Popup):
def checkAddress_valid(self, instance):
"""Checking address is valid or not"""
# my_addresses = (
# self.parent.children[1].children[2].children[0].ids.btn.values)
my_addresses = (
self.parent.children[1].children[2].children[0].ids.btn.values)
self.parent.children[1].children[0].children[0].ids.btn.values)
add_book = [addr[1] for addr in kivy_helper_search.search_sql(
folder="addressbook")]
entered_text = str(instance.text).strip()
@ -1892,31 +1890,6 @@ class IconRightSampleWidget(IRightBodyTouch, MDCheckbox):
pass
class NavigationDrawerTwoLineListItem(
TwoLineListItem, NavigationDrawerHeaderBase):
"""Navigation Drawer in Listitems"""
address_property = StringProperty()
def __init__(self, **kwargs):
"""Method for Navigation Drawer"""
super(NavigationDrawerTwoLineListItem, self).__init__(**kwargs)
Clock.schedule_once(lambda dt: self.setup())
def setup(self):
"""Bind Controller.current_account property"""
pass
def on_current_account(self, account):
"""Account detail"""
pass
def _update_specific_text_color(self, instance, value):
pass
def _set_active(self, active, list_):
pass
class MailDetail(Screen):
"""MailDetail Screen uses to show the detail of mails"""
@ -1976,7 +1949,7 @@ class MailDetail(Screen):
sqlExecute(
"UPDATE sent SET folder = 'trash' WHERE"
" ackdata = ?;", state.mail_id)
msg_count_objs.send_cnt.badge_text = str(int(state.sent_count) - 1)
# msg_count_objs.send_cnt.badge_text = str(int(state.sent_count) - 1)
state.sent_count = str(int(state.sent_count) - 1)
self.parent.screens[3].ids.ml.clear_widgets()
self.parent.screens[3].loadSent(state.association)
@ -1988,27 +1961,25 @@ class MailDetail(Screen):
sqlExecute(
"UPDATE inbox SET folder = 'trash' WHERE"
" msgid = ?;", state.mail_id)
msg_count_objs.inbox_cnt.badge_text = str(
int(state.inbox_count) - 1)
# msg_count_objs.inbox_cnt.badge_text = str(
# int(state.inbox_count) - 1)
state.inbox_count = str(int(state.inbox_count) - 1)
self.parent.screens[0].ids.ml.clear_widgets()
self.parent.screens[0].loadMessagelist(state.association)
elif state.detailPageType == 'draft':
sqlExecute("DELETE FROM sent WHERE ackdata = ?;", state.mail_id)
msg_count_objs.draft_cnt.badge_text = str(
int(state.draft_count) - 1)
# msg_count_objs.draft_cnt.badge_text = str(
# int(state.draft_count) - 1)
state.draft_count = str(int(state.draft_count) - 1)
self.parent.screens[15].clear_widgets()
self.parent.screens[15].add_widget(Draft())
# self.parent.current = 'allmails' \
# if state.is_allmail else state.detailPageType
if state.detailPageType != 'draft':
msg_count_objs.trash_cnt.badge_text = str(
int(state.trash_count) + 1)
msg_count_objs.allmail_cnt.badge_text = str(
int(state.all_count) - 1)
# msg_count_objs.trash_cnt.badge_text = str(
# int(state.trash_count) + 1)
# msg_count_objs.allmail_cnt.badge_text = str(
# int(state.all_count) - 1)
state.trash_count = str(int(state.trash_count) + 1)
state.all_count = str(int(state.all_count) - 1)
self.parent.screens[4].clear_widgets()
@ -2044,8 +2015,10 @@ class MailDetail(Screen):
def write_msg(self, navApp):
"""Write on draft mail"""
state.send_draft_mail = state.mail_id
# composer_ids = (
# self.parent.parent.parent.parent.parent.ids.sc3.children[1].ids)
composer_ids = (
self.parent.parent.parent.parent.parent.ids.sc3.children[1].ids)
self.parent.parent.ids.sc3.children[1].ids)
composer_ids.ti.text = state.write_msg['from_addr']
composer_ids.btn.text = state.write_msg['from_addr']
composer_ids.txt_input.text = state.write_msg['to_addr']
@ -2215,8 +2188,8 @@ class Draft(Screen):
len(self.queryreturn))
if self.queryreturn:
self.ids.identi_tag.children[0].text = 'Draft'
src_mng_obj = state.kivyapp.root.children[2].children[0].ids
src_mng_obj.draft_cnt.badge_text = state.draft_count
# src_mng_obj = state.kivyapp.root.children[2].children[0].ids
# src_mng_obj.draft_cnt.badge_text = state.draft_count
self.set_mdList()
self.ids.scroll_y.bind(scroll_y=self.check_scroll_y)
else:
@ -2414,8 +2387,8 @@ class Allmails(Screen):
state.kivyapp.get_sent_count()
state.all_count = str(
int(state.sent_count) + int(state.inbox_count))
state.kivyapp.root.children[2].children[
0].ids.allmail_cnt.badge_text = state.all_count
# state.kivyapp.root.children[2].children[
# 0].ids.allmail_cnt.badge_text = state.all_count
self.set_mdlist()
# self.ids.refresh_layout.bind(scroll_y=self.check_scroll_y)
self.ids.scroll_y.bind(scroll_y=self.check_scroll_y)
@ -2516,30 +2489,30 @@ class Allmails(Screen):
unique_id)
self.ids.ml.remove_widget(instance.parent.parent)
try:
msg_count_objs = self.parent.parent.parent.parent.parent.children[
2].children[0].ids
nav_lay_obj = self.parent.parent.parent.parent.parent.ids
# msg_count_objs = self.parent.parent.parent.parent.parent.children[
# 2].children[0].ids
nav_lay_obj = self.parent.parent.parent.ids
except Exception:
msg_count_objs = (
self.parent.parent.parent.parent.parent.parent.children[
2].children[0].ids)
nav_lay_obj = self.parent.parent.parent.parent.parent.parent.ids
if folder == 'inbox':
msg_count_objs.inbox_cnt.badge_text = str(
int(state.inbox_count) - 1)
# msg_count_objs.inbox_cnt.badge_text = str(
# int(state.inbox_count) - 1)
state.inbox_count = str(int(state.inbox_count) - 1)
nav_lay_obj.sc1.ids.ml.clear_widgets()
nav_lay_obj.sc1.loadMessagelist(state.association)
else:
msg_count_objs.send_cnt.badge_text = str(
int(state.sent_count) - 1)
# msg_count_objs.send_cnt.badge_text = str(
# int(state.sent_count) - 1)
state.sent_count = str(int(state.sent_count) - 1)
nav_lay_obj.sc4.ids.ml.clear_widgets()
nav_lay_obj.sc4.loadSent(state.association)
msg_count_objs.trash_cnt.badge_text = str(
int(state.trash_count) + 1)
msg_count_objs.allmail_cnt.badge_text = str(
int(state.all_count) - 1)
# msg_count_objs.trash_cnt.badge_text = str(
# int(state.trash_count) + 1)
# msg_count_objs.allmail_cnt.badge_text = str(
# int(state.all_count) - 1)
state.trash_count = str(int(state.trash_count) + 1)
state.all_count = str(int(state.all_count) - 1)
if int(state.all_count) <= 0:
@ -2618,3 +2591,8 @@ class AddressDropdown(OneLineIconListItem):
"""AddressDropdown showns all the addresses"""
pass
class NavigationItem(OneLineAvatarListItem):
"""NavigationItem class is for button behaviour"""
icon = StringProperty()