Fixed code quality

This commit is contained in:
shekhar-cis 2022-03-16 19:06:35 +05:30
parent e11b654e37
commit b772b2ce9b
Signed by untrusted user: shekhar-cis
GPG Key ID: F4F00AB04E83F9A7
2 changed files with 13 additions and 14 deletions

View File

@ -18,10 +18,10 @@ from kivy.properties import (
)
from kivy.uix.screenmanager import Screen
from helper_sql import sqlExecute
import state
from bitmessagekivy.get_platform import platform
from bitmessagekivy import kivy_helper_search
from bitmessagekivy.baseclass.common import (
@ -30,6 +30,8 @@ from bitmessagekivy.baseclass.common import (
)
from bitmessagekivy.baseclass.popup import AddbookDetailPopup
from bitmessagekivy.baseclass.addressbook_widgets import HelperAddressBook
from debug import logger
from helper_sql import sqlExecute
class AddressBook(Screen, HelperAddressBook):
@ -49,7 +51,7 @@ class AddressBook(Screen, HelperAddressBook):
def init_ui(self, dt=0):
"""Clock Schdule for method AddressBook"""
self.loadAddresslist(None, 'All', '')
print(dt)
logger.debug(dt)
def loadAddresslist(self, account, where="", what=""):
"""Clock Schdule for method AddressBook"""
@ -118,8 +120,8 @@ class AddressBook(Screen, HelperAddressBook):
self.address = obj.address = address
width = .9 if platform == 'android' else .8
self.addbook_popup = self.address_detail_popup(
self.send_message_to, self.update_addbook_label, self.close_pop,
width=width, obj=obj)
obj, self.send_message_to, self.update_addbook_label,
self.close_pop, width)
self.addbook_popup.auto_dismiss = False
self.addbook_popup.open()
else:
@ -132,7 +134,7 @@ class AddressBook(Screen, HelperAddressBook):
if self.ids.ml.children is not None:
self.ids.tag_label.text = ''
sqlExecute(
"DELETE FROM addressbook WHERE address = '{}';".format(address))
"DELETE FROM addressbook WHERE address = ?", address)
toast('Address Deleted')
def close_pop(self, instance):
@ -150,9 +152,8 @@ class AddressBook(Screen, HelperAddressBook):
stored_labels.remove(label)
if label and label not in stored_labels:
sqlExecute(
"UPDATE addressbook SET label = '{}' WHERE"
" address = '{}';".format(
label, self.addbook_popup.content_cls.address))
"UPDATE addressbook SET label = ? WHERE"
" address = ?", label, self.addbook_popup.content_cls.address)
state.kivyapp.root.ids.sc11.ids.ml.clear_widgets()
state.kivyapp.root.ids.sc11.loadAddresslist(None, 'All', '')
self.addbook_popup.dismiss()

View File

@ -1,4 +1,4 @@
# pylint: disable=no-member, too-many-arguments, no-self-use
# pylint: disable=no-member, too-many-arguments
"""
Addressbook widgets are here.
"""
@ -24,13 +24,11 @@ class HelperAddressBook(object):
theme_text_color='Primary',
# FIXME: searching_text supposed to be inside kivy_sate.py and need to create a PR for kivy_state.py
text="No contact found!" if state.searching_text
else "No contact found yet...... ",
halign='center',
size_hint_y=None,
valign='top')
else "No contact found yet...... ", halign='center', size_hint_y=None, valign='top')
return content
def address_detail_popup(self, send_message, update_address, close_popup, width, obj):
@staticmethod
def address_detail_popup(obj, send_message, update_address, close_popup, width):
"""This function shows the address's details and opens the popup."""
show_dialogue = MDDialog(
type="custom",