launch py3 convert app for first phase(need to do more checks)
This commit is contained in:
parent
afb368e770
commit
42ee9d910b
|
@ -46,13 +46,13 @@ def generate_hash(string):
|
||||||
# make input case insensitive
|
# make input case insensitive
|
||||||
string = str.lower(string)
|
string = str.lower(string)
|
||||||
hash_object = hashlib.md5(str.encode(string))
|
hash_object = hashlib.md5(str.encode(string))
|
||||||
print hash_object.hexdigest()
|
print(hash_object.hexdigest())
|
||||||
|
|
||||||
# returned object is a hex string
|
# returned object is a hex string
|
||||||
return hash_object.hexdigest()
|
return hash_object.hexdigest()
|
||||||
|
|
||||||
except IndexError:
|
except IndexError:
|
||||||
print "Error: Please enter a string as an argument."
|
print("Error: Please enter a string as an argument.")
|
||||||
|
|
||||||
|
|
||||||
def random_color(hash_string):
|
def random_color(hash_string):
|
||||||
|
|
|
@ -1,43 +1,38 @@
|
||||||
|
|
||||||
#:import Toolbar kivymd.toolbar.Toolbar
|
#:import MDToolbar kivymd.uix.toolbar.MDToolbar
|
||||||
#:import ThemeManager kivymd.theming.ThemeManager
|
#:import ThemeManager kivymd.theming.ThemeManager
|
||||||
#:import MDNavigationDrawer kivymd.navigationdrawer.MDNavigationDrawer
|
#:import MDNavigationDrawer kivymd.uix.navigationdrawer.MDNavigationDrawer
|
||||||
#:import NavigationLayout kivymd.navigationdrawer.NavigationLayout
|
#:import NavigationLayout kivymd.uix.navigationdrawer.NavigationLayout
|
||||||
#:import NavigationDrawerDivider kivymd.navigationdrawer.NavigationDrawerDivider
|
#:import NavigationDrawerDivider kivymd.uix.navigationdrawer.NavigationDrawerDivider
|
||||||
#:import NavigationDrawerToolbar kivymd.navigationdrawer.NavigationDrawerToolbar
|
#:import NavigationDrawerToolbar kivymd.uix.navigationdrawer.NavigationDrawerToolbar
|
||||||
#:import NavigationDrawerSubheader kivymd.navigationdrawer.NavigationDrawerSubheader
|
#:import NavigationDrawerSubheader kivymd.uix.navigationdrawer.NavigationDrawerSubheader
|
||||||
#:import MDCheckbox kivymd.selectioncontrols.MDCheckbox
|
#:import MDCheckbox kivymd.uix.selectioncontrol.MDCheckbox
|
||||||
#:import MDSwitch kivymd.selectioncontrols.MDSwitch
|
#:import MDSwitch kivymd.uix.selectioncontrol.MDSwitch
|
||||||
#:import MDList kivymd.list.MDList
|
#:import MDList kivymd.uix.list.MDList
|
||||||
#:import OneLineListItem kivymd.list.OneLineListItem
|
#:import OneLineListItem kivymd.uix.list.OneLineListItem
|
||||||
#:import TwoLineListItem kivymd.list.TwoLineListItem
|
#:import TwoLineListItem kivymd.uix.list.TwoLineListItem
|
||||||
#:import ThreeLineListItem kivymd.list.ThreeLineListItem
|
#:import ThreeLineListItem kivymd.uix.list.ThreeLineListItem
|
||||||
#:import OneLineAvatarListItem kivymd.list.OneLineAvatarListItem
|
#:import OneLineAvatarListItem kivymd.uix.list.OneLineAvatarListItem
|
||||||
#:import OneLineIconListItem kivymd.list.OneLineIconListItem
|
#:import OneLineIconListItem kivymd.uix.list.OneLineIconListItem
|
||||||
#:import OneLineAvatarIconListItem kivymd.list.OneLineAvatarIconListItem
|
#:import OneLineAvatarIconListItem kivymd.uix.list.OneLineAvatarIconListItem
|
||||||
#:import MDTextField kivymd.textfields.MDTextField
|
#:import MDTextField kivymd.uix.textfield.MDTextField
|
||||||
#:import MDSpinner kivymd.spinner.MDSpinner
|
#:import MDSpinner kivymd.uix.spinner.MDSpinner
|
||||||
#:import MDCard kivymd.card.MDCard
|
#:import MDCard kivymd.uix.card.MDCard
|
||||||
#:import MDSeparator kivymd.card.MDSeparator
|
#:import MDSeparator kivymd.uix.card.MDSeparator
|
||||||
#:import MDDropdownMenu kivymd.menu.MDDropdownMenu
|
#:import MDDropdownMenu kivymd.uix.menu.MDDropdownMenu
|
||||||
#:import get_color_from_hex kivy.utils.get_color_from_hex
|
#:import get_color_from_hex kivy.utils.get_color_from_hex
|
||||||
#:import colors kivymd.color_definitions.colors
|
#:import colors kivymd.color_definitions.colors
|
||||||
#:import SmartTile kivymd.grid.SmartTile
|
#:import MDSlider kivymd.uix.slider.MDSlider
|
||||||
#:import MDSlider kivymd.slider.MDSlider
|
#:import MDTabs kivymd.uix.tab.MDTabs
|
||||||
#:import MDTabbedPanel kivymd.tabs.MDTabbedPanel
|
#:import MDProgressBar kivymd.uix.progressbar.MDProgressBar
|
||||||
#:import MDTab kivymd.tabs.MDTab
|
#:import MDAccordion kivymd.uix.accordion.MDAccordion
|
||||||
#:import MDProgressBar kivymd.progressbar.MDProgressBar
|
#:import MDAccordionItem kivymd.uix.accordion.MDAccordionItem
|
||||||
#:import MDAccordion kivymd.accordion.MDAccordion
|
#:import MDAccordionSubItem kivymd.uix.accordion.MDAccordionSubItem
|
||||||
#:import MDAccordionItem kivymd.accordion.MDAccordionItem
|
#:import MDFloatingActionButton kivymd.uix.button.MDFloatingActionButton
|
||||||
#:import MDAccordionSubItem kivymd.accordion.MDAccordionSubItem
|
|
||||||
#:import MDThemePicker kivymd.theme_picker.MDThemePicker
|
|
||||||
#:import MDBottomNavigation kivymd.tabs.MDBottomNavigation
|
|
||||||
#:import MDBottomNavigationItem kivymd.tabs.MDBottomNavigationItem
|
|
||||||
#:import MDFloatingActionButton kivymd.button.MDFloatingActionButton
|
|
||||||
#:import Factory kivy.factory.Factory
|
#:import Factory kivy.factory.Factory
|
||||||
#:import MDTextButton kivymd.button.MDTextButton
|
#:import MDTextButton kivymd.uix.button.MDTextButton
|
||||||
#:import FadeTransition kivy.uix.screenmanager.FadeTransition
|
#:import FadeTransition kivy.uix.screenmanager.FadeTransition
|
||||||
#:import MDScrollViewRefreshLayout kivymd.refreshlayout.MDScrollViewRefreshLayout
|
#:import MDScrollViewRefreshLayout kivymd.uix.refreshlayout.MDScrollViewRefreshLayout
|
||||||
|
|
||||||
#:set color_button (0.784, 0.443, 0.216, 1) # brown
|
#:set color_button (0.784, 0.443, 0.216, 1) # brown
|
||||||
#:set color_button_pressed (0.659, 0.522, 0.431, 1) # darker brown
|
#:set color_button_pressed (0.659, 0.522, 0.431, 1) # darker brown
|
||||||
|
@ -176,7 +171,7 @@ NavigationLayout:
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
id: box_layout
|
id: box_layout
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
Toolbar:
|
MDToolbar:
|
||||||
id: toolbar
|
id: toolbar
|
||||||
title: app.current_address_label()
|
title: app.current_address_label()
|
||||||
opacity: 1 if app.addressexist() else 0
|
opacity: 1 if app.addressexist() else 0
|
||||||
|
@ -342,7 +337,7 @@ NavigationLayout:
|
||||||
size_hint: .6, .35
|
size_hint: .6, .35
|
||||||
height: dp(40)
|
height: dp(40)
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: root.available_credits
|
text: root.available_credits
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
|
@ -423,7 +418,7 @@ NavigationLayout:
|
||||||
height: dp(40)
|
height: dp(40)
|
||||||
on_press: root.reset_composer()
|
on_press: root.reset_composer()
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'reset'
|
text: 'reset'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
|
@ -521,7 +516,7 @@ NavigationLayout:
|
||||||
height: dp(40)
|
height: dp(40)
|
||||||
on_press: app.root.ids.scr_mngr.current = 'random'
|
on_press: app.root.ids.scr_mngr.current = 'random'
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'proceed'
|
text: 'proceed'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
|
@ -566,7 +561,7 @@ NavigationLayout:
|
||||||
on_release: root.generateaddress(app)
|
on_release: root.generateaddress(app)
|
||||||
opposite_colors: True
|
opposite_colors: True
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'next'
|
text: 'next'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
|
@ -594,7 +589,7 @@ NavigationLayout:
|
||||||
size_hint: .6, .55
|
size_hint: .6, .55
|
||||||
height: dp(40)
|
height: dp(40)
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'Server'
|
text: 'Server'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
|
@ -607,7 +602,7 @@ NavigationLayout:
|
||||||
size_hint: .6, .55
|
size_hint: .6, .55
|
||||||
height: dp(40)
|
height: dp(40)
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'Import or export data'
|
text: 'Import or export data'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
|
@ -620,7 +615,7 @@ NavigationLayout:
|
||||||
size_hint: .6, .55
|
size_hint: .6, .55
|
||||||
height: dp(40)
|
height: dp(40)
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'Restart background service'
|
text: 'Restart background service'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
|
@ -698,20 +693,20 @@ NavigationLayout:
|
||||||
size: self.size
|
size: self.size
|
||||||
MDLabel:
|
MDLabel:
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
font_style: 'Headline'
|
font_style: 'Subtitle1'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: 'Platinum'
|
text: 'Platinum'
|
||||||
halign: 'center'
|
halign: 'center'
|
||||||
color: 1,1,1,1
|
color: 1,1,1,1
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Subhead'
|
font_style: 'H4'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: 'We provide subscriptions for proof of work calculation for first month. '
|
text: 'We provide subscriptions for proof of work calculation for first month. '
|
||||||
halign: 'center'
|
halign: 'center'
|
||||||
color: 1,1,1,1
|
color: 1,1,1,1
|
||||||
MDLabel:
|
MDLabel:
|
||||||
id: free_pak
|
id: free_pak
|
||||||
font_style: 'Headline'
|
font_style: 'Subtitle1'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: '€ 50.0'
|
text: '€ 50.0'
|
||||||
halign: 'center'
|
halign: 'center'
|
||||||
|
@ -727,7 +722,7 @@ NavigationLayout:
|
||||||
height: dp(40)
|
height: dp(40)
|
||||||
on_press: root.get_available_credits(self)
|
on_press: root.get_available_credits(self)
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'Get Free Credits'
|
text: 'Get Free Credits'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (0,0,0,1)
|
color: (0,0,0,1)
|
||||||
|
@ -744,19 +739,19 @@ NavigationLayout:
|
||||||
size: self.size
|
size: self.size
|
||||||
MDLabel:
|
MDLabel:
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
font_style: 'Headline'
|
font_style: 'Subtitle1'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: 'Silver'
|
text: 'Silver'
|
||||||
halign: 'center'
|
halign: 'center'
|
||||||
color: 1,1,1,1
|
color: 1,1,1,1
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Subhead'
|
font_style: 'H4'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: 'We provide for proof of work calculation for six month. '
|
text: 'We provide for proof of work calculation for six month. '
|
||||||
halign: 'center'
|
halign: 'center'
|
||||||
color: 1,1,1,1
|
color: 1,1,1,1
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Headline'
|
font_style: 'Subtitle1'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: '€ 100.0'
|
text: '€ 100.0'
|
||||||
halign: 'center'
|
halign: 'center'
|
||||||
|
@ -771,7 +766,7 @@ NavigationLayout:
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: dp(40)
|
height: dp(40)
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'Get Monthly Credits'
|
text: 'Get Monthly Credits'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (0,0,0,1)
|
color: (0,0,0,1)
|
||||||
|
@ -788,19 +783,19 @@ NavigationLayout:
|
||||||
size: self.size
|
size: self.size
|
||||||
MDLabel:
|
MDLabel:
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
font_style: 'Headline'
|
font_style: 'Subtitle1'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: 'Gold'
|
text: 'Gold'
|
||||||
halign: 'center'
|
halign: 'center'
|
||||||
color: 1,1,1,1
|
color: 1,1,1,1
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Subhead'
|
font_style: 'H4'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: 'We provide for proof of work calculation for 1years. '
|
text: 'We provide for proof of work calculation for 1years. '
|
||||||
halign: 'center'
|
halign: 'center'
|
||||||
color: 1,1,1,1
|
color: 1,1,1,1
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Headline'
|
font_style: 'Subtitle1'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: '€ 500.0'
|
text: '€ 500.0'
|
||||||
halign: 'center'
|
halign: 'center'
|
||||||
|
@ -815,7 +810,7 @@ NavigationLayout:
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: dp(40)
|
height: dp(40)
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'Get Yearly Credits'
|
text: 'Get Yearly Credits'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (0,0,0,1)
|
color: (0,0,0,1)
|
||||||
|
@ -862,7 +857,7 @@ NavigationLayout:
|
||||||
on_release:
|
on_release:
|
||||||
root.savecontact()
|
root.savecontact()
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'Save'
|
text: 'Save'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
|
@ -873,7 +868,7 @@ NavigationLayout:
|
||||||
on_press: root.dismiss()
|
on_press: root.dismiss()
|
||||||
on_press: root.close_pop()
|
on_press: root.close_pop()
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'Cancel'
|
text: 'Cancel'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
|
@ -882,7 +877,7 @@ NavigationLayout:
|
||||||
size_hint: 2, None
|
size_hint: 2, None
|
||||||
height: dp(40)
|
height: dp(40)
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'Scan QR code'
|
text: 'Scan QR code'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
|
@ -891,93 +886,8 @@ NavigationLayout:
|
||||||
|
|
||||||
<NetworkStat>:
|
<NetworkStat>:
|
||||||
name: 'networkstat'
|
name: 'networkstat'
|
||||||
MDTabbedPanel:
|
Label:
|
||||||
id: tab_panel
|
text:"surbhi"
|
||||||
tab_display_mode:'text'
|
|
||||||
|
|
||||||
MDTab:
|
|
||||||
name: 'connections'
|
|
||||||
text: "Total connections"
|
|
||||||
ScrollView:
|
|
||||||
do_scroll_x: False
|
|
||||||
MDList:
|
|
||||||
id: ml
|
|
||||||
size_hint_y: None
|
|
||||||
height: dp(200)
|
|
||||||
OneLineListItem:
|
|
||||||
text: "Total Connections"
|
|
||||||
BoxLayout:
|
|
||||||
AnchorLayout:
|
|
||||||
MDRaisedButton:
|
|
||||||
size_hint: .6, .35
|
|
||||||
height: dp(40)
|
|
||||||
MDLabel:
|
|
||||||
font_style: 'Title'
|
|
||||||
text: root.text_variable_1
|
|
||||||
font_size: '13sp'
|
|
||||||
color: (1,1,1,1)
|
|
||||||
halign: 'center'
|
|
||||||
MDTab:
|
|
||||||
name: 'processes'
|
|
||||||
text: 'Processes'
|
|
||||||
ScrollView:
|
|
||||||
do_scroll_x: False
|
|
||||||
MDList:
|
|
||||||
id: ml
|
|
||||||
size_hint_y: None
|
|
||||||
height: dp(500)
|
|
||||||
OneLineListItem:
|
|
||||||
text: "person-to-person"
|
|
||||||
BoxLayout:
|
|
||||||
AnchorLayout:
|
|
||||||
MDRaisedButton:
|
|
||||||
size_hint: .7, .6
|
|
||||||
height: dp(40)
|
|
||||||
MDLabel:
|
|
||||||
font_style: 'Title'
|
|
||||||
text: root.text_variable_2
|
|
||||||
font_size: '13sp'
|
|
||||||
color: (1,1,1,1)
|
|
||||||
halign: 'center'
|
|
||||||
OneLineListItem:
|
|
||||||
text: "Brodcast"
|
|
||||||
BoxLayout:
|
|
||||||
AnchorLayout:
|
|
||||||
MDRaisedButton:
|
|
||||||
size_hint: .7, .6
|
|
||||||
height: dp(40)
|
|
||||||
MDLabel:
|
|
||||||
font_style: 'Title'
|
|
||||||
text: root.text_variable_3
|
|
||||||
font_size: '13sp'
|
|
||||||
color: (1,1,1,1)
|
|
||||||
halign: 'center'
|
|
||||||
OneLineListItem:
|
|
||||||
text: "publickeys"
|
|
||||||
BoxLayout:
|
|
||||||
AnchorLayout:
|
|
||||||
MDRaisedButton:
|
|
||||||
size_hint: .7, .6
|
|
||||||
height: dp(40)
|
|
||||||
MDLabel:
|
|
||||||
font_style: 'Title'
|
|
||||||
text: root.text_variable_4
|
|
||||||
font_size: '13sp'
|
|
||||||
color: (1,1,1,1)
|
|
||||||
halign: 'center'
|
|
||||||
OneLineListItem:
|
|
||||||
text: "objects"
|
|
||||||
BoxLayout:
|
|
||||||
AnchorLayout:
|
|
||||||
MDRaisedButton:
|
|
||||||
size_hint: .7, .6
|
|
||||||
height: dp(40)
|
|
||||||
MDLabel:
|
|
||||||
font_style: 'Title'
|
|
||||||
text: root.text_variable_5
|
|
||||||
font_size: '13sp'
|
|
||||||
color: (1,1,1,1)
|
|
||||||
halign: 'center'
|
|
||||||
|
|
||||||
<MailDetail>:
|
<MailDetail>:
|
||||||
name: 'mailDetail'
|
name: 'mailDetail'
|
||||||
|
@ -989,31 +899,31 @@ NavigationLayout:
|
||||||
height: dp(500) + self.minimum_height
|
height: dp(500) + self.minimum_height
|
||||||
padding: dp(32)
|
padding: dp(32)
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Headline'
|
font_style: 'Subtitle1'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: root.subject
|
text: root.subject
|
||||||
halign: 'left'
|
halign: 'left'
|
||||||
font_size: '20sp'
|
font_size: '20sp'
|
||||||
CopyTextBtn:
|
CopyTextBtn:
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Subhead'
|
font_style: 'H4'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: "From: " + root.from_addr
|
text: "From: " + root.from_addr
|
||||||
halign: 'left'
|
halign: 'left'
|
||||||
CopyTextBtn:
|
CopyTextBtn:
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Subhead'
|
font_style: 'H4'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: "To: " + root.to_addr
|
text: "To: " + root.to_addr
|
||||||
halign: 'left'
|
halign: 'left'
|
||||||
CopyTextBtn:
|
CopyTextBtn:
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Subhead'
|
font_style: 'H4'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: root.status
|
text: root.status
|
||||||
halign: 'left'
|
halign: 'left'
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Subhead'
|
font_style: 'H4'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: root.message
|
text: root.message
|
||||||
halign: 'left'
|
halign: 'left'
|
||||||
|
@ -1072,25 +982,25 @@ NavigationLayout:
|
||||||
spacing:dp(25)
|
spacing:dp(25)
|
||||||
MDLabel:
|
MDLabel:
|
||||||
id: myaddr_label
|
id: myaddr_label
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: "Label"
|
text: "Label"
|
||||||
font_size: '17sp'
|
font_size: '17sp'
|
||||||
halign: 'left'
|
halign: 'left'
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Subhead'
|
font_style: 'H4'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: root.address_label
|
text: root.address_label
|
||||||
font_size: '15sp'
|
font_size: '15sp'
|
||||||
halign: 'left'
|
halign: 'left'
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: "Address"
|
text: "Address"
|
||||||
font_size: '17sp'
|
font_size: '17sp'
|
||||||
halign: 'left'
|
halign: 'left'
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Subhead'
|
font_style: 'H4'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: root.address
|
text: root.address
|
||||||
font_size: '15sp'
|
font_size: '15sp'
|
||||||
|
@ -1104,7 +1014,7 @@ NavigationLayout:
|
||||||
height: dp(40)
|
height: dp(40)
|
||||||
on_press: root.send_message_from()
|
on_press: root.send_message_from()
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'Send message from'
|
text: 'Send message from'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
|
@ -1116,7 +1026,7 @@ NavigationLayout:
|
||||||
on_press: app.root.ids.scr_mngr.current = 'showqrcode'
|
on_press: app.root.ids.scr_mngr.current = 'showqrcode'
|
||||||
on_press: app.root.ids.sc15.qrdisplay()
|
on_press: app.root.ids.sc15.qrdisplay()
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'Show QR code'
|
text: 'Show QR code'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
|
@ -1127,7 +1037,7 @@ NavigationLayout:
|
||||||
on_press: root.dismiss()
|
on_press: root.dismiss()
|
||||||
on_press: root.close_pop()
|
on_press: root.close_pop()
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'Cancel'
|
text: 'Cancel'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
|
@ -1151,14 +1061,14 @@ NavigationLayout:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
spacing:dp(20)
|
spacing:dp(20)
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: "Label"
|
text: "Label"
|
||||||
font_size: '17sp'
|
font_size: '17sp'
|
||||||
halign: 'left'
|
halign: 'left'
|
||||||
MDTextField:
|
MDTextField:
|
||||||
id: add_label
|
id: add_label
|
||||||
font_style: 'Subhead'
|
font_style: 'H4'
|
||||||
font_size: '15sp'
|
font_size: '15sp'
|
||||||
halign: 'left'
|
halign: 'left'
|
||||||
text: root.address_label
|
text: root.address_label
|
||||||
|
@ -1166,13 +1076,13 @@ NavigationLayout:
|
||||||
required: True
|
required: True
|
||||||
helper_text_mode: "on_error"
|
helper_text_mode: "on_error"
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: "Address"
|
text: "Address"
|
||||||
font_size: '17sp'
|
font_size: '17sp'
|
||||||
halign: 'left'
|
halign: 'left'
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Subhead'
|
font_style: 'H4'
|
||||||
theme_text_color: 'Primary'
|
theme_text_color: 'Primary'
|
||||||
text: root.address
|
text: root.address
|
||||||
font_size: '15sp'
|
font_size: '15sp'
|
||||||
|
@ -1186,7 +1096,7 @@ NavigationLayout:
|
||||||
height: dp(40)
|
height: dp(40)
|
||||||
on_press: root.send_message_to()
|
on_press: root.send_message_to()
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'Send message to'
|
text: 'Send message to'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
|
@ -1197,7 +1107,7 @@ NavigationLayout:
|
||||||
font_size: '10sp'
|
font_size: '10sp'
|
||||||
on_press: root.update_addbook_label(root.address)
|
on_press: root.update_addbook_label(root.address)
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'Save'
|
text: 'Save'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
|
@ -1208,7 +1118,7 @@ NavigationLayout:
|
||||||
on_press: root.dismiss()
|
on_press: root.dismiss()
|
||||||
on_press: root.close_pop()
|
on_press: root.close_pop()
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'Title'
|
font_style: 'H4'
|
||||||
text: 'Cancel'
|
text: 'Cancel'
|
||||||
font_size: '13sp'
|
font_size: '13sp'
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
|
|
|
@ -35,27 +35,31 @@ from kivy.uix.screenmanager import Screen
|
||||||
from kivy.uix.spinner import Spinner
|
from kivy.uix.spinner import Spinner
|
||||||
from kivy.uix.textinput import TextInput
|
from kivy.uix.textinput import TextInput
|
||||||
from kivy.utils import platform
|
from kivy.utils import platform
|
||||||
import kivy_helper_search
|
from bitmessagekivy import kivy_helper_search
|
||||||
from kivymd.button import MDIconButton
|
from kivymd.uix.dialog import MDDialog
|
||||||
from kivymd.dialog import MDDialog
|
from kivymd.uix.button import MDIconButton
|
||||||
from kivymd.label import MDLabel
|
from kivymd.uix.label import MDLabel
|
||||||
from kivymd.list import (
|
from kivymd.uix.list import (
|
||||||
ILeftBody,
|
ILeftBody,
|
||||||
ILeftBodyTouch,
|
ILeftBodyTouch,
|
||||||
IRightBodyTouch,
|
IRightBodyTouch,
|
||||||
TwoLineAvatarIconListItem,
|
TwoLineAvatarIconListItem,
|
||||||
TwoLineListItem)
|
TwoLineListItem)
|
||||||
from kivymd.navigationdrawer import (
|
from kivymd.uix.navigationdrawer import (
|
||||||
MDNavigationDrawer,
|
MDNavigationDrawer,
|
||||||
NavigationDrawerHeaderBase)
|
NavigationDrawerHeaderBase)
|
||||||
from kivymd.selectioncontrols import MDCheckbox
|
from kivymd.uix.selectioncontrol import MDCheckbox
|
||||||
from kivymd.theming import ThemeManager
|
from kivymd.theming import ThemeManager
|
||||||
import queues
|
import queues
|
||||||
from semaphores import kivyuisignaler
|
from semaphores import kivyuisignaler
|
||||||
import state
|
import state
|
||||||
from uikivysignaler import UIkivySignaler
|
|
||||||
|
|
||||||
import identiconGeneration
|
from bitmessagekivy.uikivysignaler import UIkivySignaler
|
||||||
|
# pylint: disable=unused-argument, too-few-public-methods, import-error
|
||||||
|
|
||||||
|
from bitmessagekivy import identiconGeneration
|
||||||
|
import os
|
||||||
|
from kivy.core.clipboard import Clipboard
|
||||||
# pylint: disable=unused-argument, too-few-public-methods
|
# pylint: disable=unused-argument, too-few-public-methods
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,7 +93,7 @@ class Inbox(Screen):
|
||||||
def init_ui(self, dt=0):
|
def init_ui(self, dt=0):
|
||||||
"""Clock Schdule for method inbox accounts."""
|
"""Clock Schdule for method inbox accounts."""
|
||||||
self.inboxaccounts()
|
self.inboxaccounts()
|
||||||
print dt
|
print (dt)
|
||||||
|
|
||||||
def inboxaccounts(self):
|
def inboxaccounts(self):
|
||||||
"""Load inbox accounts."""
|
"""Load inbox accounts."""
|
||||||
|
@ -329,7 +333,7 @@ class AddressBook(Screen):
|
||||||
def init_ui(self, dt=0):
|
def init_ui(self, dt=0):
|
||||||
"""Clock Schdule for method AddressBook."""
|
"""Clock Schdule for method AddressBook."""
|
||||||
self.loadAddresslist(None, 'All', '')
|
self.loadAddresslist(None, 'All', '')
|
||||||
print dt
|
print (dt)
|
||||||
|
|
||||||
def loadAddresslist(self, account, where="", what=""):
|
def loadAddresslist(self, account, where="", what=""):
|
||||||
"""Clock Schdule for method AddressBook."""
|
"""Clock Schdule for method AddressBook."""
|
||||||
|
@ -428,7 +432,7 @@ class SelectableLabel(RecycleDataViewBehavior, Label):
|
||||||
"""Respond to the selection of items in the view."""
|
"""Respond to the selection of items in the view."""
|
||||||
self.selected = is_selected
|
self.selected = is_selected
|
||||||
if is_selected:
|
if is_selected:
|
||||||
print "selection changed to {0}".format(rv.data[index])
|
print("selection changed to {0}".format(rv.data[index]))
|
||||||
rv.parent.txt_input.text = rv.parent.txt_input.text.replace(
|
rv.parent.txt_input.text = rv.parent.txt_input.text.replace(
|
||||||
rv.parent.txt_input.text, rv.data[index]['text'])
|
rv.parent.txt_input.text, rv.data[index]['text'])
|
||||||
|
|
||||||
|
@ -455,7 +459,7 @@ class DropDownWidget(BoxLayout):
|
||||||
subject = self.ids.subject.text.encode('utf-8').strip()
|
subject = self.ids.subject.text.encode('utf-8').strip()
|
||||||
message = self.ids.body.text.encode('utf-8').strip()
|
message = self.ids.body.text.encode('utf-8').strip()
|
||||||
encoding = 3
|
encoding = 3
|
||||||
print "message: ", self.ids.body.text
|
print ("message: ", self.ids.body.text)
|
||||||
sendMessageToPeople = True
|
sendMessageToPeople = True
|
||||||
if sendMessageToPeople:
|
if sendMessageToPeople:
|
||||||
if toAddress != '' and subject and message:
|
if toAddress != '' and subject and message:
|
||||||
|
@ -483,12 +487,12 @@ class DropDownWidget(BoxLayout):
|
||||||
toAddress = addBMIfNotPresent(toAddress)
|
toAddress = addBMIfNotPresent(toAddress)
|
||||||
statusIconColor = 'red'
|
statusIconColor = 'red'
|
||||||
if addressVersionNumber > 4 or addressVersionNumber <= 1:
|
if addressVersionNumber > 4 or addressVersionNumber <= 1:
|
||||||
print "addressVersionNumber > 4 \
|
print("addressVersionNumber > 4 \
|
||||||
or addressVersionNumber <= 1"
|
or addressVersionNumber <= 1")
|
||||||
if streamNumber > 1 or streamNumber == 0:
|
if streamNumber > 1 or streamNumber == 0:
|
||||||
print "streamNumber > 1 or streamNumber == 0"
|
print("streamNumber > 1 or streamNumber == 0")
|
||||||
if statusIconColor == 'red':
|
if statusIconColor == 'red':
|
||||||
print "shared.statusIconColor == 'red'"
|
print("shared.statusIconColor == 'red'")
|
||||||
stealthLevel = BMConfigParser().safeGetInt(
|
stealthLevel = BMConfigParser().safeGetInt(
|
||||||
'bitmessagesettings', 'ackstealthlevel')
|
'bitmessagesettings', 'ackstealthlevel')
|
||||||
from helper_ackPayload import genAckPayload
|
from helper_ackPayload import genAckPayload
|
||||||
|
@ -523,7 +527,7 @@ class DropDownWidget(BoxLayout):
|
||||||
toLabel = ''
|
toLabel = ''
|
||||||
|
|
||||||
queues.workerQueue.put(('sendmessage', toAddress))
|
queues.workerQueue.put(('sendmessage', toAddress))
|
||||||
print "sqlExecute successfully #######################"
|
print ("sqlExecute successfully #######################")
|
||||||
self.parent.parent.current = 'inbox'
|
self.parent.parent.current = 'inbox'
|
||||||
state.in_composer = True
|
state.in_composer = True
|
||||||
navApp.back_press()
|
navApp.back_press()
|
||||||
|
@ -718,7 +722,7 @@ class Sent(Screen):
|
||||||
def init_ui(self, dt=0):
|
def init_ui(self, dt=0):
|
||||||
"""Clock Schdule for method sent accounts."""
|
"""Clock Schdule for method sent accounts."""
|
||||||
self.sentaccounts()
|
self.sentaccounts()
|
||||||
print dt
|
print(dt)
|
||||||
|
|
||||||
def sentaccounts(self):
|
def sentaccounts(self):
|
||||||
"""Load sent accounts."""
|
"""Load sent accounts."""
|
||||||
|
@ -1088,7 +1092,7 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
|
||||||
if not os.path.exists(directory):
|
if not os.path.exists(directory):
|
||||||
os.makedirs(directory)
|
os.makedirs(directory)
|
||||||
except OSError:
|
except OSError:
|
||||||
print 'Error: Creating directory. ' + directory
|
print('Error: Creating directory. ' + directory)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_default_image():
|
def get_default_image():
|
||||||
|
@ -1179,7 +1183,7 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def on_stop():
|
def on_stop():
|
||||||
"""On stop methos is used for stoping the runing script."""
|
"""On stop methos is used for stoping the runing script."""
|
||||||
print "*******************EXITING FROM APPLICATION*******************"
|
print("*******************EXITING FROM APPLICATION*******************")
|
||||||
import shutdown
|
import shutdown
|
||||||
shutdown.doCleanShutdown()
|
shutdown.doCleanShutdown()
|
||||||
|
|
||||||
|
@ -1633,7 +1637,7 @@ class Draft(Screen):
|
||||||
def init_ui(self, dt=0):
|
def init_ui(self, dt=0):
|
||||||
"""Clock Schdule for method draft accounts."""
|
"""Clock Schdule for method draft accounts."""
|
||||||
self.sentaccounts()
|
self.sentaccounts()
|
||||||
print dt
|
print (dt)
|
||||||
|
|
||||||
def sentaccounts(self):
|
def sentaccounts(self):
|
||||||
"""Load draft accounts."""
|
"""Load draft accounts."""
|
||||||
|
@ -1801,7 +1805,7 @@ class Allmails(Screen):
|
||||||
def init_ui(self, dt=0):
|
def init_ui(self, dt=0):
|
||||||
"""Clock Schdule for method all mails."""
|
"""Clock Schdule for method all mails."""
|
||||||
self.mailaccounts()
|
self.mailaccounts()
|
||||||
print dt
|
print (dt)
|
||||||
|
|
||||||
def mailaccounts(self):
|
def mailaccounts(self):
|
||||||
"""Load all mails for account."""
|
"""Load all mails for account."""
|
||||||
|
|
|
@ -200,6 +200,7 @@ class Main: # pylint: disable=no-init, old-style-class
|
||||||
from plugins.plugin import get_plugin
|
from plugins.plugin import get_plugin
|
||||||
try:
|
try:
|
||||||
proxyconfig_start = time.time()
|
proxyconfig_start = time.time()
|
||||||
|
import pdb;pdb.set_trace
|
||||||
if not get_plugin('proxyconfig', name=proxy_type)(config):
|
if not get_plugin('proxyconfig', name=proxy_type)(config):
|
||||||
raise TypeError
|
raise TypeError
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
@ -358,7 +359,7 @@ class Main: # pylint: disable=no-init, old-style-class
|
||||||
# Not needed if objproc disabled
|
# Not needed if objproc disabled
|
||||||
if state.enableObjProc:
|
if state.enableObjProc:
|
||||||
shared.reloadMyAddressHashes()
|
shared.reloadMyAddressHashes()
|
||||||
shared.reloadBroadcastSendersForWhichImWatching()
|
# shared.reloadBroadcastSendersForWhichImWatching()
|
||||||
# API is also objproc dependent
|
# API is also objproc dependent
|
||||||
if config.safeGetBoolean('bitmessagesettings', 'apienabled'):
|
if config.safeGetBoolean('bitmessagesettings', 'apienabled'):
|
||||||
import api # pylint: disable=relative-import
|
import api # pylint: disable=relative-import
|
||||||
|
@ -373,7 +374,7 @@ class Main: # pylint: disable=no-init, old-style-class
|
||||||
asyncoreThread = BMNetworkThread()
|
asyncoreThread = BMNetworkThread()
|
||||||
asyncoreThread.daemon = True
|
asyncoreThread.daemon = True
|
||||||
asyncoreThread.start()
|
asyncoreThread.start()
|
||||||
for i in range(config.getint('threads', 'receive')):
|
for i in range(config.safeGet('threads', 'receive')):
|
||||||
receiveQueueThread = ReceiveQueueThread(i)
|
receiveQueueThread = ReceiveQueueThread(i)
|
||||||
receiveQueueThread.daemon = True
|
receiveQueueThread.daemon = True
|
||||||
receiveQueueThread.start()
|
receiveQueueThread.start()
|
||||||
|
|
|
@ -25,6 +25,7 @@ StoreConfigFilesInSameDirectoryAsProgramByDefault = False
|
||||||
|
|
||||||
|
|
||||||
def _loadTrustedPeer():
|
def _loadTrustedPeer():
|
||||||
|
trustedPeer = ''
|
||||||
try:
|
try:
|
||||||
trustedPeer = BMConfigParser().get('bitmessagesettings', 'trustedpeer')
|
trustedPeer = BMConfigParser().get('bitmessagesettings', 'trustedpeer')
|
||||||
except configparser.Error:
|
except configparser.Error:
|
||||||
|
@ -32,13 +33,15 @@ def _loadTrustedPeer():
|
||||||
# can just leave it as None
|
# can just leave it as None
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
|
# import pdb;pdb.set_trace()
|
||||||
|
if trustedPeer != None:
|
||||||
host, port = trustedPeer.split(':')
|
host, port = trustedPeer.split(':')
|
||||||
|
state.trustedPeer = state.Peer(host, int(port))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
sys.exit(
|
sys.exit(
|
||||||
'Bad trustedpeer config setting! It should be set as'
|
'Bad trustedpeer config setting! It should be set as'
|
||||||
' trustedpeer=<hostname>:<portnumber>'
|
' trustedpeer=<hostname>:<portnumber>'
|
||||||
)
|
)
|
||||||
state.trustedPeer = state.Peer(host, int(port))
|
|
||||||
|
|
||||||
|
|
||||||
def loadConfig():
|
def loadConfig():
|
||||||
|
|
|
@ -16,8 +16,9 @@ def makeCryptor(privkey):
|
||||||
# import pdb;pdb.set_trace()
|
# import pdb;pdb.set_trace()
|
||||||
private_key = a.changebase(privkey, 16, 256, minlen=32)
|
private_key = a.changebase(privkey, 16, 256, minlen=32)
|
||||||
public_key = pointMult(private_key)
|
public_key = pointMult(private_key)
|
||||||
privkey_bin = '\x02\xca\x00\x20' + private_key
|
privkey_bin = '\x02\xca\x00\x20'.encode('utf-8') + private_key
|
||||||
pubkey_bin = '\x02\xca\x00\x20' + public_key[1:-32].decode() + '\x00\x20' + public_key[-32:].decode()
|
pubkey_bin = '\x02\xca\x00\x20'.encode('utf-8') + public_key[1:-32] + '\x00\x20'.encode('utf-8') + public_key[-32:]
|
||||||
|
import pdb;pdb.set_trace()
|
||||||
cryptor = pyelliptic.ECC(curve='secp256k1', privkey=privkey_bin, pubkey=pubkey_bin)
|
cryptor = pyelliptic.ECC(curve='secp256k1', privkey=privkey_bin, pubkey=pubkey_bin)
|
||||||
return cryptor
|
return cryptor
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@ def json_deserialize_knownnodes(source):
|
||||||
Read JSON from source and make knownnodes dict
|
Read JSON from source and make knownnodes dict
|
||||||
"""
|
"""
|
||||||
global knownNodesActual # pylint: disable=global-statement
|
global knownNodesActual # pylint: disable=global-statement
|
||||||
|
# import pdb;pdb.set_trace()
|
||||||
for node in json.load(source):
|
for node in json.load(source):
|
||||||
peer = node['peer']
|
peer = node['peer']
|
||||||
info = node['info']
|
info = node['info']
|
||||||
|
@ -107,7 +108,7 @@ def createDefaultKnownNodes():
|
||||||
|
|
||||||
def readKnownNodes():
|
def readKnownNodes():
|
||||||
try:
|
try:
|
||||||
with open(state.appdata + 'knownnodes.dat', 'rb') as source:
|
with open(state.appdata + 'knownnodes.dat', 'r') as source:
|
||||||
with knownNodesLock:
|
with knownNodesLock:
|
||||||
try:
|
try:
|
||||||
json_deserialize_knownnodes(source)
|
json_deserialize_knownnodes(source)
|
||||||
|
|
|
@ -274,10 +274,15 @@ class BMConnectionPool(object):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self.lastSpawned = time.time()
|
self.lastSpawned = time.time()
|
||||||
|
|
||||||
|
print('++++++++++++++++++++++++++++++++++++++++++')
|
||||||
|
print('self.inboundConnections.values()-{}'.format(self.inboundConnections.values()))
|
||||||
|
print('self.outboundConnections.values() -{}'.format(self.outboundConnections.values()))
|
||||||
|
print('+++++++++++++++++++++++++++++++++++++++++++')
|
||||||
else:
|
else:
|
||||||
for i in (
|
for i in (
|
||||||
self.inboundConnections.values() +
|
list(self.inboundConnections.values()) +
|
||||||
self.outboundConnections.values()
|
list(self.outboundConnections.values())
|
||||||
):
|
):
|
||||||
# FIXME: rating will be increased after next connection
|
# FIXME: rating will be increased after next connection
|
||||||
i.handle_close()
|
i.handle_close()
|
||||||
|
|
|
@ -4,7 +4,7 @@ src/network/stats.py
|
||||||
"""
|
"""
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import asyncore_pollchoose as asyncore
|
from network import asyncore_pollchoose as asyncore
|
||||||
from network.connectionpool import BMConnectionPool
|
from network.connectionpool import BMConnectionPool
|
||||||
from network.objectracker import missingObjects
|
from network.objectracker import missingObjects
|
||||||
|
|
||||||
|
@ -20,8 +20,9 @@ currentSentSpeed = 0
|
||||||
def connectedHostsList():
|
def connectedHostsList():
|
||||||
"""List of all the connected hosts"""
|
"""List of all the connected hosts"""
|
||||||
retval = []
|
retval = []
|
||||||
for i in BMConnectionPool().inboundConnections.values() + \
|
# import pdb;pdb.set_trace()
|
||||||
BMConnectionPool().outboundConnections.values():
|
for i in list(BMConnectionPool().inboundConnections.values()) + \
|
||||||
|
list(BMConnectionPool().outboundConnections.values()):
|
||||||
if not i.fullyEstablished:
|
if not i.fullyEstablished:
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -30,7 +30,9 @@ def get_code_string(base):
|
||||||
elif base == 58:
|
elif base == 58:
|
||||||
return "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
return "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
||||||
elif base == 256:
|
elif base == 256:
|
||||||
return ''.join([chr(x) for x in range(256)])
|
'''raw_unicode_escape is used because in the python3 after range(161) its genreate the'
|
||||||
|
the speical character so avoiding that function we have used the raw_unicode method '''
|
||||||
|
return ''.join([chr(x) for x in range(256)]).encode('raw_unicode_escape')
|
||||||
else:
|
else:
|
||||||
raise ValueError("Invalid base!")
|
raise ValueError("Invalid base!")
|
||||||
|
|
||||||
|
@ -38,9 +40,16 @@ def get_code_string(base):
|
||||||
def encode(val, base, minlen=0):
|
def encode(val, base, minlen=0):
|
||||||
code_string = get_code_string(base)
|
code_string = get_code_string(base)
|
||||||
result = ""
|
result = ""
|
||||||
|
result = str.encode(result)
|
||||||
|
count = 0
|
||||||
|
# import pdb;pdb.set_trace()
|
||||||
while val > 0:
|
while val > 0:
|
||||||
result = code_string[round(val % base)] + result
|
count += 1
|
||||||
val /= base
|
# import pdb;pdb.set_trace()
|
||||||
|
result = code_string[int(val) % base:int(val) % base + 1] + result
|
||||||
|
# print('the value of the result-{}'.format(result))
|
||||||
|
val = int(val / base)
|
||||||
|
# import pdb;pdb.set_trace()
|
||||||
if len(result) < minlen:
|
if len(result) < minlen:
|
||||||
result = code_string[0] * (minlen - len(result)) + result
|
result = code_string[0] * (minlen - len(result)) + result
|
||||||
return result
|
return result
|
||||||
|
@ -48,10 +57,12 @@ def encode(val, base, minlen=0):
|
||||||
|
|
||||||
def decode(string, base):
|
def decode(string, base):
|
||||||
code_string = get_code_string(base)
|
code_string = get_code_string(base)
|
||||||
|
string.decode()
|
||||||
result = 0
|
result = 0
|
||||||
if base == 16:
|
if base == 16:
|
||||||
string = string.lower()
|
string = string.lower()
|
||||||
while string:
|
while string:
|
||||||
|
# import pdb;pdb.set_trace()
|
||||||
result *= base
|
result *= base
|
||||||
result += code_string.find(string.decode()[0])
|
result += code_string.find(string.decode()[0])
|
||||||
string = string[1:]
|
string = string[1:]
|
||||||
|
@ -59,6 +70,7 @@ def decode(string, base):
|
||||||
|
|
||||||
|
|
||||||
def changebase(string, frm, to, minlen=0):
|
def changebase(string, frm, to, minlen=0):
|
||||||
|
# import pdb;pdb.set_trace()
|
||||||
return encode(decode(string, frm), to, minlen)
|
return encode(decode(string, frm), to, minlen)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -74,11 +74,13 @@ class ECC(object):
|
||||||
if curve != curve2:
|
if curve != curve2:
|
||||||
raise Exception("Bad ECC keys ...")
|
raise Exception("Bad ECC keys ...")
|
||||||
self.curve = curve
|
self.curve = curve
|
||||||
|
import pdb;pdb.set_trace()
|
||||||
self._set_keys(pubkey_x, pubkey_y, raw_privkey)
|
self._set_keys(pubkey_x, pubkey_y, raw_privkey)
|
||||||
else:
|
else:
|
||||||
self.privkey, self.pubkey_x, self.pubkey_y = self._generate()
|
self.privkey, self.pubkey_x, self.pubkey_y = self._generate()
|
||||||
|
|
||||||
def _set_keys(self, pubkey_x, pubkey_y, privkey):
|
def _set_keys(self, pubkey_x, pubkey_y, privkey):
|
||||||
|
import pdb;pdb.set_trace()
|
||||||
if self.raw_check_key(privkey, pubkey_x, pubkey_y) < 0:
|
if self.raw_check_key(privkey, pubkey_x, pubkey_y) < 0:
|
||||||
self.pubkey_x = None
|
self.pubkey_x = None
|
||||||
self.pubkey_y = None
|
self.pubkey_y = None
|
||||||
|
@ -129,27 +131,37 @@ class ECC(object):
|
||||||
))
|
))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _decode_pubkey( pubkey):
|
def _decode_pubkey(pubkey):
|
||||||
pubkey = pubkey.encode()
|
# pubkey = pubkey.encode()
|
||||||
|
import pdb;pdb.set_trace()
|
||||||
i = 0
|
i = 0
|
||||||
curve = unpack('!H', pubkey[i:i + 2])[0]
|
# curve = unpack('!H', pubkey[i:i + 2])[0]
|
||||||
|
curve = pack('!s', pubkey[i:i + 1])[0]
|
||||||
|
|
||||||
i += 2
|
i += 2
|
||||||
tmplen = unpack('!H', pubkey[i:i + 2])[0]
|
# tmplen = unpack('!H', pubkey[i:i + 2])[0]
|
||||||
|
tmplen = pack('!s', pubkey[i:i + 1])[0]
|
||||||
i += 2
|
i += 2
|
||||||
pubkey_x = pubkey[i:i + tmplen]
|
pubkey_x = pubkey[i:i + tmplen]
|
||||||
i += tmplen
|
# i += tmplen
|
||||||
tmplen = unpack('!H', pubkey[i:i + 2])[0]
|
i += int(tmplen / 3)
|
||||||
i += 2
|
# tmplen = unpack('!H', pubkey[i:i + 2])[0]
|
||||||
|
tmplen = pack('!s', pubkey[i:i + 1])[0]
|
||||||
|
# i += 2
|
||||||
pubkey_y = pubkey[i:i + tmplen]
|
pubkey_y = pubkey[i:i + tmplen]
|
||||||
i += tmplen
|
# i += tmplen
|
||||||
return curve, pubkey_x, pubkey_y, i
|
return curve, pubkey_x, pubkey_y, int(i)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _decode_privkey(privkey):
|
def _decode_privkey(privkey):
|
||||||
i = 0
|
i = 0
|
||||||
curve = unpack('!H', privkey[i:i + 2])[0]
|
# import pdb;pdb.set_trace()
|
||||||
|
# curve = unpack('!H', privkey[i:i + 2])[0]
|
||||||
|
curve = pack('!s', privkey[i:i + 1])[0]
|
||||||
|
|
||||||
i += 2
|
i += 2
|
||||||
tmplen = unpack('!H', privkey[i:i + 2])[0]
|
# tmplen = unpack('!H', privkey[i:i + 2])[0]
|
||||||
|
tmplen = pack('!s', privkey[i:i + 1])[0]
|
||||||
i += 2
|
i += 2
|
||||||
privkey = privkey[i:i + tmplen]
|
privkey = privkey[i:i + tmplen]
|
||||||
i += tmplen
|
i += tmplen
|
||||||
|
@ -276,6 +288,7 @@ class ECC(object):
|
||||||
return self.raw_check_key(raw_privkey, pubkey_x, pubkey_y, curve)
|
return self.raw_check_key(raw_privkey, pubkey_x, pubkey_y, curve)
|
||||||
|
|
||||||
def raw_check_key(self, privkey, pubkey_x, pubkey_y, curve=None):
|
def raw_check_key(self, privkey, pubkey_x, pubkey_y, curve=None):
|
||||||
|
import pdb;pdb.set_trace()
|
||||||
"""Check key validity, key is supplied as binary data"""
|
"""Check key validity, key is supplied as binary data"""
|
||||||
# pylint: disable=too-many-branches
|
# pylint: disable=too-many-branches
|
||||||
if curve is None:
|
if curve is None:
|
||||||
|
|
|
@ -8,7 +8,7 @@ from threading import RLock
|
||||||
|
|
||||||
|
|
||||||
from helper_sql import sqlQuery, SqlBulkExecute, sqlExecute
|
from helper_sql import sqlQuery, SqlBulkExecute, sqlExecute
|
||||||
from storage import InventoryStorage, InventoryItem
|
from storage.storage import InventoryStorage, InventoryItem
|
||||||
|
|
||||||
|
|
||||||
class SqliteInventory(InventoryStorage): # pylint: disable=too-many-ancestors
|
class SqliteInventory(InventoryStorage): # pylint: disable=too-many-ancestors
|
||||||
|
|
Reference in New Issue
Block a user