Merge pull request #38 from navjotcis/newwork
worked on alter search approch or making app preformance faster
This commit is contained in:
commit
19d6588db6
|
@ -82,52 +82,52 @@
|
|||
text: "Inbox"
|
||||
on_release: app.root.ids.scr_mngr.current = 'inbox'
|
||||
badge_text: "0"
|
||||
on_press: app.check_search_screen(self)
|
||||
on_press: app.refreshScreen(self)
|
||||
NavigationDrawerIconButton:
|
||||
id: send_cnt
|
||||
icon: 'send'
|
||||
text: "Sent"
|
||||
on_release: app.root.ids.scr_mngr.current = 'sent'
|
||||
badge_text: "0"
|
||||
on_press: app.check_search_screen(self)
|
||||
on_press: app.refreshScreen(self)
|
||||
NavigationDrawerIconButton:
|
||||
id: draft_cnt
|
||||
icon: 'message-draw'
|
||||
text: "Draft"
|
||||
on_release: app.root.ids.scr_mngr.current = 'draft'
|
||||
badge_text: "0"
|
||||
on_press: app.check_search_screen(self)
|
||||
on_press: app.refreshScreen(self)
|
||||
NavigationDrawerIconButton:
|
||||
text: "Starred"
|
||||
icon:'star'
|
||||
on_release: app.root.ids.scr_mngr.current = 'starred'
|
||||
on_press: app.check_search_screen(self)
|
||||
on_press: app.refreshScreen(self)
|
||||
NavigationDrawerIconButton:
|
||||
icon: 'archive'
|
||||
text: "Archieve"
|
||||
on_release: app.root.ids.scr_mngr.current = 'archieve'
|
||||
badge_text: "0"
|
||||
on_press: app.check_search_screen(self)
|
||||
on_press: app.refreshScreen(self)
|
||||
NavigationDrawerIconButton:
|
||||
icon: 'email-open-outline'
|
||||
text: "Spam"
|
||||
on_release: app.root.ids.scr_mngr.current = 'spam'
|
||||
badge_text: "0"
|
||||
on_press: app.check_search_screen(self)
|
||||
on_press: app.refreshScreen(self)
|
||||
NavigationDrawerIconButton:
|
||||
id: trash_cnt
|
||||
icon: 'delete'
|
||||
text: "Trash"
|
||||
on_release: app.root.ids.scr_mngr.current = 'trash'
|
||||
badge_text: "0"
|
||||
on_press: app.check_search_screen(self)
|
||||
on_press: app.refreshScreen(self)
|
||||
NavigationDrawerIconButton:
|
||||
id: allmail_cnt
|
||||
text: "All Mails"
|
||||
icon:'contact-mail'
|
||||
on_release: app.root.ids.scr_mngr.current = 'allmails'
|
||||
badge_text: "0"
|
||||
on_press: app.check_search_screen(self)
|
||||
on_press: app.refreshScreen(self)
|
||||
NavigationDrawerDivider:
|
||||
NavigationDrawerSubheader:
|
||||
text: "All labels"
|
||||
|
@ -135,37 +135,37 @@
|
|||
text: "Address Book"
|
||||
icon:'book-multiple'
|
||||
on_release: app.root.ids.scr_mngr.current = 'addressbook'
|
||||
on_press: app.check_search_screen(self)
|
||||
on_press: app.refreshScreen(self)
|
||||
NavigationDrawerIconButton:
|
||||
text: "Settings"
|
||||
icon:'settings'
|
||||
on_release: app.root.ids.scr_mngr.current = 'set'
|
||||
on_press: app.check_search_screen(self)
|
||||
on_press: app.refreshScreen(self)
|
||||
NavigationDrawerIconButton:
|
||||
text: "Subscriptions/Payment"
|
||||
icon:'wallet'
|
||||
on_release: app.root.ids.scr_mngr.current = 'payment'
|
||||
on_press: app.check_search_screen(self)
|
||||
on_press: app.refreshScreen(self)
|
||||
NavigationDrawerIconButton:
|
||||
text: "Credits"
|
||||
icon:'wallet'
|
||||
on_release: app.root.ids.scr_mngr.current = 'credits'
|
||||
on_press: app.check_search_screen(self)
|
||||
on_press: app.refreshScreen(self)
|
||||
NavigationDrawerIconButton:
|
||||
text: "new address"
|
||||
icon:'account-plus'
|
||||
on_release: app.root.ids.scr_mngr.current = 'login'
|
||||
on_press: app.check_search_screen(self)
|
||||
on_press: app.refreshScreen(self)
|
||||
NavigationDrawerIconButton:
|
||||
text: "Network Status"
|
||||
icon:'server-network'
|
||||
on_release: app.root.ids.scr_mngr.current = 'networkstat'
|
||||
on_press: app.check_search_screen(self)
|
||||
on_press: app.refreshScreen(self)
|
||||
NavigationDrawerIconButton:
|
||||
text: "My Addresses"
|
||||
icon:'account-multiple'
|
||||
on_release: app.root.ids.scr_mngr.current = 'myaddress'
|
||||
on_press: app.check_search_screen(self)
|
||||
on_press: app.refreshScreen(self)
|
||||
|
||||
NavigationLayout:
|
||||
id: nav_layout
|
||||
|
@ -186,18 +186,6 @@ NavigationLayout:
|
|||
background_hue: '500'
|
||||
left_action_items: [['menu', lambda x: app.root.toggle_nav_drawer()]]
|
||||
right_action_items: [['account-plus', lambda x: app.addingtoaddressbook()]]
|
||||
BoxLayout:
|
||||
id: search_bar
|
||||
size_hint_y: None
|
||||
height: self.minimum_height
|
||||
|
||||
MDIconButton:
|
||||
icon: 'magnify'
|
||||
|
||||
MDTextField:
|
||||
id: search_field
|
||||
hint_text: 'Search'
|
||||
on_text: app.searchQuery(self)
|
||||
|
||||
ScreenManager:
|
||||
id: scr_mngr
|
||||
|
@ -246,21 +234,30 @@ NavigationLayout:
|
|||
|
||||
<Inbox>:
|
||||
name: 'inbox'
|
||||
FloatLayout:
|
||||
MDScrollViewRefreshLayout:
|
||||
id: refresh_layout
|
||||
refresh_callback: root.refresh_callback
|
||||
root_layout: root
|
||||
MDList:
|
||||
id: ml
|
||||
BoxLayout:
|
||||
orientation: 'vertical'
|
||||
spacing: dp(10)
|
||||
SearchBar:
|
||||
FloatLayout:
|
||||
MDScrollViewRefreshLayout:
|
||||
id: refresh_layout
|
||||
refresh_callback: root.refresh_callback
|
||||
root_layout: root
|
||||
MDList:
|
||||
id: ml
|
||||
ComposerButton:
|
||||
|
||||
<Sent>:
|
||||
name: 'sent'
|
||||
ScrollView:
|
||||
do_scroll_x: False
|
||||
MDList:
|
||||
id: ml
|
||||
BoxLayout:
|
||||
orientation: 'vertical'
|
||||
SearchBar:
|
||||
BoxLayout:
|
||||
orientation:'vertical'
|
||||
ScrollView:
|
||||
do_scroll_x: False
|
||||
MDList:
|
||||
id: ml
|
||||
ComposerButton:
|
||||
|
||||
<Trash>:
|
||||
|
@ -654,23 +651,29 @@ NavigationLayout:
|
|||
|
||||
<MyAddress>:
|
||||
name: 'myaddress'
|
||||
FloatLayout:
|
||||
MDScrollViewRefreshLayout:
|
||||
id: refresh_layout
|
||||
refresh_callback: root.refresh_callback
|
||||
root_layout: root
|
||||
MDList:
|
||||
id: ml
|
||||
BoxLayout:
|
||||
orientation: 'vertical'
|
||||
SearchBar:
|
||||
FloatLayout:
|
||||
MDScrollViewRefreshLayout:
|
||||
id: refresh_layout
|
||||
refresh_callback: root.refresh_callback
|
||||
root_layout: root
|
||||
MDList:
|
||||
id: ml
|
||||
ComposerButton:
|
||||
|
||||
<AddressBook>:
|
||||
name: 'addressbook'
|
||||
BoxLayout:
|
||||
orientation:'vertical'
|
||||
ScrollView:
|
||||
do_scroll_x: False
|
||||
MDList:
|
||||
id: ml
|
||||
orientation: 'vertical'
|
||||
SearchBar:
|
||||
BoxLayout:
|
||||
orientation:'vertical'
|
||||
ScrollView:
|
||||
do_scroll_x: False
|
||||
MDList:
|
||||
id: ml
|
||||
ComposerButton:
|
||||
|
||||
<Payment>:
|
||||
|
@ -1222,4 +1225,18 @@ NavigationLayout:
|
|||
source: './images/down-arrow.png' if self.parent.is_open == True else './images/right-arrow.png'
|
||||
size: 15, 15
|
||||
x: self.parent.x + self.parent.width - self.width - 5
|
||||
y: self.parent.y + self.parent.height/2 - self.height + 5
|
||||
y: self.parent.y + self.parent.height/2 - self.height + 5
|
||||
|
||||
|
||||
<SearchBar@BoxLayout>:
|
||||
id: search_bar
|
||||
size_hint_y: None
|
||||
height: self.minimum_height
|
||||
|
||||
MDIconButton:
|
||||
icon: 'magnify'
|
||||
|
||||
MDTextField:
|
||||
id: search_field
|
||||
hint_text: 'Search'
|
||||
on_text: app.searchQuery(self)
|
||||
|
|
|
@ -79,8 +79,6 @@ class Navigatorss(MDNavigationDrawer):
|
|||
class Inbox(Screen):
|
||||
"""Inbox Screen uses screen to show widgets of screens."""
|
||||
|
||||
data = ListProperty()
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""Method Parsing the address."""
|
||||
super(Inbox, self).__init__(*args, **kwargs)
|
||||
|
@ -168,7 +166,6 @@ class Inbox(Screen):
|
|||
|
||||
def inbox_detail(self, receivedTime, *args):
|
||||
"""Load inbox page details."""
|
||||
remove_search_bar(self)
|
||||
state.detailPageType = 'inbox'
|
||||
state.sentMailTime = receivedTime
|
||||
if self.manager:
|
||||
|
@ -184,8 +181,12 @@ class Inbox(Screen):
|
|||
sqlExecute(
|
||||
"UPDATE inbox SET folder = 'trash' WHERE received = {};".format(
|
||||
data_index))
|
||||
msg_count_objs = \
|
||||
self.parent.parent.parent.parent.parent.children[2].children[0].ids
|
||||
try:
|
||||
msg_count_objs = \
|
||||
self.parent.parent.parent.parent.children[2].children[0].ids
|
||||
except Exception as e:
|
||||
msg_count_objs = \
|
||||
self.parent.parent.parent.parent.parent.children[2].children[0].ids
|
||||
if int(state.inbox_count) > 0:
|
||||
msg_count_objs.inbox_cnt.badge_text = str(
|
||||
int(state.inbox_count) - 1)
|
||||
|
@ -226,13 +227,10 @@ class Inbox(Screen):
|
|||
"""Method updates the state of application, While the spinner remains on the screen."""
|
||||
def refresh_callback(interval):
|
||||
"""Method used for loading the inbox screen data."""
|
||||
state.searcing_text = ''
|
||||
self.children[2].children[1].ids.search_field.text = ''
|
||||
self.ids.ml.clear_widgets()
|
||||
self.remove_widget(self.children[1])
|
||||
try:
|
||||
screens_obj = self.parent.screens[0]
|
||||
except Exception:
|
||||
screens_obj = self.parent.parent.screens[0]
|
||||
screens_obj.add_widget(Inbox())
|
||||
self.loadMessagelist(state.association)
|
||||
self.ids.refresh_layout.refresh_done()
|
||||
self.tick = 0
|
||||
|
||||
|
@ -284,12 +282,11 @@ class MyAddress(Screen):
|
|||
size_hint_y=None,
|
||||
valign='top')
|
||||
self.ids.ml.add_widget(content)
|
||||
try:
|
||||
self.manager.parent.parent\
|
||||
.parent.ids.search_bar.clear_widgets()
|
||||
self.manager.current = 'login'
|
||||
except Exception:
|
||||
pass
|
||||
if not state.searcing_text:
|
||||
try:
|
||||
self.manager.current = 'login'
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def myadd_detail(fromaddress, label, *args):
|
||||
|
@ -303,13 +300,10 @@ class MyAddress(Screen):
|
|||
"""Method updates the state of application, While the spinner remains on the screen."""
|
||||
def refresh_callback(interval):
|
||||
"""Method used for loading the myaddress screen data."""
|
||||
state.searcing_text = ''
|
||||
self.children[2].children[1].ids.search_field.text = ''
|
||||
self.ids.ml.clear_widgets()
|
||||
self.remove_widget(self.children[1])
|
||||
try:
|
||||
screens_obj = self.parent.screens[9]
|
||||
except Exception:
|
||||
screens_obj = self.parent.parent.screens[9]
|
||||
screens_obj.add_widget(MyAddress())
|
||||
self.init_ui()
|
||||
self.ids.refresh_layout.refresh_done()
|
||||
self.tick = 0
|
||||
Clock.schedule_once(refresh_callback, 1)
|
||||
|
@ -386,8 +380,8 @@ class AddressBook(Screen):
|
|||
@staticmethod
|
||||
def refreshs(*args):
|
||||
"""Refresh the Widget."""
|
||||
state.navinstance.ids.sc11.clear_widgets()
|
||||
state.navinstance.ids.sc11.add_widget(AddressBook())
|
||||
state.navinstance.ids.sc11.ids.ml.clear_widgets()
|
||||
state.navinstance.ids.sc11.loadAddresslist(None, 'All', '')
|
||||
|
||||
@staticmethod
|
||||
def addBook_detail(address, label, *args):
|
||||
|
@ -523,8 +517,8 @@ class DropDownWidget(BoxLayout):
|
|||
state.check_sent_acc = fromAddress
|
||||
state.msg_counter_objs = self.parent.parent.parent.parent\
|
||||
.parent.parent.children[0].children[2].children[0].ids
|
||||
self.parent.parent.screens[3].clear_widgets()
|
||||
self.parent.parent.screens[3].add_widget(Sent())
|
||||
self.parent.parent.screens[3].ids.ml.clear_widgets()
|
||||
self.parent.parent.screens[3].loadSent(state.association)
|
||||
self.parent.parent.screens[16].clear_widgets()
|
||||
self.parent.parent.screens[16].add_widget(Allmails())
|
||||
toLabel = ''
|
||||
|
@ -701,9 +695,8 @@ class Random(Screen):
|
|||
self.ids.label.text = ''
|
||||
self.parent.parent.parent.parent.ids.toolbar.opacity = 1
|
||||
self.parent.parent.parent.parent.ids.toolbar.disabled = False
|
||||
self.parent.parent.parent.parent.ids.sc10.clear_widgets()
|
||||
self.parent.parent.parent.parent.ids.sc10.add_widget(MyAddress())
|
||||
navApp.add_search_bar()
|
||||
self.parent.parent.parent.parent.ids.sc10.ids.ml.clear_widgets()
|
||||
self.parent.parent.parent.parent.ids.sc10.init_ui()
|
||||
toast('New address created')
|
||||
|
||||
|
||||
|
@ -715,9 +708,6 @@ class AddressSuccessful(Screen):
|
|||
|
||||
class Sent(Screen):
|
||||
"""Sent Screen uses screen to show widgets of screens."""
|
||||
|
||||
data = ListProperty()
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""Association with the screen."""
|
||||
super(Sent, self).__init__(*args, **kwargs)
|
||||
|
@ -742,6 +732,7 @@ class Sent(Screen):
|
|||
where = ['subject', 'message']
|
||||
what = state.searcing_text
|
||||
xAddress = 'fromaddress'
|
||||
data = []
|
||||
queryreturn = kivy_helper_search.search_sql(
|
||||
xAddress, account, "sent", where, what, False)
|
||||
if state.msg_counter_objs and state.association == \
|
||||
|
@ -757,13 +748,13 @@ class Sent(Screen):
|
|||
src_mng_obj.send_cnt.badge_text = str(len(queryreturn))
|
||||
state.sent_count = str(len(queryreturn))
|
||||
for mail in queryreturn:
|
||||
self.data.append({
|
||||
data.append({
|
||||
'text': mail[1].strip(),
|
||||
'secondary_text': mail[2][:50] + '........' if len(
|
||||
mail[2]) >= 50 else (
|
||||
mail[2] + ',' + mail[3].replace('\n', ''))[0:50] + '........',
|
||||
'lastactiontime': mail[6]})
|
||||
for item in self.data:
|
||||
for item in data:
|
||||
meny = TwoLineAvatarIconListItem(
|
||||
text=item['text'],
|
||||
secondary_text=item['secondary_text'],
|
||||
|
@ -808,7 +799,6 @@ class Sent(Screen):
|
|||
|
||||
def sent_detail(self, lastsenttime, *args):
|
||||
"""Load sent mail details."""
|
||||
remove_search_bar(self)
|
||||
state.detailPageType = 'sent'
|
||||
state.sentMailTime = lastsenttime
|
||||
if self.manager:
|
||||
|
@ -1031,8 +1021,9 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
|
|||
BMConfigParser().get(text, 'label'), text)
|
||||
self.root_window.children[1].ids.toolbar.title = address_label
|
||||
state.association = text
|
||||
self.root.ids.sc1.clear_widgets()
|
||||
self.root.ids.sc1.add_widget(Inbox())
|
||||
state.searcing_text = ''
|
||||
self.root.ids.sc1.ids.ml.clear_widgets()
|
||||
self.root.ids.sc1.loadMessagelist(state.association)
|
||||
self.root.ids.scr_mngr.current = 'inbox'
|
||||
|
||||
msg_counter_objs = \
|
||||
|
@ -1135,7 +1126,6 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
|
|||
self.root.ids.scr_mngr.current = 'login'
|
||||
else:
|
||||
self.root.ids.scr_mngr.current = 'inbox'
|
||||
self.add_search_bar()
|
||||
self.root.ids.scr_mngr.transition.direction = 'right'
|
||||
self.root.ids.scr_mngr.transition.bind(on_complete=self.reset)
|
||||
return True
|
||||
|
@ -1155,7 +1145,7 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
|
|||
def clear_composer(self):
|
||||
"""If slow down the nwe will make new composer edit screen."""
|
||||
self.set_navbar_for_composer()
|
||||
self.root.ids.search_bar.clear_widgets()
|
||||
# self.root.ids.search_bar.clear_widgets()
|
||||
composer_obj = self.root.ids.sc3.children[0].ids
|
||||
composer_obj.ti.text = ''
|
||||
composer_obj.btn.text = 'Select'
|
||||
|
@ -1183,8 +1173,6 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
|
|||
self.root.ids.scr_mngr.transition.bind(on_complete=self.reset)
|
||||
if state.is_allmail or state.detailPageType == 'draft':
|
||||
state.is_allmail = False
|
||||
else:
|
||||
self.add_search_bar()
|
||||
state.detailPageType = ''
|
||||
state.in_composer = False
|
||||
|
||||
|
@ -1211,66 +1199,60 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
|
|||
return label + address
|
||||
return ''
|
||||
|
||||
def searchQuery(self, instance, *args):
|
||||
def searchQuery(self, instance):
|
||||
"""Method used for showing searched mails."""
|
||||
state.search_screen = self.root.ids.scr_mngr.current
|
||||
state.searcing_text = str(instance.text).strip()
|
||||
if state.search_screen == 'inbox':
|
||||
self.root.ids.sc1.clear_widgets()
|
||||
self.root.ids.sc1.add_widget(Inbox())
|
||||
self.root.ids.sc1.ids.ml.clear_widgets()
|
||||
self.root.ids.sc1.loadMessagelist(state.association)
|
||||
elif state.search_screen == 'addressbook':
|
||||
self.root.ids.sc11.clear_widgets()
|
||||
self.root.ids.sc11.add_widget(AddressBook())
|
||||
self.root.ids.sc11.ids.ml.clear_widgets()
|
||||
self.root.ids.sc11.loadAddresslist(None, 'All', '')
|
||||
elif state.search_screen == 'myaddress':
|
||||
self.root.ids.sc10.clear_widgets()
|
||||
self.root.ids.sc10.add_widget(MyAddress())
|
||||
self.root.ids.sc10.ids.ml.clear_widgets()
|
||||
self.root.ids.sc10.init_ui()
|
||||
else:
|
||||
self.root.ids.sc4.clear_widgets()
|
||||
self.root.ids.sc4.add_widget(Sent())
|
||||
self.root.ids.sc4.ids.ml.clear_widgets()
|
||||
self.root.ids.sc4.loadSent(state.association)
|
||||
self.root.ids.scr_mngr.current = state.search_screen
|
||||
|
||||
def clearSreeen(self, text):
|
||||
"""Method is used for clear screen"""
|
||||
if text == 'Sent':
|
||||
self.root.ids.sc4.clear_widgets()
|
||||
self.root.ids.sc4.add_widget(Sent())
|
||||
elif text == 'Draft':
|
||||
def refreshScreen(self, instance):
|
||||
"""Method show search button only on inbox or sent screen."""
|
||||
state.searcing_text = ''
|
||||
if instance.text == 'Sent':
|
||||
self.root.ids.sc4.ids.ml.clear_widgets()
|
||||
self.root.ids.sc4.children[1].children[1].ids.search_field.text = ''
|
||||
self.root.ids.sc4.loadSent(state.association)
|
||||
elif instance.text == 'Inbox':
|
||||
self.root.ids.sc1.ids.ml.clear_widgets()
|
||||
try:
|
||||
self.root.ids.sc1.children[2].children[1].ids.search_field.text = ''
|
||||
except Exception as e:
|
||||
self.root.ids.sc1.children[1].children[1].ids.search_field.text = ''
|
||||
self.root.ids.sc1.loadMessagelist(state.association)
|
||||
elif instance.text == 'Draft':
|
||||
self.root.ids.sc16.clear_widgets()
|
||||
self.root.ids.sc16.add_widget(Draft())
|
||||
elif text == 'Trash':
|
||||
elif instance.text == 'Trash':
|
||||
self.root.ids.sc5.clear_widgets()
|
||||
self.root.ids.sc5.add_widget(Trash())
|
||||
elif text == 'All Mails':
|
||||
elif instance.text == 'All Mails':
|
||||
self.root.ids.sc17.clear_widgets()
|
||||
self.root.ids.sc17.add_widget(Allmails())
|
||||
|
||||
def check_search_screen(self, instance):
|
||||
"""Method show search button only on inbox or sent screen."""
|
||||
if instance.text in ['Sent', 'Draft', 'Trash', 'All Mails']:
|
||||
self.clearSreeen(instance.text)
|
||||
if instance.text in ['Inbox', 'Sent', 'Address Book', 'My Addresses']:
|
||||
if not self.root.ids.search_bar.children:
|
||||
self.root.ids.search_bar.add_widget(
|
||||
MDIconButton(icon='magnify'))
|
||||
text_field = MDTextField(
|
||||
id='search_field', hint_text='Search')
|
||||
text_field.bind(text=self.searchQuery)
|
||||
self.root.ids.search_bar.add_widget(text_field)
|
||||
self.root.ids.search_bar.children[0].text = ''
|
||||
else:
|
||||
self.root.ids.search_bar.clear_widgets()
|
||||
state.searcing_text = ''
|
||||
elif instance.text == 'Address Book':
|
||||
self.root.ids.sc11.ids.ml.clear_widgets()
|
||||
self.root.ids.sc11.children[1].children[1].ids.search_field.text = ''
|
||||
self.root.ids.sc11.loadAddresslist(None, 'All', '')
|
||||
elif instance.text == 'My Addresses':
|
||||
self.root.ids.sc10.ids.ml.clear_widgets()
|
||||
try:
|
||||
self.root.ids.sc10.children[1].children[1].ids.search_field.text = ''
|
||||
except Exception as e:
|
||||
self.root.ids.sc10.children[2].children[1].ids.search_field.text = ''
|
||||
self.root.ids.sc10.init_ui()
|
||||
return
|
||||
|
||||
def add_search_bar(self):
|
||||
"""Method used for adding search function on screen"""
|
||||
if not self.root.ids.search_bar.children:
|
||||
self.root.ids.search_bar.add_widget(MDIconButton(icon='magnify'))
|
||||
text_field = MDTextField(
|
||||
id='search_field', hint_text='Search')
|
||||
text_field.bind(text=self.searchQuery)
|
||||
self.root.ids.search_bar.add_widget(text_field)
|
||||
|
||||
def set_identicon(self, text):
|
||||
"""This method is use for showing identicon in address spinner"""
|
||||
img = identiconGeneration.generate(text)
|
||||
|
@ -1477,8 +1459,8 @@ class MailDetail(Screen):
|
|||
lastactiontime = {};".format(state.sentMailTime))
|
||||
msg_count_objs.send_cnt.badge_text = str(int(state.sent_count) - 1)
|
||||
state.sent_count = str(int(state.sent_count) - 1)
|
||||
self.parent.screens[3].clear_widgets()
|
||||
self.parent.screens[3].add_widget(Sent())
|
||||
self.parent.screens[3].ids.ml.clear_widgets()
|
||||
self.parent.screens[3].loadSent(state.association)
|
||||
elif state.detailPageType == 'inbox':
|
||||
sqlExecute(
|
||||
"UPDATE inbox SET folder = 'trash' WHERE \
|
||||
|
@ -1486,8 +1468,8 @@ class MailDetail(Screen):
|
|||
# msg_count_objs.inbox_cnt.badge_text = 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].add_widget(Inbox())
|
||||
self.parent.screens[0].ids.ml.clear_widgets()
|
||||
self.parent.screens[0].loadMessagelist(state.association)
|
||||
elif state.detailPageType == 'draft':
|
||||
sqlExecute("DELETE FROM sent WHERE lastactiontime = '{}';".format(
|
||||
state.sentMailTime))
|
||||
|
@ -1519,6 +1501,7 @@ class MailDetail(Screen):
|
|||
composer_obj.btn.text = data[0][0]
|
||||
composer_obj.txt_input.text = data[0][1]
|
||||
composer_obj.subject.text = data[0][2]
|
||||
composer_obj.body.text = ''
|
||||
state.kivyapp.root.ids.sc3.children[0].ids.rv.data = ''
|
||||
self.parent.current = 'create'
|
||||
state.kivyapp.set_navbar_for_composer()
|
||||
|
@ -1603,8 +1586,8 @@ class AddbookDetailPopup(Popup):
|
|||
if str(self.ids.add_label.text):
|
||||
sqlExecute("UPDATE addressbook SET label = '{}' WHERE \
|
||||
address = '{}';".format(str(self.ids.add_label.text), address))
|
||||
self.parent.children[1].ids.sc11.clear_widgets()
|
||||
self.parent.children[1].ids.sc11.add_widget(AddressBook())
|
||||
self.parent.children[1].ids.sc11.ids.ml.clear_widgets()
|
||||
self.parent.children[1].ids.sc11.loadAddresslist(None, 'All', '')
|
||||
self.dismiss()
|
||||
toast('Saved')
|
||||
|
||||
|
@ -1630,7 +1613,7 @@ class ShowQRCode(Screen):
|
|||
|
||||
def qrdisplay(self):
|
||||
"""Method used for showing QR Code."""
|
||||
self.manager.parent.parent.parent.ids.search_bar.clear_widgets()
|
||||
# self.manager.parent.parent.parent.ids.search_bar.clear_widgets()
|
||||
self.ids.qr.clear_widgets()
|
||||
from kivy.garden.qrcode import QRCodeWidget
|
||||
self.ids.qr.add_widget(QRCodeWidget(
|
||||
|
@ -1659,9 +1642,9 @@ class Draft(Screen):
|
|||
def sentaccounts(self):
|
||||
"""Load draft accounts."""
|
||||
account = state.association
|
||||
self.loadSent(account, 'All', '')
|
||||
self.loadDraft(account, 'All', '')
|
||||
|
||||
def loadSent(self, account, where="", what=""):
|
||||
def loadDraft(self, account, where="", what=""):
|
||||
"""Load draft list for Draft messages."""
|
||||
xAddress = 'fromaddress'
|
||||
queryreturn = kivy_helper_search.search_sql(
|
||||
|
@ -1807,14 +1790,6 @@ class CustomSpinner(Spinner):
|
|||
self.dropdown_cls.max_height = Window.size[1] / 3
|
||||
|
||||
|
||||
def remove_search_bar(obj):
|
||||
"""Remove search bar."""
|
||||
try:
|
||||
obj.parent.parent.parent.parent.parent.ids.search_bar.clear_widgets()
|
||||
except Exception:
|
||||
obj.parent.parent.parent.parent.ids.search_bar.clear_widgets()
|
||||
|
||||
|
||||
class Allmails(Screen):
|
||||
"""all mails Screen uses screen to show widgets of screens."""
|
||||
|
||||
|
@ -1894,7 +1869,6 @@ class Allmails(Screen):
|
|||
|
||||
def mail_detail(self, unique_id, folder, *args):
|
||||
"""Load sent and inbox mail details."""
|
||||
remove_search_bar(self)
|
||||
state.detailPageType = folder
|
||||
state.is_allmail = True
|
||||
state.sentMailTime = unique_id
|
||||
|
@ -1929,14 +1903,14 @@ class Allmails(Screen):
|
|||
msg_count_objs.inbox_cnt.badge_text = str(
|
||||
int(state.inbox_count) - 1)
|
||||
state.inbox_count = str(int(state.inbox_count) - 1)
|
||||
nav_lay_obj.sc1.clear_widgets()
|
||||
nav_lay_obj.sc1.add_widget(Inbox())
|
||||
nav_lay_obj.sc1.ids.ml.clear_widgets()
|
||||
nav_lay_obj.sc1.loadMessagelist(state.association)
|
||||
else:
|
||||
msg_count_objs.send_cnt.badge_text = str(
|
||||
int(state.sent_count) - 1)
|
||||
state.sent_count = str(int(state.sent_count) - 1)
|
||||
nav_lay_obj.sc4.clear_widgets()
|
||||
nav_lay_obj.sc4.add_widget(Sent())
|
||||
nav_lay_obj.sc4.ids.ml.clear_widgets()
|
||||
nav_lay_obj.sc4.loadSent(state.association)
|
||||
msg_count_objs.trash_cnt.badge_text = str(
|
||||
int(state.trash_count) + 1)
|
||||
msg_count_objs.allmail_cnt.badge_text = str(
|
||||
|
|
Reference in New Issue
Block a user