Fixed code quality
This commit is contained in:
parent
e11b654e37
commit
b772b2ce9b
|
@ -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()
|
||||
|
|
|
@ -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",
|
||||
|
|
Reference in New Issue
Block a user