fixed pylint CQ issues

This commit is contained in:
navjot 2021-05-31 13:24:40 +05:30
parent 9333ade8cc
commit 17447683fe
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C
10 changed files with 126 additions and 135 deletions

View File

@ -32,6 +32,7 @@ class AddressBook(Screen):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
"""Getting AddressBook Details""" """Getting AddressBook Details"""
super(AddressBook, self).__init__(*args, **kwargs) super(AddressBook, self).__init__(*args, **kwargs)
self.addbook_popup = None
Clock.schedule_once(self.init_ui, 0) Clock.schedule_once(self.init_ui, 0)
def init_ui(self, dt=0): def init_ui(self, dt=0):

View File

@ -1,4 +1,3 @@
import os
from datetime import datetime from datetime import datetime
from kivy.core.window import Window from kivy.core.window import Window
from kivy.lang import Builder from kivy.lang import Builder
@ -10,6 +9,7 @@ from kivymd.uix.list import (
from kivy.uix.image import Image from kivy.uix.image import Image
from kivymd.uix.label import MDLabel from kivymd.uix.label import MDLabel
from bitmessagekivy.get_platform import platform from bitmessagekivy.get_platform import platform
from kivymd.toast import kivytoast
from kivymd.uix.card import MDCardSwipe from kivymd.uix.card import MDCardSwipe
from kivymd.uix.chip import MDChip from kivymd.uix.chip import MDChip
from kivy.properties import ( from kivy.properties import (
@ -49,34 +49,29 @@ def chipTag(text):
return obj return obj
def initailize_detail_page(manager): # def initailize_detail_page(manager):
if not manager.has_screen( # if not manager.has_screen(
data_screens['MailDetail']["name_screen"] # data_screens['MailDetail']["name_screen"]
): # ):
Builder.load_file( # Builder.load_file(
os.path.join( # os.path.join(
# os.environ["KITCHEN_SINK_ROOT"], # # os.environ["KITCHEN_SINK_ROOT"],
os.path.dirname(os.path.dirname(__file__)), # os.path.dirname(os.path.dirname(__file__)),
"kv", # "kv",
"maildetail.kv", # "maildetail.kv",
) # )
) # )
if "Import" in data_screens['MailDetail']: # if "Import" in data_screens['MailDetail']:
exec(data_screens['MailDetail']["Import"]) # exec(data_screens['MailDetail']["Import"])
screen_object = eval(data_screens['MailDetail']["Factory"]) # screen_object = eval(data_screens['MailDetail']["Factory"])
data_screens['MailDetail']["object"] = screen_object # data_screens['MailDetail']["object"] = screen_object
manager.add_widget(screen_object) # manager.add_widget(screen_object)
manager.current = data_screens['MailDetail']["name_screen"] # manager.current = data_screens['MailDetail']["name_screen"]
def toast(text): def toast(text):
"""Method will display the toast message""" """Method will display the toast message"""
# pylint: disable=redefined-outer-name kivytoast.toast(text)
from kivymd.toast.kivytoast import toast
toast(text)
return None
def showLimitedCnt(total_msg): def showLimitedCnt(total_msg):
"""This method set the total count limit in badge_text""" """This method set the total count limit in badge_text"""
@ -97,7 +92,7 @@ def avatarImageFirstLetter(letter_string):
return img_latter if img_latter else '!' return img_latter if img_latter else '!'
def AddTimeWidget(time): # pylint: disable=redefined-outer-name def AddTimeWidget(time): # pylint: disable=redefined-outer-name, W0201
"""This method is used to create TimeWidget""" """This method is used to create TimeWidget"""
action_time = TimeTagRightSampleWidget( action_time = TimeTagRightSampleWidget(
text=str(ShowTimeHistoy(time)), text=str(ShowTimeHistoy(time)),
@ -123,6 +118,7 @@ def ShowTimeHistoy(act_time):
return display_data return display_data
# pylint: disable=too-few-public-methods
class AvatarSampleWidget(ILeftBody, Image): class AvatarSampleWidget(ILeftBody, Image):
"""AvatarSampleWidget class for kivy Ui""" """AvatarSampleWidget class for kivy Ui"""
@ -132,6 +128,7 @@ class TimeTagRightSampleWidget(IRightBodyTouch, MDLabel):
class SwipeToDeleteItem(MDCardSwipe): class SwipeToDeleteItem(MDCardSwipe):
"""Swipe delete class for App UI"""
text = StringProperty() text = StringProperty()
cla = Window.size[0] / 2 cla = Window.size[0] / 2
# cla = 800 # cla = 800
@ -140,6 +137,7 @@ class SwipeToDeleteItem(MDCardSwipe):
class CutsomSwipeToDeleteItem(MDCardSwipe): class CutsomSwipeToDeleteItem(MDCardSwipe):
"""Custom swipe delete class for App UI"""
text = StringProperty() text = StringProperty()
cla = Window.size[0] / 2 cla = Window.size[0] / 2
swipe_distance = NumericProperty(cla) swipe_distance = NumericProperty(cla)

View File

@ -84,10 +84,7 @@ class DropDownWidget(BoxLayout):
toAddress = self.ids.txt_input.text.strip() toAddress = self.ids.txt_input.text.strip()
subject = self.ids.subject.text.strip() subject = self.ids.subject.text.strip()
message = self.ids.body.text.strip() message = self.ids.body.text.strip()
encoding = 3
print("message: ", self.ids.body.text) print("message: ", self.ids.body.text)
sendMessageToPeople = True
if sendMessageToPeople:
if toAddress != "" and subject and message: if toAddress != "" and subject and message:
status, addressVersionNumber, streamNumber, ripe = decodeAddress( status, addressVersionNumber, streamNumber, ripe = decodeAddress(
toAddress toAddress
@ -114,8 +111,7 @@ class DropDownWidget(BoxLayout):
# state.send_draft_mail = None # state.send_draft_mail = None
else: else:
from addresses import addBMIfNotPresent from addresses import addBMIfNotPresent
toAddress = addBMIfNotPresent(toAddress) # toAddress = addBMIfNotPresent(toAddress)
statusIconColor = 'red'
if (addressVersionNumber > 4) or ( if (addressVersionNumber > 4) or (
addressVersionNumber <= 1): addressVersionNumber <= 1):
print( print(
@ -123,30 +119,28 @@ class DropDownWidget(BoxLayout):
" or addressVersionNumber <= 1") " or addressVersionNumber <= 1")
if streamNumber > 1 or streamNumber == 0: 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'")
stealthLevel = BMConfigParser().safeGetInt( stealthLevel = BMConfigParser().safeGetInt(
'bitmessagesettings', 'ackstealthlevel') 'bitmessagesettings', 'ackstealthlevel')
from helper_ackPayload import genAckPayload from helper_ackPayload import genAckPayload
ackdata = genAckPayload(streamNumber, stealthLevel) # ackdata = genAckPayload(streamNumber, stealthLevel)
# t = () # t = ()
sqlExecute( sqlExecute(
'''INSERT INTO sent VALUES '''INSERT INTO sent VALUES
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''',
'', '',
toAddress, addBMIfNotPresent(toAddress),
ripe, ripe,
fromAddress, fromAddress,
subject, subject,
message, message,
ackdata, genAckPayload(streamNumber, stealthLevel), #ackdata
int(time.time()), int(time.time()),
int(time.time()), int(time.time()),
0, 0,
'msgqueued', 'msgqueued',
0, 0,
'sent', 'sent',
encoding, 3, #encoding
BMConfigParser().safeGetInt( BMConfigParser().safeGetInt(
'bitmessagesettings', 'ttl')) 'bitmessagesettings', 'ttl'))
state.check_sent_acc = fromAddress state.check_sent_acc = fromAddress
@ -164,7 +158,7 @@ class DropDownWidget(BoxLayout):
allmailCnt_obj.ids.badge_txt.text = showLimitedCnt(int(state.all_count) + 1) allmailCnt_obj.ids.badge_txt.text = showLimitedCnt(int(state.all_count) + 1)
state.all_count = str(int(state.all_count) + 1) state.all_count = str(int(state.all_count) + 1)
Clock.schedule_once(self.callback_for_msgsend, 3) Clock.schedule_once(self.callback_for_msgsend, 3)
queues.workerQueue.put(('sendmessage', toAddress)) queues.workerQueue.put(('sendmessage', addBMIfNotPresent(toAddress)))
print("sqlExecute successfully #######################") print("sqlExecute successfully #######################")
state.in_composer = True state.in_composer = True
return return

View File

@ -2,7 +2,7 @@ from bitmessagekivy.get_platform import platform
from functools import partial from functools import partial
from bmconfigparser import BMConfigParser from bmconfigparser import BMConfigParser
from kivy.clock import Clock from kivy.clock import Clock
from kivy.metrics import dp # from kivy.metrics import dp
from kivy.properties import ( from kivy.properties import (
ListProperty, ListProperty,
StringProperty StringProperty
@ -100,7 +100,7 @@ class MyAddress(Screen):
text=item['text'], secondary_text=item['secondary_text'], text=item['text'], secondary_text=item['secondary_text'],
theme_text_color='Custom' if is_enable == 'true' else 'Primary', theme_text_color='Custom' if is_enable == 'true' else 'Primary',
text_color=ThemeClsColor,) text_color=ThemeClsColor,)
meny._txt_right_pad = dp(70) # meny._txt_right_pad = dp(70)
try: try:
meny.canvas.children[3].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5] meny.canvas.children[3].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5]
except Exception: except Exception:
@ -191,7 +191,7 @@ class MyAddress(Screen):
self.ids.ml.clear_widgets() self.ids.ml.clear_widgets()
self.init_ui() self.init_ui()
self.ids.refresh_layout.refresh_done() self.ids.refresh_layout.refresh_done()
self.tick = 0 # self.tick = 0
Clock.schedule_once(self.address_permision_callback, 0) Clock.schedule_once(self.address_permision_callback, 0)
Clock.schedule_once(refresh_callback, 1) Clock.schedule_once(refresh_callback, 1)

View File

@ -4,6 +4,8 @@ from kivy.clock import Clock
from kivy.properties import StringProperty from kivy.properties import StringProperty
from kivy.uix.screenmanager import Screen from kivy.uix.screenmanager import Screen
from network import objectracker, stats
class NetworkStat(Screen): class NetworkStat(Screen):
"""NetworkStat class for kivy Ui""" """NetworkStat class for kivy Ui"""
@ -26,10 +28,8 @@ class NetworkStat(Screen):
def init_ui(self, dt=0): def init_ui(self, dt=0):
"""Clock Schdule for method networkstat screen""" """Clock Schdule for method networkstat screen"""
import network.stats
from network import objectracker
self.text_variable_1 = '{0} :: {1}'.format( self.text_variable_1 = '{0} :: {1}'.format(
'Total Connections', str(len(network.stats.connectedHostsList()))) 'Total Connections', str(len(stats.connectedHostsList())))
self.text_variable_2 = 'Processed {0} per-to-per messages'.format( self.text_variable_2 = 'Processed {0} per-to-per messages'.format(
str(state.numberOfMessagesProcessed)) str(state.numberOfMessagesProcessed))
self.text_variable_3 = 'Processed {0} brodcast messages'.format( self.text_variable_3 = 'Processed {0} brodcast messages'.format(

View File

@ -11,10 +11,10 @@ from kivymd.uix.list import (
OneLineAvatarIconListItem OneLineAvatarIconListItem
) )
from bmconfigparser import BMConfigParser # from bmconfigparser import BMConfigParser
from bitmessagekivy.baseclass.common import toast from bitmessagekivy.baseclass.common import toast
import queues # import queues
import state import state

View File

@ -203,7 +203,6 @@ class SenderDetailPopup(Popup):
device_type = 2 if platform == 'android' else 1.5 device_type = 2 if platform == 'android' else 1.5
pop_height = 1.2 * device_type * (self.ids.sd_label.height + self.ids.dismiss_btn.height) pop_height = 1.2 * device_type * (self.ids.sd_label.height + self.ids.dismiss_btn.height)
if len(to_addr) > 3: if len(to_addr) > 3:
self.height = 0
self.height = pop_height self.height = pop_height
self.ids.to_addId.size_hint_y = None self.ids.to_addId.size_hint_y = None
self.ids.to_addId.height = 50 self.ids.to_addId.height = 50
@ -215,7 +214,6 @@ class SenderDetailPopup(Popup):
self.ids.space_1.height = dp(0) self.ids.space_1.height = dp(0)
self.ids.space_2.height = dp(0) self.ids.space_2.height = dp(0)
self.ids.myadd_popup_box.spacing = dp(8 if platform == 'android' else 3) self.ids.myadd_popup_box.spacing = dp(8 if platform == 'android' else 3)
self.height = 0
self.height = pop_height / 1.2 self.height = pop_height / 1.2

View File

@ -26,7 +26,7 @@ class Trash(Screen):
trash_messages = ListProperty() trash_messages = ListProperty()
has_refreshed = True has_refreshed = True
# delete_index = StringProperty() delete_index = None
table_name = StringProperty() table_name = StringProperty()
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -106,10 +106,8 @@ class Trash(Screen):
self.ids.ml.children) else False self.ids.ml.children) else False
def on_swipe_complete(self, instance, *args): def on_swipe_complete(self, instance, *args):
if instance.state == 'closed': """call on swipe left"""
instance.ids.delete_msg.disabled = True instance.ids.delete_msg.disabled = bool(instance.state == 'closed')
else:
instance.ids.delete_msg.disabled = False
def check_scroll_y(self, instance, somethingelse): def check_scroll_y(self, instance, somethingelse):
"""Load data on scroll""" """Load data on scroll"""

View File

@ -235,7 +235,8 @@ class NavigateApp(MDApp):
os.path.join( os.path.join(
os.path.dirname(__file__), os.path.dirname(__file__),
'kv', 'kv',
f'{all_data[kv]["kv_string"]}.kv', # f'{all_data[kv]["kv_string"]}.kv',
'{0}.kv'.format(all_data[kv]["kv_string"]),
) )
) )
# self.obj_1 = AddressBook() # self.obj_1 = AddressBook()
@ -957,7 +958,8 @@ class NavigateApp(MDApp):
add_obj.content_cls.ids.address.text = text add_obj.content_cls.ids.address.text = text
Clock.schedule_once(partial(self.open_popup, add_obj), .5) Clock.schedule_once(partial(self.open_popup, add_obj), .5)
def open_popup(self, instance, dt): @staticmethod
def open_popup(instance, dt):
"""This method is used for opening popup""" """This method is used for opening popup"""
instance.open() instance.open()