Fixed Draft mail details bug
This commit is contained in:
parent
9fc658dbc9
commit
01f561b412
|
@ -10,6 +10,7 @@ from kivy.properties import (
|
||||||
NumericProperty
|
NumericProperty
|
||||||
)
|
)
|
||||||
from kivy.factory import Factory
|
from kivy.factory import Factory
|
||||||
|
from kivy.app import App
|
||||||
|
|
||||||
from kivymd.uix.button import MDFlatButton, MDIconButton
|
from kivymd.uix.button import MDFlatButton, MDIconButton
|
||||||
from kivymd.uix.dialog import MDDialog
|
from kivymd.uix.dialog import MDDialog
|
||||||
|
@ -92,16 +93,18 @@ class MailDetail(Screen): # pylint: disable=too-many-instance-attributes
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Mail Details method"""
|
"""Mail Details method"""
|
||||||
super(MailDetail, self).__init__(*args, **kwargs)
|
super(MailDetail, self).__init__(*args, **kwargs)
|
||||||
|
self.kivy_running_app = App.get_running_app()
|
||||||
|
self.kivy_state = self.kivy_running_app.kivy_state_obj
|
||||||
Clock.schedule_once(self.init_ui, 0)
|
Clock.schedule_once(self.init_ui, 0)
|
||||||
|
|
||||||
def init_ui(self, dt=0):
|
def init_ui(self, dt=0):
|
||||||
"""Clock Schdule for method MailDetail mails"""
|
"""Clock Schdule for method MailDetail mails"""
|
||||||
self.page_type = state.detailPageType if state.detailPageType else ''
|
self.page_type = state.detailPageType if state.detailPageType else ''
|
||||||
try:
|
try:
|
||||||
if state.detailPageType == 'sent' or state.detailPageType == 'draft':
|
if state.detailPageType == 'sent' or self.kivy_state.detailPageType == 'draft':
|
||||||
data = sqlQuery(
|
data = sqlQuery(
|
||||||
"select toaddress, fromaddress, subject, message, status,"
|
"select toaddress, fromaddress, subject, message, status,"
|
||||||
" ackdata, senttime from sent where ackdata = ?;", state.mail_id)
|
" ackdata, senttime from sent where ackdata = ?;", self.kivy_state.mail_id)
|
||||||
state.status = self
|
state.status = self
|
||||||
state.ackdata = data[0][5]
|
state.ackdata = data[0][5]
|
||||||
self.assign_mail_details(data)
|
self.assign_mail_details(data)
|
||||||
|
@ -128,7 +131,7 @@ class MailDetail(Screen): # pylint: disable=too-many-instance-attributes
|
||||||
if len(data[0]) == 7:
|
if len(data[0]) == 7:
|
||||||
self.status = data[0][4]
|
self.status = data[0][4]
|
||||||
self.time_tag = ShowTimeHistoy(data[0][4]) if state.detailPageType == 'inbox' else ShowTimeHistoy(data[0][6])
|
self.time_tag = ShowTimeHistoy(data[0][4]) if state.detailPageType == 'inbox' else ShowTimeHistoy(data[0][6])
|
||||||
self.avatarImg = state.imageDir + '/avatar.png' if state.detailPageType == 'draft' else (
|
self.avatarImg = state.imageDir + '/avatar.png' if self.kivy_state.detailPageType == 'draft' else (
|
||||||
state.imageDir + '/text_images/{0}.png'.format(avatarImageFirstLetter(self.subject.strip())))
|
state.imageDir + '/text_images/{0}.png'.format(avatarImageFirstLetter(self.subject.strip())))
|
||||||
self.timeinseconds = data[0][4] if state.detailPageType == 'inbox' else data[0][6]
|
self.timeinseconds = data[0][4] if state.detailPageType == 'inbox' else data[0][6]
|
||||||
|
|
||||||
|
@ -157,11 +160,11 @@ class MailDetail(Screen): # pylint: disable=too-many-instance-attributes
|
||||||
self.parent.screens[0].ids.ml.clear_widgets()
|
self.parent.screens[0].ids.ml.clear_widgets()
|
||||||
self.parent.screens[0].loadMessagelist(state.association)
|
self.parent.screens[0].loadMessagelist(state.association)
|
||||||
|
|
||||||
elif state.detailPageType == 'draft':
|
elif self.kivy_state.detailPageType == 'draft':
|
||||||
sqlExecute("DELETE FROM sent WHERE ackdata = ?;", state.mail_id)
|
sqlExecute("DELETE FROM sent WHERE ackdata = ?;", self.kivy_state.mail_id)
|
||||||
msg_count_objs.draft_cnt.ids.badge_txt.text = str(
|
msg_count_objs.draft_cnt.ids.badge_txt.text = str(
|
||||||
int(state.draft_count) - 1)
|
int(self.kivy_state.draft_count) - 1)
|
||||||
state.draft_count = str(int(state.draft_count) - 1)
|
self.kivy_state.draft_count = str(int(self.kivy_state.draft_count) - 1)
|
||||||
self.parent.screens[13].clear_widgets()
|
self.parent.screens[13].clear_widgets()
|
||||||
self.parent.screens[13].add_widget(Factory.Draft())
|
self.parent.screens[13].add_widget(Factory.Draft())
|
||||||
|
|
||||||
|
@ -214,10 +217,10 @@ class MailDetail(Screen): # pylint: disable=too-many-instance-attributes
|
||||||
|
|
||||||
def write_msg(self, navApp):
|
def write_msg(self, navApp):
|
||||||
"""Write on draft mail"""
|
"""Write on draft mail"""
|
||||||
state.send_draft_mail = state.mail_id
|
state.send_draft_mail = self.kivy_state.mail_id
|
||||||
data = sqlQuery(
|
data = sqlQuery(
|
||||||
"select toaddress, fromaddress, subject, message from sent where"
|
"select toaddress, fromaddress, subject, message from sent where"
|
||||||
" ackdata = ?;", state.mail_id)
|
" ackdata = ?;", self.kivy_state.mail_id)
|
||||||
composer_ids = (
|
composer_ids = (
|
||||||
self.parent.parent.ids.sc3.children[1].ids)
|
self.parent.parent.ids.sc3.children[1].ids)
|
||||||
composer_ids.ti.text = data[0][1]
|
composer_ids.ti.text = data[0][1]
|
||||||
|
|
|
@ -645,7 +645,7 @@ class NavigateApp(MDApp):
|
||||||
self.root.ids.scr_mngr.transition = SlideTransition()
|
self.root.ids.scr_mngr.transition = SlideTransition()
|
||||||
self.root.ids.scr_mngr.transition.direction = 'right'
|
self.root.ids.scr_mngr.transition.direction = 'right'
|
||||||
self.root.ids.scr_mngr.transition.bind(on_complete=self.reset)
|
self.root.ids.scr_mngr.transition.bind(on_complete=self.reset)
|
||||||
if state.is_allmail or state.detailPageType == 'draft':
|
if state.is_allmail or self.kivy_state_obj.detailPageType == 'draft':
|
||||||
state.is_allmail = False
|
state.is_allmail = False
|
||||||
state.detailPageType = ''
|
state.detailPageType = ''
|
||||||
state.in_composer = False
|
state.in_composer = False
|
||||||
|
@ -812,7 +812,7 @@ class NavigateApp(MDApp):
|
||||||
delete_btn]
|
delete_btn]
|
||||||
elif state.detailPageType == 'sent':
|
elif state.detailPageType == 'sent':
|
||||||
dynamic_list = [delete_btn]
|
dynamic_list = [delete_btn]
|
||||||
elif state.detailPageType == 'draft':
|
elif self.kivy_state_obj.detailPageType == 'draft':
|
||||||
dynamic_list = [
|
dynamic_list = [
|
||||||
['pencil', lambda x: self.root.ids.sc14.write_msg(self)],
|
['pencil', lambda x: self.root.ids.sc14.write_msg(self)],
|
||||||
delete_btn]
|
delete_btn]
|
||||||
|
|
Reference in New Issue
Block a user