implement new features or fixed issues

This commit is contained in:
navjot 2020-03-02 16:12:15 +05:30
parent 0e8a230156
commit 51082b9376
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C
8 changed files with 270 additions and 125 deletions

View File

@ -45,7 +45,16 @@
<ToggleBtn>: <ToggleBtn>:
#size_hint: None, None size_hint: None, None
size: dp(36), dp(48) size: dp(36), dp(48)
pos_hint: {'center_x': .95, 'center_y': .4} pos_hint: {'center_x': .95, 'center_y': .4}
on_press: app.root.ids.sc10.toggleAction(self) on_active: app.root.ids.sc10.toggleAction(self)
<CustomTwoLineAvatarIconListItem>:
canvas:
Color:
# rgba: 0.5, 0.5, 0.5, 0.5
rgba: 0,0,0,0
Rectangle: #woohoo!!!
size: self.size
pos: self.pos

View File

@ -2,19 +2,27 @@
name: 'credits' name: 'credits'
ScrollView: ScrollView:
do_scroll_x: False do_scroll_x: False
MDList: BoxLayout:
id: ml
size_hint_y: None size_hint_y: None
height: dp(200) orientation: 'vertical'
OneLineListItem: OneLineListTitle:
id: cred
text: "Available Credits" text: "Available Credits"
BoxLayout: divider: None
AnchorLayout: theme_text_color: 'Primary'
MDRaisedButton: _no_ripple_effect: True
height: dp(40) long_press_time: 1
MDLabel:
font_style: 'H4' OneLineListTitle:
text: root.available_credits id: cred
font_size: '13sp' text: root.available_credits
color: (1,1,1,1) divider: None
halign: 'center' font_style: 'H5'
theme_text_color: 'Primary'
_no_ripple_effect: True
long_press_time: 1
AnchorLayout:
MDRaisedButton:
height: dp(38)
text: "+Add more credits"
on_press: app.root.ids.scr_mngr.current = 'payment'

View File

@ -5,25 +5,28 @@
BoxLayout: BoxLayout:
orientation: 'vertical' orientation: 'vertical'
size_hint_y: None size_hint_y: None
height: dp(750) height: dp(400) + self.minimum_height
padding: dp(10) padding: dp(10)
BoxLayout: BoxLayout:
MDLabel: MDLabel:
font_style: 'Subtitle2' font_style: 'Subtitle2'
theme_text_color: 'Primary' theme_text_color: 'Primary'
text: "You may generate addresses by using either random numbers or by using a passphrase If you use a passphrase, the address is called a deterministic; address The Random Number option is selected by default but deterministic addresses have several \n pros and cons:\n" text: root.log_text1
halign: 'center' halign: 'left'
color:app.theme_cls.primary_dark color:app.theme_cls.primary_dark
BoxLayout: BoxLayout:
MDLabel: MDLabel:
font_style: 'Subtitle2' font_style: 'Subtitle2'
theme_text_color: 'Primary' theme_text_color: 'Primary'
text: "If talk about pros You can recreate your addresses on any computer from memory, You need-not worry about backing up your keys.dat file as long as you can remember your passphrase and aside talk about cons You must remember (or write down) your You must remember the address version number and the stream number along with your passphrase If you choose a weak passphrase and someone on the Internet can brute-force it, they can read your messages and send messages as you" text: root.log_text2
halign: 'center' halign: 'left'
color:app.theme_cls.primary_dark color:app.theme_cls.primary_dark
MDCheckbox: MDCheckbox:
id: grp_chkbox_1 id: grp_chkbox_1
group: 'test' group: 'test'
size_hint: None, None
size: dp(48), dp(48)
pos_hint: {'center_x': .5, 'center_y': .5}
active: True active: True
allow_no_selection: False allow_no_selection: False
MDLabel: MDLabel:
@ -37,6 +40,9 @@
MDCheckbox: MDCheckbox:
id: grp_chkbox_1 id: grp_chkbox_1
group: 'test' group: 'test'
size_hint: None, None
size: dp(48), dp(48)
pos_hint: {'center_x': .5, 'center_y': .5}
allow_no_selection: False allow_no_selection: False
MDLabel: MDLabel:
font_style: 'Body2' font_style: 'Body2'
@ -84,7 +90,7 @@
MDTextField: MDTextField:
id: label id: label
multiline: True multiline: False
hint_text: "Label" hint_text: "Label"
required: True required: True
helper_text_mode: "on_error" helper_text_mode: "on_error"

