2018-08-07 08:14:14 +02:00
|
|
|
import kivy_helper_search
|
2018-08-31 13:19:57 +02:00
|
|
|
import os
|
2018-07-24 14:42:53 +02:00
|
|
|
import queues
|
2018-07-25 12:25:47 +02:00
|
|
|
import shutdown
|
2018-09-04 14:44:28 +02:00
|
|
|
import state
|
2018-07-25 12:25:47 +02:00
|
|
|
import time
|
|
|
|
|
2018-07-09 13:17:59 +02:00
|
|
|
from kivy.app import App
|
2018-07-18 14:49:39 +02:00
|
|
|
from kivy.lang import Builder
|
2018-07-24 14:42:53 +02:00
|
|
|
from kivy.properties import BooleanProperty
|
2018-07-25 12:25:47 +02:00
|
|
|
from kivy.clock import Clock
|
|
|
|
from navigationdrawer import NavigationDrawer
|
2018-08-31 13:19:57 +02:00
|
|
|
from kivy.properties import ObjectProperty, StringProperty, ListProperty
|
2018-07-25 12:25:47 +02:00
|
|
|
from kivy.uix.screenmanager import Screen
|
2018-07-18 14:49:39 +02:00
|
|
|
from kivy.uix.textinput import TextInput
|
2018-07-25 12:25:47 +02:00
|
|
|
from kivymd.theming import ThemeManager
|
|
|
|
from kivymd.toolbar import Toolbar
|
2018-07-24 12:05:39 +02:00
|
|
|
from bmconfigparser import BMConfigParser
|
2018-07-24 14:42:53 +02:00
|
|
|
from helper_ackPayload import genAckPayload
|
|
|
|
from addresses import decodeAddress, addBMIfNotPresent
|
2018-08-21 14:48:16 +02:00
|
|
|
from helper_sql import sqlExecute
|
2018-09-05 12:12:41 +02:00
|
|
|
from kivy.core.window import Window
|
2018-09-05 16:12:55 +02:00
|
|
|
from kivy.uix.actionbar import ActionItem
|
2018-08-21 14:48:16 +02:00
|
|
|
|
2018-07-24 12:05:39 +02:00
|
|
|
statusIconColor = 'red'
|
|
|
|
|
2018-07-07 14:11:58 +02:00
|
|
|
|
2018-07-24 12:05:39 +02:00
|
|
|
class NavigateApp(App, TextInput):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""Application uses kivy in which base Class of Navigate App inherits from the App class."""
|
|
|
|
|
2018-07-18 14:49:39 +02:00
|
|
|
theme_cls = ThemeManager()
|
|
|
|
nav_drawer = ObjectProperty()
|
2018-07-03 11:08:02 +02:00
|
|
|
|
2018-07-18 14:49:39 +02:00
|
|
|
def build(self):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""Return a main_widget as a root widget.
|
|
|
|
|
|
|
|
An application can be built if you return a widget on build(), or if you set
|
|
|
|
self.root.
|
|
|
|
"""
|
2018-09-04 15:05:22 +02:00
|
|
|
main_widget = Builder.load_file(
|
2018-07-24 14:42:53 +02:00
|
|
|
os.path.join(os.path.dirname(__file__), 'main.kv'))
|
2018-07-18 14:49:39 +02:00
|
|
|
self.nav_drawer = Navigator()
|
2018-09-05 12:12:41 +02:00
|
|
|
Window.bind(on_keyboard=self._key_handler)
|
2018-09-04 15:05:22 +02:00
|
|
|
return main_widget
|
2018-07-03 12:06:20 +02:00
|
|
|
|
2018-09-05 12:12:41 +02:00
|
|
|
def _key_handler(self, instance, key, *args):
|
2018-09-05 16:12:55 +02:00
|
|
|
"""Escape key manages previous screen on back."""
|
2018-09-05 12:12:41 +02:00
|
|
|
if key is 27:
|
2018-09-05 16:12:55 +02:00
|
|
|
print(args)
|
|
|
|
print(instance)
|
2018-09-05 12:12:41 +02:00
|
|
|
self.set_previous_screen()
|
|
|
|
return True
|
|
|
|
|
|
|
|
def set_previous_screen(self):
|
2018-09-05 16:12:55 +02:00
|
|
|
"""Set previous screen based on back."""
|
2018-09-05 12:12:41 +02:00
|
|
|
if self.root.ids.scr_mngr.current != 'inbox':
|
|
|
|
self.root.ids.scr_mngr.transition.direction = 'left'
|
2018-09-05 13:33:01 +02:00
|
|
|
self.root.ids.scr_mngr.current = 'inbox'
|
2018-09-05 12:12:41 +02:00
|
|
|
|
2018-08-09 12:20:20 +02:00
|
|
|
def getCurrentAccountData(self, text):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""Get Current Address Account Data."""
|
2018-09-04 14:44:28 +02:00
|
|
|
state.association = text
|
2018-09-04 15:05:22 +02:00
|
|
|
self.root.ids.sc1.clear_widgets()
|
|
|
|
self.root.ids.sc2.clear_widgets()
|
|
|
|
self.root.ids.sc3.clear_widgets()
|
|
|
|
self.root.ids.sc1.add_widget(Inbox())
|
|
|
|
self.root.ids.sc2.add_widget(Sent())
|
|
|
|
self.root.ids.sc3.add_widget(Trash())
|
|
|
|
self.root.ids.toolbar.title = BMConfigParser().get(
|
2018-09-04 14:44:28 +02:00
|
|
|
state.association, 'label') + '({})'.format(state.association)
|
2018-08-09 12:20:20 +02:00
|
|
|
Inbox()
|
|
|
|
Sent()
|
2018-08-21 14:48:16 +02:00
|
|
|
Trash()
|
2018-08-07 08:14:14 +02:00
|
|
|
|
2018-07-18 14:49:39 +02:00
|
|
|
def say_exit(self):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""Exit the application as uses shutdown PyBitmessage."""
|
2018-07-24 14:42:53 +02:00
|
|
|
print("**************************EXITING FROM APPLICATION*****************************")
|
2018-07-18 14:49:39 +02:00
|
|
|
App.get_running_app().stop()
|
|
|
|
shutdown.doCleanShutdown()
|
2018-07-03 12:06:20 +02:00
|
|
|
|
2018-09-01 13:45:39 +02:00
|
|
|
@staticmethod
|
|
|
|
def showmeaddresses(name="text"):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""Show the addresses in spinner to make as dropdown."""
|
2018-08-07 08:14:14 +02:00
|
|
|
if name == "text":
|
|
|
|
return BMConfigParser().addresses()[0]
|
|
|
|
elif name == "values":
|
|
|
|
return BMConfigParser().addresses()
|
2018-08-04 10:30:12 +02:00
|
|
|
|
2018-08-21 14:48:16 +02:00
|
|
|
def update_index(self, data_index, index):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""Update index after archieve message to trash."""
|
2018-08-21 14:48:16 +02:00
|
|
|
if self.root.ids.scr_mngr.current == 'inbox':
|
|
|
|
self.root.ids.sc1.data[data_index]['index'] = index
|
|
|
|
elif self.root.ids.scr_mngr.current == 'sent':
|
|
|
|
self.root.ids.sc2.data[data_index]['index'] = index
|
|
|
|
elif self.root.ids.scr_mngr.current == 'trash':
|
|
|
|
self.root.ids.sc3.data[data_index]['index'] = index
|
|
|
|
|
|
|
|
def delete(self, data_index):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""It will make delete using remove function."""
|
2018-08-21 14:48:16 +02:00
|
|
|
print("delete {}".format(data_index))
|
|
|
|
self._remove(data_index)
|
|
|
|
|
|
|
|
def archive(self, data_index):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""It will make archieve using remove function."""
|
2018-08-21 14:48:16 +02:00
|
|
|
print("archive {}".format(data_index))
|
|
|
|
self._remove(data_index)
|
|
|
|
|
|
|
|
def _remove(self, data_index):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""It will remove message by resetting the values in recycleview data."""
|
2018-08-21 14:48:16 +02:00
|
|
|
if self.root.ids.scr_mngr.current == 'inbox':
|
|
|
|
self.root.ids.sc1.data.pop(data_index)
|
|
|
|
self.root.ids.sc1.data = [{
|
|
|
|
'data_index': i,
|
|
|
|
'index': d['index'],
|
|
|
|
'height': d['height'],
|
|
|
|
'text': d['text']}
|
|
|
|
for i, d in enumerate(self.root.ids.sc1.data)
|
|
|
|
]
|
|
|
|
elif self.root.ids.scr_mngr.current == 'sent':
|
|
|
|
self.root.ids.sc2.data.pop(data_index)
|
|
|
|
self.root.ids.sc2.data = [{
|
|
|
|
'data_index': i,
|
|
|
|
'index': d['index'],
|
|
|
|
'height': d['height'],
|
|
|
|
'text': d['text']}
|
|
|
|
for i, d in enumerate(self.root.ids.sc2.data)
|
|
|
|
]
|
|
|
|
elif self.root.ids.scr_mngr.current == 'trash':
|
|
|
|
self.root.ids.sc3.data.pop(data_index)
|
|
|
|
self.root.ids.sc3.data = [{
|
|
|
|
'data_index': i,
|
|
|
|
'index': d['index'],
|
|
|
|
'height': d['height'],
|
|
|
|
'text': d['text']}
|
|
|
|
for i, d in enumerate(self.root.ids.sc3.data)
|
|
|
|
]
|
|
|
|
|
|
|
|
def getInboxMessageDetail(self, instance):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""It will get message detail after make selected message description."""
|
2018-08-21 14:48:16 +02:00
|
|
|
try:
|
|
|
|
self.root.ids.scr_mngr.current = 'page'
|
|
|
|
except AttributeError:
|
|
|
|
self.parent.manager.current = 'page'
|
|
|
|
print('Message Clicked {}'.format(instance))
|
|
|
|
|
2018-09-01 13:45:39 +02:00
|
|
|
@staticmethod
|
|
|
|
def getCurrentAccount():
|
2018-08-31 13:19:57 +02:00
|
|
|
"""It uses to get current account label."""
|
2018-09-04 14:44:28 +02:00
|
|
|
return BMConfigParser().get(state.association, 'label') + '({})'.format(state.association)
|
2018-08-31 13:19:57 +02:00
|
|
|
|
2018-07-24 12:05:39 +02:00
|
|
|
|
2018-07-18 14:49:39 +02:00
|
|
|
class Navigator(NavigationDrawer):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""Navigator class uses NavigationDrawer.
|
|
|
|
|
|
|
|
It is an UI panel that shows our app's main navigation menu
|
|
|
|
It is hidden when not in use, but appears when the user swipes
|
|
|
|
a finger from the left edge of the screen or, when at the top
|
|
|
|
level of the app, the user touches the drawer icon in the app bar
|
|
|
|
"""
|
|
|
|
|
2018-08-04 10:30:12 +02:00
|
|
|
image_source = StringProperty('images/qidenticon_two.png')
|
2018-07-18 14:49:39 +02:00
|
|
|
title = StringProperty('Navigation')
|
2018-07-03 12:06:20 +02:00
|
|
|
|
|
|
|
|
2018-07-18 14:49:39 +02:00
|
|
|
class Inbox(Screen):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""Inbox Screen uses screen to show widgets of screens."""
|
|
|
|
|
2018-08-21 14:48:16 +02:00
|
|
|
data = ListProperty()
|
|
|
|
|
2018-08-04 10:30:12 +02:00
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(Inbox, self).__init__(*args, **kwargs)
|
2018-09-04 14:44:28 +02:00
|
|
|
if state.association == '':
|
|
|
|
state.association = Navigator().ids.btn.text
|
2018-08-04 10:30:12 +02:00
|
|
|
Clock.schedule_once(self.init_ui, 0)
|
|
|
|
|
|
|
|
def init_ui(self, dt=0):
|
2018-09-01 13:45:39 +02:00
|
|
|
"""Clock Schdule for method inbox accounts."""
|
2018-08-21 14:48:16 +02:00
|
|
|
self.inboxaccounts()
|
2018-08-31 14:34:20 +02:00
|
|
|
print(dt)
|
2018-08-04 10:30:12 +02:00
|
|
|
|
2018-08-21 14:48:16 +02:00
|
|
|
def inboxaccounts(self):
|
2018-09-01 13:45:39 +02:00
|
|
|
"""Load inbox accounts."""
|
2018-09-04 14:44:28 +02:00
|
|
|
account = state.association
|
2018-09-04 15:24:59 +02:00
|
|
|
self.loadMessagelist(account, 'All', '')
|
2018-08-07 08:14:14 +02:00
|
|
|
|
2018-09-04 15:24:59 +02:00
|
|
|
def loadMessagelist(self, account, where="", what=""):
|
2018-09-01 13:45:39 +02:00
|
|
|
"""Load Inbox list for inbox messages."""
|
2018-08-07 08:14:14 +02:00
|
|
|
xAddress = "toaddress"
|
2018-08-31 13:19:57 +02:00
|
|
|
queryreturn = kivy_helper_search.search_sql(
|
2018-09-04 15:24:59 +02:00
|
|
|
xAddress, account, 'inbox', where, what, False)
|
2018-08-07 08:14:14 +02:00
|
|
|
if queryreturn:
|
2018-08-21 14:48:16 +02:00
|
|
|
self.data = [{
|
|
|
|
'data_index': i,
|
|
|
|
'index': 1,
|
|
|
|
'height': 48,
|
|
|
|
'text': row[4]}
|
|
|
|
for i, row in enumerate(queryreturn)
|
|
|
|
]
|
2018-08-07 08:14:14 +02:00
|
|
|
else:
|
2018-08-21 14:48:16 +02:00
|
|
|
self.data = [{
|
|
|
|
'data_index': 1,
|
|
|
|
'index': 1,
|
|
|
|
'height': 48,
|
|
|
|
'text': "yet no message for this account!!!!!!!!!!!!!"}
|
|
|
|
]
|
2018-08-04 10:30:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Page(Screen):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class AddressSuccessful(Screen):
|
|
|
|
pass
|
2018-07-03 11:08:02 +02:00
|
|
|
|
2018-07-24 12:05:39 +02:00
|
|
|
|
2018-07-18 14:49:39 +02:00
|
|
|
class Sent(Screen):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""Sent Screen uses screen to show widgets of screens."""
|
|
|
|
|
2018-08-21 14:48:16 +02:00
|
|
|
data = ListProperty()
|
|
|
|
|
2018-08-09 12:20:20 +02:00
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(Sent, self).__init__(*args, **kwargs)
|
2018-09-04 14:44:28 +02:00
|
|
|
if state.association == '':
|
|
|
|
state.association = Navigator().ids.btn.text
|
2018-08-09 12:20:20 +02:00
|
|
|
Clock.schedule_once(self.init_ui, 0)
|
|
|
|
|
|
|
|
def init_ui(self, dt=0):
|
2018-09-01 13:45:39 +02:00
|
|
|
"""Clock Schdule for method sent accounts."""
|
2018-08-21 14:48:16 +02:00
|
|
|
self.sentaccounts()
|
2018-08-31 14:34:20 +02:00
|
|
|
print(dt)
|
2018-08-09 12:20:20 +02:00
|
|
|
|
2018-08-21 14:48:16 +02:00
|
|
|
def sentaccounts(self):
|
2018-09-01 13:45:39 +02:00
|
|
|
"""Load sent accounts."""
|
2018-09-04 14:44:28 +02:00
|
|
|
account = state.association
|
2018-08-21 14:48:16 +02:00
|
|
|
self.loadSent(account, 'All', '')
|
2018-08-09 12:20:20 +02:00
|
|
|
|
2018-08-21 14:48:16 +02:00
|
|
|
def loadSent(self, account, where="", what=""):
|
2018-09-01 13:45:39 +02:00
|
|
|
"""Load Sent list for Sent messages."""
|
2018-08-09 12:20:20 +02:00
|
|
|
xAddress = 'fromaddress'
|
2018-08-31 13:19:57 +02:00
|
|
|
queryreturn = kivy_helper_search.search_sql(
|
|
|
|
xAddress, account, "sent", where, what, False)
|
2018-08-09 12:20:20 +02:00
|
|
|
if queryreturn:
|
2018-08-21 14:48:16 +02:00
|
|
|
self.data = [{
|
|
|
|
'data_index': i,
|
|
|
|
'index': 1,
|
|
|
|
'height': 48,
|
|
|
|
'text': row[2]}
|
|
|
|
for i, row in enumerate(queryreturn)
|
|
|
|
]
|
2018-08-09 12:20:20 +02:00
|
|
|
else:
|
2018-08-21 14:48:16 +02:00
|
|
|
self.data = [{
|
|
|
|
'data_index': 1,
|
|
|
|
'index': 1,
|
|
|
|
'height': 48,
|
|
|
|
'text': "yet no message for this account!!!!!!!!!!!!!"}
|
|
|
|
]
|
2018-08-09 12:20:20 +02:00
|
|
|
|
2018-07-24 12:05:39 +02:00
|
|
|
|
2018-07-18 14:49:39 +02:00
|
|
|
class Trash(Screen):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""Trash Screen uses screen to show widgets of screens."""
|
|
|
|
|
2018-08-21 14:48:16 +02:00
|
|
|
data = ListProperty()
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(Trash, self).__init__(*args, **kwargs)
|
2018-09-04 14:44:28 +02:00
|
|
|
if state.association == '':
|
|
|
|
state.association = Navigator().ids.btn.text
|
2018-08-21 14:48:16 +02:00
|
|
|
Clock.schedule_once(self.init_ui, 0)
|
|
|
|
|
|
|
|
def init_ui(self, dt=0):
|
2018-09-01 13:45:39 +02:00
|
|
|
"""Clock Schdule for method inbox accounts."""
|
2018-08-21 14:48:16 +02:00
|
|
|
self.inboxaccounts()
|
2018-08-31 14:34:20 +02:00
|
|
|
print(dt)
|
2018-08-21 14:48:16 +02:00
|
|
|
|
|
|
|
def inboxaccounts(self):
|
2018-09-01 13:45:39 +02:00
|
|
|
"""Load inbox accounts."""
|
2018-09-04 14:44:28 +02:00
|
|
|
account = state.association
|
2018-09-04 15:24:59 +02:00
|
|
|
self.loadTrashlist(account, 'All', '')
|
2018-08-21 14:48:16 +02:00
|
|
|
|
2018-09-04 15:24:59 +02:00
|
|
|
def loadTrashlist(self, account, where="", what=""):
|
2018-08-31 14:34:20 +02:00
|
|
|
"""Load Trash list for trashed messages."""
|
2018-08-21 14:48:16 +02:00
|
|
|
xAddress = "toaddress"
|
2018-08-31 13:19:57 +02:00
|
|
|
queryreturn = kivy_helper_search.search_sql(
|
2018-09-04 15:24:59 +02:00
|
|
|
xAddress, account, 'trash', where, what, False)
|
2018-08-21 14:48:16 +02:00
|
|
|
if queryreturn:
|
|
|
|
self.data = [{
|
|
|
|
'data_index': i,
|
|
|
|
'index': 1,
|
|
|
|
'height': 48,
|
|
|
|
'text': row[4]}
|
|
|
|
for i, row in enumerate(queryreturn)
|
|
|
|
]
|
|
|
|
else:
|
|
|
|
self.data = [{
|
|
|
|
'data_index': 1,
|
|
|
|
'index': 1,
|
|
|
|
'height': 48,
|
|
|
|
'text': "yet no message for this account!!!!!!!!!!!!!"}
|
|
|
|
]
|
2018-07-03 11:08:02 +02:00
|
|
|
|
|
|
|
|
2018-07-18 14:49:39 +02:00
|
|
|
class Dialog(Screen):
|
2018-08-31 14:34:20 +02:00
|
|
|
"""Dialog Screen uses screen to show widgets of screens."""
|
|
|
|
|
2018-07-18 14:49:39 +02:00
|
|
|
pass
|
2018-07-03 11:08:02 +02:00
|
|
|
|
|
|
|
|
2018-07-18 14:49:39 +02:00
|
|
|
class Test(Screen):
|
2018-08-31 14:34:20 +02:00
|
|
|
"""Test Screen uses screen to show widgets of screens."""
|
|
|
|
|
2018-07-18 14:49:39 +02:00
|
|
|
pass
|
2018-07-03 11:08:02 +02:00
|
|
|
|
2018-07-07 14:11:58 +02:00
|
|
|
|
2018-08-04 10:30:12 +02:00
|
|
|
class Create(Screen):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""Create Screen uses screen to show widgets of screens."""
|
2018-07-24 12:05:39 +02:00
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(Create, self).__init__(*args, **kwargs)
|
|
|
|
|
|
|
|
def send(self):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""Send message from one address to another."""
|
2018-07-24 14:42:53 +02:00
|
|
|
fromAddress = self.ids.spinner_id.text
|
|
|
|
# For now we are using static address i.e we are not using recipent field value.
|
|
|
|
toAddress = "BM-2cWyUfBdY2FbgyuCb7abFZ49JYxSzUhNFe"
|
|
|
|
message = self.ids.message.text
|
|
|
|
subject = self.ids.subject.text
|
|
|
|
encoding = 3
|
|
|
|
print("message: ", self.ids.message.text)
|
|
|
|
sendMessageToPeople = True
|
|
|
|
if sendMessageToPeople:
|
|
|
|
if toAddress != '':
|
|
|
|
status, addressVersionNumber, streamNumber, ripe = decodeAddress(
|
|
|
|
toAddress)
|
|
|
|
if status == 'success':
|
|
|
|
toAddress = addBMIfNotPresent(toAddress)
|
|
|
|
|
|
|
|
if addressVersionNumber > 4 or addressVersionNumber <= 1:
|
|
|
|
print("addressVersionNumber > 4 or addressVersionNumber <= 1")
|
|
|
|
if streamNumber > 1 or streamNumber == 0:
|
|
|
|
print("streamNumber > 1 or streamNumber == 0")
|
|
|
|
if statusIconColor == 'red':
|
|
|
|
print("shared.statusIconColor == 'red'")
|
|
|
|
stealthLevel = BMConfigParser().safeGetInt(
|
|
|
|
'bitmessagesettings', 'ackstealthlevel')
|
|
|
|
ackdata = genAckPayload(streamNumber, stealthLevel)
|
|
|
|
t = ()
|
|
|
|
sqlExecute(
|
|
|
|
'''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''',
|
|
|
|
'',
|
|
|
|
toAddress,
|
|
|
|
ripe,
|
|
|
|
fromAddress,
|
|
|
|
subject,
|
|
|
|
message,
|
|
|
|
ackdata,
|
|
|
|
int(time.time()),
|
|
|
|
int(time.time()),
|
|
|
|
0,
|
|
|
|
'msgqueued',
|
|
|
|
0,
|
|
|
|
'sent',
|
|
|
|
encoding,
|
|
|
|
BMConfigParser().getint('bitmessagesettings', 'ttl'))
|
|
|
|
toLabel = ''
|
|
|
|
queues.workerQueue.put(('sendmessage', toAddress))
|
|
|
|
print("sqlExecute successfully ##### ##################")
|
|
|
|
self.ids.message.text = ''
|
|
|
|
self.ids.spinner_id.text = '<select>'
|
|
|
|
self.ids.subject.text = ''
|
|
|
|
self.ids.recipent.text = ''
|
|
|
|
return None
|
|
|
|
|
|
|
|
def cancel(self):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""Reset values for send message."""
|
2018-07-24 14:42:53 +02:00
|
|
|
self.ids.message.text = ''
|
|
|
|
self.ids.spinner_id.text = '<select>'
|
|
|
|
self.ids.subject.text = ''
|
|
|
|
self.ids.recipent.text = ''
|
|
|
|
return None
|
2018-07-24 12:05:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
class NewIdentity(Screen):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""Create new address for PyBitmessage."""
|
|
|
|
|
2018-07-24 12:05:39 +02:00
|
|
|
is_active = BooleanProperty(False)
|
2018-08-04 10:30:12 +02:00
|
|
|
checked = StringProperty("")
|
2018-08-21 14:48:16 +02:00
|
|
|
# self.manager.parent.ids.create.children[0].source = 'images/plus-4-xxl.png'
|
2018-08-04 10:30:12 +02:00
|
|
|
|
|
|
|
def generateaddress(self):
|
2018-08-31 13:19:57 +02:00
|
|
|
"""Generate new address."""
|
2018-08-04 10:30:12 +02:00
|
|
|
if self.checked == 'use a random number generator to make an address':
|
|
|
|
queues.apiAddressGeneratorReturnQueue.queue.clear()
|
|
|
|
streamNumberForAddress = 1
|
|
|
|
label = self.ids.label.text
|
|
|
|
eighteenByteRipe = False
|
|
|
|
nonceTrialsPerByte = 1000
|
|
|
|
payloadLengthExtraBytes = 1000
|
2018-08-31 13:19:57 +02:00
|
|
|
|
2018-08-04 10:30:12 +02:00
|
|
|
queues.addressGeneratorQueue.put((
|
2018-08-31 13:19:57 +02:00
|
|
|
'createRandomAddress',
|
|
|
|
4, streamNumberForAddress,
|
|
|
|
label, 1, "", eighteenByteRipe,
|
|
|
|
nonceTrialsPerByte,
|
|
|
|
payloadLengthExtraBytes)
|
2018-08-04 10:30:12 +02:00
|
|
|
)
|
|
|
|
self.manager.current = 'add_sucess'
|
2018-07-24 14:42:53 +02:00
|
|
|
|
2018-08-31 13:19:57 +02:00
|
|
|
|
2018-09-05 16:12:55 +02:00
|
|
|
class SearchBar(TextInput, ActionItem):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(SearchBar, self).__init__(*args, **kwargs)
|
|
|
|
self.hint_text = 'Search'
|
|
|
|
|
|
|
|
def search(self):
|
|
|
|
request = self.text
|
|
|
|
return str(request)
|
|
|
|
|
|
|
|
|
2018-07-18 14:49:39 +02:00
|
|
|
if __name__ == '__main__':
|
2018-07-24 14:42:53 +02:00
|
|
|
NavigateApp().run()
|