From f0494cadd4902be95d6b343c8ae3266a560a4869 Mon Sep 17 00:00:00 2001 From: surbhi Date: Wed, 17 Jul 2019 14:20:27 +0530 Subject: [PATCH] kivy toolbar title updated with new ehancements --- src/bitmessagekivy/main.kv | 198 ++++++++++++++++++++++------- src/bitmessagekivy/mpybit.py | 233 ++++++++++++++++++++++++++++++++--- src/images/down-arrow.png | Bin 0 -> 2384 bytes src/images/right-arrow.png | Bin 0 -> 3145 bytes src/state.py | 6 +- 5 files changed, 371 insertions(+), 66 deletions(-) create mode 100644 src/images/down-arrow.png create mode 100644 src/images/right-arrow.png diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index 562e9f98..7d1d380f 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -1,3 +1,4 @@ + #:import Toolbar kivymd.toolbar.Toolbar #:import ThemeManager kivymd.theming.ThemeManager #:import MDNavigationDrawer kivymd.navigationdrawer.MDNavigationDrawer @@ -34,6 +35,7 @@ #:import MDBottomNavigationItem kivymd.tabs.MDBottomNavigationItem #:import MDFloatingActionButton kivymd.button.MDFloatingActionButton #:import Factory kivy.factory.Factory +#:import MDTextButton kivymd.button.MDTextButton #:set color_button (0.784, 0.443, 0.216, 1) # brown #:set color_button_pressed (0.659, 0.522, 0.431, 1) # darker brown @@ -67,6 +69,7 @@ values: app.variable_1 on_text:app.getCurrentAccountData(self.text) on_press: app.limit_spinner() + ArrowImg: NavigationDrawerIconButton: id: inbox_cnt icon: 'email-open' @@ -80,10 +83,11 @@ on_release: app.root.ids.scr_mngr.current = 'sent' badge_text: app.mail_count(self.text) NavigationDrawerIconButton: + id: draft_cnt icon: 'message-draw' text: "Draft" - on_release: app.root.ids.scr_mngr.current = 'inbox' - badge_text: "99+" + on_release: app.root.ids.scr_mngr.current = 'draft' + badge_text: app.mail_count(self.text) NavigationDrawerIconButton: text: "Starred" icon:'star' @@ -147,6 +151,7 @@ NavigationLayout: orientation: 'vertical' Toolbar: id: toolbar + title: app.current_address_label() opacity: 1 if app.addressexist() else 0 disabled: False if app.addressexist() else True md_bg_color: app.theme_cls.primary_color @@ -197,6 +202,9 @@ NavigationLayout: id:sc14 ShowQRCode: id:sc15 + Draft: + id:sc16 + : name: 'inbox' @@ -225,9 +233,12 @@ NavigationLayout: : name: 'draft' - Label: - text:"I have a good dialox box" - color: 0,0,0,1 + ScrollView: + do_scroll_x: False + MDList: + id: ml + ComposerButton: + : name: 'test' Label: @@ -258,8 +269,10 @@ NavigationLayout: hint_text: 'type or select sender address' size_hint_y: None height: 100 + font_size: '13sp' multiline: False required: True + allow_copy: True helper_text_mode: "on_error" BoxLayout: @@ -269,9 +282,13 @@ NavigationLayout: background_color: app.theme_cls.primary_dark id: btn values: app.variable_1 - on_text: ti.text = self.text + on_text: ti.text = self.text if self.text != 'Select' else '' option_cls: Factory.get("MySpinnerOption") + background_color: color_button if self.state == 'normal' else color_button_pressed + background_down: 'atlas://data/images/defaulttheme/spinner' + color: color_font font_size: '12.5sp' + ArrowImg: BoxLayout: orientation: 'vertical' @@ -282,6 +299,7 @@ NavigationLayout: MyTextInput: id: txt_input size_hint_y: None + font_size: '13sp' height: 100 hint_text: 'type or search recipients address starting with BM-' RV: @@ -291,6 +309,7 @@ NavigationLayout: hint_text: 'subject' required: True height: 100 + font_size: '13sp' size_hint_y: None multiline: False helper_text_mode: "on_error" @@ -300,6 +319,7 @@ NavigationLayout: multiline: True hint_text: 'body' size_hint_y: None + font_size: '13sp' required: True helper_text_mode: "on_error" BoxLayout: @@ -308,14 +328,24 @@ NavigationLayout: MDRaisedButton: size_hint: 1, None height: dp(40) - text: 'send' on_press: root.send() + MDLabel: + font_style: 'Title' + text: 'send' + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' AnchorLayout: MDRaisedButton: size_hint: 1, None height: dp(40) - text: 'reset' - on_press: app.root.ids.scr_mngr.current = 'random' + on_press: app.root.ids.scr_mngr.current = 'random' + MDLabel: + font_style: 'Title' + text: 'reset' + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' : readonly: False @@ -357,7 +387,8 @@ NavigationLayout: BoxLayout: orientation: 'vertical' size_hint_y: None - height: dp(700) + height: dp(750) + padding: dp(10) BoxLayout: MDLabel: font_style: 'Body1' @@ -404,9 +435,15 @@ NavigationLayout: BoxLayout: AnchorLayout: MDRaisedButton: - size_hint: .8, .5 - text: 'proceed' + size_hint: .5, .35 + height: dp(40) on_press: app.root.ids.scr_mngr.current = 'random' + MDLabel: + font_style: 'Title' + text: 'proceed' + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' : name: 'random' @@ -415,8 +452,8 @@ NavigationLayout: orientation: 'vertical' size_hint_y: None height: self.minimum_height - padding: dp(48) - spacing: 200 + padding: dp(20) + spacing: 100 MDLabel: font_style: 'Body1' theme_text_color: 'Primary' @@ -439,13 +476,19 @@ NavigationLayout: hint_text: "Label" required: True helper_text_mode: "on_error" - MDRaisedButton: - text: 'next' - size_hint_y: 0.13 - size_hint_x: 0.8 - pos_hint: {'x': .1, 'y': 0.3} - opposite_colors: True - on_release: root.generateaddress() + BoxLayout: + AnchorLayout: + MDRaisedButton: + size_hint: .5, None + height: dp(40) + on_release: root.generateaddress() + opposite_colors: True + MDLabel: + font_style: 'Title' + text: 'next' + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' : name: 'add_sucess' @@ -466,25 +509,40 @@ NavigationLayout: BoxLayout: AnchorLayout: MDRaisedButton: - size_hint: .8, .6 - text: 'Server ' - on_press: app.root.ids.scr_mngr.current = 'random' + size_hint: .6, .55 + height: dp(40) + MDLabel: + font_style: 'Title' + text: 'Server' + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' OneLineListItem: text: "DATA SETTINGS" BoxLayout: AnchorLayout: MDRaisedButton: - size_hint: .8, .6 - text: 'Import or export data' - on_press: app.root.ids.scr_mngr.current = 'random' + size_hint: .6, .55 + height: dp(40) + MDLabel: + font_style: 'Title' + text: 'Import or export data' + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' OneLineListItem: text: "OTHER SETTINGS" BoxLayout: AnchorLayout: MDRaisedButton: - size_hint: .8, .6 - text: 'Restart background service' - on_press: app.root.ids.scr_mngr.current = 'random' + size_hint: .6, .55 + height: dp(40) + MDLabel: + font_style: 'Title' + text: 'Restart background service' + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' BoxLayout: AnchorLayout: MDLabel: @@ -549,7 +607,7 @@ NavigationLayout: orientation: 'vertical' MDTextField: id: label - multiline: True + multiline: False hint_text: "Label" required: True helper_text_mode: "on_error" @@ -612,8 +670,14 @@ NavigationLayout: BoxLayout: AnchorLayout: MDRaisedButton: - size_hint: .8, .5 - text: root.text_variable_1 + size_hint: .6, .35 + height: dp(40) + MDLabel: + font_style: 'Title' + text: root.text_variable_1 + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' MDTab: name: 'processes' text: 'Processes' @@ -628,30 +692,53 @@ NavigationLayout: BoxLayout: AnchorLayout: MDRaisedButton: - size_hint: .8, .6 - text: root.text_variable_2 + size_hint: .7, .6 + height: dp(40) + MDLabel: + font_style: 'Title' + text: root.text_variable_2 + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' OneLineListItem: text: "Brodcast" BoxLayout: AnchorLayout: MDRaisedButton: - size_hint: .8, .6 - text: root.text_variable_3 + size_hint: .7, .6 + height: dp(40) + MDLabel: + font_style: 'Title' + text: root.text_variable_3 + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' OneLineListItem: text: "publickeys" BoxLayout: AnchorLayout: MDRaisedButton: - size_hint: .8, .6 - text: root.text_variable_4 - + size_hint: .7, .6 + height: dp(40) + MDLabel: + font_style: 'Title' + text: root.text_variable_4 + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' OneLineListItem: text: "objects" BoxLayout: AnchorLayout: MDRaisedButton: - size_hint: .8, .6 - text: root.text_variable_5 + size_hint: .7, .6 + height: dp(40) + MDLabel: + font_style: 'Title' + text: root.text_variable_5 + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' : name: 'mailDetail' @@ -689,17 +776,27 @@ NavigationLayout: halign: 'left' bold: True BoxLayout: - spacing:50 + spacing:20 MDRaisedButton: size_hint: 1, None height: dp(40) - text: 'Reply' if root.page_type == 'inbox' else 'Copy' on_press: root.inbox_reply() if root.page_type == 'inbox' else root.copy_sent_mail() + MDLabel: + font_style: 'Title' + text: 'Reply' if root.page_type == 'inbox' else 'Copy' + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' MDRaisedButton: size_hint: 1, None height: dp(40) - text: 'Delete' on_press: root.delete_mail() + MDLabel: + font_style: 'Title' + text: 'Delete' + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' : size_hint_y: None @@ -715,7 +812,7 @@ NavigationLayout: elevation_normal: 8 md_bg_color: [0.941, 0, 0,1] on_press: app.root.ids.scr_mngr.current = 'create' - on_release: app.clear_composer() + on_press: app.clear_composer() : id: myadd_popup @@ -871,4 +968,11 @@ NavigationLayout: name: 'showqrcode' BoxLayout: orientation: 'vertical' - id: qr \ No newline at end of file + id: qr + + +: + source: './images/down-arrow.png' if self.parent.is_open == True else './images/right-arrow.png' + size: 15, 15 + x: self.parent.x + self.parent.width - self.width - 5 + y: self.parent.y + self.parent.height/2 - self.height + 5 \ No newline at end of file diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 851375a1..b122791f 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -47,7 +47,6 @@ import kivy_helper_search from kivy.core.window import Window from functools import partial from kivy.uix.carousel import Carousel -from kivy.garden.qrcode import QRCodeWidget from kivy.utils import platform @@ -101,7 +100,8 @@ class Inbox(Screen): carousel.data_index = 0 carousel.min_move = 0.2 del_btn = Button(text='Delete') - del_btn.background_color = (1, 0, 0, .5) + del_btn.background_normal = '' + del_btn.background_color = (1, 0, 0, 1) del_btn.bind(on_press=partial(self.delete, item['receivedTime'])) carousel.add_widget(del_btn) carousel.add_widget(meny) @@ -135,8 +135,13 @@ class Inbox(Screen): def delete(self, data_index, instance, *args): """Delete inbox mail from inbox listing""" - state.navigation_drawer_obj = self.parent.parent.parent.parent.children[2].children[0].children[0].children[0].children sqlExecute("UPDATE inbox SET folder = 'trash' WHERE received = {};".format(data_index)) + msg_count_objs = self.parent.parent.parent.parent.children[2].children[0].ids + if int(state.inbox_count) > 0: + msg_count_objs.inbox_cnt.badge_text = str(int(state.inbox_count) - 1) + msg_count_objs.trash_cnt.badge_text = str(int(state.trash_count) + 1) + state.inbox_count = str(int(state.inbox_count) - 1) + state.trash_count = str(int(state.trash_count) + 1) self.ids.ml.remove_widget(instance.parent.parent) self.update_trash() @@ -208,7 +213,22 @@ class AddressBook(Screen): meny = TwoLineAvatarIconListItem(text=item[0], secondary_text=item[1], theme_text_color='Custom',text_color=NavigateApp().theme_cls.primary_color) meny.add_widget(AvatarSampleWidget(source='./images/text_images/{}.png'.format(item[0][0].upper()))) meny.bind(on_press = partial(self.addBook_detail, item[1], item[0])) - self.ids.ml.add_widget(meny) + # self.ids.ml.add_widget(meny) + carousel = Carousel(direction='right') + if platform == 'android': + carousel.height = 140 + carousel.size_hint_y = None + carousel.ignore_perpendicular_swipes = True + carousel.data_index = 0 + carousel.min_move = 0.2 + del_btn = Button(text='Delete') + del_btn.background_normal = '' + del_btn.background_color = (1, 0, 0, 1) + del_btn.bind(on_press=partial(self.delete_address, item[1])) + carousel.add_widget(del_btn) + carousel.add_widget(meny) + carousel.index=1 + self.ids.ml.add_widget(carousel) else: content = MDLabel(font_style='Body1', theme_text_color='Primary', @@ -228,6 +248,12 @@ class AddressBook(Screen): p.open() p.set_addbook_data(address, label) + def delete_address(self, address, instance, *args): + """Delete inbox mail from inbox listing""" + self.ids.ml.remove_widget(instance.parent.parent) + sqlExecute("DELETE FROM addressbook WHERE address = '{}';".format(address)) + + class SelectableRecycleBoxLayout(FocusBehavior, LayoutSelectionBehavior, RecycleBoxLayout): ''' Adds selection and focus behaviour to the view. ''' @@ -491,7 +517,6 @@ class Sent(Screen): xAddress = 'fromaddress' queryreturn = kivy_helper_search.search_sql( xAddress, account, "sent", where, what, False) - state.totalSentMail = len(queryreturn) if state.msg_counter_objs and state.association == state.check_sent_acc: state.msg_counter_objs.send_cnt.badge_text = str(len(queryreturn)) state.sent_count = str(int(state.sent_count) + 1) @@ -513,7 +538,8 @@ class Sent(Screen): carousel.data_index = 0 carousel.min_move = 0.2 del_btn = Button(text='Delete') - del_btn.background_color = (1, 0, 0, .5) + del_btn.background_normal = '' + del_btn.background_color = (1.0, 0.0, 0.0, 1.0) del_btn.bind(on_press=partial(self.delete, item['lastactiontime'])) carousel.add_widget(del_btn) carousel.add_widget(meny) @@ -628,9 +654,9 @@ class NavigateApp(App): obj_1 = ObjectProperty() variable_1 = ListProperty(BMConfigParser().addresses()) nav_drawer = ObjectProperty() - total_sentmail = str(state.totalSentMail) state.screen_density = Window.size title = "PyBitmessage" + imgstatus = False count = 0 menu_items = [ {'viewclass': 'MDMenuItem', @@ -692,24 +718,30 @@ class NavigateApp(App): def getCurrentAccountData(self, text): """Get Current Address Account Data.""" + address_label = self.current_address_label(BMConfigParser().get(text, 'label')) + self.root_window.children[1].ids.toolbar.title = address_label state.association = text self.root.ids.sc1.clear_widgets() self.root.ids.sc4.clear_widgets() self.root.ids.sc5.clear_widgets() + self.root.ids.sc16.clear_widgets() self.root.ids.sc1.add_widget(Inbox()) self.root.ids.sc4.add_widget(Sent()) self.root.ids.sc5.add_widget(Trash()) + self.root.ids.sc16.add_widget(Draft()) self.root.ids.scr_mngr.current = 'inbox' msg_counter_objs = self.root_window.children[1].children[2].children[0].ids state.sent_count = str(sqlQuery("SELECT COUNT(*) FROM sent WHERE fromaddress = '{}' and folder = 'sent' ;".format(state.association))[0][0]) state.inbox_count = str(sqlQuery("SELECT COUNT(*) FROM inbox WHERE fromaddress = '{}' and folder = 'inbox' ;".format(state.association))[0][0]) state.trash_count = str(sqlQuery("SELECT (SELECT count(*) FROM sent where fromaddress = '{0}' and folder = 'trash' )+(SELECT count(*) FROM inbox where fromaddress = '{0}' and folder = 'trash') AS SumCount".format(state.association))[0][0]) + state.draft_count = str(sqlQuery("SELECT COUNT(*) FROM sent WHERE fromaddress = '{}' and folder = 'draft' ;".format(state.association))[0][0]) if msg_counter_objs: msg_counter_objs.send_cnt.badge_text = state.sent_count msg_counter_objs.inbox_cnt.badge_text = state.inbox_count msg_counter_objs.trash_cnt.badge_text = state.trash_count + msg_counter_objs.draft_cnt.badge_text = state.draft_count def getInboxMessageDetail(self, instance): @@ -748,17 +780,33 @@ class NavigateApp(App): spinner_obj.dropdown_cls.max_height = spinner_obj.height* max + max * 4 def on_key(self, window, key, *args): + """This method is used for going on previous screen""" if key == 27: # the esc key - if self.root.ids.scr_mngr.current_screen.name == "mailDetail": - self.root.ids.scr_mngr.current = 'sent' + if self.root.ids.scr_mngr.current == "mailDetail": + self.root.ids.scr_mngr.current = 'sent' if state.detailPageType == 'sent' else 'inbox' # this is for direction of the screen comesup - # self.root.ids.scr_mngr.transition.direction = 'right' - return True - elif self.root.ids.scr_mngr.current_screen.name == "create": + elif self.root.ids.scr_mngr.current == "create": + composer_objs = self.root + from_addr = str(self.root.children[1].children[0].children[0].children[0].children[0].ids.ti.text) + to_addr = str(self.root.children[1].children[0].children[0].children[0].children[0].ids.txt_input.text) + if from_addr and to_addr: + Draft().draft_msg(composer_objs) + # self.root.ids.scr_mngr.current self.root.ids.scr_mngr.current = 'inbox' - return True + elif self.root.ids.scr_mngr.current == "showqrcode": + self.root.ids.scr_mngr.current = 'myaddress' + elif self.root.ids.scr_mngr.current == "random": + self.root.ids.scr_mngr.current = 'login' else: - return True + self.root.ids.scr_mngr.current = 'inbox' + self.root.ids.scr_mngr.transition.direction = 'right' + self.root.ids.scr_mngr.transition.bind(on_complete=self.restart) + return True + + def restart(self, *args): + """this method is used to set transition direction""" + self.root.ids.scr_mngr.transition.direction = 'left' + self.root.ids.scr_mngr.transition.unbind(on_complete=self.restart) def status_dispatching(self, data): ackData, message = data @@ -769,7 +817,7 @@ class NavigateApp(App): """if slow down the nwe will make new composer edit screen""" composer_obj = self.root.ids.sc3.children[0].ids composer_obj.ti.text = '' - composer_obj.btn.text = '' + composer_obj.btn.text = 'Select' composer_obj.txt_input.text = '' composer_obj.subject.text = '' @@ -792,6 +840,19 @@ class NavigateApp(App): elif text == 'Trash': state.trash_count = str(sqlQuery("SELECT (SELECT count(*) FROM sent where fromaddress = '{0}' and folder = 'trash' )+(SELECT count(*) FROM inbox where fromaddress = '{0}' and folder = 'trash') AS SumCount".format(state.association))[0][0]) return state.trash_count + elif text == 'Draft': + state.draft_count = str(sqlQuery("SELECT COUNT(*) FROM sent WHERE fromaddress = '{1}' and folder = '{0}' ;".format(text.lower(), state.association))[0][0]) + return state.draft_count + + def current_address_label(self, current_address = None): + if BMConfigParser().addresses() or current_address: + if current_address: + first_name = current_address + else: + first_name = BMConfigParser().get(BMConfigParser().addresses()[0], 'label') + f_name = first_name.split() + return f_name[0][:14]+ '...' if len(f_name[0])>15 else f_name[0] + return '' class GrashofPopup(Popup): @@ -805,6 +866,15 @@ class GrashofPopup(Popup): self.size_hint_x = 0.7 def savecontact(self): + my_addresses = self.parent.children[1].children[2].children[0].ids.btn.values + entered_text = str(self.ids.label.text) + if entered_text in my_addresses: + self.ids.label.focus = True + self.ids.label.helper_text = 'Please Enter corrent address' + elif entered_text == '': + self.ids.label.focus = True + self.ids.label.helper_text = 'This field is required' + label = self.ids.label.text address = self.ids.address.text if label and address: @@ -904,16 +974,23 @@ class MailDetail(Screen): self.status = data[0][4] def delete_mail(self): + msg_count_objs =self.parent.parent.parent.parent.parent.children[2].children[0].ids if state.detailPageType == 'sent': sqlExecute("UPDATE sent SET folder = 'trash' WHERE lastactiontime = {};".format(state.sentMailTime)) + msg_count_objs.send_cnt.badge_text = str(int(state.sent_count) - 1) + state.sent_count = str(int(state.sent_count) - 1) self.parent.parent.screens[3].clear_widgets() self.parent.parent.screens[3].add_widget(Sent()) self.parent.parent.current = 'sent' elif state.detailPageType == 'inbox': sqlExecute("UPDATE inbox SET folder = 'trash' WHERE received = {};".format(state.sentMailTime)) + msg_count_objs.inbox_cnt.badge_text = str(int(state.inbox_count) - 1) + state.inbox_count = str(int(state.inbox_count) - 1) self.parent.parent.screens[0].clear_widgets() self.parent.parent.screens[0].add_widget(Inbox()) self.parent.parent.current = 'inbox' + msg_count_objs.trash_cnt.badge_text = str(int(state.trash_count) + 1) + state.trash_count = str(int(state.trash_count) + 1) self.parent.parent.screens[4].clear_widgets() self.parent.parent.screens[4].add_widget(Trash()) @@ -1006,4 +1083,128 @@ class ShowQRCode(Screen): def qrdisplay(self): self.ids.qr.clear_widgets() - self.ids.qr.add_widget(QRCodeWidget(data=self.manager.get_parent_window().children[0].address)) \ No newline at end of file + if platform == 'android': + from kivy.garden.qrcode import QRCodeWidget + self.ids.qr.add_widget(QRCodeWidget(data=self.manager.get_parent_window().children[0].address)) + + +class Draft(Screen): + """Draft screen is used to show the list of draft messages.""" + data = ListProperty() + + def __init__(self, *args, **kwargs): + super(Draft, self).__init__(*args, **kwargs) + if state.association == '': + if BMConfigParser().addresses(): + state.association = BMConfigParser().addresses()[0] + Clock.schedule_once(self.init_ui, 0) + + def init_ui(self, dt=0): + """Clock Schdule for method draft accounts.""" + self.sentaccounts() + print(dt) + + def sentaccounts(self): + """Load draft accounts.""" + account = state.association + self.loadSent(account, 'All', '') + + def loadSent(self, account, where="", what=""): + """Load draft list for Draft messages.""" + xAddress = 'fromaddress' + queryreturn = kivy_helper_search.search_sql( + xAddress, account, "draft", where, what, False) + if state.msg_counter_objs: + state.msg_counter_objs.draft_cnt.badge_text = str(len(queryreturn)) + + if queryreturn: + for mail in queryreturn: + third_text = mail[3].replace('\n', ' ') + self.data.append({'text': mail[1].strip(), 'secondary_text': mail[2][:10] + '...........' if len(mail[2]) > 10 else mail[2] + '\n' + " " + (third_text[:25] + '...!') if len(third_text) > 25 else third_text, 'lastactiontime': mail[6]}) + for item in self.data: + meny = TwoLineAvatarIconListItem(text='Draft', secondary_text=item['text'], theme_text_color= 'Custom',text_color=NavigateApp().theme_cls.primary_color) + meny.add_widget(AvatarSampleWidget(source='./images/avatar.png')) + # wimg = Image(source='/home/cis/transparent1.png', size= (10, 10)) + # meny.bind(on_press = partial(self.sent_detail, item['lastactiontime'])) + carousel = Carousel(direction='right') + # carousel = MDCardPost(text_post='Card with text',swipe=True, callback=callback) + if platform == 'android': + carousel.height = 150 + carousel.size_hint_y = None + carousel.ignore_perpendicular_swipes = True + carousel.data_index = 0 + carousel.min_move = 0.2 + del_btn = Button(text='Delete') + del_btn.background_normal = '' + del_btn.background_color = (1.0, 0.0, 0.0, 1.0) + del_btn.bind(on_press=partial(self.delete_draft, item['lastactiontime'])) + carousel.add_widget(del_btn) + carousel.add_widget(meny) + carousel.index=1 + self.ids.ml.add_widget(carousel) + else: + content = MDLabel(font_style='Body1', + theme_text_color='Primary', + text="yet no message for this account!!!!!!!!!!!!!", + halign='center', + bold=True, + size_hint_y=None, + valign='top') + self.ids.ml.add_widget(content) + + def delete_draft(self, data_index, instance, *args): + """This method is used to delete draft message permanently""" + sqlExecute("DELETE FROM sent WHERE lastactiontime = '{}';".format(data_index)) + try: + msg_count_objs = self.parent.parent.parent.parent.children[2].children[0].ids + except Exception as e: + msg_count_objs = self.parent.parent.parent.parent.parent.children[2].children[0].ids + if int(state.draft_count) > 0: + msg_count_objs.draft_cnt.badge_text = str(int(state.draft_count) - 1) + state.draft_count = str(int(state.draft_count) - 1) + self.ids.ml.remove_widget(instance.parent.parent) + + def draft_msg(self, src_object): + """This method is used for saving draft mails""" + composer_object = src_object.children[1].children[0].children[0].children[0].children[0].ids + fromAddress = str(composer_object.ti.text) + toAddress = str(composer_object.txt_input.text) + subject = str(composer_object.subject.text) + message = str(composer_object.body.text) + encoding = 3 + sendMessageToPeople = True + if sendMessageToPeople: + from addresses import decodeAddress + status, addressVersionNumber, streamNumber, ripe = decodeAddress( + toAddress) + from addresses import * + toAddress = addBMIfNotPresent(toAddress) + statusIconColor = 'red' + stealthLevel = BMConfigParser().safeGetInt( + 'bitmessagesettings', 'ackstealthlevel') + from helper_ackPayload import genAckPayload + ackdata = genAckPayload(streamNumber, stealthLevel) + t = () + sqlExecute( + '''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', + '', + toAddress, + ripe, + fromAddress, + subject, + message, + ackdata, + int(time.time()), + int(time.time()), + 0, + 'msgqueued', + 0, + 'draft', + encoding, + BMConfigParser().getint('bitmessagesettings', 'ttl')) + + state.msg_counter_objs = src_object.children[2].children[0].ids + state.draft_count = str(int(state.draft_count) + 1) + src_object.ids.sc16.clear_widgets() + src_object.ids.sc16.add_widget(Draft()) + return \ No newline at end of file diff --git a/src/images/down-arrow.png b/src/images/down-arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..bf3e864c8093738d0ab553d60af018d11f9a2ebb GIT binary patch literal 2384 zcmcImX;_l!8h()xN+DWYQtIH)Ch3T$CarTC#Thega!n1VQgTa2##|~)ktNG_lwLKnj9wHj(X*Q9KkO6;uM?Y zxf)s?kX)88LBQD*m*ptLsRtCECkkQp06Hx}6hPQ&6oh@WkWs|dD6L%J_%}y2SNL3( zC%yC9#7LkwwvA)8wL-o6AICy;_;?Jtei{a>fh!=vfDH%(EGu9Kc;J71B8&c7x(27$ zw}a^MOag1Gq4spqb%In^lQ$!>8rK;)-;@`*UszO$muJp$Vb#8~ME}I$g}dtbwog*< zHu8tjB;9HJmhVksbwt|?2BwHMAtgznoADLDwJq#_U&OS{;J6`~?4oI|L?d)%+2n3w6OC5V+6P+*{gGESC8e7e$U8rncC$ z{f?CRmKRYu>UUhUBFL7a9$6&&4+YCUe1o-rO4>GzF1lSM(HpL6oSQC+VdXkau0-JYa^!t4ak7*bQ>E@vtC z)_Vr?>;_v35wcay3DOzT+z)}rKOasaD;wx5Z6)WOtiy);O#EHWz2oH{J(BH7qv<3i zckew#+&UpBAqss@mMeFjdqndTgOWy}1Xj+cy^lt)jBVSA*5>LC|w+Qyp?WPcXHQjkm9WJsCqgNZzCDhAA{GxHb46?cM7PyWZyS7yoa5tO#y}76(3S87Pn@3yX@nOKQmQSsA-e?yn>~>P1)DM ziLfCUo9%m{K@9;^gnEpZO zTW>=Nm_jHUP(llLy*D(!HP4|Yc-VKG8b)_rL*20eiO>LAEXltf@zbqxO?Aq$*gBiT zS#asmoOCX*42rj63h}zK4*Gxjm=|T)qv;eh0bAGEIGesXpY?>ZGN)Eg?dc;_@nRX) z8F(5zA$gmnLn$u>8Qz`|J%1e0Gf(T+^dnOS$C|e6{I=)G_)HhG_6o;`^nMsUT@&>= z3*5U?PHH4n)ykxy1O3Pkk0u4&gR&iZ{9^xYT>HQ)!`g8TqTd*m&%3v*>gwL6bMA-VeHm(aJ}VBISwUa8gb;=UE?S-C~{^N(?7R&YG&Vzh8QDOVJ3f zDAOq>vmn@zc>f4AlzGgJn*}^bQ6y0aC>Uw3}7DY1sDu6dGJ-z*hQzr_N($yc5Fx_y4LEvzsS! zuCk>otY6$n`?tF1;|+w5uN_IBYe~qSh7AtZ+|v`c>9MnIVW6}1fYxE-*kL$#l?{db zl>$AeR_~n$)G=|eqRV=p*J`QPM;Q+k?q~G+$W-kI*GnHVn3wvIl(ZYeW-fUisFZZ& zTQn#5aVeU<%$4Ogk#0f9R|kz;J%JFEVR6ILes$JBCSaR!jw6Jdp<}$zVU<@ z>snP9O-Ekz0i~Rdfd;AeqXt9F2M*zR-V_OQ17z>-j`2dM6X7Y3Y3AdnmD^L3TBs{y z(Qs<#f#g=8|scm7i6~YUrf|f_8=Y-~5(x>c0{SPHX@G literal 0 HcmV?d00001 diff --git a/src/images/right-arrow.png b/src/images/right-arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..8f136a774a2f1d83fc4c367a4c49d32da82eec49 GIT binary patch literal 3145 zcmYjU2~?BE7XA~AY?5H5Y&H<#v8hN{3TQ>ZB7#IvP!?HCgh!!LMdS$@AOUQsHE4rc zgIh|4*cKNMEK-F8qY;XVB^7KyLMoQ#P)JzH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