View File

@ -35,6 +35,14 @@
text: root.time_tag text: root.time_tag
halign:'right' halign:'right'
font_style:'Caption' font_style:'Caption'
pos_hint: {'center_y': .8}
MDChip:
size_hint: (None, None)
label: root.page_type
icon: ''
pos_hint: {'center_x': .94, 'center_y': .3}
radius: 8
height: 18
AvatarSampleWidget: AvatarSampleWidget:
source: root.avatarImg source: root.avatarImg
MDLabel: MDLabel:

View File

@ -45,6 +45,7 @@
hint_text: "Address" hint_text: "Address"
required: True required: True
helper_text_mode: "on_error" helper_text_mode: "on_error"
multiline: False
on_text: root.checkAddress_valid(self) on_text: root.checkAddress_valid(self)
canvas.before: canvas.before:
Color: Color:
@ -127,13 +128,19 @@
text: "Address" text: "Address"
font_size: '17sp' font_size: '17sp'
halign: 'left' halign: 'left'
MDLabel: BoxLayout:
id: address orientation: 'horizontal'
font_style: 'Body1' MDLabel:
theme_text_color: 'Primary' id: address
text: root.address font_style: 'Body1'
font_size: '15sp' theme_text_color: 'Primary'
halign: 'left' 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: BoxLayout:
id: addbook_btn id: addbook_btn
spacing:5 spacing:5
@ -208,12 +215,18 @@
text: "Address" text: "Address"
font_size: '17sp' font_size: '17sp'
halign: 'left' halign: 'left'
MDLabel: BoxLayout:
font_style: 'Body1' orientation: 'horizontal'
theme_text_color: 'Primary' MDLabel:
text: root.address font_style: 'Body1'
font_size: '15sp' theme_text_color: 'Primary'
halign: 'left' 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: BoxLayout:
id: my_add_btn id: my_add_btn
spacing:5 spacing:5
@ -316,7 +329,7 @@
<SenderDetailPopup>: <SenderDetailPopup>:
id: myadd_popup id: myadd_popup
size_hint : (None,None) size_hint : (None,None)
height: 2*(sd_label.height+ sd_btn.children[0].height) # height: 2*(sd_label.height+ sd_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) 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' background: './images/popup.jpeg'
auto_dismiss: False auto_dismiss: False
@ -337,22 +350,11 @@
font_size: '15sp' font_size: '15sp'
halign: 'left' halign: 'left'
markup: True markup: True
IconReftSampleWidget: IconRightSampleWidget:
icon: 'content-copy' icon: 'content-copy'
on_press: root.copy_composer_text(root.from_addr) on_press: app.copy_composer_text(root.from_addr)
BoxLayout: BoxLayout:
size_hint_y: None id: to_addId
orientation: 'horizontal'
height: 50
MDLabel:
font_style: 'Body2'
theme_text_color: 'Primary'
text: "To : " + root.to_addr
font_size: '15sp'
halign: 'left'
IconReftSampleWidget:
icon: 'content-copy'
on_press: root.copy_composer_text(root.to_addr)
BoxLayout: BoxLayout:
size_hint_y: None size_hint_y: None
orientation: 'vertical' orientation: 'vertical'
@ -375,3 +377,15 @@
font_size: '13sp' font_size: '13sp'
color: (1,1,1,1) color: (1,1,1,1)
halign: 'center' halign: 'center'
<ToAddrBoxlayout>:
orientation: 'horizontal'
MDLabel:
font_style: 'Body2'
theme_text_color: 'Primary'
text: "To : " + root.to_addr
font_size: '15sp'
halign: 'left'
IconRightSampleWidget:
icon: 'content-copy'
on_press: app.copy_composer_text(root.to_addr)

