Merge pull request #24 from jaicis/py3porting

Py3porting
This commit is contained in:
surbhi 2020-03-03 16:37:57 +05:30 committed by GitHub
commit ccafc6823f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 1019 additions and 255 deletions

View File

@ -44,22 +44,17 @@
on_press: app.clear_composer()
<CopyTextBtn@Button>:
id: cpyButton
color: 0,0,0,1
background_color: (0,0,0,0)
center_x: self.parent.center_x * 2 - self.parent.parent.padding[0]/2
center_y: self.parent.center_y
on_press:app.root.ids.sc14.copy_composer_text(self)
Image:
source: './images/copy_text.png'
center_x: self.parent.center_x
center_y: self.parent.center_y
size: 20, 20
<ToggleBtn>:
#size_hint: None, None
size_hint: None, None
size: dp(36), dp(48)
pos_hint: {'center_x': .95, 'center_y': .4}
on_press: app.root.ids.sc10.toggleAction(self)
on_active: app.root.ids.sc10.toggleAction(self)
<CustomTwoLineAvatarIconListItem>:
canvas:
Color:
# rgba: 0.5, 0.5, 0.5, 0.5
rgba: 0,0,0,0
Rectangle: #woohoo!!!
size: self.size
pos: self.pos

View File

@ -2,19 +2,27 @@
name: 'credits'
ScrollView:
do_scroll_x: False
MDList:
id: ml
BoxLayout:
size_hint_y: None
height: dp(200)
OneLineListItem:
orientation: 'vertical'
OneLineListTitle:
id: cred
text: "Available Credits"
BoxLayout:
AnchorLayout:
MDRaisedButton:
height: dp(40)
MDLabel:
font_style: 'H4'
text: root.available_credits
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
divider: None
theme_text_color: 'Primary'
_no_ripple_effect: True
long_press_time: 1
OneLineListTitle:
id: cred
text: root.available_credits
divider: None
font_style: 'H5'
theme_text_color: 'Primary'
_no_ripple_effect: True
long_press_time: 1
AnchorLayout:
MDRaisedButton:
height: dp(38)
text: "+Add more credits"
on_press: app.root.ids.scr_mngr.current = 'payment'

View File

@ -5,25 +5,28 @@
BoxLayout:
orientation: 'vertical'
size_hint_y: None
height: dp(750)
height: dp(400) + self.minimum_height
padding: dp(10)
BoxLayout:
MDLabel:
font_style: 'Subtitle2'
theme_text_color: 'Primary'
text: "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 \n pros and cons:\n"
halign: 'center'
text: root.log_text1
halign: 'left'
color:app.theme_cls.primary_dark
BoxLayout:
MDLabel:
font_style: 'Subtitle2'
theme_text_color: 'Primary'
text: "If talk about pros You can recreate your addresses on any computer from memory, You need-not worry about backing up your keys.dat file as long as you can remember your passphrase and aside talk about cons You must remember (or write down) your You must remember the address version number and the stream number along with your passphrase If you choose a weak passphrase and someone on the Internet can brute-force it, they can read your messages and send messages as you"
halign: 'center'
text: root.log_text2
halign: 'left'
color:app.theme_cls.primary_dark
MDCheckbox:
id: grp_chkbox_1
group: 'test'
size_hint: None, None
size: dp(48), dp(48)
pos_hint: {'center_x': .5, 'center_y': .5}
active: True
allow_no_selection: False
MDLabel:
@ -37,6 +40,9 @@
MDCheckbox:
id: grp_chkbox_1
group: 'test'
size_hint: None, None
size: dp(48), dp(48)
pos_hint: {'center_x': .5, 'center_y': .5}
allow_no_selection: False
MDLabel:
font_style: 'Body2'
@ -84,7 +90,7 @@
MDTextField:
id: label
multiline: True
multiline: False
hint_text: "Label"
required: True
helper_text_mode: "on_error"

View File

@ -1,84 +1,73 @@
<MailDetail>:
name: 'mailDetail'
# ScrollView:
# do_scroll_x: False
# BoxLayout:
# orientation: 'vertical'
# size_hint_y: None
# height: dp(500) + self.minimum_height
# padding: dp(32)
# MDLabel:
# font_style: 'Subtitle1'
# theme_text_color: 'Primary'
# text: root.subject
# halign: 'left'
# font_size: '20sp'
# CopyTextBtn:
# MDLabel:
# font_style: 'Body1'
# theme_text_color: 'Primary'
# text: "From: " + root.from_addr
# halign: 'left'
# CopyTextBtn:
# MDLabel:
# font_style: 'Body1'
# theme_text_color: 'Primary'
# text: "To: " + root.to_addr
# halign: 'left'
# CopyTextBtn:
# MDLabel:
# font_style: 'Body1'
# theme_text_color: 'Primary'
# text: root.status
# halign: 'left'
# MDLabel:
# font_style: 'Subtitle2'
# theme_text_color: 'Primary'
# text: root.message
# halign: 'left'
# bold: True
# CopyTextBtn:
# BoxLayout:
# orientation: 'vertical'
# size_hint_y: None
# height: dp(100) + self.minimum_height
ScrollView:
do_scroll_x: False
BoxLayout:
size_hint_y: None
orientation: 'vertical'
height: dp(bod.height) + self.minimum_height
# height: dp(bod.height) + self.minimum_height
height: self.minimum_height
padding: dp(20)
OneLineListItem:
# MDLabel:
# size_hint_y: None
# id: subj
# text: root.subject
# theme_text_color: 'Primary'
# halign: 'left'
# font_style: 'H5'
# height: dp(40)
# on_touch_down: root.allclick(self)
OneLineListTitle:
id: subj
text: root.subject
divider: None
disabled: True
font_style: 'H5'
theme_text_color: 'Primary'
_no_ripple_effect: True
long_press_time: 1
TwoLineAvatarIconListItem:
id: subaft
text: root.from_addr
secondary_text: 'to ' + root.to_addr
divider: None
on_press: root.detailedPopup()
BadgeText:
text: root.time_tag
halign:'right'
font_style:'Caption'
pos_hint: {'center_y': .8}
MDChip:
size_hint: (None, None)
label: root.page_type
icon: ''
pos_hint: {'center_x': .94, 'center_y': .3}
radius: 8
height: 18
AvatarSampleWidget:
source: root.avatarImg
OneLineListItem:
MDLabel:
text: root.status
divider: None
disabled: True
font_style: 'Body2'
theme_text_color: 'Primary'
halign:'left'
MDLabel:
padding_x: 20
# MDLabel:
# id: bod
# font_style: 'Subtitle2'
# theme_text_color: 'Primary'
# text: root.message
# halign: 'left'
# height: self.texture_size[1]
MyMDTextField:
id: bod
size_hint_y: None
font_style: 'Subtitle2'
theme_text_color: 'Primary'
text: root.message
halign: 'left'
height: self.texture_size[1]
multiline: True
readonly: True
line_color_normal: [0,0,0,0]
_current_line_color: [0,0,0,0]
line_color_focus: [0,0,0,0]
markup: True
font_size: '15sp'
Loader:

