fixed issues with draft mail and trash mail listing

This commit is contained in:
Navjot 2019-08-22 21:07:50 +05:30
parent 54eefe757f
commit 1351080e49
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C
2 changed files with 20 additions and 17 deletions

View File

@ -372,7 +372,7 @@ NavigationLayout:
MDRaisedButton: MDRaisedButton:
size_hint: 1, None size_hint: 1, None
height: dp(40) height: dp(40)
on_press: root.send() on_press: root.send(app)
MDLabel: MDLabel:
font_style: 'Title' font_style: 'Title'
text: 'send' text: 'send'

View File

@ -459,7 +459,7 @@ class DropDownWidget(BoxLayout):
txt_input = ObjectProperty() txt_input = ObjectProperty()
rv = ObjectProperty() rv = ObjectProperty()
def send(self): def send(self, navApp):
"""Send message from one address to another.""" """Send message from one address to another."""
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
fromAddress = str(self.ids.ti.text) fromAddress = str(self.ids.ti.text)
@ -533,6 +533,7 @@ class DropDownWidget(BoxLayout):
self.parent.parent.current = 'inbox' self.parent.parent.current = 'inbox'
self.ids.btn.text = 'select' self.ids.btn.text = 'select'
self.ids.ti.text = '' self.ids.ti.text = ''
navApp.back_press()
toast('send') toast('send')
return None return None
else: else:
@ -888,12 +889,11 @@ class Trash(Screen):
for item in trash_data: for item in trash_data:
meny = ThreeLineAvatarIconListItem( meny = ThreeLineAvatarIconListItem(
text='Draft' if item[4] == 'draft' else item[1], text=item[1],
secondary_text=item[2] if item[2] else item[1], secondary_text=item[2],
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/avatar.png' if item[ img_latter = './images/text_images/{}.png'.format(
4] == 'draft' else './images/text_images/{}.png'.format(
item[2][0].upper() if (item[2][0].upper() >= 'A' and item[ item[2][0].upper() if (item[2][0].upper() >= 'A' and item[
2][0].upper() <= 'Z') else '!') 2][0].upper() <= 'Z') else '!')
meny.add_widget(AvatarSampleWidget(source=img_latter)) meny.add_widget(AvatarSampleWidget(source=img_latter))
@ -992,7 +992,7 @@ class NavigateApp(App):
def getCurrentAccountData(self, text): def getCurrentAccountData(self, text):
"""Get Current Address Account Data.""" """Get Current Address Account Data."""
address_label = self.current_address_label( address_label = self.current_address_label(
BMConfigParser().get(text, 'label')) BMConfigParser().get(text, 'label'), text)
self.root_window.children[1].ids.toolbar.title = address_label self.root_window.children[1].ids.toolbar.title = address_label
state.association = text state.association = text
self.root.ids.sc1.clear_widgets() self.root.ids.sc1.clear_widgets()
@ -1171,16 +1171,19 @@ class NavigateApp(App):
return state.all_count return state.all_count
@staticmethod @staticmethod
def current_address_label(current_address=None): def current_address_label(current_add_label = None, current_addr = None):
"""Getting current address labels.""" """Getting current address labels."""
if BMConfigParser().addresses() or current_address: if BMConfigParser().addresses():
if current_address: if current_add_label:
first_name = current_address first_name = current_add_label
addr = current_addr
else: else:
first_name = BMConfigParser().get( addr = BMConfigParser().addresses()[0]
BMConfigParser().addresses()[0], 'label') first_name = BMConfigParser().get(addr, 'label')
f_name = first_name.split() f_name = first_name.split()
return f_name[0][:14] + '...' if len(f_name[0]) > 15 else f_name[0] label = f_name[0][:14].capitalize() + '...' if len(f_name[0]) > 15 else f_name[0].capitalize()
address = ' (' + addr[:6] + '...)'
return label + address
return '' return ''
def searchQuery(self, instance, *args): def searchQuery(self, instance, *args):
@ -1643,11 +1646,11 @@ class Draft(Screen):
int(state.draft_count) - 1) int(state.draft_count) - 1)
msg_count_objs.allmail_cnt.badge_text = str( msg_count_objs.allmail_cnt.badge_text = str(
int(state.all_count) - 1) int(state.all_count) - 1)
msg_count_objs.trash_cnt.badge_text = str( # msg_count_objs.trash_cnt.badge_text = str(
int(state.trash_count) + 1) # int(state.trash_count) + 1)
state.draft_count = str(int(state.draft_count) - 1) state.draft_count = str(int(state.draft_count) - 1)
state.all_count = str(int(state.all_count) - 1) state.all_count = str(int(state.all_count) - 1)
state.trash_count = str(int(state.trash_count) + 1) # state.trash_count = str(int(state.trash_count) + 1)
self.ids.ml.remove_widget(instance.parent.parent) self.ids.ml.remove_widget(instance.parent.parent)
toast('Deleted') toast('Deleted')