Merge pull request #36 from jaicis/py3porting

Updated all popup's with new UI and made all static path dynamic
This commit is contained in:
surbhi 2020-07-15 16:47:21 +05:30 committed by GitHub
commit bf1a57d9ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 537 additions and 554 deletions

2
.gitignore vendored
View File

@ -21,4 +21,4 @@ build
pyan/ pyan/
.buildozer/ .buildozer/
bin/ bin/
src/images/kivy/default_identicon/*png src/images/kivy/default_identicon/*.png

View File

@ -4,6 +4,7 @@
orientation: 'vertical' orientation: 'vertical'
spacing: dp(5) spacing: dp(5)
SearchBar: SearchBar:
id: address_search
GridLayout: GridLayout:
id: identi_tag id: identi_tag
padding: [20, 0, 0, 5] padding: [20, 0, 0, 5]
@ -11,6 +12,7 @@
size_hint_y: None size_hint_y: None
height: self.minimum_height height: self.minimum_height
MDLabel: MDLabel:
id: tag_label
text: '' text: ''
font_style: 'Subtitle2' font_style: 'Subtitle2'
BoxLayout: BoxLayout:

View File

@ -11,6 +11,7 @@
size_hint_y: None size_hint_y: None
height: self.minimum_height height: self.minimum_height
MDLabel: MDLabel:
id: tag_label
text: '' text: ''
font_style: 'Subtitle2' font_style: 'Subtitle2'
BoxLayout: BoxLayout:

View File

@ -5,7 +5,7 @@
y: self.parent.y + self.parent.height/2 - self.height + 5 y: self.parent.y + self.parent.height/2 - self.height + 5
<SearchBar@BoxLayout>: <SearchBar@BoxLayout>:
id: search_bar # id: search_bar
size_hint_y: None size_hint_y: None
height: self.minimum_height height: self.minimum_height

View File

@ -10,6 +10,7 @@
size_hint_y: None size_hint_y: None
height: self.minimum_height height: self.minimum_height
MDLabel: MDLabel:
id: tag_label
text: '' text: ''
font_style: 'Subtitle2' font_style: 'Subtitle2'
BoxLayout: BoxLayout:

View File

@ -5,6 +5,7 @@
orientation: 'vertical' orientation: 'vertical'
spacing: dp(5) spacing: dp(5)
SearchBar: SearchBar:
id:inbox_search
GridLayout: GridLayout:
id: identi_tag id: identi_tag
padding: [20, 0, 0, 5] padding: [20, 0, 0, 5]
@ -12,6 +13,7 @@
size_hint_y: None size_hint_y: None
height: self.minimum_height height: self.minimum_height
MDLabel: MDLabel:
id: tag_label
text: '' text: ''
font_style: 'Subtitle2' font_style: 'Subtitle2'
#FloatLayout: #FloatLayout:

View File

@ -137,90 +137,96 @@
<Random>: <Random>:
name:"random" name:"random"
ScrollView:
id:add_random_bx
<RandomBoxlayout>:
orientation: "vertical"
#buttons-area-outer
BoxLayout: BoxLayout:
orientation: "vertical" orientation: "vertical"
id:add_random_bx # padding: 0, dp(5), 0, dp(5)
#buttons-area-outer # spacing: dp(5)
BoxLayout: size_hint_y: .53
orientation: "vertical" canvas:
# padding: 0, dp(5), 0, dp(5) Color:
# spacing: dp(5) rgba: 1,1,1,1
size_hint_y: .53 Rectangle:
pos: self.pos
size: self.size
#label area
AnchorLayout:
size_hint_y: None
height: dp(50)
MDLabel:
text: "Enter a label to generate address for:"
bold: True
halign: "center"
theme_text_color: "Custom"
text_color: .4,.4,.4,1
AnchorLayout:
size_hint_y: None
height: dp(40)
MDTextField:
id:lab
hint_text: "Label"
required: True
size_hint_x: None
width: dp(190)
helper_text_mode: "on_error"
# helper_text: "Please enter your label name"
on_text: app.root.ids.sc7.add_validation(self)
canvas.before:
Color:
rgba: (0,0,0,1)
AnchorLayout:
MDFillRoundFlatIconButton:
icon: "chevron-double-right"
text: "Proceed Next"
on_release: app.root.ids.sc7.generateaddress(app)
Widget:
#info-area-outer
BoxLayout:
size_hint_y: .47
padding: dp(7)
InfoLayout:
orientation:"vertical"
padding: 0, dp(5), 0, dp(5)
canvas: canvas:
Color: Color:
rgba: 1,1,1,1 rgba:1,1,1,1
Rectangle: Rectangle:
pos: self.pos pos: self.pos
size: self.size size: self.size
Color:
rgba: app.theme_cls.primary_color
Line:
rounded_rectangle: (self.pos[0]+4, self.pos[1]+4, self.width-8,self.height-8, 10, 10, 10, 10, 50)
width: dp(1)
ScreenManager:
id: info_screenmgr
#label area Screen:
AnchorLayout: name: "info2"
size_hint_y: None ScrollView:
height: dp(50) bar_width:0
MDLabel: do_scroll_x: False
text: "Enter a label to generate address for:"
bold: True
halign: "center"
theme_text_color: "Custom"
text_color: .4,.4,.4,1
AnchorLayout: BoxLayout:
size_hint_y: None orientation: "vertical"
height: dp(40) size_hint_y: None
MDTextField: height: self.minimum_height
id:lab
hint_text: "Label"
required: True
size_hint_x: None
width: dp(190)
helper_text_mode: "on_error"
helper_text: "Please enter your label name"
AnchorLayout: #note area
MDFillRoundFlatIconButton: ContentHead:
icon: "chevron-double-right" section_name: "NOTE:"
text: "Proceed Next" ContentBody:
on_release: app.root.ids.sc7.generateaddress(app) section_text: ("Here you may generate as many addresses as you like..Indeed creating and abandoning addresses is not encouraged.")
Widget:
#info-area-outer
BoxLayout:
size_hint_y: .47
padding: dp(7)
InfoLayout:
orientation:"vertical"
padding: 0, dp(5), 0, dp(5)
canvas:
Color:
rgba:1,1,1,1
Rectangle:
pos: self.pos
size: self.size
Color:
rgba: app.theme_cls.primary_color
Line:
rounded_rectangle: (self.pos[0]+4, self.pos[1]+4, self.width-8,self.height-8, 10, 10, 10, 10, 50)
width: dp(1)
ScreenManager:
id: info_screenmgr
Screen:
name: "info2"
ScrollView:
bar_width:0
do_scroll_x: False
BoxLayout:
orientation: "vertical"
size_hint_y: None
height: self.minimum_height
#note area
ContentHead:
section_name: "NOTE:"
ContentBody:
section_text: ("Here you may generate as many addresses as you like..Indeed creating and abandoning addresses is not encouraged.")
<Check@MDCheckbox>: <Check@MDCheckbox>:
group: 'group' group: 'group'

View File

@ -1,9 +1,11 @@
<MyAddress>: <MyAddress>:
name: 'myaddress' name: 'myaddress'
BoxLayout: BoxLayout:
id: main_box
orientation: 'vertical' orientation: 'vertical'
spacing: dp(5) spacing: dp(5)
SearchBar: SearchBar:
id: search_bar
GridLayout: GridLayout:
id: identi_tag id: identi_tag
padding: [20, 0, 0, 5] padding: [20, 0, 0, 5]
@ -11,6 +13,7 @@
size_hint_y: None size_hint_y: None
height: self.minimum_height height: self.minimum_height
MDLabel: MDLabel:
id: tag_label
text: 'My Addresses' text: 'My Addresses'
font_style: 'Subtitle2' font_style: 'Subtitle2'
FloatLayout: FloatLayout:

View File

@ -13,263 +13,160 @@
<GrashofPopup>: <GrashofPopup>:
id: popup id: popup_box
size_hint : (None,None) orientation: 'vertical'
height: 2*(label.height + address.height) + 10 # spacing:dp(20)
width :app.window_size[0] - (app.window_size[0]/10 if app.app_platform == 'android' else app.window_size[0]/4) # spacing: "12dp"
title: 'add contact\'s' size_hint_y: None
background: app.image_path + '/popup.jpeg' # height: "120dp"
title_size: sp(20) height: 1.5*label.height+address.height
title_color: 0.4, 0.3765, 0.3451, 1
auto_dismiss: False
separator_color: 0.3529, 0.3922, 0.102, 0.7
BoxLayout: BoxLayout:
size_hint_y: 0.5
orientation: 'vertical' orientation: 'vertical'
spacing:dp(20) MDTextField:
id: popup_box id: label
BoxLayout: multiline: False
orientation: 'vertical' hint_text: "Label"
MDTextField: required: True
id: label helper_text_mode: "on_error"
multiline: False on_text: root.checkLabel_valid(self)
hint_text: "Label" canvas.before:
required: True Color:
helper_text_mode: "on_error" rgba: (0,0,0,1)
on_text: root.checkLabel_valid(self) MDTextField:
canvas.before: id: address
Color: hint_text: "Address"
rgba: (0,0,0,1) required: True
MDTextField: helper_text_mode: "on_error"
id: address multiline: False
hint_text: "Address" on_text: root.checkAddress_valid(self)
required: True canvas.before:
helper_text_mode: "on_error" Color:
multiline: False rgba: (0,0,0,1)
on_text: root.checkAddress_valid(self)
canvas.before:
Color:
rgba: (0,0,0,1)
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)
on_press: root.dismiss()
on_release:
app.root.ids.scr_mngr.current = 'scanscreen'
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_box
size_hint : (None,None) size_hint_y: None
height: 4*(add_label.height) height: 2.5*(add_label.height)
width :app.window_size[0] - (app.window_size[0]/10 if app.app_platform == 'android' else app.window_size[0]/4) orientation: 'vertical'
background: app.image_path + '/popup.jpeg' spacing:dp(5)
separator_height: 0 MDLabel
auto_dismiss: False font_style: 'Subtitle2'
BoxLayout: theme_text_color: 'Primary'
text: "Label"
font_size: '17sp'
halign: 'left'
MDTextField:
id: add_label
font_style: 'Body1'
font_size: '15sp'
halign: 'left'
text: root.address_label
theme_text_color: 'Primary'
required: True
helper_text_mode: "on_error"
on_text: root.checkLabel_valid(self)
canvas.before:
Color:
rgba: (0,0,0,1)
MDLabel:
font_style: 'Subtitle2'
theme_text_color: 'Primary'
text: "Address"
font_size: '17sp'
halign: 'left'
Widget:
size_hint_y: None size_hint_y: None
spacing:dp(70) height: dp(1)
id: addbook_popup_box BoxLayout:
orientation: 'vertical' orientation: 'horizontal'
BoxLayout: MDLabel:
size_hint_y: None id: address
orientation: 'vertical' font_style: 'Body1'
spacing:dp(15) theme_text_color: 'Primary'
MDLabel: text: root.address
font_style: 'Subtitle2' font_size: '15sp'
theme_text_color: 'Primary' halign: 'left'
text: "Label" IconRightSampleWidget:
font_size: '17sp' pos_hint: {'center_x': 0, 'center_y': 1}
halign: 'left' icon: 'content-copy'
MDTextField: on_press: app.copy_composer_text(root.address)
id: add_label
font_style: 'Body1'
font_size: '15sp'
halign: 'left'
text: root.address_label
theme_text_color: 'Primary'
required: True
helper_text_mode: "on_error"
on_text: root.checkLabel_valid(self)
canvas.before:
Color:
rgba: (0,0,0,1)
MDLabel:
font_style: 'Subtitle2'
theme_text_color: 'Primary'
text: "Address"
font_size: '17sp'
halign: 'left'
Widget:
size_hint_y: None
height: dp(1)
BoxLayout:
orientation: 'horizontal'
MDLabel:
id: address
font_style: 'Body1'
theme_text_color: 'Primary'
text: root.address
font_size: '15sp'
halign: 'left'
IconRightSampleWidget:
pos_hint: {'center_x': 0, 'center_y': 1}
icon: 'content-copy'
on_press: app.copy_composer_text(root.address)
BoxLayout:
id: addbook_btn
spacing:5
orientation: 'horizontal'
MDRaisedButton:
size_hint: 2, None
height: dp(40)
on_press: root.send_message_to()
MDLabel:
font_style: 'H6'
text: 'Send message to'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
MDRaisedButton:
size_hint: 1.5, None
height: dp(40)
font_size: '10sp'
on_press: root.update_addbook_label(root.address)
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'
<MyaddDetailPopup>: <MyaddDetailPopup>:
id: myadd_popup id: myadd_popup
size_hint : (None,None) size_hint_y: None
height: 4.5*(myaddr_label.height+ my_add_btn.children[0].height) spacing:dp(25)
width :app.window_size[0] - (app.window_size[0]/10 if app.app_platform == 'android' else app.window_size[0]/4) height: dp(1.2*(myaddr_label.height))
background: app.image_path + '/popup.jpeg' orientation: 'vertical'
auto_dismiss: False MDLabel:
separator_height: 0 id: myaddr_label
font_style: 'Subtitle2'
theme_text_color: 'Primary'
text: "Label"
font_size: '17sp'
halign: 'left'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: root.address_label
font_size: '15sp'
halign: 'left'
MDLabel:
font_style: 'Subtitle2'
theme_text_color: 'Primary'
text: "Address"
font_size: '17sp'
halign: 'left'
BoxLayout: BoxLayout:
id: myadd_popup_box orientation: 'horizontal'
MDLabel:
id: label_address
font_style: 'Body1'
theme_text_color: 'Primary'
text: root.address
font_size: '15sp'
halign: 'left'
IconRightSampleWidget:
pos_hint: {'center_x': 0, 'center_y': 1}
icon: 'content-copy'
on_press: app.copy_composer_text(root.address)
BoxLayout:
id: my_add_btn
spacing:5
orientation: 'horizontal'
size_hint_y: None size_hint_y: None
spacing:dp(70) height: self.minimum_height
orientation: 'vertical' MDRaisedButton:
BoxLayout: size_hint: 2, None
size_hint_y: None height: dp(40)
orientation: 'vertical' on_press: root.send_message_from()
spacing:dp(25)
MDLabel: MDLabel:
id: myaddr_label font_style: 'H6'
font_style: 'Subtitle2' text: 'Send message from'
theme_text_color: 'Primary' font_size: '13sp'
text: "Label" color: (1,1,1,1)
font_size: '17sp' halign: 'center'
halign: 'left' MDRaisedButton:
size_hint: 1.5, None
height: dp(40)
on_press: app.root.ids.scr_mngr.current = 'showqrcode'
on_press: app.root.ids.sc15.qrdisplay(root, root.address)
MDLabel: MDLabel:
font_style: 'Body1' font_style: 'H6'
theme_text_color: 'Primary' text: 'Show QR code'
text: root.address_label font_size: '13sp'
font_size: '15sp' color: (1,1,1,1)
halign: 'left' halign: 'center'
MDRaisedButton:
size_hint: 1.5, None
height: dp(40)
on_press: root.close_pop()
MDLabel: MDLabel:
font_style: 'Subtitle2' font_style: 'H6'
theme_text_color: 'Primary' text: 'Cancel'
text: "Address" font_size: '13sp'
font_size: '17sp' color: (1,1,1,1)
halign: 'left' halign: 'center'
BoxLayout:
orientation: 'horizontal'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: root.address
font_size: '15sp'
halign: 'left'
IconRightSampleWidget:
pos_hint: {'center_x': 0, 'center_y': 1}
icon: 'content-copy'
on_press: app.copy_composer_text(root.address)
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'
<AppClosingPopup>: <AppClosingPopup>:
id: closing_popup id: closing_popup
@ -398,6 +295,7 @@
id: sd_btn id: sd_btn
orientation: 'vertical' orientation: 'vertical'
MDRaisedButton: MDRaisedButton:
id: dismiss_btn
on_press: root.dismiss() on_press: root.dismiss()
size_hint: .2, 0 size_hint: .2, 0
pos_hint: {'x': 0.8, 'y': 0} pos_hint: {'x': 0.8, 'y': 0}

View File

@ -4,6 +4,7 @@
orientation: 'vertical' orientation: 'vertical'
spacing: dp(5) spacing: dp(5)
SearchBar: SearchBar:
id: sent_search
GridLayout: GridLayout:
id: identi_tag id: identi_tag
padding: [20, 0, 0, 5] padding: [20, 0, 0, 5]
@ -11,6 +12,7 @@
size_hint_y: None size_hint_y: None
height: self.minimum_height height: self.minimum_height
MDLabel: MDLabel:
id: tag_label
text: '' text: ''
font_style: 'Subtitle2' font_style: 'Subtitle2'
BoxLayout: BoxLayout:

View File

@ -204,12 +204,18 @@
# halign: 'right' # halign: 'right'
bold: True bold: True
MDDropDownItem: MDDropDownItem:
id: dropdown_item id: drop_item
# pos_hint: {'center_x': .5, 'center_y': .5}
text: 'italiano' text: 'italiano'
dropdown_max_height: 150 on_release: root.menu.open()
dropdown_bg: [1, 1, 1, 1] on_press: root.set_caller()
# pos_hint: {'center_x': 0.5, 'center_y': 0} # MDDropDownItem:
items: [f"{i}" for i in ['System Setting','U.S. English','italiano','Esperanto','dansk','Deutsch','Pirate English','francais','Nederlands','norsk bokmal','polski','portugues europeu']] # id: dropdown_item
# text: 'italiano'
# dropdown_max_height: 150
# dropdown_bg: [1, 1, 1, 1]
# # pos_hint: {'center_x': 0.5, 'center_y': 0}
# items: [f"{i}" for i in ['System Setting','U.S. English','italiano','Esperanto','dansk','Deutsch','Pirate English','francais','Nederlands','norsk bokmal','polski','portugues europeu']]
BoxLayout: BoxLayout:
spacing:5 spacing:5
orientation: 'horizontal' orientation: 'horizontal'
@ -292,7 +298,7 @@
text: "Type:" text: "Type:"
halign: 'left' halign: 'left'
MDDropDownItem: MDDropDownItem:
id: dropdown_item id: dropdown_item2
dropdown_bg: [1, 1, 1, 1] dropdown_bg: [1, 1, 1, 1]
text: 'none' text: 'none'
pos_hint: {'x': 0.9, 'y': 0} pos_hint: {'x': 0.9, 'y': 0}

View File

@ -11,6 +11,7 @@
size_hint_y: None size_hint_y: None
height: self.minimum_height height: self.minimum_height
MDLabel: MDLabel:
id: tag_label
text: '' text: ''
font_style: 'Subtitle2' font_style: 'Subtitle2'
BoxLayout: BoxLayout:

View File

@ -43,6 +43,7 @@
text_color: root.active_color text_color: root.active_color
BadgeText: BadgeText:
id: badge_txt
text: f"{root.badge_text}" text: f"{root.badge_text}"
theme_text_color: "Custom" theme_text_color: "Custom"
#text_color: root.active_color #text_color: root.active_color

View File

@ -49,7 +49,7 @@ from kivy.uix.textinput import TextInput
from kivymd.uix.button import MDIconButton from kivymd.uix.button import MDIconButton
from kivymd.uix.dialog import MDDialog from kivymd.uix.dialog import MDDialog
from kivymd.uix.label import MDLabel from kivymd.uix.label import MDLabel
from kivymd.uix.button import MDFlatButton from kivymd.uix.button import MDFlatButton, MDRaisedButton
from kivymd.uix.list import ( from kivymd.uix.list import (
ILeftBody, ILeftBody,
ILeftBodyTouch, ILeftBodyTouch,
@ -77,6 +77,8 @@ from datetime import datetime
from kivymd.uix.behaviors.elevation import RectangularElevationBehavior from kivymd.uix.behaviors.elevation import RectangularElevationBehavior
from kivymd.uix.bottomsheet import MDCustomBottomSheet from kivymd.uix.bottomsheet import MDCustomBottomSheet
from kivy.effects.dampedscroll import DampedScrollEffect from kivy.effects.dampedscroll import DampedScrollEffect
from kivymd.uix.menu import MDDropdownMenu
from kivy_garden.zbarcam import ZBarCam from kivy_garden.zbarcam import ZBarCam
from pyzbar.pyzbar import ZBarSymbol from pyzbar.pyzbar import ZBarSymbol
@ -209,16 +211,17 @@ class Inbox(Screen):
self.set_defaultAddress() self.set_defaultAddress()
self.account = state.association self.account = state.association
if state.searcing_text: if state.searcing_text:
self.children[2].children[0].children[0].scroll_y = 1.0 # self.children[2].children[0].children[0].scroll_y = 1.0
self.ids.scroll_y.scroll_y = 1.0
where = ["subject", "message"] where = ["subject", "message"]
what = state.searcing_text what = state.searcing_text
xAddress = "toaddress" xAddress = "toaddress"
data = [] data = []
self.ids.identi_tag.children[0].text = "" self.ids.tag_label.text = ""
self.inboxDataQuery(xAddress, where, what) self.inboxDataQuery(xAddress, where, what)
self.ids.identi_tag.children[0].text = "" self.ids.tag_label.text = ""
if self.queryreturn: if self.queryreturn:
self.ids.identi_tag.children[0].text = "Inbox" self.ids.tag_label.text = "Inbox"
state.kivyapp.get_inbox_count() state.kivyapp.get_inbox_count()
self.set_inboxCount(state.inbox_count) self.set_inboxCount(state.inbox_count)
for mail in self.queryreturn: for mail in self.queryreturn:
@ -242,7 +245,7 @@ class Inbox(Screen):
self.has_refreshed = True self.has_refreshed = True
self.set_mdList(data) self.set_mdList(data)
self.children[2].children[0].children[0].bind(scroll_y=self.check_scroll_y) self.ids.scroll_y.bind(scroll_y=self.check_scroll_y)
else: else:
self.set_inboxCount("0") self.set_inboxCount("0")
content = MDLabel( content = MDLabel(
@ -260,7 +263,7 @@ class Inbox(Screen):
def set_inboxCount(self, msgCnt): # pylint: disable=no-self-use def set_inboxCount(self, msgCnt): # pylint: disable=no-self-use
"""This method is used to sent inbox message count""" """This method is used to sent inbox message count"""
src_mng_obj = state.kivyapp.root.ids.content_drawer.ids.inbox_cnt src_mng_obj = state.kivyapp.root.ids.content_drawer.ids.inbox_cnt
src_mng_obj.children[0].children[0].text = showLimitedCnt(int(msgCnt)) src_mng_obj.ids.badge_txt.text = showLimitedCnt(int(msgCnt))
def inboxDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20): def inboxDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
"""This method is used for retrieving inbox data""" """This method is used for retrieving inbox data"""
@ -281,7 +284,7 @@ class Inbox(Screen):
meny._txt_right_pad = dp(70) meny._txt_right_pad = dp(70)
meny.add_widget( meny.add_widget(
AvatarSampleWidget( AvatarSampleWidget(
source="./images/text_images/{}.png".format( source=state.imageDir + "/text_images/{}.png".format(
avatarImageFirstLetter(item["secondary_text"].strip()) avatarImageFirstLetter(item["secondary_text"].strip())
) )
) )
@ -311,10 +314,8 @@ class Inbox(Screen):
def check_scroll_y(self, instance, somethingelse): def check_scroll_y(self, instance, somethingelse):
"""Loads data on scroll""" """Loads data on scroll"""
if ( if self.ids.scroll_y.scroll_y <= -0.0 and self.has_refreshed:
self.children[2].children[0].children[0].scroll_y <= -0.0 and self.has_refreshed self.ids.scroll_y.scroll_y = 0.06
):
self.children[2].children[0].children[0].scroll_y = 0.06
total_message = len(self.ids.ml.children) total_message = len(self.ids.ml.children)
self.update_inbox_screen_on_scroll(total_message) self.update_inbox_screen_on_scroll(total_message)
else: else:
@ -337,7 +338,8 @@ class Inbox(Screen):
"secondary_text": body[:50] + "........" "secondary_text": body[:50] + "........"
if len(body) >= 50 if len(body) >= 50
else (body + "," + subject.replace("\n", ""))[0:50] + "........", else (body + "," + subject.replace("\n", ""))[0:50] + "........",
"msgid": mail[1] "msgid": mail[1],
"received": mail[6]
} }
) )
self.set_mdList(data) self.set_mdList(data)
@ -359,22 +361,24 @@ class Inbox(Screen):
sqlExecute("UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", data_index) sqlExecute("UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", data_index)
msg_count_objs = self.parent.parent.ids.content_drawer.ids msg_count_objs = self.parent.parent.ids.content_drawer.ids
if int(state.inbox_count) > 0: if int(state.inbox_count) > 0:
msg_count_objs.inbox_cnt.children[0].children[0].text = showLimitedCnt( msg_count_objs.inbox_cnt.ids.badge_txt.text = showLimitedCnt(
int(state.inbox_count) - 1 int(state.inbox_count) - 1
) )
msg_count_objs.trash_cnt.children[0].children[0].text = showLimitedCnt( msg_count_objs.trash_cnt.ids.badge_txt.text = showLimitedCnt(
int(state.trash_count) + 1 int(state.trash_count) + 1
) )
msg_count_objs.allmail_cnt.children[0].children[0].text = showLimitedCnt( msg_count_objs.allmail_cnt.ids.badge_txt.text = showLimitedCnt(
int(state.all_count) - 1 int(state.all_count) - 1
) )
state.inbox_count = str(int(state.inbox_count) - 1) state.inbox_count = str(int(state.inbox_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.inbox_count) <= 0: if int(state.inbox_count) <= 0:
self.ids.identi_tag.children[0].text = "" # self.ids.identi_tag.children[0].text = ''
self.ids.ml.remove_widget(instance.parent.parent) self.ids.tag_label.text = ''
toast("Deleted") self.ids.ml.remove_widget(
instance.parent.parent)
toast('Deleted')
self.update_trash() self.update_trash()
def archive(self, data_index, instance, *args): def archive(self, data_index, instance, *args):
@ -418,6 +422,8 @@ class CustomTwoLineAvatarIconListItem(TwoLineAvatarIconListItem):
class MyAddress(Screen): class MyAddress(Screen):
"""MyAddress screen uses screen to show widgets of screens""" """MyAddress screen uses screen to show widgets of screens"""
address_label = StringProperty()
text_address = StringProperty()
addresses_list = ListProperty() addresses_list = ListProperty()
has_refreshed = True has_refreshed = True
is_add_created = False is_add_created = False
@ -440,9 +446,9 @@ class MyAddress(Screen):
] ]
self.addresses_list = filtered_list self.addresses_list = filtered_list
self.addresses_list = [obj for obj in reversed(self.addresses_list)] self.addresses_list = [obj for obj in reversed(self.addresses_list)]
self.ids.identi_tag.children[0].text = '' self.ids.tag_label.text = ''
if self.addresses_list: if self.addresses_list:
self.ids.identi_tag.children[0].text = 'My Addresses' self.ids.tag_label.text = 'My Addresses'
self.has_refreshed = True self.has_refreshed = True
self.set_mdList(0, 15) self.set_mdList(0, 15)
self.ids.refresh_layout.bind(scroll_y=self.check_scroll_y) self.ids.refresh_layout.bind(scroll_y=self.check_scroll_y)
@ -519,10 +525,20 @@ class MyAddress(Screen):
# @staticmethod # @staticmethod
def myadd_detail(self, fromaddress, label, *args): def myadd_detail(self, fromaddress, label, *args):
"""Load myaddresses details""" """Load myaddresses details"""
if BMConfigParser().get(fromaddress, "enabled") == "true": if BMConfigParser().get(fromaddress, 'enabled') == 'true':
p = MyaddDetailPopup() obj = MyaddDetailPopup()
p.open() self.address_label = obj.address_label = label
p.set_address(fromaddress, label) self.text_address = obj.address =fromaddress
width = .9 if platform == 'android' else .8
self.myadddetail_popup = MDDialog(
type="custom",
size_hint=(width, .25),
content_cls=obj,
)
self.myadddetail_popup.set_normal_height()
self.myadddetail_popup.auto_dismiss = False
self.myadddetail_popup.open()
# p.set_address(fromaddress, label)
else: else:
width = .8 if platform == 'android' else .55 width = .8 if platform == 'android' else .55
dialog_box=MDDialog( dialog_box=MDDialog(
@ -552,7 +568,7 @@ class MyAddress(Screen):
"""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.ids.search_bar.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()
@ -618,6 +634,8 @@ class AddressBook(Screen):
queryreturn = ListProperty() queryreturn = ListProperty()
has_refreshed = True has_refreshed = True
address_label = StringProperty()
address = StringProperty()
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
"""Getting AddressBook Details""" """Getting AddressBook Details"""
@ -636,12 +654,12 @@ class AddressBook(Screen):
where = ['label', 'address'] where = ['label', 'address']
what = state.searcing_text what = state.searcing_text
xAddress = '' xAddress = ''
self.ids.identi_tag.children[0].text = '' self.ids.tag_label.text = ''
self.queryreturn = kivy_helper_search.search_sql( self.queryreturn = kivy_helper_search.search_sql(
xAddress, account, "addressbook", where, what, False) xAddress, account, "addressbook", where, what, False)
self.queryreturn = [obj for obj in reversed(self.queryreturn)] self.queryreturn = [obj for obj in reversed(self.queryreturn)]
if self.queryreturn: if self.queryreturn:
self.ids.identi_tag.children[0].text = 'Address Book' self.ids.tag_label.text = 'Address Book'
self.has_refreshed = True self.has_refreshed = True
self.set_mdList(0, 20) self.set_mdList(0, 20)
self.ids.scroll_y.bind(scroll_y=self.check_scroll_y) self.ids.scroll_y.bind(scroll_y=self.check_scroll_y)
@ -706,20 +724,80 @@ class AddressBook(Screen):
# state.navinstance.ids.sc11.loadAddresslist(None, 'All', '') # state.navinstance.ids.sc11.loadAddresslist(None, 'All', '')
pass pass
@staticmethod # @staticmethod
def addBook_detail(address, label, *args): def addBook_detail(self, address, label, *args):
"""Addressbook details""" """Addressbook details"""
p = AddbookDetailPopup() obj = AddbookDetailPopup()
p.open() self.address_label = obj.address_label = label
p.set_addbook_data(address, label) self.address = obj.address = address
width = .9 if platform == 'android' else .8
self.addbook_popup = MDDialog(
type="custom",
size_hint=(width, .25),
content_cls=obj,
buttons=[
MDRaisedButton(
text="Send message to",
text_color=state.kivyapp.theme_cls.primary_color,
on_release=self.send_message_to,
),
MDRaisedButton(
text="Save", text_color=state.kivyapp.theme_cls.primary_color,
on_release=self.update_addbook_label,
),
MDRaisedButton(
text="Cancel", text_color=state.kivyapp.theme_cls.primary_color,
on_release=self.close_pop,
),
],
)
self.addbook_popup.set_normal_height()
self.addbook_popup.auto_dismiss = False
self.addbook_popup.open()
def delete_address(self, address, instance, *args): def delete_address(self, address, instance, *args):
"""Delete inbox mail from inbox listing""" """Delete inbox mail from inbox listing"""
self.ids.ml.remove_widget(instance.parent.parent) self.ids.ml.remove_widget(instance.parent.parent)
# if len(self.ids.ml.children) == 0: # if len(self.ids.ml.children) == 0:
if self.ids.ml.children is not None: if self.ids.ml.children is not None:
self.ids.identi_tag.children[0].text = "" self.ids.tag_label.text = ''
sqlExecute("DELETE FROM addressbook WHERE address = '{}';".format(address)) sqlExecute(
"DELETE FROM addressbook WHERE address = '{}';".format(address))
def close_pop(self, instance):
"""Pop is Canceled"""
self.addbook_popup.dismiss()
toast('Canceled')
def update_addbook_label(self, instance):
"""Updating the label of address book address"""
address_list = kivy_helper_search.search_sql(folder="addressbook")
stored_labels = [labels[0] for labels in address_list]
add_dict = dict(address_list)
label = str(self.addbook_popup.content_cls.ids.add_label.text)
if label in stored_labels and self.address == add_dict[label]:
stored_labels.remove(label)
if label and label not in stored_labels:
sqlExecute(
"UPDATE addressbook SET label = '{}' WHERE"
" address = '{}';".format(
label, self.addbook_popup.content_cls.address))
state.kivyapp.root.ids.sc11.ids.ml.clear_widgets()
state.kivyapp.root.ids.sc11.loadAddresslist(None, 'All', '')
self.addbook_popup.dismiss()
toast('Saved')
def send_message_to(self, instance):
"""Method used to fill to_address of composer autofield"""
state.kivyapp.set_navbar_for_composer()
window_obj = state.kivyapp.root.ids
window_obj.sc3.children[1].ids.txt_input.text = self.address
window_obj.sc3.children[1].ids.ti.text = ''
window_obj.sc3.children[1].ids.btn.text = 'Select'
window_obj.sc3.children[1].ids.subject.text = ''
window_obj.sc3.children[1].ids.body.text = ''
window_obj.scr_mngr.current = 'create'
self.addbook_popup.dismiss()
class SelectableRecycleBoxLayout( class SelectableRecycleBoxLayout(
@ -1155,9 +1233,10 @@ class Random(Screen):
def generateaddress(self, navApp): def generateaddress(self, navApp):
"""Method for Address Generator""" """Method for Address Generator"""
entered_label = str(self.ids.lab.text).strip() # entered_label = str(self.ids.lab.text).strip()
entered_label = str(self.ids.add_random_bx.children[0].ids.lab.text).strip()
if not entered_label: if not entered_label:
self.ids.lab.focus = True self.ids.add_random_bx.children[0].ids.lab.focus = True
#self.ids.lab.error = True #self.ids.lab.error = True
#self.ids.lab.helper_text = 'This field is required' #self.ids.lab.helper_text = 'This field is required'
streamNumberForAddress = 1 streamNumberForAddress = 1
@ -1204,7 +1283,7 @@ class Random(Screen):
for obj in BMConfigParser().addresses()] for obj in BMConfigParser().addresses()]
if entered_label in lables: if entered_label in lables:
instance.error = True instance.error = True
instance.helper_text = 'Label name is already exist you'\ instance.helper_text = 'it is already exist you'\
' can try this Ex. ( {0}_1, {0}_2 )'.format( ' can try this Ex. ( {0}_1, {0}_2 )'.format(
entered_label) entered_label)
elif entered_label: elif entered_label:
@ -1248,10 +1327,10 @@ class Sent(Screen):
what = state.searcing_text what = state.searcing_text
xAddress = 'fromaddress' xAddress = 'fromaddress'
data = [] data = []
self.ids.identi_tag.children[0].text = '' self.ids.tag_label.text = ''
self.sentDataQuery(xAddress, where, what) self.sentDataQuery(xAddress, where, what)
if self.queryreturn: if self.queryreturn:
self.ids.identi_tag.children[0].text = 'Sent' self.ids.tag_label.text = 'Sent'
self.set_sentCount(state.sent_count) self.set_sentCount(state.sent_count)
for mail in self.queryreturn: for mail in self.queryreturn:
data.append({ data.append({
@ -1379,18 +1458,18 @@ class Sent(Screen):
'secondary_text': mail[2][:50] + '........' if len( 'secondary_text': mail[2][:50] + '........' if len(
mail[2]) >= 50 else (mail[2] + ',' + mail[3].replace( mail[2]) >= 50 else (mail[2] + ',' + mail[3].replace(
'\n', ''))[0:50] + '........', '\n', ''))[0:50] + '........',
'ackdata': mail[5]}) 'ackdata': mail[5], 'senttime': mail[6]})
self.set_mdlist(data, 0) self.set_mdlist(data, 0)
@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.ids.content_drawer.ids.send_cnt src_mng_obj = state.kivyapp.root.ids.content_drawer.ids.send_cnt
state.kivyapp.root.ids.content_drawer.ids.send_cnt.ids.badge_txt.text
if state.association: if state.association:
src_mng_obj.children[0].children[0].text = showLimitedCnt(int(total_sent)) src_mng_obj.ids.badge_txt.text = showLimitedCnt(int(total_sent))
# state.kivyapp.get_sent_count()
else: else:
src_mng_obj.children[0].children[0].text = '0' src_mng_obj.ids.badge_txt.text = '0'
def sent_detail(self, ackdata, *args): def sent_detail(self, ackdata, *args):
"""Load sent mail details""" """Load sent mail details"""
@ -1408,14 +1487,14 @@ class Sent(Screen):
"""Delete sent mail from sent mail listing""" """Delete sent mail from sent mail listing"""
msg_count_objs = self.parent.parent.ids.content_drawer.ids msg_count_objs = self.parent.parent.ids.content_drawer.ids
if int(state.sent_count) > 0: if int(state.sent_count) > 0:
msg_count_objs.send_cnt.children[0].children[0].text = showLimitedCnt(int(state.sent_count) - 1) msg_count_objs.send_cnt.ids.badge_txt.text = showLimitedCnt(int(state.sent_count) - 1)
msg_count_objs.trash_cnt.children[0].children[0].text = showLimitedCnt(int(state.trash_count) + 1) msg_count_objs.trash_cnt.ids.badge_txt.text = showLimitedCnt(int(state.trash_count) + 1)
msg_count_objs.allmail_cnt.children[0].children[0].text = showLimitedCnt(int(state.all_count) - 1) msg_count_objs.allmail_cnt.ids.badge_txt.text = showLimitedCnt(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)
if int(state.sent_count) <= 0: if int(state.sent_count) <= 0:
self.ids.identi_tag.children[0].text = '' self.ids.tag_label.text = ''
sqlExecute( sqlExecute(
"UPDATE sent SET folder = 'trash'" "UPDATE sent SET folder = 'trash'"
" WHERE ackdata = ?;", data_index) " WHERE ackdata = ?;", data_index)
@ -1463,10 +1542,10 @@ class Trash(Screen):
if state.association == '': if state.association == '':
if BMConfigParser().addresses(): if BMConfigParser().addresses():
state.association = BMConfigParser().addresses()[0] state.association = BMConfigParser().addresses()[0]
self.ids.identi_tag.children[0].text = '' self.ids.tag_label.text = ''
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.tag_label.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_TrashCnt(state.trash_count) self.set_TrashCnt(state.trash_count)
@ -1500,7 +1579,7 @@ class Trash(Screen):
def set_TrashCnt(self, Count): # pylint: disable=no-self-use def set_TrashCnt(self, Count): # pylint: disable=no-self-use
"""This method is used to set trash message count""" """This method is used to set trash message count"""
trashCnt_obj = state.kivyapp.root.ids.content_drawer.ids.trash_cnt trashCnt_obj = state.kivyapp.root.ids.content_drawer.ids.trash_cnt
trashCnt_obj.children[0].children[0].text = showLimitedCnt(int(Count)) trashCnt_obj.ids.badge_txt.text = showLimitedCnt(int(Count))
def set_mdList(self): def set_mdList(self):
"""This method is used to create the mdlist""" """This method is used to create the mdlist"""
@ -1648,6 +1727,33 @@ class Setting(Screen):
Here you may change that behavior by having Bitmessage give up after a certain number of days \ Here you may change that behavior by having Bitmessage give up after a certain number of days \
or months." or months."
def __init__(self, *args, **kwargs):
"""Trash method, delete sent message and add in Trash"""
super(Setting, self).__init__(*args, **kwargs)
Clock.schedule_once(self.init_ui, 0)
def init_ui(self, dt=0):
menu_items = [{"text": f"{i}"} for i in ['System Setting','U.S. English','italiano',
'Esperanto','dansk','Deutsch','Pirate English','francais',
'Nederlands','norsk bokmal','polski','portugues europeu']]
self.menu = MDDropdownMenu(
caller=self,
items=menu_items,
position="auto",
callback=self.set_item,
width_mult=3,
use_icon_item=False,
)
def set_caller(self):
self.menu.caller= self.ids.drop_item
# self.menu.use_icon_item = False
self.menu.target_height = 150
def set_item(self, instance):
self.ids.drop_item.set_item(instance.text)
self.menu.dismiss()
class NavigateApp(MDApp): class NavigateApp(MDApp):
"""Navigation Layout of class""" """Navigation Layout of class"""
@ -1667,7 +1773,7 @@ class NavigateApp(MDApp):
count = 0 count = 0
manager_open = False manager_open = False
file_manager = None file_manager = None
# state.imageDir = os.path.join(os.path.abspath(os.path.join(__file__ ,"../../..")),'images', 'kivy') #state.imageDir = os.path.join(os.path.abspath(os.path.join(__file__ ,"../../..")),'images', 'kivy')
state.imageDir = os.path.join('./images', 'kivy') state.imageDir = os.path.join('./images', 'kivy')
image_path = state.imageDir image_path = state.imageDir
@ -1757,11 +1863,68 @@ class NavigateApp(MDApp):
return state.association return state.association
return "Bitmessage Login" return "Bitmessage Login"
@staticmethod # @staticmethod
def addingtoaddressbook(): def addingtoaddressbook(self):
"""Adding to address Book""" """Adding to address Book"""
p = GrashofPopup() width = .85 if platform == 'android' else .8
p.open() self.add_popup = MDDialog(
title='add contact\'s',
type="custom",
size_hint=(width, .25),
content_cls=GrashofPopup(),
buttons=[
MDRaisedButton(
text="Save",
text_color=self.theme_cls.primary_color,
on_release=self.savecontact,
),
MDRaisedButton(
text="Cancel", text_color=self.theme_cls.primary_color,
on_release=self.close_pop,
),
MDRaisedButton(
text="Scan QR code", text_color=self.theme_cls.primary_color
),
],
)
self.add_popup.set_normal_height()
self.add_popup.auto_dismiss = False
self.add_popup.open()
# p = GrashofPopup()
# p.open()
def savecontact(self, instance):
"""Method is used for saving contacts"""
pupup_obj = self.add_popup.content_cls
label = pupup_obj.ids.label.text.strip()
address = pupup_obj.ids.address.text.strip()
if label == '' and address == '':
pupup_obj.ids.label.focus = True
pupup_obj.ids.address.focus = True
elif address == '':
pupup_obj.ids.address.focus = True
elif label == '':
pupup_obj.ids.label.focus = True
stored_address = [addr[1] for addr in kivy_helper_search.search_sql(
folder="addressbook")]
stored_labels = [labels[0] for labels in kivy_helper_search.search_sql(
folder="addressbook")]
if label and address and address not in stored_address \
and label not in stored_labels and pupup_obj.valid:
# state.navinstance = self.parent.children[1]
queues.UISignalQueue.put(('rerenderAddressBook', ''))
self.add_popup.dismiss()
sqlExecute("INSERT INTO addressbook VALUES(?,?)", label, address)
self.root.ids.sc11.ids.ml.clear_widgets()
self.root.ids.sc11.loadAddresslist(None, 'All', '')
self.root.ids.scr_mngr.current = 'addressbook'
toast('Saved')
def close_pop(self, instance):
"""Pop is Canceled"""
self.add_popup.dismiss()
toast('Canceled')
def getDefaultAccData(self): def getDefaultAccData(self):
"""Getting Default Account Data""" """Getting Default Account Data"""
@ -2097,32 +2260,36 @@ class NavigateApp(MDApp):
# pylint: disable=unused-variable # pylint: disable=unused-variable
state.searcing_text = '' state.searcing_text = ''
if state.search_screen == 'inbox': if state.search_screen == 'inbox':
try: self.root.ids.sc1.ids.inbox_search.ids.search_field.text = ''
self.root.ids.sc1.children[ # try:
3].children[2].ids.search_field.text = '' # self.root.ids.sc1.children[
except Exception: # 3].children[2].ids.search_field.text = ''
self.root.ids.sc1.children[ # except Exception:
2].children[2].ids.search_field.text = '' # self.root.ids.sc1.children[
# 2].children[2].ids.search_field.text = ''
self.root.ids.sc1.children[1].active = True self.root.ids.sc1.children[1].active = True
Clock.schedule_once(self.search_callback, 0.5) Clock.schedule_once(self.search_callback, 0.5)
elif state.search_screen == 'addressbook': elif state.search_screen == 'addressbook':
self.root.ids.sc11.children[ self.root.ids.sc11.ids.address_search.ids.search_field.text = ''
2].children[2].ids.search_field.text = '' # self.root.ids.sc11.children[
# 2].children[2].ids.search_field.text = ''
self.root.ids.sc11.children[ self.root.ids.sc11.children[
1].active = True 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':
try: self.root.ids.sc10.ids.search_bar.ids.search_field.text = ''
self.root.ids.sc10.children[ # try:
1].children[2].ids.search_field.text = '' # self.root.ids.sc10.children[
except Exception: # 1].children[2].ids.search_field.text = ''
self.root.ids.sc10.children[ # except Exception:
2].children[2].ids.search_field.text = '' # self.root.ids.sc10.children[
# 2].children[2].ids.search_field.text = ''
self.loadMyAddressScreen(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.ids.sent_search.ids.search_field.text = ''
2].children[2].ids.search_field.text = '' # self.root.ids.sc4.children[
# 2].children[2].ids.search_field.text = ''
self.root.ids.sc4.children[1].active = True self.root.ids.sc4.children[1].active = True
Clock.schedule_once(self.search_callback, 0.5) Clock.schedule_once(self.search_callback, 0.5)
return return
@ -2262,8 +2429,8 @@ class NavigateApp(MDApp):
def reset_login_screen(self): def reset_login_screen(self):
"""This method is used for clearing random screen""" """This method is used for clearing random screen"""
# if self.root.ids.sc7.ids.add_random_bx.children: if self.root.ids.sc7.ids.add_random_bx.children:
# self.root.ids.sc7.ids.add_random_bx.clear_widgets() self.root.ids.sc7.ids.add_random_bx.clear_widgets()
def open_payment_layout(self, sku): def open_payment_layout(self, sku):
pml = PaymentMethodLayout() pml = PaymentMethodLayout()
@ -2284,7 +2451,7 @@ class NavigateApp(MDApp):
self.root.ids.scr_mngr.current = 'create' self.root.ids.scr_mngr.current = 'create'
class GrashofPopup(Popup): class GrashofPopup(BoxLayout):
"""Moule for save contacts and error messages""" """Moule for save contacts and error messages"""
valid = False valid = False
@ -2293,44 +2460,10 @@ class GrashofPopup(Popup):
"""Grash of pop screen settings""" """Grash of pop screen settings"""
super(GrashofPopup, self).__init__(**kwargs) super(GrashofPopup, self).__init__(**kwargs)
def savecontact(self):
"""Method is used for saving contacts"""
label = self.ids.label.text.strip()
address = self.ids.address.text.strip()
if label == '' and address == '':
self.ids.label.focus = True
self.ids.address.focus = True
elif address == '':
self.ids.address.focus = True
elif label == '':
self.ids.label.focus = True
stored_address = [addr[1] for addr in kivy_helper_search.search_sql(
folder="addressbook")]
stored_labels = [labels[0] for labels in kivy_helper_search.search_sql(
folder="addressbook")]
if label and address and address not in stored_address \
and label not in stored_labels and self.valid:
# state.navinstance = self.parent.children[1]
queues.UISignalQueue.put(('rerenderAddressBook', ''))
self.dismiss()
sqlExecute("INSERT INTO addressbook VALUES(?,?)", label, address)
self.parent.children[1].ids.sc11.ids.ml.clear_widgets()
self.parent.children[1].ids.sc11.loadAddresslist(None, 'All', '')
self.parent.children[1].ids.scr_mngr.current = 'addressbook'
toast('Saved')
@staticmethod
def close_pop():
"""Pop is Canceled"""
toast('Canceled')
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[0].children[0].ids.btn.values)
my_addresses = ( my_addresses = (
state.kivyapp.root.children[0].children[0].ids.btn.values) state.kivyapp.root.ids.content_drawer.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()
@ -2383,7 +2516,8 @@ class GrashofPopup(Popup):
elif status == 'checksumfailed': elif status == 'checksumfailed':
text = ( text = (
"The address is not typed or copied correctly" "The address is not typed or copied correctly"
" (the checksum failed).") # " (the checksum failed)."
)
elif status == 'versiontoohigh': elif status == 'versiontoohigh':
text = ( text = (
"The version number of this address is higher than this" "The version number of this address is higher than this"
@ -2496,24 +2630,20 @@ class MailDetail(Screen): # pylint: disable=too-many-instance-attributes
state.searcing_text = '' state.searcing_text = ''
self.children[0].children[0].active = True self.children[0].children[0].active = True
if state.detailPageType == 'sent': if state.detailPageType == 'sent':
state.kivyapp.root.ids.sc4.children[ state.kivyapp.root.ids.sc4.ids.sent_search.ids.search_field.text = ''
2].children[2].ids.search_field.text = ''
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.children[0].children[0].text = str(int(state.sent_count) - 1) msg_count_objs.send_cnt.ids.badge_txt.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)
elif state.detailPageType == 'inbox': elif state.detailPageType == 'inbox':
state.kivyapp.root.ids.sc1.children[ state.kivyapp.root.ids.sc1.ids.inbox_search.ids.search_field.text = ''
2].children[2].ids.search_field.text = ''
self.parent.screens[0].children[2].children[
2].ids.search_field.text = ''
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.children[0].children[0].text = str( msg_count_objs.inbox_cnt.ids.badge_txt.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()
@ -2521,16 +2651,16 @@ class MailDetail(Screen): # pylint: disable=too-many-instance-attributes
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.children[0].children[0].text = str( msg_count_objs.draft_cnt.ids.badge_txt.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())
if state.detailPageType != 'draft': if state.detailPageType != 'draft':
msg_count_objs.trash_cnt.children[0].children[0].text = str( msg_count_objs.trash_cnt.ids.badge_txt.text = str(
int(state.trash_count) + 1) int(state.trash_count) + 1)
msg_count_objs.allmail_cnt.children[0].children[0].text = str( msg_count_objs.allmail_cnt.ids.badge_txt.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) if int(state.all_count) else '0' state.all_count = str(int(state.all_count) - 1) if int(state.all_count) else '0'
@ -2603,7 +2733,7 @@ class MailDetail(Screen): # pylint: disable=too-many-instance-attributes
toast(text_item) toast(text_item)
class MyaddDetailPopup(Popup): class MyaddDetailPopup(BoxLayout):
"""MyaddDetailPopup pop is used for showing my address detail""" """MyaddDetailPopup pop is used for showing my address detail"""
address_label = StringProperty() address_label = StringProperty()
@ -2613,33 +2743,26 @@ class MyaddDetailPopup(Popup):
"""My Address Details screen setting""" """My Address Details screen setting"""
super(MyaddDetailPopup, self).__init__(**kwargs) super(MyaddDetailPopup, self).__init__(**kwargs)
def set_address(self, address, label):
"""Getting address for displaying details on popup"""
self.address_label = label
self.address = address
def send_message_from(self): def send_message_from(self):
"""Method used to fill from address of composer autofield""" """Method used to fill from address of composer autofield"""
state.kivyapp.set_navbar_for_composer() state.kivyapp.set_navbar_for_composer()
try: window_obj = state.kivyapp.root.ids
window_obj = self.parent.children[2].ids
except Exception:
window_obj = self.parent.children[1].ids
window_obj.sc3.children[1].ids.ti.text = self.address window_obj.sc3.children[1].ids.ti.text = self.address
window_obj.sc3.children[1].ids.btn.text = self.address window_obj.sc3.children[1].ids.btn.text = self.address
window_obj.sc3.children[1].ids.txt_input.text = '' window_obj.sc3.children[1].ids.txt_input.text = ''
window_obj.sc3.children[1].ids.subject.text = '' window_obj.sc3.children[1].ids.subject.text = ''
window_obj.sc3.children[1].ids.body.text = '' window_obj.sc3.children[1].ids.body.text = ''
window_obj.scr_mngr.current = 'create' window_obj.scr_mngr.current = 'create'
self.dismiss() self.parent.parent.parent.dismiss()
@staticmethod # @staticmethod
def close_pop(): def close_pop(self):
"""Pop is Canceled""" """Pop is Canceled"""
self.parent.parent.parent.dismiss()
toast('Canceled') toast('Canceled')
class AddbookDetailPopup(Popup): class AddbookDetailPopup(BoxLayout):
"""AddbookDetailPopup pop is used for showing my address detail""" """AddbookDetailPopup pop is used for showing my address detail"""
address_label = StringProperty() address_label = StringProperty()
@ -2649,49 +2772,6 @@ class AddbookDetailPopup(Popup):
"""Set screen of address detail page""" """Set screen of address detail page"""
super(AddbookDetailPopup, self).__init__(**kwargs) super(AddbookDetailPopup, self).__init__(**kwargs)
def set_addbook_data(self, address, label):
"""Getting address book data for detial dipaly"""
self.address_label = label
self.address = address
def update_addbook_label(self, address):
"""Updating the label of address book address"""
address_list = kivy_helper_search.search_sql(folder="addressbook")
stored_labels = [labels[0] for labels in address_list]
add_dict = dict(address_list)
label = str(self.ids.add_label.text)
if label in stored_labels and self.address == add_dict[label]:
stored_labels.remove(label)
if label and label not in stored_labels:
sqlExecute(
"UPDATE addressbook SET label = '{}' WHERE"
" address = '{}';".format(
str(self.ids.add_label.text), address))
state.kivyapp.root.ids.sc11.ids.ml.clear_widgets()
state.kivyapp.root.ids.sc11.loadAddresslist(None, 'All', '')
self.dismiss()
toast('Saved')
def send_message_to(self):
"""Method used to fill to_address of composer autofield"""
state.kivyapp.set_navbar_for_composer()
try:
window_obj = self.parent.children[2].ids
except Exception:
window_obj = self.parent.children[1].ids
window_obj.sc3.children[1].ids.txt_input.text = self.address
window_obj.sc3.children[1].ids.ti.text = ''
window_obj.sc3.children[1].ids.btn.text = 'Select'
window_obj.sc3.children[1].ids.subject.text = ''
window_obj.sc3.children[1].ids.body.text = ''
window_obj.scr_mngr.current = 'create'
self.dismiss()
@staticmethod
def close_pop():
"""Pop is Canceled"""
toast('Canceled')
def checkLabel_valid(self, instance): def checkLabel_valid(self, instance):
"""Checking address label is unique of not""" """Checking address label is unique of not"""
entered_label = str(instance.text.strip()) entered_label = str(instance.text.strip())
@ -2713,7 +2793,7 @@ class ShowQRCode(Screen):
"""ShowQRCode Screen uses to show the detail of mails""" """ShowQRCode Screen uses to show the detail of mails"""
address = StringProperty() address = StringProperty()
def qrdisplay(self): def qrdisplay(self, instasnce, address):
"""Method used for showing QR Code""" """Method used for showing QR Code"""
self.ids.qr.clear_widgets() self.ids.qr.clear_widgets()
state.kivyapp.set_toolbar_for_QrCode() state.kivyapp.set_toolbar_for_QrCode()
@ -2721,13 +2801,10 @@ class ShowQRCode(Screen):
from kivy.garden.qrcode import QRCodeWidget from kivy.garden.qrcode import QRCodeWidget
except Exception as e: except Exception as e:
from kivy_garden.qrcode import QRCodeWidget from kivy_garden.qrcode import QRCodeWidget
try:
address = self.manager.get_parent_window().children[0].address
except Exception:
address = self.manager.get_parent_window().children[1].address
self.address = address self.address = address
self.ids.qr.add_widget(QRCodeWidget(data=address)) self.ids.qr.add_widget(QRCodeWidget(data=address))
self.ids.qr.children[0].show_border = False self.ids.qr.children[0].show_border = False
instasnce.parent.parent.parent.dismiss()
toast('Show QR code') toast('Show QR code')
@ -2760,12 +2837,12 @@ class Draft(Screen):
def loadDraft(self, where="", what=""): def loadDraft(self, where="", what=""):
"""Load draft list for Draft messages""" """Load draft list for Draft messages"""
xAddress = 'fromaddress' xAddress = 'fromaddress'
self.ids.identi_tag.children[0].text = '' self.ids.tag_label.text = ''
self.draftDataQuery(xAddress, where, what) self.draftDataQuery(xAddress, where, what)
# if state.msg_counter_objs: # if state.msg_counter_objs:
# state.msg_counter_objs.draft_cnt.children[0].children[0].text = showLimitedCnt(len(self.queryreturn)) # state.msg_counter_objs.draft_cnt.children[0].children[0].text = showLimitedCnt(len(self.queryreturn))
if self.queryreturn: if self.queryreturn:
self.ids.identi_tag.children[0].text = 'Draft' self.ids.tag_label.text = 'Draft'
self.set_draftCnt(state.draft_count) self.set_draftCnt(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)
@ -2789,7 +2866,7 @@ class Draft(Screen):
def set_draftCnt(self, Count): # pylint: disable=no-self-use def set_draftCnt(self, Count): # pylint: disable=no-self-use
"""This method set the count of draft mails""" """This method set the count of draft mails"""
draftCnt_obj = state.kivyapp.root.ids.content_drawer.ids.draft_cnt draftCnt_obj = state.kivyapp.root.ids.content_drawer.ids.draft_cnt
draftCnt_obj.children[0].children[0].text = showLimitedCnt(int(Count)) draftCnt_obj.ids.badge_txt.text = showLimitedCnt(int(Count))
def set_mdList(self): def set_mdList(self):
"""This method is used to create mdlist""" """This method is used to create mdlist"""
@ -2861,23 +2938,12 @@ class Draft(Screen):
def delete_draft(self, data_index, instance, *args): def delete_draft(self, data_index, instance, *args):
"""Delete draft message permanently""" """Delete draft message permanently"""
sqlExecute("DELETE FROM sent WHERE ackdata = ?;", data_index) sqlExecute("DELETE FROM sent WHERE ackdata = ?;", data_index)
# try:
# msg_count_objs = (
# self.parent.parent.parent.parent.parent.children[
# 2].children[0].ids)
# except Exception:
# msg_count_objs = (
# self.parent.parent.parent.parent.parent.parent.children[
# 2].children[0].ids)
# msg_count_objs = self.parent.parent.parent.parent.parent.children[
# 2].children[0].ids
if int(state.draft_count) > 0: if int(state.draft_count) > 0:
# msg_count_objs.draft_cnt.badge_text = str(
# int(state.draft_count) - 1)
state.draft_count = str(int(state.draft_count) - 1) state.draft_count = str(int(state.draft_count) - 1)
self.set_draftCnt(state.draft_count) self.set_draftCnt(state.draft_count)
if int(state.draft_count) <= 0: if int(state.draft_count) <= 0:
self.ids.identi_tag.children[0].text = '' # self.ids.identi_tag.children[0].text = ''
self.ids.tag_label.text = ''
self.ids.ml.remove_widget(instance.parent.parent) self.ids.ml.remove_widget(instance.parent.parent)
toast('Deleted') toast('Deleted')
@ -2959,10 +3025,10 @@ class Allmails(Screen):
def loadMessagelist(self): def loadMessagelist(self):
"""Load Inbox, Sent anf Draft list of messages""" """Load Inbox, Sent anf Draft list of messages"""
self.account = state.association self.account = state.association
self.ids.identi_tag.children[0].text = '' self.ids.tag_label.text = ''
self.allMessageQuery(0, 20) self.allMessageQuery(0, 20)
if self.all_mails: if self.all_mails:
self.ids.identi_tag.children[0].text = 'All Mails' self.ids.tag_label.text = 'All Mails'
state.kivyapp.get_inbox_count() state.kivyapp.get_inbox_count()
state.kivyapp.get_sent_count() state.kivyapp.get_sent_count()
state.all_count = str( state.all_count = str(
@ -2997,7 +3063,7 @@ class Allmails(Screen):
def set_AllmailCnt(self, Count): # pylint: disable=no-self-use def set_AllmailCnt(self, Count): # pylint: disable=no-self-use
"""This method is used to set allmails message count""" """This method is used to set allmails message count"""
allmailCnt_obj = state.kivyapp.root.ids.content_drawer.ids.allmail_cnt allmailCnt_obj = state.kivyapp.root.ids.content_drawer.ids.allmail_cnt
allmailCnt_obj.children[0].children[0].text = showLimitedCnt(int(Count)) allmailCnt_obj.ids.badge_txt.text = showLimitedCnt(int(Count))
def set_mdlist(self): def set_mdlist(self):
"""This method is used to create mdList for allmaills""" """This method is used to create mdList for allmaills"""
@ -3084,21 +3150,21 @@ class Allmails(Screen):
msg_count_objs = self.parent.parent.parent.ids.content_drawer.ids msg_count_objs = self.parent.parent.parent.ids.content_drawer.ids
nav_lay_obj = self.parent.parent.parent.ids nav_lay_obj = self.parent.parent.parent.ids
if folder == 'inbox': if folder == 'inbox':
msg_count_objs.inbox_cnt.children[0].children[0].text = showLimitedCnt(int(state.inbox_count) - 1) msg_count_objs.inbox_cnt.ids.badge_txt.text = showLimitedCnt(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.children[0].children[0].text = showLimitedCnt(int(state.sent_count) - 1) msg_count_objs.send_cnt.ids.badge_txt.text = showLimitedCnt(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.children[0].children[0].text = showLimitedCnt(int(state.trash_count) + 1) msg_count_objs.trash_cnt.ids.badge_txt.text = showLimitedCnt(int(state.trash_count) + 1)
msg_count_objs.allmail_cnt.children[0].children[0].text = showLimitedCnt(int(state.all_count) - 1) msg_count_objs.allmail_cnt.ids.badge_txt.text = showLimitedCnt(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:
self.ids.identi_tag.children[0].text = '' self.ids.tag_label.text = ''
nav_lay_obj.sc5.clear_widgets() nav_lay_obj.sc5.clear_widgets()
nav_lay_obj.sc5.add_widget(Trash()) nav_lay_obj.sc5.add_widget(Trash())
nav_lay_obj.sc17.remove_widget(instance.parent.parent) nav_lay_obj.sc17.remove_widget(instance.parent.parent)
@ -3251,7 +3317,7 @@ class SenderDetailPopup(Popup):
time_obj = datetime.fromtimestamp(int(timeinseconds)) time_obj = datetime.fromtimestamp(int(timeinseconds))
self.time_tag = time_obj.strftime("%d %b %Y, %I:%M %p") self.time_tag = time_obj.strftime("%d %b %Y, %I:%M %p")
device_type = 2 if platform == 'android' else 1.5 device_type = 2 if platform == 'android' else 1.5
pop_height = device_type * (self.ids.sd_label.height + self.ids.sd_btn.children[0].height) pop_height = device_type * (self.ids.sd_label.height + self.ids.dismiss_btn.height)
if len(to_addr) > 3: if len(to_addr) > 3:
self.height = 0 self.height = 0
self.height = pop_height self.height = pop_height
@ -3290,35 +3356,29 @@ class OneLineListTitle(OneLineListItem):
"""On long press""" """On long press"""
self.copymessageTitle(self.text) self.copymessageTitle(self.text)
def copymessageTitle(self, text): def copymessageTitle(self, title_text):
"""this method is for displaying dialog box""" """this method is for displaying dialog box"""
self.title_text = title_text
width = .8 if platform == 'android' else .55 width = .8 if platform == 'android' else .55
dialog_box=MDDialog( self.dialog_box=MDDialog(
text=text, text=title_text,
size_hint=(width, .25), size_hint=(width, .25),
buttons=[ buttons=[
MDFlatButton( MDFlatButton(
text="Copy", on_release=lambda x: callback_for_copy_title(text) text="Copy", on_release=self.callback_for_copy_title
), ),
MDFlatButton( MDFlatButton(
text="Cancel",on_release=lambda x: callback_for_copy_title(text), text="Cancel",on_release=self.callback_for_copy_title,
), ),
],) ],)
dialog_box.open() self.dialog_box.open()
def callback_for_copy_title(text_item, *arg): def callback_for_copy_title(self, instance):
"""Callback of alert box""" """Callback of alert box"""
if text_item == 'Copy': if instance.text == 'Copy':
Clipboard.copy() Clipboard.copy(self.title_text)
dialog_box.dismiss() self.dialog_box.dismiss()
toast(text_item) toast(instance.text)
# @staticmethod
# def callback_for_copy_title(text_item, *arg):
# """Callback of alert box"""
# if text_item == 'Copy':
# Clipboard.copy(str(arg[0].text))
# toast(text_item)
class ToAddrBoxlayout(BoxLayout): class ToAddrBoxlayout(BoxLayout):

View File

@ -16,7 +16,7 @@ source.dir = .
source.include_exts = py,png,jpg,kv,atlas,gif,zip, json, css, ttf,java source.include_exts = py,png,jpg,kv,atlas,gif,zip, json, css, ttf,java
# (list) List of inclusions using pattern matching # (list) List of inclusions using pattern matching
#source.include_patterns = assets/*,images/*.png #source.include_patterns = assets/*,images/*.png, ../images1/*/*.png
# (list) Source files to exclude (let empty to not exclude anything) # (list) Source files to exclude (let empty to not exclude anything)
#source.exclude_exts = spec #source.exclude_exts = spec

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 26 KiB