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,197 +15,216 @@
#: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:
id: btn <ContentNavigationDrawer>
pos_hint:{"x":0,"y":.25}
option_cls: Factory.get("MySpinnerOption") BoxLayout:
font_size: '11.9sp' orientation: 'vertical'
text: app.getDefaultAccData()
background_color: color_button if self.state == 'normal' else color_button_pressed FloatLayout:
background_down: 'atlas://data/images/defaulttheme/spinner' size_hint_y: None
color: color_font height: "200dp"
values: app.variable_1
on_text:app.getCurrentAccountData(self.text) BoxLayout:
Image: id: top_box
source: app.get_default_image() size_hint_y: None
x: self.width/6 height: "200dp"
y: self.parent.y + self.parent.height/4 #padding: "10dp"
size: self.parent.height/2, self.parent.height/2 x: root.parent.x
ArrowImg: pos_hint: {"top": 1}
MyNavigationDrawerIconButton: Image:
id: inbox_cnt source: './images/drawer_logo1.png'
icon: 'email-open'
text: "Inbox" ScrollView:
on_release: app.root.ids.scr_mngr.current = 'inbox' pos_hint: {"top": 1}
badge_text: "0"
on_press: app.load_screen(self) GridLayout:
MyNavigationDrawerIconButton: id: box_item
id: send_cnt cols: 1
icon: 'send' size_hint_y: None
text: "Sent" height: self.minimum_height
#use_active: False NavigationItem:
on_release: app.root.ids.scr_mngr.current = 'sent' Spinner:
badge_text: "0" id: btn
MyNavigationDrawerIconButton: pos_hint:{"x":0,"y":.1}
id: draft_cnt option_cls: Factory.get("MySpinnerOption")
icon: 'message-draw' font_size: '11.9sp'
text: "Draft" text: app.getDefaultAccData()
on_release: app.root.ids.scr_mngr.current = 'draft' background_color: color_button if self.state == 'normal' else color_button_pressed
badge_text: "0" background_down: 'atlas://data/images/defaulttheme/spinner'
#MyNavigationDrawerIconButton: color: color_font
#text: "Starred" values: app.variable_1
#icon:'star' on_text:app.getCurrentAccountData(self.text)
#on_release: app.root.ids.scr_mngr.current = 'starred' Image:
#badge_text: "0" source: app.get_default_image()
#MyNavigationDrawerIconButton: x: self.width/6
#icon: 'archive' y: self.parent.y + self.parent.height/4
#text: "Archieve" size: self.parent.height/2, self.parent.height/2
#on_release: app.root.ids.scr_mngr.current = 'archieve' ArrowImg:
#badge_text: "0" NavigationItem:
#MyNavigationDrawerIconButton: text: 'Inbox'
#icon: 'email-open-outline' icon: 'email-open'
#text: "Spam" divider: None
#on_release: app.root.ids.scr_mngr.current = 'spam' badge_text: "0"
#badge_text: "0" on_release: app.root.ids.scr_mngr.current = 'inbox'
MyNavigationDrawerIconButton: on_release: root.parent.toggle_nav_drawer()
id: trash_cnt on_press: app.load_screen(self)
icon: 'delete' NavigationItem:
text: "Trash" text: 'Sent'
on_release: app.root.ids.scr_mngr.current = 'trash' icon: 'send'
badge_text: "0" divider: None
MyNavigationDrawerIconButton: on_release: app.root.ids.scr_mngr.current = 'sent'
id: allmail_cnt on_release: root.parent.toggle_nav_drawer()
text: "All Mails" NavigationItem:
icon:'contact-mail' text: 'Draft'
on_release: app.root.ids.scr_mngr.current = 'allmails' icon: 'message-draw'
badge_text: "0" divider: None
on_press: app.load_screen(self) on_release: app.root.ids.scr_mngr.current = 'draft'
NavigationDrawerDivider: on_release: root.parent.toggle_nav_drawer()
NavigationDrawerSubheader: NavigationItem:
text: "All labels" text: 'Trash'
MyNavigationDrawerIconButton: icon: 'delete'
text: "Address Book" divider: None
icon:'book-multiple' on_release: app.root.ids.scr_mngr.current = 'trash'
on_release: app.root.ids.scr_mngr.current = 'addressbook' on_release: root.parent.toggle_nav_drawer()
MyNavigationDrawerIconButton: NavigationItem:
text: "Settings" text: 'All Mails'
icon:'settings' icon: 'contact-mail'
on_release: app.root.ids.scr_mngr.current = 'set' divider: None
MyNavigationDrawerIconButton: on_release: app.root.ids.scr_mngr.current = 'allmails'
text: "Subscriptions/Payment" on_release: root.parent.toggle_nav_drawer()
icon:'bell' on_press: app.load_screen(self)
on_release: app.root.ids.scr_mngr.current = 'payment' NavigationItem:
MyNavigationDrawerIconButton: text: 'Address Book'
text: "Credits" icon: 'book-multiple'
icon:'wallet' divider: None
on_release: app.root.ids.scr_mngr.current = 'credits' on_release: app.root.ids.scr_mngr.current = 'addressbook'
MyNavigationDrawerIconButton: on_release: root.parent.toggle_nav_drawer()
text: "new address" NavigationItem:
icon:'account-plus' text: 'Settings'
on_release: app.root.ids.scr_mngr.current = 'login' icon: 'settings'
MyNavigationDrawerIconButton: divider: None
text: "Network Status" on_release: app.root.ids.scr_mngr.current = 'set'
icon:'server-network' on_release: root.parent.toggle_nav_drawer()
on_release: app.root.ids.scr_mngr.current = 'networkstat' NavigationItem:
MyNavigationDrawerIconButton: text: 'Payment'
text: "My Addresses" icon: 'bell'
icon:'account-multiple' divider: None
on_release: app.root.ids.scr_mngr.current = 'myaddress' on_release: app.root.ids.scr_mngr.current = 'payment'
on_release: root.parent.toggle_nav_drawer()
NavigationItem:
text: 'Credits'
icon: 'wallet'
divider: None
on_release: app.root.ids.scr_mngr.current = 'credits'
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'
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'
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: NavigationLayout:
id: nav_layout id: nav_layout
ContentNavigationDrawer: 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.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:
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
MDNavigationDrawer:
id: nav_drawer id: nav_drawer
FloatLayout: ContentNavigationDrawer:
id: float_box id: content_drawer
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
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()]]
right_action_items: [['account-plus', lambda x: app.addingtoaddressbook()]]
ScreenManager:
id: scr_mngr
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
<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:
@ -285,224 +314,6 @@ NavigationLayout:
id: ml id: ml
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'
@ -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:
@ -871,75 +688,6 @@ NavigationLayout:
font_size: '13sp' font_size: '13sp'
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'
@ -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'
color: 0,0,0,1 BoxLayout:
background_color: (0,0,0,0) orientation: 'vertical'
center_x: self.parent.center_x * 2 - self.parent.parent.padding[0]/2 id: qr
center_y: self.parent.center_y
on_press:app.root.ids.sc14.copy_composer_text(self) <Draft>:
Image: name: 'draft'
source: './images/copy_text.png' BoxLayout:
center_x: self.parent.center_x orientation: 'vertical'
center_y: self.parent.center_y spacing: dp(5)
size: 20, 20 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
<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>: <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>:
size_hint : (None,None) ScrollView:
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:
id: myadd_popup_box
size_hint_y: None
spacing:dp(70)
orientation: 'vertical'
BoxLayout: BoxLayout:
size_hint_y: None
orientation: 'vertical' orientation: 'vertical'
spacing:dp(25) size_hint_y: None
MDLabel: height: self.minimum_height + 2 * self.parent.height/4
id: myaddr_label padding: dp(32)
font_style: 'Subtitle2' spacing: 15
theme_text_color: 'Primary' BoxLayout:
text: "Label" orientation: 'vertical'
font_size: '17sp' MDTextField:
halign: 'left' id: ti
MDLabel: hint_text: 'type or select sender address'
font_style: 'Body1' size_hint_y: None
theme_text_color: 'Primary' height: 100
text: root.address_label font_size: '13sp'
font_size: '15sp' multiline: False
halign: 'left' required: True
MDLabel: helper_text_mode: "on_error"
font_style: 'Subtitle2'
theme_text_color: 'Primary' BoxLayout:
text: "Address" size_hint_y: None
font_size: '17sp' height: dp(40)
halign: 'left' Spinner:
MDLabel: id: btn
font_style: 'Body1' background_color: app.theme_cls.primary_dark
theme_text_color: 'Primary' values: app.variable_1
text: root.address on_text: root.auto_fill_fromaddr() if self.text != 'Select' else ''
font_size: '15sp' option_cls: Factory.get("MySpinnerOption")
halign: 'left' 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: 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: 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:
id: myadd_popup_box
size_hint_y: None
spacing:dp(70)
orientation: 'vertical' orientation: 'vertical'
id: qr BoxLayout:
size_hint_y: None
orientation: 'vertical'
<ArrowImg@Image>: spacing:dp(25)
source: './images/down-arrow.png' if self.parent.is_open == True else './images/right-arrow.png' MDLabel:
size: 15, 15 id: myaddr_label
x: self.parent.x + self.parent.width - self.width - 5 font_style: 'Subtitle2'
y: self.parent.y + self.parent.height/2 - self.height + 5 theme_text_color: 'Primary'
text: "Label"
font_size: '17sp'
<SearchBar@BoxLayout>: halign: 'left'
id: search_bar MDLabel:
size_hint_y: None font_style: 'Body1'
height: self.minimum_height theme_text_color: 'Primary'
text: root.address_label
MDIconButton: font_size: '15sp'
icon: 'magnify' halign: 'left'
MDLabel:
MDTextField: font_style: 'Subtitle2'
id: search_field theme_text_color: 'Primary'
hint_text: 'Search' text: "Address"
on_text: app.searchQuery(self) font_size: '17sp'
halign: 'left'
MDLabel:
<LoadingPopup>: font_style: 'Body1'
separator_color: 1, 1, 1, 1 theme_text_color: 'Primary'
background: "White.png" text: root.address
Button: font_size: '15sp'
id: btn halign: 'left'
disabled: True BoxLayout:
background_disabled_normal: "White.png" id: my_add_btn
Image: spacing:5
source: './images/loader.zip' orientation: 'horizontal'
anim_delay: 0 MDRaisedButton:
#mipmap: True size_hint: 2, None
size: root.size height: dp(40)
on_press: root.send_message_from()
MDLabel:
<Loader@MDSpinner>: font_style: 'H6'
id: spinner text: 'Send message from'
size_hint: None, None font_size: '13sp'
size: dp(46), dp(46) color: (1,1,1,1)
pos_hint: {'center_x': 0.5, 'center_y': 0.5} halign: 'center'
active: False 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()