fixed app crashing issues

This commit is contained in:
navjot 2021-03-25 01:47:26 +05:30
parent ebb350b81b
commit 6aee6f12d5
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C
13 changed files with 104 additions and 83 deletions

View File

@ -17,9 +17,10 @@ from kivymd.uix.list import TwoLineAvatarIconListItem
import state
from bitmessagekivy.baseclass.common import (
showLimitedCnt, toast, initailize_detail_page, ThemeClsColor,
showLimitedCnt, toast, ThemeClsColor,
chipTag, avatarImageFirstLetter, AddTimeWidget, AvatarSampleWidget
)
from bitmessagekivy.baseclass.maildetail import MailDetail
from bitmessagekivy.baseclass.trash import Trash
@ -148,10 +149,9 @@ class Allmails(Screen):
src_mng_obj = self.manager
else:
src_mng_obj = self.parent.parent
# src_mng_obj.screens[13].clear_widgets()
# src_mng_obj.screens[13].add_widget(MailDetail())
# src_mng_obj.current = 'mailDetail'
initailize_detail_page(src_mng_obj)
src_mng_obj.screens[11].clear_widgets()
src_mng_obj.screens[11].add_widget(MailDetail())
src_mng_obj.current = 'mailDetail'
def swipe_delete(self, unique_id, folder, instance, *args):
"""Delete inbox mail from all mail listing"""

View File

@ -1,3 +1,5 @@
import time
from bitmessagekivy import kivy_helper_search
from bmconfigparser import BMConfigParser
from helper_sql import sqlExecute
@ -18,9 +20,10 @@ from kivymd.uix.list import TwoLineAvatarIconListItem
import state
from bitmessagekivy.baseclass.common import (
showLimitedCnt, initailize_detail_page, toast, ThemeClsColor,
showLimitedCnt, toast, ThemeClsColor,
AddTimeWidget, AvatarSampleWidget
)
from bitmessagekivy.baseclass.maildetail import MailDetail
class Draft(Screen):
@ -46,11 +49,12 @@ class Draft(Screen):
def sentaccounts(self):
"""Load draft accounts"""
self.account = state.association
# self.account = state.association
self.loadDraft()
def loadDraft(self, where="", what=""):
"""Load draft list for Draft messages"""
self.account = state.association
xAddress = 'fromaddress'
self.ids.tag_label.text = ''
self.draftDataQuery(xAddress, where, what)
@ -144,10 +148,9 @@ class Draft(Screen):
src_mng_obj = self.manager
else:
src_mng_obj = self.parent.parent
# src_mng_obj.screens[13].clear_widgets()
# src_mng_obj.screens[13].add_widget(MailDetail())
# src_mng_obj.current = 'mailDetail'
initailize_detail_page(src_mng_obj)
src_mng_obj.screens[11].clear_widgets()
src_mng_obj.screens[11].add_widget(MailDetail())
src_mng_obj.current = 'mailDetail'
def delete_draft(self, data_index, instance, *args):
"""Delete draft message permanently"""

View File

