commit
6da6912e25
|
@ -6,11 +6,10 @@ idna==2.8
|
|||
isort==4.3.21
|
||||
Kivy==1.11.1
|
||||
Kivy-Garden==0.1.4
|
||||
git+https://github.com/HeaTTheatR/KivyMD.git
|
||||
-e git+https://github.com/surbhicis/KivyMD-1#egg=kivymd
|
||||
lazy-object-proxy==1.4.3
|
||||
mccabe==0.6.1
|
||||
Pillow==6.1.0
|
||||
pkg-resources==0.0.0
|
||||
pydenticon==0.3.1
|
||||
Pygments==2.4.2
|
||||
pylint==2.4.4
|
||||
|
|
35
src/api.py
35
src/api.py
|
@ -3,16 +3,9 @@ This is not what you run to run the Bitmessage API. Instead, enable the API
|
|||
( https://bitmessage.org/wiki/API ) and optionally enable daemon mode
|
||||
( https://bitmessage.org/wiki/Daemon ) then run bitmessagemain.py.
|
||||
"""
|
||||
<<<<<<< HEAD
|
||||
# Copyright (c) 2012-2016 Jonathan Warren
|
||||
# Copyright (c) 2012-2020 The Bitmessage developers
|
||||
# pylint: disable=too-many-lines,no-self-use,unused-variable,unused-argument
|
||||
=======
|
||||
# pylint: disable=too-many-locals,too-many-lines,no-self-use,unused-argument
|
||||
# pylint: disable=too-many-statements,too-many-public-methods,too-many-branches
|
||||
# Copyright (c) 2012-2016 Jonathan Warren
|
||||
# Copyright (c) 2012-2019 The Bitmessage developers
|
||||
>>>>>>> 86df28c260eb1dd4acae506c1366f3cf136c5840
|
||||
import base64
|
||||
import errno
|
||||
import hashlib
|
||||
|
@ -34,7 +27,6 @@ import queues
|
|||
import shared
|
||||
import shutdown
|
||||
import state
|
||||
<<<<<<< HEAD
|
||||
from addresses import (
|
||||
addBMIfNotPresent,
|
||||
calculateInventoryHash,
|
||||
|
@ -42,21 +34,13 @@ from addresses import (
|
|||
decodeVarint,
|
||||
varintDecodeError
|
||||
)
|
||||
=======
|
||||
|
||||
from addresses import addBMIfNotPresent, calculateInventoryHash, decodeAddress, decodeVarint, varintDecodeError
|
||||
>>>>>>> 86df28c260eb1dd4acae506c1366f3cf136c5840
|
||||
from bmconfigparser import BMConfigParser
|
||||
from debug import logger
|
||||
from helper_ackPayload import genAckPayload
|
||||
from helper_sql import SqlBulkExecute, sqlExecute, sqlQuery, sqlStoredProcedure
|
||||
from inventory import Inventory
|
||||
from network.threads import StoppableThread
|
||||
<<<<<<< HEAD
|
||||
from version import softwareVersion
|
||||
=======
|
||||
# pylint: disable=unused-variable
|
||||
>>>>>>> 86df28c260eb1dd4acae506c1366f3cf136c5840
|
||||
|
||||
str_chan = '[chan]'
|
||||
|
||||
|
@ -275,13 +259,9 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
raise APIError(9, 'Invalid characters in address: ' + address)
|
||||
if status == 'versiontoohigh':
|
||||
raise APIError(
|
||||
<<<<<<< HEAD
|
||||
10,
|
||||
'Address version number too high (or zero) in address: ' +
|
||||
address)
|
||||
=======
|
||||
10, 'Address version number too high (or zero) in address: ' + address)
|
||||
>>>>>>> 86df28c260eb1dd4acae506c1366f3cf136c5840
|
||||
if status == 'varintmalformed':
|
||||
raise APIError(26, 'Malformed varint in address: ' + address)
|
||||
raise APIError(
|
||||
|
@ -645,13 +625,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
label = str_chan + ' ' + passphrase
|
||||
except BaseException:
|
||||
label = str_chan + ' ' + repr(passphrase)
|
||||
<<<<<<< HEAD
|
||||
status, addressVersionNumber, streamNumber, toRipe = (
|
||||
self._verifyAddress(suppliedAddress))
|
||||
=======
|
||||
status, addressVersionNumber, streamNumber, toRipe = self._verifyAddress(
|
||||
suppliedAddress)
|
||||
>>>>>>> 86df28c260eb1dd4acae506c1366f3cf136c5840
|
||||
suppliedAddress = addBMIfNotPresent(suppliedAddress)
|
||||
queues.apiAddressGeneratorReturnQueue.queue.clear()
|
||||
queues.addressGeneratorQueue.put((
|
||||
|
@ -674,13 +649,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
raise APIError(0, 'I need parameters.')
|
||||
elif len(params) == 1:
|
||||
address, = params
|
||||
<<<<<<< HEAD
|
||||
status, addressVersionNumber, streamNumber, toRipe = (
|
||||
self._verifyAddress(address))
|
||||
=======
|
||||
status, addressVersionNumber, streamNumber, toRipe = \
|
||||
self._verifyAddress(address)
|
||||
>>>>>>> 86df28c260eb1dd4acae506c1366f3cf136c5840
|
||||
address = addBMIfNotPresent(address)
|
||||
if not BMConfigParser().has_section(address):
|
||||
raise APIError(
|
||||
|
@ -701,13 +671,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
|||
raise APIError(0, 'I need parameters.')
|
||||
elif len(params) == 1:
|
||||
address, = params
|
||||
<<<<<<< HEAD
|
||||
status, addressVersionNumber, streamNumber, toRipe = (
|
||||
self._verifyAddress(address))
|
||||
=======
|
||||
status, addressVersionNumber, streamNumber, toRipe = \
|
||||
self._verifyAddress(address)
|
||||
>>>>>>> 86df28c260eb1dd4acae506c1366f3cf136c5840
|
||||
address = addBMIfNotPresent(address)
|
||||
if not BMConfigParser().has_section(address):
|
||||
raise APIError(
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
<CustomTwoLineAvatarIconListItem>:
|
||||
canvas:
|
||||
Color:
|
||||
id: set_clr
|
||||
# rgba: 0.5, 0.5, 0.5, 0.5
|
||||
rgba: 0,0,0,0
|
||||
Rectangle: #woohoo!!!
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
hint_text: 'type or select sender address'
|
||||
size_hint_y: None
|
||||
height: 100
|
||||
font_size: '13sp'
|
||||
font_size: '15sp'
|
||||
multiline: False
|
||||
required: True
|
||||
helper_text_mode: "on_error"
|
||||
|
@ -26,15 +26,17 @@
|
|||
background_color: app.theme_cls.primary_dark
|
||||
values: app.variable_1
|
||||
on_text: root.auto_fill_fromaddr() if self.text != 'Select' else ''
|
||||
option_cls: Factory.get("MySpinnerOption")
|
||||
option_cls: Factory.get("ComposerSpinnerOption")
|
||||
#background_color: color_button if self.state == 'normal' else color_button_pressed
|
||||
#background_down: 'atlas://data/images/defaulttheme/spinner'
|
||||
background_normal: ''
|
||||
background_color: app.theme_cls.primary_color
|
||||
color: color_font
|
||||
font_size: '12.5sp'
|
||||
font_size: '13.5sp'
|
||||
ArrowImg:
|
||||
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
BoxLayout:
|
||||
orientation: 'vertical'
|
||||
txt_input: txt_input
|
||||
|
@ -43,17 +45,22 @@
|
|||
MyTextInput:
|
||||
id: txt_input
|
||||
size_hint_y: None
|
||||
font_size: '13sp'
|
||||
font_size: '15sp'
|
||||
height: self.parent.height/2
|
||||
hint_text: 'type, select or scan QR code for recipients address'
|
||||
RV:
|
||||
id: rv
|
||||
MDIconButton:
|
||||
icon: 'qrcode-scan'
|
||||
pos_hint: {'center_x': 0, 'center_y': .8}
|
||||
on_press: root.qrScanner()
|
||||
|
||||
MyMDTextField:
|
||||
id: subject
|
||||
hint_text: 'subject'
|
||||
required: True
|
||||
height: 100
|
||||
font_size: '13sp'
|
||||
font_size: '15sp'
|
||||
size_hint_y: None
|
||||
multiline: False
|
||||
helper_text_mode: "on_error"
|
||||
|
@ -63,7 +70,7 @@
|
|||
multiline: True
|
||||
hint_text: 'body'
|
||||
size_hint_y: None
|
||||
font_size: '13sp'
|
||||
font_size: '15sp'
|
||||
required: True
|
||||
helper_text_mode: "on_error"
|
||||
BoxLayout:
|
||||
|
@ -107,3 +114,12 @@
|
|||
canvas.before:
|
||||
Color:
|
||||
rgba: (0,0,0,1)
|
||||
|
||||
|
||||
<ComposerSpinnerOption@SpinnerOption>:
|
||||
font_size: '13.5sp'
|
||||
#background_color: color_button if self.state == 'down' else color_button_pressed
|
||||
#background_down: 'atlas://data/images/defaulttheme/button'
|
||||
background_normal: 'atlas://data/images/defaulttheme/textinput_active'
|
||||
background_color: app.theme_cls.primary_color
|
||||
color: color_font
|
|
@ -87,7 +87,6 @@
|
|||
text: "Here you may generate as many addresses as you like, Indeed creating and abandoning addresses is encouraged"
|
||||
halign: 'center'
|
||||
color:app.theme_cls.primary_dark
|
||||
|
||||
MDTextField:
|
||||
id: label
|
||||
multiline: False
|
||||
|
|
|
@ -15,16 +15,16 @@
|
|||
OneLineListItem:
|
||||
text: "Total Connections"
|
||||
BoxLayout:
|
||||
AnchorLayout:
|
||||
orientation: 'vertical'
|
||||
size_hint_y: None
|
||||
height: dp(58)
|
||||
MDRaisedButton:
|
||||
size_hint: .6, .3
|
||||
size_hint: .5, 0
|
||||
height: dp(40)
|
||||
MDLabel:
|
||||
font_style: 'H6'
|
||||
text: root.text_variable_1
|
||||
font_size: '13sp'
|
||||
color: (1,1,1,1)
|
||||
halign: 'center'
|
||||
elevation_normal: 2
|
||||
opposite_colors: True
|
||||
pos_hint: {'center_x': .5}
|
||||
Tab:
|
||||
text: 'Processes'
|
||||
ScrollView:
|
||||
|
@ -36,52 +36,52 @@
|
|||
OneLineListItem:
|
||||
text: "person-to-person"
|
||||
BoxLayout:
|
||||
AnchorLayout:
|
||||
orientation: 'vertical'
|
||||
size_hint_y: None
|
||||
height: dp(58)
|
||||
MDRaisedButton:
|
||||
size_hint: .7, .55
|
||||
size_hint: .5, 0
|
||||
height: dp(40)
|
||||
MDLabel:
|
||||
font_style: 'H6'
|
||||
text: root.text_variable_2
|
||||
font_size: '13sp'
|
||||
color: (1,1,1,1)
|
||||
halign: 'center'
|
||||
elevation_normal: 2
|
||||
opposite_colors: True
|
||||
pos_hint: {'center_x': .5}
|
||||
OneLineListItem:
|
||||
text: "Brodcast"
|
||||
BoxLayout:
|
||||
AnchorLayout:
|
||||
orientation: 'vertical'
|
||||
size_hint_y: None
|
||||
height: dp(58)
|
||||
MDRaisedButton:
|
||||
size_hint: .7, .55
|
||||
size_hint: .5, 0
|
||||
height: dp(40)
|
||||
MDLabel:
|
||||
font_style: 'H6'
|
||||
text: root.text_variable_3
|
||||
font_size: '13sp'
|
||||
color: (1,1,1,1)
|
||||
halign: 'center'
|
||||
elevation_normal: 2
|
||||
opposite_colors: True
|
||||
pos_hint: {'center_x': .5}
|
||||
OneLineListItem:
|
||||
text: "publickeys"
|
||||
BoxLayout:
|
||||
AnchorLayout:
|
||||
orientation: 'vertical'
|
||||
size_hint_y: None
|
||||
height: dp(58)
|
||||
MDRaisedButton:
|
||||
size_hint: .7, .55
|
||||
size_hint: .5, 0
|
||||
height: dp(40)
|
||||
MDLabel:
|
||||
font_style: 'H6'
|
||||
text: root.text_variable_4
|
||||
font_size: '13sp'
|
||||
color: (1,1,1,1)
|
||||
halign: 'center'
|
||||
elevation_normal: 2
|
||||
opposite_colors: True
|
||||
pos_hint: {'center_x': .5}
|
||||
OneLineListItem:
|
||||
text: "objects"
|
||||
BoxLayout:
|
||||
AnchorLayout:
|
||||
orientation: 'vertical'
|
||||
size_hint_y: None
|
||||
height: dp(58)
|
||||
MDRaisedButton:
|
||||
size_hint: .7, .55
|
||||
size_hint: .5, 0
|
||||
height: dp(40)
|
||||
MDLabel:
|
||||
font_style: 'H6'
|
||||
text: root.text_variable_5
|
||||
font_size: '13sp'
|
||||
color: (1,1,1,1)
|
||||
halign: 'center'
|
||||
elevation_normal: 2
|
||||
opposite_colors: True
|
||||
pos_hint: {'center_x': .5}
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
size: self.size
|
||||
size: dp(app.window_size[0] - 2*self.parent.parent.padding[0]) - 10 , 1
|
||||
height: dp(40)
|
||||
on_press: root.get_available_credits(self)
|
||||
on_press: root.get_free_credits(self)
|
||||
MDLabel:
|
||||
font_style: 'H6'
|
||||
text: 'Get Free Credits'
|
||||
|
@ -78,6 +78,7 @@
|
|||
halign: 'center'
|
||||
color: 1,1,1,1
|
||||
MDLabel:
|
||||
id: py2
|
||||
font_style: 'H5'
|
||||
theme_text_color: 'Primary'
|
||||
text: '€ 100.0'
|
||||
|
@ -92,6 +93,7 @@
|
|||
size: self.size
|
||||
size: dp(app.window_size[0] - 2*self.parent.parent.padding[0]) - 10 , 1
|
||||
height: dp(40)
|
||||
on_press: root.move_to_pay_option(py2.text)
|
||||
MDLabel:
|
||||
font_style: 'H6'
|
||||
text: 'Get Monthly Credits'
|
||||
|
@ -122,6 +124,7 @@
|
|||
halign: 'center'
|
||||
color: 1,1,1,1
|
||||
MDLabel:
|
||||
id: py3
|
||||
font_style: 'H5'
|
||||
theme_text_color: 'Primary'
|
||||
text: '€ 500.0'
|
||||
|
@ -136,6 +139,7 @@
|
|||
size: self.size
|
||||
size: dp(app.window_size[0] - 2*self.parent.parent.padding[0]) - 10 , 1
|
||||
height: dp(40)
|
||||
on_press: root.move_to_pay_option(py3.text)
|
||||
MDLabel:
|
||||
font_style: 'H6'
|
||||
text: 'Get Yearly Credits'
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
id: dropdown_item
|
||||
text: 'italiano'
|
||||
dropdown_max_height: 150
|
||||
dropdown_bg: [1, 1, 1, 1]
|
||||
pos_hint: {'center_x': 0.8, 'center_y': 0}
|
||||
items: [f"{i}" for i in ['System Setting','U.S. English','italiano','Esperanto','dansk','Deutsch','Pirate English','francais','Nederlands','norsk bokmal','polski','portugues europeu']]
|
||||
BoxLayout:
|
||||
|
@ -284,26 +285,25 @@
|
|||
halign: 'left'
|
||||
bold: True
|
||||
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
GridLayout:
|
||||
cols: 2
|
||||
padding: [10, 0, 0, 0]
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
MDLabel:
|
||||
size_hint_x: None
|
||||
font_style: 'Body1'
|
||||
theme_text_color: 'Primary'
|
||||
text: "Type:"
|
||||
halign: 'left'
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
MDDropDownItem:
|
||||
id: dropdown_item
|
||||
dropdown_bg: [1, 1, 1, 1]
|
||||
text: 'none'
|
||||
pos_hint: {'x': 0.9, 'y': 0}
|
||||
items: [f"{i}" for i in ['System Setting','U.S. English']]
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
padding: [30, 0, 0, 0]
|
||||
spacing: 10
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
MDLabel:
|
||||
|
@ -323,6 +323,14 @@
|
|||
theme_text_color: 'Primary'
|
||||
text: "Port:"
|
||||
halign: 'left'
|
||||
# TextInput:
|
||||
# size_hint: None, None
|
||||
# hint_text: '9050'
|
||||
# size: dp(app.window_size[0]/4), dp(30)
|
||||
# input_filter: "int"
|
||||
# readonly: False
|
||||
# multiline: False
|
||||
# font_size: '15sp'
|
||||
MDTextFieldRect:
|
||||
size_hint: None, None
|
||||
size: dp(app.window_size[0]/4), dp(30)
|
||||
|
@ -332,6 +340,7 @@
|
|||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
padding: [30, 0, 0, 0]
|
||||
spacing: 10
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
MDLabel:
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#background_down: 'atlas://data/images/defaulttheme/button'
|
||||
background_normal: 'atlas://data/images/defaulttheme/textinput_active'
|
||||
background_color: app.theme_cls.primary_color
|
||||
# text_autoupdate: True
|
||||
color: color_font
|
||||
|
||||
<NavigationItem>
|
||||
|
@ -101,7 +102,7 @@
|
|||
id: btn
|
||||
pos_hint:{"x":0,"y":0}
|
||||
option_cls: Factory.get("MySpinnerOption")
|
||||
font_size: '10.9sp'
|
||||
font_size: '12.5sp'
|
||||
text: app.getDefaultAccData()
|
||||
#background_color: color_button if self.state == 'normal' else color_button_pressed
|
||||
#background_down: 'atlas://data/images/defaulttheme/spinner'
|
||||
|
@ -111,11 +112,11 @@
|
|||
#background_color: (0.62,0.67,0.72,1)
|
||||
values: app.variable_1
|
||||
on_text:app.getCurrentAccountData(self.text)
|
||||
Image:
|
||||
source: app.get_default_image()
|
||||
x: self.width/6
|
||||
y: self.parent.y + self.parent.height/4
|
||||
size: self.parent.height/2, self.parent.height/2
|
||||
# Image:
|
||||
# source: app.get_default_image()
|
||||
# x: self.width/6
|
||||
# y: self.parent.y + self.parent.height/4
|
||||
# size: self.parent.height/2, self.parent.height/2
|
||||
ArrowImg:
|
||||
NavigationItem:
|
||||
id: inbox_cnt
|
||||
|
|
|
@ -95,33 +95,35 @@ def ShowTimeHistoy(act_time):
|
|||
action_time = datetime.fromtimestamp(int(act_time))
|
||||
crnt_date = datetime.now()
|
||||
duration = crnt_date - action_time
|
||||
display_data = (action_time.strftime('%d/%m/%Y')
|
||||
display_data = (
|
||||
action_time.strftime('%d/%m/%Y')
|
||||
if duration.days >= 365 else action_time.strftime('%I:%M %p').lstrip('0')
|
||||
if duration.days == 0 and crnt_date.strftime('%d/%m/%Y') == action_time.strftime('%d/%m/%Y')
|
||||
else action_time.strftime("%d %b"))
|
||||
else action_time.strftime("%d %b")
|
||||
)
|
||||
return display_data
|
||||
|
||||
|
||||
def AddTimeWidget(time):
|
||||
def AddTimeWidget(time): # pylint: disable=redefined-outer-name
|
||||
"""This method is used to create TimeWidget"""
|
||||
action_time = BadgeText(
|
||||
size_hint= (None, None),
|
||||
text= f"{ShowTimeHistoy(time)}",
|
||||
size_hint=(None, None),
|
||||
text=str(ShowTimeHistoy(time)),
|
||||
halign='right',
|
||||
font_style='Caption',
|
||||
size= [65,70])
|
||||
size=[65, 70])
|
||||
return action_time
|
||||
|
||||
|
||||
def chipTag(text):
|
||||
"""This method is used for showing chip tag"""
|
||||
obj = MDChip()
|
||||
obj.size_hint= (None, None)
|
||||
obj.label= text
|
||||
obj.icon= ''
|
||||
obj.pos_hint= {'center_x': .96, 'center_y': .2}
|
||||
obj.height= dp(18)
|
||||
obj.radius= 8
|
||||
obj.size_hint = (None, None)
|
||||
obj.label = text
|
||||
obj.icon = ''
|
||||
obj.pos_hint = {'center_x': .96, 'center_y': .2}
|
||||
obj.height = dp(18)
|
||||
obj.radius = 8
|
||||
return obj
|
||||
|
||||
|
||||
|
@ -167,12 +169,13 @@ class Inbox(Screen):
|
|||
self.set_inboxCount(state.inbox_count)
|
||||
for mail in self.queryreturn:
|
||||
# third_text = mail[3].replace('\n', ' ')
|
||||
body = mail[3].decode() if isinstance(mail[3],bytes) else mail[3]
|
||||
subject = mail[5].decode() if isinstance(mail[5],bytes) else mail[5]
|
||||
body = mail[3].decode() if isinstance(mail[3], bytes) else mail[3]
|
||||
subject = mail[5].decode() if isinstance(mail[5], bytes) else mail[5]
|
||||
data.append({
|
||||
'text': mail[4].strip(),
|
||||
'secondary_text': (subject[:50] + '........' if len(
|
||||
subject) >= 50 else (subject + ',' + body)[0:50] + '........').replace('\t', '').replace(' ', ''),
|
||||
subject) >= 50 else (subject + ',' + body)[0:50] + '........').replace(
|
||||
'\t', '').replace(' ', ''),
|
||||
'msgid': mail[1], 'received': mail[6]})
|
||||
|
||||
self.has_refreshed = True
|
||||
|
@ -255,12 +258,12 @@ class Inbox(Screen):
|
|||
self.inboxDataQuery('toaddress', where, what, total_message, 5)
|
||||
for mail in self.queryreturn:
|
||||
# third_text = mail[3].replace('\n', ' ')
|
||||
subject = mail[3].decode() if isinstance(mail[3],bytes) else mail[3]
|
||||
body = mail[5].decode() if isinstance(mail[5],bytes) else mail[5]
|
||||
subject = mail[3].decode() if isinstance(mail[3], bytes) else mail[3]
|
||||
body = mail[5].decode() if isinstance(mail[5], bytes) else mail[5]
|
||||
data.append({
|
||||
'text': mail[4].strip(),
|
||||
'secondary_text': body[:50] + '........' if len(
|
||||
body) >= 50 else (body + ',' +subject.replace(
|
||||
body) >= 50 else (body + ',' + subject.replace(
|
||||
'\n', ''))[0:50] + '........',
|
||||
'msgid': mail[1]})
|
||||
self.set_mdList(data)
|
||||
|
@ -331,6 +334,7 @@ class Inbox(Screen):
|
|||
|
||||
|
||||
class CustomTwoLineAvatarIconListItem(TwoLineAvatarIconListItem):
|
||||
"""Custom Two Line Avatar Icon List"""
|
||||
pass
|
||||
|
||||
|
||||
|
@ -393,22 +397,26 @@ class MyAddress(Screen):
|
|||
meny = CustomTwoLineAvatarIconListItem(
|
||||
text=item['text'], secondary_text=item['secondary_text'],
|
||||
theme_text_color='Custom' if is_enable == 'true' else 'Primary',
|
||||
text_color=NavigateApp().theme_cls.primary_color,
|
||||
)
|
||||
text_color=NavigateApp().theme_cls.primary_color,)
|
||||
try:
|
||||
meny.canvas.children[6].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5]
|
||||
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.add_widget(AvatarSampleWidget(
|
||||
source='./images/text_images/{}.png'.format(
|
||||
avatarImageFirstLetter(item['text'].strip()))))
|
||||
meny.bind(on_press=partial(
|
||||
self.myadd_detail, item['secondary_text'], item['text']))
|
||||
if state.association == item['secondary_text']:
|
||||
meny.add_widget(BadgeText(size_hint= (None, None),
|
||||
meny.add_widget(
|
||||
BadgeText(
|
||||
size_hint=(None, None),
|
||||
text='Active', halign='right',
|
||||
font_style='Body1', size= [50,60],
|
||||
font_style='Body1', size=[50, 60],
|
||||
theme_text_color='Custom',
|
||||
text_color=NavigateApp().theme_cls.primary_color))
|
||||
else:
|
||||
meny.add_widget(ToggleBtn(active = True if is_enable == 'true' else False))
|
||||
meny.add_widget(ToggleBtn(active=True if is_enable == 'true' else False))
|
||||
# carousel = Carousel(direction='right')
|
||||
# carousel.height = meny.height
|
||||
# carousel.size_hint_y = None
|
||||
|
@ -491,13 +499,15 @@ class MyAddress(Screen):
|
|||
return True
|
||||
return False
|
||||
|
||||
|
||||
def disableAddress(self, address, instance):
|
||||
"""This method is use for disabling address"""
|
||||
BMConfigParser().set(str(address), 'enabled', 'false')
|
||||
BMConfigParser().save()
|
||||
instance.parent.parent.theme_text_color = 'Primary'
|
||||
try:
|
||||
instance.parent.parent.canvas.children[6].rgba = [0.5, 0.5, 0.5, 0.5]
|
||||
except Exception:
|
||||
instance.parent.parent.canvas.children[9].rgba = [0.5, 0.5, 0.5, 0.5]
|
||||
toast('Address disabled')
|
||||
Clock.schedule_once(self.address_permision_callback, 0)
|
||||
|
||||
|
@ -506,7 +516,10 @@ class MyAddress(Screen):
|
|||
BMConfigParser().set(address, 'enabled', 'true')
|
||||
BMConfigParser().save()
|
||||
instance.parent.parent.theme_text_color = 'Custom'
|
||||
try:
|
||||
instance.parent.parent.canvas.children[6].rgba = [0, 0, 0, 0]
|
||||
except Exception:
|
||||
instance.parent.parent.canvas.children[9].rgba = [0, 0, 0, 0]
|
||||
toast('Address Enabled')
|
||||
Clock.schedule_once(self.address_permision_callback, 0)
|
||||
|
||||
|
@ -818,6 +831,10 @@ class DropDownWidget(BoxLayout):
|
|||
self.ids.ti.text = self.ids.btn.text
|
||||
self.ids.ti.focus = True
|
||||
|
||||
def qrScanner(self):
|
||||
"""This method is used for scanning Qr code"""
|
||||
pass
|
||||
|
||||
|
||||
class MyTextInput(TextInput):
|
||||
"""Takes the text input in the field"""
|
||||
|
@ -831,18 +848,18 @@ class MyTextInput(TextInput):
|
|||
def __init__(self, **kwargs):
|
||||
"""Getting Text Input."""
|
||||
super(MyTextInput, self).__init__(**kwargs)
|
||||
self.__lineBreak__=0
|
||||
self.__lineBreak__ = 0
|
||||
|
||||
def on_text(self, instance, value):
|
||||
"""Find all the occurrence of the word"""
|
||||
self.parent.parent.parent.parent.ids.rv.data = []
|
||||
self.parent.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]]
|
||||
display_data = []
|
||||
for i in matches:
|
||||
display_data.append({'text': i})
|
||||
self.parent.parent.parent.parent.ids.rv.data = display_data
|
||||
self.parent.parent.parent.parent.parent.ids.rv.data = display_data
|
||||
if len(matches) <= 10:
|
||||
self.parent.height = (250 + (len(matches) * 20))
|
||||
else:
|
||||
|
@ -860,7 +877,7 @@ class MyTextInput(TextInput):
|
|||
class Payment(Screen):
|
||||
"""Payment module"""
|
||||
|
||||
def get_available_credits(self, instance):
|
||||
def get_free_credits(self, instance):
|
||||
"""Get the available credits"""
|
||||
# pylint: disable=no-self-use
|
||||
state.availabe_credit = instance.parent.children[1].text
|
||||
|
@ -874,17 +891,21 @@ class Payment(Screen):
|
|||
state.kivyapp.root.ids.sc18.ids.cred.text = '{0}'.format(
|
||||
state.availabe_credit)
|
||||
|
||||
def move_to_pay_option(self, amount): # pylint: disable=no-self-use
|
||||
"""Option move to pay"""
|
||||
pass
|
||||
|
||||
|
||||
class Credits(Screen):
|
||||
"""Credits Method"""
|
||||
|
||||
available_credits = StringProperty(
|
||||
'{0}'.format('€ 0'))
|
||||
available_credits = StringProperty('{0}'.format('€ 0'))
|
||||
|
||||
|
||||
class Login(Screen):
|
||||
"""Login Screeen"""
|
||||
log_text1 = ('You may generate addresses by using either random numbers'
|
||||
log_text1 = (
|
||||
'You may generate addresses by using either random numbers'
|
||||
' or by using a passphrase If you use a passphrase, the address'
|
||||
' is called a deterministic; address The Random Number option is'
|
||||
' selected by default but deterministic addresses have several pros'
|
||||
|
@ -897,6 +918,7 @@ class Login(Screen):
|
|||
' choose a weak passphrase and someone on the Internet can brute-force it,'
|
||||
' they can read your messages and send messages as you')
|
||||
|
||||
|
||||
class NetworkStat(Screen):
|
||||
"""Method used to show network stat"""
|
||||
|
||||
|
@ -1040,7 +1062,8 @@ class Sent(Screen):
|
|||
data.append({
|
||||
'text': mail[1].strip(),
|
||||
'secondary_text': (mail[2][:50] + '........' if len(
|
||||
mail[2]) >= 50 else (mail[2] + ',' + mail[3])[0:50] + '........').replace('\t', '').replace(' ', ''),
|
||||
mail[2]) >= 50 else (mail[2] + ',' + mail[3])[0:50] + '........').replace(
|
||||
'\t', '').replace(' ', ''),
|
||||
'ackdata': mail[5], 'senttime': mail[6]},)
|
||||
self.set_mdlist(data, 0)
|
||||
self.has_refreshed = True
|
||||
|
@ -1076,8 +1099,7 @@ class Sent(Screen):
|
|||
meny = TwoLineAvatarIconListItem(
|
||||
text=item['text'], secondary_text=item['secondary_text'],
|
||||
theme_text_color='Custom',
|
||||
text_color=NavigateApp().theme_cls.primary_color
|
||||
)
|
||||
text_color=NavigateApp().theme_cls.primary_color)
|
||||
meny.add_widget(AvatarSampleWidget(
|
||||
source='./images/text_images/{}.png'.format(
|
||||
avatarImageFirstLetter(item['secondary_text'].strip()))))
|
||||
|
@ -1110,20 +1132,27 @@ class Sent(Screen):
|
|||
if len(self.ids.ml.children) < 3:
|
||||
self.ids.ml.clear_widgets()
|
||||
self.loadSent()
|
||||
if state.association == state.check_sent_acc:
|
||||
total_sent = int(state.sent_count) + 1
|
||||
state.sent_count = str(int(state.sent_count) +1)
|
||||
state.sent_count = str(int(state.sent_count) + 1)
|
||||
self.set_sentCount(total_sent)
|
||||
else:
|
||||
total_sent = int(state.sent_count)
|
||||
else:
|
||||
data = []
|
||||
self.sentDataQuery('fromaddress', '', '', 0, 1)
|
||||
if state.association == state.check_sent_acc:
|
||||
total_sent = int(state.sent_count) + 1
|
||||
state.sent_count = str(int(state.sent_count) +1)
|
||||
state.sent_count = str(int(state.sent_count) + 1)
|
||||
self.set_sentCount(total_sent)
|
||||
else:
|
||||
total_sent = int(state.sent_count)
|
||||
for mail in self.queryreturn:
|
||||
data.append({
|
||||
'text': mail[1].strip(),
|
||||
'secondary_text': (mail[2][:50] + '........' if len(
|
||||
mail[2]) >= 50 else (mail[2] + ',' + mail[3])[0:50] + '........').replace('\t', '').replace(' ', ''),
|
||||
mail[2]) >= 50 else (mail[2] + ',' + mail[3])[0:50] + '........').replace(
|
||||
'\t', '').replace(' ', ''),
|
||||
'ackdata': mail[5], 'senttime': mail[6]})
|
||||
self.set_mdlist(data, total_sent - 1)
|
||||
if state.msg_counter_objs and state.association == (
|
||||
|
@ -1281,8 +1310,8 @@ class Trash(Screen):
|
|||
"""This method is used to create the mdlist"""
|
||||
total_trash_msg = len(self.ids.ml.children)
|
||||
for item in self.trash_messages:
|
||||
subject = item[2].decode() if isinstance(item[2],bytes) else item[2]
|
||||
body = item[3].decode() if isinstance(item[3],bytes) else item[3]
|
||||
subject = item[2].decode() if isinstance(item[2], bytes) else item[2]
|
||||
body = item[3].decode() if isinstance(item[3], bytes) else item[3]
|
||||
meny = TwoLineAvatarIconListItem(
|
||||
text=item[1],
|
||||
secondary_text=(item[2][:50] + '........' if len(
|
||||
|
@ -1400,8 +1429,9 @@ class Setting(Screen):
|
|||
"""Setting the Screen components"""
|
||||
exp_text = "By default, if you send a message to someone and he is offline for more than two days, Bitmessage will\
|
||||
send the message again after an additional two days. This will be continued with exponential backoff\
|
||||
forever; messages will be resent after 5, 10, 20 days ect. until the receiver acknowledges them. Here you\
|
||||
may change that behavior by having Bitmessage give up after a certain number of days or months."
|
||||
forever; messages will be resent after 5, 10, 20 days ect. until the receiver acknowledges them.\
|
||||
Here you may change that behavior by having Bitmessage give up after a certain number of days \
|
||||
or months."
|
||||
|
||||
|
||||
class NavigateApp(MDApp):
|
||||
|
@ -1559,7 +1589,7 @@ class NavigateApp(MDApp):
|
|||
return False
|
||||
|
||||
def on_key(self, window, key, *args):
|
||||
# pylint: disable=inconsistent-return-statements
|
||||
# pylint: disable=inconsistent-return-statements, too-many-branches
|
||||
"""Method is used for going on previous screen"""
|
||||
if key == 27:
|
||||
if state.in_search_mode and self.root.ids.scr_mngr.current != (
|
||||
|
@ -1579,6 +1609,9 @@ class NavigateApp(MDApp):
|
|||
self.root.ids.scr_mngr.current = 'myaddress'
|
||||
elif self.root.ids.scr_mngr.current == "random":
|
||||
self.root.ids.scr_mngr.current = 'login'
|
||||
elif self.root.ids.scr_mngr.current == 'pay-options':
|
||||
self.set_common_header()
|
||||
self.root.ids.scr_mngr.current = 'payment'
|
||||
else:
|
||||
if state.kivyapp.variable_1:
|
||||
self.root.ids.scr_mngr.current = 'inbox'
|
||||
|
@ -1660,7 +1693,6 @@ class NavigateApp(MDApp):
|
|||
state.in_composer = True
|
||||
state.in_sent_method = False
|
||||
|
||||
|
||||
def set_navbar_for_composer(self):
|
||||
"""Clearing toolbar data when composer open"""
|
||||
self.root.ids.toolbar.left_action_items = [
|
||||
|
@ -1704,7 +1736,8 @@ class NavigateApp(MDApp):
|
|||
if state.in_composer else 'allmails'\
|
||||
if state.is_allmail else state.detailPageType\
|
||||
if state.detailPageType else 'myaddress'\
|
||||
if self.root.ids.scr_mngr.current == 'showqrcode' else 'inbox'
|
||||
if self.root.ids.scr_mngr.current == 'showqrcode' else 'payment'\
|
||||
if self.root.ids.scr_mngr.current == 'pay-options' else 'inbox'
|
||||
self.root.ids.scr_mngr.transition.direction = 'right'
|
||||
self.root.ids.scr_mngr.transition.bind(on_complete=self.reset)
|
||||
if state.is_allmail or state.detailPageType == 'draft':
|
||||
|
@ -1728,12 +1761,13 @@ class NavigateApp(MDApp):
|
|||
|
||||
def set_message_count(self):
|
||||
"""Setting message count"""
|
||||
try:
|
||||
msg_counter_objs = (
|
||||
self.root_window.children[0].children[2].children[0].ids)
|
||||
except Exception:
|
||||
msg_counter_objs = (
|
||||
self.root_window.children[2].children[2].children[0].ids)
|
||||
msg_counter_objs = state.kivyapp.root.children[0].children[0].ids
|
||||
# try:
|
||||
# msg_counter_objs = (
|
||||
# self.root_window.children[0].children[2].children[0].ids)
|
||||
# except Exception:
|
||||
# msg_counter_objs = (
|
||||
# self.root_window.children[2].children[2].children[0].ids)
|
||||
self.get_inbox_count()
|
||||
self.get_sent_count()
|
||||
state.trash_count = str(sqlQuery(
|
||||
|
@ -1842,7 +1876,7 @@ class NavigateApp(MDApp):
|
|||
def set_identicon(self, text):
|
||||
"""Show identicon in address spinner"""
|
||||
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
|
||||
self.root.ids.content_drawer.ids.top_box.children[0].texture = (img.texture)
|
||||
|
||||
|
@ -1907,7 +1941,6 @@ class NavigateApp(MDApp):
|
|||
def file_manager_open(self):
|
||||
"""This method open the file manager of local system"""
|
||||
from kivymd.uix.filemanager import MDFileManager
|
||||
from kivymd.uix.dialog import MDDialog
|
||||
|
||||
self.manager = ModalView(size_hint=(1, 1), auto_dismiss=False)
|
||||
self.file_manager = MDFileManager(
|
||||
|
@ -1926,7 +1959,7 @@ class NavigateApp(MDApp):
|
|||
from PIL import Image as PilImage
|
||||
if not os.path.exists('./images/default_identicon/'):
|
||||
os.makedirs('./images/default_identicon/')
|
||||
newImg = PilImage.open(path).resize((300,300))
|
||||
newImg = PilImage.open(path).resize((300, 300))
|
||||
newImg.save('./images/default_identicon/{0}.png'.format(state.association))
|
||||
self.load_selected_Image(state.association)
|
||||
self.exit_manager()
|
||||
|
@ -1941,12 +1974,13 @@ class NavigateApp(MDApp):
|
|||
def load_selected_Image(self, curerentAddr):
|
||||
"""This method load the selected image on screen"""
|
||||
top_box_obj = self.root.ids.content_drawer.ids.top_box.children[0]
|
||||
spinner_img_obj = self.root.ids.content_drawer.ids.btn.children[1]
|
||||
spinner_img_obj.source = top_box_obj.source ='./images/default_identicon/{0}.png'.format(curerentAddr)
|
||||
# spinner_img_obj = self.root.ids.content_drawer.ids.btn.children[1]
|
||||
# spinner_img_obj.source = top_box_obj.source ='./images/default_identicon/{0}.png'.format(curerentAddr)
|
||||
top_box_obj.source = './images/default_identicon/{0}.png'.format(curerentAddr)
|
||||
top_box_obj.reload()
|
||||
spinner_img_obj.reload()
|
||||
# spinner_img_obj.reload()
|
||||
|
||||
def copy_composer_text(self, text):
|
||||
def copy_composer_text(self, text): # pylint: disable=no-self-use
|
||||
"""Copy the data from mail detail page"""
|
||||
Clipboard.copy(text)
|
||||
toast('Copied')
|
||||
|
@ -2085,18 +2119,18 @@ class IconRightSampleWidget(IRightBodyTouch, MDIconButton):
|
|||
pass
|
||||
|
||||
|
||||
class IconRightSampleWidget(IRightBodyTouch, MDCheckbox):
|
||||
"""Right icon sample widget"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class ToggleBtn(IRightBodyTouch, MDSwitch):
|
||||
"""Right toggle button widget"""
|
||||
pass
|
||||
|
||||
|
||||
class MailDetail(Screen):
|
||||
class CheckboxLeftSampleWidget(ILeftBodyTouch, MDCheckbox):
|
||||
"""Left icon sample widget"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class MailDetail(Screen): # pylint: disable=too-many-instance-attributes
|
||||
"""MailDetail Screen uses to show the detail of mails"""
|
||||
|
||||
to_addr = StringProperty()
|
||||
|
@ -2133,8 +2167,8 @@ class MailDetail(Screen):
|
|||
|
||||
def assign_mail_details(self, data):
|
||||
"""Assigning mail details"""
|
||||
subject = data[0][2].decode() if isinstance(data[0][2],bytes) else data[0][2]
|
||||
body = data[0][3].decode() if isinstance(data[0][2],bytes) else data[0][3]
|
||||
subject = data[0][2].decode() if isinstance(data[0][2], bytes) else data[0][2]
|
||||
body = data[0][3].decode() if isinstance(data[0][2], bytes) else data[0][3]
|
||||
self.to_addr = data[0][0] if len(data[0][0]) > 4 else ' '
|
||||
self.from_addr = data[0][1]
|
||||
|
||||
|
@ -2144,7 +2178,7 @@ class MailDetail(Screen):
|
|||
if len(data[0]) == 7:
|
||||
self.status = data[0][4]
|
||||
self.time_tag = ShowTimeHistoy(data[0][4]) if state.detailPageType == 'inbox' else ShowTimeHistoy(data[0][6])
|
||||
self.avatarImg= './images/avatar.png' if state.detailPageType == 'draft' else (
|
||||
self.avatarImg = './images/avatar.png' if state.detailPageType == 'draft' else (
|
||||
'./images/text_images/{0}.png'.format(avatarImageFirstLetter(self.subject.strip())))
|
||||
self.timeinseconds = data[0][4] if state.detailPageType == 'inbox' else data[0][6]
|
||||
|
||||
|
@ -2211,14 +2245,22 @@ class MailDetail(Screen):
|
|||
def inbox_reply(self):
|
||||
"""Reply inbox messages"""
|
||||
data = sqlQuery(
|
||||
"select toaddress, fromaddress, subject, message from inbox where"
|
||||
"select toaddress, fromaddress, subject, message, received from inbox where"
|
||||
" msgid = ?;", state.mail_id)
|
||||
composer_obj = self.parent.screens[2].children[1].ids
|
||||
composer_obj.ti.text = data[0][0]
|
||||
composer_obj.btn.text = data[0][0]
|
||||
composer_obj.txt_input.text = data[0][1]
|
||||
composer_obj.subject.text = data[0][2]
|
||||
composer_obj.body.text = ''
|
||||
split_subject = data[0][2].split('Re:', 1)
|
||||
composer_obj.subject.text = 'Re: ' + (split_subject[1] if len(split_subject) > 1 else split_subject[0])
|
||||
time_obj = datetime.fromtimestamp(int(data[0][4]))
|
||||
time_tag = time_obj.strftime("%d %b %Y, %I:%M %p")
|
||||
sender_name = BMConfigParser().get(data[0][1], 'label')
|
||||
composer_obj.body.text = (
|
||||
'\n\n ------------------------On ' + time_tag + ', '
|
||||
+ sender_name + ' wrote:-----------------------\n' + data[0][3])
|
||||
composer_obj.body.focus = True
|
||||
composer_obj.body.cursor = (0, 0)
|
||||
state.kivyapp.root.ids.sc3.children[1].ids.rv.data = ''
|
||||
self.parent.current = 'create'
|
||||
state.kivyapp.set_navbar_for_composer()
|
||||
|
@ -2240,6 +2282,7 @@ class MailDetail(Screen):
|
|||
navApp.set_navbar_for_composer()
|
||||
|
||||
def detailedPopup(self):
|
||||
"""Detailed popup"""
|
||||
obj = SenderDetailPopup()
|
||||
obj.open()
|
||||
arg = (self.to_addr, self.from_addr, self.timeinseconds)
|
||||
|
@ -2271,7 +2314,7 @@ class MyaddDetailPopup(Popup):
|
|||
state.kivyapp.set_navbar_for_composer()
|
||||
try:
|
||||
window_obj = self.parent.children[2].ids
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
window_obj = self.parent.children[1].ids
|
||||
window_obj.sc3.children[1].ids.ti.text = self.address
|
||||
window_obj.sc3.children[1].ids.btn.text = self.address
|
||||
|
@ -2315,8 +2358,8 @@ class AddbookDetailPopup(Popup):
|
|||
"UPDATE addressbook SET label = '{}' WHERE"
|
||||
" address = '{}';".format(
|
||||
str(self.ids.add_label.text), address))
|
||||
self.parent.children[1].ids.sc11.ids.ml.clear_widgets()
|
||||
self.parent.children[1].ids.sc11.loadAddresslist(None, 'All', '')
|
||||
state.kivyapp.root.ids.sc11.ids.ml.clear_widgets()
|
||||
state.kivyapp.root.ids.sc11.loadAddresslist(None, 'All', '')
|
||||
self.dismiss()
|
||||
toast('Saved')
|
||||
|
||||
|
@ -2325,7 +2368,7 @@ class AddbookDetailPopup(Popup):
|
|||
state.kivyapp.set_navbar_for_composer()
|
||||
try:
|
||||
window_obj = self.parent.children[2].ids
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
window_obj = self.parent.children[1].ids
|
||||
window_obj.sc3.children[1].ids.txt_input.text = self.address
|
||||
window_obj.sc3.children[1].ids.ti.text = ''
|
||||
|
@ -2562,7 +2605,8 @@ class Draft(Screen):
|
|||
encoding,
|
||||
BMConfigParser().safeGetInt('bitmessagesettings', 'ttl'))
|
||||
state.msg_counter_objs = src_object.children[2].children[0].ids
|
||||
state.draft_count = str(int(state.draft_count) + 1) if state.association == fromAddress else state.draft_count
|
||||
state.draft_count = str(int(state.draft_count) + 1) \
|
||||
if state.association == fromAddress else state.draft_count
|
||||
src_object.ids.sc16.clear_widgets()
|
||||
src_object.ids.sc16.add_widget(Draft())
|
||||
toast('Save draft')
|
||||
|
@ -2646,8 +2690,8 @@ class Allmails(Screen):
|
|||
"""This method is used to create mdList for allmaills"""
|
||||
data_exist = len(self.ids.ml.children)
|
||||
for item in self.all_mails:
|
||||
body = item[3].decode() if isinstance(item[3],bytes) else item[3]
|
||||
subject = item[2].decode() if isinstance(item[2],bytes) else item[2]
|
||||
body = item[3].decode() if isinstance(item[3], bytes) else item[3]
|
||||
subject = item[2].decode() if isinstance(item[2], bytes) else item[2]
|
||||
meny = TwoLineAvatarIconListItem(
|
||||
text=item[1],
|
||||
secondary_text=(subject[:50] + '........' if len(
|
||||
|
@ -2822,6 +2866,7 @@ class NavigationItem(OneLineAvatarIconListItem):
|
|||
active = BooleanProperty(False)
|
||||
|
||||
def currentlyActive(self):
|
||||
"""Currenly active"""
|
||||
for nav_obj in self.parent.children:
|
||||
nav_obj.active = False
|
||||
self.active = True
|
||||
|
@ -2885,22 +2930,23 @@ class SenderDetailPopup(Popup):
|
|||
super(SenderDetailPopup, self).__init__(**kwargs)
|
||||
|
||||
def assignDetail(self, to_addr, from_addr, timeinseconds):
|
||||
"""Detailes assigned"""
|
||||
self.to_addr = to_addr
|
||||
self.from_addr = from_addr
|
||||
time_obj = datetime.fromtimestamp(int(timeinseconds))
|
||||
self.time_tag = time_obj.strftime("%d %b %Y, %I:%M %p")
|
||||
pop_height = 1.2*(self.ids.sd_label.height+self.ids.sd_btn.children[0].height)
|
||||
pop_height = 1.2 * (self.ids.sd_label.height + self.ids.sd_btn.children[0].height)
|
||||
if len(to_addr) > 3:
|
||||
self.height = 0
|
||||
self.height = pop_height
|
||||
self.ids.to_addId.size_hint_y = None
|
||||
self.ids.to_addId.height= 50
|
||||
self.ids.to_addId.height = 50
|
||||
frmaddbox = ToAddrBoxlayout()
|
||||
frmaddbox.set_toAddress(to_addr)
|
||||
self.ids.to_addId.add_widget(frmaddbox)
|
||||
else:
|
||||
self.height = 0
|
||||
self.height = pop_height/1.5
|
||||
self.height = pop_height / 1.5
|
||||
|
||||
|
||||
class OneLineListTitle(OneLineListItem):
|
||||
|
@ -2909,6 +2955,7 @@ class OneLineListTitle(OneLineListItem):
|
|||
long_press_time = NumericProperty(1)
|
||||
|
||||
def on_state(self, instance, value):
|
||||
"""On state"""
|
||||
if value == 'down':
|
||||
lpt = self.long_press_time
|
||||
self._clockev = Clock.schedule_once(self._do_long_press, lpt)
|
||||
|
@ -2916,9 +2963,11 @@ class OneLineListTitle(OneLineListItem):
|
|||
self._clockev.cancel()
|
||||
|
||||
def _do_long_press(self, dt):
|
||||
"""Do long press"""
|
||||
self.dispatch('on_long_press')
|
||||
|
||||
def on_long_press(self, *largs):
|
||||
"""On long press"""
|
||||
self.copymessageTitle(self.text)
|
||||
|
||||
def copymessageTitle(self, text):
|
||||
|
@ -2945,5 +2994,5 @@ class ToAddrBoxlayout(BoxLayout):
|
|||
to_addr = StringProperty()
|
||||
|
||||
def set_toAddress(self, to_addr):
|
||||
"""This method is use to set to address"""
|
||||
self.to_addr = to_addr
|
||||
pass
|
||||
|
|
|
@ -3,7 +3,6 @@ BMConfigParser class definition and default configuration settings
|
|||
"""
|
||||
# pylint: disable=no-self-use, arguments-differ
|
||||
import configparser
|
||||
import shutil
|
||||
import os
|
||||
import shutil
|
||||
from datetime import datetime
|
||||
|
|
|
@ -439,7 +439,7 @@ class objectProcessor(threading.Thread):
|
|||
return
|
||||
|
||||
# Let us try to decrypt the pubkey
|
||||
toAddress, _ = state.neededPubkeys[bytes(tag)] #check with py2
|
||||
toAddress, _ = state.neededPubkeys[bytes(tag)] # check with py2
|
||||
if protocol.decryptAndCheckPubkeyPayload(bytes(data), toAddress) == \
|
||||
'successful':
|
||||
# At this point we know that we have been waiting on this
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
Thread for performing PoW
|
||||
"""
|
||||
# pylint: disable=protected-access,too-many-branches,too-many-statements
|
||||
# pylint: disable=protected-access,too-many-branches,too-many-statements,unused-variable
|
||||
# pylint: disable=no-self-use,too-many-lines,too-many-locals,relative-import
|
||||
|
||||
|
||||
|
@ -455,7 +455,7 @@ class singleWorker(StoppableThread):
|
|||
|
||||
inventoryHash = calculateInventoryHash(payload)
|
||||
objectType = 1
|
||||
Inventory()._realInventory[inventoryHash] = (
|
||||
Inventory()[inventoryHash] = (
|
||||
objectType, streamNumber, payload, embeddedTime,
|
||||
doubleHashOfAddressData[32:]
|
||||
)
|
||||
|
@ -477,6 +477,7 @@ class singleWorker(StoppableThread):
|
|||
|
||||
def sendOnionPeerObj(self, peer=None):
|
||||
"""Send onionpeer object representing peer"""
|
||||
# pylint: disable=redefined-argument-from-local
|
||||
if not peer: # find own onionhostname
|
||||
for peer in state.ownAddresses:
|
||||
if peer.host.endswith('.onion'):
|
||||
|
@ -684,7 +685,7 @@ class singleWorker(StoppableThread):
|
|||
|
||||
def sendMsg(self):
|
||||
"""Send a message-type object (assemble the object, perform PoW and put it to the inv announcement queue)"""
|
||||
# pylint: disable=too-many-nested-blocks
|
||||
# pylint: disable=too-many-nested-blocks,logging-format-interpolation,unused-variable
|
||||
# Reset just in case
|
||||
sqlExecute(
|
||||
'''UPDATE sent SET status='msgqueued' '''
|
||||
|
@ -1158,7 +1159,7 @@ class singleWorker(StoppableThread):
|
|||
fullAckPayload = self.generateFullAckMessage(
|
||||
ackdata, toStreamNumber, TTL)
|
||||
payload += encodeVarint(len(fullAckPayload))
|
||||
payload += fullAckPayload if isinstance(fullAckPayload,bytes) else fullAckPayload.encode()
|
||||
payload += fullAckPayload if isinstance(fullAckPayload, bytes) else fullAckPayload.encode()
|
||||
dataToSign = pack('>Q', embeddedTime) + '\x00\x00\x00\x02'.encode() + \
|
||||
encodeVarint(1) + encodeVarint(toStreamNumber) + payload
|
||||
signature = highlevelcrypto.sign(dataToSign, privSigningKeyHex)
|
||||
|
@ -1201,11 +1202,11 @@ class singleWorker(StoppableThread):
|
|||
self.logger.info(
|
||||
'(For msg message) Doing proof of work. Total required'
|
||||
' difficulty: {}. Required small message difficulty: {}.'.format
|
||||
(float(requiredAverageProofOfWorkNonceTrialsPerByte) /
|
||||
(
|
||||
float(requiredAverageProofOfWorkNonceTrialsPerByte) /
|
||||
defaults.networkDefaultProofOfWorkNonceTrialsPerByte,
|
||||
float(requiredPayloadLengthExtraBytes) /
|
||||
defaults.networkDefaultPayloadLengthExtraBytes)
|
||||
)
|
||||
defaults.networkDefaultPayloadLengthExtraBytes))
|
||||
|
||||
powStartTime = time.time()
|
||||
initialHash = hashlib.sha512(encryptedPayload).digest()
|
||||
|
@ -1238,8 +1239,8 @@ class singleWorker(StoppableThread):
|
|||
inventoryHash = calculateInventoryHash(encryptedPayload)
|
||||
objectType = 2
|
||||
inventoryHashlist = (
|
||||
objectType, toStreamNumber,encryptedPayload, embeddedTime, '')
|
||||
Inventory()._realInventory[inventoryHash] = (
|
||||
objectType, toStreamNumber, encryptedPayload, embeddedTime, '')
|
||||
Inventory()[inventoryHash] = (
|
||||
objectType, toStreamNumber, encryptedPayload, embeddedTime, '')
|
||||
if BMConfigParser().has_section(toaddress) or \
|
||||
not protocol.checkBitfield(behaviorBitfield, protocol.BITFIELD_DOESACK):
|
||||
|
@ -1393,9 +1394,8 @@ class singleWorker(StoppableThread):
|
|||
payload = self._doPOWDefaults(payload, TTL)
|
||||
inventoryHash = calculateInventoryHash(payload)
|
||||
objectType = 1
|
||||
Inventory()._realInventory[inventoryHash] = (
|
||||
Inventory()[inventoryHash] = (
|
||||
objectType, streamNumber, payload, embeddedTime, '')
|
||||
# Inventory()._realInventory[inventoryHashlist]
|
||||
self.logger.info('sending inv (for the getpubkey message)')
|
||||
queues.invQueue.put((streamNumber, inventoryHash))
|
||||
# wait 10% past expiration
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
Message encoding end decoding functions
|
||||
"""
|
||||
|
||||
import string
|
||||
import zlib
|
||||
|
||||
import messagetypes
|
||||
|
|
BIN
src/images/paymode/111.webp
Normal file
BIN
src/images/paymode/111.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
src/images/paymode/bitcoin-logo.jpg
Normal file
BIN
src/images/paymode/bitcoin-logo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.3 KiB |
BIN
src/images/paymode/download.png
Normal file
BIN
src/images/paymode/download.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
|
@ -8,7 +8,7 @@ from singleton import Singleton
|
|||
|
||||
|
||||
@Singleton
|
||||
class Inventory():
|
||||
class Inventory(object):
|
||||
"""
|
||||
Inventory singleton class which uses storage backends
|
||||
to manage the inventory.
|
||||
|
@ -24,8 +24,8 @@ class Inventory():
|
|||
|
||||
# cheap inheritance copied from asyncore
|
||||
def __getattr__(self, attr):
|
||||
if attr == "__contains__":
|
||||
self.numberOfInventoryLookupsPerformed += 1
|
||||
# if attr == "__contains__":
|
||||
# self.numberOfInventoryLookupsPerformed += 1
|
||||
try:
|
||||
realRet = getattr(self._realInventory, attr)
|
||||
except AttributeError:
|
||||
|
@ -36,6 +36,15 @@ class Inventory():
|
|||
else:
|
||||
return realRet
|
||||
|
||||
# on python3 we have separately added __contains__ method
|
||||
def __contains__(self, attr):
|
||||
self.numberOfInventoryLookupsPerformed += 1
|
||||
return getattr(self._realInventory, '__contains__')(attr)
|
||||
|
||||
# on python3 we have separately added __setitem__ method
|
||||
def __setitem__(self, hash_, value):
|
||||
return getattr(self._realInventory, '__setitem__')(hash_, value)
|
||||
|
||||
# hint for pylint: this is dictionary like object
|
||||
def __getitem__(self, key):
|
||||
return self._realInventory[key]
|
||||
|
|
|
@ -15,7 +15,7 @@ class Message(MsgBase):
|
|||
# UTF-8 and variable type validator
|
||||
if isinstance(data["subject"], str):
|
||||
# Unicode is depreciated
|
||||
self.subject =data["subject"]
|
||||
self.subject = data["subject"]
|
||||
else:
|
||||
# Unicode is depreciated
|
||||
self.subject = str(data["subject"])
|
||||
|
|
|
@ -114,9 +114,10 @@ class BMObject(object): # pylint: disable=too-many-instance-attributes
|
|||
or advertise it unnecessarily)
|
||||
"""
|
||||
# if it's a stem duplicate, pretend we don't have it
|
||||
# pylint: disable=protected-access
|
||||
if Dandelion().hasHash(self.inventoryHash):
|
||||
return
|
||||
if self.inventoryHash in Inventory()._realInventory:
|
||||
if self.inventoryHash in Inventory():
|
||||
raise BMObjectAlreadyHaveError()
|
||||
|
||||
def checkObjectByType(self):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
Bitmessage Protocol
|
||||
"""
|
||||
# pylint: disable=attribute-defined-outside-init, too-few-public-methods, logging-format-interpolation
|
||||
# pylint: disable=attribute-defined-outside-init,too-few-public-methods,logging-format-interpolation,protected-access
|
||||
import base64
|
||||
import hashlib
|
||||
import logging
|
||||
|
@ -31,7 +31,7 @@ from network.dandelion import Dandelion
|
|||
from network.proxy import ProxyError
|
||||
from network.objectracker import missingObjects, ObjectTracker
|
||||
from network.node import Node, Peer
|
||||
from queues import objectProcessorQueue, portCheckerQueue, invQueue, addrQueue
|
||||
from queues import objectProcessorQueue, portCheckerQueue, invQueue
|
||||
from network.randomtrackingdict import RandomTrackingDict
|
||||
|
||||
logger = logging.getLogger('default')
|
||||
|
@ -357,7 +357,7 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
|
|||
if dandelion and not state.dandelion:
|
||||
return True
|
||||
for i in map(bytes, items):
|
||||
if i in Inventory()._realInventory and not Dandelion().hasHash(i):
|
||||
if i in Inventory() and not Dandelion().hasHash(i):
|
||||
continue
|
||||
if dandelion and not Dandelion().hasHash(i):
|
||||
Dandelion().addHash(i, self)
|
||||
|
@ -417,10 +417,9 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
|
|||
del missingObjects[self.object.inventoryHash]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
if self.object.inventoryHash in Inventory()._realInventory and Dandelion().hasHash(self.object.inventoryHash):
|
||||
if self.object.inventoryHash in Inventory() and Dandelion().hasHash(self.object.inventoryHash):
|
||||
Dandelion().removeHash(self.object.inventoryHash, "cycle detection")
|
||||
Inventory()._realInventory[self.object.inventoryHash] = (
|
||||
Inventory()[self.object.inventoryHash] = (
|
||||
self.object.objectType, self.object.streamNumber,
|
||||
memoryview(self.payload[objectOffset:]), self.object.expiresTime,
|
||||
memoryview(self.object.tag)
|
||||
|
|
|
@ -40,7 +40,7 @@ class DownloadThread(StoppableThread):
|
|||
del missingObjects[i]
|
||||
self.lastCleaned = time.time()
|
||||
|
||||
def run(self):
|
||||
def run(self): # pylint: disable=protected-access
|
||||
while not self._stopped:
|
||||
requested = 0
|
||||
connections = BMConnectionPool().establishedConnections()
|
||||
|
@ -61,7 +61,7 @@ class DownloadThread(StoppableThread):
|
|||
payload = bytearray()
|
||||
chunkCount = 0
|
||||
for chunk in request:
|
||||
if chunk in Inventory()._realInventory and not Dandelion().hasHash(chunk):
|
||||
if chunk in Inventory() and not Dandelion().hasHash(chunk):
|
||||
try:
|
||||
del i.objectsNewToMe[chunk]
|
||||
except KeyError:
|
||||
|
|
|
@ -92,13 +92,13 @@ class InvThread(StoppableThread):
|
|||
connection.append_write_buf(protocol.CreatePacket(
|
||||
'inv',
|
||||
addresses.encodeVarint(
|
||||
len(fluffs)) + ('').encode().join([x for x in fluffs]))) #compare result with python2
|
||||
len(fluffs)) + ('').encode().join([x for x in fluffs]))) # compare result with python2
|
||||
if stems:
|
||||
random.shuffle(stems)
|
||||
connection.append_write_buf(protocol.CreatePacket(
|
||||
'dinv',
|
||||
addresses.encodeVarint(
|
||||
len(stems)) + ('').encode().join([x for x in stems]))) #compare result with python2
|
||||
len(stems)) + ('').encode().join([x for x in stems]))) # compare result with python2
|
||||
|
||||
invQueue.iterate()
|
||||
for _ in range(len(chunk)):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
TCP protocol handler
|
||||
"""
|
||||
# pylint: disable=too-many-ancestors
|
||||
# pylint: disable=too-many-ancestors, protected-access
|
||||
import logging
|
||||
import math
|
||||
import random
|
||||
|
@ -211,7 +211,7 @@ class TCPConnection(BMProto, TLSDispatcher):
|
|||
# may lock for a long time, but I think it's better than
|
||||
# thousands of small locks
|
||||
with self.objectsNewToThemLock:
|
||||
for objHash in Inventory()._realInventory.unexpired_hashes_by_stream(stream):
|
||||
for objHash in Inventory().unexpired_hashes_by_stream(stream):
|
||||
# don't advertise stem objects on bigInv
|
||||
if Dandelion().hasHash(objHash):
|
||||
continue
|
||||
|
|
|
@ -110,7 +110,6 @@ def _doFastPoW(target, initialHash):
|
|||
time.sleep(0.2)
|
||||
|
||||
|
||||
|
||||
def _doCPoW(target, initialHash):
|
||||
out_h = ctypes.pointer(ctypes.create_string_buffer(initialHash, 64))
|
||||
out_m = ctypes.c_ulonglong(target)
|
||||
|
|
|
@ -289,7 +289,7 @@ def isProofOfWorkSufficient(
|
|||
|
||||
def CreatePacket(command, payload=''):
|
||||
"""Construct and return a number of bytes from a payload"""
|
||||
payload = payload if type(payload) in [bytes, bytearray,memoryview] else payload.encode()
|
||||
payload = payload if type(payload) in [bytes, bytearray, memoryview] else payload.encode()
|
||||
payload_length = len(payload)
|
||||
checksum = hashlib.sha512(payload).digest()[0:4]
|
||||
byte = bytearray(Header.size + payload_length)
|
||||
|
|
|
@ -25,7 +25,6 @@ from addresses import decodeAddress, encodeVarint
|
|||
from bmconfigparser import BMConfigParser
|
||||
from debug import logger
|
||||
from helper_sql import sqlQuery
|
||||
from pyelliptic import arithmetic
|
||||
# pylint: disable=logging-format-interpolation
|
||||
|
||||
verbose = 1
|
||||
|
|
|
@ -42,7 +42,7 @@ class SqliteInventory(InventoryStorage): # pylint: disable=too-many-ancestors
|
|||
|
||||
def __getitem__(self, hash_):
|
||||
with self.lock:
|
||||
if isinstance(hash_,memoryview) and bytes(hash_) in self._inventory :
|
||||
if isinstance(hash_, memoryview) and bytes(hash_) in self._inventory:
|
||||
return self._inventory[bytes(hash_)]
|
||||
else:
|
||||
if hash_ in self._inventory:
|
||||
|
|
Reference in New Issue
Block a user