worked on auto validation issue or toast implementation
This commit is contained in:
parent
4b77b22266
commit
48c31b41c8
|
@ -68,7 +68,9 @@
|
||||||
<Random>:
|
<Random>:
|
||||||
name: 'random'
|
name: 'random'
|
||||||
ScrollView:
|
ScrollView:
|
||||||
BoxLayout:
|
id: add_random_bx
|
||||||
|
|
||||||
|
<RandomBoxlayout>:
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
height: self.minimum_height
|
height: self.minimum_height
|
||||||
|
@ -87,21 +89,23 @@
|
||||||
text: "Here you may generate as many addresses as you like, Indeed creating and abandoning addresses is encouraged"
|
text: "Here you may generate as many addresses as you like, Indeed creating and abandoning addresses is encouraged"
|
||||||
halign: 'center'
|
halign: 'center'
|
||||||
color:app.theme_cls.primary_dark
|
color:app.theme_cls.primary_dark
|
||||||
|
|
||||||
MDTextField:
|
MDTextField:
|
||||||
id: label
|
id: label
|
||||||
multiline: False
|
multiline: False
|
||||||
hint_text: "Label"
|
hint_text: "Label"
|
||||||
required: True
|
required: True
|
||||||
helper_text_mode: "on_error"
|
helper_text_mode: "on_error"
|
||||||
on_text: root.add_validation(self)
|
on_text: app.root.ids.sc7.add_validation(self)
|
||||||
canvas.before:
|
canvas.before:
|
||||||
Color:
|
Color:
|
||||||
rgba: (0,0,0,1)
|
rgba: (0,0,0,1)
|
||||||
|
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
AnchorLayout:
|
AnchorLayout:
|
||||||
MDRaisedButton:
|
MDRaisedButton:
|
||||||
height: dp(40)
|
height: dp(40)
|
||||||
on_release: root.generateaddress(app)
|
on_release: app.root.ids.sc7.generateaddress(app)
|
||||||
opposite_colors: True
|
opposite_colors: True
|
||||||
MDLabel:
|
MDLabel:
|
||||||
font_style: 'H6'
|
font_style: 'H6'
|
||||||
|
|
|
@ -188,6 +188,7 @@
|
||||||
divider: None
|
divider: None
|
||||||
on_release: app.root.ids.scr_mngr.current = 'login'
|
on_release: app.root.ids.scr_mngr.current = 'login'
|
||||||
on_release: root.parent.set_state()
|
on_release: root.parent.set_state()
|
||||||
|
on_press: app.reset_login_screen()
|
||||||
NavigationItem:
|
NavigationItem:
|
||||||
text: 'Network status'
|
text: 'Network status'
|
||||||
icon: 'server-network'
|
icon: 'server-network'
|
||||||
|
|
|
@ -979,13 +979,12 @@ class Random(Screen):
|
||||||
|
|
||||||
def generateaddress(self, navApp):
|
def generateaddress(self, navApp):
|
||||||
"""Method for Address Generator"""
|
"""Method for Address Generator"""
|
||||||
entered_label = str(self.ids.label.text).strip()
|
entered_label = str(self.ids.add_random_bx.children[0].ids.label.text).strip()
|
||||||
if not entered_label:
|
if not entered_label:
|
||||||
self.ids.label.focus = True
|
self.ids.add_random_bx.children[0].ids.label.focus = True
|
||||||
# self.ids.label.error = True
|
# self.ids.label.error = True
|
||||||
# self.ids.label.helper_text = 'This field is required'
|
# self.ids.label.helper_text = 'This field is required'
|
||||||
streamNumberForAddress = 1
|
streamNumberForAddress = 1
|
||||||
label = self.ids.label.text
|
|
||||||
eighteenByteRipe = False
|
eighteenByteRipe = False
|
||||||
nonceTrialsPerByte = 1000
|
nonceTrialsPerByte = 1000
|
||||||
payloadLengthExtraBytes = 1000
|
payloadLengthExtraBytes = 1000
|
||||||
|
@ -994,10 +993,9 @@ class Random(Screen):
|
||||||
if entered_label and entered_label not in lables:
|
if entered_label and entered_label not in lables:
|
||||||
toast('Address Creating...')
|
toast('Address Creating...')
|
||||||
queues.addressGeneratorQueue.put((
|
queues.addressGeneratorQueue.put((
|
||||||
'createRandomAddress', 4, streamNumberForAddress, label, 1,
|
'createRandomAddress', 4, streamNumberForAddress, entered_label, 1,
|
||||||
"", eighteenByteRipe, nonceTrialsPerByte,
|
"", eighteenByteRipe, nonceTrialsPerByte,
|
||||||
payloadLengthExtraBytes))
|
payloadLengthExtraBytes))
|
||||||
self.ids.label.text = ''
|
|
||||||
self.parent.parent.ids.toolbar.opacity = 1
|
self.parent.parent.ids.toolbar.opacity = 1
|
||||||
self.parent.parent.ids.toolbar.disabled = False
|
self.parent.parent.ids.toolbar.disabled = False
|
||||||
state.kivyapp.loadMyAddressScreen(True)
|
state.kivyapp.loadMyAddressScreen(True)
|
||||||
|
@ -1019,19 +1017,20 @@ class Random(Screen):
|
||||||
lables = [BMConfigParser().get(obj, 'label')
|
lables = [BMConfigParser().get(obj, 'label')
|
||||||
for obj in BMConfigParser().addresses()]
|
for obj in BMConfigParser().addresses()]
|
||||||
if entered_label in lables:
|
if entered_label in lables:
|
||||||
self.ids.label.error = True
|
instance.error = True
|
||||||
self.ids.label.helper_text = 'Label name is already exist you'\
|
instance.helper_text = 'Label name is already exist you'\
|
||||||
' can try this Ex. ( {0}_1, {0}_2 )'.format(
|
' can try this Ex. ( {0}_1, {0}_2 )'.format(
|
||||||
entered_label)
|
entered_label)
|
||||||
elif entered_label:
|
elif entered_label:
|
||||||
self.ids.label.error = False
|
instance.error = False
|
||||||
else:
|
else:
|
||||||
self.ids.label.error = False
|
instance.error = False
|
||||||
self.ids.label.helper_text = 'This field is required'
|
instance.helper_text = 'This field is required'
|
||||||
|
|
||||||
def reset_address_label(self):
|
def reset_address_label(self):
|
||||||
"""Resetting address labels"""
|
"""Resetting address labels"""
|
||||||
self.ids.label.text = ''
|
if not self.ids.add_random_bx.children:
|
||||||
|
self.ids.add_random_bx.add_widget(RandomBoxlayout())
|
||||||
|
|
||||||
|
|
||||||
class Sent(Screen):
|
class Sent(Screen):
|
||||||
|
@ -1995,6 +1994,10 @@ class NavigateApp(MDApp):
|
||||||
Clipboard.copy(text)
|
Clipboard.copy(text)
|
||||||
toast('Copied')
|
toast('Copied')
|
||||||
|
|
||||||
|
def reset_login_screen(self):
|
||||||
|
if self.root.ids.sc7.ids.add_random_bx.children:
|
||||||
|
self.root.ids.sc7.ids.add_random_bx.clear_widgets()
|
||||||
|
|
||||||
|
|
||||||
class GrashofPopup(Popup):
|
class GrashofPopup(Popup):
|
||||||
"""Moule for save contacts and error messages"""
|
"""Moule for save contacts and error messages"""
|
||||||
|
@ -2040,9 +2043,9 @@ class GrashofPopup(Popup):
|
||||||
def checkAddress_valid(self, instance):
|
def checkAddress_valid(self, instance):
|
||||||
"""Checking address is valid or not"""
|
"""Checking address is valid or not"""
|
||||||
# my_addresses = (
|
# my_addresses = (
|
||||||
# self.parent.children[1].children[2].children[0].ids.btn.values)
|
# self.parent.children[1].children[0].children[0].ids.btn.values)
|
||||||
my_addresses = (
|
my_addresses = (
|
||||||
self.parent.children[1].children[0].children[0].ids.btn.values)
|
state.kivyapp.root.children[0].children[0].ids.btn.values)
|
||||||
add_book = [addr[1] for addr in kivy_helper_search.search_sql(
|
add_book = [addr[1] for addr in kivy_helper_search.search_sql(
|
||||||
folder="addressbook")]
|
folder="addressbook")]
|
||||||
entered_text = str(instance.text).strip()
|
entered_text = str(instance.text).strip()
|
||||||
|
@ -2798,6 +2801,7 @@ class Allmails(Screen):
|
||||||
nav_lay_obj.sc5.clear_widgets()
|
nav_lay_obj.sc5.clear_widgets()
|
||||||
nav_lay_obj.sc5.add_widget(Trash())
|
nav_lay_obj.sc5.add_widget(Trash())
|
||||||
nav_lay_obj.sc17.remove_widget(instance.parent.parent)
|
nav_lay_obj.sc17.remove_widget(instance.parent.parent)
|
||||||
|
toast('Deleted')
|
||||||
|
|
||||||
def refresh_callback(self, *args):
|
def refresh_callback(self, *args):
|
||||||
"""Method updates the state of application,
|
"""Method updates the state of application,
|
||||||
|
@ -3006,3 +3010,8 @@ class ToAddrBoxlayout(BoxLayout):
|
||||||
def set_toAddress(self, to_addr):
|
def set_toAddress(self, to_addr):
|
||||||
"""This method is use to set to address"""
|
"""This method is use to set to address"""
|
||||||
self.to_addr = to_addr
|
self.to_addr = to_addr
|
||||||
|
|
||||||
|
|
||||||
|
class RandomBoxlayout(BoxLayout):
|
||||||
|
"""class for BoxLayout behaviour"""
|
||||||
|
pass
|
Reference in New Issue
Block a user