View File

@ -45,6 +45,7 @@
hint_text: "Address"
required: True
helper_text_mode: "on_error"
multiline: False
on_text: root.checkAddress_valid(self)
canvas.before:
Color:
@ -91,7 +92,7 @@
height: 4*(add_label.height)
width :app.window_size[0] - (app.window_size[0]/10 if app.app_platform == 'android' else app.window_size[0]/4)
background: './images/popup.jpeg'
separator_height: 0
separator_height: 0
auto_dismiss: False
BoxLayout:
size_hint_y: None
@ -127,13 +128,19 @@
text: "Address"
font_size: '17sp'
halign: 'left'
MDLabel:
id: address
font_style: 'Body1'
theme_text_color: 'Primary'
text: root.address
font_size: '15sp'
halign: 'left'
BoxLayout:
orientation: 'horizontal'
MDLabel:
id: address
font_style: 'Body1'
theme_text_color: 'Primary'
text: root.address
font_size: '15sp'
halign: 'left'
IconRightSampleWidget:
pos_hint: {'center_x': 0, 'center_y': 1}
icon: 'content-copy'
on_press: app.copy_composer_text(root.address)
BoxLayout:
id: addbook_btn
spacing:5
@ -208,12 +215,18 @@
text: "Address"
font_size: '17sp'
halign: 'left'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: root.address
font_size: '15sp'
halign: 'left'
BoxLayout:
orientation: 'horizontal'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: root.address
font_size: '15sp'
halign: 'left'
IconRightSampleWidget:
pos_hint: {'center_x': 0, 'center_y': 1}
icon: 'content-copy'
on_press: app.copy_composer_text(root.address)
BoxLayout:
id: my_add_btn
spacing:5
@ -311,4 +324,68 @@
text: 'Cancel'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
halign: 'center'
<SenderDetailPopup>:
id: myadd_popup
size_hint : (None,None)
# height: 2*(sd_label.height+ sd_btn.children[0].height)
width :app.window_size[0] - (app.window_size[0]/10 if app.app_platform == 'android' else app.window_size[0]/4)
background: './images/popup.jpeg'
auto_dismiss: False
separator_height: 0
BoxLayout:
id: myadd_popup_box
size_hint_y: None
orientation: 'vertical'
BoxLayout:
size_hint_y: None
height: 50
orientation: 'horizontal'
MDLabel:
id: sd_label
font_style: 'Body2'
theme_text_color: 'Primary'
text: "From : [b]" + root.from_addr + "[/b]"
font_size: '15sp'
halign: 'left'
markup: True
IconRightSampleWidget:
icon: 'content-copy'
on_press: app.copy_composer_text(root.from_addr)
BoxLayout:
id: to_addId
BoxLayout:
size_hint_y: None
orientation: 'vertical'
height: 50
MDLabel:
font_style: 'Body2'
theme_text_color: 'Primary'
text: "Date : " + root.time_tag
font_size: '15sp'
halign: 'left'
BoxLayout:
id: sd_btn
orientation: 'vertical'
MDRaisedButton:
on_press: root.dismiss()
pos_hint: {'x': 0.85, 'y': 0}
MDLabel:
font_style: 'H6'
text: 'Cancel'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
<ToAddrBoxlayout>:
orientation: 'horizontal'
MDLabel:
font_style: 'Body2'
theme_text_color: 'Primary'
text: "To : " + root.to_addr
font_size: '15sp'
halign: 'left'
IconRightSampleWidget:
icon: 'content-copy'
on_press: app.copy_composer_text(root.to_addr)

View File

