From 2625d342a932bf33dac6209b97fb24432d31630d Mon Sep 17 00:00:00 2001 From: surbhi Date: Wed, 5 Sep 2018 19:42:55 +0530 Subject: [PATCH] Added Ui for Search bar for message searching and also manage exit button on Action bar --- src/bitmessagekivy/main.kv | 26 ++++++++++++++++++-------- src/bitmessagekivy/mpybit.py | 15 +++++++++++++++ src/images/search.png | Bin 0 -> 2982 bytes 3 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 src/images/search.png diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index 4b4316d4..1b7b2a6b 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -46,14 +46,24 @@ BoxLayout: title: app.getCurrentAccount() background_color: app.theme_cls.primary_dark left_action_items: [['menu', lambda x: app.nav_drawer.toggle()]] - Button: - text:"EXIT" - color: 0,0,0,1 - background_color: (0,0,0,0) - size_hint_y: 0.4 - size_hint_x: 0.1 - pos_hint: {'x': 0.8, 'y':0.4} - on_press: app.say_exit() + + ActionView: + SearchBar: + size_hint_x: 1.7 + size_hint_y: .5 + pos_hint: {'x': 0, 'center_y':.5} + on_text_validate: searchbutt.trigger_action() + + ActionPrevious: + with_previous: False + app_icon: '' + + ActionOverflow: + ActionButton: + text: 'Filters' + ActionButton: + text: 'Exit' + on_press: app.say_exit() ScreenManager: id: scr_mngr diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index a5241e0a..1d4f7178 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -20,6 +20,7 @@ from helper_ackPayload import genAckPayload from addresses import decodeAddress, addBMIfNotPresent from helper_sql import sqlExecute from kivy.core.window import Window +from kivy.uix.actionbar import ActionItem statusIconColor = 'red' @@ -43,11 +44,15 @@ class NavigateApp(App, TextInput): return main_widget def _key_handler(self, instance, key, *args): + """Escape key manages previous screen on back.""" if key is 27: + print(args) + print(instance) self.set_previous_screen() return True def set_previous_screen(self): + """Set previous screen based on back.""" if self.root.ids.scr_mngr.current != 'inbox': self.root.ids.scr_mngr.transition.direction = 'left' self.root.ids.scr_mngr.current = 'inbox' @@ -401,5 +406,15 @@ class NewIdentity(Screen): self.manager.current = 'add_sucess' +class SearchBar(TextInput, ActionItem): + def __init__(self, *args, **kwargs): + super(SearchBar, self).__init__(*args, **kwargs) + self.hint_text = 'Search' + + def search(self): + request = self.text + return str(request) + + if __name__ == '__main__': NavigateApp().run() diff --git a/src/images/search.png b/src/images/search.png new file mode 100644 index 0000000000000000000000000000000000000000..42a1e45a82f694cc0dc187370b080b43ef6b8040 GIT binary patch literal 2982 zcmaJ@c{r5c7r$d7Tbb7~+4?rUp-C7^CR7ryHAz`wtceLVmMoL9OeF6hno=4>LYux? z>}x8^$cSknCQH<$B$X_o{KoV9|9hY3e9pP|p8GuKKIfdzbC`|})@vk{B>@0yY;BN( zLd{qaaWNr2GdoM|a(_1s*7`22nw?pU*e{#2vao^)1pownbV zfWesQ9QCvt35tQ*&tk}%kg*T)f+~20jyr*# z4(?{?fC>NxhcF|%fDr>-7GZ3Mekedn>s3_vuloAhHRmiu?--gTBqWp-6^+?JwaO4l zl(AoRtUwjZSkGNT$hmQk9Eq{ItMw~4M~NvaD^skH>W!n7pa-&EOEp~uJecG0{3`1) zPNCEtT?RUGb6>7&D#rxOn_sMD$E<^B540wfkSw)`&1YuCh}oT=Kr;?_>bviznj#1Z zFpM<|-M_zk zw;*^p(#!)Zy>@N1e|i55dU7>zObeL;%@*9HxAXJ!fj&MyQRLdxRzLpJWT|XSvmv)3 z2XzSQ&1A>Hb=$K$X>R4zu9WhQ5*3Pa^K?V`)ffXmVo<)zTw)f|py;9TD2H?bxCt|eWS<7m@X+GQj<}F9!lF4T&J!nt&bcnB@ z0LQzb;T0d~-kbUA)S27K7-W@KpEkrA^qwRTfO<}7|a++oGJ`UXV0Z^0va0|6P!wpnVig@i-GO{v!g~C zXrKF)85DLmuwn~8zGE-qeYUOi&m3k1=2tD3+4QE1+dq&~wo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