View File

@ -29,6 +29,22 @@
halign: 'left' halign: 'left'
pos_hint: {'center_x': 0, 'center_y': 0.6} pos_hint: {'center_x': 0, 'center_y': 0.6}
disabled: True disabled: True
BoxLayout:
orientation: 'vertical'
padding: [0, 10, 0, 0]
spacing: 10
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Interface Language"
halign: 'right'
bold: True
MDDropDownItem:
id: dropdown_item
text: 'italiano'
dropdown_max_height: 150
pos_hint: {'center_x': 0.8, '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:
size_hint_y: None size_hint_y: None
orientation: 'vertical' orientation: 'vertical'
@ -179,28 +195,33 @@
text: "Reply below Quote" text: "Reply below Quote"
halign: 'left' halign: 'left'
pos_hint: {'x': 0, 'y': 0.1} pos_hint: {'x': 0, 'y': 0.1}
BoxLayout: Widget:
orientation: 'vertical' size_hint_y: None
spacing: 10 height: 10
padding: 10 # BoxLayout:
MDLabel: # orientation: 'vertical'
font_style: 'Body1' # spacing: 10
theme_text_color: 'Primary' # padding: 10
text: "Interface Language"
halign: 'left' # MDLabel:
bold: True # font_style: 'Body1'
MDDropDownItem: # theme_text_color: 'Primary'
id: dropdown_item # text: "Interface Language"
# on_select # halign: 'left'
text: 'italiano' # bold: True
pos_hint: {'center_x': 0.1, '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
# # on_select
# text: 'italiano'
# dropdown_max_height: 150
# pos_hint: {'center_x': 0.1, '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'
pos_hint: {'x':.76} pos_hint: {'x':.76}
MDRaisedButton: MDRaisedButton:
text: 'Cancel' text: 'Reset'
MDRaisedButton: MDRaisedButton:
text: 'Ok' text: 'Ok'
Tab: Tab:
@ -277,10 +298,8 @@
orientation: 'horizontal' orientation: 'horizontal'
MDDropDownItem: MDDropDownItem:
id: dropdown_item id: dropdown_item
# on_select
dropdown_bg: [1, 1, 1, 1] dropdown_bg: [1, 1, 1, 1]
text: 'none' text: 'none'
# pos_hint: {'left': 1}
items: [f"{i}" for i in ['System Setting','U.S. English']] items: [f"{i}" for i in ['System Setting','U.S. English']]
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
@ -435,7 +454,7 @@
orientation: 'horizontal' orientation: 'horizontal'
pos_hint: {'x':.76} pos_hint: {'x':.76}
MDRaisedButton: MDRaisedButton:
text: 'Cancel' text: 'Reset'
MDRaisedButton: MDRaisedButton:
text: 'Ok' text: 'Ok'
Tab: Tab:
@ -502,6 +521,6 @@
# pos_hint: {'left': 0} # pos_hint: {'left': 0}
pos_hint: {'x':.75} pos_hint: {'x':.75}
MDRaisedButton: MDRaisedButton:
text: 'Cancel' text: 'Reset'
MDRaisedButton: MDRaisedButton:
text: 'Ok' text: 'Ok'

View File

@ -26,7 +26,7 @@
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'
background_normal: '' background_normal: 'atlas://data/images/defaulttheme/textinput_active'
background_color: app.theme_cls.primary_color background_color: app.theme_cls.primary_color
color: color_font color: color_font
@ -285,7 +285,32 @@ NavigationLayout:
name: 'showqrcode' name: 'showqrcode'
BoxLayout: BoxLayout:
orientation: 'vertical' orientation: 'vertical'
size_hint: (None, None)
pos_hint:{'center_x': .5, 'top': 0.9}
size: (app.window_size[0]/2, app.window_size[0]/2)
id: qr id: qr
BoxLayout:
orientation: 'vertical'
MyMDTextField:
size_hint_y: None
font_style: 'Body1'
theme_text_color: 'Primary'
text: root.address
multiline: True
readonly: True
line_color_normal: [0,0,0,0]
_current_line_color: [0,0,0,0]
line_color_focus: [0,0,0,0]
font_size: '18sp'
bold: True
pos_hint: {'x': .26, 'y': 0.5}
# MDLabel:
# size_hint_y: None
# font_style: 'Body1'
# theme_text_color: 'Primary'
# text: "[b]BM-2cV7Y8imvAevK6z6YmhYRcj2t7rghBtDSZ[/b]"
# markup: True
# pos_hint: {'x': .28, 'y': 0.6}
<Starred>: <Starred>:
name: 'starred' name: 'starred'

View File

@ -167,14 +167,14 @@ class Inbox(Screen):
self.set_inboxCount(state.inbox_count) self.set_inboxCount(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', ' ')
subject = mail[3].decode() if isinstance(mail[3],bytes) else mail[3] body = mail[3].decode() if isinstance(mail[3],bytes) else mail[3]
body = mail[5].decode() if isinstance(mail[5],bytes) else mail[5] subject = mail[5].decode() if isinstance(mail[5],bytes) else mail[5]
data.append({ data.append({
'text': mail[4].strip(), 'text': mail[4].strip(),
'secondary_text': body[:50] + '........' if len( 'secondary_text': (subject[:50] + '........' if len(
body) >= 50 else (body + ',' + subject.replace( subject) >= 50 else (subject + ',' + body)[0:50] + '........').replace('\t', '').replace(' ', ''),
'\n', ''))[0:50] + '........',
'msgid': mail[1], 'received': mail[6]}) 'msgid': mail[1], 'received': mail[6]})
self.has_refreshed = True self.has_refreshed = True
self.set_mdList(data) self.set_mdList(data)
self.children[2].children[0].children[0].bind( self.children[2].children[0].children[0].bind(
@ -330,6 +330,10 @@ class Inbox(Screen):
Clock.schedule_once(refresh_callback, 1) Clock.schedule_once(refresh_callback, 1)
class CustomTwoLineAvatarIconListItem(TwoLineAvatarIconListItem):
pass
class MyAddress(Screen): class MyAddress(Screen):
"""MyAddress screen uses screen to show widgets of screens""" """MyAddress screen uses screen to show widgets of screens"""
@ -386,11 +390,12 @@ class MyAddress(Screen):
'secondary_text': address}) 'secondary_text': address})
for item in data: for item in data:
is_enable = BMConfigParser().get(item['secondary_text'], 'enabled') is_enable = BMConfigParser().get(item['secondary_text'], 'enabled')
meny = TwoLineAvatarIconListItem( meny = CustomTwoLineAvatarIconListItem(
text=item['text'], secondary_text=item['secondary_text'], text=item['text'], secondary_text=item['secondary_text'],
theme_text_color='Custom' if is_enable == 'true' else 'Primary', theme_text_color='Custom' if is_enable == 'true' else 'Primary',
text_color=NavigateApp().theme_cls.primary_color, text_color=NavigateApp().theme_cls.primary_color,
) )
meny.canvas.children[6].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5]
meny.add_widget(AvatarSampleWidget( meny.add_widget(AvatarSampleWidget(
source='./images/text_images/{}.png'.format( source='./images/text_images/{}.png'.format(
avatarImageFirstLetter(item['text'].strip())))) avatarImageFirstLetter(item['text'].strip()))))
@ -438,13 +443,25 @@ class MyAddress(Screen):
"""Loads more data on scroll down""" """Loads more data on scroll down"""
self.set_mdList(my_addresses, my_addresses + 20) self.set_mdList(my_addresses, my_addresses + 20)
@staticmethod # @staticmethod
def myadd_detail(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() p = MyaddDetailPopup()
p.open() p.open()
p.set_address(fromaddress, label) p.set_address(fromaddress, label)
else:
width = .8 if platform == 'android' else .55
msg_dialog = MDDialog(
text='Address is not currently active. Please click on Toggle button to active it.',
title='', size_hint=(width, .25), text_button_ok='Ok',
events_callback=self.callback_for_menu_items)
msg_dialog.open()
@staticmethod
def callback_for_menu_items(text_item, *arg):
"""Callback of alert box"""
toast(text_item)
def refresh_callback(self, *args): def refresh_callback(self, *args):
"""Method updates the state of application, """Method updates the state of application,
@ -480,6 +497,7 @@ class MyAddress(Screen):
BMConfigParser().set(str(address), 'enabled', 'false') BMConfigParser().set(str(address), 'enabled', 'false')
BMConfigParser().save() BMConfigParser().save()
instance.parent.parent.theme_text_color = 'Primary' instance.parent.parent.theme_text_color = 'Primary'
instance.parent.parent.canvas.children[6].rgba = [0.5, 0.5, 0.5, 0.5]
toast('Address disabled') toast('Address disabled')
Clock.schedule_once(self.address_permision_callback, 0) Clock.schedule_once(self.address_permision_callback, 0)
@ -488,6 +506,7 @@ class MyAddress(Screen):
BMConfigParser().set(address, 'enabled', 'true') BMConfigParser().set(address, 'enabled', 'true')
BMConfigParser().save() BMConfigParser().save()
instance.parent.parent.theme_text_color = 'Custom' instance.parent.parent.theme_text_color = 'Custom'
instance.parent.parent.canvas.children[6].rgba = [0, 0, 0, 0]
toast('Address Enabled') toast('Address Enabled')
Clock.schedule_once(self.address_permision_callback, 0) Clock.schedule_once(self.address_permision_callback, 0)
@ -502,9 +521,9 @@ class MyAddress(Screen):
"""This method is used for enable or disable address""" """This method is used for enable or disable address"""
addr = instance.parent.parent.secondary_text addr = instance.parent.parent.secondary_text
if instance.active: if instance.active:
self.disableAddress(addr, instance)
else:
self.enableAddress(addr, instance) self.enableAddress(addr, instance)
else:
self.disableAddress(addr, instance)
class AddressBook(Screen): class AddressBook(Screen):
@ -758,9 +777,9 @@ class DropDownWidget(BoxLayout):
else: else:
msg = 'Enter a valid recipients address' msg = 'Enter a valid recipients address'
elif not toAddress: elif not toAddress:
msg = 'Please fill the form' msg = 'Please fill the form completely'
else: else:
msg = 'Please fill the form' msg = 'Please fill the form completely'
self.address_error_message(msg) self.address_error_message(msg)
@staticmethod @staticmethod
@ -812,6 +831,7 @@ class MyTextInput(TextInput):
def __init__(self, **kwargs): def __init__(self, **kwargs):
"""Getting Text Input.""" """Getting Text Input."""
super(MyTextInput, self).__init__(**kwargs) super(MyTextInput, self).__init__(**kwargs)
self.__lineBreak__=0
def on_text(self, instance, value): def on_text(self, instance, value):
"""Find all the occurrence of the word""" """Find all the occurrence of the word"""
@ -844,32 +864,38 @@ class Payment(Screen):
"""Get the available credits""" """Get the available credits"""
# pylint: disable=no-self-use # pylint: disable=no-self-use
state.availabe_credit = instance.parent.children[1].text state.availabe_credit = instance.parent.children[1].text
existing_credits = ( existing_credits = state.kivyapp.root.ids.sc18.ids.cred.text
state.kivyapp.root.ids.sc18.ids.ml.children[0].children[ if float(existing_credits.split()[1]) > 0:
0].children[0].children[0].text)
if len(existing_credits.split(' ')) > 1:
toast( toast(
'We already have added free coins' 'We already have added free coins'
' for the subscription to your account!') ' for the subscription to your account!')
else: else:
toast('Coins added to your account!') toast('Coins added to your account!')
state.kivyapp.root.ids.sc18.ids.ml.children[0].children[ state.kivyapp.root.ids.sc18.ids.cred.text = '{0}'.format(
0].children[0].children[0].text = '{0}'.format( state.availabe_credit)
state.availabe_credit)
class Credits(Screen): class Credits(Screen):
"""Credits Method""" """Credits Method"""
available_credits = StringProperty( available_credits = StringProperty(
'{0}'.format('0')) '{0}'.format('0'))
class Login(Screen): class Login(Screen):
"""Login Screeen""" """Login Screeen"""
log_text1 = ('You may generate addresses by using either random numbers'
pass ' or by using a passphrase If you use a passphrase, the address'
' is called a deterministic; address The Random Number option is'
' selected by default but deterministic addresses have several pros'
' and cons:')
log_text2 = ('If talk about pros You can recreate your addresses on any computer'
' from memory, You need-not worry about backing up your keys.dat file'
' as long as you can remember your passphrase and aside talk about cons'
' You must remember (or write down) your You must remember the address'
' version number and the stream number along with your passphrase If you'
' choose a weak passphrase and someone on the Internet can brute-force it,'
' they can read your messages and send messages as you')
class NetworkStat(Screen): class NetworkStat(Screen):
"""Method used to show network stat""" """Method used to show network stat"""
@ -922,6 +948,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.label.text).strip() entered_label = str(self.ids.label.text).strip()
if not entered_label:
self.ids.label.focus = True
# self.ids.label.error = True
# self.ids.label.helper_text = 'This field is required'
streamNumberForAddress = 1 streamNumberForAddress = 1
label = self.ids.label.text label = self.ids.label.text
eighteenByteRipe = False eighteenByteRipe = False
@ -1009,9 +1039,8 @@ class Sent(Screen):
for mail in self.queryreturn: for mail in self.queryreturn:
data.append({ data.append({
'text': mail[1].strip(), 'text': mail[1].strip(),
'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])[0:50] + '........').replace('\t', '').replace(' ', ''),
'\n', ''))[0:50] + '........',
'ackdata': mail[5], 'senttime': mail[6]},) 'ackdata': mail[5], 'senttime': mail[6]},)
self.set_mdlist(data, 0) self.set_mdlist(data, 0)
self.has_refreshed = True self.has_refreshed = True
@ -1093,9 +1122,8 @@ class Sent(Screen):
for mail in self.queryreturn: for mail in self.queryreturn:
data.append({ data.append({
'text': mail[1].strip(), 'text': mail[1].strip(),
'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])[0:50] + '........').replace('\t', '').replace(' ', ''),
'\n', ''))[0:50] + '........',
'ackdata': mail[5], 'senttime': mail[6]}) 'ackdata': mail[5], 'senttime': mail[6]})
self.set_mdlist(data, total_sent - 1) self.set_mdlist(data, total_sent - 1)
if state.msg_counter_objs and state.association == ( if state.msg_counter_objs and state.association == (
@ -1257,9 +1285,8 @@ class Trash(Screen):
body = item[3].decode() if isinstance(item[3],bytes) else item[3] body = item[3].decode() if isinstance(item[3],bytes) else item[3]
meny = TwoLineAvatarIconListItem( meny = TwoLineAvatarIconListItem(
text=item[1], text=item[1],
secondary_text=item[2][:50] + '........' if len( secondary_text=(item[2][:50] + '........' if len(
subject) >= 50 else (subject + ',' + body.replace( subject) >= 50 else (subject + ',' + body)[0:50] + '........').replace('\t', '').replace(' ', ''),
'\n', ''))[0:50] + '........',
theme_text_color='Custom', theme_text_color='Custom',
text_color=NavigateApp().theme_cls.primary_color) text_color=NavigateApp().theme_cls.primary_color)
img_latter = './images/text_images/{}.png'.format( img_latter = './images/text_images/{}.png'.format(
@ -1603,8 +1630,8 @@ class NavigateApp(MDApp):
"""Saving drafts messages""" """Saving drafts messages"""
composer_objs = self.root composer_objs = self.root
from_addr = str(self.root.ids.sc3.children[1].ids.ti.text) from_addr = str(self.root.ids.sc3.children[1].ids.ti.text)
to_addr = str(self.root.ids.sc3.children[1].ids.txt_input.text) # to_addr = str(self.root.ids.sc3.children[1].ids.txt_input.text)
if from_addr and to_addr and state.detailPageType != 'draft' \ if from_addr and state.detailPageType != 'draft' \
and not state.in_sent_method: and not state.in_sent_method:
Draft().draft_msg(composer_objs) Draft().draft_msg(composer_objs)
return return
@ -1633,6 +1660,7 @@ class NavigateApp(MDApp):
state.in_composer = True state.in_composer = True
state.in_sent_method = False state.in_sent_method = False
def set_navbar_for_composer(self): def set_navbar_for_composer(self):
"""Clearing toolbar data when composer open""" """Clearing toolbar data when composer open"""
self.root.ids.toolbar.left_action_items = [ self.root.ids.toolbar.left_action_items = [
@ -1661,7 +1689,8 @@ class NavigateApp(MDApp):
def back_press(self): def back_press(self):
"""Method for, reverting composer to previous page""" """Method for, reverting composer to previous page"""
self.save_draft() if self.root.ids.scr_mngr.current == 'create':
self.save_draft()
if self.root.ids.scr_mngr.current == \ if self.root.ids.scr_mngr.current == \
'mailDetail' and state.in_search_mode: 'mailDetail' and state.in_search_mode:
toolbar_obj = self.root.ids.toolbar toolbar_obj = self.root.ids.toolbar
@ -1917,6 +1946,11 @@ class NavigateApp(MDApp):
top_box_obj.reload() top_box_obj.reload()
spinner_img_obj.reload() spinner_img_obj.reload()
def copy_composer_text(self, text):
"""Copy the data from mail detail page"""
Clipboard.copy(text)
toast('Copied')
class GrashofPopup(Popup): class GrashofPopup(Popup):
"""Moule for save contacts and error messages""" """Moule for save contacts and error messages"""
@ -2045,7 +2079,7 @@ class IconLeftSampleWidget(ILeftBodyTouch, MDIconButton):
pass pass
class IconReftSampleWidget(IRightBodyTouch, MDIconButton): class IconRightSampleWidget(IRightBodyTouch, MDIconButton):
"""Right icon sample widget""" """Right icon sample widget"""
pass pass
@ -2101,7 +2135,7 @@ class MailDetail(Screen):
"""Assigning mail details""" """Assigning mail details"""
subject = data[0][2].decode() if isinstance(data[0][2],bytes) else data[0][2] subject = data[0][2].decode() if isinstance(data[0][2],bytes) else data[0][2]
body = data[0][3].decode() if isinstance(data[0][2],bytes) else data[0][3] body = data[0][3].decode() if isinstance(data[0][2],bytes) else data[0][3]
self.to_addr = data[0][0] self.to_addr = data[0][0] if len(data[0][0]) > 4 else ' '
self.from_addr = data[0][1] self.from_addr = data[0][1]
self.subject = subject.capitalize( self.subject = subject.capitalize(
@ -2166,15 +2200,13 @@ class MailDetail(Screen):
def callback_for_delete(self, dt=0): def callback_for_delete(self, dt=0):
"""Delete method from allmails""" """Delete method from allmails"""
try: if state.detailPageType:
self.children[0].children[0].active = False self.children[0].children[0].active = False
state.kivyapp.set_common_header() state.kivyapp.set_common_header()
self.parent.current = 'allmails' \ self.parent.current = 'allmails' \
if state.is_allmail else state.detailPageType if state.is_allmail else state.detailPageType
state.detailPageType = '' state.detailPageType = ''
toast('Deleted') toast('Deleted')
except Exception as e:
print("Exception occures..........")
def inbox_reply(self): def inbox_reply(self):
"""Reply inbox messages""" """Reply inbox messages"""
@ -2237,7 +2269,10 @@ class MyaddDetailPopup(Popup):
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()
window_obj = self.parent.children[1].ids try:
window_obj = self.parent.children[2].ids
except Exception as e:
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 = ''
@ -2288,7 +2323,10 @@ class AddbookDetailPopup(Popup):
def send_message_to(self): def send_message_to(self):
"""Method used to fill to_address of composer autofield""" """Method used to fill to_address of composer autofield"""
state.kivyapp.set_navbar_for_composer() state.kivyapp.set_navbar_for_composer()
window_obj = self.parent.children[1].ids try:
window_obj = self.parent.children[2].ids
except Exception as e:
window_obj = self.parent.children[1].ids
window_obj.sc3.children[1].ids.txt_input.text = self.address 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.ti.text = ''
window_obj.sc3.children[1].ids.btn.text = 'Select' window_obj.sc3.children[1].ids.btn.text = 'Select'
@ -2321,6 +2359,7 @@ class AddbookDetailPopup(Popup):
class ShowQRCode(Screen): class ShowQRCode(Screen):
"""ShowQRCode Screen uses to show the detail of mails""" """ShowQRCode Screen uses to show the detail of mails"""
address = StringProperty()
def qrdisplay(self): def qrdisplay(self):
"""Method used for showing QR Code""" """Method used for showing QR Code"""
@ -2331,7 +2370,9 @@ class ShowQRCode(Screen):
address = self.manager.get_parent_window().children[0].address address = self.manager.get_parent_window().children[0].address
except Exception: except Exception:
address = self.manager.get_parent_window().children[1].address address = self.manager.get_parent_window().children[1].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
toast('Show QR code') toast('Show QR code')
@ -2609,10 +2650,9 @@ class Allmails(Screen):
subject = item[2].decode() if isinstance(item[2],bytes) else item[2] subject = item[2].decode() if isinstance(item[2],bytes) else item[2]
meny = TwoLineAvatarIconListItem( meny = TwoLineAvatarIconListItem(
text=item[1], text=item[1],
secondary_text=body[:50] + '........' if len( secondary_text=(subject[:50] + '........' if len(
body) >= 50 else ( subject) >= 50 else (
body + ',' + subject.replace( subject + ',' + body)[0:50] + '........').replace('\t', '').replace(' ', ''),
'\n', ''))[0:50] + '........',
theme_text_color='Custom', theme_text_color='Custom',
text_color=NavigateApp().theme_cls.primary_color) text_color=NavigateApp().theme_cls.primary_color)
meny.add_widget(AvatarSampleWidget( meny.add_widget(AvatarSampleWidget(
@ -2849,11 +2889,18 @@ class SenderDetailPopup(Popup):
self.from_addr = from_addr self.from_addr = from_addr
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")
pop_height = 1.2*(self.ids.sd_label.height+self.ids.sd_btn.children[0].height)
def copy_composer_text(self, text): if len(to_addr) > 3:
"""Copy the data from mail detail page""" self.height = 0
Clipboard.copy(text) self.height = pop_height
toast('Copied') self.ids.to_addId.size_hint_y = None
self.ids.to_addId.height= 50
frmaddbox = ToAddrBoxlayout()
frmaddbox.set_toAddress(to_addr)
self.ids.to_addId.add_widget(frmaddbox)
else:
self.height = 0
self.height = pop_height/1.5
class OneLineListTitle(OneLineListItem): class OneLineListTitle(OneLineListItem):
@ -2891,3 +2938,12 @@ class OneLineListTitle(OneLineListItem):
if text_item == 'Copy': if text_item == 'Copy':
Clipboard.copy(str(arg[0].text)) Clipboard.copy(str(arg[0].text))
toast(text_item) toast(text_item)
class ToAddrBoxlayout(BoxLayout):
"""class for BoxLayout behaviour"""
to_addr = StringProperty()
def set_toAddress(self, to_addr):
self.to_addr = to_addr
pass