diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index adbcb0e9..29dc2691 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -372,7 +372,7 @@ NavigationLayout: MDRaisedButton: size_hint: 1, None height: dp(40) - on_press: root.send() + on_press: root.send(app) MDLabel: font_style: 'Title' text: 'send' diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index a5ab9d31..6c92d518 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -459,7 +459,7 @@ class DropDownWidget(BoxLayout): txt_input = ObjectProperty() rv = ObjectProperty() - def send(self): + def send(self, navApp): """Send message from one address to another.""" # pylint: disable=too-many-locals fromAddress = str(self.ids.ti.text) @@ -533,6 +533,7 @@ class DropDownWidget(BoxLayout): self.parent.parent.current = 'inbox' self.ids.btn.text = 'select' self.ids.ti.text = '' + navApp.back_press() toast('send') return None else: @@ -888,12 +889,11 @@ class Trash(Screen): for item in trash_data: meny = ThreeLineAvatarIconListItem( - text='Draft' if item[4] == 'draft' else item[1], - secondary_text=item[2] if item[2] else item[1], + text=item[1], + secondary_text=item[2], theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) - img_latter = './images/avatar.png' if item[ - 4] == 'draft' else './images/text_images/{}.png'.format( + img_latter = './images/text_images/{}.png'.format( item[2][0].upper() if (item[2][0].upper() >= 'A' and item[ 2][0].upper() <= 'Z') else '!') meny.add_widget(AvatarSampleWidget(source=img_latter)) @@ -992,7 +992,7 @@ class NavigateApp(App): def getCurrentAccountData(self, text): """Get Current Address Account Data.""" address_label = self.current_address_label( - BMConfigParser().get(text, 'label')) + BMConfigParser().get(text, 'label'), text) self.root_window.children[1].ids.toolbar.title = address_label state.association = text self.root.ids.sc1.clear_widgets() @@ -1171,16 +1171,19 @@ class NavigateApp(App): return state.all_count @staticmethod - def current_address_label(current_address=None): + def current_address_label(current_add_label = None, current_addr = None): """Getting current address labels.""" - if BMConfigParser().addresses() or current_address: - if current_address: - first_name = current_address + if BMConfigParser().addresses(): + if current_add_label: + first_name = current_add_label + addr = current_addr else: - first_name = BMConfigParser().get( - BMConfigParser().addresses()[0], 'label') + addr = BMConfigParser().addresses()[0] + first_name = BMConfigParser().get(addr, 'label') f_name = first_name.split() - return f_name[0][:14] + '...' if len(f_name[0]) > 15 else f_name[0] + label = f_name[0][:14].capitalize() + '...' if len(f_name[0]) > 15 else f_name[0].capitalize() + address = ' (' + addr[:6] + '...)' + return label + address return '' def searchQuery(self, instance, *args): @@ -1643,11 +1646,11 @@ class Draft(Screen): int(state.draft_count) - 1) msg_count_objs.allmail_cnt.badge_text = str( int(state.all_count) - 1) - msg_count_objs.trash_cnt.badge_text = str( - int(state.trash_count) + 1) + # msg_count_objs.trash_cnt.badge_text = str( + # int(state.trash_count) + 1) state.draft_count = str(int(state.draft_count) - 1) state.all_count = str(int(state.all_count) - 1) - state.trash_count = str(int(state.trash_count) + 1) + # state.trash_count = str(int(state.trash_count) + 1) self.ids.ml.remove_widget(instance.parent.parent) toast('Deleted')