Kivy fixes part 4
This commit is contained in:
parent
825bfb0a3c
commit
4ada9f68b3
|
@ -25,7 +25,8 @@
|
||||||
#:set color_font (0.957, 0.890, 0.843, 1) # off white
|
#:set color_font (0.957, 0.890, 0.843, 1) # off white
|
||||||
|
|
||||||
<MyNavigationDrawerIconButton@NavigationDrawerIconButton>:
|
<MyNavigationDrawerIconButton@NavigationDrawerIconButton>:
|
||||||
icon: 'checkbox-blank-circle'
|
font_style: 'Body1'
|
||||||
|
theme_text_color: 'Secondary'
|
||||||
|
|
||||||
<MySpinnerOption@SpinnerOption>:
|
<MySpinnerOption@SpinnerOption>:
|
||||||
font_size: '12.5sp'
|
font_size: '12.5sp'
|
||||||
|
@ -39,7 +40,7 @@
|
||||||
height: dp(7)
|
height: dp(7)
|
||||||
NavigationDrawerSubheader:
|
NavigationDrawerSubheader:
|
||||||
text: "Accounts"
|
text: "Accounts"
|
||||||
NavigationDrawerIconButton:
|
AddressDropdown:
|
||||||
CustomSpinner:
|
CustomSpinner:
|
||||||
id: btn
|
id: btn
|
||||||
pos_hint:{"x":0,"y":.25}
|
pos_hint:{"x":0,"y":.25}
|
||||||
|
@ -57,47 +58,48 @@
|
||||||
y: self.parent.y + self.parent.height/4
|
y: self.parent.y + self.parent.height/4
|
||||||
size: self.parent.height/2, self.parent.height/2
|
size: self.parent.height/2, self.parent.height/2
|
||||||
ArrowImg:
|
ArrowImg:
|
||||||
NavigationDrawerIconButton:
|
MyNavigationDrawerIconButton:
|
||||||
id: inbox_cnt
|
id: inbox_cnt
|
||||||
icon: 'email-open'
|
icon: 'email-open'
|
||||||
text: "Inbox"
|
text: "Inbox"
|
||||||
on_release: app.root.ids.scr_mngr.current = 'inbox'
|
on_release: app.root.ids.scr_mngr.current = 'inbox'
|
||||||
badge_text: "0"
|
badge_text: "0"
|
||||||
on_press: app.load_screen(self)
|
on_press: app.load_screen(self)
|
||||||
NavigationDrawerIconButton:
|
MyNavigationDrawerIconButton:
|
||||||
id: send_cnt
|
id: send_cnt
|
||||||
icon: 'send'
|
icon: 'send'
|
||||||
text: "Sent"
|
text: "Sent"
|
||||||
|
#use_active: False
|
||||||
on_release: app.root.ids.scr_mngr.current = 'sent'
|
on_release: app.root.ids.scr_mngr.current = 'sent'
|
||||||
badge_text: "0"
|
badge_text: "0"
|
||||||
NavigationDrawerIconButton:
|
MyNavigationDrawerIconButton:
|
||||||
id: draft_cnt
|
id: draft_cnt
|
||||||
icon: 'message-draw'
|
icon: 'message-draw'
|
||||||
text: "Draft"
|
text: "Draft"
|
||||||
on_release: app.root.ids.scr_mngr.current = 'draft'
|
on_release: app.root.ids.scr_mngr.current = 'draft'
|
||||||
badge_text: "0"
|
badge_text: "0"
|
||||||
#NavigationDrawerIconButton:
|
#MyNavigationDrawerIconButton:
|
||||||
#text: "Starred"
|
#text: "Starred"
|
||||||
#icon:'star'
|
#icon:'star'
|
||||||
#on_release: app.root.ids.scr_mngr.current = 'starred'
|
#on_release: app.root.ids.scr_mngr.current = 'starred'
|
||||||
#badge_text: "0"
|
#badge_text: "0"
|
||||||
#NavigationDrawerIconButton:
|
#MyNavigationDrawerIconButton:
|
||||||
#icon: 'archive'
|
#icon: 'archive'
|
||||||
#text: "Archieve"
|
#text: "Archieve"
|
||||||
#on_release: app.root.ids.scr_mngr.current = 'archieve'
|
#on_release: app.root.ids.scr_mngr.current = 'archieve'
|
||||||
#badge_text: "0"
|
#badge_text: "0"
|
||||||
#NavigationDrawerIconButton:
|
#MyNavigationDrawerIconButton:
|
||||||
#icon: 'email-open-outline'
|
#icon: 'email-open-outline'
|
||||||
#text: "Spam"
|
#text: "Spam"
|
||||||
#on_release: app.root.ids.scr_mngr.current = 'spam'
|
#on_release: app.root.ids.scr_mngr.current = 'spam'
|
||||||
#badge_text: "0"
|
#badge_text: "0"
|
||||||
NavigationDrawerIconButton:
|
MyNavigationDrawerIconButton:
|
||||||
id: trash_cnt
|
id: trash_cnt
|
||||||
icon: 'delete'
|
icon: 'delete'
|
||||||
text: "Trash"
|
text: "Trash"
|
||||||
on_release: app.root.ids.scr_mngr.current = 'trash'
|
on_release: app.root.ids.scr_mngr.current = 'trash'
|
||||||
badge_text: "0"
|
badge_text: "0"
|
||||||
NavigationDrawerIconButton:
|
MyNavigationDrawerIconButton:
|
||||||
id: allmail_cnt
|
id: allmail_cnt
|
||||||
text: "All Mails"
|
text: "All Mails"
|
||||||
icon:'contact-mail'
|
icon:'contact-mail'
|
||||||
|
@ -107,31 +109,31 @@
|
||||||
NavigationDrawerDivider:
|
NavigationDrawerDivider:
|
||||||
NavigationDrawerSubheader:
|
NavigationDrawerSubheader:
|
||||||
text: "All labels"
|
text: "All labels"
|
||||||
NavigationDrawerIconButton:
|
MyNavigationDrawerIconButton:
|
||||||
text: "Address Book"
|
text: "Address Book"
|
||||||
icon:'book-multiple'
|
icon:'book-multiple'
|
||||||
on_release: app.root.ids.scr_mngr.current = 'addressbook'
|
on_release: app.root.ids.scr_mngr.current = 'addressbook'
|
||||||
NavigationDrawerIconButton:
|
MyNavigationDrawerIconButton:
|
||||||
text: "Settings"
|
text: "Settings"
|
||||||
icon:'settings'
|
icon:'settings'
|
||||||
on_release: app.root.ids.scr_mngr.current = 'set'
|
on_release: app.root.ids.scr_mngr.current = 'set'
|
||||||
NavigationDrawerIconButton:
|
MyNavigationDrawerIconButton:
|
||||||
text: "Subscriptions/Payment"
|
text: "Subscriptions/Payment"
|
||||||
icon:'bell'
|
icon:'bell'
|
||||||
on_release: app.root.ids.scr_mngr.current = 'payment'
|
on_release: app.root.ids.scr_mngr.current = 'payment'
|
||||||
NavigationDrawerIconButton:
|
MyNavigationDrawerIconButton:
|
||||||
text: "Credits"
|
text: "Credits"
|
||||||
icon:'wallet'
|
icon:'wallet'
|
||||||
on_release: app.root.ids.scr_mngr.current = 'credits'
|
on_release: app.root.ids.scr_mngr.current = 'credits'
|
||||||
NavigationDrawerIconButton:
|
MyNavigationDrawerIconButton:
|
||||||
text: "new address"
|
text: "new address"
|
||||||
icon:'account-plus'
|
icon:'account-plus'
|
||||||
on_release: app.root.ids.scr_mngr.current = 'login'
|
on_release: app.root.ids.scr_mngr.current = 'login'
|
||||||
NavigationDrawerIconButton:
|
MyNavigationDrawerIconButton:
|
||||||
text: "Network Status"
|
text: "Network Status"
|
||||||
icon:'server-network'
|
icon:'server-network'
|
||||||
on_release: app.root.ids.scr_mngr.current = 'networkstat'
|
on_release: app.root.ids.scr_mngr.current = 'networkstat'
|
||||||
NavigationDrawerIconButton:
|
MyNavigationDrawerIconButton:
|
||||||
text: "My Addresses"
|
text: "My Addresses"
|
||||||
icon:'account-multiple'
|
icon:'account-multiple'
|
||||||
on_release: app.root.ids.scr_mngr.current = 'myaddress'
|
on_release: app.root.ids.scr_mngr.current = 'myaddress'
|
||||||
|
@ -545,12 +547,6 @@ NavigationLayout:
|
||||||
color: (1,1,1,1)
|
color: (1,1,1,1)
|
||||||
halign: 'center'
|
halign: 'center'
|
||||||
|
|
||||||
<AddressSuccessful>:
|
|
||||||
name: 'add_sucess'
|
|
||||||
Label:
|
|
||||||
text: 'Successfully created a new bit address'
|
|
||||||
color: 0,0,0,1
|
|
||||||
|
|
||||||
<Setting>:
|
<Setting>:
|
||||||
name: 'set'
|
name: 'set'
|
||||||
ScrollView:
|
ScrollView:
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Bitmessage android(mobile) interface
|
src/bitmessagekivy/mpybit.py
|
||||||
|
=================================
|
||||||
"""
|
"""
|
||||||
# pylint: disable=import-error, no-name-in-module, too-many-lines
|
# pylint: disable=import-error, no-name-in-module, too-many-lines
|
||||||
# pylint: disable=too-few-public-methods, unused-argument, too-many-ancestors
|
# pylint: disable=too-few-public-methods, unused-argument, too-many-ancestors
|
||||||
|
@ -46,6 +47,7 @@ from kivymd.uix.list import (
|
||||||
IRightBodyTouch,
|
IRightBodyTouch,
|
||||||
TwoLineAvatarIconListItem,
|
TwoLineAvatarIconListItem,
|
||||||
TwoLineListItem,
|
TwoLineListItem,
|
||||||
|
OneLineIconListItem,
|
||||||
)
|
)
|
||||||
from kivymd.uix.navigationdrawer import (
|
from kivymd.uix.navigationdrawer import (
|
||||||
MDNavigationDrawer,
|
MDNavigationDrawer,
|
||||||
|
@ -57,35 +59,36 @@ import queues
|
||||||
from semaphores import kivyuisignaler
|
from semaphores import kivyuisignaler
|
||||||
|
|
||||||
import state
|
import state
|
||||||
from bitmessagekivy.uikivysignaler import UIkivySignaler
|
|
||||||
|
|
||||||
|
from bitmessagekivy.uikivysignaler import UIkivySignaler
|
||||||
from bitmessagekivy import identiconGeneration
|
from bitmessagekivy import identiconGeneration
|
||||||
from addresses import addBMIfNotPresent, decodeAddress
|
from addresses import addBMIfNotPresent, decodeAddress, encodeVarint
|
||||||
|
# pylint: disable=unused-argument, too-few-public-methods
|
||||||
|
|
||||||
|
|
||||||
def toast(text):
|
def toast(text):
|
||||||
"""Function displays toast message"""
|
"""Method will display the toast message"""
|
||||||
# pylint: disable=redefined-outer-name
|
from kivymd.toast.kivytoast import toast # pylint: disable=redefined-outer-name
|
||||||
from kivymd.toast.kivytoast import toast
|
|
||||||
toast(text)
|
toast(text)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
class Navigatorss(MDNavigationDrawer):
|
class Navigatorss(MDNavigationDrawer):
|
||||||
"""Navigator class (image, title and logo)"""
|
"""Navigators class contains image, title and logo"""
|
||||||
|
|
||||||
image_source = StringProperty('images/qidenticon_two.png')
|
image_source = StringProperty('images/qidenticon_two.png')
|
||||||
title = StringProperty('Navigation')
|
title = StringProperty('Navigation')
|
||||||
drawer_logo = StringProperty()
|
drawer_logo = StringProperty()
|
||||||
|
|
||||||
|
|
||||||
class Inbox(Screen):
|
class Inbox(Screen):
|
||||||
"""Inbox Screen uses screen to show widgets of screens."""
|
"""Inbox Screen uses screen to show widgets of screens"""
|
||||||
queryreturn = ListProperty()
|
queryreturn = ListProperty()
|
||||||
has_refreshed = True
|
has_refreshed = True
|
||||||
account = StringProperty()
|
account = StringProperty()
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Method Parsing the address."""
|
"""Method Parsing the address"""
|
||||||
super(Inbox, self).__init__(*args, **kwargs)
|
super(Inbox, self).__init__(*args, **kwargs)
|
||||||
Clock.schedule_once(self.init_ui, 0)
|
Clock.schedule_once(self.init_ui, 0)
|
||||||
|
|
||||||
|
@ -97,11 +100,11 @@ class Inbox(Screen):
|
||||||
state.association = BMConfigParser().addresses()[0]
|
state.association = BMConfigParser().addresses()[0]
|
||||||
|
|
||||||
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.loadMessagelist()
|
self.loadMessagelist()
|
||||||
|
|
||||||
def loadMessagelist(self, where="", what=""):
|
def loadMessagelist(self, where="", what=""):
|
||||||
"""Load Inbox list for Inbox messages."""
|
"""Load Inbox list for Inbox messages"""
|
||||||
# pylint: disable=too-many-locals
|
# pylint: disable=too-many-locals
|
||||||
self.set_defaultAddress()
|
self.set_defaultAddress()
|
||||||
self.account = state.association
|
self.account = state.association
|
||||||
|
@ -300,13 +303,13 @@ class Inbox(Screen):
|
||||||
|
|
||||||
|
|
||||||
class MyAddress(Screen):
|
class MyAddress(Screen):
|
||||||
"""MyAddress screen uses screen to show widgets of screens."""
|
"""MyAddress screen uses screen to show widgets of screens"""
|
||||||
addresses_list = ListProperty()
|
addresses_list = ListProperty()
|
||||||
has_refreshed = True
|
has_refreshed = True
|
||||||
is_add_created = False
|
is_add_created = False
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Clock schdule for method Myaddress accounts."""
|
"""Clock schdule for method Myaddress accounts"""
|
||||||
super(MyAddress, self).__init__(*args, **kwargs)
|
super(MyAddress, self).__init__(*args, **kwargs)
|
||||||
Clock.schedule_once(self.init_ui, 0)
|
Clock.schedule_once(self.init_ui, 0)
|
||||||
|
|
||||||
|
@ -316,9 +319,7 @@ class MyAddress(Screen):
|
||||||
self.addresses_list = state.kivyapp.variable_1
|
self.addresses_list = state.kivyapp.variable_1
|
||||||
if state.searcing_text:
|
if state.searcing_text:
|
||||||
self.ids.refresh_layout.scroll_y = 1.0
|
self.ids.refresh_layout.scroll_y = 1.0
|
||||||
filtered_list = filter(
|
filtered_list = [x for x in BMConfigParser().addresses() if self.filter_address(x)]
|
||||||
lambda addr: self.filter_address(
|
|
||||||
addr), BMConfigParser().addresses())
|
|
||||||
self.addresses_list = filtered_list
|
self.addresses_list = filtered_list
|
||||||
self.addresses_list = [obj for obj in reversed(self.addresses_list)]
|
self.addresses_list = [obj for obj in reversed(self.addresses_list)]
|
||||||
if self.addresses_list:
|
if self.addresses_list:
|
||||||
|
@ -403,9 +404,7 @@ class MyAddress(Screen):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def filter_address(address):
|
def filter_address(address):
|
||||||
"""Method will filter the my address list data"""
|
"""Method will filter the my address list data"""
|
||||||
if filter(lambda x: (state.searcing_text).lower() in x, [
|
if [x for x in [BMConfigParser().get(address, 'label').lower(), address.lower()] if (state.searcing_text).lower() in x]:
|
||||||
BMConfigParser().get(
|
|
||||||
address, 'label').lower(), address.lower()]):
|
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -519,8 +518,8 @@ class AddressBook(Screen):
|
||||||
"DELETE FROM addressbook WHERE address = '{}';".format(address))
|
"DELETE FROM addressbook WHERE address = '{}';".format(address))
|
||||||
|
|
||||||
|
|
||||||
class SelectableRecycleBoxLayout(
|
class SelectableRecycleBoxLayout(FocusBehavior, LayoutSelectionBehavior,
|
||||||
FocusBehavior, LayoutSelectionBehavior, RecycleBoxLayout):
|
RecycleBoxLayout):
|
||||||
"""Adds selection and focus behaviour to the view"""
|
"""Adds selection and focus behaviour to the view"""
|
||||||
# pylint: disable = duplicate-bases
|
# pylint: disable = duplicate-bases
|
||||||
pass
|
pass
|
||||||
|
@ -528,6 +527,7 @@ class SelectableRecycleBoxLayout(
|
||||||
|
|
||||||
class SelectableLabel(RecycleDataViewBehavior, Label):
|
class SelectableLabel(RecycleDataViewBehavior, Label):
|
||||||
"""Add selection support to the Label"""
|
"""Add selection support to the Label"""
|
||||||
|
|
||||||
index = None
|
index = None
|
||||||
selected = BooleanProperty(False)
|
selected = BooleanProperty(False)
|
||||||
selectable = BooleanProperty(True)
|
selectable = BooleanProperty(True)
|
||||||
|
@ -556,7 +556,8 @@ class SelectableLabel(RecycleDataViewBehavior, Label):
|
||||||
|
|
||||||
class RV(RecycleView):
|
class RV(RecycleView):
|
||||||
"""Recycling View"""
|
"""Recycling View"""
|
||||||
def __init__(self, **kwargs): # pylint: disable=useless-super-delegation
|
|
||||||
|
def __init__(self, **kwargs): # pylint: disable=useless-super-delegation
|
||||||
"""Recycling Method"""
|
"""Recycling Method"""
|
||||||
super(RV, self).__init__(**kwargs)
|
super(RV, self).__init__(**kwargs)
|
||||||
|
|
||||||
|
@ -578,6 +579,7 @@ class DropDownWidget(BoxLayout):
|
||||||
sendMessageToPeople = True
|
sendMessageToPeople = True
|
||||||
if sendMessageToPeople:
|
if sendMessageToPeople:
|
||||||
if toAddress != '' and subject and message:
|
if toAddress != '' and subject and message:
|
||||||
|
from addresses import decodeAddress
|
||||||
status, addressVersionNumber, streamNumber, ripe = (
|
status, addressVersionNumber, streamNumber, ripe = (
|
||||||
decodeAddress(toAddress))
|
decodeAddress(toAddress))
|
||||||
if status == 'success':
|
if status == 'success':
|
||||||
|
@ -596,7 +598,10 @@ class DropDownWidget(BoxLayout):
|
||||||
state.send_draft_mail)
|
state.send_draft_mail)
|
||||||
self.parent.parent.screens[15].clear_widgets()
|
self.parent.parent.screens[15].clear_widgets()
|
||||||
self.parent.parent.screens[15].add_widget(Draft())
|
self.parent.parent.screens[15].add_widget(Draft())
|
||||||
|
# state.detailPageType = ''
|
||||||
|
# state.send_draft_mail = None
|
||||||
else:
|
else:
|
||||||
|
from addresses import addBMIfNotPresent
|
||||||
toAddress = addBMIfNotPresent(toAddress)
|
toAddress = addBMIfNotPresent(toAddress)
|
||||||
statusIconColor = 'red'
|
statusIconColor = 'red'
|
||||||
if (addressVersionNumber > 4) or (
|
if (addressVersionNumber > 4) or (
|
||||||
|
@ -696,6 +701,7 @@ class DropDownWidget(BoxLayout):
|
||||||
|
|
||||||
class MyTextInput(TextInput):
|
class MyTextInput(TextInput):
|
||||||
"""Takes the text input in the field"""
|
"""Takes the text input in the field"""
|
||||||
|
|
||||||
txt_input = ObjectProperty()
|
txt_input = ObjectProperty()
|
||||||
flt_list = ObjectProperty()
|
flt_list = ObjectProperty()
|
||||||
word_list = ListProperty()
|
word_list = ListProperty()
|
||||||
|
@ -751,12 +757,14 @@ class Payment(Screen):
|
||||||
|
|
||||||
|
|
||||||
class Credits(Screen):
|
class Credits(Screen):
|
||||||
"""Credits Module"""
|
"""Credits Method"""
|
||||||
available_credits = StringProperty('{0}'.format('0'))
|
available_credits = StringProperty(
|
||||||
|
'{0}'.format('0'))
|
||||||
|
|
||||||
|
|
||||||
class Login(Screen):
|
class Login(Screen):
|
||||||
"""Login Screeen"""
|
"""Login Screeen"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -867,7 +875,7 @@ class Sent(Screen):
|
||||||
account = StringProperty()
|
account = StringProperty()
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Association with the screen."""
|
"""Association with the screen"""
|
||||||
super(Sent, self).__init__(*args, **kwargs)
|
super(Sent, self).__init__(*args, **kwargs)
|
||||||
if state.association == '':
|
if state.association == '':
|
||||||
if BMConfigParser().addresses():
|
if BMConfigParser().addresses():
|
||||||
|
@ -880,7 +888,7 @@ class Sent(Screen):
|
||||||
print(dt)
|
print(dt)
|
||||||
|
|
||||||
def loadSent(self, where="", what=""):
|
def loadSent(self, where="", what=""):
|
||||||
"""Load Sent list for Sent messages."""
|
"""Load Sent list for Sent messages"""
|
||||||
self.account = state.association
|
self.account = state.association
|
||||||
if state.searcing_text:
|
if state.searcing_text:
|
||||||
self.ids.scroll_y.scroll_y = 1.0
|
self.ids.scroll_y.scroll_y = 1.0
|
||||||
|
@ -918,7 +926,7 @@ class Sent(Screen):
|
||||||
self.queryreturn = kivy_helper_search.search_sql(
|
self.queryreturn = kivy_helper_search.search_sql(
|
||||||
xAddress,
|
xAddress,
|
||||||
self.account,
|
self.account,
|
||||||
"sent",
|
'sent',
|
||||||
where,
|
where,
|
||||||
what,
|
what,
|
||||||
False,
|
False,
|
||||||
|
@ -1084,7 +1092,7 @@ class Trash(Screen):
|
||||||
"""Trash Screen uses screen to show widgets of screens"""
|
"""Trash Screen uses screen to show widgets of screens"""
|
||||||
trash_messages = ListProperty()
|
trash_messages = ListProperty()
|
||||||
has_refreshed = True
|
has_refreshed = True
|
||||||
delete_index = StringProperty()
|
# delete_index = StringProperty()
|
||||||
table_name = StringProperty()
|
table_name = StringProperty()
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
@ -1093,7 +1101,7 @@ class Trash(Screen):
|
||||||
Clock.schedule_once(self.init_ui, 0)
|
Clock.schedule_once(self.init_ui, 0)
|
||||||
|
|
||||||
def init_ui(self, dt=0):
|
def init_ui(self, dt=0):
|
||||||
"""Clock Schdule for method trash screen."""
|
"""Clock Schdule for method trash screen"""
|
||||||
if state.association == '':
|
if state.association == '':
|
||||||
if BMConfigParser().addresses():
|
if BMConfigParser().addresses():
|
||||||
state.association = BMConfigParser().addresses()[0]
|
state.association = BMConfigParser().addresses()[0]
|
||||||
|
@ -1199,7 +1207,7 @@ class Trash(Screen):
|
||||||
events_callback=self.callback_for_delete_msg)
|
events_callback=self.callback_for_delete_msg)
|
||||||
delete_msg_dialog.open()
|
delete_msg_dialog.open()
|
||||||
|
|
||||||
def callback_for_delete_msg(self, text_item):
|
def callback_for_delete_msg(self, text_item, *arg):
|
||||||
"""Getting the callback of alert box"""
|
"""Getting the callback of alert box"""
|
||||||
if text_item == 'Yes':
|
if text_item == 'Yes':
|
||||||
self.delete_message_from_trash()
|
self.delete_message_from_trash()
|
||||||
|
@ -1210,11 +1218,9 @@ class Trash(Screen):
|
||||||
"""Deleting message from trash"""
|
"""Deleting message from trash"""
|
||||||
self.children[1].active = True
|
self.children[1].active = True
|
||||||
if self.table_name == 'inbox':
|
if self.table_name == 'inbox':
|
||||||
sqlExecute("DELETE FROM inbox WHERE msgid = ?;", str(
|
sqlExecute("DELETE FROM inbox WHERE msgid = ?;", self.delete_index)
|
||||||
self.delete_index))
|
|
||||||
elif self.table_name == 'sent':
|
elif self.table_name == 'sent':
|
||||||
sqlExecute("DELETE FROM sent WHERE ackdata = ?;", str(
|
sqlExecute("DELETE FROM sent WHERE ackdata = ?;", self.delete_index)
|
||||||
self.delete_index))
|
|
||||||
msg_count_objs = state.kivyapp.root.children[2].children[0].ids
|
msg_count_objs = state.kivyapp.root.children[2].children[0].ids
|
||||||
if int(state.trash_count) > 0:
|
if int(state.trash_count) > 0:
|
||||||
msg_count_objs.trash_cnt.badge_text = str(
|
msg_count_objs.trash_cnt.badge_text = str(
|
||||||
|
@ -1225,6 +1231,7 @@ class Trash(Screen):
|
||||||
|
|
||||||
class Page(Screen):
|
class Page(Screen):
|
||||||
"""Page Screen show widgets of page"""
|
"""Page Screen show widgets of page"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -1244,6 +1251,7 @@ class Create(Screen):
|
||||||
|
|
||||||
class Setting(Screen):
|
class Setting(Screen):
|
||||||
"""Setting the Screen components"""
|
"""Setting the Screen components"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -1320,7 +1328,7 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
|
||||||
Clock.schedule_once(self.setCurrentAccountData, 0.5)
|
Clock.schedule_once(self.setCurrentAccountData, 0.5)
|
||||||
|
|
||||||
def setCurrentAccountData(self, dt=0):
|
def setCurrentAccountData(self, dt=0):
|
||||||
"""This method set the current accout data on all the screens."""
|
"""This method set the current accout data on all the screens"""
|
||||||
self.root.ids.sc1.ids.ml.clear_widgets()
|
self.root.ids.sc1.ids.ml.clear_widgets()
|
||||||
self.root.ids.sc1.loadMessagelist(state.association)
|
self.root.ids.sc1.loadMessagelist(state.association)
|
||||||
|
|
||||||
|
@ -1827,8 +1835,7 @@ class GrashofPopup(Popup):
|
||||||
elif status == 'checksumfailed':
|
elif status == 'checksumfailed':
|
||||||
text = "The address is not typed or copied correctly(the checksum failed)."
|
text = "The address is not typed or copied correctly(the checksum failed)."
|
||||||
elif status == 'versiontoohigh':
|
elif status == 'versiontoohigh':
|
||||||
text = "The version number of this address is higher"\
|
text = "The version number of this address is higher than this software can support. Please upgrade Bitmessage."
|
||||||
" than this software can support. Please upgrade Bitmessage."
|
|
||||||
elif status == 'invalidcharacters':
|
elif status == 'invalidcharacters':
|
||||||
text = "The address contains invalid characters."
|
text = "The address contains invalid characters."
|
||||||
elif status == 'ripetooshort':
|
elif status == 'ripetooshort':
|
||||||
|
@ -1842,22 +1849,26 @@ class GrashofPopup(Popup):
|
||||||
|
|
||||||
class AvatarSampleWidget(ILeftBody, Image):
|
class AvatarSampleWidget(ILeftBody, Image):
|
||||||
"""Avatar Sample Widget"""
|
"""Avatar Sample Widget"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class IconLeftSampleWidget(ILeftBodyTouch, MDIconButton):
|
class IconLeftSampleWidget(ILeftBodyTouch, MDIconButton):
|
||||||
"""Left icon sample widget"""
|
"""Left icon sample widget"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class IconRightSampleWidget(IRightBodyTouch, MDCheckbox):
|
class IconRightSampleWidget(IRightBodyTouch, MDCheckbox):
|
||||||
"""Right icon sample widget"""
|
"""Right icon sample widget"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class NavigationDrawerTwoLineListItem(
|
class NavigationDrawerTwoLineListItem(
|
||||||
TwoLineListItem, NavigationDrawerHeaderBase):
|
TwoLineListItem, NavigationDrawerHeaderBase):
|
||||||
"""Navigation Drawer in Listitems"""
|
"""Navigation Drawer in Listitems"""
|
||||||
|
|
||||||
address_property = StringProperty()
|
address_property = StringProperty()
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
@ -1948,7 +1959,7 @@ class MailDetail(Screen):
|
||||||
1].ids.search_field.text = ''
|
1].ids.search_field.text = ''
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"UPDATE inbox SET folder = 'trash' WHERE"
|
"UPDATE inbox SET folder = 'trash' WHERE"
|
||||||
" msgid = ?;", str(state.mail_id))
|
" msgid = ?;", state.mail_id)
|
||||||
msg_count_objs.inbox_cnt.badge_text = str(
|
msg_count_objs.inbox_cnt.badge_text = str(
|
||||||
int(state.inbox_count) - 1)
|
int(state.inbox_count) - 1)
|
||||||
state.inbox_count = str(int(state.inbox_count) - 1)
|
state.inbox_count = str(int(state.inbox_count) - 1)
|
||||||
|
@ -1956,8 +1967,7 @@ class MailDetail(Screen):
|
||||||
self.parent.screens[0].loadMessagelist(state.association)
|
self.parent.screens[0].loadMessagelist(state.association)
|
||||||
|
|
||||||
elif state.detailPageType == 'draft':
|
elif state.detailPageType == 'draft':
|
||||||
sqlExecute("DELETE FROM sent WHERE ackdata = ?;", str(
|
sqlExecute("DELETE FROM sent WHERE ackdata = ?;", state.mail_id)
|
||||||
state.mail_id))
|
|
||||||
msg_count_objs.draft_cnt.badge_text = str(
|
msg_count_objs.draft_cnt.badge_text = str(
|
||||||
int(state.draft_count) - 1)
|
int(state.draft_count) - 1)
|
||||||
state.draft_count = str(int(state.draft_count) - 1)
|
state.draft_count = str(int(state.draft_count) - 1)
|
||||||
|
@ -1992,7 +2002,7 @@ class MailDetail(Screen):
|
||||||
"""Reply inbox messages"""
|
"""Reply inbox messages"""
|
||||||
data = sqlQuery(
|
data = sqlQuery(
|
||||||
"select toaddress, fromaddress, subject, message from inbox where"
|
"select toaddress, fromaddress, subject, message from inbox where"
|
||||||
" msgid = ?;", str(state.mail_id))
|
" msgid = ?;", state.mail_id)
|
||||||
composer_obj = self.parent.screens[2].children[1].ids
|
composer_obj = self.parent.screens[2].children[1].ids
|
||||||
composer_obj.ti.text = data[0][0]
|
composer_obj.ti.text = data[0][0]
|
||||||
composer_obj.btn.text = data[0][0]
|
composer_obj.btn.text = data[0][0]
|
||||||
|
@ -2131,7 +2141,7 @@ class ShowQRCode(Screen):
|
||||||
"""ShowQRCode Screen uses to show the detail of mails"""
|
"""ShowQRCode Screen uses to show the detail of mails"""
|
||||||
|
|
||||||
def qrdisplay(self):
|
def qrdisplay(self):
|
||||||
"""Showing QR Code"""
|
"""Method used for showing QR Code"""
|
||||||
# self.manager.parent.parent.parent.ids.search_bar.clear_widgets()
|
# self.manager.parent.parent.parent.ids.search_bar.clear_widgets()
|
||||||
self.ids.qr.clear_widgets()
|
self.ids.qr.clear_widgets()
|
||||||
from kivy.garden.qrcode import QRCodeWidget
|
from kivy.garden.qrcode import QRCodeWidget
|
||||||
|
@ -2161,12 +2171,12 @@ class Draft(Screen):
|
||||||
print(dt)
|
print(dt)
|
||||||
|
|
||||||
def sentaccounts(self):
|
def sentaccounts(self):
|
||||||
"""Load draft accounts."""
|
"""Load draft accounts"""
|
||||||
self.account = state.association
|
self.account = state.association
|
||||||
self.loadDraft()
|
self.loadDraft()
|
||||||
|
|
||||||
def loadDraft(self, where="", what=""):
|
def loadDraft(self, where="", what=""):
|
||||||
"""Load draft list for Draft messages."""
|
"""Load draft list for Draft messages"""
|
||||||
xAddress = 'fromaddress'
|
xAddress = 'fromaddress'
|
||||||
self.draftDataQuery(xAddress, where, what)
|
self.draftDataQuery(xAddress, where, what)
|
||||||
if state.msg_counter_objs:
|
if state.msg_counter_objs:
|
||||||
|
@ -2273,8 +2283,7 @@ class Draft(Screen):
|
||||||
data_index))
|
data_index))
|
||||||
try:
|
try:
|
||||||
msg_count_objs = (
|
msg_count_objs = (
|
||||||
self.parent.parent.parent.parent.parent.parent.children[
|
self.parent.parent.parent.parent.parent.children[2].children[0].ids)
|
||||||
2].children[0].ids)
|
|
||||||
except Exception:
|
except Exception:
|
||||||
msg_count_objs = self.parent.parent.parent.parent.parent.parent.children[
|
msg_count_objs = self.parent.parent.parent.parent.parent.parent.children[
|
||||||
2].children[0].ids
|
2].children[0].ids
|
||||||
|
@ -2298,7 +2307,9 @@ class Draft(Screen):
|
||||||
encoding = 3
|
encoding = 3
|
||||||
sendMessageToPeople = True
|
sendMessageToPeople = True
|
||||||
if sendMessageToPeople:
|
if sendMessageToPeople:
|
||||||
|
from addresses import decodeAddress
|
||||||
streamNumber, ripe = decodeAddress(toAddress)[2:]
|
streamNumber, ripe = decodeAddress(toAddress)[2:]
|
||||||
|
from addresses import addBMIfNotPresent
|
||||||
toAddress = addBMIfNotPresent(toAddress)
|
toAddress = addBMIfNotPresent(toAddress)
|
||||||
stealthLevel = BMConfigParser().safeGetInt(
|
stealthLevel = BMConfigParser().safeGetInt(
|
||||||
'bitmessagesettings', 'ackstealthlevel')
|
'bitmessagesettings', 'ackstealthlevel')
|
||||||
|
@ -2334,7 +2345,7 @@ class CustomSpinner(Spinner):
|
||||||
"""This class is used for setting spinner size"""
|
"""This class is used for setting spinner size"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Setting size of spinner"""
|
"""Method used for setting size of spinner"""
|
||||||
super(CustomSpinner, self).__init__(*args, **kwargs)
|
super(CustomSpinner, self).__init__(*args, **kwargs)
|
||||||
self.dropdown_cls.max_height = Window.size[1] / 3
|
self.dropdown_cls.max_height = Window.size[1] / 3
|
||||||
|
|
||||||
|
@ -2347,7 +2358,7 @@ class Allmails(Screen):
|
||||||
account = StringProperty()
|
account = StringProperty()
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Method Parsing the address."""
|
"""Method Parsing the address"""
|
||||||
super(Allmails, self).__init__(*args, **kwargs)
|
super(Allmails, self).__init__(*args, **kwargs)
|
||||||
if state.association == '':
|
if state.association == '':
|
||||||
if BMConfigParser().addresses():
|
if BMConfigParser().addresses():
|
||||||
|
@ -2360,7 +2371,7 @@ class Allmails(Screen):
|
||||||
print(dt)
|
print(dt)
|
||||||
|
|
||||||
def loadMessagelist(self):
|
def loadMessagelist(self):
|
||||||
"""Load Inbox, Sent anf Draft list of messages."""
|
"""Load Inbox, Sent anf Draft list of messages"""
|
||||||
self.account = state.association
|
self.account = state.association
|
||||||
self.allMessageQuery(0, 20)
|
self.allMessageQuery(0, 20)
|
||||||
if self.all_mails:
|
if self.all_mails:
|
||||||
|
@ -2538,16 +2549,19 @@ def avatarImageFirstLetter(letter_string):
|
||||||
|
|
||||||
class Starred(Screen):
|
class Starred(Screen):
|
||||||
"""Starred Screen show widgets of page"""
|
"""Starred Screen show widgets of page"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Archieve(Screen):
|
class Archieve(Screen):
|
||||||
"""Archieve Screen show widgets of page"""
|
"""Archieve Screen show widgets of page"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Spam(Screen):
|
class Spam(Screen):
|
||||||
"""Spam Screen show widgets of page"""
|
"""Spam Screen show widgets of page"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -2562,3 +2576,8 @@ class LoadingPopup(Popup):
|
||||||
def dismiss_popup(self, dt):
|
def dismiss_popup(self, dt):
|
||||||
"""Dismiss popups"""
|
"""Dismiss popups"""
|
||||||
self.dismiss()
|
self.dismiss()
|
||||||
|
|
||||||
|
|
||||||
|
class AddressDropdown(OneLineIconListItem):
|
||||||
|
"""AddressDropdown showns all the addresses"""
|
||||||
|
pass
|
|
@ -573,27 +573,10 @@ class sqlThread(threading.Thread):
|
||||||
rowcount = 0
|
rowcount = 0
|
||||||
# print 'item', item
|
# print 'item', item
|
||||||
# print 'parameters', parameters
|
# print 'parameters', parameters
|
||||||
# print('++++454++++++++++++++++++++++++')
|
|
||||||
# print ('parameters')
|
|
||||||
# print (parameters)
|
|
||||||
# print ('+++++++++++++++++++++++++++++')
|
|
||||||
try:
|
|
||||||
if 'sent' == parameters[1] and 'B' in parameters[0]:
|
|
||||||
item = (
|
|
||||||
'''SELECT toaddress, fromaddress, subject,'''
|
|
||||||
''' message, status, ackdata, lastactiontime'''
|
|
||||||
''' FROM sent WHERE fromaddress = ?'''
|
|
||||||
''' ORDER BY lastactiontime DESC''')
|
|
||||||
parameters = (parameters[0],)
|
|
||||||
except(IndexError, TypeError):
|
|
||||||
pass
|
|
||||||
try:
|
try:
|
||||||
self.cur.execute(item, parameters)
|
self.cur.execute(item, parameters)
|
||||||
rowcount = self.cur.rowcount
|
rowcount = self.cur.rowcount
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@')
|
|
||||||
print('inside the expectation')
|
|
||||||
print('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@')
|
|
||||||
if str(err) == 'database or disk is full':
|
if str(err) == 'database or disk is full':
|
||||||
logger.fatal(
|
logger.fatal(
|
||||||
'(while cur.execute) Alert: Your disk or data storage volume is full.'
|
'(while cur.execute) Alert: Your disk or data storage volume is full.'
|
||||||
|
|
45
src/state.py
45
src/state.py
|
@ -1,43 +1,30 @@
|
||||||
"""
|
"""
|
||||||
Global runtime variables.
|
src/state.py
|
||||||
|
=================================
|
||||||
"""
|
"""
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
neededPubkeys = {}
|
neededPubkeys = {}
|
||||||
streamsInWhichIAmParticipating = []
|
streamsInWhichIAmParticipating = []
|
||||||
|
# For UPnP
|
||||||
extPort = None
|
extPort = None
|
||||||
"""For UPnP"""
|
# for Tor hidden service
|
||||||
|
|
||||||
socksIP = None
|
socksIP = None
|
||||||
"""for Tor hidden service"""
|
# Network protocols availability, initialised below
|
||||||
|
networkProtocolAvailability = None
|
||||||
appdata = ''
|
appdata = '' # holds the location of the application data storage directory
|
||||||
"""holds the location of the application data storage directory"""
|
# Set to 1 by the doCleanShutdown function.
|
||||||
|
# Used to tell the proof of work worker threads to exit.
|
||||||
shutdown = 0
|
shutdown = 0
|
||||||
"""
|
|
||||||
Set to 1 by the `.shutdown.doCleanShutdown` function.
|
|
||||||
Used to tell the threads to exit.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Component control flags - set on startup, do not change during runtime
|
# Component control flags - set on startup, do not change during runtime
|
||||||
# The defaults are for standalone GUI (default operating mode)
|
# The defaults are for standalone GUI (default operating mode)
|
||||||
enableNetwork = True
|
enableNetwork = True # enable network threads
|
||||||
"""enable network threads"""
|
enableObjProc = True # enable object processing threads
|
||||||
enableObjProc = True
|
enableAPI = True # enable API (if configured)
|
||||||
"""enable object processing thread"""
|
enableGUI = True # enable GUI (QT or ncurses)
|
||||||
enableAPI = True
|
enableSTDIO = False # enable STDIO threads
|
||||||
"""enable API (if configured)"""
|
|
||||||
enableGUI = True
|
|
||||||
"""enable GUI (QT or ncurses)"""
|
|
||||||
enableSTDIO = False
|
|
||||||
"""enable STDIO threads"""
|
|
||||||
curses = False
|
curses = False
|
||||||
|
sqlReady = False # set to true by sqlTread when ready for processing
|
||||||
sqlReady = False
|
|
||||||
"""set to true by `.threads.sqlThread` when ready for processing"""
|
|
||||||
|
|
||||||
maximumNumberOfHalfOpenConnections = 0
|
maximumNumberOfHalfOpenConnections = 0
|
||||||
invThread = None
|
invThread = None
|
||||||
addrThread = None
|
addrThread = None
|
||||||
|
@ -68,8 +55,6 @@ def resetNetworkProtocolAvailability():
|
||||||
|
|
||||||
resetNetworkProtocolAvailability()
|
resetNetworkProtocolAvailability()
|
||||||
|
|
||||||
discoveredPeers = {}
|
|
||||||
|
|
||||||
dandelion = 0
|
dandelion = 0
|
||||||
|
|
||||||
testmode = False
|
testmode = False
|
||||||
|
|
Reference in New Issue
Block a user