@ -1,68 +1,526 @@
<Setting>:
name: 'set'
ScrollView:
do_scroll_x: False
MDList:
id: ml
size_hint_y: None
height: dp(500)
OneLineListItem:
text: "SERVER SETTINGS"
BoxLayout:
AnchorLayout:
MDRaisedButton:
size_hint: .6, .55
height: dp(40)
MDLabel:
font_style: 'H6'
text: 'Server'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
OneLineListItem:
text: "DATA SETTINGS"
BoxLayout:
AnchorLayout:
MDRaisedButton:
size_hint: .6, .55
height: dp(40)
MDLabel:
font_style: 'H6'
text: 'Import or export data'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
OneLineListItem:
text: "OTHER SETTINGS"
BoxLayout:
AnchorLayout:
MDRaisedButton:
size_hint: .6, .55
height: dp(40)
MDLabel:
font_style: 'H6'
text: 'Restart background service'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
BoxLayout:
AnchorLayout:
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "bitmessage is 11 seconds behind the network"
halign: 'center'
color: [0.941, 0, 0,1]
MDTabs:
id: tab_panel
tab_display_mode:'text'
BoxLayout:
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(64)
active: True
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "show settings (for advanced users only)"
halign: 'left'
color: app.theme_cls.primary_dark
Tab:
text: "User Interface"
ScrollView:
do_scroll_x: False
BoxLayout:
size_hint_y: None
orientation: 'vertical'
height: dp(400) + self.minimum_height
padding: 10
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
disabled: True
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Start-on-login not yet supported on your OS"
halign: 'left'
pos_hint: {'center_x': 0, 'center_y': 0.6}
disabled: True
BoxLayout:
orientation: 'vertical'
padding: [0, 10, 0, 0]
spacing: 10
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Interface Language"
halign: 'right'
bold: True
MDDropDownItem:
id: dropdown_item
text: 'italiano'
dropdown_max_height: 150
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:
size_hint_y: None
orientation: 'vertical'
padding: [20, 0, 0, 0]
spacing: dp(10)
height: dp(100) + self.minimum_height
# pos_hint: {'center_x': 0, 'center_y': 0.6}
BoxLayout:
id: box_height
orientation: 'vertical'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Tray"
halign: 'left'
bold: True
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Start Bitmessage in the tray(don't show main window)"
halign: 'left'
pos_hint: {'x': 0, 'y': .5}
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Minimize to tray"
halign: 'left'
pos_hint: {'x': 0, 'y': .5}
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Close to tray"
halign: 'left'
pos_hint: {'x': 0, 'y': .5}
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Hide connection notifications"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Show notification when message received"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Run in Portable Mode"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
# id: box_height
orientation: 'horizontal'
padding: 10
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: 'In portable Mode, messages and config files are stored in the same directory as the program rather then the normal application-data folder. This makes it convenient to run Bitmessage from a USB thumb drive.'
# text: 'huiiiii'
halign: 'left'
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Willingly include unencrypted destination address when sending to a mobile device"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Use identicons"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Reply below Quote"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
Widget:
size_hint_y: None
height: 10
# BoxLayout:
# orientation: 'vertical'
# spacing: 10
# padding: 10
# MDLabel:
# font_style: 'Body1'
# theme_text_color: 'Primary'
# text: "Interface Language"
# halign: 'left'
# bold: True
# MDDropDownItem:
# id: dropdown_item
# # on_select
# text: 'italiano'
# dropdown_max_height: 150
# pos_hint: {'center_x': 0.1, '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:
spacing:5
orientation: 'horizontal'
pos_hint: {'x':.76}
MDRaisedButton:
text: 'Reset'
MDRaisedButton:
text: 'Ok'
Tab:
text: 'Network Settings'
ScrollView:
do_scroll_x: False
BoxLayout:
size_hint_y: None
orientation: 'vertical'
height: dp(550) + self.minimum_height
padding: 10
BoxLayout:
id: box_height
orientation: 'vertical'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Listening port"
halign: 'left'
bold: True
BoxLayout:
orientation: 'horizontal'
padding: [10, 0, 0, 0]
BoxLayout:
orientation: 'horizontal'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Listen for connections on port:"
halign: 'left'
BoxLayout:
orientation: 'horizontal'
MDTextFieldRect:
size_hint: None, None
size: dp(100), dp(30)
text: '8444'
pos_hint: {'center_y': .5, 'center_x': .5}
input_filter: "int"
BoxLayout:
orientation: 'horizontal'
padding_left: 10
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "UPnP"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
orientation: 'vertical'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Proxy server / Tor"
halign: 'left'
bold: True
BoxLayout:
orientation: 'horizontal'
padding: [10, 0, 0, 0]
BoxLayout:
orientation: 'horizontal'
MDLabel:
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'
items: [f"{i}" for i in ['System Setting','U.S. English']]
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
BoxLayout:
orientation: 'horizontal'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Server hostname:"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(app.window_size[0]/4), dp(30)
hint_text: 'localhost'
pos_hint: {'center_y': .5, 'center_x': .5}
BoxLayout:
orientation: 'horizontal'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Port:"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(app.window_size[0]/4), dp(30)
hint_text: '9050'
pos_hint: {'center_y': .5, 'center_x': .5}
input_filter: "int"
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
BoxLayout:
orientation: 'horizontal'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Username:"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(app.window_size[0]/4), dp(30)
pos_hint: {'center_y': .5, 'center_x': .5}
BoxLayout:
orientation: 'horizontal'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Pass:"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(app.window_size[0]/4), dp(30)
pos_hint: {'center_y': .5, 'center_x': .5}
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Authentication"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Listen for incoming connections when using proxy"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Only connect to onion services(*.onion)"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
orientation: 'vertical'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Bandwidth limit"
halign: 'left'
bold: True
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Maximum download rate (kB/s):[0:unlimited]"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(app.window_size[0]/2), dp(30)
hint_text: '0'
pos_hint: {'center_y': .5, 'center_x': .5}
input_filter: "int"
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Maximum upload rate (kB/s):[0:unlimited]"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(app.window_size[0]/2), dp(30)
hint_text: '0'
pos_hint: {'center_y': .5, 'center_x': .5}
input_filter: "int"
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Maximum outbound connections:[0:none]"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(app.window_size[0]/2), dp(30)
hint_text: '8'
pos_hint: {'center_y': .5, 'center_x': .5}
input_filter: "int"
BoxLayout:
spacing:5
orientation: 'horizontal'
pos_hint: {'x':.76}
MDRaisedButton:
text: 'Reset'
MDRaisedButton:
text: 'Ok'
Tab:
text: 'Resends Expire'
ScrollView:
do_scroll_x: False
BoxLayout:
size_hint_y: None
orientation: 'vertical'
height: dp(200) + self.minimum_height
padding: 20
spacing: 10
BoxLayout:
id: box_height
orientation: 'vertical'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: root.exp_text
halign: 'left'
BoxLayout:
id: box_height
orientation: 'vertical'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Leave these input fields blank for the default behavior."
halign: 'left'
BoxLayout:
orientation: 'horizontal'
padding: [10, 0, 0, 0]
BoxLayout:
orientation: 'horizontal'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Give up after"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(70), dp(30)
text: '0'
pos_hint: {'center_y': .5, 'center_x': .5}
input_filter: "int"
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "days and"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(70), dp(30)
text: '0'
pos_hint: {'center_y': .5, 'center_x': .5}
input_filter: "int"
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "months"
halign: 'left'
BoxLayout:
spacing:5
orientation: 'horizontal'
# pos_hint: {'left': 0}
pos_hint: {'x':.75}
MDRaisedButton:
text: 'Reset'
MDRaisedButton:
text: 'Ok'

View File

@ -26,7 +26,7 @@
font_size: '12.5sp'
#background_color: color_button if self.state == 'down' else color_button_pressed
#background_down: 'atlas://data/images/defaulttheme/button'
background_normal: ''
background_normal: 'atlas://data/images/defaulttheme/textinput_active'
background_color: app.theme_cls.primary_color
color: color_font
@ -62,6 +62,16 @@
size_hint_y: None
height: "200dp"
MDIconButton:
icon: "file-image"
x: root.parent.x + dp(10)
pos_hint: {"top": 1, 'right': 1}
color: [1,0,0,1]
on_release: app.file_manager_open()
# md_bg_color: app.theme_cls.primary_color
theme_text_color: "Custom"
text_color: app.theme_cls.primary_color
BoxLayout:
id: top_box
size_hint_y: None
@ -275,7 +285,32 @@ NavigationLayout:
name: 'showqrcode'
BoxLayout:
orientation: 'vertical'
size_hint: (None, None)
pos_hint:{'center_x': .5, 'top': 0.9}
size: (app.window_size[0]/2, app.window_size[0]/2)
id: qr
BoxLayout:
orientation: 'vertical'
MyMDTextField:
size_hint_y: None
font_style: 'Body1'
theme_text_color: 'Primary'
text: root.address
multiline: True
readonly: True
line_color_normal: [0,0,0,0]
_current_line_color: [0,0,0,0]
line_color_focus: [0,0,0,0]
font_size: '18sp'
bold: True
pos_hint: {'x': .26, 'y': 0.5}
# MDLabel:
# size_hint_y: None
# font_style: 'Body1'
# theme_text_color: 'Primary'
# text: "[b]BM-2cV7Y8imvAevK6z6YmhYRcj2t7rghBtDSZ[/b]"
# markup: True
# pos_hint: {'x': .28, 'y': 0.6}
<Starred>:
name: 'starred'

View File

@ -56,12 +56,15 @@ from kivymd.uix.list import (
# NavigationDrawerHeaderBase
# )
from kivymd.uix.selectioncontrol import MDCheckbox, MDSwitch
from kivymd.uix.chip import MDChip
import queues
from semaphores import kivyuisignaler
import state
from addresses import decodeAddress
from kivy.uix.modalview import ModalView
from datetime import datetime
from kivy.config import Config
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
# pylint: disable=too-few-public-methods,too-many-arguments,attribute-defined-outside-init
@ -89,7 +92,6 @@ def showLimitedCnt(total_msg):
def ShowTimeHistoy(act_time):
"""This method is used to return the message sent or receive time"""
from datetime import datetime
action_time = datetime.fromtimestamp(int(act_time))
crnt_date = datetime.now()
duration = crnt_date - action_time
@ -111,6 +113,18 @@ def AddTimeWidget(time):
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
return obj
class Inbox(Screen):
"""Inbox Screen uses screen to show widgets of screens"""
@ -153,14 +167,14 @@ class Inbox(Screen):
self.set_inboxCount(state.inbox_count)
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]
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': body[:50] + '........' if len(
body) >= 50 else (body + ',' + subject.replace(
'\n', ''))[0:50] + '........',
'secondary_text': (subject[:50] + '........' if len(
subject) >= 50 else (subject + ',' + body)[0:50] + '........').replace('\t', '').replace(' ', ''),
'msgid': mail[1], 'received': mail[6]})
self.has_refreshed = True
self.set_mdList(data)
self.children[2].children[0].children[0].bind(
@ -316,6 +330,10 @@ class Inbox(Screen):
Clock.schedule_once(refresh_callback, 1)
class CustomTwoLineAvatarIconListItem(TwoLineAvatarIconListItem):
pass
class MyAddress(Screen):
"""MyAddress screen uses screen to show widgets of screens"""
@ -372,11 +390,12 @@ class MyAddress(Screen):
'secondary_text': address})
for item in data:
is_enable = BMConfigParser().get(item['secondary_text'], 'enabled')
meny = TwoLineAvatarIconListItem(
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,
)
meny.canvas.children[6].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()))))
@ -424,13 +443,25 @@ class MyAddress(Screen):
"""Loads more data on scroll down"""
self.set_mdList(my_addresses, my_addresses + 20)
@staticmethod
def myadd_detail(fromaddress, label, *args):
# @staticmethod
def myadd_detail(self, fromaddress, label, *args):
"""Load myaddresses details"""
if BMConfigParser().get(fromaddress, 'enabled') == 'true':
p = MyaddDetailPopup()
p.open()
p.set_address(fromaddress, label)
else:
width = .8 if platform == 'android' else .55
msg_dialog = MDDialog(
text='Address is not currently active. Please click on Toggle button to active it.',
title='', size_hint=(width, .25), text_button_ok='Ok',
events_callback=self.callback_for_menu_items)
msg_dialog.open()
@staticmethod
def callback_for_menu_items(text_item, *arg):
"""Callback of alert box"""
toast(text_item)
def refresh_callback(self, *args):
"""Method updates the state of application,
@ -466,6 +497,7 @@ class MyAddress(Screen):
BMConfigParser().set(str(address), 'enabled', 'false')
BMConfigParser().save()
instance.parent.parent.theme_text_color = 'Primary'
instance.parent.parent.canvas.children[6].rgba = [0.5, 0.5, 0.5, 0.5]
toast('Address disabled')
Clock.schedule_once(self.address_permision_callback, 0)
@ -474,6 +506,7 @@ class MyAddress(Screen):
BMConfigParser().set(address, 'enabled', 'true')
BMConfigParser().save()
instance.parent.parent.theme_text_color = 'Custom'
instance.parent.parent.canvas.children[6].rgba = [0, 0, 0, 0]
toast('Address Enabled')
Clock.schedule_once(self.address_permision_callback, 0)
@ -488,9 +521,9 @@ class MyAddress(Screen):
"""This method is used for enable or disable address"""
addr = instance.parent.parent.secondary_text
if instance.active:
self.disableAddress(addr, instance)
else:
self.enableAddress(addr, instance)
else:
self.disableAddress(addr, instance)
class AddressBook(Screen):
@ -735,7 +768,7 @@ class DropDownWidget(BoxLayout):
# state.draft_count)
state.detailPageType = ''
state.send_draft_mail = None
self.parent.parent.screens[3].update_sent_messagelist()
self.parent.parent.parent.ids.sc4.update_sent_messagelist()
Clock.schedule_once(self.callback_for_msgsend, 3)
queues.workerQueue.put(('sendmessage', toAddress))
print("sqlExecute successfully #######################")
@ -744,9 +777,9 @@ class DropDownWidget(BoxLayout):
else:
msg = 'Enter a valid recipients address'
elif not toAddress:
msg = 'Please fill the form'
msg = 'Please fill the form completely'
else:
msg = 'Please fill the form'
msg = 'Please fill the form completely'
self.address_error_message(msg)
@staticmethod
@ -798,6 +831,7 @@ class MyTextInput(TextInput):
def __init__(self, **kwargs):
"""Getting Text Input."""
super(MyTextInput, self).__init__(**kwargs)
self.__lineBreak__=0
def on_text(self, instance, value):
"""Find all the occurrence of the word"""
@ -830,32 +864,38 @@ class Payment(Screen):
"""Get the available credits"""
# pylint: disable=no-self-use
state.availabe_credit = instance.parent.children[1].text
existing_credits = (
state.kivyapp.root.ids.sc18.ids.ml.children[0].children[
0].children[0].children[0].text)
if len(existing_credits.split(' ')) > 1:
existing_credits = state.kivyapp.root.ids.sc18.ids.cred.text
if float(existing_credits.split()[1]) > 0:
toast(
'We already have added free coins'
' for the subscription to your account!')
else:
toast('Coins added to your account!')
state.kivyapp.root.ids.sc18.ids.ml.children[0].children[
0].children[0].children[0].text = '{0}'.format(
state.availabe_credit)
state.kivyapp.root.ids.sc18.ids.cred.text = '{0}'.format(
state.availabe_credit)
class Credits(Screen):
"""Credits Method"""
available_credits = StringProperty(
'{0}'.format('0'))
'{0}'.format('0'))
class Login(Screen):
"""Login Screeen"""
pass
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'
' and cons:')
log_text2 = ('If talk about pros You can recreate your addresses on any computer'
' from memory, You need-not worry about backing up your keys.dat file'
' as long as you can remember your passphrase and aside talk about cons'
' You must remember (or write down) your You must remember the address'
' version number and the stream number along with your passphrase If you'
' 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"""
@ -908,6 +948,10 @@ class Random(Screen):
def generateaddress(self, navApp):
"""Method for Address Generator"""
entered_label = str(self.ids.label.text).strip()
if not entered_label:
self.ids.label.focus = True
# self.ids.label.error = True
# self.ids.label.helper_text = 'This field is required'
streamNumberForAddress = 1
label = self.ids.label.text
eighteenByteRipe = False
@ -995,9 +1039,8 @@ class Sent(Screen):
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].replace(
'\n', ''))[0:50] + '........',
'secondary_text': (mail[2][:50] + '........' if len(
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
@ -1068,18 +1111,19 @@ class Sent(Screen):
self.ids.ml.clear_widgets()
self.loadSent()
total_sent = int(state.sent_count) + 1
state.sent_count = str(int(state.sent_count) +1)
self.set_sentCount(total_sent)
else:
data = []
self.sentDataQuery('fromaddress', '', '', 0, 1)
total_sent = int(state.sent_count) + 1
state.sent_count = str(int(state.sent_count) +1)
self.set_sentCount(total_sent)
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].replace(
'\n', ''))[0:50] + '........',
'secondary_text': (mail[2][:50] + '........' if len(
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 == (
@ -1119,7 +1163,7 @@ class Sent(Screen):
src_mng_obj = state.kivyapp.root.ids.content_drawer.ids.send_cnt
if state.association:
src_mng_obj.children[0].children[0].text = showLimitedCnt(int(total_sent))
state.kivyapp.get_sent_count()
# state.kivyapp.get_sent_count()
else:
src_mng_obj.children[0].children[0].text = '0'
@ -1241,15 +1285,15 @@ class Trash(Screen):
body = item[3].decode() if isinstance(item[3],bytes) else item[3]
meny = TwoLineAvatarIconListItem(
text=item[1],
secondary_text=item[2][:50] + '........' if len(
subject) >= 50 else (subject + ',' + body.replace(
'\n', ''))[0:50] + '........',
secondary_text=(item[2][:50] + '........' if len(
subject) >= 50 else (subject + ',' + body)[0:50] + '........').replace('\t', '').replace(' ', ''),
theme_text_color='Custom',
text_color=NavigateApp().theme_cls.primary_color)
img_latter = './images/text_images/{}.png'.format(
subject[0].upper() if (subject[0].upper() >= 'A' and subject[0].upper() <= 'Z') else '!')
meny.add_widget(AvatarSampleWidget(source=img_latter))
meny.add_widget(AddTimeWidget(item[7]))
meny.add_widget(chipTag('inbox 'if 'inbox' in item[4] else 'sent'))
carousel = Carousel(direction='right')
carousel.height = meny.height
carousel.size_hint_y = None
@ -1354,8 +1398,10 @@ class Create(Screen):
class Setting(Screen):
"""Setting the Screen components"""
pass
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."
class NavigateApp(MDApp):
@ -1374,6 +1420,7 @@ class NavigateApp(MDApp):
title = "PyBitmessage"
imgstatus = False
count = 0
manager_open = False
def build(self):
"""Method builds the widget"""
@ -1407,7 +1454,10 @@ class NavigateApp(MDApp):
def getCurrentAccountData(self, text):
"""Get Current Address Account Data"""
self.set_identicon(text)
if os.path.exists('./images/default_identicon/{}.png'.format(text)):
self.load_selected_Image(text)
else:
self.set_identicon(text)
address_label = self.current_address_label(
BMConfigParser().get(text, 'label'), text)
self.root_window.children[1].ids.toolbar.title = address_label
@ -1469,8 +1519,10 @@ class NavigateApp(MDApp):
img.texture.save('{1}/images/default_identicon/{0}.png'.format(
BMConfigParser().addresses()[0], android_path))
else:
img.texture.save('./images/default_identicon/{}.png'.format(
BMConfigParser().addresses()[0]))
if not os.path.exists('./images/default_identicon/{}.png'.format(
BMConfigParser().addresses()[0])):
img.texture.save('./images/default_identicon/{}.png'.format(
BMConfigParser().addresses()[0]))
return BMConfigParser().addresses()[0]
return 'Select Address'
@ -1578,8 +1630,8 @@ class NavigateApp(MDApp):
"""Saving drafts messages"""
composer_objs = self.root
from_addr = str(self.root.ids.sc3.children[1].ids.ti.text)
to_addr = str(self.root.ids.sc3.children[1].ids.txt_input.text)
if from_addr and to_addr and state.detailPageType != 'draft' \
# to_addr = str(self.root.ids.sc3.children[1].ids.txt_input.text)
if from_addr and state.detailPageType != 'draft' \
and not state.in_sent_method:
Draft().draft_msg(composer_objs)
return
@ -1608,6 +1660,7 @@ 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 = [
@ -1636,7 +1689,8 @@ class NavigateApp(MDApp):
def back_press(self):
"""Method for, reverting composer to previous page"""
self.save_draft()
if self.root.ids.scr_mngr.current == 'create':
self.save_draft()
if self.root.ids.scr_mngr.current == \
'mailDetail' and state.in_search_mode:
toolbar_obj = self.root.ids.toolbar
@ -1850,6 +1904,53 @@ class NavigateApp(MDApp):
AppClosingPopup().open()
return True
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(
exit_manager=self.exit_manager,
select_path=self.select_path,
previous=False,
ext=['.png', '.jpg']
)
self.manager.add_widget(self.file_manager)
self.file_manager.show(os.environ["HOME"])
self.manager_open = True
self.manager.open()
def select_path(self, path):
"""This method is used to save the select image"""
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.save('./images/default_identicon/{0}.png'.format(state.association))
self.load_selected_Image(state.association)
self.exit_manager()
toast('Image changed')
def exit_manager(self, *args):
"""Called when the user reaches the root of the directory tree."""
self.manager.dismiss()
self.manager_open = False
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)
top_box_obj.reload()
spinner_img_obj.reload()
def copy_composer_text(self, text):
"""Copy the data from mail detail page"""
Clipboard.copy(text)
toast('Copied')
class GrashofPopup(Popup):
"""Moule for save contacts and error messages"""
@ -1978,6 +2079,12 @@ class IconLeftSampleWidget(ILeftBodyTouch, MDIconButton):
pass
class IconRightSampleWidget(IRightBodyTouch, MDIconButton):
"""Right icon sample widget"""
pass
class IconRightSampleWidget(IRightBodyTouch, MDCheckbox):
"""Right icon sample widget"""
@ -2028,17 +2135,18 @@ class MailDetail(Screen):
"""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]
self.to_addr = data[0][0]
self.to_addr = data[0][0] if len(data[0][0]) > 4 else ' '
self.from_addr = data[0][1]
self.subject = subject.upper(
) if subject.upper() else '(no subject)'
self.subject = subject.capitalize(
) if subject.capitalize() else '(no subject)'
self.message = body
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/text_images/{0}.png'.format(
'avatar.png' if state.detailPageType == 'draft' else avatarImageFirstLetter(self.subject.strip()))
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]
def delete_mail(self):
"""Method for mail delete"""
@ -2092,12 +2200,13 @@ class MailDetail(Screen):
def callback_for_delete(self, dt=0):
"""Delete method from allmails"""
self.children[0].children[0].active = False
state.kivyapp.set_common_header()
self.parent.current = 'allmails' \
if state.is_allmail else state.detailPageType
state.detailPageType = ''
toast('Deleted')
if state.detailPageType:
self.children[0].children[0].active = False
state.kivyapp.set_common_header()
self.parent.current = 'allmails' \
if state.is_allmail else state.detailPageType
state.detailPageType = ''
toast('Deleted')
def inbox_reply(self):
"""Reply inbox messages"""
@ -2130,15 +2239,16 @@ class MailDetail(Screen):
self.parent.current = 'create'
navApp.set_navbar_for_composer()
def detailedPopup(self):
obj = SenderDetailPopup()
obj.open()
arg = (self.to_addr, self.from_addr, self.timeinseconds)
obj.assignDetail(*arg)
@staticmethod
def copy_composer_text(instance, *args):
"""Copy the data from mail detail page"""
if len(instance.parent.text.split(':')) > 1:
cpy_text = instance.parent.text.split(':')[1].strip()
else:
cpy_text = instance.parent.text
Clipboard.copy(cpy_text)
toast('Copied')
def callback_for_menu_items(text_item, *arg):
"""Callback of alert box"""
toast(text_item)
class MyaddDetailPopup(Popup):
@ -2159,7 +2269,10 @@ class MyaddDetailPopup(Popup):
def send_message_from(self):
"""Method used to fill from address of composer autofield"""
state.kivyapp.set_navbar_for_composer()
window_obj = self.parent.children[1].ids
try:
window_obj = self.parent.children[2].ids
except Exception as e:
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
window_obj.sc3.children[1].ids.txt_input.text = ''
@ -2210,7 +2323,10 @@ class AddbookDetailPopup(Popup):
def send_message_to(self):
"""Method used to fill to_address of composer autofield"""
state.kivyapp.set_navbar_for_composer()
window_obj = self.parent.children[1].ids
try:
window_obj = self.parent.children[2].ids
except Exception as e:
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 = ''
window_obj.sc3.children[1].ids.btn.text = 'Select'
@ -2243,6 +2359,7 @@ class AddbookDetailPopup(Popup):
class ShowQRCode(Screen):
"""ShowQRCode Screen uses to show the detail of mails"""
address = StringProperty()
def qrdisplay(self):
"""Method used for showing QR Code"""
@ -2253,7 +2370,9 @@ class ShowQRCode(Screen):
address = self.manager.get_parent_window().children[0].address
except Exception:
address = self.manager.get_parent_window().children[1].address
self.address = address
self.ids.qr.add_widget(QRCodeWidget(data=address))
self.ids.qr.children[0].show_border = False
toast('Show QR code')
@ -2531,10 +2650,9 @@ class Allmails(Screen):
subject = item[2].decode() if isinstance(item[2],bytes) else item[2]
meny = TwoLineAvatarIconListItem(
text=item[1],
secondary_text=body[:50] + '........' if len(
body) >= 50 else (
body + ',' + subject.replace(
'\n', ''))[0:50] + '........',
secondary_text=(subject[:50] + '........' if len(
subject) >= 50 else (
subject + ',' + body)[0:50] + '........').replace('\t', '').replace(' ', ''),
theme_text_color='Custom',
text_color=NavigateApp().theme_cls.primary_color)
meny.add_widget(AvatarSampleWidget(
@ -2543,6 +2661,7 @@ class Allmails(Screen):
meny.bind(on_press=partial(
self.mail_detail, item[5], item[4]))
meny.add_widget(AddTimeWidget(item[7]))
meny.add_widget(chipTag(item[4]))
carousel = Carousel(direction='right')
carousel.height = meny.height
carousel.size_hint_y = None
@ -2752,3 +2871,79 @@ class AppClosingPopup(Popup):
else:
self.dismiss()
toast(text)
class SenderDetailPopup(Popup):
"""SenderDetailPopup pop is used for showing my address detail"""
to_addr = StringProperty()
from_addr = StringProperty()
time_tag = StringProperty()
def __init__(self, **kwargs):
"""this metthod initialized the send message detial popup"""
super(SenderDetailPopup, self).__init__(**kwargs)
def assignDetail(self, to_addr, from_addr, timeinseconds):
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)
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
frmaddbox = ToAddrBoxlayout()
frmaddbox.set_toAddress(to_addr)
self.ids.to_addId.add_widget(frmaddbox)
else:
self.height = 0
self.height = pop_height/1.5
class OneLineListTitle(OneLineListItem):
"""class for long press behaviour"""
__events__ = ('on_long_press', )
long_press_time = NumericProperty(1)
def on_state(self, instance, value):
if value == 'down':
lpt = self.long_press_time
self._clockev = Clock.schedule_once(self._do_long_press, lpt)
else:
self._clockev.cancel()
def _do_long_press(self, dt):
self.dispatch('on_long_press')
def on_long_press(self, *largs):
self.copymessageTitle(self.text)
def copymessageTitle(self, text):
"""this method is for displaying dialog box"""
width = .8 if platform == 'android' else .55
msg_dialog = MDDialog(
text=text,
title='', size_hint=(width, .25),
text_button_cancel='Cancel',
text_button_ok='Copy',
events_callback=self.callback_for_copy_title)
msg_dialog.open()
@staticmethod
def callback_for_copy_title(text_item, *arg):
"""Callback of alert box"""
if text_item == 'Copy':
Clipboard.copy(str(arg[0].text))
toast(text_item)
class ToAddrBoxlayout(BoxLayout):
"""class for BoxLayout behaviour"""
to_addr = StringProperty()
def set_toAddress(self, to_addr):
self.to_addr = to_addr
pass

View File

@ -144,11 +144,11 @@ class objectProcessor(threading.Thread):
sqlExecute(
'UPDATE sent SET status=?, lastactiontime=?'
' WHERE ackdata=?',
'ackreceived', int(time.time()), data[readPosition:])
'ackreceived', int(time.time()), bytes(data[readPosition:]))
queues.UISignalQueue.put((
'updateSentItemStatusByAckdata',
(
data[readPosition:],
bytes(data[readPosition:]),
tr._translate(
"MainWindow",
"Acknowledgement of the message received %1"

View File

@ -687,9 +687,14 @@ def _unpack_binary(code, fp, options):
length = struct.unpack(">I", _read_except(fp, 4))[0]
else:
raise Exception("logic error, not binary: 0x%02x" % ord(code))
return _read_except(fp, length)
#Added Decode method for python3
data = _read_except(fp, length)
try:
return bytes.decode(data, 'utf-8')
except UnicodeDecodeError:
if options.get("allow_invalid_utf8"):
return InvalidString(data)
raise InvalidStringException("unpacked string is invalid utf-8")
def _unpack_ext(code, fp, options):
if code == b'\xd4':

View File

@ -54,7 +54,6 @@ def encrypt(msg, hexPubkey):
def decrypt(msg, hexPrivkey):
print("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS#################################################")
"""Decrypts message with hex private key"""
return makeCryptor(hexPrivkey).decrypt(msg)

View File

@ -141,7 +141,7 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
except BMObjectAlreadyHaveError:
logger.debug(
'%(host)s:%(port)i already got object, skipping',
self.destinaestion._asdict())
self.destination._asdict())
except struct.error:
logger.debug('decoding error, skipping')
except ValueError:
@ -409,7 +409,7 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
try:
self.object.checkObjectByType()
objectProcessorQueue.put((
self.object.objectType, memoryview(self.object.data)))
self.object.objectType, memoryview(self.object.data)))
except BMObjectInvalidError:
BMProto.stopDownloadingObject(self.object.inventoryHash, True)
else:
@ -420,13 +420,11 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
if self.object.inventoryHash in Inventory()._realInventory and Dandelion().hasHash(self.object.inventoryHash):
Dandelion().removeHash(self.object.inventoryHash, "cycle detection")
[self.object.inventoryHash] = (
Inventory()._realInventory[self.object.inventoryHash] = (
self.object.objectType, self.object.streamNumber,
memoryview(self.payload[objectOffset:]), self.object.expiresTime,
memoryview(self.object.tag)
)
Inventory()[self.object.inventoryHash]
self.handleReceivedObject(
self.object.streamNumber, self.object.inventoryHash)
invQueue.put((

View File

@ -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] 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)
@ -444,7 +444,6 @@ def decryptAndCheckPubkeyPayload(data, address):
# That sort of address-malleability should have been caught
# by the UI or API and an error given to the user.
return 'failed'
print("WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW#################################################")
try:
decryptedData = cryptorObject.decrypt(encryptedData)
except:
@ -455,7 +454,6 @@ def decryptAndCheckPubkeyPayload(data, address):
readPosition = 0
# bitfieldBehaviors = decryptedData[readPosition:readPosition + 4]
readPosition += 4
print("working fine till here#################################################################")
publicSigningKey = '\x04'.encode() + decryptedData[readPosition:readPosition + 64]
readPosition += 64
publicEncryptionKey = '\x04'.encode() + decryptedData[readPosition:readPosition + 64]
@ -503,7 +501,6 @@ def decryptAndCheckPubkeyPayload(data, address):
)
t = (address, addressVersion, storedData, int(time.time()), 'yes')
sqlExecute('''INSERT INTO pubkeys VALUES (?,?,?,?,?)''', *t)
print("successful Insertion of pubkey hurray#################################################")
return 'successful'
except varintDecodeError:
logger.info(

View File

@ -42,8 +42,11 @@ class SqliteInventory(InventoryStorage): # pylint: disable=too-many-ancestors
def __getitem__(self, hash_):
with self.lock:
if hash_ in self._inventory:
return self._inventory[hash_]
if isinstance(hash_,memoryview) and bytes(hash_) in self._inventory :
return self._inventory[bytes(hash_)]
else:
if hash_ in self._inventory:
return self._inventory[hash_]
rows = sqlQuery(
'SELECT objecttype, streamnumber, payload, expirestime, tag'
' FROM inventory WHERE hash=?', sqlite3.Binary(hash_))
@ -91,7 +94,6 @@ class SqliteInventory(InventoryStorage): # pylint: disable=too-many-ancestors
hashes += (payload for payload, in sqlQuery(
'SELECT hash FROM inventory WHERE streamnumber=?'
' AND expirestime>?', stream, t))
# print('sqlllllllllllllllllllllllllllllllllll',hashes)
return hashes
def flush(self):