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 isort==4.3.21
Kivy==1.11.1 Kivy==1.11.1
Kivy-Garden==0.1.4 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 lazy-object-proxy==1.4.3
mccabe==0.6.1 mccabe==0.6.1
Pillow==6.1.0 Pillow==6.1.0

View File

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

View File

@ -47,7 +47,7 @@
size_hint_y: None size_hint_y: None
font_size: '15sp' font_size: '15sp'
height: self.parent.height/2 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: RV:
id: rv id: rv
MDIconButton: 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" text: "Here you may generate as many addresses as you like, Indeed creating and abandoning addresses is encouraged"
halign: 'center' halign: 'center'
color:app.theme_cls.primary_dark color:app.theme_cls.primary_dark
MDTextField: MDTextField:
id: label id: label
multiline: False multiline: False

View File

@ -43,6 +43,7 @@
id: dropdown_item id: dropdown_item
text: 'italiano' text: 'italiano'
dropdown_max_height: 150 dropdown_max_height: 150
dropdown_bg: [1, 1, 1, 1]
pos_hint: {'center_x': 0.8, 'center_y': 0} 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']] 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: BoxLayout:
@ -284,26 +285,25 @@
halign: 'left' halign: 'left'
bold: True bold: True
BoxLayout: GridLayout:
orientation: 'horizontal' cols: 2
padding: [10, 0, 0, 0] padding: [10, 0, 0, 0]
BoxLayout: MDLabel:
orientation: 'horizontal' size_hint_x: None
MDLabel: font_style: 'Body1'
font_style: 'Body1' theme_text_color: 'Primary'
theme_text_color: 'Primary' text: "Type:"
text: "Type:" halign: 'left'
halign: 'left' MDDropDownItem:
BoxLayout: id: dropdown_item
orientation: 'horizontal' dropdown_bg: [1, 1, 1, 1]
MDDropDownItem: text: 'none'
id: dropdown_item pos_hint: {'x': 0.9, 'y': 0}
dropdown_bg: [1, 1, 1, 1] items: [f"{i}" for i in ['System Setting','U.S. English']]
text: 'none'
items: [f"{i}" for i in ['System Setting','U.S. English']]
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
padding: [30, 0, 0, 0] padding: [30, 0, 0, 0]
spacing: 10
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
MDLabel: MDLabel:
@ -323,6 +323,14 @@
theme_text_color: 'Primary' theme_text_color: 'Primary'
text: "Port:" text: "Port:"
halign: 'left' 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: MDTextFieldRect:
size_hint: None, None size_hint: None, None
size: dp(app.window_size[0]/4), dp(30) size: dp(app.window_size[0]/4), dp(30)
@ -332,6 +340,7 @@
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
padding: [30, 0, 0, 0] padding: [30, 0, 0, 0]
spacing: 10
BoxLayout: BoxLayout:
orientation: 'horizontal' orientation: 'horizontal'
MDLabel: MDLabel:

View File

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