Merge pull request #23 from jaicis/kivyfixes

kivy fixed part 6
This commit is contained in:
navjotcis 2020-01-09 20:40:32 +05:30 committed by GitHub
commit 9a1917face
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 MDCheckbox kivymd.uix.selectioncontrol.MDCheckbox
#:import MDList kivymd.uix.list.MDList #:import MDList kivymd.uix.list.MDList
#:import OneLineListItem kivymd.uix.list.OneLineListItem #:import OneLineListItem kivymd.uix.list.OneLineListItem
@ -15,35 +15,58 @@
#:import Factory kivy.factory.Factory #:import Factory kivy.factory.Factory
#:import MDScrollViewRefreshLayout kivymd.uix.refreshlayout.MDScrollViewRefreshLayout #:import MDScrollViewRefreshLayout kivymd.uix.refreshlayout.MDScrollViewRefreshLayout
#:import MDSpinner kivymd.uix.spinner.MDSpinner #:import MDSpinner kivymd.uix.spinner.MDSpinner
#:import NoTransition kivy.uix.screenmanager.NoTransition
#:import MDTabsBase kivymd.uix.tab.MDTabsBase #:import MDTabsBase kivymd.uix.tab.MDTabsBase
<Tab@BoxLayout+MDTabsBase> <Tab@BoxLayout+MDTabsBase>
#:set color_button (0.784, 0.443, 0.216, 1) # brown #: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_button_pressed (0.659, 0.522, 0.431, 1) # darker brown
#:set color_font (0.957, 0.890, 0.843, 1) # off white #:set color_font (0.957, 0.890, 0.843, 1) # off white
<MyNavigationDrawerIconButton@NavigationDrawerIconButton>:
font_style: 'Body1'
theme_text_color: 'Secondary'
<MySpinnerOption@SpinnerOption>: <MySpinnerOption@SpinnerOption>:
font_size: '12.5sp' font_size: '12.5sp'
background_color: color_button if self.state == 'down' else color_button_pressed background_color: color_button if self.state == 'down' else color_button_pressed
background_down: 'atlas://data/images/defaulttheme/button' background_down: 'atlas://data/images/defaulttheme/button'
color: color_font color: color_font
<ContentNavigationDrawer@Navigatorss>: <NavigationItem>
drawer_logo: './images/drawer_logo1.png' theme_text_color: 'Custom'
NavigationDrawerDivider: divider: None
height: dp(7)
NavigationDrawerSubheader: IconLeftWidget:
text: "Accounts" icon: root.icon
AddressDropdown:
CustomSpinner:
<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 id: btn
pos_hint:{"x":0,"y":.25} pos_hint:{"x":0,"y":.1}
option_cls: Factory.get("MySpinnerOption") option_cls: Factory.get("MySpinnerOption")
font_size: '11.9sp' font_size: '11.9sp'
text: app.getDefaultAccData() text: app.getDefaultAccData()
@ -58,110 +81,100 @@
y: self.parent.y + self.parent.height/4 y: self.parent.y + self.parent.height/4
size: self.parent.height/2, self.parent.height/2 size: self.parent.height/2, self.parent.height/2
ArrowImg: ArrowImg:
MyNavigationDrawerIconButton: NavigationItem:
id: inbox_cnt text: 'Inbox'
icon: 'email-open' icon: 'email-open'
text: "Inbox" divider: None
badge_text: "0"
on_release: app.root.ids.scr_mngr.current = 'inbox' 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) on_press: app.load_screen(self)
MyNavigationDrawerIconButton: NavigationItem:
id: send_cnt text: 'Sent'
icon: 'send' icon: 'send'
text: "Sent" divider: None
#use_active: False
on_release: app.root.ids.scr_mngr.current = 'sent' on_release: app.root.ids.scr_mngr.current = 'sent'
badge_text: "0" on_release: root.parent.toggle_nav_drawer()
MyNavigationDrawerIconButton: NavigationItem:
id: draft_cnt text: 'Draft'
icon: 'message-draw' icon: 'message-draw'
text: "Draft" divider: None
on_release: app.root.ids.scr_mngr.current = 'draft' on_release: app.root.ids.scr_mngr.current = 'draft'
badge_text: "0" on_release: root.parent.toggle_nav_drawer()
#MyNavigationDrawerIconButton: NavigationItem:
#text: "Starred" text: 'Trash'
#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
icon: 'delete' icon: 'delete'
text: "Trash" divider: None
on_release: app.root.ids.scr_mngr.current = 'trash' on_release: app.root.ids.scr_mngr.current = 'trash'
badge_text: "0" on_release: root.parent.toggle_nav_drawer()
MyNavigationDrawerIconButton: NavigationItem:
id: allmail_cnt text: 'All Mails'
text: "All Mails"
icon: 'contact-mail' icon: 'contact-mail'
divider: None
on_release: app.root.ids.scr_mngr.current = 'allmails' 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) on_press: app.load_screen(self)
NavigationDrawerDivider: NavigationItem:
NavigationDrawerSubheader: text: 'Address Book'
text: "All labels"
MyNavigationDrawerIconButton:
text: "Address Book"
icon: 'book-multiple' icon: 'book-multiple'
divider: None
on_release: app.root.ids.scr_mngr.current = 'addressbook' on_release: app.root.ids.scr_mngr.current = 'addressbook'
MyNavigationDrawerIconButton: on_release: root.parent.toggle_nav_drawer()
text: "Settings" NavigationItem:
text: 'Settings'
icon: 'settings' icon: 'settings'
divider: None
on_release: app.root.ids.scr_mngr.current = 'set' on_release: app.root.ids.scr_mngr.current = 'set'
MyNavigationDrawerIconButton: on_release: root.parent.toggle_nav_drawer()
text: "Subscriptions/Payment" NavigationItem:
text: 'Payment'
icon: 'bell' icon: 'bell'
divider: None
on_release: app.root.ids.scr_mngr.current = 'payment' on_release: app.root.ids.scr_mngr.current = 'payment'
MyNavigationDrawerIconButton: on_release: root.parent.toggle_nav_drawer()
text: "Credits" NavigationItem:
text: 'Credits'
icon: 'wallet' icon: 'wallet'
divider: None
on_release: app.root.ids.scr_mngr.current = 'credits' on_release: app.root.ids.scr_mngr.current = 'credits'
MyNavigationDrawerIconButton: on_release: root.parent.toggle_nav_drawer()
text: "new address" NavigationItem:
text: 'New address'
icon: 'account-plus' icon: 'account-plus'
divider: None
on_release: app.root.ids.scr_mngr.current = 'login' on_release: app.root.ids.scr_mngr.current = 'login'
MyNavigationDrawerIconButton: on_release: root.parent.toggle_nav_drawer()
text: "Network Status" NavigationItem:
text: 'Network status'
icon: 'server-network' icon: 'server-network'
divider: None
on_release: app.root.ids.scr_mngr.current = 'networkstat' on_release: app.root.ids.scr_mngr.current = 'networkstat'
MyNavigationDrawerIconButton: on_release: root.parent.toggle_nav_drawer()
text: "My Addresses" NavigationItem:
text: 'My addresses'
icon: 'account-multiple' icon: 'account-multiple'
divider: None
on_release: app.root.ids.scr_mngr.current = 'myaddress' on_release: app.root.ids.scr_mngr.current = 'myaddress'
on_release: root.parent.toggle_nav_drawer()
NavigationLayout: NavigationLayout:
id: nav_layout id: nav_layout
ContentNavigationDrawer:
id: nav_drawer
FloatLayout:
id: float_box
BoxLayout:
id: box_layout
orientation: 'vertical'
MDToolbar: MDToolbar:
id: toolbar id: toolbar
title: app.current_address_label() title: app.current_address_label()
opacity: 1 if app.addressexist() else 0 opacity: 1 if app.addressexist() else 0
disabled: False if app.addressexist() else True disabled: False if app.addressexist() else True
pos_hint: {"top": 1}
md_bg_color: app.theme_cls.primary_color md_bg_color: app.theme_cls.primary_color
background_palette: 'Primary' elevation: 10
background_hue: '500' left_action_items: [['menu', lambda x: nav_drawer.toggle_nav_drawer()]]
left_action_items: [['menu', lambda x: app.root.toggle_nav_drawer()]]
right_action_items: [['account-plus', lambda x: app.addingtoaddressbook()]] right_action_items: [['account-plus', lambda x: app.addingtoaddressbook()]]
ScreenManager: ScreenManager:
id: scr_mngr id: scr_mngr
size_hint_y: None
height: root.height - toolbar.height
Inbox: Inbox:
id:sc1 id:sc1
Page: Page:
@ -203,9 +216,15 @@ NavigationLayout:
Archieve: Archieve:
id:sc20 id:sc20
MDNavigationDrawer:
id: nav_drawer
ContentNavigationDrawer:
id: content_drawer
<Inbox>: <Inbox>:
name: 'inbox' name: 'inbox'
transition: NoTransition() #transition: NoTransition()
BoxLayout: BoxLayout:
orientation: 'vertical' orientation: 'vertical'
spacing: dp(5) spacing: dp(5)
@ -261,6 +280,16 @@ NavigationLayout:
Loader: Loader:
ComposerButton: ComposerButton:
<Page>:
name: 'page'
Label:
text:"I am in Page"
color: 0,0,0,1
<Create>:
name: 'create'
Loader:
<Trash>: <Trash>:
name: 'trash' name: 'trash'
BoxLayout: BoxLayout:
@ -286,224 +315,6 @@ NavigationLayout:
Loader: Loader:
ComposerButton: 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>: <Login>:
name: 'login' name: 'login'
ScrollView: ScrollView:
@ -608,6 +419,12 @@ NavigationLayout:
color: (1,1,1,1) color: (1,1,1,1)
halign: 'center' halign: 'center'
<Spam>:
name: 'spam'
Label:
text:"I am in Spam"
color: 0,0,0,1
<Setting>: <Setting>:
name: 'set' name: 'set'
ScrollView: ScrollView:
@ -696,7 +513,7 @@ NavigationLayout:
MDScrollViewRefreshLayout: MDScrollViewRefreshLayout:
id: refresh_layout id: refresh_layout
refresh_callback: root.refresh_callback refresh_callback: root.refresh_callback
root_layout: root.set_root_layout() root_layout: root
MDList: MDList:
id: ml id: ml
Loader: Loader:
@ -872,75 +689,6 @@ NavigationLayout:
color: (0,0,0,1) color: (0,0,0,1)
halign: 'center' 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>: <NetworkStat>:
name: 'networkstat' name: 'networkstat'
MDTabs: MDTabs:
@ -1075,18 +823,130 @@ NavigationLayout:
height: dp(100) + self.minimum_height height: dp(100) + self.minimum_height
Loader: Loader:
<CopyTextBtn@Button>: <ShowQRCode>:
id: cpyButton 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 color: 0,0,0,1
background_color: (0,0,0,0)
center_x: self.parent.center_x * 2 - self.parent.parent.padding[0]/2 color: 0,0,0,1
center_y: self.parent.center_y
on_press:app.root.ids.sc14.copy_composer_text(self) <Archieve>:
Image: name: 'archieve'
source: './images/copy_text.png' Label:
center_x: self.parent.center_x text:"I am in Archieve"
center_y: self.parent.center_y color: 0,0,0,1
size: 20, 20
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>: <ComposerButton@BoxLayout>:
size_hint_y: None size_hint_y: None
@ -1104,71 +964,180 @@ NavigationLayout:
on_press: app.root.ids.scr_mngr.current = 'create' on_press: app.root.ids.scr_mngr.current = 'create'
on_press: app.clear_composer() 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) 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) 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' background: './images/popup.jpeg'
title_size: sp(20)
title_color: 0.4, 0.3765, 0.3451, 1
auto_dismiss: False auto_dismiss: False
separator_height: 0 separator_color: 0.3529, 0.3922, 0.102, 0.7
BoxLayout: BoxLayout:
id: myadd_popup_box size_hint_y: 0.5
size_hint_y: None
spacing:dp(70)
orientation: 'vertical' orientation: 'vertical'
spacing:dp(20)
id: popup_box
BoxLayout: BoxLayout:
size_hint_y: None
orientation: 'vertical' orientation: 'vertical'
spacing:dp(25) MDTextField:
MDLabel: id: label
id: myaddr_label multiline: False
font_style: 'Subtitle2' hint_text: "Label"
theme_text_color: 'Primary' required: True
text: "Label" helper_text_mode: "on_error"
font_size: '17sp' on_text: root.checkLabel_valid(self)
halign: 'left' MDTextField:
MDLabel: id: address
font_style: 'Body1' hint_text: "Address"
theme_text_color: 'Primary' required: True
text: root.address_label helper_text_mode: "on_error"
font_size: '15sp' on_text: root.checkAddress_valid(self)
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: BoxLayout:
id: my_add_btn
spacing:5 spacing:5
orientation: 'horizontal' orientation: 'horizontal'
MDRaisedButton: MDRaisedButton:
size_hint: 2, None id: save_addr
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 size_hint: 1.5, None
height: dp(40) height: dp(40)
on_press: root.dismiss() on_release:
on_press: app.root.ids.scr_mngr.current = 'showqrcode' root.savecontact()
on_press: app.root.ids.sc15.qrdisplay()
MDLabel: MDLabel:
font_style: 'H6' font_style: 'H6'
text: 'Show QR code' text: 'Save'
font_size: '13sp' font_size: '13sp'
color: (1,1,1,1) color: (1,1,1,1)
halign: 'center' halign: 'center'
@ -1183,6 +1152,15 @@ NavigationLayout:
font_size: '13sp' font_size: '13sp'
color: (1,1,1,1) color: (1,1,1,1)
halign: 'center' 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>: <AddbookDetailPopup>:
id: addbook_popup id: addbook_popup
@ -1267,51 +1245,83 @@ NavigationLayout:
color: (1,1,1,1) color: (1,1,1,1)
halign: 'center' 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: BoxLayout:
orientation: 'vertical' id: myadd_popup_box
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
size_hint_y: None size_hint_y: None
height: self.minimum_height spacing:dp(70)
orientation: 'vertical'
MDIconButton: BoxLayout:
icon: 'magnify' size_hint_y: None
orientation: 'vertical'
MDTextField: spacing:dp(25)
id: search_field MDLabel:
hint_text: 'Search' id: myaddr_label
on_text: app.searchQuery(self) font_style: 'Subtitle2'
theme_text_color: 'Primary'
text: "Label"
<LoadingPopup>: font_size: '17sp'
separator_color: 1, 1, 1, 1 halign: 'left'
background: "White.png" MDLabel:
Button: font_style: 'Body1'
id: btn theme_text_color: 'Primary'
disabled: True text: root.address_label
background_disabled_normal: "White.png" font_size: '15sp'
Image: halign: 'left'
source: './images/loader.zip' MDLabel:
anim_delay: 0 font_style: 'Subtitle2'
#mipmap: True theme_text_color: 'Primary'
size: root.size text: "Address"
font_size: '17sp'
halign: 'left'
<Loader@MDSpinner>: MDLabel:
id: spinner font_style: 'Body1'
size_hint: None, None theme_text_color: 'Primary'
size: dp(46), dp(46) text: root.address
pos_hint: {'center_x': 0.5, 'center_y': 0.5} font_size: '15sp'
active: False 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 bmconfigparser import BMConfigParser
from functools import partial from functools import partial
from helper_sql import sqlExecute, sqlQuery from helper_sql import sqlExecute, sqlQuery
from kivy.app import App from kivymd.app import MDApp
from kivy.clock import Clock from kivy.clock import Clock
from kivy.core.clipboard import Clipboard from kivy.core.clipboard import Clipboard
from kivy.core.window import Window from kivy.core.window import Window
@ -48,11 +48,13 @@ from kivymd.uix.list import (
TwoLineAvatarIconListItem, TwoLineAvatarIconListItem,
TwoLineListItem, TwoLineListItem,
OneLineIconListItem, OneLineIconListItem,
OneLineAvatarListItem,
IRightBody
) )
from kivymd.uix.navigationdrawer import ( # from kivymd.uix.navigationdrawer import (
MDNavigationDrawer, # MDNavigationDrawer,
NavigationDrawerHeaderBase # NavigationDrawerHeaderBase
) # )
from kivymd.uix.selectioncontrol import MDCheckbox from kivymd.uix.selectioncontrol import MDCheckbox
from kivymd.theming import ThemeManager from kivymd.theming import ThemeManager
@ -71,14 +73,6 @@ def toast(text):
return 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): class Inbox(Screen):
"""Inbox Screen uses screen to show widgets of screens""" """Inbox Screen uses screen to show widgets of screens"""
@ -115,8 +109,8 @@ class Inbox(Screen):
self.inboxDataQuery(xAddress, where, what) self.inboxDataQuery(xAddress, where, what)
if self.queryreturn: if self.queryreturn:
state.kivyapp.get_inbox_count() state.kivyapp.get_inbox_count()
src_mng_obj = state.kivyapp.root.children[2].children[0].ids # src_mng_obj = state.kivyapp.root.children[2].children[0].ids
src_mng_obj.inbox_cnt.badge_text = state.inbox_count # src_mng_obj.inbox_cnt.badge_text = state.inbox_count
for mail in self.queryreturn: for mail in self.queryreturn:
# third_text = mail[3].replace('\n', ' ') # third_text = mail[3].replace('\n', ' ')
data.append({ data.append({
@ -395,8 +389,9 @@ class MyAddress(Screen):
def refresh_callback(interval): def refresh_callback(interval):
"""Method used for loading the myaddress screen data""" """Method used for loading the myaddress screen data"""
state.searcing_text = '' state.searcing_text = ''
state.kivyapp.root.ids.sc10.children[2].active = False #state.kivyapp.root.ids.sc10.children[2].active = False
self.children[2].children[2].ids.search_field.text = '' # self.children[2].children[2].ids.search_field.text = ''
self.children[3].children[2].ids.search_field.text = ''
self.has_refreshed = True self.has_refreshed = True
self.ids.ml.clear_widgets() self.ids.ml.clear_widgets()
self.init_ui() self.init_ui()
@ -417,10 +412,6 @@ class MyAddress(Screen):
return True return True
return False return False
def set_root_layout(self):
"""Setting root layout"""
return self.manager.parent.parent
class AddressBook(Screen): class AddressBook(Screen):
"""AddressBook Screen uses screen to show widgets of screens""" """AddressBook Screen uses screen to show widgets of screens"""
@ -653,20 +644,16 @@ class DropDownWidget(BoxLayout):
int(BMConfigParser().safeGet( int(BMConfigParser().safeGet(
'bitmessagesettings', 'ttl'))) 'bitmessagesettings', 'ttl')))
state.check_sent_acc = fromAddress state.check_sent_acc = fromAddress
state.msg_counter_objs = self.parent.parent.parent.parent\ # state.msg_counter_objs = self.parent.parent.parent.parent\
.parent.parent.children[2].children[0].ids # .parent.parent.children[2].children[0].ids
if state.detailPageType == 'draft' \ if state.detailPageType == 'draft' \
and state.send_draft_mail: and state.send_draft_mail:
state.draft_count = str(int(state.draft_count) - 1) state.draft_count = str(int(state.draft_count) - 1)
state.msg_counter_objs.draft_cnt.badge_text = ( # state.msg_counter_objs.draft_cnt.badge_text = (
state.draft_count) # state.draft_count)
state.detailPageType = '' state.detailPageType = ''
state.send_draft_mail = None 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[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) Clock.schedule_once(self.callback_for_msgsend, 3)
queues.workerQueue.put(('sendmessage', toAddress)) queues.workerQueue.put(('sendmessage', toAddress))
print("sqlExecute successfully #######################") print("sqlExecute successfully #######################")
@ -824,7 +811,7 @@ class NetworkStat(Screen):
len(objectracker.missingObjects)) len(objectracker.missingObjects))
class ContentNavigationDrawer(Navigatorss): class ContentNavigationDrawer(BoxLayout):
"""Navigate Content Drawer""" """Navigate Content Drawer"""
pass pass
@ -857,14 +844,14 @@ class Random(Screen):
self.ids.label.text = '' self.ids.label.text = ''
self.parent.parent.children[1].opacity = 1 self.parent.parent.children[1].opacity = 1
self.parent.parent.children[1].disabled = False self.parent.parent.children[1].disabled = False
state.kivyapp.root.ids.sc10.children[1].active = True state.kivyapp.loadMyAddressScreen(True)
self.manager.current = 'myaddress' self.manager.current = 'myaddress'
Clock.schedule_once(self.address_created_callback, 6) Clock.schedule_once(self.address_created_callback, 6)
@staticmethod @staticmethod
def address_created_callback(dt=0): def address_created_callback(dt=0):
"""New address created""" """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.ids.ml.clear_widgets()
state.kivyapp.root.ids.sc10.is_add_created = True state.kivyapp.root.ids.sc10.is_add_created = True
state.kivyapp.root.ids.sc10.init_ui() state.kivyapp.root.ids.sc10.init_ui()
@ -1050,8 +1037,8 @@ class Sent(Screen):
@staticmethod @staticmethod
def set_sentCount(total_sent): def set_sentCount(total_sent):
"""Set the total no. of sent message count""" """Set the total no. of sent message count"""
src_mng_obj = state.kivyapp.root.children[2].children[0].ids # src_mng_obj = state.kivyapp.root.children[2].children[0].ids
src_mng_obj.send_cnt.badge_text = str(total_sent) # src_mng_obj.send_cnt.badge_text = str(total_sent)
state.sent_count = str(total_sent) state.sent_count = str(total_sent)
def sent_detail(self, ackdata, *args): def sent_detail(self, ackdata, *args):
@ -1068,19 +1055,19 @@ class Sent(Screen):
def delete(self, data_index, instance, *args): def delete(self, data_index, instance, *args):
"""Delete sent mail from sent mail listing""" """Delete sent mail from sent mail listing"""
try: # try:
msg_count_objs = self.parent.parent.parent.parent.children[ # msg_count_objs = self.parent.parent.parent.parent.children[
2].children[0].ids # 2].children[0].ids
except Exception: # except Exception:
msg_count_objs = self.parent.parent.parent.parent.parent.children[ # msg_count_objs = self.parent.parent.parent.parent.parent.children[
2].children[0].ids # 2].children[0].ids
if int(state.sent_count) > 0: if int(state.sent_count) > 0:
msg_count_objs.send_cnt.badge_text = str( # msg_count_objs.send_cnt.badge_text = str(
int(state.sent_count) - 1) # int(state.sent_count) - 1)
msg_count_objs.trash_cnt.badge_text = str( # msg_count_objs.trash_cnt.badge_text = str(
int(state.trash_count) + 1) # int(state.trash_count) + 1)
msg_count_objs.allmail_cnt.badge_text = str( # msg_count_objs.allmail_cnt.badge_text = str(
int(state.all_count) - 1) # int(state.all_count) - 1)
state.sent_count = str(int(state.sent_count) - 1) state.sent_count = str(int(state.sent_count) - 1)
state.trash_count = str(int(state.trash_count) + 1) state.trash_count = str(int(state.trash_count) + 1)
state.all_count = str(int(state.all_count) - 1) state.all_count = str(int(state.all_count) - 1)
@ -1137,8 +1124,8 @@ class Trash(Screen):
self.trashDataQuery(0, 20) self.trashDataQuery(0, 20)
if self.trash_messages: if self.trash_messages:
self.ids.identi_tag.children[0].text = 'Trash' self.ids.identi_tag.children[0].text = 'Trash'
src_mng_obj = state.kivyapp.root.children[2].children[0].ids # src_mng_obj = state.kivyapp.root.children[2].children[0].ids
src_mng_obj.trash_cnt.badge_text = state.trash_count # src_mng_obj.trash_cnt.badge_text = state.trash_count
self.set_mdList() self.set_mdList()
self.ids.scroll_y.bind(scroll_y=self.check_scroll_y) self.ids.scroll_y.bind(scroll_y=self.check_scroll_y)
else: else:
@ -1256,8 +1243,8 @@ class Trash(Screen):
"DELETE FROM sent WHERE ackdata = ?;", self.delete_index) "DELETE FROM sent WHERE ackdata = ?;", self.delete_index)
msg_count_objs = state.kivyapp.root.children[2].children[0].ids msg_count_objs = state.kivyapp.root.children[2].children[0].ids
if int(state.trash_count) > 0: if int(state.trash_count) > 0:
msg_count_objs.trash_cnt.badge_text = str( # msg_count_objs.trash_cnt.badge_text = str(
int(state.trash_count) - 1) # int(state.trash_count) - 1)
state.trash_count = str(int(state.trash_count) - 1) state.trash_count = str(int(state.trash_count) - 1)
Clock.schedule_once(self.callback_for_screen_load, 1) Clock.schedule_once(self.callback_for_screen_load, 1)
@ -1288,11 +1275,11 @@ class Setting(Screen):
pass pass
class NavigateApp(App): class NavigateApp(MDApp):
"""Navigation Layout of class""" """Navigation Layout of class"""
# pylint: disable=too-many-public-methods # pylint: disable=too-many-public-methods
theme_cls = ThemeManager() # theme_cls = ThemeManager()
previous_date = ObjectProperty() previous_date = ObjectProperty()
obj_1 = ObjectProperty() obj_1 = ObjectProperty()
variable_1 = ListProperty(BMConfigParser().addresses()) variable_1 = ListProperty(BMConfigParser().addresses())
@ -1325,7 +1312,6 @@ class NavigateApp(App):
print(os.path.join(os.path.dirname(__file__), 'main.kv')) print(os.path.join(os.path.dirname(__file__), 'main.kv'))
main_widget = Builder.load_file( main_widget = Builder.load_file(
os.path.join(os.path.dirname(__file__), 'main.kv')) os.path.join(os.path.dirname(__file__), 'main.kv'))
self.nav_drawer = Navigatorss()
self.obj_1 = AddressBook() self.obj_1 = AddressBook()
kivysignalthread = UIkivySignaler() kivysignalthread = UIkivySignaler()
kivysignalthread.daemon = True kivysignalthread.daemon = True
@ -1473,7 +1459,7 @@ class NavigateApp(App):
self.root.ids.sc11.children[1].active = True self.root.ids.sc11.children[1].active = True
Clock.schedule_once(self.search_callback, 0.5) Clock.schedule_once(self.search_callback, 0.5)
elif state.search_screen == 'myaddress': elif state.search_screen == 'myaddress':
self.root.ids.sc10.children[1].active = True self.loadMyAddressScreen(True)
Clock.schedule_once(self.search_callback, 0.5) Clock.schedule_once(self.search_callback, 0.5)
elif state.search_screen == 'sent': elif state.search_screen == 'sent':
self.root.ids.sc4.children[1].active = True self.root.ids.sc4.children[1].active = True
@ -1492,13 +1478,20 @@ class NavigateApp(App):
elif state.search_screen == 'myaddress': elif state.search_screen == 'myaddress':
self.root.ids.sc10.ids.ml.clear_widgets() self.root.ids.sc10.ids.ml.clear_widgets()
self.root.ids.sc10.init_ui() self.root.ids.sc10.init_ui()
self.root.ids.sc10.children[1].active = False self.loadMyAddressScreen(False)
else: else:
self.root.ids.sc4.ids.ml.clear_widgets() self.root.ids.sc4.ids.ml.clear_widgets()
self.root.ids.sc4.loadSent(state.association) self.root.ids.sc4.loadSent(state.association)
self.root.ids.sc4.children[1].active = False self.root.ids.sc4.children[1].active = False
self.root.ids.scr_mngr.current = state.search_screen 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): def save_draft(self):
"""Saving drafts messages""" """Saving drafts messages"""
composer_objs = self.root composer_objs = self.root
@ -1547,8 +1540,10 @@ class NavigateApp(App):
"""Common header for all window""" """Common header for all window"""
self.root.ids.toolbar.right_action_items = [ self.root.ids.toolbar.right_action_items = [
['account-plus', lambda x: self.addingtoaddressbook()]] ['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 = [ 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 return
def back_press(self): def back_press(self):
@ -1694,7 +1689,7 @@ class NavigateApp(App):
except Exception: except Exception:
self.root.ids.sc10.children[ self.root.ids.sc10.children[
2].children[2].ids.search_field.text = '' 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) Clock.schedule_once(self.search_callback, 0.5)
else: else:
self.root.ids.sc4.children[ self.root.ids.sc4.children[
@ -1706,8 +1701,9 @@ class NavigateApp(App):
def set_identicon(self, text): def set_identicon(self, text):
"""Show identicon in address spinner""" """Show identicon in address spinner"""
img = identiconGeneration.generate(text) img = identiconGeneration.generate(text)
self.root.children[2].children[0].ids.btn.children[1].texture = ( # self.root.children[2].children[0].ids.btn.children[1].texture = (
img.texture) # img.texture)
self.root.children[0].children[0].ids.btn.texture = (img.texture)
def set_mail_detail_header(self): def set_mail_detail_header(self):
"""Setting the details of the page""" """Setting the details of the page"""
@ -1804,8 +1800,10 @@ class GrashofPopup(Popup):
def checkAddress_valid(self, instance): def checkAddress_valid(self, instance):
"""Checking address is valid or not""" """Checking address is valid or not"""
# my_addresses = (
# self.parent.children[1].children[2].children[0].ids.btn.values)
my_addresses = ( 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( add_book = [addr[1] for addr in kivy_helper_search.search_sql(
folder="addressbook")] folder="addressbook")]
entered_text = str(instance.text).strip() entered_text = str(instance.text).strip()
@ -1892,31 +1890,6 @@ class IconRightSampleWidget(IRightBodyTouch, MDCheckbox):
pass 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): class MailDetail(Screen):
"""MailDetail Screen uses to show the detail of mails""" """MailDetail Screen uses to show the detail of mails"""
@ -1976,7 +1949,7 @@ class MailDetail(Screen):
sqlExecute( sqlExecute(
"UPDATE sent SET folder = 'trash' WHERE" "UPDATE sent SET folder = 'trash' WHERE"
" ackdata = ?;", state.mail_id) " 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) state.sent_count = str(int(state.sent_count) - 1)
self.parent.screens[3].ids.ml.clear_widgets() self.parent.screens[3].ids.ml.clear_widgets()
self.parent.screens[3].loadSent(state.association) self.parent.screens[3].loadSent(state.association)
@ -1988,27 +1961,25 @@ class MailDetail(Screen):
sqlExecute( sqlExecute(
"UPDATE inbox SET folder = 'trash' WHERE" "UPDATE inbox SET folder = 'trash' WHERE"
" msgid = ?;", state.mail_id) " msgid = ?;", state.mail_id)
msg_count_objs.inbox_cnt.badge_text = str( # msg_count_objs.inbox_cnt.badge_text = str(
int(state.inbox_count) - 1) # int(state.inbox_count) - 1)
state.inbox_count = 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].ids.ml.clear_widgets()
self.parent.screens[0].loadMessagelist(state.association) self.parent.screens[0].loadMessagelist(state.association)
elif state.detailPageType == 'draft': elif state.detailPageType == 'draft':
sqlExecute("DELETE FROM sent WHERE ackdata = ?;", state.mail_id) sqlExecute("DELETE FROM sent WHERE ackdata = ?;", state.mail_id)
msg_count_objs.draft_cnt.badge_text = str( # msg_count_objs.draft_cnt.badge_text = str(
int(state.draft_count) - 1) # int(state.draft_count) - 1)
state.draft_count = 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].clear_widgets()
self.parent.screens[15].add_widget(Draft()) self.parent.screens[15].add_widget(Draft())
# self.parent.current = 'allmails' \
# if state.is_allmail else state.detailPageType
if state.detailPageType != 'draft': if state.detailPageType != 'draft':
msg_count_objs.trash_cnt.badge_text = str( # msg_count_objs.trash_cnt.badge_text = str(
int(state.trash_count) + 1) # int(state.trash_count) + 1)
msg_count_objs.allmail_cnt.badge_text = str( # msg_count_objs.allmail_cnt.badge_text = str(
int(state.all_count) - 1) # int(state.all_count) - 1)
state.trash_count = str(int(state.trash_count) + 1) state.trash_count = str(int(state.trash_count) + 1)
state.all_count = str(int(state.all_count) - 1) state.all_count = str(int(state.all_count) - 1)
self.parent.screens[4].clear_widgets() self.parent.screens[4].clear_widgets()
@ -2044,8 +2015,10 @@ class MailDetail(Screen):
def write_msg(self, navApp): def write_msg(self, navApp):
"""Write on draft mail""" """Write on draft mail"""
state.send_draft_mail = state.mail_id state.send_draft_mail = state.mail_id
# composer_ids = (
# self.parent.parent.parent.parent.parent.ids.sc3.children[1].ids)
composer_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.ti.text = state.write_msg['from_addr']
composer_ids.btn.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'] composer_ids.txt_input.text = state.write_msg['to_addr']
@ -2215,8 +2188,8 @@ class Draft(Screen):
len(self.queryreturn)) len(self.queryreturn))
if self.queryreturn: if self.queryreturn:
self.ids.identi_tag.children[0].text = 'Draft' self.ids.identi_tag.children[0].text = 'Draft'
src_mng_obj = state.kivyapp.root.children[2].children[0].ids # src_mng_obj = state.kivyapp.root.children[2].children[0].ids
src_mng_obj.draft_cnt.badge_text = state.draft_count # src_mng_obj.draft_cnt.badge_text = state.draft_count
self.set_mdList() self.set_mdList()
self.ids.scroll_y.bind(scroll_y=self.check_scroll_y) self.ids.scroll_y.bind(scroll_y=self.check_scroll_y)
else: else:
@ -2414,8 +2387,8 @@ class Allmails(Screen):
state.kivyapp.get_sent_count() state.kivyapp.get_sent_count()
state.all_count = str( state.all_count = str(
int(state.sent_count) + int(state.inbox_count)) int(state.sent_count) + int(state.inbox_count))
state.kivyapp.root.children[2].children[ # state.kivyapp.root.children[2].children[
0].ids.allmail_cnt.badge_text = state.all_count # 0].ids.allmail_cnt.badge_text = state.all_count
self.set_mdlist() self.set_mdlist()
# self.ids.refresh_layout.bind(scroll_y=self.check_scroll_y) # self.ids.refresh_layout.bind(scroll_y=self.check_scroll_y)
self.ids.scroll_y.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) unique_id)
self.ids.ml.remove_widget(instance.parent.parent) self.ids.ml.remove_widget(instance.parent.parent)
try: try:
msg_count_objs = self.parent.parent.parent.parent.parent.children[ # msg_count_objs = self.parent.parent.parent.parent.parent.children[
2].children[0].ids # 2].children[0].ids
nav_lay_obj = self.parent.parent.parent.parent.parent.ids nav_lay_obj = self.parent.parent.parent.ids
except Exception: except Exception:
msg_count_objs = ( msg_count_objs = (
self.parent.parent.parent.parent.parent.parent.children[ self.parent.parent.parent.parent.parent.parent.children[
2].children[0].ids) 2].children[0].ids)
nav_lay_obj = self.parent.parent.parent.parent.parent.parent.ids nav_lay_obj = self.parent.parent.parent.parent.parent.parent.ids
if folder == 'inbox': if folder == 'inbox':
msg_count_objs.inbox_cnt.badge_text = str( # msg_count_objs.inbox_cnt.badge_text = str(
int(state.inbox_count) - 1) # int(state.inbox_count) - 1)
state.inbox_count = 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.ids.ml.clear_widgets()
nav_lay_obj.sc1.loadMessagelist(state.association) nav_lay_obj.sc1.loadMessagelist(state.association)
else: else:
msg_count_objs.send_cnt.badge_text = str( # msg_count_objs.send_cnt.badge_text = str(
int(state.sent_count) - 1) # int(state.sent_count) - 1)
state.sent_count = 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.ids.ml.clear_widgets()
nav_lay_obj.sc4.loadSent(state.association) nav_lay_obj.sc4.loadSent(state.association)
msg_count_objs.trash_cnt.badge_text = str( # msg_count_objs.trash_cnt.badge_text = str(
int(state.trash_count) + 1) # int(state.trash_count) + 1)
msg_count_objs.allmail_cnt.badge_text = str( # msg_count_objs.allmail_cnt.badge_text = str(
int(state.all_count) - 1) # int(state.all_count) - 1)
state.trash_count = str(int(state.trash_count) + 1) state.trash_count = str(int(state.trash_count) + 1)
state.all_count = str(int(state.all_count) - 1) state.all_count = str(int(state.all_count) - 1)
if int(state.all_count) <= 0: if int(state.all_count) <= 0:
@ -2618,3 +2591,8 @@ class AddressDropdown(OneLineIconListItem):
"""AddressDropdown showns all the addresses""" """AddressDropdown showns all the addresses"""
pass pass
class NavigationItem(OneLineAvatarListItem):
"""NavigationItem class is for button behaviour"""
icon = StringProperty()