implemented address disable feature or fixed issues

This commit is contained in:
navjot 2020-03-17 17:12:16 +05:30
parent faced23f12
commit c8a08919ee
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C
6 changed files with 71 additions and 39 deletions

View File

@ -6,7 +6,7 @@ idna==2.8
isort==4.3.21
Kivy==1.11.1
Kivy-Garden==0.1.4
git+https://github.com/HeaTTheatR/KivyMD.git
git+https://github.com/surbhicis/KivyMD-1
lazy-object-proxy==1.4.3
mccabe==0.6.1
Pillow==6.1.0

View File

@ -53,6 +53,7 @@
<CustomTwoLineAvatarIconListItem>:
canvas:
Color:
id: set_clr
# rgba: 0.5, 0.5, 0.5, 0.5
rgba: 0,0,0,0
Rectangle: #woohoo!!!

View File

@ -47,7 +47,7 @@
size_hint_y: None
font_size: '15sp'
height: self.parent.height/2
# hint_text: 'type, select or scan QR code for recipients address'
hint_text: 'type, select or scan QR code for recipients address'
RV:
id: rv
MDIconButton:

View File

@ -87,7 +87,6 @@
text: "Here you may generate as many addresses as you like, Indeed creating and abandoning addresses is encouraged"
halign: 'center'
color:app.theme_cls.primary_dark
MDTextField:
id: label
multiline: False

View File

@ -43,6 +43,7 @@
id: dropdown_item
text: 'italiano'
dropdown_max_height: 150
dropdown_bg: [1, 1, 1, 1]
pos_hint: {'center_x': 0.8, 'center_y': 0}
items: [f"{i}" for i in ['System Setting','U.S. English','italiano','Esperanto','dansk','Deutsch','Pirate English','francais','Nederlands','norsk bokmal','polski','portugues europeu']]
BoxLayout:
@ -284,26 +285,25 @@
halign: 'left'
bold: True
BoxLayout:
orientation: 'horizontal'
GridLayout:
cols: 2
padding: [10, 0, 0, 0]
BoxLayout:
orientation: 'horizontal'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Type:"
halign: 'left'
BoxLayout:
orientation: 'horizontal'
MDDropDownItem:
id: dropdown_item
dropdown_bg: [1, 1, 1, 1]
text: 'none'
items: [f"{i}" for i in ['System Setting','U.S. English']]
MDLabel:
size_hint_x: None
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Type:"
halign: 'left'
MDDropDownItem:
id: dropdown_item
dropdown_bg: [1, 1, 1, 1]
text: 'none'
pos_hint: {'x': 0.9, 'y': 0}
items: [f"{i}" for i in ['System Setting','U.S. English']]
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
spacing: 10
BoxLayout:
orientation: 'horizontal'
MDLabel:
@ -323,6 +323,14 @@
theme_text_color: 'Primary'
text: "Port:"
halign: 'left'
# TextInput:
# size_hint: None, None
# hint_text: '9050'
# size: dp(app.window_size[0]/4), dp(30)
# input_filter: "int"
# readonly: False
# multiline: False
# font_size: '15sp'
MDTextFieldRect:
size_hint: None, None
size: dp(app.window_size[0]/4), dp(30)
@ -332,6 +340,7 @@
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
spacing: 10
BoxLayout:
orientation: 'horizontal'
MDLabel:

View File

