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 kivy.uix.screenmanager import Screen
|
||||||
|
|
||||||
from helper_sql import sqlExecute
|
|
||||||
|
|
||||||
import state
|
import state
|
||||||
|
|
||||||
|
|
||||||
from bitmessagekivy.get_platform import platform
|
from bitmessagekivy.get_platform import platform
|
||||||
from bitmessagekivy import kivy_helper_search
|
from bitmessagekivy import kivy_helper_search
|
||||||
from bitmessagekivy.baseclass.common import (
|
from bitmessagekivy.baseclass.common import (
|
||||||
|
@ -30,6 +30,8 @@ from bitmessagekivy.baseclass.common import (
|
||||||
)
|
)
|
||||||
from bitmessagekivy.baseclass.popup import AddbookDetailPopup
|
from bitmessagekivy.baseclass.popup import AddbookDetailPopup
|
||||||
from bitmessagekivy.baseclass.addressbook_widgets import HelperAddressBook
|
from bitmessagekivy.baseclass.addressbook_widgets import HelperAddressBook
|
||||||
|
from debug import logger
|
||||||
|
from helper_sql import sqlExecute
|
||||||
|
|
||||||
|
|
||||||
class AddressBook(Screen, HelperAddressBook):
|
class AddressBook(Screen, HelperAddressBook):
|
||||||
|
@ -49,7 +51,7 @@ class AddressBook(Screen, HelperAddressBook):
|
||||||
def init_ui(self, dt=0):
|
def init_ui(self, dt=0):
|
||||||
"""Clock Schdule for method AddressBook"""
|
"""Clock Schdule for method AddressBook"""
|
||||||
self.loadAddresslist(None, 'All', '')
|
self.loadAddresslist(None, 'All', '')
|
||||||
print(dt)
|
logger.debug(dt)
|
||||||
|
|
||||||
def loadAddresslist(self, account, where="", what=""):
|
def loadAddresslist(self, account, where="", what=""):
|
||||||
"""Clock Schdule for method AddressBook"""
|
"""Clock Schdule for method AddressBook"""
|
||||||
|
@ -118,8 +120,8 @@ class AddressBook(Screen, HelperAddressBook):
|
||||||
self.address = obj.address = address
|
self.address = obj.address = address
|
||||||
width = .9 if platform == 'android' else .8
|
width = .9 if platform == 'android' else .8
|
||||||
self.addbook_popup = self.address_detail_popup(
|
self.addbook_popup = self.address_detail_popup(
|
||||||
self.send_message_to, self.update_addbook_label, self.close_pop,
|
obj, self.send_message_to, self.update_addbook_label,
|
||||||
width=width, obj=obj)
|
self.close_pop, width)
|
||||||
self.addbook_popup.auto_dismiss = False
|
self.addbook_popup.auto_dismiss = False
|
||||||
self.addbook_popup.open()
|
self.addbook_popup.open()
|
||||||
else:
|
else:
|
||||||
|
@ -132,7 +134,7 @@ class AddressBook(Screen, HelperAddressBook):
|
||||||
if self.ids.ml.children is not None:
|
if self.ids.ml.children is not None:
|
||||||
self.ids.tag_label.text = ''
|
self.ids.tag_label.text = ''
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"DELETE FROM addressbook WHERE address = '{}';".format(address))
|
"DELETE FROM addressbook WHERE address = ?", address)
|
||||||
toast('Address Deleted')
|
toast('Address Deleted')
|
||||||
|
|
||||||
def close_pop(self, instance):
|
def close_pop(self, instance):
|
||||||
|
@ -150,9 +152,8 @@ class AddressBook(Screen, HelperAddressBook):
|
||||||
stored_labels.remove(label)
|
stored_labels.remove(label)
|
||||||
if label and label not in stored_labels:
|
if label and label not in stored_labels:
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"UPDATE addressbook SET label = '{}' WHERE"
|
"UPDATE addressbook SET label = ? WHERE"
|
||||||
" address = '{}';".format(
|
" address = ?", label, self.addbook_popup.content_cls.address)
|
||||||
label, self.addbook_popup.content_cls.address))
|
|
||||||
state.kivyapp.root.ids.sc11.ids.ml.clear_widgets()
|
state.kivyapp.root.ids.sc11.ids.ml.clear_widgets()
|
||||||
state.kivyapp.root.ids.sc11.loadAddresslist(None, 'All', '')
|
state.kivyapp.root.ids.sc11.loadAddresslist(None, 'All', '')
|
||||||
self.addbook_popup.dismiss()
|
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.
|
Addressbook widgets are here.
|
||||||
"""
|
"""
|
||||||
|
@ -24,13 +24,11 @@ class HelperAddressBook(object):
|
||||||
theme_text_color='Primary',
|
theme_text_color='Primary',
|
||||||
# FIXME: searching_text supposed to be inside kivy_sate.py and need to create a PR for kivy_state.py
|
# 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
|
text="No contact found!" if state.searching_text
|
||||||
else "No contact found yet...... ",
|
else "No contact found yet...... ", halign='center', size_hint_y=None, valign='top')
|
||||||
halign='center',
|
|
||||||
size_hint_y=None,
|
|
||||||
valign='top')
|
|
||||||
return content
|
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."""
|
"""This function shows the address's details and opens the popup."""
|
||||||
show_dialogue = MDDialog(
|
show_dialogue = MDDialog(
|
||||||
type="custom",
|
type="custom",
|
||||||
|
|
Reference in New Issue
Block a user