fixed flake8 CQ fixed for mpybit, language_script and some other modules
This commit is contained in:
parent
67292f2ea0
commit
5be08babf5
|
@ -41,29 +41,29 @@ windowsLanguageMap = {
|
||||||
'zh': 'Chinese',
|
'zh': 'Chinese',
|
||||||
}
|
}
|
||||||
|
|
||||||
current_dir_path = os.path.abspath(os.path.join(__file__ , '../'))
|
current_dir_path = os.path.abspath(os.path.join(__file__, '../'))
|
||||||
main_file = os.path.join(current_dir_path, 'mpybit.py')
|
main_file = os.path.join(current_dir_path, 'mpybit.py')
|
||||||
kv_file = os.path.join(current_dir_path, 'main.kv')
|
kv_file = os.path.join(current_dir_path, 'main.kv')
|
||||||
|
|
||||||
print("Create .po files for Project")
|
print("Create .po files for Project")
|
||||||
|
|
||||||
translation_command = [
|
translation_command = [
|
||||||
'xgettext',
|
'xgettext',
|
||||||
'-Lpython',
|
'-Lpython',
|
||||||
'--output=messages.pot',
|
'--output=messages.pot',
|
||||||
'--from-code=UTF-8',
|
'--from-code=UTF-8',
|
||||||
main_file,
|
main_file,
|
||||||
kv_file
|
kv_file
|
||||||
]
|
]
|
||||||
|
|
||||||
for kv_file in KVFILES:
|
for kv_file in KVFILES:
|
||||||
translation_command.append(f'{current_dir_path}/kv/{kv_file}.kv')
|
translation_command.append(f'{current_dir_path}/kv/{kv_file}.kv')
|
||||||
|
|
||||||
print('translation_command..............', translation_command)
|
# print('translation_command..............', translation_command)
|
||||||
subprocess.run(translation_command, stdout=subprocess.DEVNULL)
|
subprocess.run(translation_command, stdout=subprocess.DEVNULL)
|
||||||
# print("The exit code1 was: %d" % list_files.returncode)
|
# print("The exit code1 was: %d" % list_files.returncode)
|
||||||
|
|
||||||
#this command is used to create seperate dir for mo and po file
|
# this command is used to create seperate dir for mo and po file
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
['mkdir', '-p', 'translations/po'], stdout=subprocess.DEVNULL)
|
['mkdir', '-p', 'translations/po'], stdout=subprocess.DEVNULL)
|
||||||
|
|
||||||
|
@ -73,18 +73,22 @@ for key in windowsLanguageMap.keys():
|
||||||
['touch', f'{current_dir_path}/translations/po/bitmessage_{key}.po'], stdout=subprocess.DEVNULL)
|
['touch', f'{current_dir_path}/translations/po/bitmessage_{key}.po'], stdout=subprocess.DEVNULL)
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
['msgmerge', '--update', '--no-fuzzy-matching', '--backup=off',
|
['msgmerge', '--update', '--no-fuzzy-matching', '--backup=off',
|
||||||
f'{current_dir_path}/translations/po/bitmessage_{key}.po', f'{current_dir_path}/messages.pot'],
|
f'{current_dir_path}/translations/po/bitmessage_{key}.po', f'{current_dir_path}/messages.pot'],
|
||||||
stdout=subprocess.DEVNULL)
|
stdout=subprocess.DEVNULL
|
||||||
|
)
|
||||||
|
|
||||||
print("Create .mo file from .po file")
|
print("Create .mo file from .po file")
|
||||||
|
|
||||||
for key in windowsLanguageMap.keys():
|
for key in windowsLanguageMap.keys():
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
['mkdir', '-p', f'{current_dir_path}/translations/mo/locales/{key}/LC_MESSAGES'],
|
['mkdir', '-p', f'{current_dir_path}/translations/mo/locales/{key}/LC_MESSAGES'],
|
||||||
stdout=subprocess.DEVNULL)
|
stdout=subprocess.DEVNULL
|
||||||
|
)
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
['touch', f'{current_dir_path}/translations/mo/locales/{key}/LC_MESSAGES/langapp.mo'],
|
['touch', f'{current_dir_path}/translations/mo/locales/{key}/LC_MESSAGES/langapp.mo'],
|
||||||
stdout=subprocess.DEVNULL)
|
stdout=subprocess.DEVNULL
|
||||||
|
)
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
['msgfmt', '-c', '-o', f'{current_dir_path}/translations/mo/locales/{key}/LC_MESSAGES/langapp.mo',
|
['msgfmt', '-c', '-o', f'{current_dir_path}/translations/mo/locales/{key}/LC_MESSAGES/langapp.mo',
|
||||||
f'{current_dir_path}/translations/po/bitmessage_{key}.po'], stdout=subprocess.DEVNULL)
|
f'{current_dir_path}/translations/po/bitmessage_{key}.po'], stdout=subprocess.DEVNULL
|
||||||
|
)
|
||||||
|
|
|
@ -312,7 +312,6 @@ class Inbox(Screen):
|
||||||
int(state.sent_count) + int(state.inbox_count))
|
int(state.sent_count) + int(state.inbox_count))
|
||||||
src_mng_obj.allmail_cnt.ids.badge_txt.text = showLimitedCnt(int(state.all_count))
|
src_mng_obj.allmail_cnt.ids.badge_txt.text = showLimitedCnt(int(state.all_count))
|
||||||
|
|
||||||
|
|
||||||
def inboxDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
def inboxDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
||||||
"""This method is used for retrieving inbox data"""
|
"""This method is used for retrieving inbox data"""
|
||||||
self.queryreturn = kivy_helper_search.search_sql(
|
self.queryreturn = kivy_helper_search.search_sql(
|
||||||
|
@ -537,7 +536,7 @@ class MyAddress(Screen):
|
||||||
except Exception:
|
except Exception:
|
||||||
meny.canvas.children[9].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5]
|
meny.canvas.children[9].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5]
|
||||||
meny.add_widget(AvatarSampleWidget(
|
meny.add_widget(AvatarSampleWidget(
|
||||||
source= state.imageDir + '/text_images/{}.png'.format(
|
source=state.imageDir + '/text_images/{}.png'.format(
|
||||||
avatarImageFirstLetter(item['text'].strip()))))
|
avatarImageFirstLetter(item['text'].strip()))))
|
||||||
meny.bind(on_press=partial(
|
meny.bind(on_press=partial(
|
||||||
self.myadd_detail, item['secondary_text'], item['text']))
|
self.myadd_detail, item['secondary_text'], item['text']))
|
||||||
|
@ -578,7 +577,7 @@ class MyAddress(Screen):
|
||||||
if BMConfigParser().get(fromaddress, 'enabled') == 'true':
|
if BMConfigParser().get(fromaddress, 'enabled') == 'true':
|
||||||
obj = MyaddDetailPopup()
|
obj = MyaddDetailPopup()
|
||||||
self.address_label = obj.address_label = label
|
self.address_label = obj.address_label = label
|
||||||
self.text_address = obj.address =fromaddress
|
self.text_address = obj.address = fromaddress
|
||||||
width = .9 if platform == 'android' else .8
|
width = .9 if platform == 'android' else .8
|
||||||
self.myadddetail_popup = MDDialog(
|
self.myadddetail_popup = MDDialog(
|
||||||
type="custom",
|
type="custom",
|
||||||
|
@ -591,14 +590,15 @@ class MyAddress(Screen):
|
||||||
# p.set_address(fromaddress, label)
|
# p.set_address(fromaddress, label)
|
||||||
else:
|
else:
|
||||||
width = .8 if platform == 'android' else .55
|
width = .8 if platform == 'android' else .55
|
||||||
dialog_box=MDDialog(
|
dialog_box = MDDialog(
|
||||||
text='Address is not currently active. Please click on Toggle button to active it.',
|
text='Address is not currently active. Please click on Toggle button to active it.',
|
||||||
size_hint=(width, .25),
|
size_hint=(width, .25),
|
||||||
buttons=[
|
buttons=[
|
||||||
MDFlatButton(
|
MDFlatButton(
|
||||||
text="Ok", on_release=lambda x: callback_for_menu_items("Ok")
|
text="Ok", on_release=lambda x: callback_for_menu_items("Ok")
|
||||||
),
|
),
|
||||||
],)
|
],
|
||||||
|
)
|
||||||
dialog_box.open()
|
dialog_box.open()
|
||||||
|
|
||||||
def callback_for_menu_items(text_item, *arg):
|
def callback_for_menu_items(text_item, *arg):
|
||||||
|
@ -1014,7 +1014,7 @@ class DropDownWidget(BoxLayout):
|
||||||
def address_error_message(self, msg):
|
def address_error_message(self, msg):
|
||||||
"""Generates error message"""
|
"""Generates error message"""
|
||||||
width = .8 if platform == 'android' else .55
|
width = .8 if platform == 'android' else .55
|
||||||
dialog_box=MDDialog(
|
dialog_box = MDDialog(
|
||||||
text=msg,
|
text=msg,
|
||||||
size_hint=(width, .25),
|
size_hint=(width, .25),
|
||||||
buttons=[
|
buttons=[
|
||||||
|
@ -1029,7 +1029,6 @@ class DropDownWidget(BoxLayout):
|
||||||
dialog_box.dismiss()
|
dialog_box.dismiss()
|
||||||
toast(text_item)
|
toast(text_item)
|
||||||
|
|
||||||
|
|
||||||
# @staticmethod
|
# @staticmethod
|
||||||
# def callback_for_menu_items(text_item, *arg):
|
# def callback_for_menu_items(text_item, *arg):
|
||||||
# """Callback of alert box"""
|
# """Callback of alert box"""
|
||||||
|
@ -1061,14 +1060,15 @@ class DropDownWidget(BoxLayout):
|
||||||
def camera_alert(self):
|
def camera_alert(self):
|
||||||
width = .8 if platform == 'android' else .55
|
width = .8 if platform == 'android' else .55
|
||||||
altet_txt = 'Currently this feature is not avaialbe!'if platform == 'android' else 'Camera is not available!'
|
altet_txt = 'Currently this feature is not avaialbe!'if platform == 'android' else 'Camera is not available!'
|
||||||
dialog_box=MDDialog(
|
dialog_box = MDDialog(
|
||||||
text=altet_txt,
|
text=altet_txt,
|
||||||
size_hint=(width, .25),
|
size_hint=(width, .25),
|
||||||
buttons=[
|
buttons=[
|
||||||
MDFlatButton(
|
MDFlatButton(
|
||||||
text="Ok", on_release=lambda x: callback_for_menu_items("Ok")
|
text="Ok", on_release=lambda x: callback_for_menu_items("Ok")
|
||||||
),
|
),
|
||||||
],)
|
],
|
||||||
|
)
|
||||||
dialog_box.open()
|
dialog_box.open()
|
||||||
|
|
||||||
def callback_for_menu_items(text_item, *arg):
|
def callback_for_menu_items(text_item, *arg):
|
||||||
|
@ -1340,8 +1340,8 @@ class Random(Screen):
|
||||||
entered_label = str(self.ids.add_random_bx.children[0].ids.lab.text).strip()
|
entered_label = str(self.ids.add_random_bx.children[0].ids.lab.text).strip()
|
||||||
if not entered_label:
|
if not entered_label:
|
||||||
self.ids.add_random_bx.children[0].ids.lab.focus = True
|
self.ids.add_random_bx.children[0].ids.lab.focus = True
|
||||||
#self.ids.lab.error = True
|
# self.ids.lab.error = True
|
||||||
#self.ids.lab.helper_text = 'This field is required'
|
# self.ids.lab.helper_text = 'This field is required'
|
||||||
streamNumberForAddress = 1
|
streamNumberForAddress = 1
|
||||||
eighteenByteRipe = False
|
eighteenByteRipe = False
|
||||||
nonceTrialsPerByte = 1000
|
nonceTrialsPerByte = 1000
|
||||||
|
@ -1697,7 +1697,7 @@ class Trash(Screen):
|
||||||
theme_text_color='Custom',
|
theme_text_color='Custom',
|
||||||
text_color=ThemeClsColor)
|
text_color=ThemeClsColor)
|
||||||
meny._txt_right_pad = dp(70)
|
meny._txt_right_pad = dp(70)
|
||||||
img_latter =state.imageDir + '/text_images/{}.png'.format(
|
img_latter = state.imageDir + '/text_images/{}.png'.format(
|
||||||
subject[0].upper() if (subject[0].upper() >= 'A' and subject[0].upper() <= 'Z') else '!')
|
subject[0].upper() if (subject[0].upper() >= 'A' and subject[0].upper() <= 'Z') else '!')
|
||||||
meny.add_widget(AvatarSampleWidget(source=img_latter))
|
meny.add_widget(AvatarSampleWidget(source=img_latter))
|
||||||
meny.add_widget(AddTimeWidget(item[7]))
|
meny.add_widget(AddTimeWidget(item[7]))
|
||||||
|
@ -1750,7 +1750,7 @@ class Trash(Screen):
|
||||||
def delete_confirmation(self):
|
def delete_confirmation(self):
|
||||||
"""Show confirmation delete popup"""
|
"""Show confirmation delete popup"""
|
||||||
width = .8 if platform == 'android' else .55
|
width = .8 if platform == 'android' else .55
|
||||||
dialog_box=MDDialog(
|
dialog_box = MDDialog(
|
||||||
text='Are you sure you want to delete this'
|
text='Are you sure you want to delete this'
|
||||||
' message permanently from trash?',
|
' message permanently from trash?',
|
||||||
size_hint=(width, .25),
|
size_hint=(width, .25),
|
||||||
|
@ -1759,7 +1759,7 @@ class Trash(Screen):
|
||||||
text="Yes", on_release=lambda x: callback_for_delete_msg("Yes")
|
text="Yes", on_release=lambda x: callback_for_delete_msg("Yes")
|
||||||
),
|
),
|
||||||
MDFlatButton(
|
MDFlatButton(
|
||||||
text="No",on_release=lambda x: callback_for_delete_msg("No"),
|
text="No", on_release=lambda x: callback_for_delete_msg("No"),
|
||||||
),
|
),
|
||||||
],)
|
],)
|
||||||
dialog_box.open()
|
dialog_box.open()
|
||||||
|
@ -1893,7 +1893,7 @@ class Setting(Screen):
|
||||||
)
|
)
|
||||||
|
|
||||||
def set_caller(self):
|
def set_caller(self):
|
||||||
self.menu.caller= self.ids.drop_item
|
self.menu.caller = self.ids.drop_item
|
||||||
# self.menu.use_icon_item = False
|
# self.menu.use_icon_item = False
|
||||||
self.menu.target_height = 250
|
self.menu.target_height = 250
|
||||||
|
|
||||||
|
@ -1903,7 +1903,7 @@ class Setting(Screen):
|
||||||
|
|
||||||
def change_language(self):
|
def change_language(self):
|
||||||
lang = self.ids.drop_item.current_item
|
lang = self.ids.drop_item.current_item
|
||||||
for k,v in self.languages.items():
|
for k, v in self.languages.items():
|
||||||
if v == lang:
|
if v == lang:
|
||||||
BMConfigParser().set('bitmessagesettings', 'userlocale', k)
|
BMConfigParser().set('bitmessagesettings', 'userlocale', k)
|
||||||
BMConfigParser().save()
|
BMConfigParser().save()
|
||||||
|
@ -1935,10 +1935,10 @@ class NavigateApp(MDApp):
|
||||||
count = 0
|
count = 0
|
||||||
manager_open = False
|
manager_open = False
|
||||||
file_manager = None
|
file_manager = None
|
||||||
#state.imageDir = os.path.join(os.path.abspath(os.path.join(__file__ ,"../../..")),'images', 'kivy')
|
# state.imageDir = os.path.join(os.path.abspath(os.path.join(__file__ ,"../../..")),'images', 'kivy')
|
||||||
state.imageDir = os.path.join('./images', 'kivy')
|
state.imageDir = os.path.join('./images', 'kivy')
|
||||||
image_path = state.imageDir
|
image_path = state.imageDir
|
||||||
tr = Lang("en") # for changing in franch replace en with fr
|
tr = Lang("en") # for changing in franch replace en with fr
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
"""Method builds the widget"""
|
"""Method builds the widget"""
|
||||||
|
@ -2644,6 +2644,7 @@ class NavigateApp(MDApp):
|
||||||
"""This method is used for opening popup"""
|
"""This method is used for opening popup"""
|
||||||
instance.open()
|
instance.open()
|
||||||
|
|
||||||
|
|
||||||
class GrashofPopup(BoxLayout):
|
class GrashofPopup(BoxLayout):
|
||||||
"""Moule for save contacts and error messages"""
|
"""Moule for save contacts and error messages"""
|
||||||
|
|
||||||
|
@ -2710,7 +2711,7 @@ class GrashofPopup(BoxLayout):
|
||||||
text = (
|
text = (
|
||||||
"The address is not typed or copied correctly"
|
"The address is not typed or copied correctly"
|
||||||
# " (the checksum failed)."
|
# " (the checksum failed)."
|
||||||
)
|
)
|
||||||
elif status == 'versiontoohigh':
|
elif status == 'versiontoohigh':
|
||||||
text = (
|
text = (
|
||||||
"The version number of this address is higher than this"
|
"The version number of this address is higher than this"
|
||||||
|
@ -3273,7 +3274,7 @@ class Allmails(Screen):
|
||||||
text_color=ThemeClsColor)
|
text_color=ThemeClsColor)
|
||||||
meny._txt_right_pad = dp(70)
|
meny._txt_right_pad = dp(70)
|
||||||
meny.add_widget(AvatarSampleWidget(
|
meny.add_widget(AvatarSampleWidget(
|
||||||
source= state.imageDir +'/text_images/{}.png'.format(
|
source=state.imageDir + '/text_images/{}.png'.format(
|
||||||
avatarImageFirstLetter(body.strip()))))
|
avatarImageFirstLetter(body.strip()))))
|
||||||
meny.bind(on_press=partial(
|
meny.bind(on_press=partial(
|
||||||
self.mail_detail, item[5], item[4]))
|
self.mail_detail, item[5], item[4]))
|
||||||
|
@ -3554,7 +3555,7 @@ class OneLineListTitle(OneLineListItem):
|
||||||
"""this method is for displaying dialog box"""
|
"""this method is for displaying dialog box"""
|
||||||
self.title_text = title_text
|
self.title_text = title_text
|
||||||
width = .8 if platform == 'android' else .55
|
width = .8 if platform == 'android' else .55
|
||||||
self.dialog_box=MDDialog(
|
self.dialog_box = MDDialog(
|
||||||
text=title_text,
|
text=title_text,
|
||||||
size_hint=(width, .25),
|
size_hint=(width, .25),
|
||||||
buttons=[
|
buttons=[
|
||||||
|
@ -3562,7 +3563,7 @@ class OneLineListTitle(OneLineListItem):
|
||||||
text="Copy", on_release=self.callback_for_copy_title
|
text="Copy", on_release=self.callback_for_copy_title
|
||||||
),
|
),
|
||||||
MDFlatButton(
|
MDFlatButton(
|
||||||
text="Cancel",on_release=self.callback_for_copy_title,
|
text="Cancel", on_release=self.callback_for_copy_title,
|
||||||
),
|
),
|
||||||
],)
|
],)
|
||||||
self.dialog_box.open()
|
self.dialog_box.open()
|
||||||
|
@ -3655,7 +3656,7 @@ class ChatList(Screen):
|
||||||
text=item[0], secondary_text=item[1], theme_text_color='Custom',
|
text=item[0], secondary_text=item[1], theme_text_color='Custom',
|
||||||
text_color=ThemeClsColor)
|
text_color=ThemeClsColor)
|
||||||
meny.add_widget(AvatarSampleWidget(
|
meny.add_widget(AvatarSampleWidget(
|
||||||
source= state.imageDir + '/text_images/{}.png'.format(
|
source=state.imageDir + '/text_images/{}.png'.format(
|
||||||
avatarImageFirstLetter(item[0].strip()))))
|
avatarImageFirstLetter(item[0].strip()))))
|
||||||
meny.bind(on_release=partial(
|
meny.bind(on_release=partial(
|
||||||
self.redirect_to_chat, item[0], item[1]))
|
self.redirect_to_chat, item[0], item[1]))
|
||||||
|
|
|
@ -53,7 +53,6 @@ sys.path.insert(0, app_dir)
|
||||||
depends.check_dependencies()
|
depends.check_dependencies()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _fixSocket():
|
def _fixSocket():
|
||||||
if sys.platform.startswith('linux'):
|
if sys.platform.startswith('linux'):
|
||||||
socket.SO_BINDTODEVICE = 25
|
socket.SO_BINDTODEVICE = 25
|
||||||
|
|
|
@ -126,11 +126,13 @@ class BMConfigParser(configparser.ConfigParser):
|
||||||
def addresses(self, hidden=False):
|
def addresses(self, hidden=False):
|
||||||
|
|
||||||
"""Return a list of local bitmessage addresses (from section labels)"""
|
"""Return a list of local bitmessage addresses (from section labels)"""
|
||||||
return [x for x in BMConfigParser().sections() if x.startswith('BM-') and (hidden or not BMConfigParser().safeGetBoolean(x, 'hidden'))]
|
return [x for x in BMConfigParser().sections() if x.startswith('BM-') and (
|
||||||
|
hidden or not BMConfigParser().safeGetBoolean(x, 'hidden'))]
|
||||||
|
|
||||||
def paymentaddress(self):
|
def paymentaddress(self):
|
||||||
"""Return a list of local payment addresses (from section labels)"""
|
"""Return a list of local payment addresses (from section labels)"""
|
||||||
return ''.join([x for x in BMConfigParser().sections() if x.startswith('BM-') and BMConfigParser().safeGetBoolean(x, 'payment')])
|
return ''.join([x for x in BMConfigParser().sections() if x.startswith(
|
||||||
|
'BM-') and BMConfigParser().safeGetBoolean(x, 'payment')])
|
||||||
|
|
||||||
def read(self, filenames):
|
def read(self, filenames):
|
||||||
configparser.ConfigParser.read(self, filenames)
|
configparser.ConfigParser.read(self, filenames)
|
||||||
|
|
|
@ -79,7 +79,6 @@ def search_sql(
|
||||||
return sqlQuery(sqlStatementBase, sqlArguments)
|
return sqlQuery(sqlStatementBase, sqlArguments)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def check_match(
|
def check_match(
|
||||||
toAddress, fromAddress, subject, message, where=None, what=None):
|
toAddress, fromAddress, subject, message, where=None, what=None):
|
||||||
"""
|
"""
|
||||||
|
|
Reference in New Issue
Block a user