@ -396,7 +396,10 @@ class MyAddress(Screen):
theme_text_color='Custom' if is_enable == 'true' else 'Primary',
text_color=NavigateApp().theme_cls.primary_color,
)
meny.canvas.children[6].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5]
try:
meny.canvas.children[6].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5]
except Exception as e:
meny.canvas.children[9].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5]
meny.add_widget(AvatarSampleWidget(
source='./images/text_images/{}.png'.format(
avatarImageFirstLetter(item['text'].strip()))))
@ -498,7 +501,10 @@ class MyAddress(Screen):
BMConfigParser().set(str(address), 'enabled', 'false')
BMConfigParser().save()
instance.parent.parent.theme_text_color = 'Primary'
instance.parent.parent.canvas.children[6].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 as e:
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)
@ -507,7 +513,10 @@ class MyAddress(Screen):
BMConfigParser().set(address, 'enabled', 'true')
BMConfigParser().save()
instance.parent.parent.theme_text_color = 'Custom'
instance.parent.parent.canvas.children[6].rgba = [0, 0, 0, 0]
try:
instance.parent.parent.canvas.children[6].rgba = [0, 0, 0, 0]
except Exception as e:
instance.parent.parent.canvas.children[9].rgba = [0, 0, 0, 0]
toast('Address Enabled')
Clock.schedule_once(self.address_permision_callback, 0)
@ -905,6 +914,7 @@ class Login(Screen):
' choose a weak passphrase and someone on the Internet can brute-force it,'
' they can read your messages and send messages as you')
class NetworkStat(Screen):
"""Method used to show network stat"""
@ -1118,15 +1128,21 @@ class Sent(Screen):
if len(self.ids.ml.children) < 3:
self.ids.ml.clear_widgets()
self.loadSent()
total_sent = int(state.sent_count) + 1
state.sent_count = str(int(state.sent_count) +1)
self.set_sentCount(total_sent)
if state.association == state.check_sent_acc:
total_sent = int(state.sent_count) + 1
state.sent_count = str(int(state.sent_count) +1)
self.set_sentCount(total_sent)
else:
total_sent = int(state.sent_count)
else:
data = []
self.sentDataQuery('fromaddress', '', '', 0, 1)
total_sent = int(state.sent_count) + 1
state.sent_count = str(int(state.sent_count) +1)
self.set_sentCount(total_sent)
if state.association == state.check_sent_acc:
total_sent = int(state.sent_count) + 1
state.sent_count = str(int(state.sent_count) +1)
self.set_sentCount(total_sent)
else:
total_sent = int(state.sent_count)
for mail in self.queryreturn:
data.append({
'text': mail[1].strip(),
@ -1740,12 +1756,13 @@ class NavigateApp(MDApp):
def set_message_count(self):
"""Setting message count"""
try:
msg_counter_objs = (
self.root_window.children[0].children[2].children[0].ids)
except Exception:
msg_counter_objs = (
self.root_window.children[2].children[2].children[0].ids)
msg_counter_objs = state.kivyapp.root.children[0].children[0].ids
# try:
# msg_counter_objs = (
# self.root_window.children[0].children[2].children[0].ids)
# except Exception:
# msg_counter_objs = (
# self.root_window.children[2].children[2].children[0].ids)
self.get_inbox_count()
self.get_sent_count()
state.trash_count = str(sqlQuery(
@ -2230,14 +2247,20 @@ class MailDetail(Screen):
def inbox_reply(self):
"""Reply inbox messages"""
data = sqlQuery(
"select toaddress, fromaddress, subject, message from inbox where"
"select toaddress, fromaddress, subject, message, received from inbox where"
" msgid = ?;", state.mail_id)
composer_obj = self.parent.screens[2].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]
composer_obj.subject.text = data[0][2]
composer_obj.body.text = ''
split_subject = data[0][2].split('Re:', 1)
composer_obj.subject.text = 'Re: ' +(split_subject[1] if len(split_subject)>1 else split_subject[0])
time_obj = datetime.fromtimestamp(int(data[0][4]))
time_tag = time_obj.strftime("%d %b %Y, %I:%M %p")
sender_name = BMConfigParser().get(data[0][1], 'label')
composer_obj.body.text = '\n\n ------------------------On '+time_tag+', '+sender_name+' wrote:-----------------------\n' + data[0][3]
composer_obj.body.focus = True
composer_obj.body.cursor = (0, 0)
state.kivyapp.root.ids.sc3.children[1].ids.rv.data = ''
self.parent.current = 'create'
state.kivyapp.set_navbar_for_composer()
@ -2334,8 +2357,8 @@ class AddbookDetailPopup(Popup):
"UPDATE addressbook SET label = '{}' WHERE"
" address = '{}';".format(
str(self.ids.add_label.text), address))
self.parent.children[1].ids.sc11.ids.ml.clear_widgets()
self.parent.children[1].ids.sc11.loadAddresslist(None, 'All', '')
state.kivyapp.root.ids.sc11.ids.ml.clear_widgets()
state.kivyapp.root.ids.sc11.loadAddresslist(None, 'All', '')
self.dismiss()
toast('Saved')