Fixed kivy_state variables
This commit is contained in:
parent
137e61f527
commit
bc3a9098a8
|
@ -24,12 +24,13 @@ from kivymd.uix.list import (
|
||||||
)
|
)
|
||||||
from kivymd.uix.selectioncontrol import MDSwitch
|
from kivymd.uix.selectioncontrol import MDSwitch
|
||||||
from kivy.uix.screenmanager import Screen
|
from kivy.uix.screenmanager import Screen
|
||||||
|
from kivy.app import App
|
||||||
|
|
||||||
import state
|
import state
|
||||||
|
|
||||||
from bitmessagekivy.baseclass.common import (
|
from bitmessagekivy.baseclass.common import (
|
||||||
avatarImageFirstLetter, AvatarSampleWidget, ThemeClsColor,
|
avatarImageFirstLetter, AvatarSampleWidget, ThemeClsColor,
|
||||||
toast
|
toast, empty_screen_label
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,10 +58,14 @@ class MyAddress(Screen, HelperMyAddress):
|
||||||
addresses_list = ListProperty()
|
addresses_list = ListProperty()
|
||||||
has_refreshed = True
|
has_refreshed = True
|
||||||
is_add_created = False
|
is_add_created = False
|
||||||
|
label_str = "yet no address is created by user!!!!!!!!!!!!!"
|
||||||
|
no_search_result = "No address found!"
|
||||||
|
|
||||||
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)
|
||||||
|
self.kivy_running_app = App.get_running_app()
|
||||||
|
self.kivy_state = self.kivy_running_app.kivy_state_obj
|
||||||
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):
|
||||||
|
@ -68,7 +73,7 @@ class MyAddress(Screen, HelperMyAddress):
|
||||||
# pylint: disable=unnecessary-lambda, deprecated-lambda
|
# pylint: disable=unnecessary-lambda, deprecated-lambda
|
||||||
# self.addresses_list = state.kivyapp.variable_1
|
# self.addresses_list = state.kivyapp.variable_1
|
||||||
self.addresses_list = BMConfigParser().addresses()
|
self.addresses_list = BMConfigParser().addresses()
|
||||||
if state.searcing_text:
|
if self.kivy_state.searcing_text:
|
||||||
self.ids.refresh_layout.scroll_y = 1.0
|
self.ids.refresh_layout.scroll_y = 1.0
|
||||||
filtered_list = [
|
filtered_list = [
|
||||||
x for x in BMConfigParser().addresses()
|
x for x in BMConfigParser().addresses()
|
||||||
|
@ -91,8 +96,8 @@ class MyAddress(Screen, HelperMyAddress):
|
||||||
# halign='center',
|
# halign='center',
|
||||||
# size_hint_y=None,
|
# size_hint_y=None,
|
||||||
# valign='top')
|
# valign='top')
|
||||||
self.ids.ml.add_widget(self.default_label_when_empty())
|
self.ids.ml.add_widget(empty_screen_label(self.label_str, self.no_search_result))
|
||||||
if not state.searcing_text and not self.is_add_created:
|
if not self.kivy_state.searcing_text and not self.is_add_created:
|
||||||
try:
|
try:
|
||||||
self.manager.current = 'login'
|
self.manager.current = 'login'
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -205,7 +210,7 @@ class MyAddress(Screen, HelperMyAddress):
|
||||||
While the spinner remains on the screen"""
|
While the spinner remains on the screen"""
|
||||||
def refresh_callback(interval):
|
def refresh_callback(interval):
|
||||||
"""Method used for loading the myaddress screen data"""
|
"""Method used for loading the myaddress screen data"""
|
||||||
state.searcing_text = ''
|
self.kivy_state.searcing_text = ''
|
||||||
# state.kivyapp.root.ids.sc10.children[2].active = False
|
# state.kivyapp.root.ids.sc10.children[2].active = False
|
||||||
self.ids.search_bar.ids.search_field.text = ''
|
self.ids.search_bar.ids.search_field.text = ''
|
||||||
self.has_refreshed = True
|
self.has_refreshed = True
|
||||||
|
@ -220,7 +225,7 @@ class MyAddress(Screen, HelperMyAddress):
|
||||||
def filter_address(address):
|
def filter_address(address):
|
||||||
"""Method will filter the my address list data"""
|
"""Method will filter the my address list data"""
|
||||||
# import pdb; pdb.set_trace()
|
# import pdb; pdb.set_trace()
|
||||||
searched_text = state.searcing_text.lower()
|
searched_text = MyAddress().kivy_state.searcing_text.lower()
|
||||||
if BMConfigParser().search_addresses(address, searched_text):
|
if BMConfigParser().search_addresses(address, searched_text):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
Reference in New Issue
Block a user