From 03db10675e20f9a6b6513615832a055e5aecb5d8 Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Tue, 7 Jan 2020 16:58:29 +0530 Subject: [PATCH] new fix --- src/bitmessagekivy/identiconGeneration.py | 4 +- src/bitmessagekivy/kivy_helper_search.py | 14 +++--- src/bitmessagekivy/mpybit.py | 57 ++++++++++++++++++----- 3 files changed, 54 insertions(+), 21 deletions(-) diff --git a/src/bitmessagekivy/identiconGeneration.py b/src/bitmessagekivy/identiconGeneration.py index 25bd2254..faa72013 100644 --- a/src/bitmessagekivy/identiconGeneration.py +++ b/src/bitmessagekivy/identiconGeneration.py @@ -59,8 +59,7 @@ def random_color(hash_string): r = rgb[:split] g = rgb[split:2 * split] b = rgb[2 * split:3 * split] - color = (int(r, 16), int(g, 16), - int(b, 16), 0xFF) + color = (int(r, 16), int(g, 16), int(b, 16), 0xFF) return color @@ -78,6 +77,5 @@ def generate_image(image, color, hash_string): if int(hash_string[index], 16) % 2 == 0: image.putpixel((x, y), color) image.putpixel((limit_x - x, y), color) - index = index + 1 return image diff --git a/src/bitmessagekivy/kivy_helper_search.py b/src/bitmessagekivy/kivy_helper_search.py index c05e69d4..9f740597 100644 --- a/src/bitmessagekivy/kivy_helper_search.py +++ b/src/bitmessagekivy/kivy_helper_search.py @@ -7,22 +7,24 @@ from helper_sql import sqlQuery def search_sql( xAddress="toaddress", account=None, folder="inbox", where=None, what=None, unreadOnly=False, start_indx=0, end_indx=20): - """Method helping for searching mails""" # pylint: disable=too-many-arguments, too-many-branches + """Method helping for searching mails""" if what is not None and what != "": what = "%" + what + "%" else: what = None - if folder == "sent" or folder == "draft": + if folder in ("sent", "draft"): sqlStatementBase = ( '''SELECT toaddress, fromaddress, subject, message, status,''' - ''' ackdata, lastactiontime FROM sent ''') + ''' ackdata, lastactiontime FROM sent ''' + ) elif folder == "addressbook": sqlStatementBase = '''SELECT label, address From addressbook ''' else: sqlStatementBase = ( '''SELECT folder, msgid, toaddress, message, fromaddress,''' - ''' subject, received, read FROM inbox ''') + ''' subject, received, read FROM inbox ''' + ) sqlStatementParts = [] sqlArguments = [] if account is not None: @@ -59,7 +61,7 @@ def search_sql( if sqlStatementParts: sqlStatementBase += "WHERE " + " AND ".join(sqlStatementParts) # if folder in ("sent", "draft"): - if folder == "sent" or folder == "draft": + if folder in ("sent", "draft"): sqlStatementBase += \ "ORDER BY lastactiontime DESC limit {0}, {1}".format( start_indx, end_indx) @@ -69,4 +71,4 @@ def search_sql( start_indx, end_indx) # elif folder == "addressbook": # sqlStatementBase += " limit {0}, {1}".format(start_indx, end_indx) - return sqlQuery(sqlStatementBase, sqlArguments) \ No newline at end of file + return sqlQuery(sqlStatementBase, sqlArguments) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index d2371000..45eec8fb 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -81,6 +81,7 @@ class Navigatorss(MDNavigationDrawer): class Inbox(Screen): """Inbox Screen uses screen to show widgets of screens""" + queryreturn = ListProperty() has_refreshed = True account = StringProperty() @@ -301,6 +302,7 @@ class Inbox(Screen): class MyAddress(Screen): """MyAddress screen uses screen to show widgets of screens""" + addresses_list = ListProperty() has_refreshed = True is_add_created = False @@ -316,7 +318,10 @@ class MyAddress(Screen): self.addresses_list = state.kivyapp.variable_1 if state.searcing_text: self.ids.refresh_layout.scroll_y = 1.0 - filtered_list = [x for x in BMConfigParser().addresses() if self.filter_address(x)] + filtered_list = [ + x for x in BMConfigParser().addresses() + if self.filter_address(x) + ] self.addresses_list = filtered_list self.addresses_list = [obj for obj in reversed(self.addresses_list)] self.ids.identi_tag.children[0].text = '' @@ -419,6 +424,7 @@ class MyAddress(Screen): class AddressBook(Screen): """AddressBook Screen uses screen to show widgets of screens""" + queryreturn = ListProperty() has_refreshed = True @@ -530,6 +536,7 @@ class SelectableRecycleBoxLayout( FocusBehavior, LayoutSelectionBehavior, RecycleBoxLayout): """Adds selection and focus behaviour to the view""" # pylint: disable = duplicate-bases + pass @@ -573,6 +580,7 @@ class RV(RecycleView): class DropDownWidget(BoxLayout): """Adding Dropdown Widget""" # pylint: disable=too-many-statements + txt_input = ObjectProperty() rv = ObjectProperty() @@ -613,7 +621,9 @@ class DropDownWidget(BoxLayout): statusIconColor = 'red' if (addressVersionNumber > 4) or ( addressVersionNumber <= 1): - print("addressVersionNumber > 4 or addressVersionNumber <= 1") + print( + "addressVersionNumber > 4" + " or addressVersionNumber <= 1") if streamNumber > 1 or streamNumber == 0: print("streamNumber > 1 or streamNumber == 0") if statusIconColor == 'red': @@ -648,7 +658,8 @@ class DropDownWidget(BoxLayout): if state.detailPageType == 'draft' \ and state.send_draft_mail: state.draft_count = str(int(state.draft_count) - 1) - state.msg_counter_objs.draft_cnt.badge_text = state.draft_count + state.msg_counter_objs.draft_cnt.badge_text = ( + state.draft_count) state.detailPageType = '' state.send_draft_mail = None # self.parent.parent.screens[0].ids.ml.clear_widgets() @@ -766,6 +777,7 @@ class Payment(Screen): class Credits(Screen): """Credits Method""" + available_credits = StringProperty( '{0}'.format('0')) @@ -778,13 +790,15 @@ class Login(Screen): class NetworkStat(Screen): """Method used to show network stat""" + text_variable_1 = StringProperty( '{0}::{1}'.format('Total Connections', '0')) text_variable_2 = StringProperty( 'Processed {0} per-to-per messages'.format('0')) text_variable_3 = StringProperty( 'Processed {0} brodcast messages'.format('0')) - text_variable_4 = StringProperty('Processed {0} public keys'.format('0')) + text_variable_4 = StringProperty( + 'Processed {0} public keys'.format('0')) text_variable_5 = StringProperty( 'Processed {0} object to be synced'.format('0')) @@ -812,11 +826,13 @@ class NetworkStat(Screen): class ContentNavigationDrawer(Navigatorss): """Navigate Content Drawer""" + pass class Random(Screen): """Generates Random Address""" + is_active = BooleanProperty(False) checked = StringProperty("") @@ -877,6 +893,7 @@ class Random(Screen): class Sent(Screen): """Sent Screen uses screen to show widgets of screens""" + queryreturn = ListProperty() has_refreshed = True account = StringProperty() @@ -1100,6 +1117,7 @@ class Sent(Screen): class Trash(Screen): """Trash Screen uses screen to show widgets of screens""" + trash_messages = ListProperty() has_refreshed = True # delete_index = StringProperty() @@ -1231,9 +1249,11 @@ class Trash(Screen): """Deleting message from trash""" self.children[1].active = True if self.table_name == 'inbox': - sqlExecute("DELETE FROM inbox WHERE msgid = ?;", self.delete_index) + sqlExecute( + "DELETE FROM inbox WHERE msgid = ?;", self.delete_index) elif self.table_name == 'sent': - sqlExecute("DELETE FROM sent WHERE ackdata = ?;", self.delete_index) + sqlExecute( + "DELETE FROM sent WHERE ackdata = ?;", self.delete_index) msg_count_objs = state.kivyapp.root.children[2].children[0].ids if int(state.trash_count) > 0: msg_count_objs.trash_cnt.badge_text = str( @@ -1271,6 +1291,7 @@ class Setting(Screen): class NavigateApp(App): """Navigation Layout of class""" # pylint: disable=too-many-public-methods + theme_cls = ThemeManager() previous_date = ObjectProperty() obj_1 = ObjectProperty() @@ -1742,6 +1763,7 @@ class NavigateApp(App): class GrashofPopup(Popup): """Moule for save contacts and error messages""" + valid = False def __init__(self, **kwargs): @@ -1834,7 +1856,9 @@ class GrashofPopup(Popup): elif status == 'missingbm': text = "The address should start with ''BM-''" elif status == 'checksumfailed': - text = "The address is not typed or copied correctly(the checksum failed)." + text = ( + "The address is not typed or copied correctly" + " (the checksum failed).") elif status == 'versiontoohigh': text = ( "The version number of this address is higher than this" @@ -1896,6 +1920,7 @@ class NavigationDrawerTwoLineListItem( class MailDetail(Screen): """MailDetail Screen uses to show the detail of mails""" + to_addr = StringProperty() from_addr = StringProperty() subject = StringProperty() @@ -2043,6 +2068,7 @@ class MailDetail(Screen): class MyaddDetailPopup(Popup): """MyaddDetailPopup pop is used for showing my address detail""" + address_label = StringProperty() address = StringProperty() @@ -2075,6 +2101,7 @@ class MyaddDetailPopup(Popup): class AddbookDetailPopup(Popup): """AddbookDetailPopup pop is used for showing my address detail""" + address_label = StringProperty() address = StringProperty() @@ -2154,6 +2181,7 @@ class ShowQRCode(Screen): class Draft(Screen): """Draft screen is used to show the list of draft messages""" + data = ListProperty() account = StringProperty() queryreturn = ListProperty() @@ -2284,10 +2312,12 @@ class Draft(Screen): sqlExecute("DELETE FROM sent WHERE ackdata = ?;", data_index) try: msg_count_objs = ( - self.parent.parent.parent.parent.parent.children[2].children[0].ids) + self.parent.parent.parent.parent.parent.children[ + 2].children[0].ids) except Exception: - msg_count_objs = self.parent.parent.parent.parent.parent.parent.children[ - 2].children[0].ids + msg_count_objs = ( + self.parent.parent.parent.parent.parent.parent.children[ + 2].children[0].ids) # msg_count_objs = self.parent.parent.parent.parent.parent.children[ # 2].children[0].ids if int(state.draft_count) > 0: @@ -2354,6 +2384,7 @@ class CustomSpinner(Spinner): class Allmails(Screen): """All mails Screen uses screen to show widgets of screens""" + data = ListProperty() has_refreshed = True all_mails = ListProperty() @@ -2489,8 +2520,9 @@ class Allmails(Screen): 2].children[0].ids nav_lay_obj = self.parent.parent.parent.parent.parent.ids except Exception: - msg_count_objs = self.parent.parent.parent.parent.parent.parent.children[ - 2].children[0].ids + msg_count_objs = ( + self.parent.parent.parent.parent.parent.parent.children[ + 2].children[0].ids) nav_lay_obj = self.parent.parent.parent.parent.parent.parent.ids if folder == 'inbox': msg_count_objs.inbox_cnt.badge_text = str( @@ -2584,4 +2616,5 @@ class LoadingPopup(Popup): class AddressDropdown(OneLineIconListItem): """AddressDropdown showns all the addresses""" + pass