From 2e5fcf5fc6a5dd3fb6f0f398f71474101662f5ef Mon Sep 17 00:00:00 2001 From: shekhar-cis Date: Mon, 30 May 2022 17:11:20 +0530 Subject: [PATCH] Fixed sql query --- src/bitmessagekivy/baseclass/__init__.py | 0 src/bitmessagekivy/baseclass/addressbook.py | 4 +-- src/bitmessagekivy/baseclass/common.py | 34 ++++++++++++++++----- src/bitmessagekivy/baseclass/payment.py | 4 +-- src/bitmessagekivy/baseclass/qrcode.py | 5 ++- 5 files changed, 32 insertions(+), 15 deletions(-) create mode 100644 src/bitmessagekivy/baseclass/__init__.py diff --git a/src/bitmessagekivy/baseclass/__init__.py b/src/bitmessagekivy/baseclass/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/bitmessagekivy/baseclass/addressbook.py b/src/bitmessagekivy/baseclass/addressbook.py index ce89169c..0b99a9a4 100644 --- a/src/bitmessagekivy/baseclass/addressbook.py +++ b/src/bitmessagekivy/baseclass/addressbook.py @@ -178,9 +178,7 @@ class AddressBook(Screen, HelperAddressBook): if label in stored_labels and self.address == add_dict[label]: stored_labels.remove(label) if label and label not in stored_labels: - sqlExecute( - "UPDATE addressbook SET label = ? WHERE" - "address = ?", label, self.addbook_popup.content_cls.address) + sqlExecute("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() diff --git a/src/bitmessagekivy/baseclass/common.py b/src/bitmessagekivy/baseclass/common.py index eae8459b..96a8eef0 100644 --- a/src/bitmessagekivy/baseclass/common.py +++ b/src/bitmessagekivy/baseclass/common.py @@ -2,6 +2,7 @@ from datetime import datetime from kivy.core.window import Window from kivy.lang import Builder from kivy.metrics import dp +from kivy.app import App from kivymd.uix.list import ( ILeftBody, IRightBodyTouch, @@ -82,13 +83,29 @@ def showLimitedCnt(total_msg): def avatarImageFirstLetter(letter_string): """This function is used to the first letter for the avatar image""" + # try: + # if isinstance(letter_string, int): + # letter_string = str(letter_string) + # letter_string = letter_string.title()[0] + # if image_exists: + # return letter + # raise IndexError + # except IndexError: + # return '!' + # import pdb; pdb.set_trace() + try: - if isinstance(letter_string, int): - return letter_string[0] - elif isinstance(letter_string, str) and letter_string[0].isalnum(): - return letter_string.title()[0] - else: - return '!' + image_letter = letter_string.title()[0] + if image_letter.isalnum(): + return image_letter + return '!' + + # if isinstance(letter_string, int): + # return letter_string[0] + # elif isinstance(letter_string, str) and letter_string[0].isalnum(): + # return letter_string.title()[0] + # else: + # return '!' except IndexError: return '!' @@ -146,10 +163,13 @@ class CutsomSwipeToDeleteItem(MDCardSwipe): def empty_screen_label(label_str=None, no_search_res_found=None): """Returns default text on screen when no address is there.""" + kivy_running_app = App.get_running_app() + kivy_state = kivy_running_app.kivy_state_obj + # import pdb; pdb.set_trace() content = MDLabel( font_style='Caption', theme_text_color='Primary', - text=no_search_res_found if state.searcing_text else label_str, + text=no_search_res_found if kivy_state.searcing_text else label_str, halign='center', size_hint_y=None, valign='top') diff --git a/src/bitmessagekivy/baseclass/payment.py b/src/bitmessagekivy/baseclass/payment.py index 0e9777ca..e056abe6 100644 --- a/src/bitmessagekivy/baseclass/payment.py +++ b/src/bitmessagekivy/baseclass/payment.py @@ -1,10 +1,10 @@ ''' - This is for pamyent related part + This is for payment related part ''' from kivy.uix.boxlayout import BoxLayout -from kivymd.uix.behaviors.elevation import RectangularElevationBehavior from kivy.uix.screenmanager import Screen +from kivymd.uix.behaviors.elevation import RectangularElevationBehavior from kivymd.uix.label import MDLabel from kivymd.uix.list import ( IRightBodyTouch, diff --git a/src/bitmessagekivy/baseclass/qrcode.py b/src/bitmessagekivy/baseclass/qrcode.py index 6c81bd58..7729e541 100644 --- a/src/bitmessagekivy/baseclass/qrcode.py +++ b/src/bitmessagekivy/baseclass/qrcode.py @@ -1,9 +1,8 @@ -import state -from bitmessagekivy.baseclass.common import toast from kivy.uix.screenmanager import Screen from kivy.properties import StringProperty from kivy_garden.qrcode import QRCodeWidget - +from bitmessagekivy.baseclass.common import toast +import state class ShowQRCode(Screen): """ShowQRCode Screen class for kivy Ui"""