commit
c08f196ad0
|
@ -31,7 +31,7 @@ import shared
|
||||||
import shutdown
|
import shutdown
|
||||||
import state
|
import state
|
||||||
|
|
||||||
from addresses import addBMIfNotPresent, calculateInventoryHash, decodeAddress, decodeVarint, varintDecodeError
|
from addresses import addBMIfNotPresent, calculateInventoryHash, decodeAddress, decodeVarint, varintDecodeError
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
from debug import logger
|
from debug import logger
|
||||||
from helper_ackPayload import genAckPayload
|
from helper_ackPayload import genAckPayload
|
||||||
|
|
|
@ -47,12 +47,8 @@ from kivymd.uix.list import (
|
||||||
ILeftBodyTouch,
|
ILeftBodyTouch,
|
||||||
IRightBodyTouch,
|
IRightBodyTouch,
|
||||||
TwoLineAvatarIconListItem,
|
TwoLineAvatarIconListItem,
|
||||||
TwoLineListItem,
|
|
||||||
OneLineIconListItem,
|
OneLineIconListItem,
|
||||||
OneLineAvatarListItem,
|
|
||||||
IRightBody,
|
|
||||||
OneLineAvatarIconListItem,
|
OneLineAvatarIconListItem,
|
||||||
IRightBodyTouch,
|
|
||||||
OneLineListItem
|
OneLineListItem
|
||||||
)
|
)
|
||||||
# from kivymd.uix.navigationdrawer import (
|
# from kivymd.uix.navigationdrawer import (
|
||||||
|
@ -60,7 +56,6 @@ from kivymd.uix.list import (
|
||||||
# NavigationDrawerHeaderBase
|
# NavigationDrawerHeaderBase
|
||||||
# )
|
# )
|
||||||
from kivymd.uix.selectioncontrol import MDCheckbox
|
from kivymd.uix.selectioncontrol import MDCheckbox
|
||||||
from kivymd.theming import ThemeManager
|
|
||||||
|
|
||||||
import queues
|
import queues
|
||||||
from semaphores import kivyuisignaler
|
from semaphores import kivyuisignaler
|
||||||
|
@ -69,10 +64,12 @@ import state
|
||||||
from addresses import decodeAddress
|
from addresses import decodeAddress
|
||||||
|
|
||||||
|
|
||||||
KVFILES = ['settings', 'popup', 'allmails', 'draft',
|
KVFILES = [
|
||||||
'maildetail', 'common_widgets', 'addressbook',
|
'settings', 'popup', 'allmails', 'draft',
|
||||||
'myaddress', 'composer', 'payment', 'sent',
|
'maildetail', 'common_widgets', 'addressbook',
|
||||||
'network', 'login', 'credits', 'trash', 'inbox']
|
'myaddress', 'composer', 'payment', 'sent',
|
||||||
|
'network', 'login', 'credits', 'trash', 'inbox'
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def toast(text):
|
def toast(text):
|
||||||
|
@ -151,7 +148,7 @@ class Inbox(Screen):
|
||||||
valign='top')
|
valign='top')
|
||||||
self.ids.ml.add_widget(content)
|
self.ids.ml.add_widget(content)
|
||||||
|
|
||||||
def set_inboxCount(self, msgCnt):
|
def set_inboxCount(self, msgCnt): # pylint: disable=no-self-use
|
||||||
"""This method is used to sent inbox message count"""
|
"""This method is used to sent inbox message count"""
|
||||||
src_mng_obj = state.kivyapp.root.ids.content_drawer.ids.inbox_cnt
|
src_mng_obj = state.kivyapp.root.ids.content_drawer.ids.inbox_cnt
|
||||||
src_mng_obj.children[0].children[0].text = showLimitedCnt(int(msgCnt))
|
src_mng_obj.children[0].children[0].text = showLimitedCnt(int(msgCnt))
|
||||||
|
@ -386,7 +383,7 @@ class MyAddress(Screen):
|
||||||
def refresh_callback(interval):
|
def refresh_callback(interval):
|
||||||
"""Method used for loading the myaddress screen data"""
|
"""Method used for loading the myaddress screen data"""
|
||||||
state.searcing_text = ''
|
state.searcing_text = ''
|
||||||
#state.kivyapp.root.ids.sc10.children[2].active = False
|
# state.kivyapp.root.ids.sc10.children[2].active = False
|
||||||
# self.children[2].children[2].ids.search_field.text = ''
|
# self.children[2].children[2].ids.search_field.text = ''
|
||||||
self.children[3].children[2].ids.search_field.text = ''
|
self.children[3].children[2].ids.search_field.text = ''
|
||||||
self.has_refreshed = True
|
self.has_refreshed = True
|
||||||
|
@ -539,7 +536,7 @@ class SelectableLabel(RecycleDataViewBehavior, Label):
|
||||||
return super(SelectableLabel, self).refresh_view_attrs(
|
return super(SelectableLabel, self).refresh_view_attrs(
|
||||||
rv, index, data)
|
rv, index, data)
|
||||||
|
|
||||||
def on_touch_down(self, touch):
|
def on_touch_down(self, touch): # pylint: disable=inconsistent-return-statements
|
||||||
"""Add selection on touch down"""
|
"""Add selection on touch down"""
|
||||||
if super(SelectableLabel, self).on_touch_down(touch):
|
if super(SelectableLabel, self).on_touch_down(touch):
|
||||||
return True
|
return True
|
||||||
|
@ -1136,7 +1133,7 @@ class Trash(Screen):
|
||||||
" ORDER BY actionTime DESC limit {1}, {2}".format(
|
" ORDER BY actionTime DESC limit {1}, {2}".format(
|
||||||
state.association, start_indx, end_indx))
|
state.association, start_indx, end_indx))
|
||||||
|
|
||||||
def set_TrashCnt(self, Count):
|
def set_TrashCnt(self, Count): # pylint: disable=no-self-use
|
||||||
"""This method is used to set trash message count"""
|
"""This method is used to set trash message count"""
|
||||||
trashCnt_obj = state.kivyapp.root.ids.content_drawer.ids.trash_cnt
|
trashCnt_obj = state.kivyapp.root.ids.content_drawer.ids.trash_cnt
|
||||||
trashCnt_obj.children[0].children[0].text = showLimitedCnt(int(Count))
|
trashCnt_obj.children[0].children[0].text = showLimitedCnt(int(Count))
|
||||||
|
@ -1284,7 +1281,7 @@ class NavigateApp(MDApp):
|
||||||
"""Method builds the widget"""
|
"""Method builds the widget"""
|
||||||
for kv_file in KVFILES:
|
for kv_file in KVFILES:
|
||||||
Builder.load_file(
|
Builder.load_file(
|
||||||
os.path.join(os.path.dirname(__file__),f"kv/{kv_file}.kv"))
|
os.path.join(os.path.dirname(__file__), f"kv/{kv_file}.kv"))
|
||||||
self.obj_1 = AddressBook()
|
self.obj_1 = AddressBook()
|
||||||
kivysignalthread = UIkivySignaler()
|
kivysignalthread = UIkivySignaler()
|
||||||
kivysignalthread.daemon = True
|
kivysignalthread.daemon = True
|
||||||
|
@ -1408,6 +1405,7 @@ class NavigateApp(MDApp):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def on_key(self, window, key, *args):
|
def on_key(self, window, key, *args):
|
||||||
|
# pylint: disable=inconsistent-return-statements
|
||||||
"""Method is used for going on previous screen"""
|
"""Method is used for going on previous screen"""
|
||||||
if key == 27:
|
if key == 27:
|
||||||
if state.in_search_mode and self.root.ids.scr_mngr.current != (
|
if state.in_search_mode and self.root.ids.scr_mngr.current != (
|
||||||
|
@ -1469,7 +1467,7 @@ class NavigateApp(MDApp):
|
||||||
|
|
||||||
def loadMyAddressScreen(self, action):
|
def loadMyAddressScreen(self, action):
|
||||||
"""loadMyAddressScreen method spin the loader"""
|
"""loadMyAddressScreen method spin the loader"""
|
||||||
if len(self.root.ids.sc10.children) <=3:
|
if len(self.root.ids.sc10.children) <= 3:
|
||||||
self.root.ids.sc10.children[1].active = action
|
self.root.ids.sc10.children[1].active = action
|
||||||
else:
|
else:
|
||||||
self.root.ids.sc10.children[2].active = action
|
self.root.ids.sc10.children[2].active = action
|
||||||
|
@ -1681,7 +1679,7 @@ class NavigateApp(MDApp):
|
||||||
"""Show identicon in address spinner"""
|
"""Show identicon in address spinner"""
|
||||||
img = identiconGeneration.generate(text)
|
img = identiconGeneration.generate(text)
|
||||||
self.root.children[0].children[0].ids.btn.children[1].texture = (img.texture)
|
self.root.children[0].children[0].ids.btn.children[1].texture = (img.texture)
|
||||||
#below line is for displaing logo
|
# below line is for displaing logo
|
||||||
self.root.ids.content_drawer.ids.top_box.children[0].texture = (img.texture)
|
self.root.ids.content_drawer.ids.top_box.children[0].texture = (img.texture)
|
||||||
|
|
||||||
def set_mail_detail_header(self):
|
def set_mail_detail_header(self):
|
||||||
|
@ -1735,7 +1733,7 @@ class NavigateApp(MDApp):
|
||||||
except Exception:
|
except Exception:
|
||||||
self.root.ids.sc17.children[0].children[1].active = False
|
self.root.ids.sc17.children[0].children[1].active = False
|
||||||
|
|
||||||
def on_request_close(self, *args):
|
def on_request_close(self, *args): # pylint: disable=no-self-use
|
||||||
"""This method is for app closing request"""
|
"""This method is for app closing request"""
|
||||||
AppClosingPopup().open()
|
AppClosingPopup().open()
|
||||||
return True
|
return True
|
||||||
|
@ -1874,7 +1872,6 @@ class IconRightSampleWidget(IRightBodyTouch, MDCheckbox):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MailDetail(Screen):
|
class MailDetail(Screen):
|
||||||
"""MailDetail Screen uses to show the detail of mails"""
|
"""MailDetail Screen uses to show the detail of mails"""
|
||||||
|
|
||||||
|
@ -2128,8 +2125,8 @@ class ShowQRCode(Screen):
|
||||||
from kivy.garden.qrcode import QRCodeWidget
|
from kivy.garden.qrcode import QRCodeWidget
|
||||||
try:
|
try:
|
||||||
address = self.manager.get_parent_window().children[0].address
|
address = self.manager.get_parent_window().children[0].address
|
||||||
except Exception as e:
|
except Exception:
|
||||||
address = self.manager.get_parent_window().children[1].address
|
address = self.manager.get_parent_window().children[1].address
|
||||||
self.ids.qr.add_widget(QRCodeWidget(data=address))
|
self.ids.qr.add_widget(QRCodeWidget(data=address))
|
||||||
toast('Show QR code')
|
toast('Show QR code')
|
||||||
|
|
||||||
|
@ -2189,7 +2186,7 @@ class Draft(Screen):
|
||||||
xAddress, self.account, "draft", where, what,
|
xAddress, self.account, "draft", where, what,
|
||||||
False, start_indx, end_indx)
|
False, start_indx, end_indx)
|
||||||
|
|
||||||
def set_draftCnt(self, Count):
|
def set_draftCnt(self, Count): # pylint: disable=no-self-use
|
||||||
"""This method set the count of draft mails"""
|
"""This method set the count of draft mails"""
|
||||||
draftCnt_obj = state.kivyapp.root.ids.content_drawer.ids.draft_cnt
|
draftCnt_obj = state.kivyapp.root.ids.content_drawer.ids.draft_cnt
|
||||||
draftCnt_obj.children[0].children[0].text = showLimitedCnt(int(Count))
|
draftCnt_obj.children[0].children[0].text = showLimitedCnt(int(Count))
|
||||||
|
@ -2270,8 +2267,8 @@ class Draft(Screen):
|
||||||
# msg_count_objs = (
|
# msg_count_objs = (
|
||||||
# self.parent.parent.parent.parent.parent.parent.children[
|
# self.parent.parent.parent.parent.parent.parent.children[
|
||||||
# 2].children[0].ids)
|
# 2].children[0].ids)
|
||||||
# msg_count_objs = self.parent.parent.parent.parent.parent.children[
|
# msg_count_objs = self.parent.parent.parent.parent.parent.children[
|
||||||
# 2].children[0].ids
|
# 2].children[0].ids
|
||||||
if int(state.draft_count) > 0:
|
if int(state.draft_count) > 0:
|
||||||
# msg_count_objs.draft_cnt.badge_text = str(
|
# msg_count_objs.draft_cnt.badge_text = str(
|
||||||
# int(state.draft_count) - 1)
|
# int(state.draft_count) - 1)
|
||||||
|
@ -2394,7 +2391,7 @@ class Allmails(Screen):
|
||||||
" ORDER BY actionTime DESC limit {1}, {2}".format(
|
" ORDER BY actionTime DESC limit {1}, {2}".format(
|
||||||
self.account, start_indx, end_indx))
|
self.account, start_indx, end_indx))
|
||||||
|
|
||||||
def set_AllmailCnt(self, Count):
|
def set_AllmailCnt(self, Count): # pylint: disable=no-self-use
|
||||||
"""This method is used to set allmails message count"""
|
"""This method is used to set allmails message count"""
|
||||||
allmailCnt_obj = state.kivyapp.root.ids.content_drawer.ids.allmail_cnt
|
allmailCnt_obj = state.kivyapp.root.ids.content_drawer.ids.allmail_cnt
|
||||||
allmailCnt_obj.children[0].children[0].text = showLimitedCnt(int(Count))
|
allmailCnt_obj.children[0].children[0].text = showLimitedCnt(int(Count))
|
||||||
|
@ -2565,6 +2562,7 @@ class AddressDropdown(OneLineIconListItem):
|
||||||
|
|
||||||
|
|
||||||
class BadgeText(IRightBodyTouch, MDLabel):
|
class BadgeText(IRightBodyTouch, MDLabel):
|
||||||
|
"""Class for badgetext"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -2610,6 +2608,7 @@ class AppClosingPopup(Popup):
|
||||||
super(AppClosingPopup, self).__init__(**kwargs)
|
super(AppClosingPopup, self).__init__(**kwargs)
|
||||||
|
|
||||||
def closingAction(self, text):
|
def closingAction(self, text):
|
||||||
|
"""Action on closing window"""
|
||||||
if text == 'Yes':
|
if text == 'Yes':
|
||||||
print("*******************EXITING FROM APPLICATION*******************")
|
print("*******************EXITING FROM APPLICATION*******************")
|
||||||
import shutdown
|
import shutdown
|
||||||
|
|
|
@ -371,6 +371,7 @@ class Main(object):
|
||||||
|
|
||||||
elif state.kivy:
|
elif state.kivy:
|
||||||
config.remove_option('bitmessagesettings', 'dontconnect')
|
config.remove_option('bitmessagesettings', 'dontconnect')
|
||||||
|
# pylint: disable=no-member, import-error
|
||||||
from bitmessagekivy.mpybit import NavigateApp
|
from bitmessagekivy.mpybit import NavigateApp
|
||||||
state.kivyapp = NavigateApp()
|
state.kivyapp = NavigateApp()
|
||||||
state.kivyapp.run()
|
state.kivyapp.run()
|
||||||
|
|
|
@ -126,7 +126,7 @@ def readKnownNodes():
|
||||||
except ValueError:
|
except ValueError:
|
||||||
source.seek(0)
|
source.seek(0)
|
||||||
pickle_deserialize_old_knownnodes(source)
|
pickle_deserialize_old_knownnodes(source)
|
||||||
except (IOError, OSError, KeyError, EOFError,pickle.UnpicklingError):
|
except (IOError, OSError, KeyError, EOFError, pickle.UnpicklingError):
|
||||||
logger.debug(
|
logger.debug(
|
||||||
'Failed to read nodes from knownnodes.dat', exc_info=True)
|
'Failed to read nodes from knownnodes.dat', exc_info=True)
|
||||||
createDefaultKnownNodes()
|
createDefaultKnownNodes()
|
||||||
|
|
|
@ -16,7 +16,7 @@ logger = logging.getLogger('default')
|
||||||
class MsgBase(object): # pylint: disable=too-few-public-methods
|
class MsgBase(object): # pylint: disable=too-few-public-methods
|
||||||
"""Base class for message types"""
|
"""Base class for message types"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.data = {"": lower(type(self).__name__)}
|
self.data = {"": (type(self).__name__).lower()}
|
||||||
|
|
||||||
|
|
||||||
def constructObject(data):
|
def constructObject(data):
|
||||||
|
|
|
@ -326,7 +326,7 @@ class BMConnectionPool(object):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if type(chosen.host) == bytes:
|
if type(chosen.host) == bytes:
|
||||||
onion= '.onion'.encode()
|
onion = '.onion'.encode()
|
||||||
else:
|
else:
|
||||||
onion = '.onion'
|
onion = '.onion'
|
||||||
if chosen.host.endswith(onion) and Proxy.onion_proxy:
|
if chosen.host.endswith(onion) and Proxy.onion_proxy:
|
||||||
|
|
|
@ -105,7 +105,9 @@ def encodeHost(host):
|
||||||
colon = ':'
|
colon = ':'
|
||||||
full_stop = '.'
|
full_stop = '.'
|
||||||
if host.find(onion) > -1:
|
if host.find(onion) > -1:
|
||||||
return '\xfd\x87\xd8\x7e\xeb\x43'.encode('raw_unicode_escape') + base64.b32decode(host.split(full_stop)[0], True)
|
return '\xfd\x87\xd8\x7e\xeb\x43'.encode(
|
||||||
|
'raw_unicode_escape') + base64.b32decode(
|
||||||
|
host.split(full_stop)[0], True)
|
||||||
elif host.find(colon) == -1:
|
elif host.find(colon) == -1:
|
||||||
return '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF'.encode('raw_unicode_escape') + \
|
return '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF'.encode('raw_unicode_escape') + \
|
||||||
socket.inet_aton(host)
|
socket.inet_aton(host)
|
||||||
|
@ -286,7 +288,7 @@ def isProofOfWorkSufficient(
|
||||||
|
|
||||||
def CreatePacket(command, payload=''):
|
def CreatePacket(command, payload=''):
|
||||||
"""Construct and return a number of bytes from a payload"""
|
"""Construct and return a number of bytes from a payload"""
|
||||||
payload = payload if type(payload) in [bytes,bytearray] else payload.encode()
|
payload = payload if type(payload) in [bytes, bytearray] else payload.encode()
|
||||||
payload_length = len(payload)
|
payload_length = len(payload)
|
||||||
checksum = hashlib.sha512(payload).digest()[0:4]
|
checksum = hashlib.sha512(payload).digest()[0:4]
|
||||||
byte = bytearray(Header.size + payload_length)
|
byte = bytearray(Header.size + payload_length)
|
||||||
|
@ -332,7 +334,7 @@ def assembleVersionMessage(remoteHost, remotePort, participatingStreams, server=
|
||||||
(NODE_DANDELION if state.dandelion else 0)
|
(NODE_DANDELION if state.dandelion else 0)
|
||||||
)
|
)
|
||||||
# = 127.0.0.1. This will be ignored by the remote host. The actual remote connected IP will be used.
|
# = 127.0.0.1. This will be ignored by the remote host. The actual remote connected IP will be used.
|
||||||
#python3 need to check
|
# python3 need to check
|
||||||
payload += '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF'.encode('raw_unicode_escape') + pack('>L', 2130706433)
|
payload += '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF'.encode('raw_unicode_escape') + pack('>L', 2130706433)
|
||||||
|
|
||||||
# we have a separate extPort and incoming over clearnet
|
# we have a separate extPort and incoming over clearnet
|
||||||
|
|
|
@ -51,6 +51,7 @@ def encode(val, base, minlen=0):
|
||||||
result = code_string[0] * (minlen - len(result)) + result
|
result = code_string[0] * (minlen - len(result)) + result
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def decode(string, base):
|
def decode(string, base):
|
||||||
"""Returns the decoded string"""
|
"""Returns the decoded string"""
|
||||||
code_string = get_code_string(base)
|
code_string = get_code_string(base)
|
||||||
|
|
|
@ -699,7 +699,7 @@ def loadOpenSSL():
|
||||||
path.join(sys._MEIPASS, 'libssl.so'),
|
path.join(sys._MEIPASS, 'libssl.so'),
|
||||||
path.join(sys._MEIPASS, 'libcrypto.so.1.1.0'),
|
path.join(sys._MEIPASS, 'libcrypto.so.1.1.0'),
|
||||||
path.join(sys._MEIPASS, 'libssl.so.1.1.0'),
|
path.join(sys._MEIPASS, 'libssl.so.1.1.0'),
|
||||||
path.join(sys._MEIPASS, 'libcrypto.so.1.0.2'),
|
path.join(sys._MEIPASS, 'libcrypto.so.1.0.2'),
|
||||||
path.join(sys._MEIPASS, 'libssl.so.1.0.2'),
|
path.join(sys._MEIPASS, 'libssl.so.1.0.2'),
|
||||||
path.join(sys._MEIPASS, 'libcrypto.so.1.0.1'),
|
path.join(sys._MEIPASS, 'libcrypto.so.1.0.1'),
|
||||||
path.join(sys._MEIPASS, 'libssl.so.1.0.1'),
|
path.join(sys._MEIPASS, 'libssl.so.1.0.1'),
|
||||||
|
|
Reference in New Issue
Block a user