From 33cbf80b11184f9903c05281a9c73ae26752b5dc Mon Sep 17 00:00:00 2001 From: navjot Date: Wed, 22 Apr 2020 22:28:16 +0530 Subject: [PATCH] worked on designing toolbar or transition on chatroom --- src/bitmessagekivy/kv/chat_list.kv | 6 +++++ src/bitmessagekivy/kv/chat_room.kv | 7 +++++- src/bitmessagekivy/mpybit.py | 40 ++++++++++++++++++++++++++---- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/bitmessagekivy/kv/chat_list.kv b/src/bitmessagekivy/kv/chat_list.kv index b982b2e4..2a480abf 100644 --- a/src/bitmessagekivy/kv/chat_list.kv +++ b/src/bitmessagekivy/kv/chat_list.kv @@ -1,5 +1,11 @@ : name: 'chlist' + canvas.before: + Color: + rgba: 1,1,1,1 + Rectangle: + pos: self.pos + size: self.size MDTabs: id: chat_panel tab_display_mode:'text' diff --git a/src/bitmessagekivy/kv/chat_room.kv b/src/bitmessagekivy/kv/chat_room.kv index a1413ae8..25edfd69 100644 --- a/src/bitmessagekivy/kv/chat_room.kv +++ b/src/bitmessagekivy/kv/chat_room.kv @@ -4,7 +4,12 @@ name: 'chroom' BoxLayout: orientation: 'vertical' - + canvas.before: + Color: + rgba: 1,1,1,1 + Rectangle: + pos: self.pos + size: self.size ScrollView: Label: id: chat_logs diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 8cc6876e..6480c0c7 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -57,6 +57,11 @@ from kivymd.uix.list import ( # ) from kivymd.uix.selectioncontrol import MDCheckbox, MDSwitch from kivymd.uix.chip import MDChip +from kivy.uix.screenmanager import ( + RiseInTransition, + SlideTransition, + FallOutTransition +) import queues from semaphores import kivyuisignaler @@ -1623,6 +1628,16 @@ class NavigateApp(MDApp): elif self.root.ids.scr_mngr.current == 'pay-options': self.set_common_header() self.root.ids.scr_mngr.current = 'payment' + elif self.root.ids.scr_mngr.current == 'chroom': + if state.association: + address_label = self.current_address_label( + BMConfigParser().get( + state.association, 'label'), state.association) + self.root.ids.toolbar.title = address_label + self.set_common_header() + self.root.ids.scr_mngr.transition = FallOutTransition() + self.root.ids.scr_mngr.current = 'chlist' + self.root.ids.scr_mngr.transition = SlideTransition() else: if state.kivyapp.variable_1: self.root.ids.scr_mngr.current = 'inbox' @@ -1743,12 +1758,21 @@ class NavigateApp(MDApp): self.root.ids.toolbar.title = '' else: self.set_common_header() + if self.root.ids.scr_mngr.current == 'chroom' and state.association: + self.root.ids.scr_mngr.transition = FallOutTransition() + address_label = self.current_address_label( + BMConfigParser().get( + state.association, 'label'), state.association) + self.root.ids.toolbar.title = address_label self.root.ids.scr_mngr.current = 'inbox' \ if state.in_composer else 'allmails'\ if state.is_allmail else state.detailPageType\ if state.detailPageType else 'myaddress'\ if self.root.ids.scr_mngr.current == 'showqrcode' else 'payment'\ - if self.root.ids.scr_mngr.current == 'pay-options' else 'inbox' + if self.root.ids.scr_mngr.current == 'pay-options' else 'chlist'\ + if self.root.ids.scr_mngr.current == 'chroom' else 'inbox' + if self.root.ids.scr_mngr.current == 'chlist': + self.root.ids.scr_mngr.transition = SlideTransition() self.root.ids.scr_mngr.transition.direction = 'right' self.root.ids.scr_mngr.transition.bind(on_complete=self.reset) if state.is_allmail or state.detailPageType == 'draft': @@ -3083,10 +3107,16 @@ class ChatList(Screen): meny.add_widget(AvatarSampleWidget( source='./images/text_images/{}.png'.format( avatarImageFirstLetter(item[0].strip())))) - # meny.bind(on_press=self.redirect_on_chat()) - meny.bind(on_press=partial( - self.redirect_on_chat,)) + meny.bind(on_release=partial( + self.redirect_to_chat, item[0], item[1])) self.ids.ml.add_widget(meny) - def redirect_on_chat(self, *args): + def redirect_to_chat(self, label, addr, *args): + """This method is redirecting on chatroom""" + self.manager.transition = RiseInTransition() + state.kivyapp.set_toolbar_for_QrCode() + label = label[:14].capitalize() + '...' if len(label) > 15 else label.capitalize() + addrs = ' (' + addr + ')' + self.manager.parent.ids.toolbar.title = label + addrs + self.manager.parent.ids.sc21.ids.chat_logs.text self.manager.current = 'chroom'