From 51082b937612d46ac1b6656c70876064165d1720 Mon Sep 17 00:00:00 2001 From: navjot Date: Mon, 2 Mar 2020 16:12:15 +0530 Subject: [PATCH] implement new features or fixed issues --- src/bitmessagekivy/kv/common_widgets.kv | 13 +- src/bitmessagekivy/kv/credits.kv | 36 +++--- src/bitmessagekivy/kv/login.kv | 18 ++- src/bitmessagekivy/kv/maildetail.kv | 8 ++ src/bitmessagekivy/kv/popup.kv | 72 ++++++----- src/bitmessagekivy/kv/settings.kv | 61 +++++---- src/bitmessagekivy/main.kv | 27 +++- src/bitmessagekivy/mpybit.py | 160 ++++++++++++++++-------- 8 files changed, 270 insertions(+), 125 deletions(-) diff --git a/src/bitmessagekivy/kv/common_widgets.kv b/src/bitmessagekivy/kv/common_widgets.kv index 7e8291ab..e3bd5242 100644 --- a/src/bitmessagekivy/kv/common_widgets.kv +++ b/src/bitmessagekivy/kv/common_widgets.kv @@ -45,7 +45,16 @@ : - #size_hint: None, None + size_hint: None, None size: dp(36), dp(48) pos_hint: {'center_x': .95, 'center_y': .4} - on_press: app.root.ids.sc10.toggleAction(self) + on_active: app.root.ids.sc10.toggleAction(self) + +: + canvas: + Color: + # rgba: 0.5, 0.5, 0.5, 0.5 + rgba: 0,0,0,0 + Rectangle: #woohoo!!! + size: self.size + pos: self.pos \ No newline at end of file diff --git a/src/bitmessagekivy/kv/credits.kv b/src/bitmessagekivy/kv/credits.kv index 9371311f..f6d037d2 100644 --- a/src/bitmessagekivy/kv/credits.kv +++ b/src/bitmessagekivy/kv/credits.kv @@ -2,19 +2,27 @@ name: 'credits' ScrollView: do_scroll_x: False - MDList: - id: ml + BoxLayout: size_hint_y: None - height: dp(200) - OneLineListItem: + orientation: 'vertical' + OneLineListTitle: + id: cred text: "Available Credits" - BoxLayout: - AnchorLayout: - MDRaisedButton: - height: dp(40) - MDLabel: - font_style: 'H4' - text: root.available_credits - font_size: '13sp' - color: (1,1,1,1) - halign: 'center' \ No newline at end of file + divider: None + theme_text_color: 'Primary' + _no_ripple_effect: True + long_press_time: 1 + + OneLineListTitle: + id: cred + text: root.available_credits + divider: None + font_style: 'H5' + theme_text_color: 'Primary' + _no_ripple_effect: True + long_press_time: 1 + AnchorLayout: + MDRaisedButton: + height: dp(38) + text: "+Add more credits" + on_press: app.root.ids.scr_mngr.current = 'payment' diff --git a/src/bitmessagekivy/kv/login.kv b/src/bitmessagekivy/kv/login.kv index c668ebd1..fc2873bd 100644 --- a/src/bitmessagekivy/kv/login.kv +++ b/src/bitmessagekivy/kv/login.kv @@ -5,25 +5,28 @@ BoxLayout: orientation: 'vertical' size_hint_y: None - height: dp(750) + height: dp(400) + self.minimum_height padding: dp(10) BoxLayout: MDLabel: font_style: 'Subtitle2' theme_text_color: 'Primary' - text: "You may generate addresses by using either random numbers or by using a passphrase If you use a passphrase, the address is called a deterministic; address The Random Number option is selected by default but deterministic addresses have several \n pros and cons:\n" - halign: 'center' + text: root.log_text1 + halign: 'left' color:app.theme_cls.primary_dark BoxLayout: MDLabel: font_style: 'Subtitle2' theme_text_color: 'Primary' - text: "If talk about pros You can recreate your addresses on any computer from memory, You need-not worry about backing up your keys.dat file as long as you can remember your passphrase and aside talk about cons You must remember (or write down) your You must remember the address version number and the stream number along with your passphrase If you choose a weak passphrase and someone on the Internet can brute-force it, they can read your messages and send messages as you" - halign: 'center' + text: root.log_text2 + halign: 'left' color:app.theme_cls.primary_dark MDCheckbox: id: grp_chkbox_1 group: 'test' + size_hint: None, None + size: dp(48), dp(48) + pos_hint: {'center_x': .5, 'center_y': .5} active: True allow_no_selection: False MDLabel: @@ -37,6 +40,9 @@ MDCheckbox: id: grp_chkbox_1 group: 'test' + size_hint: None, None + size: dp(48), dp(48) + pos_hint: {'center_x': .5, 'center_y': .5} allow_no_selection: False MDLabel: font_style: 'Body2' @@ -84,7 +90,7 @@ MDTextField: id: label - multiline: True + multiline: False hint_text: "Label" required: True helper_text_mode: "on_error" diff --git a/src/bitmessagekivy/kv/maildetail.kv b/src/bitmessagekivy/kv/maildetail.kv index 60c6e0eb..018818f8 100644 --- a/src/bitmessagekivy/kv/maildetail.kv +++ b/src/bitmessagekivy/kv/maildetail.kv @@ -35,6 +35,14 @@ text: root.time_tag halign:'right' font_style:'Caption' + pos_hint: {'center_y': .8} + MDChip: + size_hint: (None, None) + label: root.page_type + icon: '' + pos_hint: {'center_x': .94, 'center_y': .3} + radius: 8 + height: 18 AvatarSampleWidget: source: root.avatarImg MDLabel: diff --git a/src/bitmessagekivy/kv/popup.kv b/src/bitmessagekivy/kv/popup.kv index 5e5fa241..f35ee211 100644 --- a/src/bitmessagekivy/kv/popup.kv +++ b/src/bitmessagekivy/kv/popup.kv @@ -45,6 +45,7 @@ hint_text: "Address" required: True helper_text_mode: "on_error" + multiline: False on_text: root.checkAddress_valid(self) canvas.before: Color: @@ -127,13 +128,19 @@ text: "Address" font_size: '17sp' halign: 'left' - MDLabel: - id: address - font_style: 'Body1' - theme_text_color: 'Primary' - text: root.address - font_size: '15sp' - halign: 'left' + BoxLayout: + orientation: 'horizontal' + MDLabel: + id: address + font_style: 'Body1' + theme_text_color: 'Primary' + text: root.address + font_size: '15sp' + halign: 'left' + IconRightSampleWidget: + pos_hint: {'center_x': 0, 'center_y': 1} + icon: 'content-copy' + on_press: app.copy_composer_text(root.address) BoxLayout: id: addbook_btn spacing:5 @@ -208,12 +215,18 @@ text: "Address" font_size: '17sp' halign: 'left' - MDLabel: - font_style: 'Body1' - theme_text_color: 'Primary' - text: root.address - font_size: '15sp' - halign: 'left' + BoxLayout: + orientation: 'horizontal' + MDLabel: + font_style: 'Body1' + theme_text_color: 'Primary' + text: root.address + font_size: '15sp' + halign: 'left' + IconRightSampleWidget: + pos_hint: {'center_x': 0, 'center_y': 1} + icon: 'content-copy' + on_press: app.copy_composer_text(root.address) BoxLayout: id: my_add_btn spacing:5 @@ -316,7 +329,7 @@ : id: myadd_popup size_hint : (None,None) - height: 2*(sd_label.height+ sd_btn.children[0].height) + # height: 2*(sd_label.height+ sd_btn.children[0].height) width :app.window_size[0] - (app.window_size[0]/10 if app.app_platform == 'android' else app.window_size[0]/4) background: './images/popup.jpeg' auto_dismiss: False @@ -337,22 +350,11 @@ font_size: '15sp' halign: 'left' markup: True - IconReftSampleWidget: + IconRightSampleWidget: icon: 'content-copy' - on_press: root.copy_composer_text(root.from_addr) + on_press: app.copy_composer_text(root.from_addr) BoxLayout: - size_hint_y: None - orientation: 'horizontal' - height: 50 - MDLabel: - font_style: 'Body2' - theme_text_color: 'Primary' - text: "To : " + root.to_addr - font_size: '15sp' - halign: 'left' - IconReftSampleWidget: - icon: 'content-copy' - on_press: root.copy_composer_text(root.to_addr) + id: to_addId BoxLayout: size_hint_y: None orientation: 'vertical' @@ -374,4 +376,16 @@ text: 'Cancel' font_size: '13sp' color: (1,1,1,1) - halign: 'center' \ No newline at end of file + halign: 'center' + +: + orientation: 'horizontal' + MDLabel: + font_style: 'Body2' + theme_text_color: 'Primary' + text: "To : " + root.to_addr + font_size: '15sp' + halign: 'left' + IconRightSampleWidget: + icon: 'content-copy' + on_press: app.copy_composer_text(root.to_addr) \ No newline at end of file diff --git a/src/bitmessagekivy/kv/settings.kv b/src/bitmessagekivy/kv/settings.kv index 88350a1a..8e947c2b 100644 --- a/src/bitmessagekivy/kv/settings.kv +++ b/src/bitmessagekivy/kv/settings.kv @@ -29,6 +29,22 @@ halign: 'left' pos_hint: {'center_x': 0, 'center_y': 0.6} disabled: True + BoxLayout: + orientation: 'vertical' + padding: [0, 10, 0, 0] + spacing: 10 + MDLabel: + font_style: 'Body1' + theme_text_color: 'Primary' + text: "Interface Language" + halign: 'right' + bold: True + MDDropDownItem: + id: dropdown_item + text: 'italiano' + dropdown_max_height: 150 + pos_hint: {'center_x': 0.8, 'center_y': 0} + items: [f"{i}" for i in ['System Setting','U.S. English','italiano','Esperanto','dansk','Deutsch','Pirate English','francais','Nederlands','norsk bokmal','polski','portugues europeu']] BoxLayout: size_hint_y: None orientation: 'vertical' @@ -179,28 +195,33 @@ text: "Reply below Quote" halign: 'left' pos_hint: {'x': 0, 'y': 0.1} - BoxLayout: - orientation: 'vertical' - spacing: 10 - padding: 10 - MDLabel: - font_style: 'Body1' - theme_text_color: 'Primary' - text: "Interface Language" - halign: 'left' - bold: True - MDDropDownItem: - id: dropdown_item - # on_select - text: 'italiano' - pos_hint: {'center_x': 0.1, 'center_y': 0} - items: [f"{i}" for i in ['System Setting','U.S. English','italiano','Esperanto','dansk','Deutsch','Pirate English','francais','Nederlands','norsk bokmal','polski','portugues europeu']] + Widget: + size_hint_y: None + height: 10 + # BoxLayout: + # orientation: 'vertical' + # spacing: 10 + # padding: 10 + + # MDLabel: + # font_style: 'Body1' + # theme_text_color: 'Primary' + # text: "Interface Language" + # halign: 'left' + # bold: True + # MDDropDownItem: + # id: dropdown_item + # # on_select + # text: 'italiano' + # dropdown_max_height: 150 + # pos_hint: {'center_x': 0.1, 'center_y': 0} + # items: [f"{i}" for i in ['System Setting','U.S. English','italiano','Esperanto','dansk','Deutsch','Pirate English','francais','Nederlands','norsk bokmal','polski','portugues europeu']] BoxLayout: spacing:5 orientation: 'horizontal' pos_hint: {'x':.76} MDRaisedButton: - text: 'Cancel' + text: 'Reset' MDRaisedButton: text: 'Ok' Tab: @@ -277,10 +298,8 @@ orientation: 'horizontal' MDDropDownItem: id: dropdown_item - # on_select dropdown_bg: [1, 1, 1, 1] text: 'none' - # pos_hint: {'left': 1} items: [f"{i}" for i in ['System Setting','U.S. English']] BoxLayout: orientation: 'horizontal' @@ -435,7 +454,7 @@ orientation: 'horizontal' pos_hint: {'x':.76} MDRaisedButton: - text: 'Cancel' + text: 'Reset' MDRaisedButton: text: 'Ok' Tab: @@ -502,6 +521,6 @@ # pos_hint: {'left': 0} pos_hint: {'x':.75} MDRaisedButton: - text: 'Cancel' + text: 'Reset' MDRaisedButton: text: 'Ok' diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index 5ad576c4..c507eb49 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -26,7 +26,7 @@ font_size: '12.5sp' #background_color: color_button if self.state == 'down' else color_button_pressed #background_down: 'atlas://data/images/defaulttheme/button' - background_normal: '' + background_normal: 'atlas://data/images/defaulttheme/textinput_active' background_color: app.theme_cls.primary_color color: color_font @@ -285,7 +285,32 @@ NavigationLayout: name: 'showqrcode' BoxLayout: orientation: 'vertical' + size_hint: (None, None) + pos_hint:{'center_x': .5, 'top': 0.9} + size: (app.window_size[0]/2, app.window_size[0]/2) id: qr + BoxLayout: + orientation: 'vertical' + MyMDTextField: + size_hint_y: None + font_style: 'Body1' + theme_text_color: 'Primary' + text: root.address + multiline: True + readonly: True + line_color_normal: [0,0,0,0] + _current_line_color: [0,0,0,0] + line_color_focus: [0,0,0,0] + font_size: '18sp' + bold: True + pos_hint: {'x': .26, 'y': 0.5} + # MDLabel: + # size_hint_y: None + # font_style: 'Body1' + # theme_text_color: 'Primary' + # text: "[b]BM-2cV7Y8imvAevK6z6YmhYRcj2t7rghBtDSZ[/b]" + # markup: True + # pos_hint: {'x': .28, 'y': 0.6} : name: 'starred' diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 1c22feff..a97eecc4 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -167,14 +167,14 @@ class Inbox(Screen): self.set_inboxCount(state.inbox_count) for mail in self.queryreturn: # third_text = mail[3].replace('\n', ' ') - subject = mail[3].decode() if isinstance(mail[3],bytes) else mail[3] - body = mail[5].decode() if isinstance(mail[5],bytes) else mail[5] + body = mail[3].decode() if isinstance(mail[3],bytes) else mail[3] + subject = mail[5].decode() if isinstance(mail[5],bytes) else mail[5] data.append({ 'text': mail[4].strip(), - 'secondary_text': body[:50] + '........' if len( - body) >= 50 else (body + ',' + subject.replace( - '\n', ''))[0:50] + '........', + 'secondary_text': (subject[:50] + '........' if len( + subject) >= 50 else (subject + ',' + body)[0:50] + '........').replace('\t', '').replace(' ', ''), 'msgid': mail[1], 'received': mail[6]}) + self.has_refreshed = True self.set_mdList(data) self.children[2].children[0].children[0].bind( @@ -330,6 +330,10 @@ class Inbox(Screen): Clock.schedule_once(refresh_callback, 1) +class CustomTwoLineAvatarIconListItem(TwoLineAvatarIconListItem): + pass + + class MyAddress(Screen): """MyAddress screen uses screen to show widgets of screens""" @@ -386,11 +390,12 @@ class MyAddress(Screen): 'secondary_text': address}) for item in data: is_enable = BMConfigParser().get(item['secondary_text'], 'enabled') - meny = TwoLineAvatarIconListItem( + meny = CustomTwoLineAvatarIconListItem( text=item['text'], secondary_text=item['secondary_text'], theme_text_color='Custom' if is_enable == 'true' else 'Primary', text_color=NavigateApp().theme_cls.primary_color, ) + meny.canvas.children[6].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5] meny.add_widget(AvatarSampleWidget( source='./images/text_images/{}.png'.format( avatarImageFirstLetter(item['text'].strip())))) @@ -438,13 +443,25 @@ class MyAddress(Screen): """Loads more data on scroll down""" self.set_mdList(my_addresses, my_addresses + 20) - @staticmethod - def myadd_detail(fromaddress, label, *args): + # @staticmethod + def myadd_detail(self, fromaddress, label, *args): """Load myaddresses details""" if BMConfigParser().get(fromaddress, 'enabled') == 'true': p = MyaddDetailPopup() p.open() p.set_address(fromaddress, label) + else: + width = .8 if platform == 'android' else .55 + msg_dialog = MDDialog( + text='Address is not currently active. Please click on Toggle button to active it.', + title='', size_hint=(width, .25), text_button_ok='Ok', + events_callback=self.callback_for_menu_items) + msg_dialog.open() + + @staticmethod + def callback_for_menu_items(text_item, *arg): + """Callback of alert box""" + toast(text_item) def refresh_callback(self, *args): """Method updates the state of application, @@ -480,6 +497,7 @@ class MyAddress(Screen): BMConfigParser().set(str(address), 'enabled', 'false') BMConfigParser().save() instance.parent.parent.theme_text_color = 'Primary' + instance.parent.parent.canvas.children[6].rgba = [0.5, 0.5, 0.5, 0.5] toast('Address disabled') Clock.schedule_once(self.address_permision_callback, 0) @@ -488,6 +506,7 @@ class MyAddress(Screen): BMConfigParser().set(address, 'enabled', 'true') BMConfigParser().save() instance.parent.parent.theme_text_color = 'Custom' + instance.parent.parent.canvas.children[6].rgba = [0, 0, 0, 0] toast('Address Enabled') Clock.schedule_once(self.address_permision_callback, 0) @@ -502,9 +521,9 @@ class MyAddress(Screen): """This method is used for enable or disable address""" addr = instance.parent.parent.secondary_text if instance.active: - self.disableAddress(addr, instance) - else: self.enableAddress(addr, instance) + else: + self.disableAddress(addr, instance) class AddressBook(Screen): @@ -758,9 +777,9 @@ class DropDownWidget(BoxLayout): else: msg = 'Enter a valid recipients address' elif not toAddress: - msg = 'Please fill the form' + msg = 'Please fill the form completely' else: - msg = 'Please fill the form' + msg = 'Please fill the form completely' self.address_error_message(msg) @staticmethod @@ -812,6 +831,7 @@ class MyTextInput(TextInput): def __init__(self, **kwargs): """Getting Text Input.""" super(MyTextInput, self).__init__(**kwargs) + self.__lineBreak__=0 def on_text(self, instance, value): """Find all the occurrence of the word""" @@ -844,32 +864,38 @@ class Payment(Screen): """Get the available credits""" # pylint: disable=no-self-use state.availabe_credit = instance.parent.children[1].text - existing_credits = ( - state.kivyapp.root.ids.sc18.ids.ml.children[0].children[ - 0].children[0].children[0].text) - if len(existing_credits.split(' ')) > 1: + existing_credits = state.kivyapp.root.ids.sc18.ids.cred.text + if float(existing_credits.split()[1]) > 0: toast( 'We already have added free coins' ' for the subscription to your account!') else: toast('Coins added to your account!') - state.kivyapp.root.ids.sc18.ids.ml.children[0].children[ - 0].children[0].children[0].text = '{0}'.format( - state.availabe_credit) + state.kivyapp.root.ids.sc18.ids.cred.text = '{0}'.format( + state.availabe_credit) class Credits(Screen): """Credits Method""" available_credits = StringProperty( - '{0}'.format('0')) + '{0}'.format('€ 0')) class Login(Screen): """Login Screeen""" - - pass - + log_text1 = ('You may generate addresses by using either random numbers' + ' or by using a passphrase If you use a passphrase, the address' + ' is called a deterministic; address The Random Number option is' + ' selected by default but deterministic addresses have several pros' + ' and cons:') + log_text2 = ('If talk about pros You can recreate your addresses on any computer' + ' from memory, You need-not worry about backing up your keys.dat file' + ' as long as you can remember your passphrase and aside talk about cons' + ' You must remember (or write down) your You must remember the address' + ' version number and the stream number along with your passphrase If you' + ' choose a weak passphrase and someone on the Internet can brute-force it,' + ' they can read your messages and send messages as you') class NetworkStat(Screen): """Method used to show network stat""" @@ -922,6 +948,10 @@ class Random(Screen): def generateaddress(self, navApp): """Method for Address Generator""" entered_label = str(self.ids.label.text).strip() + if not entered_label: + self.ids.label.focus = True + # self.ids.label.error = True + # self.ids.label.helper_text = 'This field is required' streamNumberForAddress = 1 label = self.ids.label.text eighteenByteRipe = False @@ -1009,9 +1039,8 @@ class Sent(Screen): for mail in self.queryreturn: data.append({ 'text': mail[1].strip(), - 'secondary_text': mail[2][:50] + '........' if len( - mail[2]) >= 50 else (mail[2] + ',' + mail[3].replace( - '\n', ''))[0:50] + '........', + 'secondary_text': (mail[2][:50] + '........' if len( + mail[2]) >= 50 else (mail[2] + ',' + mail[3])[0:50] + '........').replace('\t', '').replace(' ', ''), 'ackdata': mail[5], 'senttime': mail[6]},) self.set_mdlist(data, 0) self.has_refreshed = True @@ -1093,9 +1122,8 @@ class Sent(Screen): for mail in self.queryreturn: data.append({ 'text': mail[1].strip(), - 'secondary_text': mail[2][:50] + '........' if len( - mail[2]) >= 50 else (mail[2] + ',' + mail[3].replace( - '\n', ''))[0:50] + '........', + 'secondary_text': (mail[2][:50] + '........' if len( + mail[2]) >= 50 else (mail[2] + ',' + mail[3])[0:50] + '........').replace('\t', '').replace(' ', ''), 'ackdata': mail[5], 'senttime': mail[6]}) self.set_mdlist(data, total_sent - 1) if state.msg_counter_objs and state.association == ( @@ -1257,9 +1285,8 @@ class Trash(Screen): body = item[3].decode() if isinstance(item[3],bytes) else item[3] meny = TwoLineAvatarIconListItem( text=item[1], - secondary_text=item[2][:50] + '........' if len( - subject) >= 50 else (subject + ',' + body.replace( - '\n', ''))[0:50] + '........', + secondary_text=(item[2][:50] + '........' if len( + subject) >= 50 else (subject + ',' + body)[0:50] + '........').replace('\t', '').replace(' ', ''), theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) img_latter = './images/text_images/{}.png'.format( @@ -1603,8 +1630,8 @@ class NavigateApp(MDApp): """Saving drafts messages""" composer_objs = self.root from_addr = str(self.root.ids.sc3.children[1].ids.ti.text) - to_addr = str(self.root.ids.sc3.children[1].ids.txt_input.text) - if from_addr and to_addr and state.detailPageType != 'draft' \ + # to_addr = str(self.root.ids.sc3.children[1].ids.txt_input.text) + if from_addr and state.detailPageType != 'draft' \ and not state.in_sent_method: Draft().draft_msg(composer_objs) return @@ -1633,6 +1660,7 @@ class NavigateApp(MDApp): state.in_composer = True state.in_sent_method = False + def set_navbar_for_composer(self): """Clearing toolbar data when composer open""" self.root.ids.toolbar.left_action_items = [ @@ -1661,7 +1689,8 @@ class NavigateApp(MDApp): def back_press(self): """Method for, reverting composer to previous page""" - self.save_draft() + if self.root.ids.scr_mngr.current == 'create': + self.save_draft() if self.root.ids.scr_mngr.current == \ 'mailDetail' and state.in_search_mode: toolbar_obj = self.root.ids.toolbar @@ -1917,6 +1946,11 @@ class NavigateApp(MDApp): top_box_obj.reload() spinner_img_obj.reload() + def copy_composer_text(self, text): + """Copy the data from mail detail page""" + Clipboard.copy(text) + toast('Copied') + class GrashofPopup(Popup): """Moule for save contacts and error messages""" @@ -2045,7 +2079,7 @@ class IconLeftSampleWidget(ILeftBodyTouch, MDIconButton): pass -class IconReftSampleWidget(IRightBodyTouch, MDIconButton): +class IconRightSampleWidget(IRightBodyTouch, MDIconButton): """Right icon sample widget""" pass @@ -2101,7 +2135,7 @@ class MailDetail(Screen): """Assigning mail details""" subject = data[0][2].decode() if isinstance(data[0][2],bytes) else data[0][2] body = data[0][3].decode() if isinstance(data[0][2],bytes) else data[0][3] - self.to_addr = data[0][0] + self.to_addr = data[0][0] if len(data[0][0]) > 4 else ' ' self.from_addr = data[0][1] self.subject = subject.capitalize( @@ -2166,15 +2200,13 @@ class MailDetail(Screen): def callback_for_delete(self, dt=0): """Delete method from allmails""" - try: + if state.detailPageType: self.children[0].children[0].active = False state.kivyapp.set_common_header() self.parent.current = 'allmails' \ if state.is_allmail else state.detailPageType state.detailPageType = '' toast('Deleted') - except Exception as e: - print("Exception occures..........") def inbox_reply(self): """Reply inbox messages""" @@ -2237,7 +2269,10 @@ class MyaddDetailPopup(Popup): def send_message_from(self): """Method used to fill from address of composer autofield""" state.kivyapp.set_navbar_for_composer() - window_obj = self.parent.children[1].ids + try: + window_obj = self.parent.children[2].ids + except Exception as e: + window_obj = self.parent.children[1].ids window_obj.sc3.children[1].ids.ti.text = self.address window_obj.sc3.children[1].ids.btn.text = self.address window_obj.sc3.children[1].ids.txt_input.text = '' @@ -2288,7 +2323,10 @@ class AddbookDetailPopup(Popup): def send_message_to(self): """Method used to fill to_address of composer autofield""" state.kivyapp.set_navbar_for_composer() - window_obj = self.parent.children[1].ids + try: + window_obj = self.parent.children[2].ids + except Exception as e: + window_obj = self.parent.children[1].ids window_obj.sc3.children[1].ids.txt_input.text = self.address window_obj.sc3.children[1].ids.ti.text = '' window_obj.sc3.children[1].ids.btn.text = 'Select' @@ -2321,6 +2359,7 @@ class AddbookDetailPopup(Popup): class ShowQRCode(Screen): """ShowQRCode Screen uses to show the detail of mails""" + address = StringProperty() def qrdisplay(self): """Method used for showing QR Code""" @@ -2331,7 +2370,9 @@ class ShowQRCode(Screen): address = self.manager.get_parent_window().children[0].address except Exception: address = self.manager.get_parent_window().children[1].address + self.address = address self.ids.qr.add_widget(QRCodeWidget(data=address)) + self.ids.qr.children[0].show_border = False toast('Show QR code') @@ -2609,10 +2650,9 @@ class Allmails(Screen): subject = item[2].decode() if isinstance(item[2],bytes) else item[2] meny = TwoLineAvatarIconListItem( text=item[1], - secondary_text=body[:50] + '........' if len( - body) >= 50 else ( - body + ',' + subject.replace( - '\n', ''))[0:50] + '........', + secondary_text=(subject[:50] + '........' if len( + subject) >= 50 else ( + subject + ',' + body)[0:50] + '........').replace('\t', '').replace(' ', ''), theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) meny.add_widget(AvatarSampleWidget( @@ -2849,11 +2889,18 @@ class SenderDetailPopup(Popup): self.from_addr = from_addr time_obj = datetime.fromtimestamp(int(timeinseconds)) self.time_tag = time_obj.strftime("%d %b %Y, %I:%M %p") - - def copy_composer_text(self, text): - """Copy the data from mail detail page""" - Clipboard.copy(text) - toast('Copied') + pop_height = 1.2*(self.ids.sd_label.height+self.ids.sd_btn.children[0].height) + if len(to_addr) > 3: + self.height = 0 + self.height = pop_height + self.ids.to_addId.size_hint_y = None + self.ids.to_addId.height= 50 + frmaddbox = ToAddrBoxlayout() + frmaddbox.set_toAddress(to_addr) + self.ids.to_addId.add_widget(frmaddbox) + else: + self.height = 0 + self.height = pop_height/1.5 class OneLineListTitle(OneLineListItem): @@ -2890,4 +2937,13 @@ class OneLineListTitle(OneLineListItem): """Callback of alert box""" if text_item == 'Copy': Clipboard.copy(str(arg[0].text)) - toast(text_item) \ No newline at end of file + toast(text_item) + + +class ToAddrBoxlayout(BoxLayout): + """class for BoxLayout behaviour""" + to_addr = StringProperty() + + def set_toAddress(self, to_addr): + self.to_addr = to_addr + pass