added fake addressGenerator thread
This commit is contained in:
parent
064c5ca403
commit
148d4a1333
|
@ -19,7 +19,7 @@
|
||||||
# spacing: "12dp"
|
# spacing: "12dp"
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
# height: "120dp"
|
# height: "120dp"
|
||||||
height: 1.5*label.height+address.height
|
height: label.height+address.height
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
MDTextField:
|
MDTextField:
|
||||||
|
|
|
@ -476,6 +476,7 @@ class NavigateApp(MDApp):
|
||||||
state.in_composer = False
|
state.in_composer = False
|
||||||
self.root.ids.scr_mngr.current = 'inbox'
|
self.root.ids.scr_mngr.current = 'inbox'
|
||||||
elif self.root.ids.scr_mngr.current == "showqrcode":
|
elif self.root.ids.scr_mngr.current == "showqrcode":
|
||||||
|
self.set_common_header()
|
||||||
self.root.ids.scr_mngr.current = 'myaddress'
|
self.root.ids.scr_mngr.current = 'myaddress'
|
||||||
elif self.root.ids.scr_mngr.current == "random":
|
elif self.root.ids.scr_mngr.current == "random":
|
||||||
self.root.ids.scr_mngr.current = 'login'
|
self.root.ids.scr_mngr.current = 'login'
|
||||||
|
|
|
@ -3,7 +3,8 @@ import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from telenium.tests import TeleniumTestCase
|
from telenium.tests import TeleniumTestCase
|
||||||
from threads import addressGenerator, sqlThread
|
from threads import sqlThread
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_files = (
|
_files = (
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import time
|
import time
|
||||||
from bitmessagekivy.tests.telenium_process import TeleniumTestProcess
|
from bitmessagekivy.tests.telenium_process import TeleniumTestProcess
|
||||||
from bmconfigparser import BMConfigParser
|
|
||||||
from .common import ordered
|
from .common import ordered
|
||||||
|
|
||||||
data = BMConfigParser().addresses()
|
data = [
|
||||||
|
'BM-2cWmjntZ47WKEUtocrdvs19y5CivpKoi1h',
|
||||||
|
'BM-2cVpswZo8rWLXDVtZEUNcDQvnvHJ6TLRYr'
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class AddressBook(TeleniumTestProcess):
|
class AddressBook(TeleniumTestProcess):
|
||||||
|
@ -60,7 +62,7 @@ class AddressBook(TeleniumTestProcess):
|
||||||
self.cli.sleep(3)
|
self.cli.sleep(3)
|
||||||
self.cli.execute('app.addingtoaddressbook()')
|
self.cli.execute('app.addingtoaddressbook()')
|
||||||
self.cli.sleep(3)
|
self.cli.sleep(3)
|
||||||
self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[0]','text','test2')
|
self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[0]','text','test2 ')
|
||||||
self.cli.sleep(3)
|
self.cli.sleep(3)
|
||||||
self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]','text',data[0])
|
self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]','text',data[0])
|
||||||
self.cli.sleep(3)
|
self.cli.sleep(3)
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
from bmconfigparser import BMConfigParser
|
|
||||||
from bitmessagekivy.tests.telenium_process import TeleniumTestProcess
|
from bitmessagekivy.tests.telenium_process import TeleniumTestProcess
|
||||||
from .common import ordered
|
from .common import ordered
|
||||||
|
|
||||||
data = BMConfigParser().addresses()
|
data = [
|
||||||
|
'BM-2cWmjntZ47WKEUtocrdvs19y5CivpKoi1h',
|
||||||
|
'BM-2cVpswZo8rWLXDVtZEUNcDQvnvHJ6TLRYr'
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class MyAddressScreen(TeleniumTestProcess):
|
class MyAddressScreen(TeleniumTestProcess):
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
from bitmessagekivy.tests.telenium_process import TeleniumTestProcess
|
from bitmessagekivy.tests.telenium_process import TeleniumTestProcess
|
||||||
from bmconfigparser import BMConfigParser
|
|
||||||
from .common import ordered
|
from .common import ordered
|
||||||
|
|
||||||
data = BMConfigParser().addresses()
|
data = [
|
||||||
|
'BM-2cWmjntZ47WKEUtocrdvs19y5CivpKoi1h',
|
||||||
|
'BM-2cVpswZo8rWLXDVtZEUNcDQvnvHJ6TLRYr'
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class SendMessage(TeleniumTestProcess):
|
class SendMessage(TeleniumTestProcess):
|
||||||
|
|
60
src/fake_addressGenerator.py
Normal file
60
src/fake_addressGenerator.py
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
"""
|
||||||
|
A thread for creating addresses
|
||||||
|
"""
|
||||||
|
|
||||||
|
import queues
|
||||||
|
import state
|
||||||
|
from bmconfigparser import BMConfigParser
|
||||||
|
from network.threads import StoppableThread
|
||||||
|
|
||||||
|
|
||||||
|
fake_addresses = [
|
||||||
|
'BM-2cXDconV3bk6nPwWgBwN7wXaqZoT1bEzGv',
|
||||||
|
'BM-2cTWjUVedYftZJbnZfs7MWts92v1R35Try',
|
||||||
|
'BM-2cV1UN3er2YVQBcmJaaeYMXvpwBVokJNTo',
|
||||||
|
'BM-2cWVkWk3TyKUscdcn9E7s9hrwpv2ZsBBog',
|
||||||
|
'BM-2cW2a5R1KidMGNByqPKn6nJDDnHtazoere'
|
||||||
|
]
|
||||||
|
|
||||||
|
class FakeAddressGenerator(StoppableThread):
|
||||||
|
"""A thread for creating fake addresses"""
|
||||||
|
name = "addressGenerator"
|
||||||
|
|
||||||
|
def stopThread(self):
|
||||||
|
try:
|
||||||
|
queues.addressGeneratorQueue.put(("stopThread", "data"))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
super(addressGenerator, self).stopThread()
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
"""
|
||||||
|
Process the requests for addresses generation
|
||||||
|
from `.queues.addressGeneratorQueue`
|
||||||
|
"""
|
||||||
|
while state.shutdown == 0:
|
||||||
|
queueValue = queues.addressGeneratorQueue.get()
|
||||||
|
streamNumber = 1
|
||||||
|
try:
|
||||||
|
if len(BMConfigParser().addresses()) > 0:
|
||||||
|
address = fake_addresses[len(BMConfigParser().addresses())]
|
||||||
|
else:
|
||||||
|
address = fake_addresses[0]
|
||||||
|
|
||||||
|
label = queueValue[3]
|
||||||
|
BMConfigParser().add_section(address)
|
||||||
|
BMConfigParser().set(address, 'label', label)
|
||||||
|
BMConfigParser().set(address, 'enabled', 'true')
|
||||||
|
BMConfigParser().set(
|
||||||
|
address, 'privencryptionkey', '5KUayt1aPSsNWsxMJnk27kv79wfRE3cWVPYLazyLQc752bXfQP3')
|
||||||
|
BMConfigParser().save()
|
||||||
|
|
||||||
|
queues.UISignalQueue.put((
|
||||||
|
'updateStatusBar', ""
|
||||||
|
))
|
||||||
|
queues.UISignalQueue.put(('writeNewAddressToTable', (
|
||||||
|
label, address, streamNumber)))
|
||||||
|
queues.addressGeneratorQueue.task_done()
|
||||||
|
except IndexError:
|
||||||
|
self.logger.error(
|
||||||
|
'Program error: you can only create 5 fake addresses')
|
|
@ -1,12 +1,13 @@
|
||||||
"""This module is for thread start."""
|
"""This module is for thread start."""
|
||||||
import state
|
import state
|
||||||
from bitmessagekivy.mpybit import NavigateApp
|
from bitmessagekivy.mpybit import NavigateApp
|
||||||
from threads import addressGenerator, sqlThread
|
from fake_addressGenerator import FakeAddressGenerator
|
||||||
|
from threads import sqlThread
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if state.enableObjProc:
|
if state.enableObjProc:
|
||||||
# Start the address generation thread
|
# Start the address generation thread
|
||||||
addressGeneratorThread = addressGenerator()
|
addressGeneratorThread = FakeAddressGenerator()
|
||||||
# close the main program even if there are threads left
|
# close the main program even if there are threads left
|
||||||
addressGeneratorThread.daemon = True
|
addressGeneratorThread.daemon = True
|
||||||
addressGeneratorThread.start()
|
addressGeneratorThread.start()
|
||||||
|
|
Reference in New Issue
Block a user