wokred on android device send mail issue or worked on app response issue

This commit is contained in:
Navjot 2019-09-19 22:00:26 +05:30
parent 3bff3c5631
commit 31a73d66bb
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C
2 changed files with 94 additions and 68 deletions

View File

@ -72,61 +72,61 @@
on_text:app.getCurrentAccountData(self.text) on_text:app.getCurrentAccountData(self.text)
Image: Image:
source: app.get_default_image() source: app.get_default_image()
x: self.width/4 x: self.width/4-2
y: self.parent.y + self.parent.height/2 - self.height + 10 y: self.parent.y + self.parent.height/2 - self.height + 14
size: 20, 20 size: 28, 28
ArrowImg: ArrowImg:
NavigationDrawerIconButton: NavigationDrawerIconButton:
id: inbox_cnt id: inbox_cnt
icon: 'email-open' icon: 'email-open'
text: "Inbox" text: "Inbox"
on_release: app.root.ids.scr_mngr.current = 'inbox' on_release: app.root.ids.scr_mngr.current = 'inbox'
badge_text: app.mail_count(self.text) badge_text: "0"
on_press: app.check_search_screen(self) on_press: app.check_search_screen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
id: send_cnt id: send_cnt
icon: 'send' icon: 'send'
text: "Sent" text: "Sent"
on_release: app.root.ids.scr_mngr.current = 'sent' on_release: app.root.ids.scr_mngr.current = 'sent'
badge_text: app.mail_count(self.text) badge_text: "0"
on_press: app.check_search_screen(self) on_press: app.check_search_screen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
id: draft_cnt id: draft_cnt
icon: 'message-draw' icon: 'message-draw'
text: "Draft" text: "Draft"
on_release: app.root.ids.scr_mngr.current = 'draft' on_release: app.root.ids.scr_mngr.current = 'draft'
badge_text: app.mail_count(self.text) badge_text: "0"
on_press: app.check_search_screen(self) on_press: app.check_search_screen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
text: "Starred" text: "Starred"
icon:'star' icon:'star'
on_release: app.root.ids.scr_mngr.current = 'inbox' on_release: app.root.ids.scr_mngr.current = 'starred'
on_press: app.check_search_screen(self) on_press: app.check_search_screen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
icon: 'archive' icon: 'archive'
text: "Archieve" text: "Archieve"
on_release: app.root.ids.scr_mngr.current = 'trash' on_release: app.root.ids.scr_mngr.current = 'archieve'
badge_text: "9+" badge_text: "0"
on_press: app.check_search_screen(self) on_press: app.check_search_screen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
icon: 'email-open-outline' icon: 'email-open-outline'
text: "Spam" text: "Spam"
on_release: app.root.ids.scr_mngr.current = 'inbox' on_release: app.root.ids.scr_mngr.current = 'spam'
badge_text: "8+" badge_text: "0"
on_press: app.check_search_screen(self) on_press: app.check_search_screen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
id: trash_cnt id: trash_cnt
icon: 'delete' icon: 'delete'
text: "Trash" text: "Trash"
on_release: app.root.ids.scr_mngr.current = 'trash' on_release: app.root.ids.scr_mngr.current = 'trash'
badge_text: app.mail_count(self.text) badge_text: "0"
on_press: app.check_search_screen(self) on_press: app.check_search_screen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
id: allmail_cnt id: allmail_cnt
text: "All Mails" text: "All Mails"
icon:'contact-mail' icon:'contact-mail'
on_release: app.root.ids.scr_mngr.current = 'allmails' on_release: app.root.ids.scr_mngr.current = 'allmails'
badge_text: app.mail_count(self.text) badge_text: "0"
on_press: app.check_search_screen(self) on_press: app.check_search_screen(self)
NavigationDrawerDivider: NavigationDrawerDivider:
NavigationDrawerSubheader: NavigationDrawerSubheader:
@ -237,7 +237,12 @@ NavigationLayout:
id:sc17 id:sc17
Credits: Credits:
id:sc18 id:sc18
Starred:
id:sc19
Archieve:
id:sc20
Spam:
id:sc21
<Inbox>: <Inbox>:
name: 'inbox' name: 'inbox'
@ -274,6 +279,30 @@ NavigationLayout:
id: ml id: ml
ComposerButton: ComposerButton:
<Starred>:
name: 'starred'
ScrollView:
do_scroll_x: False
MDList:
id: ml
ComposerButton:
<Archieve>:
name: 'archieve'
ScrollView:
do_scroll_x: False
MDList:
id: ml
ComposerButton:
<Spam>:
name: 'spam'
ScrollView:
do_scroll_x: False
MDList:
id: ml
ComposerButton:
<Allmails>: <Allmails>:
name: 'allmails' name: 'allmails'
FloatLayout: FloatLayout:

