Update common_backend

This commit is contained in:
shekhar-cis 2022-06-30 19:51:58 +05:30
parent 60d69e5314
commit 3ff897395f
Signed by untrusted user: shekhar-cis
GPG Key ID: F4F00AB04E83F9A7

View File

@ -1,21 +1,22 @@
"""
Common methods and functions for kivy and qt.
"""
import queues import queues
from bmconfigparser import BMConfigParser from bmconfigparser import BMConfigParser
from bitmessagekivy.baseclass.common import toast
class AddressGenerator: class AddressGenerator:
@staticmethod @staticmethod
def generate_address(entered_label): def start_address_generation(
""""Return True if the label is uniqe""" entered_label, streamNumberForAddress=1, eighteenByteRipe=False,
streamNumberForAddress = 1 nonceTrialsPerByte=1000, payloadLengthExtraBytes=1000
eighteenByteRipe = False ):
nonceTrialsPerByte = 1000 """"Return True if the label is unique"""
payloadLengthExtraBytes = 1000
labels = [BMConfigParser().get(obj, 'label') labels = [BMConfigParser().get(obj, 'label')
for obj in BMConfigParser().addresses()] for obj in BMConfigParser().addresses()]
if entered_label and entered_label not in labels: if entered_label and entered_label not in labels:
toast('Address Creating...')
queues.addressGeneratorQueue.put(( queues.addressGeneratorQueue.put((
'createRandomAddress', 4, streamNumberForAddress, entered_label, 1, 'createRandomAddress', 4, streamNumberForAddress, entered_label, 1,
"", eighteenByteRipe, nonceTrialsPerByte, "", eighteenByteRipe, nonceTrialsPerByte,