From abd3e02d72f5ceda7be73e13c2bb2b01d921c129 Mon Sep 17 00:00:00 2001 From: surbhi Date: Tue, 4 Sep 2018 18:21:27 +0530 Subject: [PATCH] Fix pylint global variable undefined at the module level issue --- src/bitmessagekivy/mpybit.py | 19 +++++++++---------- src/state.py | 2 ++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 01cd46bc..0d4ff2b5 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -35,22 +35,21 @@ class NavigateApp(App, TextInput): An application can be built if you return a widget on build(), or if you set self.root. """ - global main_widget - main_widget = Builder.load_file( + state.main_widget = Builder.load_file( os.path.join(os.path.dirname(__file__), 'main.kv')) self.nav_drawer = Navigator() - return main_widget + return state.main_widget def getCurrentAccountData(self, text): """Get Current Address Account Data.""" state.association = text - main_widget.ids.sc1.clear_widgets() - main_widget.ids.sc2.clear_widgets() - main_widget.ids.sc3.clear_widgets() - main_widget.ids.sc1.add_widget(Inbox()) - main_widget.ids.sc2.add_widget(Sent()) - main_widget.ids.sc3.add_widget(Trash()) - main_widget.ids.toolbar.title = BMConfigParser().get( + state.main_widget.ids.sc1.clear_widgets() + state.main_widget.ids.sc2.clear_widgets() + state.main_widget.ids.sc3.clear_widgets() + state.main_widget.ids.sc1.add_widget(Inbox()) + state.main_widget.ids.sc2.add_widget(Sent()) + state.main_widget.ids.sc3.add_widget(Trash()) + state.main_widget.ids.toolbar.title = BMConfigParser().get( state.association, 'label') + '({})'.format(state.association) Inbox() Sent() diff --git a/src/state.py b/src/state.py index f052d7bb..6630a86d 100644 --- a/src/state.py +++ b/src/state.py @@ -72,3 +72,5 @@ testmode = False kivy = False association = '' + +main_widget = ''