@ -19,9 +19,11 @@ from kivymd.uix.list import TwoLineAvatarIconListItem
import state
from bitmessagekivy.baseclass.common import (
showLimitedCnt, initailize_detail_page, avatarImageFirstLetter,
showLimitedCnt, avatarImageFirstLetter,
AddTimeWidget, ThemeClsColor, AvatarSampleWidget, toast
)
from bitmessagekivy.baseclass.maildetail import MailDetail
from bitmessagekivy.baseclass.trash import Trash
class Inbox(Screen):
@ -195,10 +197,9 @@ class Inbox(Screen):
src_mng_obj = self.manager
else:
src_mng_obj = self.parent.parent
# src_mng_obj.screens[13].clear_widgets()
# src_mng_obj.screens[13].add_widget(MailDetail())
# src_mng_obj.current = "mailDetail"
initailize_detail_page(src_mng_obj)
src_mng_obj.screens[11].clear_widgets()
src_mng_obj.screens[11].add_widget(MailDetail())
src_mng_obj.current = "mailDetail"
def delete(self, data_index, instance, *args):
"""Delete inbox mail from inbox listing"""
@ -235,12 +236,14 @@ class Inbox(Screen):
def update_trash(self):
"""Update trash screen mails which is deleted from inbox"""
try:
self.parent.screens[4].clear_widgets()
self.parent.screens[4].add_widget(Trash())
except Exception:
self.parent.parent.screens[4].clear_widgets()
self.parent.parent.screens[4].add_widget(Trash())
self.manager.parent.ids.sc5.clear_widgets()
self.manager.parent.ids.sc5.add_widget(Trash())
# try:
# self.parent.screens[4].clear_widgets()
# self.parent.screens[4].add_widget(Trash())
# except Exception:
# self.parent.parent.screens[4].clear_widgets()
# self.parent.parent.screens[4].add_widget(Trash())
def refresh_callback(self, *args):
"""Method updates the state of application,

View File

@ -1,3 +1,5 @@
from datetime import datetime
from bitmessagekivy.get_platform import platform
from helper_sql import sqlExecute, sqlQuery
@ -7,6 +9,8 @@ from kivy.properties import (
StringProperty,
NumericProperty
)
from kivy.factory import Factory
from kivymd.uix.button import MDFlatButton, MDIconButton
from kivymd.uix.dialog import MDDialog
from kivymd.uix.list import (
@ -22,7 +26,6 @@ from bitmessagekivy.baseclass.common import (
toast, avatarImageFirstLetter, ShowTimeHistoy
)
from bitmessagekivy.baseclass.popup import SenderDetailPopup
from bitmessagekivy.baseclass.trash import Trash
class OneLineListTitle(OneLineListItem):
@ -95,6 +98,7 @@ class MailDetail(Screen): # pylint: disable=too-many-instance-attributes
def init_ui(self, dt=0):
"""Clock Schdule for method MailDetail mails"""
self.page_type = state.detailPageType if state.detailPageType else ''
try:
if state.detailPageType == 'sent' or state.detailPageType == 'draft':
data = sqlQuery(
"select toaddress, fromaddress, subject, message, status,"
@ -109,6 +113,8 @@ class MailDetail(Screen): # pylint: disable=too-many-instance-attributes
" where msgid = ?;", state.mail_id)
self.assign_mail_details(data)
state.kivyapp.set_mail_detail_header()
except Exception as e:
print('Something wents wrong!!')
def assign_mail_details(self, data):
"""Assigning mail details"""
@ -139,8 +145,8 @@ class MailDetail(Screen): # pylint: disable=too-many-instance-attributes
" ackdata = ?;", state.mail_id)
msg_count_objs.send_cnt.ids.badge_txt.text = 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].loadSent(state.association)
self.parent.screens[2].ids.ml.clear_widgets()
self.parent.screens[2].loadSent(state.association)
elif state.detailPageType == 'inbox':
state.kivyapp.root.ids.sc1.ids.inbox_search.ids.search_field.text = ''
sqlExecute(
@ -157,8 +163,8 @@ class MailDetail(Screen): # pylint: disable=too-many-instance-attributes
msg_count_objs.draft_cnt.ids.badge_txt.text = 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].add_widget(Draft())
self.parent.screens[13].ids.ml.clear_widgets()
self.parent.screens[13].loadDraft(state.association)
if state.detailPageType != 'draft':
msg_count_objs.trash_cnt.ids.badge_txt.text = str(
@ -167,10 +173,10 @@ class MailDetail(Screen): # pylint: disable=too-many-instance-attributes
int(state.all_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'
self.parent.screens[4].clear_widgets()
self.parent.screens[4].add_widget(Trash())
self.parent.screens[16].clear_widgets()
self.parent.screens[16].add_widget(Allmails())
self.parent.screens[3].clear_widgets()
self.parent.screens[3].add_widget(Factory.Trash())
self.parent.screens[14].clear_widgets()
self.parent.screens[14].add_widget(Factory.Allmails())
Clock.schedule_once(self.callback_for_delete, 4)
def callback_for_delete(self, dt=0):
@ -189,7 +195,7 @@ class MailDetail(Screen): # pylint: disable=too-many-instance-attributes
data = sqlQuery(
"select toaddress, fromaddress, subject, message, received from inbox where"
" msgid = ?;", state.mail_id)
composer_obj = self.parent.screens[2].children[1].ids
composer_obj = self.parent.screens[1].children[1].ids
composer_obj.ti.text = data[0][0]
composer_obj.btn.text = data[0][0]
composer_obj.txt_input.text = data[0][1]

View File

@ -5,6 +5,7 @@ from bmconfigparser import BMConfigParser
from helper_sql import sqlExecute, sqlQuery
from kivy.clock import Clock
from kivy.core.window import Window
from kivy.factory import Factory
from kivy.properties import (
BooleanProperty,
ListProperty,
@ -107,8 +108,8 @@ class DropDownWidget(BoxLayout):
int(time.time()),
int(time.time()),
state.send_draft_mail)
self.parent.parent.screens[15].clear_widgets()
self.parent.parent.screens[15].add_widget(Draft())
self.parent.parent.screens[13].clear_widgets()
self.parent.parent.screens[13].add_widget(Factory.Draft())
# state.detailPageType = ''
# state.send_draft_mail = None
else:

View File

@ -7,6 +7,7 @@ from kivy.properties import (
ListProperty,
StringProperty
)
from kivymd.uix.button import MDFlatButton
from kivymd.uix.dialog import MDDialog
from kivymd.uix.label import MDLabel
from kivymd.uix.list import (
@ -19,7 +20,8 @@ from kivy.uix.screenmanager import Screen
import state
from bitmessagekivy.baseclass.common import (
avatarImageFirstLetter, AvatarSampleWidget,ThemeClsColor
avatarImageFirstLetter, AvatarSampleWidget,ThemeClsColor,
toast
)
from bitmessagekivy.baseclass.popup import MyaddDetailPopup
@ -100,12 +102,9 @@ class MyAddress(Screen):
text_color=ThemeClsColor,)
meny._txt_right_pad = dp(70)
try:
meny.canvas.children[6].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5]
meny.canvas.children[3].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5]
except Exception:
try:
meny.canvas.children[9].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5]
except Exception as e:
print('Exception: ', e)
pass
meny.add_widget(AvatarSampleWidget(
source=state.imageDir + '/text_images/{}.png'.format(
avatarImageFirstLetter(item['text'].strip()))))
@ -125,6 +124,7 @@ class MyAddress(Screen):
meny.add_widget(ToggleBtn(active=True if is_enable == 'true' else False))
self.ids.ml.add_widget(meny)
def check_scroll_y(self, instance, somethingelse):
"""Load data on scroll down"""
if self.ids.refresh_layout.scroll_y <= -0.0 and self.has_refreshed:
@ -214,10 +214,11 @@ class MyAddress(Screen):
BMConfigParser().set(str(address), 'enabled', 'false')
BMConfigParser().save()
instance.parent.parent.theme_text_color = 'Primary'
try:
instance.parent.parent.canvas.children[6].rgba = [0.5, 0.5, 0.5, 0.5]
except Exception:
instance.parent.parent.canvas.children[9].rgba = [0.5, 0.5, 0.5, 0.5]
instance.parent.parent.canvas.children[3].rgba = [0.5, 0.5, 0.5, 0.5]
# try:
# instance.parent.parent.canvas.children[6].rgba = [0.5, 0.5, 0.5, 0.5]
# except Exception:
# instance.parent.parent.canvas.children[9].rgba = [0.5, 0.5, 0.5, 0.5]
toast('Address disabled')
Clock.schedule_once(self.address_permision_callback, 0)
@ -226,10 +227,11 @@ class MyAddress(Screen):
BMConfigParser().set(address, 'enabled', 'true')
BMConfigParser().save()
instance.parent.parent.theme_text_color = 'Custom'
try:
instance.parent.parent.canvas.children[6].rgba = [0, 0, 0, 0]
except Exception:
instance.parent.parent.canvas.children[9].rgba = [0, 0, 0, 0]
instance.parent.parent.canvas.children[3].rgba = [0, 0, 0, 0]
# try:
# instance.parent.parent.canvas.children[6].rgba = [0, 0, 0, 0]
# except Exception:
# instance.parent.parent.canvas.children[9].rgba = [0, 0, 0, 0]
toast('Address Enabled')
Clock.schedule_once(self.address_permision_callback, 0)

View File

@ -2,6 +2,7 @@ from bitmessagekivy.get_platform import platform
from bitmessagekivy import kivy_helper_search
from kivy.clock import Clock
from kivy.metrics import dp
from kivy.properties import StringProperty
from kivy.uix.boxlayout import BoxLayout

View File

@ -5,8 +5,10 @@ from bmconfigparser import BMConfigParser
from functools import partial
from helper_sql import sqlExecute
from kivy.clock import Clock
from kivy.factory import Factory
from kivy.metrics import dp
from kivy.properties import StringProperty, ListProperty
from kivy.uix.button import Button
from kivy.uix.carousel import Carousel
from kivy.uix.screenmanager import Screen
@ -16,10 +18,10 @@ from kivymd.uix.list import TwoLineAvatarIconListItem
import state
from bitmessagekivy.baseclass.common import (
showLimitedCnt, initailize_detail_page, ThemeClsColor,
avatarImageFirstLetter, AddTimeWidget, AvatarSampleWidget,
toast
showLimitedCnt, ThemeClsColor, avatarImageFirstLetter,
AddTimeWidget, AvatarSampleWidget, toast
)
from bitmessagekivy.baseclass.maildetail import MailDetail
class Sent(Screen):
@ -201,10 +203,9 @@ class Sent(Screen):
src_mng_obj = self.manager
else:
src_mng_obj = self.parent.parent
# src_mng_obj.screens[13].clear_widgets()
# src_mng_obj.screens[13].add_widget(MailDetail())
# src_mng_obj.current = 'mailDetail'
initailize_detail_page(src_mng_obj)
src_mng_obj.screens[11].clear_widgets()
src_mng_obj.screens[11].add_widget(MailDetail())
src_mng_obj.current = 'mailDetail'
def delete(self, data_index, instance, *args):
"""Delete sent mail from sent mail listing"""
@ -236,12 +237,12 @@ class Sent(Screen):
def update_trash(self):
"""Update trash screen mails which is deleted from inbox"""
try:
self.parent.screens[4].clear_widgets()
self.parent.screens[4].add_widget(Trash())
self.parent.screens[16].clear_widgets()
self.parent.screens[16].add_widget(Allmails())
self.parent.screens[3].clear_widgets()
self.parent.screens[3].add_widget(Factory.Trash())
self.parent.screens[14].clear_widgets()
self.parent.screens[14].add_widget(Factory.Allmails())
except Exception:
self.parent.parent.screens[4].clear_widgets()
self.parent.parent.screens[4].add_widget(Trash())
self.parent.parent.screens[16].clear_widgets()
self.parent.parent.screens[16].add_widget(Allmails())
self.parent.parent.screens[3].clear_widgets()
self.parent.parent.screens[3].add_widget(Factory.Trash())
self.parent.parent.screens[14].clear_widgets()
self.parent.parent.screens[14].add_widget(Factory.Allmails())

View File

@ -19,7 +19,7 @@ from kivy.uix.screenmanager import Screen
import state
from bitmessagekivy.baseclass.common import (
showLimitedCnt, initailize_detail_page, avatarImageFirstLetter,
showLimitedCnt, avatarImageFirstLetter,
AddTimeWidget, ThemeClsColor, AvatarSampleWidget
)

View File

@ -24,3 +24,10 @@
MDList:
id: ml
Loader:
<ToggleBtn>:
size_hint: None, None
size: dp(36), dp(48)
pos_hint: {'center_x': .95, 'center_y': .4}
on_active: app.root.ids.sc10.toggleAction(self)

View File

@ -267,8 +267,8 @@ MDNavigationLayout:
id:sc12
NetworkStat:
id:sc13
# MailDetail:
# id:sc14
MailDetail:
id:sc14
ShowQRCode:
id:sc15
Draft:

View File

@ -564,7 +564,6 @@ class NavigateApp(MDApp):
def clear_composer(self):
"""If slow down, the new composer edit screen"""
self.set_navbar_for_composer()
# import pdb;pdb.set_trace()
composer_obj = self.root.ids.sc3.children[1].ids
composer_obj.ti.text = ''
composer_obj.btn.text = 'Select'
@ -811,7 +810,6 @@ class NavigateApp(MDApp):
try:
self.root.ids.sc17.children[1].active = True
except Exception:
# import pdb;pdb.set_trace()
self.root.ids.sc17.children[0].children[1].active = True
Clock.schedule_once(partial(self.load_screen_callback, instance), 1)

View File

@ -50,7 +50,6 @@
"Import": "from bitmessagekivy.baseclass.myaddress import MyAddress",
},
"MailDetail": {
"_comment1": "this is my comment",
"kv_string": "maildetail",
"name_screen": "mailDetail",
"Import": "from bitmessagekivy.baseclass.maildetail import MailDetail",