Skip to content

Commit 137a10d

Browse files
authored
Merge pull request Bitmessage#14 from navjotcis/UiChanges
code quality stuff fixes with enhancement in kivy app
2 parents ec7e84a + 8e5da52 commit 137a10d

16 files changed

Lines changed: 311 additions & 285 deletions

File tree

src/bitmessagekivy/android/python-for-android/recipes/kivymd/__init__.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
from os import environ
2-
from os.path import exists, join
1+
"""
2+
src/bitmessagekivy/android/python-for-android/recipes/kivymd/__init__.py
3+
=================================
4+
"""
5+
# pylint: disable=import-error
6+
from os.path import join
37

4-
import sh
5-
from pythonforandroid.logger import shprint, info_main, info
68
from pythonforandroid.recipe import PythonRecipe
79
# from pythonforandroid.util import ensure_dir
810

911

1012
class KivyMDRecipe(PythonRecipe):
11-
# This recipe installs KivyMD into the android dist from source
13+
"""This recipe installs KivyMD into the android dist from source"""
1214
version = 'master'
1315
url = 'https://github.com/surbhicis/kivymd/archive/master.zip'
1416
depends = ['kivy']
1517
site_packages_name = 'kivymd'
1618
call_hostpython_via_targetpython = False
1719

18-
def should_build(self, arch):
20+
def should_build(self, arch): # pylint: disable=no-self-use, unused-argument
21+
"""Method helps to build the application"""
1922
return True
2023

2124
def get_recipe_env(self, arch):
25+
"""Method is used for getting all the env paths"""
2226
env = super(KivyMDRecipe, self).get_recipe_env(arch)
2327
env['PYTHON_ROOT'] = self.ctx.get_python_install_dir()
2428
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7'
@@ -30,8 +34,7 @@ def get_recipe_env(self, arch):
3034
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include'),
3135
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_image'),
3236
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_mixer'),
33-
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'),
34-
])
37+
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'), ])
3538
return env
3639

3740

src/bitmessagekivy/identiconGeneration.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
src/identiconGeneration.py
33
=================================
44
"""
5+
# pylint: disable=import-error
56
import hashlib
7+
from io import BytesIO
8+
69
from PIL import Image
710
from kivy.core.image import Image as CoreImage
811
from kivy.uix.image import Image as kiImage
9-
from io import BytesIO
1012
""" Core classes for loading images and converting them to a Texture.
1113
The raw image data can be keep in memory for further access """
1214

src/bitmessagekivy/kivy_helper_search.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
from helper_sql import *
1+
"""
2+
src/bitmessagekivy/kivy_helper_search.py
3+
=================================
4+
"""
5+
from helper_sql import sqlQuery
26

37

48
def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, what=None, unreadOnly=False):
9+
"""Method helping for searching mails"""
10+
# pylint: disable=too-many-arguments, too-many-branches
511
if what is not None and what != "":
612
what = "%" + what + "%"
713
else:
814
what = None
915

1016
if folder == "sent" or folder == "draft":
1117
sqlStatementBase = '''
12-
SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime
18+
SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime
1319
FROM sent '''
1420
elif folder == "addressbook":
1521
sqlStatementBase = '''SELECT label, address From addressbook '''
@@ -27,7 +33,7 @@ def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, w
2733
else:
2834
sqlStatementParts.append(xAddress + " = ? ")
2935
sqlArguments.append(account)
30-
if folder is not "addressbook":
36+
if folder != "addressbook":
3137
if folder is not None:
3238
if folder == "new":
3339
folder = "inbox"
@@ -50,10 +56,10 @@ def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, w
5056
sqlStatementParts.append(filter_col)
5157
if unreadOnly:
5258
sqlStatementParts.append("read = 0")
53-
if len(sqlStatementParts) > 0:
59+
if sqlStatementParts:
5460
sqlStatementBase += "WHERE " + " AND ".join(sqlStatementParts)
5561
if folder == "sent":
5662
sqlStatementBase += " ORDER BY lastactiontime DESC"
5763
elif folder == "inbox":
5864
sqlStatementBase += " ORDER BY received DESC"
59-
return sqlQuery(sqlStatementBase, sqlArguments)
65+
return sqlQuery(sqlStatementBase, sqlArguments)

0 commit comments

Comments
 (0)