worked on time text or address disable and enable feature
This commit is contained in:
parent
fef7dddb6c
commit
ca538668ab
|
@ -16,22 +16,18 @@ def search_sql(
|
||||||
if folder in ("sent", "draft"):
|
if folder in ("sent", "draft"):
|
||||||
sqlStatementBase = (
|
sqlStatementBase = (
|
||||||
'''SELECT toaddress, fromaddress, subject, message, status,'''
|
'''SELECT toaddress, fromaddress, subject, message, status,'''
|
||||||
''' ackdata, lastactiontime FROM sent '''
|
''' ackdata, senttime FROM sent '''
|
||||||
)
|
)
|
||||||
elif folder == "addressbook":
|
elif folder == "addressbook":
|
||||||
sqlStatementBase = '''SELECT label, address From addressbook '''
|
sqlStatementBase = '''SELECT label, address From addressbook '''
|
||||||
else:
|
else:
|
||||||
sqlStatementBase = (
|
sqlStatementBase = (
|
||||||
'''SELECT folder, toaddress, message, fromaddress,'''
|
'''SELECT folder, msgid, toaddress, message, fromaddress,'''
|
||||||
''' subject, received, read FROM inbox '''
|
''' subject, received, read FROM inbox '''
|
||||||
)
|
)
|
||||||
sqlStatementParts = []
|
sqlStatementParts = []
|
||||||
sqlArguments = []
|
sqlArguments = []
|
||||||
if account is not None:
|
if account is not None:
|
||||||
#xAddress = 'toaddress'
|
|
||||||
#where = ['subject', 'message']
|
|
||||||
#what = None
|
|
||||||
#unreadOnly = False
|
|
||||||
if xAddress == 'both':
|
if xAddress == 'both':
|
||||||
sqlStatementParts.append("(fromaddress = ? OR toaddress = ?)")
|
sqlStatementParts.append("(fromaddress = ? OR toaddress = ?)")
|
||||||
sqlArguments.append(account)
|
sqlArguments.append(account)
|
||||||
|
@ -67,7 +63,7 @@ def search_sql(
|
||||||
# if folder in ("sent", "draft"):
|
# if folder in ("sent", "draft"):
|
||||||
if folder in ("sent", "draft"):
|
if folder in ("sent", "draft"):
|
||||||
sqlStatementBase += \
|
sqlStatementBase += \
|
||||||
"ORDER BY lastactiontime DESC limit {0}, {1}".format(
|
"ORDER BY senttime DESC limit {0}, {1}".format(
|
||||||
start_indx, end_indx)
|
start_indx, end_indx)
|
||||||
elif folder == "inbox":
|
elif folder == "inbox":
|
||||||
sqlStatementBase += \
|
sqlStatementBase += \
|
||||||
|
|
|
@ -27,8 +27,10 @@
|
||||||
values: app.variable_1
|
values: app.variable_1
|
||||||
on_text: root.auto_fill_fromaddr() if self.text != 'Select' else ''
|
on_text: root.auto_fill_fromaddr() if self.text != 'Select' else ''
|
||||||
option_cls: Factory.get("MySpinnerOption")
|
option_cls: Factory.get("MySpinnerOption")
|
||||||
background_color: color_button if self.state == 'normal' else color_button_pressed
|
#background_color: color_button if self.state == 'normal' else color_button_pressed
|
||||||
background_down: 'atlas://data/images/defaulttheme/spinner'
|
#background_down: 'atlas://data/images/defaulttheme/spinner'
|
||||||
|
background_normal: ''
|
||||||
|
background_color: app.theme_cls.primary_color
|
||||||
color: color_font
|
color: color_font
|
||||||
font_size: '12.5sp'
|
font_size: '12.5sp'
|
||||||
ArrowImg:
|
ArrowImg:
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
Rectangle:
|
Rectangle:
|
||||||
pos: self.pos
|
pos: self.pos
|
||||||
size: self.size
|
size: self.size
|
||||||
size: dp(app.window_size[0]) - 2*dp(app.window_size[0]/16 if app.window_size[0] <= 720 else app.window_size[0]/4*1.1) - 10 , 1
|
size: dp(app.window_size[0] - 2*self.parent.parent.padding[0]) - 10 , 1
|
||||||
height: dp(40)
|
height: dp(40)
|
||||||
on_press: root.get_available_credits(self)
|
on_press: root.get_available_credits(self)
|
||||||
MDLabel:
|
MDLabel:
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
Rectangle:
|
Rectangle:
|
||||||
pos: self.pos
|
pos: self.pos
|
||||||
size: self.size
|
size: self.size
|
||||||
size: dp(app.window_size[0]) - 2*dp(app.window_size[0]/16 if app.window_size[0] <= 720 else app.window_size[0]/4*1.1) - 10 , 1
|
size: dp(app.window_size[0] - 2*self.parent.parent.padding[0]) - 10 , 1
|
||||||
height: dp(40)
|
height: dp(40)
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'H6'
|
font_style: 'H6'
|
||||||
|
@ -134,7 +134,7 @@
|
||||||
Rectangle:
|
Rectangle:
|
||||||
pos: self.pos
|
pos: self.pos
|
||||||
size: self.size
|
size: self.size
|
||||||
size: dp(app.window_size[0]) - 2*dp(app.window_size[0]/16 if app.window_size[0] <= 720 else app.window_size[0]/4*1.1) - 10 , 1
|
size: dp(app.window_size[0] - 2*self.parent.parent.padding[0]) - 10 , 1
|
||||||
height: dp(40)
|
height: dp(40)
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'H6'
|
font_style: 'H6'
|
||||||
|
|
|
@ -275,7 +275,7 @@
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: "Bitmessage isn't connected to the network.\n If you quit now, it may cause delivery delays.\n Wait until connected and the synchronisation finishes?"
|
text: "Bitmessage isn't connected to the network.\n If you quit now, it may cause delivery delays.\n Wait until connected and the synchronisation finishes?"
|
||||||
font_size: '17sp'
|
font_size: '17sp'
|
||||||
halign: 'left'
|
halign: 'center'
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
id: my_add_btn
|
id: my_add_btn
|
||||||
spacing:5
|
spacing:5
|
||||||
|
|
|
@ -24,8 +24,10 @@
|
||||||
|
|
||||||
<MySpinnerOption@SpinnerOption>:
|
<MySpinnerOption@SpinnerOption>:
|
||||||
font_size: '12.5sp'
|
font_size: '12.5sp'
|
||||||
background_color: color_button if self.state == 'down' else color_button_pressed
|
#background_color: color_button if self.state == 'down' else color_button_pressed
|
||||||
background_down: 'atlas://data/images/defaulttheme/button'
|
#background_down: 'atlas://data/images/defaulttheme/button'
|
||||||
|
background_normal: ''
|
||||||
|
background_color: app.theme_cls.primary_color
|
||||||
color: color_font
|
color: color_font
|
||||||
|
|
||||||
<NavigationItem>
|
<NavigationItem>
|
||||||
|
@ -81,16 +83,21 @@
|
||||||
NavigationDrawerDivider:
|
NavigationDrawerDivider:
|
||||||
NavigationDrawerSubheader:
|
NavigationDrawerSubheader:
|
||||||
text: "Accounts"
|
text: "Accounts"
|
||||||
|
height:"35dp"
|
||||||
NavigationItem:
|
NavigationItem:
|
||||||
|
size: 50,50
|
||||||
CustomSpinner:
|
CustomSpinner:
|
||||||
id: btn
|
id: btn
|
||||||
pos_hint:{"x":0,"y":0}
|
pos_hint:{"x":0,"y":0}
|
||||||
option_cls: Factory.get("MySpinnerOption")
|
option_cls: Factory.get("MySpinnerOption")
|
||||||
font_size: '10.9sp'
|
font_size: '10.9sp'
|
||||||
text: app.getDefaultAccData()
|
text: app.getDefaultAccData()
|
||||||
background_color: color_button if self.state == 'normal' else color_button_pressed
|
#background_color: color_button if self.state == 'normal' else color_button_pressed
|
||||||
background_down: 'atlas://data/images/defaulttheme/spinner'
|
#background_down: 'atlas://data/images/defaulttheme/spinner'
|
||||||
color: color_font
|
color: color_font
|
||||||
|
background_normal: ''
|
||||||
|
background_color: app.theme_cls.primary_color
|
||||||
|
#background_color: (0.62,0.67,0.72,1)
|
||||||
values: app.variable_1
|
values: app.variable_1
|
||||||
on_text:app.getCurrentAccountData(self.text)
|
on_text:app.getCurrentAccountData(self.text)
|
||||||
Image:
|
Image:
|
||||||
|
@ -105,7 +112,7 @@
|
||||||
icon: 'email-open'
|
icon: 'email-open'
|
||||||
divider: None
|
divider: None
|
||||||
on_release: app.root.ids.scr_mngr.current = 'inbox'
|
on_release: app.root.ids.scr_mngr.current = 'inbox'
|
||||||
on_release: root.parent.toggle_nav_drawer()
|
on_release: root.parent.set_state()
|
||||||
on_press: app.load_screen(self)
|
on_press: app.load_screen(self)
|
||||||
NavigationItem:
|
NavigationItem:
|
||||||
id: send_cnt
|
id: send_cnt
|
||||||
|
@ -113,28 +120,28 @@
|
||||||
icon: 'send'
|
icon: 'send'
|
||||||
divider: None
|
divider: None
|
||||||
on_release: app.root.ids.scr_mngr.current = 'sent'
|
on_release: app.root.ids.scr_mngr.current = 'sent'
|
||||||
on_release: root.parent.toggle_nav_drawer()
|
on_release: root.parent.set_state()
|
||||||
NavigationItem:
|
NavigationItem:
|
||||||
id: draft_cnt
|
id: draft_cnt
|
||||||
text: 'Draft'
|
text: 'Draft'
|
||||||
icon: 'message-draw'
|
icon: 'message-draw'
|
||||||
divider: None
|
divider: None
|
||||||
on_release: app.root.ids.scr_mngr.current = 'draft'
|
on_release: app.root.ids.scr_mngr.current = 'draft'
|
||||||
on_release: root.parent.toggle_nav_drawer()
|
on_release: root.parent.set_state()
|
||||||
NavigationItem:
|
NavigationItem:
|
||||||
id: trash_cnt
|
id: trash_cnt
|
||||||
text: 'Trash'
|
text: 'Trash'
|
||||||
icon: 'delete'
|
icon: 'delete'
|
||||||
divider: None
|
divider: None
|
||||||
on_release: app.root.ids.scr_mngr.current = 'trash'
|
on_release: app.root.ids.scr_mngr.current = 'trash'
|
||||||
on_release: root.parent.toggle_nav_drawer()
|
on_release: root.parent.set_state()
|
||||||
NavigationItem:
|
NavigationItem:
|
||||||
id: allmail_cnt
|
id: allmail_cnt
|
||||||
text: 'All Mails'
|
text: 'All Mails'
|
||||||
icon: 'contact-mail'
|
icon: 'contact-mail'
|
||||||
divider: None
|
divider: None
|
||||||
on_release: app.root.ids.scr_mngr.current = 'allmails'
|
on_release: app.root.ids.scr_mngr.current = 'allmails'
|
||||||
on_release: root.parent.toggle_nav_drawer()
|
on_release: root.parent.set_state()
|
||||||
on_press: app.load_screen(self)
|
on_press: app.load_screen(self)
|
||||||
NavigationDrawerDivider:
|
NavigationDrawerDivider:
|
||||||
NavigationDrawerSubheader:
|
NavigationDrawerSubheader:
|
||||||
|
@ -144,43 +151,43 @@
|
||||||
icon: 'book-multiple'
|
icon: 'book-multiple'
|
||||||
divider: None
|
divider: None
|
||||||
on_release: app.root.ids.scr_mngr.current = 'addressbook'
|
on_release: app.root.ids.scr_mngr.current = 'addressbook'
|
||||||
on_release: root.parent.toggle_nav_drawer()
|
on_release: root.parent.set_state()
|
||||||
NavigationItem:
|
NavigationItem:
|
||||||
text: 'Settings'
|
text: 'Settings'
|
||||||
icon: 'settings'
|
icon: 'settings'
|
||||||
divider: None
|
divider: None
|
||||||
on_release: app.root.ids.scr_mngr.current = 'set'
|
on_release: app.root.ids.scr_mngr.current = 'set'
|
||||||
on_release: root.parent.toggle_nav_drawer()
|
on_release: root.parent.set_state()
|
||||||
NavigationItem:
|
NavigationItem:
|
||||||
text: 'Payment'
|
text: 'Payment'
|
||||||
icon: 'bell'
|
icon: 'bell'
|
||||||
divider: None
|
divider: None
|
||||||
on_release: app.root.ids.scr_mngr.current = 'payment'
|
on_release: app.root.ids.scr_mngr.current = 'payment'
|
||||||
on_release: root.parent.toggle_nav_drawer()
|
on_release: root.parent.set_state()
|
||||||
NavigationItem:
|
NavigationItem:
|
||||||
text: 'Credits'
|
text: 'Credits'
|
||||||
icon: 'wallet'
|
icon: 'wallet'
|
||||||
divider: None
|
divider: None
|
||||||
on_release: app.root.ids.scr_mngr.current = 'credits'
|
on_release: app.root.ids.scr_mngr.current = 'credits'
|
||||||
on_release: root.parent.toggle_nav_drawer()
|
on_release: root.parent.set_state()
|
||||||
NavigationItem:
|
NavigationItem:
|
||||||
text: 'New address'
|
text: 'New address'
|
||||||
icon: 'account-plus'
|
icon: 'account-plus'
|
||||||
divider: None
|
divider: None
|
||||||
on_release: app.root.ids.scr_mngr.current = 'login'
|
on_release: app.root.ids.scr_mngr.current = 'login'
|
||||||
on_release: root.parent.toggle_nav_drawer()
|
on_release: root.parent.set_state()
|
||||||
NavigationItem:
|
NavigationItem:
|
||||||
text: 'Network status'
|
text: 'Network status'
|
||||||
icon: 'server-network'
|
icon: 'server-network'
|
||||||
divider: None
|
divider: None
|
||||||
on_release: app.root.ids.scr_mngr.current = 'networkstat'
|
on_release: app.root.ids.scr_mngr.current = 'networkstat'
|
||||||
on_release: root.parent.toggle_nav_drawer()
|
on_release: root.parent.set_state()
|
||||||
NavigationItem:
|
NavigationItem:
|
||||||
text: 'My addresses'
|
text: 'My addresses'
|
||||||
icon: 'account-multiple'
|
icon: 'account-multiple'
|
||||||
divider: None
|
divider: None
|
||||||
on_release: app.root.ids.scr_mngr.current = 'myaddress'
|
on_release: app.root.ids.scr_mngr.current = 'myaddress'
|
||||||
on_release: root.parent.toggle_nav_drawer()
|
on_release: root.parent.set_state()
|
||||||
|
|
||||||
NavigationLayout:
|
NavigationLayout:
|
||||||
id: nav_layout
|
id: nav_layout
|
||||||
|
@ -193,7 +200,7 @@ NavigationLayout:
|
||||||
pos_hint: {"top": 1}
|
pos_hint: {"top": 1}
|
||||||
md_bg_color: app.theme_cls.primary_color
|
md_bg_color: app.theme_cls.primary_color
|
||||||
elevation: 10
|
elevation: 10
|
||||||
left_action_items: [['menu', lambda x: nav_drawer.toggle_nav_drawer()]]
|
left_action_items: [['menu', lambda x: nav_drawer.set_state("toggle")]]
|
||||||
right_action_items: [['account-plus', lambda x: app.addingtoaddressbook()]]
|
right_action_items: [['account-plus', lambda x: app.addingtoaddressbook()]]
|
||||||
|
|
||||||
ScreenManager:
|
ScreenManager:
|
||||||
|
|
|
@ -62,6 +62,8 @@ from semaphores import kivyuisignaler
|
||||||
|
|
||||||
import state
|
import state
|
||||||
from addresses import decodeAddress
|
from addresses import decodeAddress
|
||||||
|
from kivy.config import Config
|
||||||
|
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
|
||||||
# pylint: disable=too-few-public-methods,too-many-arguments,attribute-defined-outside-init
|
# pylint: disable=too-few-public-methods,too-many-arguments,attribute-defined-outside-init
|
||||||
|
|
||||||
KVFILES = [
|
KVFILES = [
|
||||||
|
@ -85,6 +87,30 @@ def showLimitedCnt(total_msg):
|
||||||
return "99+" if total_msg > 99 else str(total_msg)
|
return "99+" if total_msg > 99 else str(total_msg)
|
||||||
|
|
||||||
|
|
||||||
|
def ShowTimeHistoy(act_time):
|
||||||
|
"""This method is used to return the message sent or receive time"""
|
||||||
|
from datetime import datetime
|
||||||
|
action_time = datetime.fromtimestamp(int(act_time))
|
||||||
|
crnt_date = datetime.now()
|
||||||
|
duration = crnt_date - action_time
|
||||||
|
display_data = (action_time.strftime('%d/%m/%Y')
|
||||||
|
if duration.days >= 365 else action_time.strftime('%I:%M %p').lstrip('0')
|
||||||
|
if duration.days == 0 and crnt_date.strftime('%d/%m/%Y') == action_time.strftime('%d/%m/%Y')
|
||||||
|
else action_time.strftime("%d %b"))
|
||||||
|
return display_data
|
||||||
|
|
||||||
|
|
||||||
|
def AddTimeWidget(time):
|
||||||
|
"""This method is used to create TimeWidget"""
|
||||||
|
action_time = BadgeText(
|
||||||
|
size_hint= (None, None),
|
||||||
|
text= f"{ShowTimeHistoy(time)}",
|
||||||
|
halign='right',
|
||||||
|
font_style='Caption',
|
||||||
|
size= [65,70])
|
||||||
|
return action_time
|
||||||
|
|
||||||
|
|
||||||
class Inbox(Screen):
|
class Inbox(Screen):
|
||||||
"""Inbox Screen uses screen to show widgets of screens"""
|
"""Inbox Screen uses screen to show widgets of screens"""
|
||||||
|
|
||||||
|
@ -118,6 +144,7 @@ class Inbox(Screen):
|
||||||
what = state.searcing_text
|
what = state.searcing_text
|
||||||
xAddress = 'toaddress'
|
xAddress = 'toaddress'
|
||||||
data = []
|
data = []
|
||||||
|
self.ids.identi_tag.children[0].text = ''
|
||||||
self.inboxDataQuery(xAddress, where, what)
|
self.inboxDataQuery(xAddress, where, what)
|
||||||
self.ids.identi_tag.children[0].text = ''
|
self.ids.identi_tag.children[0].text = ''
|
||||||
if self.queryreturn:
|
if self.queryreturn:
|
||||||
|
@ -131,7 +158,7 @@ class Inbox(Screen):
|
||||||
'secondary_text': mail[5][:50] + '........' if len(
|
'secondary_text': mail[5][:50] + '........' if len(
|
||||||
mail[5]) >= 50 else (mail[5] + ',' + mail[3].replace(
|
mail[5]) >= 50 else (mail[5] + ',' + mail[3].replace(
|
||||||
'\n', ''))[0:50] + '........',
|
'\n', ''))[0:50] + '........',
|
||||||
'msgid': mail[1]})
|
'msgid': mail[1], 'received': mail[6]})
|
||||||
self.has_refreshed = True
|
self.has_refreshed = True
|
||||||
self.set_mdList(data)
|
self.set_mdList(data)
|
||||||
self.children[2].children[0].children[0].bind(
|
self.children[2].children[0].children[0].bind(
|
||||||
|
@ -171,6 +198,7 @@ class Inbox(Screen):
|
||||||
source='./images/text_images/{}.png'.format(
|
source='./images/text_images/{}.png'.format(
|
||||||
avatarImageFirstLetter(item['secondary_text'].strip()))))
|
avatarImageFirstLetter(item['secondary_text'].strip()))))
|
||||||
meny.bind(on_press=partial(self.inbox_detail, item['msgid']))
|
meny.bind(on_press=partial(self.inbox_detail, item['msgid']))
|
||||||
|
meny.add_widget(AddTimeWidget(item['received']))
|
||||||
carousel = Carousel(direction='right')
|
carousel = Carousel(direction='right')
|
||||||
carousel.height = meny.height
|
carousel.height = meny.height
|
||||||
carousel.size_hint_y = None
|
carousel.size_hint_y = None
|
||||||
|
@ -183,10 +211,10 @@ class Inbox(Screen):
|
||||||
del_btn.bind(on_press=partial(self.delete, item['msgid']))
|
del_btn.bind(on_press=partial(self.delete, item['msgid']))
|
||||||
carousel.add_widget(del_btn)
|
carousel.add_widget(del_btn)
|
||||||
carousel.add_widget(meny)
|
carousel.add_widget(meny)
|
||||||
ach_btn = Button(text='Achieve')
|
# ach_btn = Button(text='Achieve')
|
||||||
ach_btn.background_color = (0, 1, 0, 1)
|
# ach_btn.background_color = (0, 1, 0, 1)
|
||||||
ach_btn.bind(on_press=partial(self.archive, item['msgid']))
|
# ach_btn.bind(on_press=partial(self.archive, item['msgid']))
|
||||||
carousel.add_widget(ach_btn)
|
# carousel.add_widget(ach_btn)
|
||||||
carousel.index = 1
|
carousel.index = 1
|
||||||
self.ids.ml.add_widget(carousel)
|
self.ids.ml.add_widget(carousel)
|
||||||
update_message = len(self.ids.ml.children)
|
update_message = len(self.ids.ml.children)
|
||||||
|
@ -304,7 +332,9 @@ class MyAddress(Screen):
|
||||||
|
|
||||||
def init_ui(self, dt=0):
|
def init_ui(self, dt=0):
|
||||||
"""Clock schdule for method Myaddress accounts"""
|
"""Clock schdule for method Myaddress accounts"""
|
||||||
self.addresses_list = state.kivyapp.variable_1
|
# pylint: disable=unnecessary-lambda, deprecated-lambda
|
||||||
|
# self.addresses_list = state.kivyapp.variable_1
|
||||||
|
self.addresses_list = BMConfigParser().addresses()
|
||||||
if state.searcing_text:
|
if state.searcing_text:
|
||||||
self.ids.refresh_layout.scroll_y = 1.0
|
self.ids.refresh_layout.scroll_y = 1.0
|
||||||
filtered_list = [
|
filtered_list = [
|
||||||
|
@ -343,16 +373,34 @@ class MyAddress(Screen):
|
||||||
'text': BMConfigParser().get(address, 'label'),
|
'text': BMConfigParser().get(address, 'label'),
|
||||||
'secondary_text': address})
|
'secondary_text': address})
|
||||||
for item in data:
|
for item in data:
|
||||||
|
is_enable = BMConfigParser().get(item['secondary_text'], 'enabled')
|
||||||
meny = TwoLineAvatarIconListItem(
|
meny = TwoLineAvatarIconListItem(
|
||||||
text=item['text'], secondary_text=item['secondary_text'],
|
text=item['text'], secondary_text=item['secondary_text'],
|
||||||
theme_text_color='Custom',
|
theme_text_color='Custom' if is_enable == 'true' else 'Primary',
|
||||||
text_color=NavigateApp().theme_cls.primary_color)
|
text_color=NavigateApp().theme_cls.primary_color,
|
||||||
|
disabled=False if is_enable == 'true' else True)
|
||||||
meny.add_widget(AvatarSampleWidget(
|
meny.add_widget(AvatarSampleWidget(
|
||||||
source='./images/text_images/{}.png'.format(
|
source='./images/text_images/{}.png'.format(
|
||||||
avatarImageFirstLetter(item['text'].strip()))))
|
avatarImageFirstLetter(item['text'].strip()))))
|
||||||
meny.bind(on_press=partial(
|
meny.bind(on_press=partial(
|
||||||
self.myadd_detail, item['secondary_text'], item['text']))
|
self.myadd_detail, item['secondary_text'], item['text']))
|
||||||
self.ids.ml.add_widget(meny)
|
carousel = Carousel(direction='right')
|
||||||
|
carousel.height = meny.height
|
||||||
|
carousel.size_hint_y = None
|
||||||
|
carousel.ignore_perpendicular_swipes = True
|
||||||
|
carousel.data_index = 0
|
||||||
|
carousel.min_move = 0.2
|
||||||
|
del_btn = Button(text='Disable' if is_enable == 'true' else 'Enable')
|
||||||
|
if is_enable == 'true':
|
||||||
|
del_btn.background_normal = ''
|
||||||
|
del_btn.background_color = (1, 0, 0, 1) if is_enable == 'true' else (0, 1, 0, 1)
|
||||||
|
del_btn.bind(
|
||||||
|
on_press=partial(
|
||||||
|
self.disableAddress if is_enable == 'true' else self.enableAddress , item['secondary_text']))
|
||||||
|
carousel.add_widget(del_btn)
|
||||||
|
carousel.add_widget(meny)
|
||||||
|
carousel.index = 1
|
||||||
|
self.ids.ml.add_widget(carousel)
|
||||||
|
|
||||||
def check_scroll_y(self, instance, somethingelse):
|
def check_scroll_y(self, instance, somethingelse):
|
||||||
"""Load data on scroll down"""
|
"""Load data on scroll down"""
|
||||||
|
@ -406,6 +454,33 @@ class MyAddress(Screen):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def disableAddress(self, address, instance, *args):
|
||||||
|
"""This method is use for disabling address"""
|
||||||
|
BMConfigParser().set(str(address), 'enabled', 'false')
|
||||||
|
BMConfigParser().save()
|
||||||
|
state.kivyapp.loadMyAddressScreen(True)
|
||||||
|
state.kivyapp.root.ids.sc10.ids.ml.clear_widgets()
|
||||||
|
Clock.schedule_once(self.address_permision_callback, 0)
|
||||||
|
# state.kivyapp.root.ids.sc10.init_ui()
|
||||||
|
pass
|
||||||
|
|
||||||
|
def enableAddress(self, address, instance, *args):
|
||||||
|
"""This method is use for enabling address"""
|
||||||
|
BMConfigParser().set(address, 'enabled', 'true')
|
||||||
|
BMConfigParser().save()
|
||||||
|
state.kivyapp.loadMyAddressScreen(True)
|
||||||
|
state.kivyapp.root.ids.sc10.ids.ml.clear_widgets()
|
||||||
|
Clock.schedule_once(self.address_permision_callback, 0)
|
||||||
|
|
||||||
|
# @staticmethod
|
||||||
|
def address_permision_callback(self, dt=0):
|
||||||
|
"""New address created"""
|
||||||
|
state.kivyapp.loadMyAddressScreen(False)
|
||||||
|
state.kivyapp.root.ids.sc10.init_ui()
|
||||||
|
addresses = [addr for addr in BMConfigParser().addresses()
|
||||||
|
if BMConfigParser().get(str(addr), 'enabled') == 'true']
|
||||||
|
self.parent.parent.ids.content_drawer.ids.btn.values = addresses
|
||||||
|
self.parent.parent.ids.sc3.children[1].ids.btn.values = addresses
|
||||||
|
|
||||||
class AddressBook(Screen):
|
class AddressBook(Screen):
|
||||||
"""AddressBook Screen uses screen to show widgets of screens"""
|
"""AddressBook Screen uses screen to show widgets of screens"""
|
||||||
|
@ -570,8 +645,8 @@ class DropDownWidget(BoxLayout):
|
||||||
|
|
||||||
def send(self, navApp):
|
def send(self, navApp):
|
||||||
"""Send message from one address to another"""
|
"""Send message from one address to another"""
|
||||||
fromAddress = str(self.ids.ti.text)
|
fromAddress = self.ids.ti.text.strip()
|
||||||
toAddress = str(self.ids.txt_input.text)
|
toAddress = self.ids.txt_input.text.strip()
|
||||||
subject = self.ids.subject.text.strip()
|
subject = self.ids.subject.text.strip()
|
||||||
message = self.ids.body.text.strip()
|
message = self.ids.body.text.strip()
|
||||||
encoding = 3
|
encoding = 3
|
||||||
|
@ -909,7 +984,7 @@ class Sent(Screen):
|
||||||
'secondary_text': mail[2][:50] + '........' if len(
|
'secondary_text': mail[2][:50] + '........' if len(
|
||||||
mail[2]) >= 50 else (mail[2] + ',' + mail[3].replace(
|
mail[2]) >= 50 else (mail[2] + ',' + mail[3].replace(
|
||||||
'\n', ''))[0:50] + '........',
|
'\n', ''))[0:50] + '........',
|
||||||
'ackdata': mail[5]})
|
'ackdata': mail[5], 'senttime': mail[6]},)
|
||||||
self.set_mdlist(data, 0)
|
self.set_mdlist(data, 0)
|
||||||
self.has_refreshed = True
|
self.has_refreshed = True
|
||||||
self.ids.scroll_y.bind(scroll_y=self.check_scroll_y)
|
self.ids.scroll_y.bind(scroll_y=self.check_scroll_y)
|
||||||
|
@ -944,11 +1019,13 @@ class Sent(Screen):
|
||||||
meny = TwoLineAvatarIconListItem(
|
meny = TwoLineAvatarIconListItem(
|
||||||
text=item['text'], secondary_text=item['secondary_text'],
|
text=item['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
|
||||||
|
)
|
||||||
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()))))
|
||||||
meny.bind(on_press=partial(self.sent_detail, item['ackdata']))
|
meny.bind(on_press=partial(self.sent_detail, item['ackdata']))
|
||||||
|
meny.add_widget(AddTimeWidget(item['senttime']))
|
||||||
carousel = Carousel(direction='right')
|
carousel = Carousel(direction='right')
|
||||||
carousel.height = meny.height
|
carousel.height = meny.height
|
||||||
carousel.size_hint_y = None
|
carousel.size_hint_y = None
|
||||||
|
@ -961,10 +1038,10 @@ class Sent(Screen):
|
||||||
del_btn.bind(on_press=partial(self.delete, item['ackdata']))
|
del_btn.bind(on_press=partial(self.delete, item['ackdata']))
|
||||||
carousel.add_widget(del_btn)
|
carousel.add_widget(del_btn)
|
||||||
carousel.add_widget(meny)
|
carousel.add_widget(meny)
|
||||||
ach_btn = Button(text='Achieve')
|
# ach_btn = Button(text='Achieve')
|
||||||
ach_btn.background_color = (0, 1, 0, 1)
|
# ach_btn.background_color = (0, 1, 0, 1)
|
||||||
ach_btn.bind(on_press=partial(self.archive, item['ackdata']))
|
# ach_btn.bind(on_press=partial(self.archive, item['ackdata']))
|
||||||
carousel.add_widget(ach_btn)
|
# carousel.add_widget(ach_btn)
|
||||||
carousel.index = 1
|
carousel.index = 1
|
||||||
self.ids.ml.add_widget(carousel, index=set_index)
|
self.ids.ml.add_widget(carousel, index=set_index)
|
||||||
updated_msgs = len(self.ids.ml.children)
|
updated_msgs = len(self.ids.ml.children)
|
||||||
|
@ -989,7 +1066,7 @@ class Sent(Screen):
|
||||||
'secondary_text': mail[2][:50] + '........' if len(
|
'secondary_text': mail[2][:50] + '........' if len(
|
||||||
mail[2]) >= 50 else (mail[2] + ',' + mail[3].replace(
|
mail[2]) >= 50 else (mail[2] + ',' + mail[3].replace(
|
||||||
'\n', ''))[0:50] + '........',
|
'\n', ''))[0:50] + '........',
|
||||||
'ackdata': mail[5]})
|
'ackdata': mail[5], 'senttime': mail[6]})
|
||||||
self.set_mdlist(data, total_sent - 1)
|
self.set_mdlist(data, total_sent - 1)
|
||||||
if state.msg_counter_objs and state.association == (
|
if state.msg_counter_objs and state.association == (
|
||||||
state.check_sent_acc):
|
state.check_sent_acc):
|
||||||
|
@ -1026,8 +1103,11 @@ class Sent(Screen):
|
||||||
def set_sentCount(total_sent):
|
def set_sentCount(total_sent):
|
||||||
"""Set the total no. of sent message count"""
|
"""Set the total no. of sent message count"""
|
||||||
src_mng_obj = state.kivyapp.root.ids.content_drawer.ids.send_cnt
|
src_mng_obj = state.kivyapp.root.ids.content_drawer.ids.send_cnt
|
||||||
|
if state.association:
|
||||||
src_mng_obj.children[0].children[0].text = showLimitedCnt(int(total_sent))
|
src_mng_obj.children[0].children[0].text = showLimitedCnt(int(total_sent))
|
||||||
state.sent_count = str(total_sent)
|
# state.sent_count = str(total_sent)
|
||||||
|
else:
|
||||||
|
src_mng_obj.children[0].children[0].text = '0'
|
||||||
|
|
||||||
def sent_detail(self, ackdata, *args):
|
def sent_detail(self, ackdata, *args):
|
||||||
"""Load sent mail details"""
|
"""Load sent mail details"""
|
||||||
|
@ -1125,7 +1205,7 @@ class Trash(Screen):
|
||||||
self.trash_messages = sqlQuery(
|
self.trash_messages = sqlQuery(
|
||||||
"SELECT toaddress, fromaddress, subject, message,"
|
"SELECT toaddress, fromaddress, subject, message,"
|
||||||
" folder ||',' || 'sent' as folder, ackdata As"
|
" folder ||',' || 'sent' as folder, ackdata As"
|
||||||
" id, DATE(lastactiontime) As actionTime FROM sent"
|
" id, DATE(senttime) As actionTime FROM sent"
|
||||||
" WHERE folder = 'trash' and fromaddress = '{0}' UNION"
|
" WHERE folder = 'trash' and fromaddress = '{0}' UNION"
|
||||||
" SELECT toaddress, fromaddress, subject, message,"
|
" SELECT toaddress, fromaddress, subject, message,"
|
||||||
" folder ||',' || 'inbox' as folder, msgid As id,"
|
" folder ||',' || 'inbox' as folder, msgid As id,"
|
||||||
|
@ -1269,7 +1349,8 @@ class NavigateApp(MDApp):
|
||||||
# theme_cls = ThemeManager()
|
# theme_cls = ThemeManager()
|
||||||
previous_date = ObjectProperty()
|
previous_date = ObjectProperty()
|
||||||
obj_1 = ObjectProperty()
|
obj_1 = ObjectProperty()
|
||||||
variable_1 = ListProperty(BMConfigParser().addresses())
|
variable_1 = ListProperty(addr for addr in BMConfigParser().addresses()
|
||||||
|
if BMConfigParser().get(str(addr), 'enabled') == 'true')
|
||||||
nav_drawer = ObjectProperty()
|
nav_drawer = ObjectProperty()
|
||||||
state.screen_density = Window.size
|
state.screen_density = Window.size
|
||||||
window_size = state.screen_density
|
window_size = state.screen_density
|
||||||
|
@ -1515,6 +1596,12 @@ class NavigateApp(MDApp):
|
||||||
['send',
|
['send',
|
||||||
lambda x: self.root.ids.sc3.children[1].send(self)]]
|
lambda x: self.root.ids.sc3.children[1].send(self)]]
|
||||||
|
|
||||||
|
def set_toolbar_for_QrCode(self):
|
||||||
|
"""This method is use for setting Qr code toolbar."""
|
||||||
|
self.root.ids.toolbar.left_action_items = [
|
||||||
|
['arrow-left', lambda x: self.back_press()]]
|
||||||
|
self.root.ids.toolbar.right_action_items = []
|
||||||
|
|
||||||
def set_common_header(self):
|
def set_common_header(self):
|
||||||
"""Common header for all window"""
|
"""Common header for all window"""
|
||||||
self.root.ids.toolbar.right_action_items = [
|
self.root.ids.toolbar.right_action_items = [
|
||||||
|
@ -1522,7 +1609,7 @@ class NavigateApp(MDApp):
|
||||||
# self.root.ids.toolbar.left_action_items = [
|
# self.root.ids.toolbar.left_action_items = [
|
||||||
# ['menu', lambda x: self.root.toggle_nav_drawer()]]
|
# ['menu', lambda x: self.root.toggle_nav_drawer()]]
|
||||||
self.root.ids.toolbar.left_action_items = [
|
self.root.ids.toolbar.left_action_items = [
|
||||||
['menu', lambda x: self.root.ids.nav_drawer.toggle_nav_drawer()]]
|
['menu', lambda x: self.root.ids.nav_drawer.set_state("toggle")]]
|
||||||
return
|
return
|
||||||
|
|
||||||
def back_press(self):
|
def back_press(self):
|
||||||
|
@ -1540,7 +1627,8 @@ class NavigateApp(MDApp):
|
||||||
self.root.ids.scr_mngr.current = 'inbox' \
|
self.root.ids.scr_mngr.current = 'inbox' \
|
||||||
if state.in_composer else 'allmails'\
|
if state.in_composer else 'allmails'\
|
||||||
if state.is_allmail else state.detailPageType\
|
if state.is_allmail else state.detailPageType\
|
||||||
if state.detailPageType else 'inbox'
|
if state.detailPageType else 'myaddress'\
|
||||||
|
if self.root.ids.scr_mngr.current == 'showqrcode' else 'inbox'
|
||||||
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 state.detailPageType == 'draft':
|
||||||
|
@ -2122,6 +2210,7 @@ class ShowQRCode(Screen):
|
||||||
def qrdisplay(self):
|
def qrdisplay(self):
|
||||||
"""Method used for showing QR Code"""
|
"""Method used for showing QR Code"""
|
||||||
self.ids.qr.clear_widgets()
|
self.ids.qr.clear_widgets()
|
||||||
|
state.kivyapp.set_toolbar_for_QrCode()
|
||||||
from kivy.garden.qrcode import QRCodeWidget
|
from kivy.garden.qrcode import QRCodeWidget
|
||||||
try:
|
try:
|
||||||
address = self.manager.get_parent_window().children[0].address
|
address = self.manager.get_parent_window().children[0].address
|
||||||
|
@ -2383,7 +2472,7 @@ class Allmails(Screen):
|
||||||
"""Retrieving data from inbox or sent both tables"""
|
"""Retrieving data from inbox or sent both tables"""
|
||||||
self.all_mails = sqlQuery(
|
self.all_mails = sqlQuery(
|
||||||
"SELECT toaddress, fromaddress, subject, message, folder, ackdata"
|
"SELECT toaddress, fromaddress, subject, message, folder, ackdata"
|
||||||
" As id, DATE(lastactiontime) As actionTime FROM sent WHERE"
|
" As id, DATE(senttime) As actionTime FROM sent WHERE"
|
||||||
" folder = 'sent' and fromaddress = '{0}'"
|
" folder = 'sent' and fromaddress = '{0}'"
|
||||||
" UNION SELECT toaddress, fromaddress, subject, message, folder,"
|
" UNION SELECT toaddress, fromaddress, subject, message, folder,"
|
||||||
" msgid As id, DATE(received) As actionTime FROM inbox"
|
" msgid As id, DATE(received) As actionTime FROM inbox"
|
||||||
|
|
Reference in New Issue
Block a user