From fb44c8aaf711c7b94518e8a9de1d2a51d2ee9265 Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Thu, 8 Aug 2019 13:03:17 +0530 Subject: [PATCH 1/3] Pychecker Fixes --- src/bitmessagekivy/mpybit.py | 76 +++++++++++++----------------------- 1 file changed, 27 insertions(+), 49 deletions(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 53f37dbb..701c3b0b 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -104,12 +104,11 @@ class Inbox(Screen): secondary_text=item['secondary_text'], theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) + img_latter = item['secondary_text'][0].upper() if ( + item['secondary_text'][0].upper() >= 'A' and item[ + 'secondary_text'][0].upper() <= 'Z') else '!' meny.add_widget(AvatarSampleWidget( - source='./images/text_images/{}.png'.format( - item['secondary_text'][0].upper() if ( - item['secondary_text'][0].upper() >= 'A' and item[ - 'secondary_text'][0].upper() <= 'Z') - else '!'))) + source='./images/text_images/{}.png'.format(img_latter))) meny.bind(on_press=partial( self.inbox_detail, item['receivedTime'])) carousel = Carousel(direction='right') @@ -233,12 +232,11 @@ class MyAddress(Screen): secondary_text=item['secondary_text'], theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) + img_latter = item['text'][0].upper() if ( + item['text'][0].upper() >= 'A' and item['text'][ + 0].upper() <= 'Z') else '!' meny.add_widget(AvatarSampleWidget( - source='./images/text_images/{}.png'.format( - item['text'][0].upper() if ( - item['text'][0].upper() >= 'A' and item['text'][ - 0].upper() <= 'Z') - else '!'))) + source='./images/text_images/{}.png'.format(img_latter))) meny.bind(on_press=partial( self.myadd_detail, item['secondary_text'], item['text'])) self.ids.ml.add_widget(meny) @@ -290,12 +288,12 @@ class AddressBook(Screen): Clock.schedule_once(self.init_ui, 0) def init_ui(self, dt=0): - """Clock Schdule for method AddressBook""" + """Clock Schdule for method AddressBook.""" self.loadAddresslist(None, 'All', '') print(dt) def loadAddresslist(self, account, where="", what=""): - """Clock Schdule for method AddressBook""" + """Clock Schdule for method AddressBook.""" if state.searcing_text: where = ['label', 'address'] what = state.searcing_text @@ -309,11 +307,11 @@ class AddressBook(Screen): secondary_text=item[1], theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) + img_latter = item[0][0].upper() if ( + item[0][0].upper() >= 'A' and item[0][ + 0].upper() <= 'Z') else '!' meny.add_widget(AvatarSampleWidget( - source='./images/text_images/{}.png'.format( - item[0][0].upper() if ( - item[0][0].upper() >= 'A' and item[0][ - 0].upper() <= 'Z') else '!'))) + source='./images/text_images/{}.png'.format(img_latter))) meny.bind(on_press=partial( self.addBook_detail, item[1], item[0])) carousel = Carousel(direction='right') @@ -609,7 +607,6 @@ class Random(Screen): def generateaddress(self): """Method for Address Generator.""" - import queues streamNumberForAddress = 1 label = self.ids.label.text eighteenByteRipe = False @@ -690,12 +687,11 @@ class Sent(Screen): secondary_text=item['secondary_text'], theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) + img_latter = item['secondary_text'][0].upper() if ( + item['secondary_text'][0].upper() >= 'A' and item[ + 'secondary_text'][0].upper() <= 'Z') else '!' meny.add_widget(AvatarSampleWidget( - source='./images/text_images/{}.png'.format( - item['secondary_text'][0].upper() if ( - item['secondary_text'][0].upper() >= 'A' and item[ - 'secondary_text'][0].upper() <= 'Z') - else '!'))) + source='./images/text_images/{}.png'.format(img_latter))) meny.bind(on_press=partial( self.sent_detail, item['lastactiontime'])) carousel = Carousel(direction='right') @@ -814,10 +810,11 @@ class Trash(Screen): secondary_text=item[2], theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) + img_latter = item[2][0].upper() if ( + item[2][0].upper() >= 'A' and item[ + 2][0].upper() <= 'Z') else '!' meny.add_widget(AvatarSampleWidget( - source='./images/text_images/{}.png'.format( - item[2][0].upper() if (item[2][0].upper() >= 'A' and item[ - 2][0].upper() <= 'Z') else '!'))) + source='./images/text_images/{}.png'.format(img_latter))) self.ids.ml.add_widget(meny) @@ -894,17 +891,6 @@ class NavigateApp(App): kivyuisignaler.release() super(NavigateApp, self).run() - def show_address_success(self): - """Showing the succesfull address.""" - content = MDLabel(font_style='Body1', - theme_text_color='Secondary', - text="Successfully Saved your contact address. " - "That's pretty awesome right!", - size_hint_y=None, - valign='top') - content.bind(texture_size=content.setter('size')) - self.dialog.open() - @staticmethod def showmeaddresses(name="text"): """Show the addresses in spinner to make as dropdown.""" @@ -961,14 +947,6 @@ class NavigateApp(App): msg_counter_objs.trash_cnt.badge_text = state.trash_count msg_counter_objs.draft_cnt.badge_text = state.draft_count - def getInboxMessageDetail(self, instance): - """Getting message detail after selected message description.""" - try: - self.root.ids._mngr.current = 'page' - except AttributeError: - self.parent.manager.current = 'page' - print('Message Clicked {}'.format(instance)) - @staticmethod def getCurrentAccount(): """It uses to get current account label.""" @@ -1108,7 +1086,7 @@ class NavigateApp(App): def check_search_screen(self, instance): """Method show search button only on inbox or sent screen.""" - if instance.text in ['Inbox', 'Sent', 'Address Book']: + if instance.text in ['Inbox', 'Sent', 'Address Book']: if not self.root.ids.search_bar.children: self.root.ids.search_bar.add_widget( MDIconButton(icon='magnify')) @@ -1550,10 +1528,10 @@ class CustomSpinner(Spinner): def __init__(self, *args, **kwargs): """Method used for setting size of spinner.""" super(CustomSpinner, self).__init__(*args, **kwargs) - max = 2.8 - self.dropdown_cls.max_height = self.height * max + max * 4 + max_value = 2.8 + self.dropdown_cls.max_height = self.height * max_value + max_value * 4 -def remove_search_bar(self): +def remove_search_bar(obj): """Remove search bar.""" - self.parent.parent.parent.parent.parent.ids.search_bar.clear_widgets() + obj.parent.parent.parent.parent.parent.ids.search_bar.clear_widgets() From 862e68445b658a7198468136cfc19ceffa141d3f Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Tue, 13 Aug 2019 18:16:19 +0530 Subject: [PATCH 2/3] Pylint Fixes part1 --- src/bitmessagekivy/mpybit.py | 57 ++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index d87f3b6e..03f1d18b 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -80,7 +80,7 @@ class Inbox(Screen): def init_ui(self, dt=0): """Clock Schdule for method inbox accounts.""" self.inboxaccounts() - print(dt) + print dt def inboxaccounts(self): """Load inbox accounts.""" @@ -103,8 +103,8 @@ class Inbox(Screen): 'text': mail[4].strip(), 'secondary_text': mail[5][:10] + '...........' if len( mail[3]) > 10 else mail[3] + '\n' + " " + ( - third_text[:25] + '...!') if len( - third_text) > 25 else third_text, + third_text[:25] + '...!') if len( + third_text) > 25 else third_text, 'receivedTime': mail[6]}) for item in data: meny = ThreeLineAvatarIconListItem( @@ -198,7 +198,7 @@ class Inbox(Screen): try: self.parent.screens[4].clear_widgets() self.parent.screens[4].add_widget(Trash()) - except Exception as e: + except Exception: self.parent.parent.screens[4].clear_widgets() self.parent.parent.screens[4].add_widget(Trash()) @@ -211,7 +211,7 @@ class Inbox(Screen): self.remove_widget(self.children[1]) try: screens_obj = self.parent.screens[0] - except Exception as e: + except Exception: screens_obj = self.parent.parent.screens[0] screens_obj.add_widget(Inbox()) self.ids.refresh_layout.refresh_done() @@ -270,7 +270,7 @@ class MyAddress(Screen): self.manager.parent.parent\ .parent.ids.search_bar.clear_widgets() self.manager.current = 'login' - except Exception as e: + except Exception: pass def myadd_detail(self, fromaddress, label, *args): @@ -288,7 +288,7 @@ class MyAddress(Screen): self.remove_widget(self.children[1]) try: screens_obj = self.parent.screens[9] - except Exception as e: + except Exception: screens_obj = self.parent.parent.screens[9] screens_obj.add_widget(MyAddress()) self.ids.refresh_layout.refresh_done() @@ -318,7 +318,7 @@ class AddressBook(Screen): def init_ui(self, dt=0): """Clock Schdule for method AddressBook.""" self.loadAddresslist(None, 'All', '') - print(dt) + print dt def loadAddresslist(self, account, where="", what=""): """Clock Schdule for method AddressBook.""" @@ -420,7 +420,7 @@ class SelectableLabel(RecycleDataViewBehavior, Label): """Respond to the selection of items in the view.""" self.selected = is_selected if is_selected: - print("selection changed to {0}".format(rv.data[index])) + print "selection changed to {0}".format(rv.data[index]) rv.parent.txt_input.text = rv.parent.txt_input.text.replace( rv.parent.txt_input.text, rv.data[index]['text']) @@ -446,7 +446,7 @@ class DropDownWidget(BoxLayout): subject = str(self.ids.subject.text) message = str(self.ids.body.text) encoding = 3 - print("message: ", self.ids.body.text) + print "message: ", self.ids.body.text sendMessageToPeople = True if sendMessageToPeople: if toAddress != '' and subject and message: @@ -458,12 +458,12 @@ class DropDownWidget(BoxLayout): toAddress = addBMIfNotPresent(toAddress) 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") + print "streamNumber > 1 or streamNumber == 0" if statusIconColor == 'red': - print("shared.statusIconColor == 'red'") + print "shared.statusIconColor == 'red'" stealthLevel = BMConfigParser().safeGetInt( 'bitmessagesettings', 'ackstealthlevel') from helper_ackPayload import genAckPayload @@ -494,7 +494,7 @@ class DropDownWidget(BoxLayout): self.parent.parent.screens[3].add_widget(Sent()) toLabel = '' queues.workerQueue.put(('sendmessage', toAddress)) - print("sqlExecute successfully #######################") + print "sqlExecute successfully #######################" self.ids.body.text = '' self.ids.ti.text = '' self.ids.subject.text = '' @@ -565,7 +565,7 @@ class MyTextInput(TextInput): self.parent.parent.parent.parent.ids.rv.data = [] matches = [self.word_list[i] for i in range( len(self.word_list)) if self.word_list[ - i][:self.starting_no] == value[:self.starting_no]] + i][:self.starting_no] == value[:self.starting_no]] display_data = [] for i in matches: display_data.append({'text': i}) @@ -656,8 +656,7 @@ class Random(Screen): 4, streamNumberForAddress, label, 1, "", eighteenByteRipe, nonceTrialsPerByte, - payloadLengthExtraBytes) - ) + payloadLengthExtraBytes)) self.manager.current = 'myaddress' self.ids.label.text = '' self.parent.parent.parent.parent.ids.toolbar.opacity = 1 @@ -689,7 +688,7 @@ class Sent(Screen): def init_ui(self, dt=0): """Clock Schdule for method sent accounts.""" self.sentaccounts() - print(dt) + print dt def sentaccounts(self): """Load sent accounts.""" @@ -717,8 +716,8 @@ class Sent(Screen): 'text': mail[1].strip(), 'secondary_text': mail[2][:10] + '...........' if len( mail[2]) > 10 else mail[2] + '\n' + " " + ( - third_text[:25] + '...!') if len( - third_text) > 25 else third_text, + third_text[:25] + '...!') if len( + third_text) > 25 else third_text, 'lastactiontime': mail[6]}) for item in self.data: meny = ThreeLineAvatarIconListItem( @@ -786,7 +785,7 @@ class Sent(Screen): try: msg_count_objs = self.parent.parent.parent.parent.children[ 2].children[0].ids - except Exception as e: + except Exception: msg_count_objs = self.parent.parent.parent.parent.parent.children[ 2].children[0].ids if int(state.sent_count) > 0: @@ -816,7 +815,7 @@ class Sent(Screen): try: self.parent.screens[4].clear_widgets() self.parent.screens[4].add_widget(Trash()) - except Exception as e: + except Exception: self.parent.parent.screens[4].clear_widgets() self.parent.parent.screens[4].add_widget(Trash()) @@ -1065,7 +1064,7 @@ class NavigateApp(App): def on_stop(self): """On stop methos is used for stoping the runing script.""" - print("*******************EXITING FROM APPLICATION*******************") + print "*******************EXITING FROM APPLICATION*******************" import shutdown shutdown.doCleanShutdown() @@ -1461,7 +1460,7 @@ class Draft(Screen): def init_ui(self, dt=0): """Clock Schdule for method draft accounts.""" self.sentaccounts() - print(dt) + print dt def sentaccounts(self): """Load draft accounts.""" @@ -1483,8 +1482,8 @@ class Draft(Screen): 'text': mail[1].strip(), 'secondary_text': mail[2][:10] + '...........' if len( mail[2]) > 10 else mail[2] + '\n' + " " + ( - third_text[:25] + '...!') if len( - third_text) > 25 else third_text, + third_text[:25] + '...!') if len( + third_text) > 25 else third_text, 'lastactiontime': mail[6]}) for item in self.data: meny = TwoLineAvatarIconListItem( @@ -1530,7 +1529,7 @@ class Draft(Screen): try: msg_count_objs = \ self.parent.parent.parent.parent.children[2].children[0].ids - except Exception as e: + except Exception: msg_count_objs = self.parent.parent.parent.parent.parent.children[ 2].children[0].ids if int(state.draft_count) > 0: @@ -1603,5 +1602,5 @@ def remove_search_bar(obj): """Remove search bar.""" try: obj.parent.parent.parent.parent.parent.ids.search_bar.clear_widgets() - except Exception as e: + except Exception: obj.parent.parent.parent.parent.ids.search_bar.clear_widgets() From f7c440fee687269513770fe9565581be1fc0335f Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Sat, 17 Aug 2019 18:13:10 +0530 Subject: [PATCH 3/3] Pylint Fixes part3 --- src/bitmessagekivy/mpybit.py | 170 +++++++++++++++++++---------------- 1 file changed, 91 insertions(+), 79 deletions(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index ff4f12c1..fe57fb20 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -1,51 +1,65 @@ """Coding: utf-8.""" +import time +from functools import partial + +from bmconfigparser import BMConfigParser + +from helper_sql import sqlExecute, sqlQuery + from kivy.app import App +from kivy.clock import Clock +from kivy.core.window import Window from kivy.lang import Builder from kivy.metrics import dp -from kivy.properties import ObjectProperty +from kivy.properties import ( + BooleanProperty, + ListProperty, + NumericProperty, + ObjectProperty, + StringProperty) +from kivy.uix.behaviors import FocusBehavior +from kivy.uix.boxlayout import BoxLayout +from kivy.uix.button import Button +from kivy.uix.carousel import Carousel +from kivy.uix.floatlayout import FloatLayout from kivy.uix.image import Image +from kivy.uix.label import Label +from kivy.uix.popup import Popup +from kivy.uix.recycleboxlayout import RecycleBoxLayout +from kivy.uix.recycleview import RecycleView +from kivy.uix.recycleview.layout import LayoutSelectionBehavior +from kivy.uix.recycleview.views import RecycleDataViewBehavior from kivy.uix.screenmanager import Screen +from kivy.uix.spinner import Spinner +from kivy.uix.textinput import TextInput +from kivy.utils import platform + +import kivy_helper_search + from kivymd.button import MDIconButton from kivymd.dialog import MDDialog from kivymd.label import MDLabel -from kivymd.list import ILeftBody, ILeftBodyTouch, IRightBodyTouch +from kivymd.list import ( + ILeftBody, + ILeftBodyTouch, + IRightBodyTouch, + ThreeLineAvatarIconListItem, + TwoLineAvatarIconListItem, + TwoLineListItem) from kivymd.navigationdrawer import ( MDNavigationDrawer, NavigationDrawerHeaderBase) from kivymd.selectioncontrols import MDCheckbox -from kivymd.theming import ThemeManager -from kivymd.list import ( - ThreeLineAvatarIconListItem, - TwoLineAvatarIconListItem, - TwoLineListItem) -from kivy.properties import ListProperty, StringProperty, BooleanProperty -from kivy.clock import Clock -from bmconfigparser import BMConfigParser -import state -import queues -from kivy.uix.popup import Popup -from helper_sql import sqlQuery, sqlExecute -from kivy.uix.textinput import TextInput -from kivy.uix.boxlayout import BoxLayout -from kivy.uix.floatlayout import FloatLayout -from kivy.properties import NumericProperty -from kivy.uix.recycleview import RecycleView -from kivy.uix.recycleview.views import RecycleDataViewBehavior -from kivy.uix.label import Label -from kivy.uix.recycleboxlayout import RecycleBoxLayout -from kivy.uix.behaviors import FocusBehavior -from kivy.uix.recycleview.layout import LayoutSelectionBehavior -import time -from uikivysignaler import UIkivySignaler -from semaphores import kivyuisignaler -from kivy.uix.button import Button -import kivy_helper_search -from kivy.core.window import Window -from functools import partial -from kivy.uix.carousel import Carousel -from kivy.utils import platform -from kivy.uix.spinner import Spinner from kivymd.textfields import MDTextField +from kivymd.theming import ThemeManager + +import queues + +from semaphores import kivyuisignaler + +import state + +from uikivysignaler import UIkivySignaler def toast(text): @@ -58,7 +72,7 @@ def toast(text): class Navigatorss(MDNavigationDrawer): """Navigators class contains image, title and logo.""" - + # pylint: disable=too-few-public-methods image_source = StringProperty('images/qidenticon_two.png') title = StringProperty('Navigation') drawer_logo = StringProperty() @@ -204,8 +218,8 @@ class Inbox(Screen): self.parent.parent.screens[4].add_widget(Trash()) def refresh_callback(self, *args): - """A method that updates the state of your application.""" - """While the spinner remains on the screen.""" + """Method updates the state of application, \ + While the spinner remains on the screen.""" def refresh_callback(interval): """Method used for loading the inbox screen data.""" self.ids.ml.clear_widgets() @@ -233,8 +247,9 @@ class MyAddress(Screen): """Clock Schdule for method inbox accounts.""" addresses_list = state.kivyapp.variable_1 if state.searcing_text: - filtered_list = filter(lambda addr: self.filter_address( - addr), BMConfigParser().addresses()) + filtered_list = filter( + lambda addr: self.filter_address( + addr), BMConfigParser().addresses()) addresses_list = filtered_list if addresses_list: data = [] @@ -282,8 +297,8 @@ class MyAddress(Screen): p.set_address(fromaddress, label) def refresh_callback(self, *args): - """A method that updates the state of your application.""" - """While the spinner remains on the screen.""" + """Method updates the state of application, \ + While the spinner remains on the screen.""" def refresh_callback(interval): """Method used for loading the myaddress screen data.""" self.ids.ml.clear_widgets() @@ -304,8 +319,7 @@ class MyAddress(Screen): if filter(lambda x: ( state.searcing_text).lower() in x, [ BMConfigParser().get( - address, - 'label').lower(), address.lower()]): + address, 'label').lower(), address.lower()]): return True return False @@ -397,7 +411,7 @@ class AddressBook(Screen): class SelectableRecycleBoxLayout(FocusBehavior, LayoutSelectionBehavior, RecycleBoxLayout): """Adds selection and focus behaviour to the view.""" - + # pylint: disable=too-few-public-methods pass @@ -432,6 +446,7 @@ class SelectableLabel(RecycleDataViewBehavior, Label): class RV(RecycleView): """Recycling View.""" + # pylint: disable=too-few-public-methods def __init__(self, **kwargs): """Recycling Method.""" @@ -592,19 +607,19 @@ class MyTextInput(TextInput): class Payment(Screen): """Payment Method.""" - + # pylint: disable=too-few-public-methods pass class Login(Screen): """Login Screeen.""" - + # pylint: disable=too-few-public-methods pass class NetworkStat(Screen): """Method used to show network stat.""" - + # pylint: disable=too-few-public-methods text_variable_1 = StringProperty( '{0}::{1}'.format('Total Connections', '0')) text_variable_2 = StringProperty( @@ -639,13 +654,13 @@ class NetworkStat(Screen): class ContentNavigationDrawer(Navigatorss): """Navigate Content Drawer.""" - + # pylint: disable=too-few-public-methods pass class Random(Screen): """Generates Random Address.""" - + # pylint: disable=too-few-public-methods is_active = BooleanProperty(False) checked = StringProperty("") @@ -674,7 +689,7 @@ class Random(Screen): class AddressSuccessful(Screen): """Getting Address Detail.""" - + # pylint: disable=too-few-public-methods pass @@ -833,6 +848,7 @@ class Sent(Screen): class Trash(Screen): """Trash Screen uses screen to show widgets of screens.""" + # pylint: disable=too-few-public-methods def __init__(self, *args, **kwargs): """Trash method, delete sent message and add in Trash.""" @@ -846,12 +862,12 @@ class Trash(Screen): state.association = BMConfigParser().addresses()[0] inbox = sqlQuery( - "SELECT toaddress, fromaddress, subject, message, folder from inbox \ - WHERE folder = 'trash' and toaddress = '{}';".format( + "SELECT toaddress, fromaddress, subject, message, folder from \ + inbox WHERE folder = 'trash' and toaddress = '{}';".format( state.association)) sent = sqlQuery( - "SELECT toaddress, fromaddress, subject, message, folder from sent \ - WHERE folder = 'trash' and fromaddress = '{}';".format( + "SELECT toaddress, fromaddress, subject, message, folder from \ + sent WHERE folder = 'trash' and fromaddress = '{}';".format( state.association)) trash_data = inbox + sent @@ -871,12 +887,13 @@ class Trash(Screen): class Page(Screen): """Page Screen show widgets of page.""" - + # pylint: disable=too-few-public-methods pass class Create(Screen): """Creates the screen widgets.""" + # pylint: disable=too-few-public-methods def __init__(self, **kwargs): """Getting Labels and address from addressbook.""" @@ -891,7 +908,7 @@ class Create(Screen): class Setting(Screen): """Setting the Screen components.""" - + # pylint: disable=too-few-public-methods pass @@ -1068,8 +1085,6 @@ class NavigateApp(App): def clear_composer(self): """If slow down the nwe will make new composer edit screen.""" - # self.root.ids.toolbar.left_action_items = '' - # self.root.ids.myButton.opacity = 0 self.root.ids.search_bar.clear_widgets() composer_obj = self.root.ids.sc3.children[0].ids composer_obj.ti.text = '' @@ -1078,7 +1093,7 @@ class NavigateApp(App): composer_obj.subject.text = '' @staticmethod - def on_stop(self): + def on_stop(): """On stop methos is used for stoping the runing script.""" print "*******************EXITING FROM APPLICATION*******************" import shutdown @@ -1117,8 +1132,8 @@ class NavigateApp(App): return state.draft_count elif text == 'All Mails': state.all_count = str(sqlQuery( - "SELECT (SELECT count(*) FROM sent where fromaddress = '{0}' and \ - folder != 'trash' )+(SELECT count(*) FROM inbox where \ + "SELECT (SELECT count(*) FROM sent where fromaddress = '{0}'\ + and folder != 'trash' )+(SELECT count(*) FROM inbox where \ toaddress = '{0}' and folder != 'trash') AS SumCount".format( state.association))[0][0]) return state.all_count @@ -1236,26 +1251,27 @@ class GrashofPopup(Popup): action=lambda *x: self.dialog.dismiss()) self.dialog.open() - def close_pop(self): + @staticmethod + def close_pop(): """Pop is Canceled.""" toast('Canceled') class AvatarSampleWidget(ILeftBody, Image): """Avatar Sample Widget.""" - + # pylint: disable=too-few-public-methods pass class IconLeftSampleWidget(ILeftBodyTouch, MDIconButton): """Left icon sample widget.""" - + # pylint: disable=too-few-public-methods pass class IconRightSampleWidget(IRightBodyTouch, MDCheckbox): """Right icon sample widget.""" - + # pylint: disable=too-few-public-methods pass @@ -1462,6 +1478,7 @@ class AddbookDetailPopup(Popup): class ShowQRCode(Screen): """ShowQRCode Screen uses to show the detail of mails.""" + # pylint: disable=too-few-public-methods def qrdisplay(self): """Method used for showing QR Code.""" @@ -1556,12 +1573,6 @@ class Draft(Screen): def delete_draft(self, data_index, instance, *args): """Method used to delete draft message permanently.""" - # sqlExecute( - # "UPDATE sent SET folder = 'draft, trash' WHERE lastactiontime = {};".format( - # data_index)) - # sqlExecute( - # "UPDATE sent SET folder = 'trash' WHERE lastactiontime = {};".format( - # data_index)) sqlExecute("DELETE FROM sent WHERE lastactiontime = '{}';".format( data_index)) try: @@ -1583,7 +1594,8 @@ class Draft(Screen): self.ids.ml.remove_widget(instance.parent.parent) toast('Deleted') - def draft_msg(self, src_object): + @staticmethod + def draft_msg(src_object): """Method used for saving draft mails.""" # pylint: disable=too-many-locals composer_object = src_object.children[1].children[0].children[ @@ -1635,6 +1647,7 @@ class Draft(Screen): class CustomSpinner(Spinner): """This class is used for setting spinner size.""" + # pylint: disable=too-few-public-methods def __init__(self, *args, **kwargs): """Method used for setting size of spinner.""" @@ -1677,12 +1690,12 @@ class Allmails(Screen): def loadMessagelist(self, account, where="", what=""): """Load Inbox, Sent anf Draft list of messages.""" inbox = sqlQuery( - "SELECT toaddress, fromaddress, subject, message, folder from inbox \ - WHERE folder = 'inbox' and toaddress = '{}';".format( + "SELECT toaddress, fromaddress, subject, message, folder from\ + inbox WHERE folder = 'inbox' and toaddress = '{}';".format( account)) sent_and_draft = sqlQuery( - "SELECT toaddress, fromaddress, subject, message, folder from sent \ - WHERE folder != 'trash' and fromaddress = '{}';".format( + "SELECT toaddress, fromaddress, subject, message, folder from\ + sent WHERE folder != 'trash' and fromaddress = '{}';".format( account)) all_mails = inbox + sent_and_draft @@ -1728,8 +1741,8 @@ class Allmails(Screen): self.ids.ml.add_widget(content) def refresh_callback(self, *args): - """A method that updates the state of your application.""" - """While the spinner remains on the screen.""" + """Method updates the state of application, \ + While the spinner remains on the screen.""" def refresh_callback(interval): """Method used for loading the allmails screen data.""" self.ids.ml.clear_widgets() @@ -1741,5 +1754,4 @@ class Allmails(Screen): screens_obj.add_widget(Allmails()) self.ids.refresh_layout.refresh_done() self.tick = 0 - Clock.schedule_once(refresh_callback, 1)