View File

@ -5,7 +5,6 @@ src/bitmessagekivy/mpybit.py
import os import os
import time import time
from functools import partial from functools import partial
import identiconGeneration
from bmconfigparser import BMConfigParser from bmconfigparser import BMConfigParser
from helper_sql import sqlExecute, sqlQuery from helper_sql import sqlExecute, sqlQuery
from kivy.app import App from kivy.app import App
@ -58,12 +57,16 @@ import state
from uikivysignaler import UIkivySignaler from uikivysignaler import UIkivySignaler
# pylint: disable=unused-argument, too-few-public-methods, import-error # pylint: disable=unused-argument, too-few-public-methods, import-error
import identiconGeneration
import os
from kivy.core.clipboard import Clipboard
# pylint: disable=unused-argument, too-few-public-methods
def toast(text): def toast(text):
"""Method will display the toast message.""" """Method will display the toast message."""
# pylint: disable=redefined-outer-name
if platform == 'linux': if platform == 'linux':
from kivymd.toast.kivytoast import toast from kivymd.toast.kivytoast import toast # pylint: disable=redefined-outer-name
toast(text) toast(text)
return return
@ -101,7 +104,7 @@ class Inbox(Screen):
def loadMessagelist(self, account, where="", what=""): def loadMessagelist(self, account, where="", what=""):
"""Load Inbox list for Inbox messages.""" """Load Inbox list for Inbox messages."""
# pylint: disable=too-many-locals, unused-variable # pylint: disable=too-many-locals
if state.searcing_text: if state.searcing_text:
where = ['subject', 'message'] where = ['subject', 'message']
what = state.searcing_text what = state.searcing_text
@ -110,6 +113,11 @@ class Inbox(Screen):
queryreturn = kivy_helper_search.search_sql( queryreturn = kivy_helper_search.search_sql(
xAddress, account, "inbox", where, what, False) xAddress, account, "inbox", where, what, False)
if queryreturn: if queryreturn:
src_mng_obj = state.kivyapp.root.children[2].children[0].ids
src_mng_obj.inbox_cnt.badge_text = str(len(queryreturn))
state.inbox_count = str(len(queryreturn))
state.kivyapp.root.ids.sc17.clear_widgets()
state.kivyapp.root.ids.sc17.add_widget(Allmails())
for mail in queryreturn: for mail in queryreturn:
third_text = mail[3].replace('\n', ' ') third_text = mail[3].replace('\n', ' ')
data.append({ data.append({
@ -124,9 +132,6 @@ class Inbox(Screen):
secondary_text=item['secondary_text'], secondary_text=item['secondary_text'],
theme_text_color='Custom', theme_text_color='Custom',
text_color=NavigateApp().theme_cls.primary_color) text_color=NavigateApp().theme_cls.primary_color)
# img_latter = item['secondary_text'][0].upper() if (
# item['secondary_text'][0].upper() >= 'A' and item[
# 'secondary_text'][0].upper() <= 'Z') else '!'
meny.add_widget(AvatarSampleWidget( meny.add_widget(AvatarSampleWidget(
source='./images/text_images/{}.png'.format( source='./images/text_images/{}.png'.format(
avatarImageFirstLetter(item['secondary_text'].strip())))) avatarImageFirstLetter(item['secondary_text'].strip()))))
@ -192,10 +197,14 @@ class Inbox(Screen):
int(state.inbox_count) - 1) int(state.inbox_count) - 1)
msg_count_objs.trash_cnt.badge_text = str( msg_count_objs.trash_cnt.badge_text = str(
int(state.trash_count) + 1) int(state.trash_count) + 1)
msg_count_objs.allmail_cnt.badge_text = str(
int(state.all_count) - 1)
state.inbox_count = str( state.inbox_count = str(
int(state.inbox_count) - 1) int(state.inbox_count) - 1)
state.trash_count = str( state.trash_count = str(
int(state.trash_count) + 1) int(state.trash_count) + 1)
state.all_count = str(
int(state.all_count) - 1)
self.ids.ml.remove_widget( self.ids.ml.remove_widget(
instance.parent.parent) instance.parent.parent)
toast('Deleted') toast('Deleted')
@ -753,6 +762,9 @@ class Sent(Screen):
state.check_sent_acc = None state.check_sent_acc = None
if queryreturn: if queryreturn:
src_mng_obj = state.kivyapp.root.children[2].children[0].ids
src_mng_obj.send_cnt.badge_text = str(len(queryreturn))
state.sent_count = str(len(queryreturn))
for mail in queryreturn: for mail in queryreturn:
self.data.append({ self.data.append({
'text': mail[1].strip(), 'text': mail[1].strip(),
@ -891,6 +903,9 @@ class Trash(Screen):
trash_data = inbox + sent trash_data = inbox + sent
if trash_data: if trash_data:
src_mng_obj = state.kivyapp.root.children[2].children[0].ids
src_mng_obj.trash_cnt.badge_text = str(len(trash_data))
state.trash_count = str(len(trash_data))
for item in trash_data: for item in trash_data:
meny = ThreeLineAvatarIconListItem( meny = ThreeLineAvatarIconListItem(
text=item[1], text=item[1],
@ -1199,45 +1214,6 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
import shutdown import shutdown
shutdown.doCleanShutdown() shutdown.doCleanShutdown()
@staticmethod
def mail_count(text):
"""Counting Mail numbers."""
if state.association == '':
if BMConfigParser().addresses():
state.association = BMConfigParser().addresses()[0]
if text == 'Sent':
state.sent_count = str(sqlQuery(
"SELECT COUNT(*) FROM {0} WHERE fromaddress = '{1}' and \
folder = '{0}' ;".format(
text.lower(), state.association))[0][0])
return state.sent_count
elif text == 'Inbox':
state.inbox_count = str(sqlQuery(
"SELECT COUNT(*) FROM {0} WHERE toaddress = '{1}' and \
folder = '{0}' ;".format(
text.lower(), state.association))[0][0])
return state.inbox_count
elif text == 'Trash':
state.trash_count = str(sqlQuery(
"SELECT (SELECT count(*) FROM sent where fromaddress = '{0}' \
and folder = 'trash' )+(SELECT count(*) FROM inbox where \
toaddress = '{0}' and folder = 'trash') AS SumCount".format(
state.association))[0][0])
return state.trash_count
elif text == 'Draft':
state.draft_count = str(sqlQuery(
"SELECT COUNT(*) FROM sent WHERE fromaddress = '{1}' and \
folder = '{0}' ;".format(
text.lower(), state.association))[0][0])
return state.draft_count
elif text == 'All Mails':
state.all_count = str(sqlQuery(
"SELECT (SELECT count(*) FROM sent where fromaddress = '{0}' \
and folder = 'sent' )+(SELECT count(*) FROM inbox where \
toaddress = '{0}' and folder != 'trash') AS SumCount".format(
state.association))[0][0])
return state.all_count
@staticmethod @staticmethod
def current_address_label(current_add_label=None, current_addr=None): def current_address_label(current_add_label=None, current_addr=None):
"""Getting current address labels.""" """Getting current address labels."""
@ -1250,7 +1226,7 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
first_name = BMConfigParser().get(addr, 'label') first_name = BMConfigParser().get(addr, 'label')
f_name = first_name.split() f_name = first_name.split()
label = f_name[0][:14].capitalize() + '...' if len(f_name[0]) > 15 else f_name[0].capitalize() label = f_name[0][:14].capitalize() + '...' if len(f_name[0]) > 15 else f_name[0].capitalize()
address = ' (' + addr[:6] + '...)' address = ' (' + addr + '...)'
return label + address return label + address
return '' return ''
@ -1317,10 +1293,7 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
def set_identicon(self, text): def set_identicon(self, text):
"""This method is use for showing identicon in address spinner""" """This method is use for showing identicon in address spinner"""
img = identiconGeneration.generate(text) img = identiconGeneration.generate(text)
img.size = 20, 20 self.root.children[2].children[0].ids.btn.children[1].texture = img.texture
img.y = self.root.children[2].children[0].ids.btn.children[0].y
img.x = 5
self.root.children[2].children[0].ids.btn.add_widget(img)
@staticmethod @staticmethod
def address_identicon(): def address_identicon():
@ -1348,6 +1321,7 @@ class GrashofPopup(Popup):
def __init__(self, **kwargs): def __init__(self, **kwargs):
"""Grash of pop screen settings.""" """Grash of pop screen settings."""
super(GrashofPopup, self).__init__(**kwargs) super(GrashofPopup, self).__init__(**kwargs)
print("sssssssssssssssssssiiiiiiiiiiiiiiizzzzzzzzzzeeeeee...............", state.screen_density)
if state.screen_density[0] <= 720: if state.screen_density[0] <= 720:
self.size_hint_y = 0.4 self.size_hint_y = 0.4
self.size_hint_x = 0.9 self.size_hint_x = 0.9
@ -1535,9 +1509,9 @@ class MailDetail(Screen):
sqlExecute( sqlExecute(
"UPDATE inbox SET folder = 'trash' WHERE \ "UPDATE inbox SET folder = 'trash' WHERE \
received = {};".format(state.sentMailTime)) received = {};".format(state.sentMailTime))
msg_count_objs.inbox_cnt.badge_text = str( # msg_count_objs.inbox_cnt.badge_text = str(
int(state.inbox_count) - 1) # int(state.inbox_count) - 1)
state.inbox_count = str(int(state.inbox_count) - 1) # state.inbox_count = str(int(state.inbox_count) - 1)
self.parent.screens[0].clear_widgets() self.parent.screens[0].clear_widgets()
self.parent.screens[0].add_widget(Inbox()) self.parent.screens[0].add_widget(Inbox())
elif state.detailPageType == 'draft': elif state.detailPageType == 'draft':
@ -1737,6 +1711,9 @@ class Draft(Screen):
# state.msg_counter_objs = None # state.msg_counter_objs = None
if queryreturn: if queryreturn:
src_mng_obj = state.kivyapp.root.children[2].children[0].ids
src_mng_obj.draft_cnt.badge_text = str(len(queryreturn))
state.draft_count = str(len(queryreturn))
for mail in queryreturn: for mail in queryreturn:
third_text = mail[3].replace('\n', ' ') third_text = mail[3].replace('\n', ' ')
self.data.append({ self.data.append({
@ -1863,6 +1840,7 @@ class Draft(Screen):
'draft', 'draft',
encoding, encoding,
BMConfigParser().getint('bitmessagesettings', 'ttl')) BMConfigParser().getint('bitmessagesettings', 'ttl'))
state.msg_counter_objs = src_object.children[2].children[0].ids state.msg_counter_objs = src_object.children[2].children[0].ids
state.draft_count = str(int(state.draft_count) + 1) state.draft_count = str(int(state.draft_count) + 1)
src_object.ids.sc16.clear_widgets() src_object.ids.sc16.clear_widgets()
@ -1926,6 +1904,8 @@ class Allmails(Screen):
all_mails = inbox + sent_and_draft all_mails = inbox + sent_and_draft
if all_mails: if all_mails:
state.kivyapp.root.children[2].children[0].ids.allmail_cnt.badge_text = str(len(all_mails))
state.all_count = str(len(all_mails))
for item in all_mails: for item in all_mails:
meny = ThreeLineAvatarIconListItem( meny = ThreeLineAvatarIconListItem(
text=item[1], text=item[1],
@ -2051,3 +2031,20 @@ def avatarImageFirstLetter(letter_string):
img_latter = '!' img_latter = '!'
return img_latter return img_latter
class Starred(Screen):
"""Starred Screen show widgets of page."""
pass
class Archieve(Screen):
"""Archieve Screen show widgets of page."""
pass
class Spam(Screen):
"""Spam Screen show widgets of page."""
pass